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

Adding external libraries in OMEdit

Adding external libraries in OMEdit

Is it possible to add other libraries in OMEdit as well as the msl?  Maybe I'm missing something but I just can't see where to do it.

Tom

Re: Adding external libraries in OMEdit

The answer I got from one of the OMEdit developers was that it is currently not supported. The TODO-list is quite long so I don't know when it will be added.

Re: Adding external libraries in OMEdit

Hi,

Well, as a workaround you can trick OMC to think your library is part of the Modelica library.
Add your library (directory or just Library.mo) to:
c:\OpenModelica1.6.0\lib\omc\omlibrary\msl31\Modelica
Also, add in the your library top package:
within Modelica;
package YourLibrary
end YourLibrary;


Cheers,
Adrian Pop/

Re: Adding external libraries in OMEdit

Thanks, that worked.

Tom

Re: Adding external libraries in OMEdit

Is this still workaround for openmodelica 1.7.0?
Thanks.
/peb

Re: Adding external libraries in OMEdit

Sort of. I think you can also hack around with the Uses annotation of Modelica 3.1/package.mo to load your library with its proper name (it still needs to be in omlibrary though). I have not tested this myself though. And OMEdit has not improved its support for these things a lot current/sad

Re: Adding external libraries in OMEdit

HI
i've loaded Motorcycle dynamic library into OMEdit ( simply by copy files into C:\OpenModelica1.7.0\lib\omlibrary\msl31\Modelica and modifing  the package  file with this instruction
within Modelica;
package MotorcycleDynamics
end MotorcycleDynamics;
now when i launch OMedit it found the library and i see it on the tree, the problem is that when i try insert a component into a model nothing appen... does someone know what happen??
very thanks

Re: Adding external libraries in OMEdit

Hi,

The Motorcycle dynamic library is built using Modelica annotations 2.2.1 and OMEdit supports Modelica annotations 3.x. You can add the library and its components but you can't see them graphically.

Adeel.

Re: Adding external libraries in OMEdit

is not possible downgrade OMEdit to 2.2.1 ?

Re: Adding external libraries in OMEdit

Is not possible to downgrade OMEdit.
It might work if you load the library in Dymola (version 7.x) and do a conversion to Modelica 3.1. However, the result might not be usable.

Cheers,
Adrian Pop/

Re: Adding external libraries in OMEdit

Hi, just getting started here --  with the newest 1.7 version of OMEdit, and I've already got a case where I need the MSL 3.2 ( apparently, since I'm getting the error: Error: Base class Modelica.Fluid.Icons.BaseClassLibrary not found in scope Buildings.BaseClasses). Any tips? Thanks! R

Re: Adding external libraries in OMEdit

OMEdit removes Modelica.Fluid and Modelica.Media on load because OpenModelica has issues with them

Re: Adding external libraries in OMEdit

Thanks! OK, well no wonder. I guess it might want to tell us this. So there is no way to get my funky test with Buildings-0.9.0 and ExternalMedia to work? sorry for the stupid question :-)

Re: Adding external libraries in OMEdit

I think you could open the console window and send two commands:
deleteClass(Modelica)
loadModel(Modelica,{"3.1"})

And I think it might even work by only calling loadModel(Modelica) (not deleting the old one)

Re: Adding external libraries in OMEdit

In r10094+ it will be possible to modify the config-file (on Linux ~/.config/openmodelica/omedit.ini) manually and add your custom libraries.

For example, this would change the MSL version to 3.2 and also load the LinearSystems2 package:

Code:

[libraries]

Modelica=3.2
ModelicaReference=default
Modelica_LinearSystems2=default

Re: Adding external libraries in OMEdit

adrpo wrote:


Hi,

Well, as a workaround you can trick OMC to think your library is part of the Modelica library.
Add your library (directory or just Library.mo) to:
c:\OpenModelica1.6.0\lib\omc\omlibrary\msl31\Modelica
Also, add in the your library top package:
within Modelica;
package YourLibrary
end YourLibrary;


Cheers,
Adrian Pop/

Hi Adrian,
I'm following your procedure to add SpiceLib in OM. (https://github.com/modelica-3rdparty/SPICELib).

In my case there was not msl31 folder under C:\OpenModelica1.14.1-64bit\lib\omc, therefore I've created it as well as Modelica folder inside. So now I've:

C:\OpenModelica1.14.1-64bit\lib\omc\msl31\Modelica\SPICELib 1.1

Now, I don't know how to go on. I tried to open the Modelica Library in text view on OM but I cannot edit it because it's read only? Can you please help me to understand which file shall I edit to add the following lines?

within Modelica;
package SPICELib 1.1
end SPICELib 1.1;

Thanks!

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