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:
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?
I see multiple issues.
1. Illegal if conditions
The error message
tries to tell you, that
BleuStop.flange_b>0.18does not work, as you compare a connector with a scalar.flange_bcontains the two variablessandf, so you must useBleuStop.flange_b.sorBleuStop.flange_b.finstead.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
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):
The cylinders are rigidly connected to the stop models, which have a fixed length
L(assuming you are usingModelica.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.