Skip to content

Commit 5ebe3e8

Browse files
Enable computation of Q_flow and P depending on operating mode
1 parent 807a8f1 commit 5ebe3e8

3 files changed

Lines changed: 188 additions & 98 deletions

File tree

Buildings/Fluid/Chillers/ModularReversible/RefrigerantCycle/TableData2DLoadDep.mo

Lines changed: 94 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -33,141 +33,178 @@ model TableData2DLoadDep
3333
final fileName=dat.fileName)
3434
"Compute heat flow rate and input power"
3535
annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=-90,
36-
origin={90,30})));
36+
origin={120,0})));
3737
Buildings.Controls.OBC.CDL.Routing.RealExtractor extBusSig[6](
3838
each final nin=2)
3939
"Extract bus signals depending on application and operating mode"
4040
annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=-90,
41-
origin={70,80})));
41+
origin={100,80})));
4242
Buildings.Controls.OBC.CDL.Reals.Sources.Constant cp[2](
4343
k={cpEva, cpCon})
4444
"Specific heat capacity"
45-
annotation (Placement(transformation(extent={{30,88},{50,108}})));
45+
annotation (Placement(transformation(extent={{60,88},{80,108}})));
4646
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator coo(
4747
nout=1)
4848
if have_switchover
4949
"Extract bus signals depending on application"
5050
annotation (Placement(transformation(extent={{-10,-10},{10,10}},rotation=0,
51-
origin={-80,100})));
51+
origin={-50,100})));
5252
Buildings.Controls.OBC.CDL.Logical.Sources.Constant have_swi(
5353
final k=have_switchover)
5454
"Constant Boolean"
55-
annotation (Placement(transformation(extent={{-90,30},{-70,50}})));
55+
annotation (Placement(transformation(extent={{-60,30},{-40,50}})));
5656
Buildings.Controls.OBC.CDL.Logical.Sources.Constant use_inChi(
5757
final k=useInChi)
5858
"Constant Boolean"
59-
annotation (Placement(transformation(extent={{-90,-10},{-70,10}})));
59+
annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
6060
Buildings.Controls.OBC.CDL.Logical.Sources.Constant plaCoo(
6161
final k=true)
6262
if not have_switchover
6363
"Placeholder signal"
64-
annotation (Placement(transformation(extent={{-90,60},{-70,80}})));
64+
annotation (Placement(transformation(extent={{-60,60},{-40,80}})));
6565
Buildings.Controls.OBC.CDL.Integers.Sources.Constant cst[2](
6666
k={1, 2})
6767
"Constants"
68-
annotation (Placement(transformation(extent={{-50,-38},{-30,-18}})));
68+
annotation (Placement(transformation(extent={{-20,-38},{0,-18}})));
6969
Buildings.Controls.OBC.CDL.Logical.And havSwiAndCoo
7070
"True if have_switchover and cooling mode enabled"
71-
annotation (Placement(transformation(extent={{-50,60},{-30,80}})));
71+
annotation (Placement(transformation(extent={{-20,60},{0,80}})));
7272
Buildings.Controls.OBC.CDL.Logical.Not notHavSwi
7373
"True if not have_switchover"
74-
annotation (Placement(transformation(extent={{-50,30},{-30,50}})));
74+
annotation (Placement(transformation(extent={{-20,30},{0,50}})));
7575
Buildings.Controls.OBC.CDL.Integers.Switch intSwi
7676
"Selection index: 1 to use evaporator as load side, 2 to use condenser"
77-
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
77+
annotation (Placement(transformation(extent={{20,-10},{40,10}})));
7878
Buildings.Controls.OBC.CDL.Logical.And cooLoaAndUseChi
7979
"True if tracking a CHW setpoint and used in a chiller cycle model"
80-
annotation (Placement(transformation(extent={{-50,-10},{-30,10}})));
80+
annotation (Placement(transformation(extent={{-20,-10},{0,10}})));
8181
Buildings.Controls.OBC.CDL.Logical.Or cooLoa
8282
"True if tracking a CHW setpoint"
83-
annotation (Placement(transformation(extent={{-10,50},{10,70}})));
83+
annotation (Placement(transformation(extent={{20,50},{40,70}})));
8484
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator intScaRep(
8585
nout=6)
8686
"Replicate selection index"
87-
annotation (Placement(transformation(extent={{30,50},{50,70}})));
87+
annotation (Placement(transformation(extent={{60,50},{80,70}})));
88+
Buildings.Controls.OBC.CDL.Logical.Not notHea if not useInChi
89+
"Heating disabled (if used in reversible heat pump)"
90+
annotation (Placement(transformation(extent={{-140,20},{-120,40}})));
91+
Buildings.Controls.OBC.CDL.Logical.Sources.Constant tru(final k=true)
92+
if useInChi "Placeholder signal for cooling-only system"
93+
annotation (Placement(transformation(extent={{-140,-10},{-120,10}})));
94+
Buildings.Controls.OBC.CDL.Logical.And onAndCoo
95+
"True if on and (used in chiller or used in HP and enabled in cooling mode)"
96+
annotation (Placement(transformation(extent={{-100,10},{-80,30}})));
8897
equation
8998
connect(sigBus.TConInMea, extBusSig[1].u[1])
90-
annotation (Line(points={{1,120},{69.5,120},{69.5,92}},color={255,204,51},thickness=0.5));
99+
annotation (Line(points={{1,120},{99.5,120},{99.5,92}},color={255,204,51},thickness=0.5));
91100
connect(sigBus.TEvaInMea, extBusSig[1].u[2])
92-
annotation (Line(points={{1,120},{70.5,120},{70.5,92}},color={255,204,51},thickness=0.5));
101+
annotation (Line(points={{1,120},{100.5,120},{100.5,92}},
102+
color={255,204,51},thickness=0.5));
93103
connect(sigBus.TConOutMea, extBusSig[2].u[1])
94-
annotation (Line(points={{1,120},{69.5,120},{69.5,92}},color={255,204,51},thickness=0.5));
104+
annotation (Line(points={{1,120},{99.5,120},{99.5,92}},color={255,204,51},thickness=0.5));
95105
connect(sigBus.TEvaOutMea, extBusSig[2].u[2])
96-
annotation (Line(points={{1,120},{70.5,120},{70.5,92}},color={255,204,51},thickness=0.5));
106+
annotation (Line(points={{1,120},{100.5,120},{100.5,92}},
107+
color={255,204,51},thickness=0.5));
97108
connect(sigBus.TEvaInMea, extBusSig[3].u[1])
98-
annotation (Line(points={{1,120},{69.5,120},{69.5,92}},color={255,204,51},thickness=0.5));
109+
annotation (Line(points={{1,120},{99.5,120},{99.5,92}},color={255,204,51},thickness=0.5));
99110
connect(sigBus.TConInMea, extBusSig[3].u[2])
100-
annotation (Line(points={{1,120},{70.5,120},{70.5,92}},color={255,204,51},thickness=0.5));
111+
annotation (Line(points={{1,120},{100.5,120},{100.5,92}},
112+
color={255,204,51},thickness=0.5));
101113
connect(sigBus.TEvaOutMea, extBusSig[4].u[1])
102-
annotation (Line(points={{1,120},{69.5,120},{69.5,92}},color={255,204,51},thickness=0.5));
114+
annotation (Line(points={{1,120},{99.5,120},{99.5,92}},color={255,204,51},thickness=0.5));
103115
connect(sigBus.TConOutMea, extBusSig[4].u[2])
104-
annotation (Line(points={{1,120},{70.5,120},{70.5,92}},color={255,204,51},thickness=0.5));
116+
annotation (Line(points={{1,120},{100.5,120},{100.5,92}},
117+
color={255,204,51},thickness=0.5));
105118
connect(sigBus.mEvaMea_flow, extBusSig[5].u[1])
106-
annotation (Line(points={{1,120},{69.5,120},{69.5,92}},color={255,204,51},thickness=0.5));
119+
annotation (Line(points={{1,120},{99.5,120},{99.5,92}},color={255,204,51},thickness=0.5));
107120
connect(sigBus.mConMea_flow, extBusSig[5].u[2])
108-
annotation (Line(points={{1,120},{70.5,120},{70.5,92}},color={255,204,51},thickness=0.5));
121+
annotation (Line(points={{1,120},{100.5,120},{100.5,92}},
122+
color={255,204,51},thickness=0.5));
109123
connect(cp[1].y, extBusSig[6].u[1])
110-
annotation (Line(points={{52,98},{69.5,98},{69.5,92}},color={0,0,127}));
124+
annotation (Line(points={{82,98},{99.5,98},{99.5,92}},color={0,0,127}));
111125
connect(cp[2].y, extBusSig[6].u[2])
112-
annotation (Line(points={{52,98},{70.5,98},{70.5,92}},color={0,0,127}));
126+
annotation (Line(points={{82,98},{100.5,98},{100.5,92}},
127+
color={0,0,127}));
113128
connect(extBusSig[1].y, calQUseP.TSouEnt)
114-
annotation (Line(points={{70,68},{70,60},{91,60},{91,42}},color={0,0,127}));
129+
annotation (Line(points={{100,68},{100,60},{121,60},{121,12}},
130+
color={0,0,127}));
115131
connect(extBusSig[2].y, calQUseP.TSouLvg)
116-
annotation (Line(points={{70,68},{70,60},{89,60},{89,42}},color={0,0,127}));
132+
annotation (Line(points={{100,68},{100,60},{119,60},{119,12}},
133+
color={0,0,127}));
117134
connect(extBusSig[3].y, calQUseP.TLoaEnt)
118-
annotation (Line(points={{70,68},{70,60},{87,60},{87,42}},color={0,0,127}));
135+
annotation (Line(points={{100,68},{100,60},{117,60},{117,12}},
136+
color={0,0,127}));
119137
connect(extBusSig[4].y, calQUseP.TLoaLvg)
120-
annotation (Line(points={{70,68},{70,60},{85,60},{85,42}},color={0,0,127}));
138+
annotation (Line(points={{100,68},{100,60},{115,60},{115,12}},
139+
color={0,0,127}));
121140
connect(extBusSig[5].y, calQUseP.mLoa_flow)
122-
annotation (Line(points={{70,68},{70,60},{83,60},{83,42}},color={0,0,127}));
141+
annotation (Line(points={{100,68},{100,60},{113,60},{113,12}},
142+
color={0,0,127}));
123143
connect(extBusSig[6].y, calQUseP.cpLoa)
124-
annotation (Line(points={{70,68},{70,60},{81,60},{81,42}},color={0,0,127}));
125-
connect(sigBus.onOffMea, calQUseP.on)
126-
annotation (Line(points={{1,120},{90,120},{90,80},{99,80},{99,42}},color={255,204,51},thickness=0.5));
144+
annotation (Line(points={{100,68},{100,60},{111,60},{111,12}},
145+
color={0,0,127}));
127146
connect(sigBus.TSet, calQUseP.TSet)
128-
annotation (Line(points={{1,120},{90,120},{90,80},{95,80},{95,42}},color={255,204,51},thickness=0.5));
147+
annotation (Line(points={{1,120},{125,120},{125,12}}, color={255,204,51},thickness=0.5));
129148
connect(calQUseP.PLR, sigBus.PLRCoo)
130-
annotation (Line(points={{96,18},{96,10},{110,10},{110,120},{1,120}},color={0,0,127}));
149+
annotation (Line(points={{126,-12},{126,-20},{134,-20},{134,120},{1,120}},
150+
color={0,0,127}));
131151
connect(sigBus.yMea, calQUseP.yMea)
132-
annotation (Line(points={{1,120},{90,120},{90,80},{93,80},{93,42}},color={255,204,51},thickness=0.5));
152+
annotation (Line(points={{1,120},{123,120},{123,12}}, color={255,204,51},thickness=0.5));
133153
connect(calQUseP.P, PEle)
134-
annotation (Line(points={{84,18},{84,-60},{0,-60},{0,-130}},color={0,0,127}));
154+
annotation (Line(points={{114,-12},{114,-60},{0,-60},{0,-130}},
155+
color={0,0,127}));
135156
connect(calQUseP.Q_flow, proRedQEva.u2)
136-
annotation (Line(points={{90,18},{90,-50},{-24,-50},{-24,-78}},color={0,0,127}));
157+
annotation (Line(points={{120,-12},{120,-50},{-24,-50},{-24,-78}},
158+
color={0,0,127}));
137159
connect(calQUseP.P, redQCon.u2)
138-
annotation (Line(points={{84,18},{84,-60},{64,-60},{64,-78}},color={0,0,127}));
160+
annotation (Line(points={{114,-12},{114,-60},{64,-60},{64,-78}},
161+
color={0,0,127}));
139162
connect(sigBus.coo, coo.u)
140-
annotation (Line(points={{1,120},{-100,120},{-100,100},{-92,100}},color={255,204,51},thickness=0.5));
163+
annotation (Line(points={{1,120},{-74,120},{-74,100},{-62,100}}, color={255,204,51},thickness=0.5));
141164
connect(have_swi.y, havSwiAndCoo.u2)
142-
annotation (Line(points={{-68,40},{-60,40},{-60,62},{-52,62}},color={255,0,255}));
165+
annotation (Line(points={{-38,40},{-26,40},{-26,62},{-22,62}},color={255,0,255}));
143166
connect(coo.y[1], havSwiAndCoo.u1)
144-
annotation (Line(points={{-68,100},{-60,100},{-60,70},{-52,70}},color={255,0,255}));
167+
annotation (Line(points={{-38,100},{-30,100},{-30,70},{-22,70}},color={255,0,255}));
145168
connect(plaCoo.y, havSwiAndCoo.u1)
146-
annotation (Line(points={{-68,70},{-52,70}},color={255,0,255}));
169+
annotation (Line(points={{-38,70},{-22,70}},color={255,0,255}));
147170
connect(have_swi.y, notHavSwi.u)
148-
annotation (Line(points={{-68,40},{-52,40}},color={255,0,255}));
171+
annotation (Line(points={{-38,40},{-22,40}},color={255,0,255}));
149172
connect(use_inChi.y, cooLoaAndUseChi.u2)
150-
annotation (Line(points={{-68,0},{-64,0},{-64,-8},{-52,-8}},color={255,0,255}));
173+
annotation (Line(points={{-38,0},{-34,0},{-34,-8},{-22,-8}},color={255,0,255}));
151174
connect(notHavSwi.y, cooLoa.u2)
152-
annotation (Line(points={{-28,40},{-20,40},{-20,52},{-12,52}},color={255,0,255}));
175+
annotation (Line(points={{2,40},{10,40},{10,52},{18,52}}, color={255,0,255}));
153176
connect(havSwiAndCoo.y, cooLoa.u1)
154-
annotation (Line(points={{-28,70},{-20,70},{-20,60},{-12,60}},color={255,0,255}));
177+
annotation (Line(points={{2,70},{10,70},{10,60},{18,60}}, color={255,0,255}));
155178
connect(cooLoa.y, cooLoaAndUseChi.u1)
156-
annotation (Line(points={{12,60},{14,60},{14,20},{-60,20},{-60,0},{-52,0}},
179+
annotation (Line(points={{42,60},{44,60},{44,16},{-30,16},{-30,0},{-22,0}},
157180
color={255,0,255}));
158181
connect(cooLoaAndUseChi.y, intSwi.u2)
159-
annotation (Line(points={{-28,0},{-12,0}},color={255,0,255}));
182+
annotation (Line(points={{2,0},{18,0}}, color={255,0,255}));
160183
connect(extBusSig.index, intScaRep.y)
161-
annotation (Line(points={{58,80},{54,80},{54,60},{52,60}},color={255,127,0}));
184+
annotation (Line(points={{88,80},{84,80},{84,60},{82,60}},color={255,127,0}));
162185
connect(intScaRep.u, intSwi.y)
163-
annotation (Line(points={{28,60},{20,60},{20,0},{12,0}},color={255,127,0}));
186+
annotation (Line(points={{58,60},{50,60},{50,0},{42,0}},color={255,127,0}));
164187
connect(cst[1].y, intSwi.u1)
165-
annotation (Line(points={{-28,-28},{-20,-28},{-20,8},{-12,8}},color={255,127,0}));
188+
annotation (Line(points={{2,-28},{10,-28},{10,8},{18,8}}, color={255,127,0}));
166189
connect(cst[2].y, intSwi.u3)
167-
annotation (Line(points={{-28,-28},{-20,-28},{-20,-8},{-12,-8}},color={255,127,0}));
190+
annotation (Line(points={{2,-28},{10,-28},{10,-8},{18,-8}}, color={255,127,0}));
168191
connect(coo.y[1], calQUseP.coo)
169-
annotation (Line(points={{-68,100},{-60,100},{-60,114},{97,114},{97,42}},
192+
annotation (Line(points={{-38,100},{-30,100},{-30,22},{127,22},{127,12}},
170193
color={255,0,255}));
194+
connect(sigBus.hea, notHea.u) annotation (Line(
195+
points={{1,120},{-150,120},{-150,30},{-142,30}},
196+
color={255,204,51},
197+
thickness=0.5));
198+
connect(tru.y, onAndCoo.u2) annotation (Line(points={{-118,0},{-116,0},{-116,
199+
12},{-102,12}}, color={255,0,255}));
200+
connect(sigBus.onOffMea, onAndCoo.u1) annotation (Line(
201+
points={{1,120},{-106,120},{-106,20},{-102,20}},
202+
color={255,204,51},
203+
thickness=0.5));
204+
connect(notHea.y, onAndCoo.u2) annotation (Line(points={{-118,30},{-116,30},{
205+
-116,12},{-102,12}}, color={255,0,255}));
206+
connect(onAndCoo.y, calQUseP.on)
207+
annotation (Line(points={{-78,20},{129,20},{129,12}}, color={255,0,255}));
171208
annotation (Icon(graphics={
172209
Line(points={{-46,90},{-46,40}}),
173210
Rectangle(fillColor={255,215,136},
@@ -241,5 +278,6 @@ March 21, 2025, by Antoine Gautier:<br/>
241278
First implementation.
242279
</li>
243280
</ul>
244-
</html>"));
281+
</html>"),
282+
Diagram(coordinateSystem(extent={{-160,-120},{140,120}})));
245283
end TableData2DLoadDep;

0 commit comments

Comments
 (0)