Skip to content

Commit dc1af93

Browse files
author
Hubertus Tummescheit
authored
Merge pull request #3956 from dietmarw/AnimateTankLevel
Adds animated level on the icon layer of the OpenTank
2 parents 13818f1 + 08e3080 commit dc1af93

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

Modelica/Thermal/FluidHeatFlow/Components/OpenTank.mo

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,32 @@ equation
4545
der(H) = flowPort.H_flow + Q_flow;
4646
//pressure at bottom
4747
flowPort.p = pAmbient + m*g/ATank;
48-
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
48+
annotation (Icon(graphics={
4949
Ellipse(
5050
extent={{-80,-60},{80,-100}},
5151
fillColor={170,170,255},
5252
fillPattern=FillPattern.Sphere),
5353
Rectangle(
54-
extent={{-80,0},{80,-80}},
54+
extent={{-80,80},{80,-80}},
5555
fillPattern=FillPattern.VerticalCylinder,
56-
fillColor={170,170,255}),
56+
fillColor={255,255,255}),
5757
Rectangle(
58-
extent={{-80,80},{80,0}},
58+
extent=DynamicSelect({{-80,0},{80,-80}},
59+
{{-80,(-80+160*level/hTank)},{80,-80}}),
5960
fillPattern=FillPattern.VerticalCylinder,
60-
fillColor={255,255,255}),
61+
fillColor={170,170,255}),
6162
Ellipse(
62-
extent={{-80,100},{80,60}},
63-
fillColor={255,255,255},
63+
extent=DynamicSelect({{-80,20},{80,-20}},
64+
{{-80,(-60+160*level/hTank)},{80,(-100+160*level/hTank)}}),
65+
fillColor={170,170,255},
6466
fillPattern=FillPattern.Sphere),
6567
Ellipse(
66-
extent={{-80,20},{80,-20}},
67-
fillColor={170,170,255},
68+
extent={{-80,100},{80,60}},
69+
fillColor={255,255,255},
6870
fillPattern=FillPattern.Sphere),
6971
Line(points={{100,0},{80,0}}, thickness=0.5),
7072
Line(points={{100,-60},{80,-60}},
71-
color={238,46,47},
73+
color={238,46,47},
7274
thickness=0.5),
7375
Ellipse(
7476
extent={{72,-56},{80,-64}},
@@ -103,7 +105,17 @@ equation
103105
Line(visible=useHeatPort,
104106
points={{-90,-100},{-56,-100},{-56,-88}},
105107
color={238,46,47},
106-
thickness=0.5)}), Documentation(info="<html>
108+
thickness=0.5),
109+
Text(
110+
extent={{-95,50},{95,30}},
111+
textString="level ="),
112+
Text(
113+
extent={{-95,-30},{95,-50}},
114+
textString=DynamicSelect("%level.start", String(
115+
level,
116+
minimumLength=1,
117+
significantDigits=2)))}),
118+
Documentation(info="<html>
107119
<p>This is a simple model of an open tank with volume A*h. The level and the temperature of the medium are measured and provided as output.</p>
108120
<p>Note: If the level of the medium reaches 0 (minimum) or h (maximum), an assertion is triggered.</p>
109121
<p>Note: The flowPort is assumed to be at the bottom. Therefore the pressure at the flowPort is ambient pressure + level*rho*g.</p>

0 commit comments

Comments
 (0)