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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With