Skip to content

Commit 4799b1a

Browse files
Add elevation display to surge tank and reservoir models (#93)
Co-authored-by: Dietmar Winkler <dietmar.winkler@dwe.no>
1 parent 9f06bde commit 4799b1a

5 files changed

Lines changed: 94 additions & 50 deletions

File tree

OpenHPL/Icons/Reservoir.mo

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
within OpenHPL.Icons;
22
partial class Reservoir "Reservoir icon"
3+
input SI.Position h_abs_ds "Absolut height of watercolumn in the surge shaft (for DynamicSelect)";
4+
input Boolean show "Show additional level info";
5+
36
annotation (
47
preferredView="icon",
5-
Icon(graphics={ Rectangle(extent={{-100,100},{100,-100}}, lineColor={28,108,200}),
8+
Icon(graphics={Rectangle(lineColor = {28, 108, 200}, extent = {{-100, 100}, {100, -100}}),
69
Text(
710
textColor={28,108,200},
811
extent={{-150,90},{150,50}},
@@ -21,5 +24,12 @@ partial class Reservoir "Reservoir icon"
2124
points={{-80,-20},{-60,0},{-20,-40},{20,0},{60,-40},{80,-20}},
2225
color={28,108,200},
2326
thickness=0.5,
24-
smooth=Smooth.Bezier)}));
25-
end Reservoir;
27+
smooth=Smooth.Bezier),
28+
Text(
29+
visible = show,
30+
textColor={28,108,200},
31+
origin = {0, -60},
32+
extent = {{-100, 20}, {100, -20}},
33+
textString = DynamicSelect("(level)", "("+String(h_abs_ds, ".1f") + ")"),
34+
textStyle = {TextStyle.Italic})}));
35+
end Reservoir;

OpenHPL/Icons/Surge.mo

Lines changed: 77 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,85 @@
11
within OpenHPL.Icons;
2+
23
partial class Surge "Surge tank/shaft icon"
3-
input SI.Length lds "Lenght of watercolumn in the surge shaft(for DynamicSelect)";
4-
input SI.Length Lds "Length of the surge shaft (for DynamicSelect)";
5-
annotation (
6-
preferredView="icon",
7-
Icon(coordinateSystem(preserveAspectRatio=false, grid={1,1}),
8-
graphics={
9-
Text(
10-
textColor={28,108,200},
11-
extent={{-150,-60},{150,-100}},
12-
textString="%name",
13-
textStyle={TextStyle.Bold}),
4+
input SI.Length h_ds "Height of watercolumn in the surge shaft (for DynamicSelect)";
5+
input SI.Length H_ds "Height of the surge shaft (for DynamicSelect)";
6+
input SI.Position h_abs_ds "Absolut height of watercolumn in the surge shaft (for DynamicSelect)";
7+
input Boolean show "Show additional level info";
8+
9+
annotation(
10+
preferredView = "icon",
11+
Icon(
12+
coordinateSystem(preserveAspectRatio = false, grid = {1, 1}),
13+
graphics = {
14+
Text(
15+
origin = {0, 10},
16+
textColor = {28, 108, 200},
17+
extent = {{-150, -60}, {150, -100}},
18+
textString = "%name",
19+
textStyle = {TextStyle.Bold}
20+
),
1421
Rectangle(
15-
extent={{-90,30},{90,-50}},
16-
lineColor={0,0,0},
17-
fillPattern=FillPattern.Solid,
18-
fillColor={175,175,175}),
22+
origin = {0, 10},
23+
fillColor = {175, 175, 175},
24+
fillPattern = FillPattern.Solid,
25+
extent = {{-90, 30}, {90, -50}}
26+
),
1927
Rectangle(
20-
extent={{-90,20},{90,-40}},
21-
lineColor={28,108,200},
22-
fillColor={0,128,255},
23-
fillPattern=FillPattern.Solid),
28+
origin = {0, 10},
29+
lineColor = {28, 108, 200},
30+
fillColor = {0, 128, 255},
31+
fillPattern = FillPattern.Solid,
32+
extent = {{-90, 20}, {90, -40}}
33+
),
2434
Rectangle(
25-
extent={{-40,90},{40,30}},
26-
lineColor={0,0,0},
27-
fillPattern=FillPattern.Solid,
28-
fillColor={175,175,175},
29-
pattern=LinePattern.None),
35+
origin = {0, 10},
36+
fillColor = {175, 175, 175},
37+
pattern = LinePattern.None,
38+
fillPattern = FillPattern.Solid,
39+
extent = {{-40, 90}, {40, 30}}
40+
),
3041
Rectangle(
31-
extent={{-30,90},{30,20}},
32-
lineColor={0,0,0},
33-
fillPattern=FillPattern.Solid,
34-
fillColor={255,255,255},
35-
pattern=LinePattern.None),
42+
origin = {0, 10},
43+
fillColor = {255, 255, 255},
44+
pattern = LinePattern.None,
45+
fillPattern = FillPattern.Solid,
46+
extent = {{-30, 90}, {30, 20}}
47+
),
3648
Rectangle(
37-
extent=DynamicSelect({{-30,60},{30,18}},
38-
{{-30,(20+70*lds/Lds)},{30,18}}),
39-
lineColor={28,108,200},
40-
fillColor={0,128,255},
41-
fillPattern=FillPattern.Solid,
42-
pattern=LinePattern.None),
49+
lineColor = {28, 108, 200},
50+
fillColor = {0, 128, 255},
51+
pattern = LinePattern.None,
52+
fillPattern = FillPattern.Solid,
53+
extent = DynamicSelect({{-30, 60}, {30, 30}}, {{-30, 30 + 70*h_ds/H_ds}, {30, 30}})
54+
),
4355
Rectangle(
44-
extent={{-30,90},{30,80}},
45-
lineColor={0,0,0},
46-
pattern=LinePattern.None),
47-
Line(points={{-40,30},{-40,90},{-30,90},{-30,20},{-90,20}}, color={0,0,0}),
48-
Line(points={{-90,-41}}, color={0,0,0}),
49-
Line(points={{-90,-40},{90,-40}}, color={0,0,0}),
50-
Line(points={{40,30},{40,90},{30,90},{30,20},{90,20}}, color={0,0,0})}));
51-
end Surge;
56+
origin = {0, 10},
57+
pattern = LinePattern.None,
58+
extent = {{-30, 90}, {30, 80}}
59+
),
60+
Line(
61+
origin = {0, 10},
62+
points = {{-40, 30}, {-40, 90}, {-30, 90}, {-30, 20}, {-90, 20}}
63+
),
64+
Line(
65+
origin = {0, 10},
66+
points = {{-90, -41}}
67+
),
68+
Line(
69+
origin = {0, 10},
70+
points = {{-90, -40}, {90, -40}}
71+
),
72+
Line(
73+
origin = {0, 10},
74+
points = {{40, 30}, {40, 90}, {30, 90}, {30, 20}, {90, 20}}
75+
),
76+
Text(
77+
visible = show,
78+
textColor = {255, 255, 255},
79+
extent = {{-30, 50}, {30, 30}},
80+
textString = DynamicSelect("(level)", "(" + String(h_abs_ds, ".1f") + ")")
81+
)
82+
}
83+
)
84+
);
85+
end Surge;

OpenHPL/Interfaces/Contact.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ arbitrary topologies including parallel pipes and loops.</li>
2424
</ul>
2525
</html>"),
2626
Icon(graphics = {
27-
Text(origin = {0, -175},
27+
Text(origin = {0, 175},
2828
textColor = {0, 85, 255},
2929
extent = {{-100, 100}, {100, -100}},
3030
textString = DynamicSelect("", if showElevation then String(elevation.z) else ""))}));

OpenHPL/Waterway/Reservoir.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
within OpenHPL.Waterway;
22
model Reservoir "Model of the reservoir"
33
outer Data data "using standard class with constants";
4-
extends OpenHPL.Icons.Reservoir;
4+
extends OpenHPL.Icons.Reservoir(h_abs_ds=h_abs,show=data.showElevation);
55
parameter SI.Height h_0=50 "Initial water level above intake"
66
annotation (Dialog(group="Setup", enable=not useLevel));
77
parameter Boolean fixElevation=false "If true (fixed), z_0 is enforced as initial value; if false (derived), elevation is determined by connected topology"
@@ -127,4 +127,4 @@ the mass and momentum balances are:</p>
127127
p<sub>atm</sub> and p<sub>o</sub> are atmospheric and outlet pressures, and F<sub>f,r</sub> is
128128
the friction term (typically small for large reservoirs).</p>
129129
</html>"));
130-
end Reservoir;
130+
end Reservoir;

OpenHPL/Waterway/SurgeTank.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
within OpenHPL.Waterway;
22
model SurgeTank "Model of the surge tank/shaft"
33
outer Data data "Using standard data set";
4-
extends OpenHPL.Icons.Surge(lds=l, Lds=L);
4+
extends OpenHPL.Icons.Surge(h_ds=h, H_ds=H, h_abs_ds=h_abs, show=data.showElevation);
55
extends OpenHPL.Interfaces.TwoContacts;
66
extends Types.FrictionSpec( final D_h = D);
77

0 commit comments

Comments
 (0)