forked from lbl-srg/modelica-buildings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDryCalcsFuzzy_V2_2.mo
192 lines (174 loc) · 6.7 KB
/
DryCalcsFuzzy_V2_2.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
within Buildings.Fluid.HeatExchangers.BaseClasses;
model DryCalcsFuzzy_V2_2
"Dry coil calculations for effectiveness-NTU model"
// - water
input Modelica.SIunits.ThermalConductance UAWat
"UA for water side";
input Real dryfra(min=0, max=1)
"Fraction of heat exchanger to which UA is to be applied";
input Modelica.SIunits.MassFlowRate mWat_flow
"Mass flow rate for water";
input Modelica.SIunits.MassFlowRate mWatNonZer_flow(min=Modelica.Constants.eps)
"Mass flow rate for water, bounded away from zero";
input Modelica.SIunits.SpecificHeatCapacity cpWat
"Specific heat capacity of water";
input Modelica.SIunits.Temperature TWatIn
"Water temperature at inlet";
// -- air
input Modelica.SIunits.ThermalConductance UAAir
"UA for air side";
input Modelica.SIunits.MassFlowRate mAir_flow(min=Modelica.Constants.eps)
"Mass flow rate of air";
input Modelica.SIunits.MassFlowRate mAirNonZer_flow(min=Modelica.Constants.eps)
"Mass flow rate for air, bounded away from zero";
input Modelica.SIunits.SpecificHeatCapacity cpAir
"Specific heat capacity of moist air at constant pressure";
input Modelica.SIunits.Temperature TAirIn
"Temperature of air at inlet";
// -- misc.
input Buildings.Fluid.Types.HeatExchangerFlowRegime cfg
"The flow regime of the heat exchanger";
output Modelica.SIunits.HeatFlowRate QTot_flow
"Heat transferred from water to air";
output Modelica.SIunits.Temperature TWatOut
"Temperature of water at outlet";
output Modelica.SIunits.Temperature TAirOut
"Temperature of air at the outlet";
output Real eps(min=0, max=1, unit="1")
"Effectiveness for heat exchanger";
Modelica.SIunits.ThermalConductance CWat_flow
"Capacitance rate of water";
Modelica.SIunits.ThermalConductance CAir_flow
"Capacitance rate of air";
Modelica.SIunits.ThermalConductance CMin_flow
"Minimum capacity rate";
Modelica.SIunits.ThermalConductance CMax_flow
"Maximum capacity rate";
Real Z(unit="1")
"capacitance rate ratio (C*)";
output Modelica.SIunits.ThermalConductance UA
"Overall heat transfer coefficient";
output Real NTU
"Dry coil number of transfer units";
output Modelica.SIunits.Temperature TSurAirOut
"Surface Temperature at air outlet";
input Real delta = 1E-3 "Small value used for smoothing";
input Modelica.SIunits.MassFlowRate mAir_flow_nominal;
input Modelica.SIunits.MassFlowRate mWat_flow_nominal;
//protected
Modelica.SIunits.ThermalConductance deltaCMin
"Small number for capacity flow rate";
Modelica.SIunits.ThermalConductance deltaCMax
"Small number for capacity flow rate";
output Modelica.SIunits.ThermalConductance CMinNonZer_flow
"Non-zero minimum capacity rate";
Modelica.SIunits.ThermalConductance CMaxNonZer_flow
"Non-zero maximum capacity rate";
Real dryfraNonZero;
Real gai(min=0, max=1)
"Gain used to force UA to zero for very small flow rates";
Real gaiNTU(min=1E-10, max=1)
"Gain used to force NTU to a number slightly above zero for very small flow rates. Because NTU is used in NTU^-(0.22), it must not be zero.";
equation
dryfraNonZero = Buildings.Utilities.Math.Functions.spliceFunction(
pos = dryfra,
neg = delta,
x = dryfra-delta,
deltax = delta/2);
deltaCMin = delta*min(mAir_flow_nominal*cpAir,mWat_flow_nominal*cpWat);
deltaCMax = delta*max(mAir_flow_nominal*cpAir,mWat_flow_nominal*cpWat);
CWat_flow = mWat_flow*cpWat;
CAir_flow = mAir_flow*cpAir;
//CMin_flow = min(CWat_flow, CAir_flow);
CMin_flow =Buildings.Utilities.Math.Functions.smoothMin(
CAir_flow,
CWat_flow,
deltaCMin/4);
//CMax_flow = max(CWat_flow, CAir_flow);
CMax_flow =Buildings.Utilities.Math.Functions.smoothMax(
CAir_flow,
CWat_flow,
deltaCMax/4);
// CMinNonZer_flow = min(mWatNonZer_flow*cpWat, mAirNonZer_flow*cpAir);
// CMaxNonZer_flow = max(mWatNonZer_flow*cpWat, mAirNonZer_flow*cpAir);
CMinNonZer_flow=Buildings.Utilities.Math.Functions.smoothMax(
CMin_flow,
deltaCMin,
deltaCMin/4);
CMaxNonZer_flow =Buildings.Utilities.Math.Functions.smoothMax(
CMax_flow,
deltaCMax,
deltaCMax/4);
UA = 1/ (1 / UAAir + 1 / UAWat) "UA is for the overall coil (i.e., both sides)";
Z = CMin_flow/CMaxNonZer_flow "Braun 1988 eq 4.1.10";
gai = Buildings.Utilities.Math.Functions.spliceFunction(
pos=1,
neg=0,
x=CMin_flow-deltaCMin,
deltax=deltaCMin/2);
gaiNTU = Buildings.Utilities.Math.Functions.spliceFunction(
pos=1,
neg=delta,
x=CMin_flow-deltaCMin,
deltax=deltaCMin/2);
NTU = gaiNTU*dryfraNonZero*UA/CMinNonZer_flow;
eps = gai*Buildings.Fluid.HeatExchangers.BaseClasses.epsilon_ntuZ(
NTU=NTU,
Z=Z,
flowRegime=Integer(cfg));
//
// if (gai <= 0) and (gai >=0) then
// NTU = 0;
// eps = 1; // around zero flow, eps=Q/(CMin*dT) should be one
// else
// //gai =1;
// NTU =gai*dryfraNonZero*UA/CMinNonZer_flow;
// eps = gai*Buildings.Fluid.HeatExchangers.BaseClasses.epsilon_ntuZ(
// NTU=NTU,
// Z=Z,
// flowRegime=Integer(cfg));
// end if;
// Use CMin to compute Q_flow
QTot_flow = eps*CMin_flow*(TAirIn-TWatIn)
"Note: positive heat transfer is air to water";
// fixme: the next two equations are only valid if CWat >= CAir,
// but this is not true if the water flow is small
// TAirOut = TAirIn + eps*(TWatIn - TAirIn)
// "Braun 1988 eq 4.1.8";
// TWatOut = TWatIn + Z*(TAirIn - TAirOut)
// "Braun 1988 eq 4.1.9";
TAirOut=TAirIn-QTot_flow/(mAirNonZer_flow*cpAir);
TWatOut=TWatIn+QTot_flow/(mWatNonZer_flow*cpWat);
(TAirOut-TSurAirOut)*UAAir=(TSurAirOut-TWatIn)*UAWat;
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Rectangle(
extent={{-100,100},{100,-100}},
lineColor={28,108,200},
fillColor={255,213,170},
fillPattern=FillPattern.Solid)}), Diagram(
coordinateSystem(preserveAspectRatio=false)),
Documentation(revisions="<html>
<ul>
<li>
April 14, 2017, by Michael Wetter:<br/>
Changed sign of heat transfer so that sensible and total heat transfer
have the same sign.
</li>
<li>
March 17, 2017, by Michael O'Keefe:<br/>
First implementation. See
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/622\">
issue 622</a> for more information.
</li>
</ul>
</html>", info="<html>
<p>
This model implements the calculation for a 100% dry coil.
</p>
<p>
See
<a href=\"modelica://Buildings.Fluid.HeatExchangers.WetEffectivenessNTU\">
Buildings.Fluid.HeatExchangers.WetEffectivenessNTU</a> for documentation.
</p>
</html>"));
end DryCalcsFuzzy_V2_2;