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

How to setup library-application including extend/redeclare in OM?

How to setup library-application including extend/redeclare in OM?

I have Modelica code divided in a small library DEMO_v11.mo and an application D11_APP7.mo The application code include parts that adapt interface of the library to the application using: import-extend-redeclare. It all works in JModelica. Now I want to set it up in OpenModelica but I do not know how to handle my two different files. Browsing through the documentation I could find little help.

I have before managed to bring in a library and in OpenModelica add graphical notation and then compose a new model based on components from the library. However, now I need to do a more “advanced” import that extend-redeclare the imported models. Thus my problem is how to do this more “advanced” part.

Appreciate some advice, or suggestion on where to read.

Edited by: janpeter - Apr-08-19 14:54:18

Re: How to setup library-application including extend/redeclare in OM?

The answer to this questions I have found is both easy and difficult.

The easy part is that you should in OpenModelica load both the library and application code in the same way using command “File/Open Modelica/Library File(s). Then the library and the application land side by side, sort of. The icons for them appear in the pane to the left and below the MSL library Modelica. The application code can then import (and redeclare) from both the loaded library and from MSL if needed in a similar way.

The difficult part is that here seems to be bugs in OpenModelica when you refer to models in two (or more) steps instead of one. 

A code that works to import as described above are library DEMO_v15 and application D15_app7 and shown below (and slightly modified from DEMO_v11 and D11_app7 mentioned and described in another thread). The example with D11_app7 and DMEO_v11 does not work and seems to be a bug, I think.

I enclose all four files then you better see what I mean.


d11-app7.mo

DEMO-v11.mo


d15-app7.mo

DEMO-v15.mo




Edited by: janpeter - Apr-08-19 14:55:50
There are 0 guests and 0 other users also viewing this topic
You are here: