/
TwoWayValveTable.mo
150 lines (148 loc) · 5.84 KB
/
TwoWayValveTable.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
within Buildings.Fluid.Actuators.Valves.Examples;
model TwoWayValveTable
"Two way valve with nonlinear opening characteristics based on a table"
extends Modelica.Icons.Example;
package Medium = Buildings.Media.Water "Medium";
Modelica.Blocks.Sources.Ramp y(
height=1,
duration=1,
offset=0) "Control signal"
annotation (Placement(transformation(extent={{-40,50},{-20,70}})));
Buildings.Fluid.Sources.Boundary_pT sou(
redeclare package Medium = Medium,
use_p_in=false,
p(displayUnit="Pa") = 306000,
T=293.15,
nPorts=1) "Boundary condition for flow source"
annotation (Placement(
transformation(extent={{-90,10},{-70,30}})));
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
p(displayUnit="Pa") = 3E5,
T=293.15,
nPorts=1) "Boundary condition for flow sink"
annotation (Placement(
transformation(extent={{72,10},{52,30}})));
Valves.TwoWayTable valTab(
redeclare package Medium = Medium,
filteredOpening=false,
from_dp=true,
flowCharacteristics=datVal,
CvData=Buildings.Fluid.Types.CvTypes.Kv,
Kv=0.65,
m_flow_nominal=0.04)
"Valve model with opening characteristics based on a table"
annotation (Placement(transformation(extent={{-20,10},{0,30}})));
parameter Data.Generic datVal(
y={0,0.1667,0.3333,0.5,0.6667,1},
phi={0, 0.19, 0.35, 0.45, 0.5, 0.65}/0.65) "Valve characteristics"
annotation (Placement(transformation(extent={{60,60},{80,80}})));
Modelica.Blocks.Math.UnitConversions.To_bar to_bar
annotation (Placement(transformation(extent={{0,-46},{20,-26}})));
Sensors.RelativePressure senRelPre(redeclare package Medium = Medium)
"Pressure differential sensor"
annotation (Placement(transformation(extent={{-20,-20},{0,0}})));
Sensors.VolumeFlowRate senVolFlo(redeclare package Medium = Medium,
m_flow_nominal=0.04) "Volume flow rate sensor"
annotation (Placement(transformation(extent={{-60,10},{-40,30}})));
Modelica.Blocks.Math.Sqrt sqrt1
annotation (Placement(transformation(extent={{28,-46},{48,-26}})));
Modelica.Blocks.Math.Gain to_m3_h(k=3600) "Conversion to m3/h"
annotation (Placement(transformation(extent={{-10,-74},{10,-54}})));
Modelica.Blocks.Math.Division kv "Kv-value"
annotation (Placement(transformation(extent={{60,-80},{80,-60}})));
equation
connect(y.y,valTab. y) annotation (Line(
points={{-19,60},{-19,60},{-10,60},{-10,32}},
color={0,0,127},
pattern=LinePattern.None));
connect(sou.ports[1], senVolFlo.port_a) annotation (Line(
points={{-70,20},{-60,20}},
color={0,127,255},
smooth=Smooth.None));
connect(senVolFlo.port_b, valTab.port_a) annotation (Line(
points={{-40,20},{-20,20}},
color={0,127,255},
smooth=Smooth.None));
connect(valTab.port_a, senRelPre.port_a) annotation (Line(
points={{-20,20},{-20,-10}},
color={0,127,255},
smooth=Smooth.None));
connect(valTab.port_b, senRelPre.port_b) annotation (Line(
points={{4.44089e-16,20},{4.44089e-16,-10}},
color={0,127,255},
smooth=Smooth.None));
connect(valTab.port_b, sin.ports[1]) annotation (Line(
points={{4.44089e-16,20},{52,20}},
color={0,127,255},
smooth=Smooth.None));
connect(to_bar.u, senRelPre.p_rel) annotation (Line(
points={{-2,-36},{-10,-36},{-10,-19}},
color={0,0,127},
smooth=Smooth.None));
connect(sqrt1.u, to_bar.y) annotation (Line(
points={{26,-36},{21,-36}},
color={0,0,127},
smooth=Smooth.None));
connect(senVolFlo.V_flow, to_m3_h.u) annotation (Line(
points={{-50,31},{-50,36},{-30,36},{-30,-64},{-12,-64}},
color={0,0,127},
smooth=Smooth.None));
connect(to_m3_h.y,kv. u1) annotation (Line(
points={{11,-64},{58,-64}},
color={0,0,127},
smooth=Smooth.None));
connect(sqrt1.y,kv. u2) annotation (Line(
points={{49,-36},{54,-36},{54,-76},{58,-76}},
color={0,0,127},
smooth=Smooth.None));
annotation (experiment(StopTime=1.0),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Fluid/Actuators/Valves/Examples/TwoWayValveTable.mos"
"Simulate and plot"),
Documentation(info="<html>
<p>
Test model for a two way valve in which a table is used to specify the
opening characteristics.
The valve has the following opening characteristics, which is taken from a test case
of the IEA EBC Annex 60 project.
</p>
<table summary=\"summary\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"border-collapse:collapse;\">
<tr><td><i>y</i></td>
<td>0</td> <td>0.1667</td> <td>0.3333</td> <td>0.5</td> <td>0.6667</td> <td>1</td>
</tr>
<tr><td><i>K<sub>v</sub></i></td>
<td>0</td> <td>0.19</td> <td>0.35</td> <td>0.45</td> <td>0.5</td> <td>0.65</td> </tr>
</table>
<p>
The <i>K<sub>v</sub></i> value is the volume flow rate in m<sup>3</sup>/h at a pressure difference
of 1 bar.
Hence, the <i>K<sub>v</sub></i> value of the fully open valve is <i>K<sub>v</sub>=0.65</i>.
</p>
<p>
Plotting the variables <code>kv.y</code> versus <code>y.y</code> shows that the valve
reproduces the <i>K<sub>v</sub></i> values shown in the above table.
</p>
<p align=\"center\">
<img alt=\"image\" src=\"modelica://Buildings/Resources/Images/Fluid/Actuators/Valves/Examples/TwoWayValveTable_kv.png\"/>
</p>
<p>
The parameter <code>filterOpening</code> is set to <code>false</code>,
as this model is used to plot the flow at different opening signals
without taking into account the travel time of the actuator.
</p>
</html>", revisions="<html>
<ul>
<li>
August 12, 2014 by Michael Wetter:<br/>
Added <code>parameter</code> keyword to <code>datVal</code>,
as this is needed to asssign <code>datVal</code> to a parameter
in the instance <code>valTab</code>.
This also avoids an error in OpenModelica.
</li>
<li>
April 2, 2014 by Michael Wetter:<br/>
First implementation.
</li>
</ul>
</html>"));
end TwoWayValveTable;