Question

I have a question about hard stops in Modelica.Mechanics.Translational.Components.MassWithStopAndFriction. As I can understand mass should not move outside interval (smin, smax) But it actually does in my example that I include here:

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; 

simulate(ActuatorMechanics)
plot(mass.flange_a.s)

Am I doing something wrong?

Was it helpful?

Solution

This was a bug in OpenModelica. It's working since r11060 and a regression test has been added.

OTHER TIPS

Well, this is really a question for the OpenModelica developers so hopefully one of them will pop in here and answer.

Just to give you a little bit of background on what is going on in the model, when the mass hits a stop, it switches into a different state where it constrains the mass to a zero acceleration (not velocity) and computes the reaction force necessary to hold that constraint.

This complexity is due mostly to the fact that OpenModelica (and most, if not all, other Modelica tools) have difficulty handling variable index DAEs. The trick here is to detect the point at which the mass reaches its mechanical limit, use reinit to set the velocity to zero and then enforce the no acceleration constraint I mentioned above.

This all depends on the velocity being a state. It is possible to formulate a system using this component where the velocity will be prescribed on the system (and therefore not a state). In this case, the reinit has no effect. But I would suspect that you would get a singular system of equations at that point (since you'd have essentially two equations for the acceleration of the mass once the mechanical limit is reached). So I am surprised that you are seeing movement beyond those limits.

Another possibility could be that the mass starts its motion outside the mechanical limits and somehow the switch to the alternative (constrained) equations is not made.

Again, it is really a question for the OpenModelica developers. I'm just trying to provide some insights as to things that could go wrong with such a model. Although I admit such insights are not particularly useful in answering your question.

I would suggest you also contact the OpenModelica developers (in addition to posting here on StackOverflow) since they may not see this question.

Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top