Opened 13 years ago
Last modified 13 years ago
#1687 closed defect (fixed)
MassWithStopAndFriction simulation error
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Version: | ||
Keywords: | Cc: | Martin Sjölund, Willi Braun |
Description
{{{loadString("model ActuatorMechanics
Modelica.Mechanics.Translational.Sources.Force force;
Modelica.Mechanics.Translational.Components.MassWithStopAndFriction mass(m=1,F_prop=0,F_Coulomb=10, smax=0.1, smin=0, L=0.01);
Modelica.Mechanics.Translational.Components.Spring spring(c=1000);
Modelica.Mechanics.Translational.Components.Fixed fixed;
Modelica.Mechanics.Translational.Sensors.PositionSensor sens_pos;
equation
connect(force.flange, mass.flange_a);
connect(mass.flange_b, spring.flange_a);
connect(spring.flange_b, fixed.flange);
connect(sens_pos.flange, mass.flange_a);
force.f = 100;
end ActuatorMechanics;");
loadModel(Modelica);
instantiateModel(ActuatorMechanics);
simulate(ActuatorMechanics);
plot({mass.s,mass.stopped})}}}
Note that smax=0.1, smin=0 but our mass.s goes outside this limit. The reason seems to be that
{{{ when mass.stopped <> 0 then
reinit(mass.s, if mass.stopped < 0 then mass.smin + mass.L / 2.0 else mass.smax + (-mass.L) / 2.0);
if not initial() or Real(mass.stopped) * mass.v > 0.0 then
reinit(mass.v, 0.0);
end if;
end when;}}}
is never executed. The C-code looks empty for these equations to me, but that might just be that I don't know enough about event generation.
http://stackoverflow.com/questions/9125218/on-the-using-of-masswithstopandfriction-and-hard-stops-in-openmodelica
http://openmodelica.org/index.php/forum/topic?id=513
and sent to openmodelicainterest
Yes, it's just one forgotten case of algorithm without output variables.