How to connect a mass to a telescopic piston?

112 Views Asked by At

I'd like to ask for your help again, to study my telescopic piston on OPenModelica. In particular, to simulate the action of the mass that will come to the end of my piston. To do this, I first connected my 3 cylinders to the same mass (input), but if I'm not mistaken, I can't connect 3 inputs to the same mass. Because I get this error: "[2] 14:30:47 Traduction Erreur Internal error Selection of DummyDerivatives failed due to negative system rank of -2! There are 3 unassigned equations and 1 potential states.

[3] 14:30:47 Traduction Erreur Internal error - IndexReduction.selectDummyDerivatives2new failed!

[4] 14:30:47 Traduction Erreur Internal error - IndexReduction.processComps4New failed!

[5] 14:30:47 Traduction Erreur Internal error - IndexReduction.dynamicStateSelectionWork failed!" Then I thought of measuring the force using sensors on my 3 cylinders, but I can't get to the end:enter image description here Finally, I wrote a program as follows to mean that when the first cylinder reaches its limit stop, it no longer acts on the mass (this is the case for the second and third cylinders).

if BleuStop.flange_b>0.18 then
     connect(forceSensor.flange_b, mass.flange_a) ; 
  elseif NoirStop.flange_b>0.36 then
     connect(forceSensor1.flange_b, mass.flange_a)   ;
  else
     connect(forceSensor2.flange_b, mass.flange_a);
  end if;

But I get another error « Cannot resolve type of expression BleuStop.flange_b > (0.18). The operands have types Modelica.Mechanics.Translational.Interfaces.Flange_b, Real in component <NO_COMPONENT>. » Can you please help me?

1

There are 1 best solutions below

0
marco On

I see multiple issues.

1. Illegal if conditions

The error message

The operands have types Modelica.Mechanics.Translational.Interfaces.Flange_b, Real in component <NO_COMPONENT>

tries to tell you, that BleuStop.flange_b>0.18 does not work, as you compare a connector with a scalar. flange_b contains the two variables s and f, so you must use BleuStop.flange_b.s or BleuStop.flange_b.f instead.

2. No structural variability in Modelica

If you fix your if conditions the model will still not work. The structure of a Modelica models cannot change during the simulation. Therefore it is not possible to change connections dynamically.

3. Connecting multiple flanges

Regarding

I can't connect 3 inputs to the same mass.

If you connect to a mass, you don't use inputs, you have connectors named flanges. This is an important point, as inputs also exist in Modelica (as keyword and as specialized, causal connector).

Connecting multiple components to the flange of a mass does work in general, but you have to keep in mind that the position of all connected flanges is set equal. With the connections in your screenshot you generate the following equations by connecting the stop models to the mass (neglecting the sensors, which have no physical meaning):

mass1.flange_l.s = BlueStop.flange_r.s
mass1.flange_l.s = NoirStop.flange_r.s
mass1.flange_l.s = RogueStop.flange_r.s

The cylinders are rigidly connected to the stop models, which have a fixed length L (assuming you are using Modelica.Mechanics.Translational.Components.MassWithStopAndFriction). Consequently, the position of the right flange of all three cylinders is set equal. This is probably the reason that your initial attempt did not work and you came to the wrong conclusion that multiple connections to the same flange are not possible.