Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Propagating packages using inner/outer

Tags:

modelica

I would like to place a "System" component in my simulation (similar to Modelica.Fluid.System and Modelica.Mechanics.MultiBody.World) from which all other components can access the Medium package, in order to set the working fluid only once for the entire flowsheet. My System is defined as follows:

model System  annotation(defaultAttributes="inner");
    replaceable package Medium = Modelica.Media.Interfaces.PartialMedium 
        annotation(choicesAllMatching=true);
    parameter Modelica.SIunits.Temperature T_amb=293.15;
    // ...
equation
    // empty
end System;

I have referenced the System in other components using outer System system;, and I can thus access all variables/parameters contained therein, e.g. system.T_amb. However, trying to pull the Medium package like this does not work:

model MixingVolume
    outer System system;
    package Medium = system.Medium;
    // ...
equation
    // ...
end MixingVolume;

I get a message saying the base class "system.Medium" is missing. (This is re-translated from an extremely poor German translation within CATIA V6's Modelica environment that I am doomed to use - perhaps the original message would have been more informative.) What am I doing wrong? I am puzzled because this...

model MixingVolume
    outer System system;
    Constant Integer nXi = system.Medium.nXi; // number of independent mass fractions
    // ...
equation
    // ...
end MixingVolume;

...works fine, so MixingVolume does see the system.Medium component. Any clues? Many thanks for any help.

like image 439
Dominic Jefferies Avatar asked Jun 13 '14 14:06

Dominic Jefferies


1 Answers

You cannot access packages inside components via dot notation.

If the first name is a component reference after dot only a component reference or a function can follow. Read the Modelica Specification: https://www.modelica.org/documents/ModelicaSpec32Revision2.pdf.

It could be a bug in the tool if system.Medium.nXi is allowed.

like image 146
Adrian Pop Avatar answered Oct 22 '22 12:10

Adrian Pop