Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Weird simulation at Basic hydraulic cylinder - Derivative[solved]

Weird simulation at Basic hydraulic cylinder - Derivative[solved]

Hi!

This is my setup:

https://www.openmodelica.org/images/agorapro/attachments/5412/mini_Markering-013.png

It's only the cylinder I have some problems with. The cylinder's code lines are those:

Code:

model Double_acting_cylinder "Hydraulic cylinder"

  // Mass of piston and rod
  parameter Modelica.SIunits.Mass M "Mass of piston and rod";
  // Area of piston cap area
  parameter EasyHydraulics.Setup.AreaUnit A1 "Area cap side";
  // Area of piston rod area
  parameter EasyHydraulics.Setup.AreaUnit A2 "Area rod side";
  // Rod lenght
  parameter Modelica.SIunits.Length L "Length of rod";
  // Volymetric efficiency of cylinder
  parameter EasyHydraulics.Setup.EfficiencyUnit ve(start = 0) "Volymetric efficiency";
  // Mechanic efficiency of cylinder
  parameter EasyHydraulics.Setup.EfficiencyUnit me(start = 0) "Mechanic efficiency";
  // Position of cylinder
  Modelica.SIunits.Position s(start = 0) "Position rod";
  // Velocity of cylinder
  Modelica.SIunits.Position v(start = 0) "Velocity rod";
  // Input of cylinder
  EasyHydraulics.Setup.Connecter C1 annotation(...);
  // Output of cylinder
  EasyHydraulics.Setup.Connecter C2 annotation(...);
  // Connection rod
  Modelica.Mechanics.Translational.Interfaces.Flange_b rod annotation(...);
equation
  // Compute the flow out and in
  C2.Q = C1.Q*A2/A1;
  // Compute the position
  rod.s = s;
  // Compute the derivative of position
  v = der(s);
  // ODE equation of the cylinder
  10 * A1 * C1.P * me = M * der(v) + rod.f + 10 * A2 * C2.P * me;
  annotation(...)
end Double_acting_cylinder;

Below the "equation". I first compute the output flow at the cylinder. Then I sett the rod's  position equal to the rod position s. Then I take the derivative of position s to find the velocity v.

After I have found the velocity v, I simulate the ordinary differential equation:

10*Cap Area * Pressure at Cap side * mechanical efficiency = Mass of (rod + piston)*accleration + force at the rod + 10*Area rod side * pressure at rod side * mechanical efficiency.

Notice that I multiply the areas with 10, because the area's is in cm^2 and not m^2. Hydraulic units.

My question is: Why does this not working? I think it has something to do with the values I sett the position of the rod because the results of position and velocity of the rod look like this:


https://www.openmodelica.org/images/agorapro/attachments/5412/mini_Markering-017.png


Is this right thing to do? Set the position of rod

Code:

rod.s = s;

Then get the force from the spring.

Code:

rod.f

Edit:

The code says:

Code:

  // Velocity of cylinder

  Modelica.SIunits.Position v(start = 0) "Velocity rod"

But it should be

Code:

  // Velocity of cylinder

  Modelica.SIunits.Velocity v(start = 0) "Velocity rod"

The results are the same anyway.

Edited by: Volvo742 - Nov-17-17 18:58:22

Re: Weird simulation at Basic hydraulic cylinder - Derivative[solved]

Found the solution!

Insted of this:

Code:

// ODE equation of the cylinder

  10 * A1 * C1.P * me = M * der(v) + rod.f + 10 * A2 * C2.P * me;

use this:

Code:

// ODE equation of the cylinder

M * der(v) = 10 * A1 * C1.P * me + rod.f + 10 * A2 * C2.P * me;

There are 0 guests and 0 other users also viewing this topic
You are here: