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

Problems with example from OpenHydraulics library

Problems with example from OpenHydraulics library

Hello Ladies and Gentleman,

I'm really new to the Modelica language and OpenModelica. I used the book from Michael Tiller to learn some basics.

Now I want to work with the OpenHydraulics library.
When trying to simulate the delivered example OpenHydraulics.Examples.Excavator.DigCycleSimulation in OpenModelica some errors appear.

Code:

[1] 11:07:15 Translation Warning

[OpenHydraulics.Basic.BaseClasses.massFlowRate_dp_WallFriction: 82:9-82:71]: Re was used before it was defined (given a value). Additional such uses may exist for the variable, but some messages were suppressed.

Code:

[2] 11:07:15 Symbolic Error

Zu wenige Gleichungen - unterbestimmtes System. Das Modell hat 2084 Gleichung(en) und 2092 Variable(n).

Even though I changed the language to english the error message appears in german.
It says that the system of equations is under-determined and that there are 2084 equations and 2092 variables.

Code:

[3] 11:07:15 Translation Error

post-optimization module encapsulateWhenConditions failed.

When trying to run this in the SimulationX trial version I'm currently testing this problem does not appear.

Can anybody give me a hint on how to run the example?
I assume when even the example can not be simulated I might experience problems on my own models.

Thanks in advance.

Edited by: Schoker - Oct-28-15 10:18:02

Re: Problems with example from OpenHydraulics library

The OpenHydraulics library isn't supported well by OpenModelica yet: https://test.openmodelica.org/libraries … rsive.html

Re: Problems with example from OpenHydraulics library

I will group the examples by issue and open tickets for them. We will see how fast we get full support for the OpenHydaulics library.

Re: Problems with example from OpenHydraulics library

FINALLY!!!

I been frustrated for a while with this library so, yesterday I took it personally I decided to track down the problem... and I think I did!  current/big_smile

At least, the excavator and several other examples (like OpenCenter) now compiles perfectly!

Is baffling how simple the solution is. It fails because of this model:   Basic.FluidPower2MechTrans

And the solution is to move everything in the 'algorithm' section to the 'equation' section

WAS:

Code:


algorithm
  assert(V > 0, "Volume in fluid chamber is negative or zero.\n" + "Increase the residualVolume or the stopStiffness");
  assert(p_vol < maxPressure or s_rel < 0, "Maxiumum pressure in chamber has been exceeded");
  when empty then
    Modelica.Utilities.Streams.print("\nWARNING: CylinderChamber has reached end of travel.");
    Modelica.Utilities.Streams.print("         This could cause erratic behavior of the simulation.");
    Modelica.Utilities.Streams.print("         (time = " + String(time) + ")");
  end when;
equation
  // medium equations
  // the pressure is the same everywhere
  for i in 1:n_ports loop
    p_vol = p[i];
  end for;
...

SHOULD BE:

Code:


equation
  assert(V > 0, "Volume in fluid chamber is negative or zero.\n" + "Increase the residualVolume or the stopStiffness");
  assert(p_vol < maxPressure or s_rel < 0, "Maxiumum pressure in chamber has been exceeded");
  when empty then
    Modelica.Utilities.Streams.print("\nWARNING: CylinderChamber has reached end of travel.");
    Modelica.Utilities.Streams.print("         This could cause erratic behavior of the simulation.");
    Modelica.Utilities.Streams.print("         (time = " + String(time) + ")");
  end when;

  // medium equations
  // the pressure is the same everywhere
  for i in 1:n_ports loop
    p_vol = p[i];
  end for;
...

and that is! so far I been able to play a little bit with the library with no problems.

Mind you, I discovered this yesterday, there could be some other problem somewhere else but I havent came across it yet.

Now Ill try to warn the maintainers of the source, lets see if Im not breaking something else and can make it into 1.9.4! current/smile

Jorge

Edited by: JOssorio - Mar-04-16 21:01:31

Re: Problems with example from OpenHydraulics library

Big thanks to JOssorio for this solution!


However the Excavator example was still not working for me. It gives the following error:

Code:


[3] 14:01:51 Translation Error
[Modelica.Mechanics.MultiBody.Visualizers: 1986:8-1987:83]: PartialModelicaServices is partial, name lookup is not allowed in partial classes.

[4] 14:01:51 Translation Error
[ModelicaServices: 653:5-654:81]: PartialModelicaServices is partial, name lookup is not allowed in partial classes.

Also the PressureCompensated & PressureCompensatedLoadSensing circuits were still not working for me, which I tracked down to the following:

Need to change OpenHydraulics.Components.MotorsPumps.PCLSPump.mo
For the swashPlatePD bloack we need to change the initType from Init.InitialState to InitPID.InitialState

Before:

Code:


  Modelica.Blocks.Continuous.LimPID swashPlatePD(
    final controllerType=Modelica.Blocks.Types.SimpleController.PD,
    k=propGain,
    Td=timeConst,
    final yMin=0,
    initType=Modelica.Blocks.Types.Init.InitialState)
    annotation (Placement(transformation(extent={{0,-36},{20,-16}},
          rotation=0)));

After

Code:


  Modelica.Blocks.Continuous.LimPID swashPlatePD(
    final controllerType=Modelica.Blocks.Types.SimpleController.PD,
    k=propGain,
    Td=timeConst,
    final yMin=0,
    initType=Modelica.Blocks.Types.InitPID.InitialState)
    annotation (Placement(transformation(extent={{0,-36},{20,-16}},
          rotation=0)));

Edited by: srideep - Jul-14-16 06:17:15
There are 0 guests and 0 other users also viewing this topic
You are here: