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

What is the difference between a library, a package, and a model?

What is the difference between a library, a package, and a model?

So there are free libraries, commercial libraries, etc.  But looking into them, it seems they are all simply .mo files?  What is to prevent someone from simply giving away commercial libraries? (Can developers protect their creation somehow with licenses or something?)

Am I understanding what libraries/packages are:  .mo files defining the mathematical model of a given system?  (i.e. just normal Modelica code organized in a unique and meaningful way)

If that is the case, it leads me to my next question: Can my copy of OpenModelica simulate a model which uses libraries/packages I don't own?  Can I use loadFile(PathToSomeLIbrary) on any library?

And lastly, the other simulation environments (Dymola, SystemModeler, MapleSim, etc.) also work with Modelica.  When they generate .mo files, is there anything particularly special about them that wouldn't allow OpenModelica to simulate them as well?

Thanks for the help!

Re: What is the difference between a library, a package, and a model?

Some of the commercial libraries use copy protection (encryption). And only tools with the secret keys can decrypt them. OpenModelica cannot open these libraries.

There is no real difference between Modelica files and libraries except loading resources through modelica:// URIs.

If you use loadFile("path/to/library/package.mo") it will load the full library. Or just put the library in ~/.openmodelica/libraries (or even a symlink), and use loadModel.

Yes, the Dymola ones may contain syntax errors (so they won't load in OpenModelica), or illegal code (you wrote something that is not strictly speaking Modelica, but Dymola thought it was close enough). Otherwise, they work fine together.

Re: What is the difference between a library, a package, and a model?

Thank you for your help.

sjoelund.se wrote:

Some of the commercial libraries use copy protection (encryption). And only tools with the secret keys can decrypt them. OpenModelica cannot open these libraries.

Where can I find more information on this?  At what point in the "buy a library, import a library, create a model, run a simulation" process does the unencryption take place?  Do owners of the commercial libraries have access to the unencrypted libraries or does unencryption take place during the compilation?

Confused about this.  I have been searching for information regarding precisely this concept (encrypting commercial libraries) but have had no luck.

Thanks again.

Re: What is the difference between a library, a package, and a model?

Hi,

See here:
http://www.3ds.com/fileadmin/PRODUCTS/C … _Notes.pdf
Section 11.5

And in the Modelica Specification:
https://modelica.org/documents/ModelicaSpec33.pdf
18.9 Annotations for Access Control to Protect Intellectual Property

I think it depends on tools but I guess decryption happens during library loading.

Cheers,
Adrian Pop/

Re: What is the difference between a library, a package, and a model?

Also, just to give an idea what I'm trying to do (unsuccessfully) is run the following .mos:

Code:

loadModel(Modelica);

loadFile("C:/Program Files/Wolfram Research/SystemModeler 3.0.2/Libraries/BioChem 1.1/Constants.mo");
loadFile("proprietarySystemModeler.mo");
simulate(proprietarySystemModeler,outputFormat="csv", stopTime=60.0, stepSize=0.1);

So, I'm loading Modelica standard libraries.  Then I'm attempting to load the Constants.mo package from the specified directory.  Is my syntax wrong here?  I'm using Windows XP.

The .mo file is a trivial academic example, but I'll show it if you're interested:

Code:

model proprietarySystemModeler "testing proprietary libraries of System Modeler"

  Real radius(start=1.2);
  Real circumference;
  Real area;
equation
  circumference=2*BioChem.Constants.pi*radius;
  area=Modelica.Constants.pi*radius^2;
  der(radius)=1 + radius;
  annotation(Diagram(coordinateSystem(extent={{-148.5,-105.0},{148.5,105.0}}, preserveAspectRatio=true, initialScale=0.1, grid={5,5})));
end proprietarySystemModeler;

The purpose is simply to test whether another tool's library can be used in OpenModelica.  Does my implementation make sense?  I have no idea what that last line (annotation) is about.  It looks like graph settings, perhaps for System Modeler.  Is that an example of non-Modelica code, or is "annotation" supported in this way?

Re: What is the difference between a library, a package, and a model?

Use:
loadFile("C:/Program Files/Wolfram Research/SystemModeler 3.0.2/Libraries/BioChem 1.1/package.mo");

Re: What is the difference between a library, a package, and a model?

Also, I suggest you add getErrorString(); after all commands to find out if there are any issues and what they are.

Cheers,
Adrian Pop/

Re: What is the difference between a library, a package, and a model?

Thanks for your help guys!

Re: What is the difference between a library, a package, and a model?

I'm using Wolfram System Modeler and tried WSM Models in OpenModelica, what I realised was: annotations seem to be saved in another way, in openmodelica they are allways corrupted. openmodelica seems to be more "strict" regarding syntax. for example if you define a vector with a unit "Real[5] a(unit="m")" openmodelica gives an error or warning and you have to use "each", also sometimes i couldn't get complex systems to run in openmodelica and couldn't find the reason.
also: the format of the txt-file the.mo file) of wsm and om didn't match one was utf-8 and the other something else, not a big problem though...

Re: What is the difference between a library, a package, and a model?

WSM uses an older OpenModelica front-end with their own back-end. That's why you don't get the warnings for missing each. Or maybe they ignore that warning.

What do you mean by annotations being corrupted in OpenModelica? Report a bug if there are issues with the annotations:
https://trac.openmodelica.org/OpenModelica/
Note that OpenModelica only supports 3.x annotations and not 2.x or older.
We do save them (the annotations) at the end of the model as that's what the Modelica Specification says.

Also conform to the Modelica Specification all the models should be UTF8, but as you can see most of the tools do not abide by that (mostly Windows encoding).

Cheers,
Adrian Pop/

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