- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Adding external libraries in OMEdit
Adding external libraries in OMEdit
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.
- sjoelund.se
- 1700 Posts
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/
- adrpo
- 885 Posts
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
- sjoelund.se
- 1700 Posts
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.
- adeas
- 454 Posts
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/
- adrpo
- 885 Posts
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
- sjoelund.se
- 1700 Posts
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)
- sjoelund.se
- 1700 Posts
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
- sjoelund.se
- 1700 Posts
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!
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Adding external libraries in OMEdit