1 |
REQUIRE "johnpye/fprops/rankine_fprops.a4c"; |
2 |
|
3 |
(*------------------------------------------------------------------------------ |
4 |
REGENERATIVE RANKINE CYCLE |
5 |
*) |
6 |
(* |
7 |
Add a boiler feedwater heater and two-stage turbine. |
8 |
*) |
9 |
MODEL rankine_regen_water; |
10 |
|
11 |
BO IS_A boiler_simple; |
12 |
TU1 IS_A turbine_simple; |
13 |
BL IS_A tee; (* bleed *) |
14 |
TU2 IS_A turbine_simple; |
15 |
CO IS_A condenser_simple; |
16 |
HE IS_A heater_open; |
17 |
PU1 IS_A pump_simple; |
18 |
PU2 IS_A pump_simple; |
19 |
|
20 |
BO.cd.component :== 'water'; |
21 |
|
22 |
(* main loop *) |
23 |
BO.outlet, TU1.inlet ARE_THE_SAME; |
24 |
TU1.outlet, BL.inlet ARE_THE_SAME; |
25 |
BL.outlet, TU2.inlet ARE_THE_SAME; |
26 |
TU2.outlet, CO.inlet ARE_THE_SAME; |
27 |
CO.outlet, PU1.inlet ARE_THE_SAME; |
28 |
PU1.outlet, HE.inlet ARE_THE_SAME; |
29 |
HE.outlet, PU2.inlet ARE_THE_SAME; |
30 |
PU2.outlet, BO.inlet ARE_THE_SAME; |
31 |
|
32 |
(* bleed stream *) |
33 |
BL.outlet_branch, HE.inlet_heat ARE_THE_SAME; |
34 |
phi ALIASES BL.phi; |
35 |
p_bleed ALIASES TU1.outlet.p; |
36 |
|
37 |
p_bleed_ratio IS_A fraction; |
38 |
p_bleed_ratio * (TU1.inlet.p - TU2.outlet.p) = (TU1.outlet.p - TU2.outlet.p); |
39 |
|
40 |
mdot ALIASES BO.mdot; |
41 |
cd ALIASES BO.inlet.cd; |
42 |
|
43 |
T_H ALIASES BO.outlet.T; |
44 |
T_C ALIASES CO.outlet.T; |
45 |
|
46 |
eta IS_A fraction; |
47 |
eta_eq:eta * (BO.Qdot_fuel) = TU1.Wdot + TU2.Wdot + PU1.Wdot + PU2.Wdot; |
48 |
|
49 |
Wdot_TU1 ALIASES TU1.Wdot; |
50 |
Wdot_TU2 ALIASES TU2.Wdot; |
51 |
Wdot_PU1 ALIASES PU1.Wdot; |
52 |
Wdot_PU2 ALIASES PU2.Wdot; |
53 |
Qdot_fuel ALIASES BO.Qdot_fuel; |
54 |
|
55 |
eta_carnot IS_A fraction; |
56 |
eta_carnot_eq: eta_carnot = 1 - T_C / T_H; |
57 |
|
58 |
eta_turb_tot IS_A fraction; |
59 |
TU_out_is IS_A stream_state; |
60 |
TU_out_is.cd, TU1.inlet.cd ARE_THE_SAME; |
61 |
TU_out_is.p, TU2.outlet.p ARE_THE_SAME; |
62 |
TU_out_is.s, TU1.inlet.s ARE_THE_SAME; |
63 |
eta_turb_eq:eta_turb_tot * (TU1.inlet.h - TU_out_is.h) = (TU1.inlet.h - TU2.outlet.h); |
64 |
|
65 |
(* some checking output... *) |
66 |
|
67 |
phi_weston IS_A fraction; |
68 |
phi_weston_eq:phi_weston * (TU1.outlet.h - PU1.outlet.h) = (PU2.inlet.h - PU1.outlet.h); |
69 |
phi_eq:phi_weston = phi; |
70 |
|
71 |
q_a IS_A specific_energy; |
72 |
q_a_eq: q_a = TU1.inlet.h - PU2.outlet.h; |
73 |
|
74 |
Wdot IS_A energy_rate; |
75 |
Wdot_eq: Wdot = TU1.Wdot + TU2.Wdot + PU1.Wdot + PU2.Wdot; |
76 |
|
77 |
cons_en: HE.inlet.mdot * HE.inlet.h + HE.inlet_heat.mdot * HE.inlet_heat.h = HE.outlet.mdot * HE.outlet.h; |
78 |
|
79 |
x_turb_out ALIASES TU2.outlet.x; |
80 |
METHODS |
81 |
METHOD default_self; |
82 |
RUN BO.default_self; |
83 |
RUN TU1.default_self; |
84 |
RUN TU2.default_self; |
85 |
RUN CO.default_self; |
86 |
RUN PU1.default_self; |
87 |
RUN PU2.default_self; |
88 |
BO.outlet.h := 4000 {kJ/kg}; |
89 |
p_bleed := 37 {bar}; |
90 |
TU1.outlet.h := 2300 {kJ/kg}; |
91 |
BL.cons_mass.included := FALSE; |
92 |
(*HE.cons_mass.included := FALSE;*) |
93 |
HE.cons_en.included := FALSE; |
94 |
cons_en.included := FALSE; |
95 |
HE.inlet.v := 100 {m^3/kg}; |
96 |
HE.inlet.p.nominal := 40 {bar}; |
97 |
HE.inlet.v.nominal := 1 {L/kg}; |
98 |
HE.inlet.h.nominal := 100 {kJ/kg}; |
99 |
END default_self; |
100 |
METHOD solarpaces2010; |
101 |
RUN ClearAll; |
102 |
RUN default_self; |
103 |
(* component efficiencies *) |
104 |
FIX BO.eta; BO.eta := 1.0; |
105 |
FIX TU1.eta; TU1.eta := 0.85; |
106 |
FIX TU2.eta; TU2.eta := 0.85; |
107 |
FIX PU1.eta; PU1.eta := 0.8; |
108 |
FIX PU2.eta; PU2.eta := 0.8; |
109 |
FIX Wdot; Wdot := 100 {MW}; |
110 |
(* |
111 |
(* FIX CO.outlet.p; CO.outlet.p := 10 {kPa};*) |
112 |
FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K}; |
113 |
FIX CO.outlet.x; CO.outlet.x := 1e-6; |
114 |
FIX PU1.outlet.p; PU1.outlet.p := 7 {bar}; |
115 |
FIX PU2.outlet.p; PU2.outlet.p := 150 {bar}; |
116 |
PU2.outlet.p.upper_bound := 150 {bar}; |
117 |
FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K}; |
118 |
*) |
119 |
(* turbine conditions *) |
120 |
FIX TU1.inlet.p; TU1.inlet.p := 150 {bar}; |
121 |
FIX TU1.inlet.T; TU1.inlet.T := 580 {K} + 273.15 {K}; |
122 |
FIX TU1.outlet.p; TU1.outlet.p := 7 {bar}; |
123 |
FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K}; |
124 |
(* heater conditions *) |
125 |
TU2.outlet.p := 10 {kPa}; |
126 |
(* FIX HE.outlet.p; HE.outlet.p := 0.7 {MPa}; *) |
127 |
FIX CO.outlet.x; CO.outlet.x := 1e-6; |
128 |
FIX HE.outlet.x; HE.outlet.x := 1e-6; |
129 |
END solarpaces2010; |
130 |
METHOD on_load; |
131 |
RUN solarpaces2010; |
132 |
(* |
133 |
This model needs to be solved using QRSlv with convopt set to 'RELNOMSCALE'. |
134 |
*) |
135 |
SOLVER QRSlv; |
136 |
OPTION convopt 'RELNOM_SCALE'; |
137 |
OPTION iterationlimit 400; |
138 |
END on_load; |
139 |
METHOD set_x_limit; |
140 |
FREE PU2.outlet.p; |
141 |
PU2.outlet.p.upper_bound := 150 {bar}; |
142 |
FIX TU2.outlet.x; TU2.outlet.x := 0.9; |
143 |
END set_x_limit; |
144 |
METHOD cycle_plot; |
145 |
EXTERNAL cycle_plot_rankine_regen2(SELF); |
146 |
END cycle_plot; |
147 |
METHOD moran_ex_8_5; |
148 |
RUN default_self; |
149 |
(* |
150 |
This is Example 8.5 from Moran and Shapiro, 'Fundamentals of |
151 |
Engineering Thermodynamics', 4th Ed. |
152 |
*) |
153 |
RUN ClearAll; |
154 |
(* component efficiencies *) |
155 |
FIX BO.eta; BO.eta := 1.0; |
156 |
FIX TU1.eta; TU1.eta := 0.85; |
157 |
FIX TU2.eta; TU2.eta := 0.85; |
158 |
FIX PU1.eta; PU1.eta := 1.0; |
159 |
FIX PU2.eta; PU2.eta := 1.0; |
160 |
(* turbine conditions *) |
161 |
FIX TU1.inlet.p; TU1.inlet.p := 8. {MPa}; |
162 |
FIX TU1.inlet.T; TU1.inlet.T := 480 {K} + 273.15 {K}; |
163 |
FIX TU1.outlet.p; TU1.outlet.p := 0.7 {MPa}; |
164 |
FIX TU2.outlet.p; TU2.outlet.p := 0.008 {MPa}; |
165 |
(* heater conditions *) |
166 |
(* FIX HE.outlet.p; HE.outlet.p := 0.7 {MPa}; *) |
167 |
FIX CO.outlet.x; CO.outlet.x := 0.0001; |
168 |
FIX HE.outlet.x; HE.outlet.x := 0.0001; |
169 |
FIX Wdot; Wdot := 100 {MW}; |
170 |
END moran_ex_8_5; |
171 |
METHOD self_test; |
172 |
(* solution values to the Moran & Shapiro example 8.5 problem *) |
173 |
ASSERT abs(eta - 0.369) < 0.001; |
174 |
ASSERT abs((TU1.Wdot+TU2.Wdot)/mdot - 984.4{kJ/kg}) < 1 {kJ/kg}; |
175 |
ASSERT abs(mdot - 3.69e5 {kg/h}) < 0.05e5 {kg/h}; |
176 |
ASSERT abs(CO.inlet.h - 2249.3 {kJ/kg}) < 1.0 {kJ/kg}; |
177 |
END self_test; |
178 |
METHOD weston_ex_2_6; |
179 |
(* |
180 |
The scenario here is example 2.6 from K Weston (op. cit.), p. 55. |
181 |
*) |
182 |
RUN ClearAll; |
183 |
|
184 |
(* all ideal components *) |
185 |
FIX BO.eta; BO.eta := 1.0; |
186 |
FIX TU1.eta; TU1.eta := 1.0; |
187 |
FIX TU2.eta; TU2.eta := 1.0; |
188 |
FIX PU1.eta; PU1.eta := 1.0; |
189 |
FIX PU2.eta; PU2.eta := 1.0; |
190 |
|
191 |
(* mass flow rate is arbitrary *) |
192 |
FIX mdot; |
193 |
mdot := 10 {kg/s}; |
194 |
|
195 |
(* max pressure constraint *) |
196 |
FIX PU2.outlet.p; |
197 |
PU2.outlet.p := 2000 {psi}; |
198 |
PU2.outlet.h := 1400 {btu/lbm}; (* guess *) |
199 |
|
200 |
(* boiler max temp *) |
201 |
FIX BO.outlet.T; |
202 |
BO.outlet.T := 1460 {R}; |
203 |
BO.outlet.h := 1400 {btu/lbm}; (* guess *) |
204 |
|
205 |
(* intermediate temperature setting *) |
206 |
FIX TU1.outlet.p; |
207 |
TU1.outlet.p := 200 {psi}; |
208 |
(* FIX TU1.outlet.T; |
209 |
TU1.outlet.T := 860 {R}; (* 400 °F *) |
210 |
TU1.outlet.h := 3000 {kJ/kg}; (* guess *) *) |
211 |
|
212 |
(* minimum pressure constraint *) |
213 |
FIX CO.outlet.p; |
214 |
CO.outlet.p := 1 {psi}; |
215 |
|
216 |
(* condenser outlet is saturated liquid *) |
217 |
FIX CO.outlet.h; |
218 |
CO.outlet.h := 69.73 {btu/lbm}; |
219 |
|
220 |
(* remove the redundant balance equations *) |
221 |
HE.cons_mass.included := TRUE; |
222 |
HE.cons_en.included := TRUE; |
223 |
BL.cons_mass.included := FALSE; |
224 |
phi_weston_eq.included := TRUE; |
225 |
phi_eq.included := FALSE; |
226 |
cons_en.included := FALSE; |
227 |
|
228 |
(* fix the bleed ratio *) |
229 |
FIX BL.phi; |
230 |
BL.phi := 0.251; |
231 |
|
232 |
(* FIX BL.outlet.h; |
233 |
BL.outlet.h := 355.5 {btu/lbm}; *) |
234 |
|
235 |
(** |
236 |
these values seem to be from another problem, need to check which ... |
237 |
ASSERT abs(TU1.inlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R}; |
238 |
ASSERT abs(TU1.outlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R}; |
239 |
ASSERT abs(TU2.outlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R}; |
240 |
ASSERT abs(PU1.inlet.s - 0.1326 {btu/lbm/R}) < 0.001 {btu/lbm/R}; |
241 |
ASSERT abs(PU1.outlet.s - 0.1326 {btu/lbm/R}) < 0.002 {btu/lbm/R}; |
242 |
ASSERT abs(PU2.inlet.s - 0.5438 {btu/lbm/R}) < 0.002 {btu/lbm/R}; |
243 |
ASSERT abs(PU2.outlet.s - 0.5438 {btu/lbm/R}) < 0.002 {btu/lbm/R}; |
244 |
|
245 |
ASSERT abs(TU1.inlet.h - 1474.1 {btu/lbm}) < 1.5 {btu/lbm}; |
246 |
ASSERT abs(TU1.outlet.h - 1210.0 {btu/lbm}) < 1.5 {btu/lbm}; |
247 |
ASSERT abs(TU2.outlet.h - 871.0 {btu/lbm}) < 1.5 {btu/lbm}; |
248 |
ASSERT abs(PU1.inlet.h - 69.73 {btu/lbm}) < 0.001 {btu/lbm}; |
249 |
ASSERT abs(PU1.outlet.h - 69.73 {btu/lbm}) < 1.0 {btu/lbm}; |
250 |
ASSERT abs(PU2.inlet.h - 355.5 {btu/lbm}) < 1.5 {btu/lbm}; |
251 |
ASSERT abs(PU2.outlet.h - 355.5 {btu/lbm}) < 8 {btu/lbm}; |
252 |
|
253 |
ASSERT abs(w_net - 518.1 {btu/lbm}) < 0.3 {btu/lbm}; |
254 |
|
255 |
ASSERT abs(w_net * mdot - (TU1.Wdot + TU2.Wdot)) < 1 {W}; |
256 |
|
257 |
ASSERT abs(q_a - 1118.6 {btu/lbm}) < 7 {btu/lbm}; |
258 |
|
259 |
ASSERT abs(eta - 0.463) < 0.003; |
260 |
|
261 |
ASSERT abs(phi - 0.251) < 0.001; |
262 |
*) |
263 |
END weston_ex_2_6; |
264 |
END rankine_regen_water; |
265 |
|
266 |
|
267 |
MODEL rankine_regen_common; |
268 |
BO IS_A boiler_simple; |
269 |
TU IS_A turbine_simple; |
270 |
CO IS_A condenser_simple; |
271 |
HE IS_A heater_closed; |
272 |
PU IS_A pump_simple; |
273 |
|
274 |
(* main loop *) |
275 |
BO.outlet, TU.inlet ARE_THE_SAME; |
276 |
TU.outlet, HE.inlet_heat ARE_THE_SAME; |
277 |
HE.outlet_heat, CO.inlet ARE_THE_SAME; |
278 |
CO.outlet, PU.inlet ARE_THE_SAME; |
279 |
PU.outlet, HE.inlet ARE_THE_SAME; |
280 |
HE.outlet, BO.inlet ARE_THE_SAME; |
281 |
|
282 |
mdot ALIASES BO.mdot; |
283 |
cd ALIASES BO.inlet.cd; |
284 |
|
285 |
T_H ALIASES BO.outlet.T; |
286 |
T_C ALIASES CO.outlet.T; |
287 |
|
288 |
eta IS_A fraction; |
289 |
eta_eq:eta * (BO.Qdot_fuel) = TU.Wdot + PU.Wdot; |
290 |
|
291 |
Wdot_TU ALIASES TU.Wdot; |
292 |
Wdot_PU ALIASES PU.Wdot; |
293 |
Qdot_fuel ALIASES BO.Qdot_fuel; |
294 |
|
295 |
eta_carnot IS_A fraction; |
296 |
eta_carnot_eq: eta_carnot = 1 - T_C / T_H; |
297 |
|
298 |
Wdot IS_A energy_rate; |
299 |
Wdot_eq: Wdot = TU.Wdot + PU.Wdot; |
300 |
|
301 |
DE_cycle "cycle energy balance, should be zero" IS_A energy_rate; |
302 |
DE_cycle = BO.Qdot + CO.Qdot - TU.Wdot - PU.Wdot; |
303 |
|
304 |
x_turb_out ALIASES TU.outlet.x; |
305 |
METHODS |
306 |
METHOD default_self; |
307 |
RUN BO.default_self; |
308 |
RUN TU.default_self; |
309 |
RUN CO.default_self; |
310 |
RUN PU.default_self; |
311 |
RUN HE.default_self; |
312 |
BL.cons_mass.included := FALSE; |
313 |
HE.cons_en.included := FALSE; |
314 |
END default_self; |
315 |
METHOD cycle_plot; |
316 |
EXTERNAL cycle_plot_rankine_regen1(SELF); |
317 |
END cycle_plot; |
318 |
END rankine_regen_common; |
319 |
|
320 |
MODEL rankine_regen_toluene REFINES rankine_regen_common; |
321 |
|
322 |
BO.cd.component :== 'toluene'; |
323 |
|
324 |
METHODS |
325 |
METHOD on_load; |
326 |
FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K}; |
327 |
FIX PU.outlet.p; PU.outlet.p := 150 {bar}; |
328 |
FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K}; |
329 |
FIX CO.outlet.x; CO.outlet.x := 1e-6; |
330 |
FIX HE.outlet.T; HE.outlet.T := 300 {K} + 273.15 {K}; |
331 |
|
332 |
FIX BO.eta; BO.eta := 1.0; |
333 |
FIX TU.eta; TU.eta := 0.85; |
334 |
FIX PU.eta; PU.eta := 0.8; |
335 |
|
336 |
SOLVER QRSlv; |
337 |
OPTION convopt 'RELNOM_SCALE'; |
338 |
OPTION iterationlimit 200; |
339 |
END on_load; |
340 |
METHOD default_self; |
341 |
RUN rankine_regen_common::default_self; |
342 |
PU.inlet.h := 400 {kJ/kg}; |
343 |
BO.outlet.h := 400 {kJ/kg}; |
344 |
CO.outlet.h := 400 {kJ/kg}; |
345 |
CO.outlet.p := 10 {kPa}; |
346 |
END default_self; |
347 |
END rankine_regen_toluene; |