janpeter
janpeter

Reputation: 1074

How to change Medium in MSL Fluid Examples Tanks ThreeTanks?

In the example Modelica.Fluid.Examples.Tanks.ThreeTanks, the code shows that the application has a central variable Medium and is used in components where needed:

replaceable package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater
   constrainedby Modelica.Media.Interfaces.PartialMedium;

The application components tanks and pipes, six altogether, have a redeclare Medium statement in each component that refers to the application central variable Medium. The code design makes it convenient to change the Medium at a central place, at least code-wise.

However, when you use OpenModelica GUI you cannot access the central variable Medium, but you can access the variable in each component. Is there really no way to access the central variable from the GUI? Can you access it in some other Modelica software´s GUI?

Here is also a central model System that contains some general attributes used by components, but not Medium.

In the two following examples: TanksWithOverflow and EmptyTanks, there are no central variable Medium. Instead, each component Medium is redeclared with the full reference to the actual Medium. From the GUI you can change the Medium by going through all components, as you in fact need to do in the first example.

In several other examples like ControlledTank, AST_BatchPlant, etc. you often have a central application variable for Medium, but with the same limitations as described above, i.e. cannot be accessed from the OpenModelica GUI.

The code is identical in this respect both from MSL 4.0.0 and 3.2.3.

Thus, the question is, is there some GUI that can address the central variable and change it?

Does the difference in code between the first three examples reflect a later limitation in what to expect from GUI and that there was an earlier GUI that could handle this central Medium variable?

Upvotes: 0

Views: 116

Answers (2)

janpeter
janpeter

Reputation: 1074

The same example done in Modelon Impact is shown below for comparison.

The code is duplicated from MSL and dragged to a new canvas.

enter image description here

We see that when we select the whole application "ThreeTanks_1" we find under the headline "PROPERTIES" a field "Medium*" where we can choose a medium for the whole application in one step.

If we select a component then we address the properties of that component (not shown).

Upvotes: 0

Adrian Pop
Adrian Pop

Reputation: 4231

In Dymola or OpenModelica anyway you cannot change the MSL because is read-only, you need to duplicate the class first:

enter image description here

Then in the duplicated model you just right click on the diagram and you get this:

enter image description here

Where you select "Parameters" and you get this:

enter image description here

You need to wait a bit to get the populated list.

Upvotes: 2

Related Questions