Skip to content

Commit a3bd784

Browse files
committed
Add DynamicSelect display of elevation of connector
1 parent b754322 commit a3bd784

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

OpenHPL/Data.mo

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
within OpenHPL;
22
record Data "Provides a data set of most common used settings"
33
extends Modelica.Icons.Record;
4+
parameter Boolean showElevation=true "Display elevation of connectors"
5+
annotation(Dialog(group = "Icon"),
6+
choices(checkBox = true));
47
parameter SI.Acceleration g = Modelica.Constants.g_n "Gravity constant"
58
annotation (Dialog(enable=false, group = "Constants"));
69
parameter Real gamma_air = 1.4 "Ratio of heat capacities at constant pressure (C_p) to constant volume (C_v) for air at STP"

OpenHPL/Interfaces/Contact.mo

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
within OpenHPL.Interfaces;
22
connector Contact "Water flow connector"
3+
parameter Boolean showElevation = true "Show elevation z";
34
SI.Pressure p "Contact pressure";
45
//SI.Temperature T "Contact temperature";
56
flow SI.MassFlowRate mdot "Mass flow rate through the contact";
67
SI.Height z "Elevation at connection point";
78
flow Real gz(unit="m2/s") "Auxiliary elevation flow variable (always zero, for connector balance)";
9+
810
annotation (
911
Documentation(info = "<html>
1012
<p>Contact is a basic water flow connector, which consists of water pressure, mass flow rate,
@@ -19,5 +21,10 @@ Each component provides an equation relating its connector elevations,
1921
enabling automatic propagation of absolute elevation through the system.
2022
Source components (e.g., Reservoir) set the absolute reference elevation.</li>
2123
</ul>
22-
</html>"));
23-
end Contact;
24+
</html>"),
25+
Icon(graphics = {
26+
Text(origin = {0, -175},
27+
textColor = {0, 85, 255},
28+
extent = {{-100, 100}, {100, -100}},
29+
textString = DynamicSelect("", if showElevation then String(z) else ""))}));
30+
end Contact;

OpenHPL/Interfaces/TwoContacts.mo

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
within OpenHPL.Interfaces;
22
partial model TwoContacts "Model of two connectors"
3-
Contact_i i "Inlet contact (positive design flow direction is from i to o)"
3+
outer Data data;
4+
Contact_i i(showElevation=data.showElevation) "Inlet contact (positive design flow direction is from i to o)"
45
annotation (
56
Placement(transformation(extent={{-110,-10},{-90,10}})));
6-
Contact_o o "Outlet contact (positive design flow direction is from i to o)"
7+
Contact_o o(showElevation=data.showElevation) "Outlet contact (positive design flow direction is from i to o)"
78
annotation (
89
Placement(transformation(extent={{90,-10},{110,10}})));
910
equation

OpenHPL/Waterway/Reservoir.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ model Reservoir "Model of the reservoir"
4545
SI.Height h_abs = h + o.z "Absolute water level";
4646
SI.Pressure p_o "Outlet pressure";
4747

48-
OpenHPL.Interfaces.Contact_o o(p=p_o) "Outflow from reservoir" annotation (Placement(transformation(extent={{90,-10},{110,10}}), iconTransformation(extent={{90,-10},{110,10}})));
48+
OpenHPL.Interfaces.Contact_o o(p = p_o, showElevation = data.showElevation) "Outflow from reservoir" annotation (Placement(transformation(extent={{90,-10},{110,10}}), iconTransformation(extent={{90,-10},{110,10}})));
4949
Modelica.Blocks.Interfaces.RealInput inflow=Vdot_i if useInflow "Conditional input inflow of the reservoir" annotation (Placement(transformation(
5050
origin={-120,0},
5151
extent={{-20,-20},{20,20}})));

0 commit comments

Comments
 (0)