/[ascend]/trunk/models/johnpye/brayton.a4c
ViewVC logotype

Contents of /trunk/models/johnpye/brayton.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2181 - (show annotations) (download) (as text)
Mon Apr 12 05:02:15 2010 UTC (14 years, 2 months ago) by jpye
File MIME type: text/x-ascend
File size: 14080 byte(s)
Fixing combined cycle model.
1 (* ASCEND modelling environment
2 Copyright (C) 2007, 2008, 2009, 2010 Carnegie Mellon University
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18 *)(*
19 This file contains some models of Brayton engines and associated cycles,
20 following the development of Çengel & Boles 'Thermodynamcs: An Engineering
21 Approach, 6th Ed, McGraw-Hill, 2008.
22
23 Author: John Pye
24 *)
25
26 REQUIRE "atoms.a4l";
27 REQUIRE "johnpye/thermo_types.a4c";
28 REQUIRE "johnpye/airprops.a4c";
29 IMPORT "sensitivity/solve";
30
31 (* first some models of air as an ideal gas *)
32
33 MODEL ideal_gas_base;
34 M IS_A molar_weight_constant;
35 c_p IS_A specific_heat_capacity;
36 s IS_A specific_entropy;
37 h IS_A specific_enthalpy;
38 v IS_A specific_volume;
39 T IS_A temperature;
40 p IS_A pressure;
41 R IS_A specific_gas_constant;
42
43 R :== 1{GAS_C} / M;
44 p * v = R * T;
45
46 METHODS
47 METHOD bound_self;
48 s.lower_bound := -5 {kJ/kg/K};
49 END bound_self;
50 END ideal_gas_base;
51
52 (*
53 Ideal air assuming ideal gas and constant cp.
54 *)
55 MODEL simple_ideal_air
56 REFINES ideal_gas_base;
57
58 M :== 28.958600656 {kg/kmol};
59
60 c_p = 1.005 {kJ/kg/K};
61
62 T_ref IS_A temperature_constant;
63 p_ref IS_A pressure_constant;
64
65 s = c_p * ln(T / T_ref) - R * ln(p / p_ref);
66 h = c_p * (T - T_ref);
67
68 T_ref :== 273.15 {K};
69 p_ref :== 1 {bar};
70
71 METHODS
72 METHOD on_load;
73 RUN ClearAll;
74 RUN bound_self;
75 FIX T, p;
76 T := 300 {K};
77 p := 1 {bar};
78 END on_load;
79 END simple_ideal_air;
80
81 (*
82 Ideal air, using a quartic polynomial for c_p as given in Moran & Shapiro
83 4th Ed.
84 *)
85 MODEL ideal_air REFINES ideal_gas_base;
86 M :== 28.958600656 {kg/kmol};
87
88 a[0..4] IS_A real_constant;
89 a[0] :== 3.653;
90 a[1] :== -1.337e-3{1/K};
91 a[2] :== 3.294e-6{1/K^2};
92 a[3] :== -1.913e-9{1/K^3};
93 a[4] :== 0.2763e-12{1/K^4};
94
95 T_ref IS_A temperature_constant;
96 p_ref IS_A pressure_constant;
97 h_ref IS_A real_constant;
98 s_ref IS_A real_constant;
99
100 T_ref :== 300 {K};
101 p_ref :== 1 {bar};
102 h_ref :== -4.40119 {kJ/kg};
103 s_ref :== 0. {kJ/kg/K};
104
105 c_p * M = 1{GAS_C} * SUM[a[i]*T^i | i IN [0..4]];
106
107 (h - h_ref) * M = 1{GAS_C} * SUM[a[i]/(i+1) * T^(i+1) | i IN[0..4]];
108
109 s0 IS_A specific_entropy;
110 s0 = R * (a[0]*ln(T/T_ref) + SUM[a[i]/i * (T - T_ref)^i | i IN[1..4]]) + 1.294559 {kJ/kg/K} + 0.38191663487 {kJ/kg/K};
111
112 s = s0 - R * ln(p/p_ref);
113
114 METHODS
115 METHOD bound_self;
116 RUN ideal_gas_base::bound_self;
117 s0.lower_bound := -1e20 {kJ/kg/K};
118 END bound_self;
119 METHOD on_load;
120 RUN ClearAll;
121 RUN bound_self;
122 FIX T, p;
123 T := 200 {K};
124 p := 1 {bar};
125 END on_load;
126 END ideal_air;
127
128 (*
129 Thermo properties
130 *)
131 MODEL state;
132 air IS_A ideal_air;
133 p ALIASES air.p;
134 T ALIASES air.T;
135 h ALIASES air.h;
136 s ALIASES air.s;
137 v ALIASES air.v;
138 METHODS
139 METHOD default;
140 p := 10{bar};
141 p.nominal := 42 {bar};
142 h := 2000 {kJ/kg};
143
144 T := 400 {K};
145 v.nominal := 10 {L/kg};
146 s := 4 {kJ/kg/K};
147 END default;
148 METHOD solve;
149 EXTERNAL do_solve(SELF);
150 END solve;
151 METHOD on_load;
152 RUN default_all;
153 FIX p, h;
154 END on_load;
155 END state;
156
157
158 (* a simple connector that includes calculation of steam properties *)
159 MODEL node;
160 state IS_A state;
161 p ALIASES state.p;
162 h ALIASES state.h;
163 v ALIASES state.v;
164 T ALIASES state.T;
165 s ALIASES state.s;
166 mdot IS_A mass_rate;
167 METHODS
168 METHOD default;
169 mdot.nominal := 2 {kg/s};
170 END default;
171 METHOD solve;
172 EXTERNAL do_solve(SELF);
173 END solve;
174 METHOD on_load;
175 RUN default; RUN reset; RUN values;
176 FIX p,h;
177 END on_load;
178 END node;
179
180 MODEL air_equipment;
181 inlet "in: inlet air stream" IS_A node;
182 outlet "out: outlet air stream" IS_A node;
183
184 inlet.mdot, outlet.mdot ARE_THE_SAME;
185 mdot ALIASES inlet.mdot;
186 END air_equipment;
187
188
189 MODEL compressor REFINES air_equipment;
190 NOTES
191 'block' SELF {Simple model of a compressor using isentropic efficiency}
192 END NOTES;
193
194 dp IS_A delta_pressure;
195 inlet.p + dp = outlet.p;
196
197 outlet_is IS_A state;
198 outlet_is.p, outlet.p ARE_THE_SAME;
199
200 outlet_is.s, inlet.s ARE_THE_SAME;
201 eta IS_A fraction;
202
203 r IS_A factor;
204 r * inlet.p = outlet.p;
205
206 eta_eq:eta * (inlet.h - outlet.h) = (inlet.h - outlet_is.h);
207
208 (* work done on the environment, will be negative *)
209 Wdot IS_A energy_rate;
210 Wdot_eq:Wdot * eta = mdot * (inlet.h - outlet_is.h);
211
212 w IS_A specific_energy;
213 w_eq:w = eta * (outlet.h - inlet.h);
214
215 END compressor;
216
217 MODEL compressor_test REFINES compressor;
218 (* no equations here *)
219 METHODS
220 METHOD on_load;
221 FIX inlet.T;
222 FIX inlet.p;
223
224 inlet.T := 300 {K};
225 inlet.p := 1 {bar};
226
227 FIX r;
228 FIX eta;
229 FIX mdot;
230
231 r := 8;
232 eta := 0.8;
233 mdot := 1 {kg/s};
234 END on_load;
235 END compressor_test;
236
237
238
239 MODEL gas_turbine REFINES air_equipment;
240 NOTES
241 'block' SELF {Simple turbine model}
242 END NOTES;
243
244 dp IS_A delta_pressure;
245 inlet.p + dp = outlet.p;
246
247 outlet_is IS_A state;
248 outlet_is.p, outlet.p ARE_THE_SAME;
249 outlet_is.s, inlet.s ARE_THE_SAME;
250
251 eta IS_A fraction;
252 eta_eq:eta * (inlet.h - outlet_is.h) = (inlet.h - outlet.h);
253
254 (* work done on the environment, will be positive *)
255 Wdot IS_A energy_rate;
256 Wedot_eq:Wdot = mdot * (inlet.h - outlet.h);
257
258 w IS_A specific_energy;
259 w_eq:w = inlet.h - outlet.h;
260
261 r IS_A factor;
262 r * outlet.p = inlet.p;
263
264 END gas_turbine;
265
266 MODEL gas_turbine_test REFINES gas_turbine;
267 (* no equations here *)
268 METHODS
269 METHOD on_load;
270 FIX inlet.p;
271 FIX inlet.T;
272 FIX outlet.p;
273 FIX eta;
274 FIX mdot;
275
276 inlet.p := 15 {bar};
277 inlet.T := 1200 {K};
278 outlet.p := 1 {bar};
279 eta := 0.85;
280 mdot := 1 {kg/s};
281 END on_load;
282 END gas_turbine_test;
283
284
285
286
287 (*
288 simple model assumes no pressure drop, but heating losses due to
289 flue gas temperature
290 *)
291 MODEL combustor REFINES air_equipment;
292 NOTES
293 'block' SELF {Simple combustion chamber model}
294 END NOTES;
295
296 inlet.p, outlet.p ARE_THE_SAME;
297 Qdot_fuel IS_A energy_rate;
298 Qdot IS_A energy_rate;
299
300 Qdot = mdot * (outlet.h - inlet.h);
301
302 eta IS_A fraction;
303 Qdot = eta * Qdot_fuel;
304
305 qdot_fuel IS_A specific_energy_rate;
306 qdot_fuel * mdot = Qdot_fuel;
307 END combustor;
308
309 MODEL combustor_test REFINES combustor;
310 (* nothing here *)
311 METHODS
312 METHOD on_load;
313 FIX inlet.p;
314 FIX inlet.T;
315 FIX eta;
316 FIX outlet.T;
317 FIX mdot;
318
319 inlet.p := 15 {bar};
320 inlet.T := 500 {K};
321
322 eta := 0.8;
323 outlet.T := 700 {K};
324 mdot := 1 {kg/s};
325 END on_load;
326 END combustor_test;
327
328
329
330 (*
331 this is really simple (fluid props permitting): just work out the heat
332 that must be expelled to get the gas down to a specified temperature
333 *)
334 MODEL dissipator REFINES air_equipment;
335 NOTES
336 'block' SELF {Simple condenser model}
337 END NOTES;
338
339 inlet.p, outlet.p ARE_THE_SAME;
340 Qdot IS_A energy_rate;
341
342 Qdot = mdot * (outlet.h - inlet.h);
343
344 END dissipator;
345
346 MODEL dissipator_test REFINES dissipator;
347 (* nothing here *)
348 METHODS
349 METHOD on_load;
350 FIX inlet.p, inlet.T;
351 FIX outlet.T;
352 FIX mdot;
353
354 inlet.p := 1 {bar};
355 inlet.T := 500 {K};
356 outlet.T := 300 {K};
357 mdot := 1 {kg/s};
358 END on_load;
359 END dissipator_test;
360
361
362 MODEL brayton;
363 NOTES
364 'description' SELF {
365 This is a model of a simple Brayton cycle with
366 irreversible compressor (eta=0.8) and turbine (eta=0.85) operating
367 between 300 K and 1300 K, with a compression ratio of 8 and an
368 assumed inlet pressure of 1 bar. Based on examples 9-5 and 9-6 from
369 Çengel & Boles, 'Thermodynamics: An Engineering Approach', 6th Ed,
370 McGraw-Hill, 2008}
371 END NOTES;
372
373 CO IS_A compressor;
374 TU IS_A gas_turbine;
375 BU IS_A combustor;
376 DI IS_A dissipator;
377
378 CO.outlet, BU.inlet ARE_THE_SAME;
379 BU.outlet, TU.inlet ARE_THE_SAME;
380 TU.outlet, DI.inlet ARE_THE_SAME;
381 DI.outlet, CO.inlet ARE_THE_SAME;
382
383 Wdot_CO ALIASES CO.Wdot;
384 Wdot_TU ALIASES TU.Wdot;
385 Wdot IS_A energy_rate;
386 Wdot = Wdot_CO + Wdot_TU;
387
388 Qdot_BU ALIASES BU.Qdot;
389 Qdot_DI ALIASES DI.Qdot;
390
391 Qdot IS_A energy_rate;
392 Qdot = Qdot_BU + Qdot_DI;
393
394 Edot IS_A energy_rate;
395 Edot = Wdot - Qdot;
396
397 eta IS_A fraction;
398 eta = Wdot / Qdot_BU;
399
400 r_bw IS_A factor;
401 r_bw = -Wdot_CO / Wdot_TU;
402
403 state[1..4] IS_A node;
404 state[1], CO.inlet ARE_THE_SAME;
405 state[2], BU.inlet ARE_THE_SAME;
406 state[3], TU.inlet ARE_THE_SAME;
407 state[4], DI.inlet ARE_THE_SAME;
408
409 eta_TU ALIASES TU.eta;
410 eta_CO ALIASES CO.eta;
411
412 METHODS
413 METHOD on_load;
414 FIX CO.eta, TU.eta;
415 CO.eta := 0.8;
416 TU.eta := 0.85;
417 FIX CO.inlet.T, TU.inlet.T;
418 CO.inlet.T := 300 {K};
419 TU.inlet.T := 1300 {K};
420 FIX CO.r;
421 CO.r := 8;
422 FIX CO.inlet.p;
423 CO.inlet.p := 1 {bar};
424 FIX CO.inlet.mdot;
425 CO.inlet.mdot := 1 {kg/s};
426 FIX BU.eta;
427 BU.eta := 1;
428 END on_load;
429 END brayton;
430
431
432 (*
433 Regenerator: air-to-air heat exchanger
434
435 Assumption: fluid on both sides have the same c_p.
436 *)
437 MODEL regenerator REFINES air_equipment;
438 inlet_hot, outlet_hot IS_A node;
439
440 inlet.p, outlet.p ARE_THE_SAME;
441 inlet_hot.p, outlet_hot.p ARE_THE_SAME;
442
443 inlet_hot.mdot, outlet_hot.mdot ARE_THE_SAME;
444 mdot_hot ALIASES inlet_hot.mdot;
445
446 (* for perfect eps=1 case: inlet_hot.T, outlet.T ARE_THE_SAME;*)
447
448 epsilon IS_A fraction;
449
450 Qdot IS_A energy_rate;
451 mdot_min IS_A mass_rate;
452 mdot_min = inlet.mdot + 0.5*(inlet.mdot - inlet_hot.mdot + abs(inlet.mdot - inlet_hot.mdot));
453
454 Qdot = epsilon * mdot_min * (inlet_hot.h - inlet.h);
455 outlet.h = inlet.h + Qdot/inlet.mdot;
456 outlet_hot.h = inlet_hot.h - Qdot/inlet_hot.mdot;
457 END regenerator;
458
459 MODEL regenerator_test REFINES regenerator;
460 METHODS
461 METHOD on_load;
462 FIX inlet.mdot, inlet.p, inlet.T;
463 FIX inlet_hot.mdot, inlet_hot.p, inlet_hot.T;
464 inlet.mdot := 1 {kg/s};
465 inlet.p := 1 {bar};
466 inlet.T := 300 {K};
467 inlet_hot.mdot := 1.05 {kg/s};
468 inlet_hot.p := 15 {bar};
469 inlet_hot.T := 500 {K};
470 FIX epsilon;
471 epsilon := 0.8;
472 END on_load;
473 END regenerator_test;
474
475
476
477 MODEL brayton_regenerative;
478 NOTES
479 'description' SELF {
480 This is a model of a regenerative Brayton cycle with
481 irreversible compressor (eta=0.8) and turbine (eta=0.85) operating
482 between 300 K and 1300 K, with a compression ratio of 8 and an
483 assumed inlet pressure of 1 bar. The regenerator effectiveness is
484 0.8.
485
486 Based on example 9-7 from Çengel & Boles, 'Thermodynamics: An
487 Engineering Approach', 6th Ed, McGraw-Hill, 2008}
488 END NOTES;
489
490 CO IS_A compressor;
491 TU IS_A gas_turbine;
492 BU IS_A combustor;
493 DI IS_A dissipator;
494 RE IS_A regenerator;
495
496 CO.outlet, RE.inlet ARE_THE_SAME;
497 RE.outlet, BU.inlet ARE_THE_SAME;
498 BU.outlet, TU.inlet ARE_THE_SAME;
499 TU.outlet, RE.inlet_hot ARE_THE_SAME;
500 RE.outlet_hot, DI.inlet ARE_THE_SAME;
501 DI.outlet, CO.inlet ARE_THE_SAME;
502
503 Wdot_CO ALIASES CO.Wdot;
504 Wdot_TU ALIASES TU.Wdot;
505 Wdot IS_A energy_rate;
506 Wdot = Wdot_CO + Wdot_TU;
507
508 Qdot_BU ALIASES BU.Qdot;
509 Qdot_DI ALIASES DI.Qdot;
510
511 Qdot IS_A energy_rate;
512 Qdot = Qdot_BU + Qdot_DI;
513
514 Edot IS_A energy_rate;
515 Edot = Wdot - Qdot;
516
517 eta IS_A factor;
518 eta = Wdot / Qdot_BU;
519
520 r_bw IS_A factor;
521 r_bw = -Wdot_CO / Wdot_TU;
522
523 Qdot_RE ALIASES RE.Qdot;
524
525 eta_TU ALIASES TU.eta;
526 eta_CO ALIASES CO.eta;
527 epsilon_RE ALIASES RE.epsilon;
528 METHODS
529 METHOD on_load;
530 FIX CO.eta, TU.eta;
531 CO.eta := 0.8;
532 TU.eta := 0.85;
533 FIX CO.inlet.T, TU.inlet.T;
534 CO.inlet.T := 300 {K};
535 TU.inlet.T := 1300 {K};
536 FIX CO.r;
537 CO.r := 8;
538 FIX CO.inlet.p;
539 CO.inlet.p := 1 {bar};
540 FIX CO.inlet.mdot;
541 CO.inlet.mdot := 1 {kg/s};
542 FIX BU.eta;
543 BU.eta := 1;
544 FIX RE.epsilon;
545 RE.epsilon := 0.8;
546 END on_load;
547 END brayton_regenerative;
548
549
550
551
552 MODEL brayton_intercool_reheat_regen;
553 NOTES
554 'description' SELF {
555 This is a model of a Brayton cycle with intercooling, reheating, and
556 regeneration.
557
558 It has an irreversible compressor (eta=0.8) and turbine (eta=0.85)
559 and operates between 300 K and 1300 K, with a compression ratio of 8
560 and an assumed inlet pressure of 1 bar. The regenerator
561 effectiveness is 0.8.
562
563 In adding the intercooling and reheating stages, we assume an
564 intermediate pressure that results in two compression stages of
565 equal pressure ratio, and two turbine stages of equal pressure
566 ratio.
567
568 Based on example 9-8 from Çengel & Boles, 'Thermodynamics: An
569 Engineering Approach', 6th Ed, McGraw-Hill, 2008}
570 END NOTES;
571
572 CO1, CO2 IS_A compressor;
573 TU1, TU2 IS_A gas_turbine;
574 BU IS_A combustor;
575 DI IS_A dissipator;
576 RE IS_A regenerator;
577 IC IS_A dissipator;
578 RH IS_A combustor;
579
580 CO1.outlet, IC.inlet ARE_THE_SAME;
581 IC.outlet, CO2.inlet ARE_THE_SAME;
582 CO2.outlet, RE.inlet ARE_THE_SAME;
583 RE.outlet, BU.inlet ARE_THE_SAME;
584 BU.outlet, TU1.inlet ARE_THE_SAME;
585 TU1.outlet, RH.inlet ARE_THE_SAME;
586 RH.outlet, TU2.inlet ARE_THE_SAME;
587 TU2.outlet, RE.inlet_hot ARE_THE_SAME;
588 RE.outlet_hot, DI.inlet ARE_THE_SAME;
589 DI.outlet, CO1.inlet ARE_THE_SAME;
590
591 Wdot_CO1 ALIASES CO1.Wdot;
592 Wdot_CO2 ALIASES CO2.Wdot;
593 Wdot_TU1 ALIASES TU1.Wdot;
594 Wdot_TU2 ALIASES TU2.Wdot;
595
596 Wdot_CO, Wdot_TU, Wdot IS_A energy_rate;
597 Wdot_CO = Wdot_CO1 + Wdot_CO2;
598 Wdot_TU = Wdot_TU1 + Wdot_TU2;
599 Wdot = Wdot_CO + Wdot_TU;
600
601 Qdot_BU ALIASES BU.Qdot;
602 Qdot_DI ALIASES DI.Qdot;
603 Qdot_IC ALIASES IC.Qdot;
604 Qdot_RH ALIASES RH.Qdot;
605
606 Qdot IS_A energy_rate;
607 Qdot = Qdot_BU + Qdot_DI + Qdot_IC + Qdot_RH;
608
609 Edot IS_A energy_rate;
610 Edot = Wdot - Qdot;
611
612 eta IS_A factor;
613 eta = Wdot / Qdot_BU;
614
615 CO1.r = CO2.r;
616 TU1.r = TU2.r;
617
618 RH.outlet.T = BU.outlet.T;
619 IC.outlet.T = DI.outlet.T;
620
621 r IS_A factor;
622 r = CO2.outlet.p / CO1.inlet.p;
623
624 r_bw IS_A factor;
625 r_bw = -Wdot_CO / Wdot_TU;
626
627 Qdot_RE ALIASES RE.Qdot;
628
629 eta_TU1 ALIASES TU1.eta;
630 eta_TU2 ALIASES TU2.eta;
631 eta_CO1 ALIASES CO1.eta;
632 eta_CO2 ALIASES CO2.eta;
633 epsilon_RE ALIASES RE.epsilon;
634 METHODS
635 METHOD on_load;
636 FIX CO1.eta, CO2.eta, TU1.eta, TU2.eta;
637 CO1.eta := 0.8;
638 CO2.eta := 0.8;
639 TU1.eta := 0.85;
640 TU2.eta := 0.85;
641 FIX CO1.inlet.T, TU1.inlet.T;
642 CO1.inlet.T := 300 {K};
643 TU1.inlet.T := 1300 {K};
644 FIX r;
645 r := 8;
646 FIX CO1.inlet.p;
647 CO1.inlet.p := 1 {bar};
648 FIX CO1.inlet.mdot;
649 CO1.inlet.mdot := 1 {kg/s};
650 FIX BU.eta, RH.eta;
651 BU.eta := 1;
652 RH.eta := 1;
653 FIX RE.epsilon;
654 RE.epsilon := 0.8;
655 END on_load;
656 END brayton_intercool_reheat_regen;

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