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

Newbie help with partial model

Newbie help with partial model

Hi everyone, I have a fairly basic question as Im just starting out with the software.

In using fluid library in openmodelica, i keep getting errors because i have partial components with no fluid type set up. Eg i drag and drop a valve or pump into one of the existing examples, like heat exchanger, and it breaks it. How do i fix this? Should i be editing code directly every time i import a partial model component,  is there a way to set the fluid in the gui, or is there a global setting somewhere? I thought it would be somewhere in the "system" item but i dont see where?

Re: Newbie help with partial model

Ok so this can be fixed by editing code in the text view by redeclare package. But can it be changed in the gui?

Re: Newbie help with partial model

Ok, to put it another way-

"All the components in Modelica.Fluid use a replaceable medium package, called Medium: the model is written for a generic fluid, and a specific fluid model can then be specified when building a system model by redeclaring the package. This can be done in different ways:

If several components use the same medium, it is possible to select all of them within a GUI, and set them simultaneously (as they are all named Medium)."


HOW is it possible to "set them all simultaneously"?  Could someone please explain the process of setting them all simultaneously?

Any help would be appreciated!

Re: Newbie help with partial model

Kirk,

This is possible in Dymola but, as far as I know, it is not yet possible in OpenModelica.

I believe that the feature of replacing models and packages through the GUI has been requested for some time, but it has not yet been prioritized by the developers.

So for now, the best way to get around the problem is to insert the line

Code:

replaceable package MyMedium = Modelica.Media.Water.StandardWater;

in the beginning of you simulation model (the one with all the thermofluid components). If you want to use another medium than water, the you only need to change that one line of code.

Then in all the instantiated models using a medium model, insert:

Code:

(redeclare package Medium=MyMedium)

right after the instance name.

See, for example,

Code:

Modelica.Fluid.Examples.PumpingSystem

Regards,
Rene Just Nielsen

Re: Newbie help with partial model

Ah great, now it makes perfect sense.  Thankyou!

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