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

Modification of a standard library

Modification of a standard library

Hello !

Is it possible to modify a standard component of a standard/system library ?
I can "look" inside a component using "Open Class", but unfortunately, I cannot rename some components for example.

Thanks in advance for your answers and tips about modifying existing standard components.

Regards,
Arnaud.

Re: Modification of a standard library

The system libraries will be loaded in OMEdit as read-only. If you need something changed, the normal way is to inherit/extend from this components in your own package (or even copy the component to your package) and make your changes there.

If you really want to edit the Modelica standard library, then in principle you could change the files in the system path (e.g. /usr/lib/omlibrary/Modelica 3.2.2 on linux) with a text editor, but I would recommend to make a working copy of it to your home directory. In OMEdit you can then unload the Modelica standard library with a right-click in the libraries browser and then load your working copy instead, which will then be writable. If you need this permanently, you can remove Modelica from the system libraries in the OMEdit options and add your working copy as an user library (please see screenshot attached).

https://openmodelica.org/images/agorapro/attachments/4504/mini_OMEdit-libraries.png

Edited by: spinnau - Apr-28-18 17:48:07

Re: Modification of a standard library

You can also duplicate a class that is read only into one that you can edit and save.

Re: Modification of a standard library

Hello !

Thanks 'spinnau' and 'adrpo' for your answers !

I will test them !

Thanks again.

Re: Modification of a standard library

Hello again !

I've created a User Package but when I try to Duplicate a component, I cannot select it. I've only access to Modelica Standard Package.

How to create a Package/Library in which I can duplicate a standard component ?

Thanks again for your answers !

Best regards,

Re: Modification of a standard library

* Create a new modelica package "File | New Modelica Class"
* Select the model you want to duplicate from the MSL, right-click and choose "Duplicate"
* Click the "Browse" button
* In the "Select Path" dialog delete the path from the filter field (upper text entry box)
* Now all your loaded Modelica libraries including your newly created package should be shown
* Select your package

Possibly the duplicated model contains some relative references to other name spaces, that needs to be changed to absolute paths for the model to work, e.g.

Code:


Interfaces.HeatPort_a port

// change to
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port

Edited by: spinnau - May-03-18 15:49:31
There are 0 guests and 0 other users also viewing this topic
You are here: