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

Embed a modelica Fluid device model in a new Fluid device model

Embed a modelica Fluid device model in a new Fluid device model

Hi,
I try to make new Fluid device model by embedding from standards Fluid devices models. I have a difficulty to understand how to pass Medium properties (inheritance process).
I have this issue : " Medium is partial, name lookup is not allowed in partial classes"
An example : I try to make a very simple pipe (by hidding  most of parameters) from static pipe to use with my students.

model SimplePipe

// extends ?

  parameter Real L = 1 "Length (m)" annotation(Evaluate = true);

  Modelica.Fluid.Pipes.StaticPipe pipe(replaceable package Medium = Medium,  diameter = 1, length = L)  annotation(
    Placement(visible = true, transformation(origin = {2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Interfaces.FluidPort_a port_a annotation(
    Placement(visible = true, transformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Interfaces.FluidPort_b port_b annotation(
    Placement(visible = true, transformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {102, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(port_a, pipe.port_a) annotation(
    Line(points = {{-100, 0}, {-8, 0}}));
  connect(pipe.port_b, port_b) annotation(
    Line(points = {{12, 0}, {100, 0}}, color = {0, 127, 255}));

annotation(
    uses(Modelica(version = "3.2.3")),
    Icon(graphics = {Rectangle(fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid, extent = {{-80, 40}, {80, -40}}), Line(origin = {-69.01, -19.09}, points = {{-28.9893, 19.0923}, {-10.9893, 19.0923}}, color = {0, 0, 255}, thickness = 1), Line(origin = {57, -32.97}, points = {{23, 32.9667}, {37, 32.9667}}, color = {0, 0, 255}, thickness = 1), Line(origin = {-0.707068, 14.1414}, points = {{55, -85}, {-60, -85}}, color = {0, 128, 255}), Polygon(origin = {0, 14}, lineColor = {255, 255, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{20, -75}, {50, -85}, {20, -95}, {20, -75}}), Polygon(origin = {0, 14}, lineColor = {0, 128, 255}, fillColor = {0, 128, 255}, fillPattern = FillPattern.Solid, points = {{20, -70}, {60, -85}, {20, -100}, {20, -70}})}));
end

ysseraviva.fr/Images/SimplePipe.png


Edited by: Brunad - Feb-22-21 17:16:04
There are 0 guests and 0 other users also viewing this topic
You are here: