- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » over-constrained system
over-constrained system
over-constrained system
I'm trying to implement a double action piston using SweptVolumes but I obtain an over-constrained system with 2 equations too much. The code for the double action piston is as follows:
model DoubleActionPiston
// mechanical connection
Modelica.Mechanics.Translational.Interfaces.Flange_b flange annotation(
Placement(visible = true, transformation(origin = {104, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {104, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//hydraulic connection to piston 1
Modelica.Fluid.Interfaces.FluidPort_a port_1(redeclare package Medium = Modelica.Media.Incompressible.Examples.Glycol47) "feed piston 1" annotation(
Placement(visible = true, transformation(origin = {-104, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-104, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//hydralic connection to piston 2
Modelica.Fluid.Interfaces.FluidPort_b port_2(redeclare package Medium = Modelica.Media.Incompressible.Examples.Glycol47) "feed piston 2" annotation(
Placement(visible = true, transformation(origin = {-104, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-104, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//piston parameters
parameter Real L = 0.055 "piston stroke [m]";
parameter Real D = 0.040 "piston diameter [m]";
parameter Real d1 = 0.000 "piston 1 shaft diameter [m]"; // there is no shaft on that side
parameter Real d2 = 0.010 "piston 2 shaft diameter [m]";
parameter Real s0 = 0.0275 "piston (2) starting position [m]";
parameter Real c1 = 0.01 "piston 1 clearance [m]";
parameter Real c2 = 0.01 "piston 2 clearance [m]";
//pistons modeled as Modelica.Fluid.Machines.SweptVolume
Modelica.Fluid.Machines.SweptVolume p1(redeclare package Medium = Modelica.Media.Incompressible.Examples.Glycol47, clearance = p1.pistonCrossArea * c1, nPorts = 1, pistonCrossArea = Modelica.Constants.pi * (D ^ 2 - d1 ^ 2) / 4, s(each fixed = true, each start = L - s0)) annotation(
Placement(visible = true, transformation(origin = {-40, 40}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
Modelica.Fluid.Machines.SweptVolume p2(redeclare package Medium = Modelica.Media.Incompressible.Examples.Glycol47, clearance = p2.pistonCrossArea * c2, nPorts = 1, pistonCrossArea = Modelica.Constants.pi * (D ^ 2 - d2 ^ 2), s(each fixed = true, each start = s0)) annotation(
Placement(visible = true, transformation(origin = {40, 40}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-74, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
//hydraulic connections to the pistons
connect(port_2, p2.ports[1]) annotation( Line(points = {{-104, -40}, {80, -40}, {80, 38}, {50, 38}}));
connect(port_1, p1.ports[1]) annotation(Line(points = {{-104, 40}, {-74, 40}, {-74, 42}, {-50, 42}}));
//pistons do not move independently
p1.flange.s = L - p2.flange.s;
//piston mechanical output
flange.s = p2.flange.s;
flange.f = p1.flange.f - p2.flange.f;
annotation(
uses(Modelica(version = "3.2.2")));
end DoubleActionPiston;
As can be inferred from the code the double action piston is implemented as 2 SweptVolume pistons/cylinders, "p1" and "p2", with equations linking their position as well as the force and position at the piston shaft is collected in "flange".
As mentioned I get an over constrained system with:
"""
Check of DoubleActionPiston completed successfully.
Class DoubleActionPiston has 116 equation(s) and 114 variable(s).
62 of these are trivial equation(s).
"""
What are the two variables that are missing or which 2 equations are too much ?
Re: over-constrained system
Did you try to simulate the model? That should give the following message:
Code:
Error: Too many equations, over-determined system. The model has 116 equation(s) and 114 variable(s).
[/home/marsj/tmp/a.mo:45:3-45:39:writable] Warning: Equation 93 (size: 1) flange.f = p1.flange.f - p2.flange.f is not big enough to solve for enough variables.
Remaining unsolved variables are:
Already solved: flange.f, p1.flange.f, p2.flange.f
Equations used to solve those variables:
Equation 94 (size: 1): flange.f = 0.0
Equation 97 (size: 1): p1.flange.f = 0.0
Equation 104 (size: 1): p2.flange.f = 0.0
- sjoelund.se
- 1700 Posts
Re: over-constrained system
Note that if you do not use connect() statements, you get implicit flow=0.0 added. So always connect connectors instead of manually adding equations for them.
- sjoelund.se
- 1700 Posts
Re: over-constrained system
Hi,
Thanks for the answer. I had done it in this manner as the SweptVolumes need to move in opposite directions and their forces partially cancel each other (the difference is transferred through the external flange).
I have now produced a forceMotionInvertor as
model ForceMotionInvertor
parameter Real L = 0.055;
Modelica.Mechanics.Translational.Interfaces.Flange_b flange_b2 annotation(...);
Modelica.Mechanics.Translational.Interfaces.Flange_b flange_bE annotation(...);
Modelica.Mechanics.Translational.Interfaces.Flange_b flange_b1 annotation(...);
equation
flange_b1.s + flange_b2.s = L;
flange_b1.f + flange_b2.f + flange_bE.f = 0;
flange_bE.s = flange_b2.s;
annotation(
uses(Modelica(version = "3.2.2")));
end ForceMotionInvertor;
This appears to resolve the #equations/#variables but now I'm struggling with the signs of the various quantities (that should be another topic once I understand what I don't understand).
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » over-constrained system