modelica-3rdparty / OpenHydraulics

A free Modelica package providing components describing 1-dimensional fluid flow in hydraulic circuits.
BSD 3-Clause "New" or "Revised" License
39 stars 25 forks source link

OpenHydraulics in OpenModelica #12

Closed joehays closed 2 years ago

joehays commented 11 years ago

Hello,

I'm a brand new Modelica user. I'm trying to learn the language with OpenModelica. I'd like to use OpenHydraulics in OpenModelica (specifically in the OMEdit Connection Editor). I downloaded version 1.0.1 of OpenHydraulics and installed it in "~OpenModelica1.0.0\lib\omlibrary\OpenHydraulics 1.0.1". I added this library in the OMEdit library list. After relaunching OMEdit I do see the OpenHydraulics library and am able to browse the library, however, when I open the Excavator example and try to Instantiate or Simulate the model I get many errors of the form:

"Base class Modelica.Icons.ExamplesPackage not found in scope OpenHydraulics.Examples"

I "installed" OpenHydraulics from the .zip that I downloaded from GITHUB. I had to modify the folder name and pull the code up one folder level to get OMEdit to recognize it and allow me to browse it (meaning from "~OpenModelica1.0.0\lib\omlibrary\OpenHydraulics 1.0.1\OpenHydraulics" to "~OpenModelica1.0.0\lib\omlibrary\OpenHydraulics 1.0.1"). However, with the above errors it seems that I've not installed this correctly.

Are there some simple instructions to properly install OpenHydraulics in OpenModelica such that I can run the Excavator example in the OMEdit Connection Editor tool?

Thanks in advance.

sjoelund commented 11 years ago

First of all, the OpenHydraulics 1.0.1 release still has a version="1.0" annotation, which is just a little weird and should not affect you.

When trying the excavator example, I get another error (quite common in Modelica tools if the library is created by Dymola): [.../SubSystems/MechanicsBody_noFriction.mo:82:28-84:53:readonly] Error: Cannot resolve type of expression swing_initType == 3. The operands have types enumeration(Free, PositionVelocity, SteadyState, Position, Velocity, VelocityAcceleration, PositionVelocityAcceleration), Integer in component mechanicsBody. Error: Error occurred while flattening model OpenHydraulics.Examples.Excavator.DigCycleSimulation

Given that I get this error and you get the one about icons, I would wager that you are using MSL 3.1 in OMEdit, possibly because you are using an older version of OpenModelica. The latest nightly builds are quite stable.

joehays commented 11 years ago

I did have an older beta for OpenModelica 1.9.0. I updated to the daily build for 4/30/2013. Now I'm receiving the following error when I try to simulate the Excavator example,

"Cannot instantiate OpenHydraulics.Examples.Excavator due to restriction PACKAGE."

I found the following OpenModelica forum entry:

https://www.openmodelica.org/index.php/forum/topic?id=701

Has anyone used successfully used OpenHydraulics with OpenModelica/OMEdit? Or, has the only real testing/development been Dymola based?

Thx.

masc0122 commented 11 years ago

Hey,

also trying to use the OpenHydraulics Library in OpenModelica. While testing the excavator example i get the same error than joehays. I also get error messages when using some examples from circuits and development test. For example: Circuits->OpenCenter:

Translation 09:55:21 0:0-0:0 Error occurred while flattening model OpenHydraulics.Circuits.OpenCenter Translation 09:55:21 C:/OpenModelica1.9.0/lib/omlibrary/OpenHydraulics/Components/MotorsPumps/ConstantDisplacementPump.mo 21:3-23:68 Class oil.approxBulkModulus not found in scope OpenHydraulics.Components.MotorsPumps.ConstantDisplacementPump (looking for a function or record). Translation 09:55:21 C:/OpenModelica1.9.0/lib/omlibrary/OpenHydraulics/Fluids/BaseClasses/PartialFluid.mo 32:5-33:63 Class density not found in scope OpenHydraulics.Components.MotorsPumps.ConstantDisplacementPump.oil__approxBulkModulus (looking for a function or record).

Anybody an idea how to solve the problem? Or is OpenHydraulics not compatible with OpenModelica yet?

THX

sjoelund commented 11 years ago

I am fairly sure it shouldn't be compatible with any Modelica tool. It suffers from many of the same defects that libraries developed in Dymola do suffer from ;) Anyway, if it uses Media or Fluids, OpenModelica requires that it is written in the same style as 3.2.1. Earlier versions of Media and Fluid should not have worked in any tool, and if any of that design was copy-pasted into this library, it will need to be updated. Parts of the library does work in OpenModelica though: https://test.openmodelica.org/~marsj/OpenHydraulics/BuildModelRecursive.html

cparedis commented 11 years ago

I developed the library in Dymola and everything runs just fine there. When I first developed the library several years ago, I did copy and past from the Media library. Do you have any pointers to what kinds of problems there were with the Media library at that time? Since Dymola doesn't report any problems when I run these examples, it is difficult to debug. I will download openModelica and take a look at this over the weekend.

sjoelund commented 11 years ago

Some of the main issues concern using partial packages as if they were not partial. Things like import Modelica.Media.Interfaces.PartialMedium.Choices. I looked around and I don't think this is the main problem.

I looked a little closer into this. It seems the problem is you call functions by instance, which was not part of the 3.2 specification. It is part of 3.3 and unsupported by OpenModelica so far (except for the 3.1 version of gravityAcceleration).

vwaurich commented 7 years ago

Recently, OpenModelica overcame its problems with OpenHydraulics.