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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2290 - (show annotations) (download) (as text)
Sun Aug 15 10:11:54 2010 UTC (13 years, 10 months ago) by jpye
File MIME type: text/x-ascend
File size: 23475 byte(s)
Trying to catch errors associated with pressure below triple point for CO2.
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 A number of Rankine-cycle (steam turbine power cycle) models of increasing
20 complexity, following the general development of Moran & Shapiro, Çengel,
21 and others.
22
23 Author: John Pye
24 *)
25
26 REQUIRE "atoms.a4l";
27 REQUIRE "johnpye/thermo_types.a4c";
28
29 IMPORT "johnpye/fprops/helmholtz";
30 IMPORT "sensitivity/solve";
31
32 (*------------------------------------------------------------------------------
33 BACKGROUND STUFF
34 *)
35
36 MODEL fluid;
37 component IS_A symbol_constant;
38 END fluid;
39
40 (*
41 Thermo properties -- IAPWS-IF97
42 *)
43 MODEL stream_state;
44 cd IS_A fluid;
45 p IS_A pressure;
46 h IS_A specific_enthalpy;
47
48 T IS_A temperature;
49 v IS_A specific_volume;
50 s IS_A specific_entropy;
51 x IS_A fraction;
52
53 (*calc_vT: helmholtz_phsx_vT(
54 v, T : INPUT;
55 p, h, s, x : OUTPUT;
56 cd : DATA
57 );*)
58 calc_ph: helmholtz_Tvsx_ph(
59 p, h : INPUT;
60 T, v, s, x : OUTPUT;
61 cd : DATA
62 );
63 METHODS
64 METHOD default;
65 p := 10{bar};
66 p.nominal := 42 {bar};
67 IF cd.component == 'water' THEN
68 h := 2000 {kJ/kg};
69 ELSE
70 IF cd.component == 'carbondioxide' THEN
71 h := 350 {kJ/kg};
72 ELSE
73 h := 350 {kJ/kg};
74 END IF;
75 END IF;
76
77 T := 400 {K};
78 v.nominal := 10 {L/kg};
79 s := 4 {kJ/kg/K};
80 x := 0.8;
81
82 RUN enable_ph;
83 END default;
84 METHOD default_self;
85 RUN default;
86 END default_self;
87 METHOD enable_vT;
88 FOR i IN [1..4] DO
89 (*calc_ph[i].included := FALSE;
90 calc_vT[i].included := TRUE;*)
91 calc_ph[i].included := TRUE;
92 END FOR;
93 END enable_vT;
94 METHOD enable_ph;
95 FOR i IN [1..4] DO
96 calc_ph[i].included := TRUE;
97 (*calc_vT[i].included := FALSE;*)
98 END FOR;
99 END enable_ph;
100 METHOD solve;
101 EXTERNAL do_solve(SELF);
102 END solve;
103 END stream_state;
104
105 MODEL stream_state_test REFINES stream_state;
106 cd.component :== 'water';
107 METHODS
108 METHOD on_load;
109 RUN default_all;
110 FIX p, h;
111 p := 10 {bar};
112 h := 2000 {kJ/kg};
113 SOLVER QRSlv;
114 OPTION convopt 'RELNOM_SCALE';
115 SOLVE;
116 ASSERT abs(T - 453.03 {K}) < 0.01 {K};
117 ASSERT abs(v - 0.119808 {m^3/kg}) < 0.0001 {m^3/kg};
118 ASSERT abs(x - 0.6142) < 0.0001;
119 ASSERT abs(s - 4.8696 {kJ/kg/K}) < 0.0001 {kJ/kg/K};
120 END on_load;
121 END stream_state_test;
122
123
124 MODEL stream_state_test_co2 REFINES stream_state;
125 cd.component :== 'carbondioxide';
126 METHODS
127 METHOD on_load;
128 RUN default_all;
129 h := 350 {kJ/kg};
130 FIX p, x;
131 p := 9 {kPa};
132 x := 1e-6;
133 SOLVER QRSlv;
134 OPTION convopt 'RELNOM_SCALE';
135 END on_load;
136 END stream_state_test_co2;
137
138
139 MODEL stream_state_test_toluene REFINES stream_state;
140 cd.component :== 'toluene';
141 METHODS
142 METHOD on_load;
143 RUN default_all;
144 FIX p, x;
145 p := 8 {kPa};
146 x := 1e-6;
147 SOLVER QRSlv;
148 OPTION convopt 'RELNOM_SCALE';
149 END on_load;
150 END stream_state_test_toluene;
151
152
153 (* a simple connector that includes calculation of steam properties *)
154 MODEL stream_node;
155 state IS_A stream_state;
156 cd ALIASES state.cd;
157 p ALIASES state.p;
158 h ALIASES state.h;
159 v ALIASES state.v;
160 T ALIASES state.T;
161 s ALIASES state.s;
162 x ALIASES state.x;
163 mdot IS_A mass_rate;
164 METHODS
165
166 METHOD default_self;
167 RUN state.default_self;
168 RUN default;
169 END default_self;
170
171 METHOD default;
172 mdot.nominal := 2 {kg/s};
173 END default;
174 METHOD solve;
175 EXTERNAL do_solve(SELF);
176 END solve;
177 METHOD on_load;
178 RUN default_all; RUN reset; RUN values;
179 FIX p,h;
180 END on_load;
181 END stream_node;
182
183 MODEL stream_equipment;
184 inlet "in: inlet steam stream" IS_A stream_node;
185 outlet "out: outlet steam stream" IS_A stream_node;
186 inlet.cd, outlet.cd ARE_THE_SAME;
187 inlet.mdot, outlet.mdot ARE_THE_SAME;
188 cd ALIASES inlet.cd;
189 mdot ALIASES inlet.mdot;
190 END stream_equipment;
191
192 (*------------------------------------------------------------------------------
193 PUMP COMPONENT
194 *)
195
196 MODEL pump_simple REFINES stream_equipment;
197 NOTES
198 'block' SELF {Simple model of a pump using isentropic efficiency}
199 END NOTES;
200
201 dp IS_A delta_pressure;
202 inlet.p + dp = outlet.p;
203
204 outlet_is IS_A stream_state;
205 outlet_is.p, outlet.p ARE_THE_SAME;
206 outlet_is.cd, outlet.cd ARE_THE_SAME;
207 outlet_is.s, inlet.s ARE_THE_SAME;
208 eta IS_A fraction;
209
210 eta_eq:eta * (inlet.h - outlet.h) = (inlet.h - outlet_is.h);
211
212 (* work done on the environment, will be negative *)
213 Wdot IS_A energy_rate;
214 Wdot_eq:Wdot = mdot * w;
215
216
217 w IS_A specific_energy;
218 w_eq:w * eta = (outlet.h - inlet.h);
219
220 (*
221 NOTES
222 'inline' inlet {in:}
223 'inline' outlet {out:}
224 END NOTES;
225 *)
226 METHODS
227 METHOD default_self;
228 RUN inlet.default_self;
229 RUN outlet.default_self;
230 RUN outlet_is.default_self;
231 END default_self;
232 END pump_simple;
233
234 MODEL pump_simple_test REFINES pump_simple;
235 cd.component :== 'water';
236 METHODS
237 METHOD on_load;
238 RUN default_self;
239 FIX inlet.p; inlet.p := 5 {bar};
240 FIX inlet.h; inlet.h := 400 {kJ/kg};
241 FIX outlet.p; outlet.p := 100 {bar};
242 FIX eta; eta := 0.65;
243 FIX mdot; mdot := 900 {t/d};
244
245 inlet.v := 0.97 {L/kg};
246 inlet.T := 300 {K};
247
248 SOLVER QRSlv;
249 OPTION convopt 'RELNOM_SCALE';
250 OPTION iterationlimit 200;
251 END on_load;
252 END pump_simple_test;
253
254 (*------------------------------------------------------------------------------
255 TURBINE COMPONENT
256 *)
257
258 MODEL turbine_simple REFINES stream_equipment;
259 NOTES
260 'block' SELF {Simple turbine model}
261 END NOTES;
262
263 dp IS_A delta_pressure;
264 inlet.p + dp = outlet.p;
265
266 outlet_is IS_A stream_state;
267 outlet_is.cd, outlet.cd ARE_THE_SAME;
268 outlet_is.p, outlet.p ARE_THE_SAME;
269 outlet_is.s, inlet.s ARE_THE_SAME;
270
271 eta IS_A fraction;
272 eta_eq:eta * (inlet.h - outlet_is.h) = (inlet.h - outlet.h);
273
274 (* work done on the environment, will be positive *)
275 Wdot IS_A energy_rate;
276 Wedot_eq:Wdot = mdot * w;
277
278 w IS_A specific_energy;
279 w_eq:w = inlet.h - outlet.h;
280 METHODS
281 METHOD default_self;
282 RUN inlet.default_self;
283 RUN outlet.default_self;
284 RUN outlet_is.default_self;
285 END default_self;
286 END turbine_simple;
287
288 MODEL turbine_simple_test REFINES turbine_simple;
289 cd.component :== 'water';
290 METHODS
291 METHOD on_load;
292 RUN default_self;
293 FIX inlet.p;
294 FIX inlet.h;
295 FIX outlet.p;
296 FIX eta;
297 FIX mdot;
298
299 inlet.p := 100 {bar};
300 inlet.h := 3000 {kJ/kg};
301 outlet.p := 5 {bar};
302 eta := 0.85;
303 mdot := 900 {t/d};
304 END on_load;
305 END turbine_simple_test;
306
307 (*------------------------------------------------------------------------------
308 BOILER COMPONENT
309 *)
310
311 (*
312 simple model assumes no pressure drop, but heating losses due to
313 flue gas temperature
314 *)
315 MODEL boiler_simple REFINES stream_equipment;
316 NOTES
317 'block' SELF {Simple boiler model}
318 END NOTES;
319
320 inlet.p, outlet.p ARE_THE_SAME;
321 Qdot_fuel IS_A energy_rate;
322
323 q IS_A specific_energy;
324 q = (outlet.h - inlet.h);
325
326 Qdot IS_A energy_rate;
327 Qdot = mdot * q;
328
329 eta IS_A fraction;
330 Qdot = eta * Qdot_fuel;
331 METHODS
332 METHOD default_self;
333 RUN inlet.default_self;
334 RUN outlet.default_self;
335 END default_self;
336 END boiler_simple;
337
338 MODEL boiler_simple_test REFINES boiler_simple;
339 cd.component :== 'water';
340 METHODS
341 METHOD on_load;
342 RUN default_self;
343 FIX inlet.p;
344 FIX inlet.h;
345 FIX eta;
346 FIX mdot;
347
348 inlet.p := 100 {bar};
349 inlet.h := 500 {kJ/kg};
350
351 eta := 0.8;
352 outlet.h := 3000 {kJ/kg};
353 mdot := 900 {t/d};
354 END on_load;
355 END boiler_simple_test;
356
357 (*------------------------------------------------------------------------------
358 CONDENSER COMPONENT
359 *)
360
361 (*
362 this is really simple (fluid props permitting): just work out the heat
363 that must be expelled to get the water down to a certain state
364 *)
365 MODEL condenser_simple REFINES stream_equipment;
366 NOTES
367 'block' SELF {Simple condenser model}
368 'inline' inlet {in: yahoooo}
369 END NOTES;
370
371 inlet.p, outlet.p ARE_THE_SAME;
372 Qdot IS_A energy_rate;
373
374 cons_en: Qdot = mdot * (outlet.h - inlet.h);
375 METHODS
376 METHOD default_self;
377 RUN inlet.default_self;
378 RUN outlet.default_self;
379 END default_self;
380 END condenser_simple;
381
382 MODEL condenser_simple_test REFINES condenser_simple;
383 cd.component :== 'water';
384 METHODS
385 METHOD on_load;
386 RUN default_self;
387 FIX inlet.p, inlet.x;
388 FIX outlet.h;
389 FIX mdot;
390
391 inlet.p := 5 {bar};
392 inlet.x := 0.95;
393 outlet.h := 500 {kJ/kg};
394 mdot := 900 {t/d};
395 END on_load;
396 END condenser_simple_test;
397
398 (*------------------------------------------------------------------------------
399 FEEDWATER HEATER
400 *)
401
402 (*
403 open heater does not have inlet.mdot==outlet.mdot, so not a refinement
404 of 'stream_equipment'.
405 *)
406 MODEL heater_open;
407 NOTES
408 'block' SELF {Simple open feedwater heater model}
409 END NOTES;
410
411 inlet "in:" IS_A stream_node;
412 inlet_heat "in:" IS_A stream_node;
413 outlet "out:" IS_A stream_node;
414 inlet_heat.p, inlet.p, outlet.p ARE_THE_SAME;
415 inlet.cd, outlet.cd, inlet_heat.cd ARE_THE_SAME;
416 cd ALIASES inlet.cd;
417
418 (* cons. mass *)
419 cons_mass: inlet.mdot + inlet_heat.mdot = outlet.mdot;
420
421 m_ratio IS_A factor;
422 inlet_heat.mdot = m_ratio * inlet.mdot;
423 (* cons. energy *)
424 cons_en: inlet.h + m_ratio * inlet_heat.h = outlet.h;
425 METHODS
426 METHOD default_self;
427 RUN inlet.default_self;
428 RUN inlet_heat.default_self;
429 RUN outlet.default_self;
430 END default_self;
431 END heater_open;
432
433 MODEL heater_open_test REFINES heater_open;
434 cd.component :== 'water';
435 METHODS
436 METHOD on_load;
437 RUN default_self;
438 FIX inlet.p, inlet.h;
439 inlet.p := 40 {bar};
440 inlet.h := 634 {kJ/kg};
441 FIX inlet_heat.h;
442 inlet_heat.h := 2960 {kJ/kg};
443
444 FIX outlet.mdot;
445 outlet.mdot := 900 {t/d};
446
447 FIX inlet.mdot;
448 inlet.mdot := 700 {t/d};
449 END on_load;
450 END heater_open_test;
451
452 MODEL heater_open2;
453 NOTES
454 'block' SELF {Simple open feedwater heater model}
455 END NOTES;
456
457 inlet "in:" IS_A stream_node;
458 inlet_heat1 "in:" IS_A stream_node;
459 inlet_heat2 "in:" IS_A stream_node;
460 outlet "out:" IS_A stream_node;
461 inlet.cd, inlet_heat1.cd, inlet_heat2.cd, outlet.cd ARE_THE_SAME;
462 inlet_heat1.p, inlet_heat2.p, inlet.p, outlet.p ARE_THE_SAME;
463 cd ALIASES inlet.cd;
464
465 (* cons. mass *)
466 cons_mass: inlet.mdot + inlet_heat1.mdot + inlet_heat2.mdot = outlet.mdot;
467
468 (* cons. energy *)
469 cons_en: inlet.mdot * inlet.h + inlet_heat1.mdot * inlet_heat1.h
470 + inlet_heat2.mdot * inlet_heat2.h = outlet.mdot * outlet.h;
471 METHODS
472 METHOD default_self;
473 RUN inlet.default_self;
474 RUN inlet_heat.default_self;
475 RUN inlet_heat2.default_self;
476 RUN outlet.default_self;
477 END default_self;
478 END heater_open2;
479
480 MODEL heater_closed;
481 NOTES
482 'block' SELF {Simple open feedwater heater model}
483 END NOTES;
484
485 inlet "in:" IS_A stream_node;
486 inlet_heat "in:" IS_A stream_node;
487 outlet "out:" IS_A stream_node;
488 outlet_heat "out:" IS_A stream_node;
489
490 inlet.cd, outlet.cd ARE_THE_SAME;
491 inlet_heat.cd, outlet_heat.cd ARE_THE_SAME;
492 cd ALIASES inlet.cd;
493 cd_heat ALIASES inlet_heat.cd;
494
495 inlet_heat.p, outlet_heat.p ARE_THE_SAME;
496 inlet.p, outlet.p ARE_THE_SAME;
497
498 Qdot "heat transferred to main flow stream" IS_A energy_rate;
499
500 q IS_A specific_energy;
501 Qdot = q * inlet.mdot;
502
503 (* cons. mass *)
504 cons_mass: inlet.mdot = outlet.mdot;
505 cons_mass_heat: inlet_heat.mdot = outlet_heat.mdot;
506
507 m_ratio IS_A factor;
508 inlet_heat.mdot = inlet.mdot * m_ratio;
509
510 (* cons. energy *)
511 cons_en: q + inlet.h = outlet.h;
512 cons_en_heat: m_ratio * inlet_heat.h = m_ratio * outlet_heat.h + q;
513 METHODS
514 METHOD default_self;
515 RUN inlet.default_self;
516 RUN inlet_heat.default_self;
517 RUN outlet.default_self;
518 RUN outlet_heat.default_self;
519 END default_self;
520 END heater_closed;
521
522 MODEL heater_closed_test REFINES heater_closed;
523 cd.component :== 'water';
524 cd_heat.component :== 'water';
525 METHODS
526 METHOD on_load;
527 FIX inlet.p, inlet.h, inlet.mdot;
528 inlet.p := 40 {bar};
529 inlet.h := 634 {kJ/kg};
530 inlet.mdot := 700 {t/d};
531
532 FIX inlet_heat.p, inlet_heat.h, inlet_heat.mdot;
533 inlet_heat.p := 50 {bar};
534 inlet_heat.h := 2960 {kJ/kg};
535 inlet_heat.mdot := 500 {t/d};
536
537 FIX outlet.h;
538 outlet.h := 900 {kJ/kg};
539
540 SOLVER QRSlv;
541 OPTION convopt 'RELNOM_SCALE';
542 OPTION iterationlimit 200;
543 END on_load;
544 END heater_closed_test;
545
546 (*------------------------------------------------------------------------------
547 TEE PIECE
548 *)
549
550 (*
551 it's not a car :-)
552 *)
553 MODEL tee;
554 NOTES
555 'block' SELF {Model of a branching of two flow streams}
556 END NOTES;
557
558 inlet "in:" IS_A stream_node;
559 outlet "out:" IS_A stream_node;
560 outlet_branch "out:" IS_A stream_node;
561
562 inlet.cd, outlet.cd, outlet_branch.cd ARE_THE_SAME;
563 cd ALIASES inlet.cd;
564
565 inlet.p, outlet.p, outlet_branch.p ARE_THE_SAME;
566 inlet.h, outlet.h, outlet_branch.h ARE_THE_SAME;
567
568 (* cons. mass *)
569 cons_mass: inlet.mdot = outlet.mdot + outlet_branch.mdot;
570
571 phi IS_A fraction;
572 phi_eq: phi * inlet.mdot = outlet_branch.mdot;
573
574 END tee;
575
576 (*------------------------------------------------------------------------------
577 OVERALL CYCLE
578 *)
579
580 (*
581 simplest possible rankine cycle
582 *)
583 MODEL rankine_fprops;
584
585 BO IS_A boiler_simple;
586 TU IS_A turbine_simple;
587 CO IS_A condenser_simple;
588 PU IS_A pump_simple;
589
590 cd ALIASES BO.cd;
591 cd.component :== 'water';
592
593 BO.outlet, TU.inlet ARE_THE_SAME;
594 TU.outlet, CO.inlet ARE_THE_SAME;
595 CO.outlet, PU.inlet ARE_THE_SAME;
596 PU.outlet, BO.inlet ARE_THE_SAME;
597
598 Qdot_loss ALIASES CO.Qdot;
599
600 T_H ALIASES BO.outlet.T;
601 T_C ALIASES CO.outlet.T;
602
603 eta IS_A fraction;
604 eta * (BO.Qdot_fuel - PU.Wdot) = TU.Wdot;
605
606 eta_carnot IS_A fraction;
607 eta_carnot = 1 - T_C / T_H;
608
609 mdot ALIASES TU.mdot;
610 x_turb_out ALIASES TU.outlet.x;
611 METHODS
612 METHOD default_self;
613 RUN BO.default_self;
614 RUN TU.default_self;
615 RUN CO.default_self;
616 RUN PU.default_self;
617 END default_self;
618 (* first test case: just some plausible values *)
619 METHOD specify_1;
620 RUN ClearAll;
621 FIX PU.inlet.p;
622 FIX PU.inlet.h;
623 FIX PU.outlet.p;
624 FIX BO.outlet.h;
625 FIX TU.eta;
626 FIX PU.eta;
627 FIX BO.eta;
628 FIX mdot;
629 END specify_1;
630 METHOD values_1;
631 PU.inlet.p := 1 {bar};
632 PU.inlet.h := 104.9 {kJ/kg};
633 PU.outlet.p := 250 {bar};
634 BO.outlet.h := 3772 {kJ/kg};
635 TU.eta := 0.85;
636 PU.eta := 0.65;
637 BO.eta := 0.9;
638 mdot := 900 {t/d};
639 END values_1;
640 (*
641 second test case: numbers from Example 2.1, K Weston, 'Energy Conversion',
642 1992, http://www.personal.utulsa.edu/~kenneth-weston/
643 *)
644 METHOD specify;
645 RUN ClearAll;
646 FIX PU.outlet.p;
647 FIX BO.outlet.T;
648 FIX PU.inlet.p;
649 FIX PU.inlet.h;
650 FIX TU.eta;
651 FIX PU.eta;
652 FIX BO.eta;
653 FIX mdot;
654 END specify;
655 METHOD values;
656 PU.outlet.p := 2000 {psi};
657 BO.outlet.T := 1460 {R}; BO.outlet.h := 3400 {kJ/kg};
658 PU.inlet.p := 1 {psi};
659 PU.inlet.h := 69.73 {btu/lbm};
660 TU.eta := 1.0;
661 PU.eta := 1.0;
662 BO.eta := 1.0;
663 mdot := 900 {t/d};
664 END values;
665 METHOD on_load;
666 RUN default_self;
667 RUN specify;
668 RUN values;
669
670 SOLVER QRSlv;
671 OPTION convopt 'RELNOM_SCALE';
672 OPTION iterationlimit 200;
673 END on_load;
674 METHOD self_test;
675 (* check the results against those from K Weston's book *)
676 (* note that we have NOT neglected pump work in this case! *)
677 ASSERT abs(eta - 0.4294) < 0.0005;
678 ASSERT abs(eta_carnot - 0.6152) < 0.0005;
679 ASSERT abs(TU.outlet.x - 0.7736) < 0.0005;
680 ASSERT abs(TU.w - 603.1 {btu/lbm}) < 0.7 {btu/lbm};
681 END self_test;
682 END rankine_fprops;
683
684
685 (*------------------------------------------------------------------------------
686 REHEAT RANKINE CYCLE
687 *)
688 MODEL rankine_reheat;
689
690 BO1 IS_A boiler_simple;
691 BO2 IS_A boiler_simple;
692 TU1 IS_A turbine_simple;
693 TU2 IS_A turbine_simple;
694 CO IS_A condenser_simple;
695 PU IS_A pump_simple;
696
697 BO1.cd.component :== 'water';
698
699 BO1.outlet, TU1.inlet ARE_THE_SAME;
700 TU1.outlet, BO2.inlet ARE_THE_SAME;
701 BO2.outlet, TU2.inlet ARE_THE_SAME;
702 TU2.outlet, CO.inlet ARE_THE_SAME;
703 CO.outlet, PU.inlet ARE_THE_SAME;
704 PU.outlet, BO1.inlet ARE_THE_SAME;
705
706 BO1.eta, BO2.eta ARE_THE_SAME;
707
708 (* boiler peak temperature is reached for both main and reheat... *)
709 BO1.outlet.T, BO2.outlet.T ARE_THE_SAME;
710
711 mdot ALIASES PU.mdot;
712
713 T_H ALIASES BO1.outlet.T;
714 T_C ALIASES CO.outlet.T;
715
716 eta IS_A fraction;
717 eta * (BO1.Qdot_fuel + BO2.Qdot_fuel - PU.Wdot) = TU1.Wdot + TU2.Wdot;
718
719 eta_carnot IS_A fraction;
720 eta_carnot = 1 - T_C / T_H;
721
722 METHODS
723 METHOD default_self;
724 RUN BO1.default_self;
725 RUN BO2.default_self;
726 RUN TU1.default_self;
727 RUN TU2.default_self;
728 RUN CO.default_self;
729 RUN PU.default_self;
730 END default_self;
731 (*
732 The on_load scenario reproduces the same calculation from
733 K Weston, op. cit., Example 2.5, p. 51.
734 *)
735 METHOD on_load;
736 FIX BO1.eta;
737 BO1.eta := 1.0;
738 FIX TU1.eta, TU2.eta;
739 TU1.eta := 1.0;
740 TU2.eta := 1.0;
741 FIX PU.eta;
742 PU.eta := 1.0;
743 FIX PU.inlet.p;
744 PU.inlet.p := 1 {psi};
745 FIX PU.inlet.h;
746 PU.inlet.h := 69.73 {btu/lbm};
747 FIX BO1.outlet.T;
748 BO1.outlet.T := 1460 {R};
749 BO1.outlet.h := 3000 {kJ/kg}; (* guess *)
750 TU1.outlet.h := 3000 {kJ/kg}; (* guess *)
751 FIX PU.outlet.p;
752 PU.outlet.p := 2000 {psi};
753 FIX mdot;
754 mdot := 900 {t/d};
755
756 (* this value here is what defines the intermediate pressure *)
757 FIX TU1.outlet.T;
758 TU1.outlet.T := 860 {R};
759
760 TU2.inlet.h := 3000 {kJ/kg}; (* guess *)
761
762 SOLVER QRSlv;
763 OPTION convopt 'RELNOM_SCALE';
764 OPTION iterationlimit 200;
765 END on_load;
766 METHOD self_test;
767 ASSERT abs(eta - 0.443) < 0.0005;
768 ASSERT abs(TU2.outlet.x - 0.926) < 0.0015;
769 ASSERT abs(TU1.w + TU2.w) - 763.1 {btu/lbm} < 1 {btu/lbm};
770 END self_test;
771 END rankine_reheat;
772
773
774
775
776 (*------------------------------------------------------------------------------
777 REGENERATIVE RANKINE CYCLE
778 *)
779 (*
780 Add a boiler feedwater heater and two-stage turbine.
781 *)
782 MODEL rankine_regen;
783
784 BO IS_A boiler_simple;
785 TU1 IS_A turbine_simple;
786 BL IS_A tee; (* bleed *)
787 TU2 IS_A turbine_simple;
788 CO IS_A condenser_simple;
789 HE IS_A heater_open;
790 PU1 IS_A pump_simple;
791 PU2 IS_A pump_simple;
792
793 BO.cd.component :== 'water';
794
795 (* main loop *)
796 BO.outlet, TU1.inlet ARE_THE_SAME;
797 TU1.outlet, BL.inlet ARE_THE_SAME;
798 BL.outlet, TU2.inlet ARE_THE_SAME;
799 TU2.outlet, CO.inlet ARE_THE_SAME;
800 CO.outlet, PU1.inlet ARE_THE_SAME;
801 PU1.outlet, HE.inlet ARE_THE_SAME;
802 HE.outlet, PU2.inlet ARE_THE_SAME;
803 PU2.outlet, BO.inlet ARE_THE_SAME;
804
805 (* bleed stream *)
806 BL.outlet_branch, HE.inlet_heat ARE_THE_SAME;
807 phi ALIASES BL.phi;
808 p_bleed ALIASES TU1.outlet.p;
809
810 p_bleed_ratio IS_A fraction;
811 p_bleed_ratio * (TU1.inlet.p - TU2.outlet.p) = (TU1.outlet.p - TU2.outlet.p);
812
813 mdot ALIASES BO.mdot;
814
815 T_H ALIASES BO.outlet.T;
816 T_C ALIASES CO.outlet.T;
817
818 eta IS_A fraction;
819 eta_eq:eta * (BO.Qdot_fuel) = TU1.Wdot + TU2.Wdot + PU1.Wdot + PU2.Wdot;
820
821 Wdot_TU1 ALIASES TU1.Wdot;
822 Wdot_TU2 ALIASES TU2.Wdot;
823 Wdot_PU1 ALIASES PU1.Wdot;
824 Wdot_PU2 ALIASES PU2.Wdot;
825 Qdot_fuel ALIASES BO.Qdot_fuel;
826
827 eta_carnot IS_A fraction;
828 eta_carnot_eq: eta_carnot = 1 - T_C / T_H;
829
830 (* some checking output... *)
831
832 phi_weston IS_A fraction;
833 phi_weston_eq:phi_weston * (TU1.outlet.h - PU1.outlet.h) = (PU2.inlet.h - PU1.outlet.h);
834 phi_eq:phi_weston = phi;
835
836 w_net IS_A specific_energy;
837 w_net_eq: TU1.mdot * w_net = TU1.mdot * (TU1.inlet.h - TU1.outlet.h) + TU2.mdot * (TU2.inlet.h - TU2.outlet.h);
838
839 q_a IS_A specific_energy;
840 q_a_eq: q_a = TU1.inlet.h - PU2.outlet.h;
841
842 Wdot IS_A energy_rate;
843 Wdot_eq: Wdot = TU1.Wdot + TU2.Wdot + PU1.Wdot + PU2.Wdot;
844
845 cons_en: HE.inlet.mdot * HE.inlet.h + HE.inlet_heat.mdot * HE.inlet_heat.h = HE.outlet.mdot * HE.outlet.h;
846
847 METHODS
848 METHOD default_self;
849 RUN BO.default_self;
850 RUN TU1.default_self;
851 RUN TU2.default_self;
852 RUN CO.default_self;
853 RUN PU1.default_self;
854 RUN PU2.default_self;
855 BO.outlet.h := 4000 {kJ/kg};
856 p_bleed := 37 {bar};
857 TU1.outlet.h := 2300 {kJ/kg};
858 BL.cons_mass.included := FALSE;
859 (*HE.cons_mass.included := FALSE;*)
860 HE.cons_en.included := FALSE;
861 cons_en.included := FALSE;
862 HE.inlet.v := 100 {m^3/kg};
863 HE.inlet.p.nominal := 40 {bar};
864 HE.inlet.v.nominal := 1 {L/kg};
865 HE.inlet.h.nominal := 100 {kJ/kg};
866 END default_self;
867 METHOD on_load;
868 RUN moran_ex_8_5;
869 (*
870 This model needs to be solved using QRSlv with convopt set to 'RELNOMSCALE'.
871 *)
872 SOLVER QRSlv;
873 OPTION convopt 'RELNOM_SCALE';
874 OPTION iterationlimit 400;
875 END on_load;
876 METHOD moran_ex_8_5;
877 RUN default_self;
878 (*
879 This is Example 8.5 from Moran and Shapiro, 'Fundamentals of
880 Engineering Thermodynamics', 4th Ed.
881 *)
882 RUN ClearAll;
883 (* component efficiencies *)
884 FIX BO.eta; BO.eta := 1.0;
885 FIX TU1.eta; TU1.eta := 0.85;
886 FIX TU2.eta; TU2.eta := 0.85;
887 FIX PU1.eta; PU1.eta := 1.0;
888 FIX PU2.eta; PU2.eta := 1.0;
889 (* turbine conditions *)
890 FIX TU1.inlet.p; TU1.inlet.p := 8. {MPa};
891 FIX TU1.inlet.T; TU1.inlet.T := 480 {K} + 273.15 {K};
892 FIX TU1.outlet.p; TU1.outlet.p := 0.7 {MPa};
893 FIX TU2.outlet.p; TU2.outlet.p := 0.008 {MPa};
894 (* heater conditions *)
895 (* FIX HE.outlet.p; HE.outlet.p := 0.7 {MPa}; *)
896 FIX CO.outlet.x; CO.outlet.x := 0.0001;
897 FIX HE.outlet.x; HE.outlet.x := 0.0001;
898 FIX Wdot; Wdot := 100 {MW};
899 END moran_ex_8_5;
900 METHOD self_test;
901 (* solution values to the Moran & Shapiro example 8.5 problem *)
902 ASSERT abs(eta - 0.369) < 0.001;
903 ASSERT abs((TU1.Wdot+TU2.Wdot)/mdot - 984.4{kJ/kg}) < 1 {kJ/kg};
904 ASSERT abs(mdot - 3.69e5 {kg/h}) < 0.05e5 {kg/h};
905 ASSERT abs(CO.inlet.h - 2249.3 {kJ/kg}) < 1.0 {kJ/kg};
906 END self_test;
907 METHOD weston_ex_2_6;
908 (*
909 The scenario here is example 2.6 from K Weston (op. cit.), p. 55.
910 *)
911 RUN ClearAll;
912
913 (* all ideal components *)
914 FIX BO.eta; BO.eta := 1.0;
915 FIX TU1.eta; TU1.eta := 1.0;
916 FIX TU2.eta; TU2.eta := 1.0;
917 FIX PU1.eta; PU1.eta := 1.0;
918 FIX PU2.eta; PU2.eta := 1.0;
919
920 (* mass flow rate is arbitrary *)
921 FIX mdot;
922 mdot := 10 {kg/s};
923
924 (* max pressure constraint *)
925 FIX PU2.outlet.p;
926 PU2.outlet.p := 2000 {psi};
927 PU2.outlet.h := 1400 {btu/lbm}; (* guess *)
928
929 (* boiler max temp *)
930 FIX BO.outlet.T;
931 BO.outlet.T := 1460 {R};
932 BO.outlet.h := 1400 {btu/lbm}; (* guess *)
933
934 (* intermediate temperature setting *)
935 FIX TU1.outlet.p;
936 TU1.outlet.p := 200 {psi};
937 (* FIX TU1.outlet.T;
938 TU1.outlet.T := 860 {R}; (* 400 °F *)
939 TU1.outlet.h := 3000 {kJ/kg}; (* guess *) *)
940
941 (* minimum pressure constraint *)
942 FIX CO.outlet.p;
943 CO.outlet.p := 1 {psi};
944
945 (* condenser outlet is saturated liquid *)
946 FIX CO.outlet.h;
947 CO.outlet.h := 69.73 {btu/lbm};
948
949 (* remove the redundant balance equations *)
950 HE.cons_mass.included := TRUE;
951 HE.cons_en.included := TRUE;
952 BL.cons_mass.included := FALSE;
953 phi_weston_eq.included := TRUE;
954 phi_eq.included := FALSE;
955 cons_en.included := FALSE;
956
957 (* fix the bleed ratio *)
958 FIX BL.phi;
959 BL.phi := 0.251;
960
961 (* FIX BL.outlet.h;
962 BL.outlet.h := 355.5 {btu/lbm}; *)
963
964 (**
965 these values seem to be from another problem, need to check which ...
966 ASSERT abs(TU1.inlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};
967 ASSERT abs(TU1.outlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};
968 ASSERT abs(TU2.outlet.s - 1.5603 {btu/lbm/R}) < 0.01 {btu/lbm/R};
969 ASSERT abs(PU1.inlet.s - 0.1326 {btu/lbm/R}) < 0.001 {btu/lbm/R};
970 ASSERT abs(PU1.outlet.s - 0.1326 {btu/lbm/R}) < 0.002 {btu/lbm/R};
971 ASSERT abs(PU2.inlet.s - 0.5438 {btu/lbm/R}) < 0.002 {btu/lbm/R};
972 ASSERT abs(PU2.outlet.s - 0.5438 {btu/lbm/R}) < 0.002 {btu/lbm/R};
973
974 ASSERT abs(TU1.inlet.h - 1474.1 {btu/lbm}) < 1.5 {btu/lbm};
975 ASSERT abs(TU1.outlet.h - 1210.0 {btu/lbm}) < 1.5 {btu/lbm};
976 ASSERT abs(TU2.outlet.h - 871.0 {btu/lbm}) < 1.5 {btu/lbm};
977 ASSERT abs(PU1.inlet.h - 69.73 {btu/lbm}) < 0.001 {btu/lbm};
978 ASSERT abs(PU1.outlet.h - 69.73 {btu/lbm}) < 1.0 {btu/lbm};
979 ASSERT abs(PU2.inlet.h - 355.5 {btu/lbm}) < 1.5 {btu/lbm};
980 ASSERT abs(PU2.outlet.h - 355.5 {btu/lbm}) < 8 {btu/lbm};
981
982 ASSERT abs(w_net - 518.1 {btu/lbm}) < 0.3 {btu/lbm};
983
984 ASSERT abs(w_net * mdot - (TU1.Wdot + TU2.Wdot)) < 1 {W};
985
986 ASSERT abs(q_a - 1118.6 {btu/lbm}) < 7 {btu/lbm};
987
988 ASSERT abs(eta - 0.463) < 0.003;
989
990 ASSERT abs(phi - 0.251) < 0.001;
991 *)
992 END weston_ex_2_6;
993 END rankine_regen;

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