diff --git a/OpenHPL/Icons/Reservoir.mo b/OpenHPL/Icons/Reservoir.mo index 1879ded..0ca774b 100644 --- a/OpenHPL/Icons/Reservoir.mo +++ b/OpenHPL/Icons/Reservoir.mo @@ -1,8 +1,11 @@ within OpenHPL.Icons; partial class Reservoir "Reservoir icon" + input SI.Position h_abs_ds "Absolut height of watercolumn in the surge shaft (for DynamicSelect)"; + input Boolean show "Show additional level info"; + annotation ( preferredView="icon", - Icon(graphics={ Rectangle(extent={{-100,100},{100,-100}}, lineColor={28,108,200}), + Icon(graphics={Rectangle(lineColor = {28, 108, 200}, extent = {{-100, 100}, {100, -100}}), Text( textColor={28,108,200}, extent={{-150,90},{150,50}}, @@ -21,5 +24,12 @@ partial class Reservoir "Reservoir icon" points={{-80,-20},{-60,0},{-20,-40},{20,0},{60,-40},{80,-20}}, color={28,108,200}, thickness=0.5, - smooth=Smooth.Bezier)})); -end Reservoir; + smooth=Smooth.Bezier), + Text( + visible = show, + textColor={28,108,200}, + origin = {0, -60}, + extent = {{-100, 20}, {100, -20}}, + textString = DynamicSelect("(level)", "("+String(h_abs_ds, ".1f") + ")"), + textStyle = {TextStyle.Italic})})); +end Reservoir; \ No newline at end of file diff --git a/OpenHPL/Icons/Surge.mo b/OpenHPL/Icons/Surge.mo index 3fb2e06..fe0a9e4 100644 --- a/OpenHPL/Icons/Surge.mo +++ b/OpenHPL/Icons/Surge.mo @@ -1,51 +1,85 @@ within OpenHPL.Icons; + partial class Surge "Surge tank/shaft icon" - input SI.Length lds "Lenght of watercolumn in the surge shaft(for DynamicSelect)"; - input SI.Length Lds "Length of the surge shaft (for DynamicSelect)"; - annotation ( - preferredView="icon", - Icon(coordinateSystem(preserveAspectRatio=false, grid={1,1}), - graphics={ - Text( - textColor={28,108,200}, - extent={{-150,-60},{150,-100}}, - textString="%name", - textStyle={TextStyle.Bold}), + input SI.Length h_ds "Height of watercolumn in the surge shaft (for DynamicSelect)"; + input SI.Length H_ds "Height of the surge shaft (for DynamicSelect)"; + input SI.Position h_abs_ds "Absolut height of watercolumn in the surge shaft (for DynamicSelect)"; + input Boolean show "Show additional level info"; + + annotation( + preferredView = "icon", + Icon( + coordinateSystem(preserveAspectRatio = false, grid = {1, 1}), + graphics = { + Text( + origin = {0, 10}, + textColor = {28, 108, 200}, + extent = {{-150, -60}, {150, -100}}, + textString = "%name", + textStyle = {TextStyle.Bold} + ), Rectangle( - extent={{-90,30},{90,-50}}, - lineColor={0,0,0}, - fillPattern=FillPattern.Solid, - fillColor={175,175,175}), + origin = {0, 10}, + fillColor = {175, 175, 175}, + fillPattern = FillPattern.Solid, + extent = {{-90, 30}, {90, -50}} + ), Rectangle( - extent={{-90,20},{90,-40}}, - lineColor={28,108,200}, - fillColor={0,128,255}, - fillPattern=FillPattern.Solid), + origin = {0, 10}, + lineColor = {28, 108, 200}, + fillColor = {0, 128, 255}, + fillPattern = FillPattern.Solid, + extent = {{-90, 20}, {90, -40}} + ), Rectangle( - extent={{-40,90},{40,30}}, - lineColor={0,0,0}, - fillPattern=FillPattern.Solid, - fillColor={175,175,175}, - pattern=LinePattern.None), + origin = {0, 10}, + fillColor = {175, 175, 175}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + extent = {{-40, 90}, {40, 30}} + ), Rectangle( - extent={{-30,90},{30,20}}, - lineColor={0,0,0}, - fillPattern=FillPattern.Solid, - fillColor={255,255,255}, - pattern=LinePattern.None), + origin = {0, 10}, + fillColor = {255, 255, 255}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + extent = {{-30, 90}, {30, 20}} + ), Rectangle( - extent=DynamicSelect({{-30,60},{30,18}}, - {{-30,(20+70*lds/Lds)},{30,18}}), - lineColor={28,108,200}, - fillColor={0,128,255}, - fillPattern=FillPattern.Solid, - pattern=LinePattern.None), + lineColor = {28, 108, 200}, + fillColor = {0, 128, 255}, + pattern = LinePattern.None, + fillPattern = FillPattern.Solid, + extent = DynamicSelect({{-30, 60}, {30, 30}}, {{-30, 30 + 70*h_ds/H_ds}, {30, 30}}) + ), Rectangle( - extent={{-30,90},{30,80}}, - lineColor={0,0,0}, - pattern=LinePattern.None), - Line(points={{-40,30},{-40,90},{-30,90},{-30,20},{-90,20}}, color={0,0,0}), - Line(points={{-90,-41}}, color={0,0,0}), - Line(points={{-90,-40},{90,-40}}, color={0,0,0}), - Line(points={{40,30},{40,90},{30,90},{30,20},{90,20}}, color={0,0,0})})); -end Surge; + origin = {0, 10}, + pattern = LinePattern.None, + extent = {{-30, 90}, {30, 80}} + ), + Line( + origin = {0, 10}, + points = {{-40, 30}, {-40, 90}, {-30, 90}, {-30, 20}, {-90, 20}} + ), + Line( + origin = {0, 10}, + points = {{-90, -41}} + ), + Line( + origin = {0, 10}, + points = {{-90, -40}, {90, -40}} + ), + Line( + origin = {0, 10}, + points = {{40, 30}, {40, 90}, {30, 90}, {30, 20}, {90, 20}} + ), + Text( + visible = show, + textColor = {255, 255, 255}, + extent = {{-30, 50}, {30, 30}}, + textString = DynamicSelect("(level)", "(" + String(h_abs_ds, ".1f") + ")") + ) + } + ) + ); +end Surge; \ No newline at end of file diff --git a/OpenHPL/Interfaces/Contact.mo b/OpenHPL/Interfaces/Contact.mo index 9e273c3..ba9bdf0 100644 --- a/OpenHPL/Interfaces/Contact.mo +++ b/OpenHPL/Interfaces/Contact.mo @@ -24,7 +24,7 @@ arbitrary topologies including parallel pipes and loops. "), Icon(graphics = { - Text(origin = {0, -175}, + Text(origin = {0, 175}, textColor = {0, 85, 255}, extent = {{-100, 100}, {100, -100}}, textString = DynamicSelect("", if showElevation then String(elevation.z) else ""))})); diff --git a/OpenHPL/Waterway/Reservoir.mo b/OpenHPL/Waterway/Reservoir.mo index afa4f22..0b3b92e 100644 --- a/OpenHPL/Waterway/Reservoir.mo +++ b/OpenHPL/Waterway/Reservoir.mo @@ -1,7 +1,7 @@ within OpenHPL.Waterway; model Reservoir "Model of the reservoir" outer Data data "using standard class with constants"; - extends OpenHPL.Icons.Reservoir; + extends OpenHPL.Icons.Reservoir(h_abs_ds=h_abs,show=data.showElevation); parameter SI.Height h_0=50 "Initial water level above intake" annotation (Dialog(group="Setup", enable=not useLevel)); 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:

patm and po are atmospheric and outlet pressures, and Ff,r is the friction term (typically small for large reservoirs).

")); -end Reservoir; +end Reservoir; \ No newline at end of file diff --git a/OpenHPL/Waterway/SurgeTank.mo b/OpenHPL/Waterway/SurgeTank.mo index e674200..daacf04 100644 --- a/OpenHPL/Waterway/SurgeTank.mo +++ b/OpenHPL/Waterway/SurgeTank.mo @@ -1,7 +1,7 @@ within OpenHPL.Waterway; model SurgeTank "Model of the surge tank/shaft" outer Data data "Using standard data set"; - extends OpenHPL.Icons.Surge(lds=l, Lds=L); + extends OpenHPL.Icons.Surge(h_ds=h, H_ds=H, h_abs_ds=h_abs, show=data.showElevation); extends OpenHPL.Interfaces.TwoContacts; extends Types.FrictionSpec( final D_h = D);