/[ascend]/trunk/models/johnpye/fprops/rankine_regen.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/fprops/rankine_regen.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2303 - (show annotations) (download) (as text)
Sun Aug 22 01:33:16 2010 UTC (11 years, 11 months ago) by jpye
File MIME type: text/x-ascend
File size: 10940 byte(s)
Fix minor issue with building FPROPS from ~/ascend.
Added heat-exchanger plopts in cycle_plot.py.
Finished ammonia and toluene regen cycles.
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 := 10.3 {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_correct_turb;
140 FREE PU2.outlet.p;
141 PU2.outlet.p.upper_bound := 150 {bar};
142 FIX TU2.outlet.x; TU2.outlet.x := 0.9;
143 (* a little corrctn to ensure we're comparing the same *overall* turbine eff *)
144 FREE TU1.eta;
145 TU2.eta := 0.823;
146 FIX eta_turb_tot; eta_turb_tot := 0.85;
147 END set_x_limit;
148 METHOD cycle_plot;
149 EXTERNAL cycle_plot_rankine_regen2(SELF);
150 END cycle_plot;
151 METHOD moran_ex_8_5;
152 RUN default_self;
153 (*
154 This is Example 8.5 from Moran and Shapiro, 'Fundamentals of
155 Engineering Thermodynamics', 4th Ed.
156 *)
157 RUN ClearAll;
158 (* component efficiencies *)
159 FIX BO.eta; BO.eta := 1.0;
160 FIX TU1.eta; TU1.eta := 0.85;
161 FIX TU2.eta; TU2.eta := 0.85;
162 FIX PU1.eta; PU1.eta := 1.0;
163 FIX PU2.eta; PU2.eta := 1.0;
164 (* turbine conditions *)
165 FIX TU1.inlet.p; TU1.inlet.p := 8. {MPa};
166 FIX TU1.inlet.T; TU1.inlet.T := 480 {K} + 273.15 {K};
167 FIX TU1.outlet.p; TU1.outlet.p := 0.7 {MPa};
168 FIX TU2.outlet.p; TU2.outlet.p := 0.008 {MPa};
169 (* heater conditions *)
170 (* FIX HE.outlet.p; HE.outlet.p := 0.7 {MPa}; *)
171 FIX CO.outlet.x; CO.outlet.x := 0.0001;
172 FIX HE.outlet.x; HE.outlet.x := 0.0001;
173 FIX Wdot; Wdot := 100 {MW};
174 END moran_ex_8_5;
175 METHOD self_test;
176 (* solution values to the Moran & Shapiro example 8.5 problem *)
177 ASSERT abs(eta - 0.369) < 0.001;
178 ASSERT abs((TU1.Wdot+TU2.Wdot)/mdot - 984.4{kJ/kg}) < 1 {kJ/kg};
179 ASSERT abs(mdot - 3.69e5 {kg/h}) < 0.05e5 {kg/h};
180 ASSERT abs(CO.inlet.h - 2249.3 {kJ/kg}) < 1.0 {kJ/kg};
181 END self_test;
182 METHOD weston_ex_2_6;
183 (*
184 The scenario here is example 2.6 from K Weston (op. cit.), p. 55.
185 *)
186 RUN ClearAll;
187
188 (* all ideal components *)
189 FIX BO.eta; BO.eta := 1.0;
190 FIX TU1.eta; TU1.eta := 1.0;
191 FIX TU2.eta; TU2.eta := 1.0;
192 FIX PU1.eta; PU1.eta := 1.0;
193 FIX PU2.eta; PU2.eta := 1.0;
194
195 (* mass flow rate is arbitrary *)
196 FIX mdot;
197 mdot := 10 {kg/s};
198
199 (* max pressure constraint *)
200 FIX PU2.outlet.p;
201 PU2.outlet.p := 2000 {psi};
202 PU2.outlet.h := 1400 {btu/lbm}; (* guess *)
203
204 (* boiler max temp *)
205 FIX BO.outlet.T;
206 BO.outlet.T := 1460 {R};
207 BO.outlet.h := 1400 {btu/lbm}; (* guess *)
208
209 (* intermediate temperature setting *)
210 FIX TU1.outlet.p;
211 TU1.outlet.p := 200 {psi};
212 (* FIX TU1.outlet.T;
213 TU1.outlet.T := 860 {R}; (* 400 °F *)
214 TU1.outlet.h := 3000 {kJ/kg}; (* guess *) *)
215
216 (* minimum pressure constraint *)
217 FIX CO.outlet.p;
218 CO.outlet.p := 1 {psi};
219
220 (* condenser outlet is saturated liquid *)
221 FIX CO.outlet.h;
222 CO.outlet.h := 69.73 {btu/lbm};
223
224 (* remove the redundant balance equations *)
225 HE.cons_mass.included := TRUE;
226 HE.cons_en.included := TRUE;
227 BL.cons_mass.included := FALSE;
228 phi_weston_eq.included := TRUE;
229 phi_eq.included := FALSE;
230 cons_en.included := FALSE;
231
232 (* fix the bleed ratio *)
233 FIX BL.phi;
234 BL.phi := 0.251;
235
236 (* FIX BL.outlet.h;
237 BL.outlet.h := 355.5 {btu/lbm}; *)
238
239 (**
240 these values seem to be from another problem, need to check which ...
241 ASSERT abs(TU1.inlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};
242 ASSERT abs(TU1.outlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};
243 ASSERT abs(TU2.outlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};
244 ASSERT abs(PU1.inlet.s - 0.1326 {btu/lbm/R}) < 0.001 {btu/lbm/R};
245 ASSERT abs(PU1.outlet.s - 0.1326 {btu/lbm/R}) < 0.002 {btu/lbm/R};
246 ASSERT abs(PU2.inlet.s - 0.5438 {btu/lbm/R}) < 0.002 {btu/lbm/R};
247 ASSERT abs(PU2.outlet.s - 0.5438 {btu/lbm/R}) < 0.002 {btu/lbm/R};
248
249 ASSERT abs(TU1.inlet.h - 1474.1 {btu/lbm}) < 1.5 {btu/lbm};
250 ASSERT abs(TU1.outlet.h - 1210.0 {btu/lbm}) < 1.5 {btu/lbm};
251 ASSERT abs(TU2.outlet.h - 871.0 {btu/lbm}) < 1.5 {btu/lbm};
252 ASSERT abs(PU1.inlet.h - 69.73 {btu/lbm}) < 0.001 {btu/lbm};
253 ASSERT abs(PU1.outlet.h - 69.73 {btu/lbm}) < 1.0 {btu/lbm};
254 ASSERT abs(PU2.inlet.h - 355.5 {btu/lbm}) < 1.5 {btu/lbm};
255 ASSERT abs(PU2.outlet.h - 355.5 {btu/lbm}) < 8 {btu/lbm};
256
257 ASSERT abs(w_net - 518.1 {btu/lbm}) < 0.3 {btu/lbm};
258
259 ASSERT abs(w_net * mdot - (TU1.Wdot + TU2.Wdot)) < 1 {W};
260
261 ASSERT abs(q_a - 1118.6 {btu/lbm}) < 7 {btu/lbm};
262
263 ASSERT abs(eta - 0.463) < 0.003;
264
265 ASSERT abs(phi - 0.251) < 0.001;
266 *)
267 END weston_ex_2_6;
268 END rankine_regen_water;
269
270
271 MODEL rankine_regen_common;
272 BO IS_A boiler_simple;
273 TU IS_A turbine_simple;
274 CO IS_A condenser_simple;
275 HE IS_A heater_closed;
276 PU IS_A pump_simple;
277
278 (* main loop *)
279 BO.outlet, TU.inlet ARE_THE_SAME;
280 TU.outlet, HE.inlet_heat ARE_THE_SAME;
281 HE.outlet_heat, CO.inlet ARE_THE_SAME;
282 CO.outlet, PU.inlet ARE_THE_SAME;
283 PU.outlet, HE.inlet ARE_THE_SAME;
284 HE.outlet, BO.inlet ARE_THE_SAME;
285
286 mdot ALIASES BO.mdot;
287 cd ALIASES BO.inlet.cd;
288
289 T_H ALIASES BO.outlet.T;
290 T_C ALIASES CO.outlet.T;
291
292 eta IS_A fraction;
293 eta_eq:eta * (BO.Qdot_fuel) = TU.Wdot + PU.Wdot;
294
295 Wdot_TU ALIASES TU.Wdot;
296 Wdot_PU ALIASES PU.Wdot;
297 Qdot_fuel ALIASES BO.Qdot_fuel;
298
299 eta_carnot IS_A fraction;
300 eta_carnot_eq: eta_carnot = 1 - T_C / T_H;
301
302 Wdot IS_A energy_rate;
303 Wdot_eq: Wdot = TU.Wdot + PU.Wdot;
304
305 T_ci ALIASES HE.inlet.T;
306 T_co ALIASES HE.outlet.T;
307 T_hi ALIASES HE.inlet_heat.T;
308 T_ho ALIASES HE.outlet_heat.T;
309
310 DE_cycle "cycle energy balance, should be zero" IS_A energy_rate;
311 DE_cycle = BO.Qdot + CO.Qdot - TU.Wdot - PU.Wdot;
312
313 x_turb_out ALIASES TU.outlet.x;
314 METHODS
315 METHOD default_self;
316 RUN BO.default_self;
317 RUN TU.default_self;
318 RUN CO.default_self;
319 RUN PU.default_self;
320 RUN HE.default_self;
321 BL.cons_mass.included := FALSE;
322 HE.cons_en.included := FALSE;
323 END default_self;
324 METHOD cycle_plot;
325 EXTERNAL cycle_plot_rankine_regen1(SELF);
326 END cycle_plot;
327 METHOD heater_plot;
328 EXTERNAL heater_closed_plot(SELF);
329 END cycle_plot;
330 END rankine_regen_common;
331
332
333 MODEL rankine_regen_toluene REFINES rankine_regen_common;
334 BO.cd.component :== 'toluene';
335 METHODS
336 METHOD on_load;
337 FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
338 FIX PU.outlet.p; PU.outlet.p := 150 {bar};
339 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
340 FIX CO.outlet.x; CO.outlet.x := 1e-6;
341 FIX HE.outlet.T; HE.outlet.T := 307 {K} + 273.15 {K};
342
343 FIX BO.eta; BO.eta := 1.0;
344 FIX TU.eta; TU.eta := 0.85;
345 FIX PU.eta; PU.eta := 0.8;
346
347 SOLVER QRSlv;
348 OPTION convopt 'RELNOM_SCALE';
349 OPTION iterationlimit 200;
350 END on_load;
351 METHOD default_self;
352 RUN rankine_regen_common::default_self;
353 PU.inlet.h := 400 {kJ/kg};
354 BO.outlet.h := 400 {kJ/kg};
355 CO.outlet.h := 400 {kJ/kg};
356 CO.outlet.p := 10 {kPa};
357 END default_self;
358 END rankine_regen_toluene;
359
360
361 MODEL rankine_regen_ammonia REFINES rankine_regen_common;
362 BO.cd.component :== 'ammonia';
363 METHODS
364 METHOD on_load;
365 FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
366 FIX PU.outlet.p; PU.outlet.p := 150 {bar};
367 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
368 FIX CO.outlet.x; CO.outlet.x := 1e-6;
369 FIX HE.outlet.T; HE.outlet.T := 150.1 {K} + 273.15 {K};
370
371 FIX BO.eta; BO.eta := 1.0;
372 FIX TU.eta; TU.eta := 0.85;
373 FIX PU.eta; PU.eta := 0.8;
374
375 SOLVER QRSlv;
376 OPTION convopt 'RELNOM_SCALE';
377 OPTION iterationlimit 200;
378 END on_load;
379 METHOD default_self;
380 RUN rankine_regen_common::default_self;
381 PU.inlet.h := 400 {kJ/kg};
382 BO.outlet.h := 400 {kJ/kg};
383 CO.outlet.h := 400 {kJ/kg};
384 CO.outlet.p := 10 {kPa};
385 END default_self;
386 END rankine_regen_ammonia;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22