/[ascend]/trunk/models/test/fprops/fprops_test_base.a4c
ViewVC logotype

Contents of /trunk/models/test/fprops/fprops_test_base.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2660 - (show annotations) (download) (as text)
Wed Jan 16 05:57:03 2013 UTC (5 years, 10 months ago) by jpye
File MIME type: text/x-ascend
File size: 21386 byte(s)
Working on updating rankine_fprops and associated models to work with new fprops2 code.
Some issue discovered with (p,h) for water (added python/solve_ph1.py to check it).
Next cunit tests to drive some ASCEND models embedding FPROPS (note use of slvreq for this).
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, see <http://www.gnu.org/licenses/>.
16 *)(*
17 A number of Rankine-cycle (steam turbine power cycle) models of increasing
18 complexity, following the general development of Moran & Shapiro, Çengel,
19 and others.
20
21 Author: John Pye
22 *)
23
24 REQUIRE "atoms.a4l";
25 REQUIRE "johnpye/thermo_types.a4c";
26
27 IMPORT "johnpye/fprops/fprops";
28 IMPORT "qrslv";
29
30 (*------------------------------------------------------------------------------
31 BACKGROUND STUFF
32 *)
33
34 MODEL fluid;
35 component IS_A symbol_constant;
36 type IS_A symbol_constant;
37 END fluid;
38
39 (*
40 Thermo properties -- IAPWS-IF97
41 *)
42 MODEL stream_state;
43 cd IS_A fluid;
44 p IS_A pressure;
45 h IS_A specific_enthalpy;
46
47 T IS_A temperature;
48 v IS_A specific_volume;
49 s IS_A specific_entropy;
50 x IS_A fraction;
51
52 calc_vT: fprops_phsx_vT(
53 v, T : INPUT;
54 p, h, s, x : OUTPUT;
55 cd : DATA
56 );
57 calc_ph: fprops_Tvsx_ph(
58 p, h : INPUT;
59 T, v, s, x : OUTPUT;
60 cd : DATA
61 );
62 METHODS
63 METHOD default;
64 p := 10{bar};
65 p.nominal := 42 {bar};
66 IF cd.component == 'water' THEN
67 h := 2000 {kJ/kg};
68 ELSE
69 IF cd.component == 'carbondioxide' THEN
70 h := 350 {kJ/kg};
71 ELSE
72 h := 351 {kJ/kg};
73 END IF;
74 END IF;
75
76 T := 400 {K};
77 v.nominal := 10 {L/kg};
78 s := 4 {kJ/kg/K};
79 x := 0.8;
80
81 RUN enable_ph;
82 END default;
83 METHOD default_self;
84 RUN default;
85 END default_self;
86 METHOD enable_vT;
87 FOR i IN [1..4] DO
88 calc_ph[i].included := FALSE;
89 calc_vT[i].included := TRUE;
90 END FOR;
91 END enable_vT;
92 METHOD enable_ph;
93 FOR i IN [1..4] DO
94 calc_ph[i].included := TRUE;
95 calc_vT[i].included := FALSE;
96 END FOR;
97 END enable_ph;
98 METHOD solve;
99 EXTERNAL do_solve(SELF);
100 END solve;
101 END stream_state;
102
103 MODEL stream_state_test REFINES stream_state;
104 cd.component :== 'water';
105 cd.type :== 'helmholtz';
106 METHODS
107 METHOD on_load;
108 RUN default_all;
109 FIX p, h;
110 p := 10 {bar};
111 h := 2000 {kJ/kg};
112 SOLVER QRSlv;
113 OPTION convopt 'RELNOM_SCALE';
114 SOLVE;
115 ASSERT abs(T - 453.03 {K}) < 0.01 {K};
116 ASSERT abs(v - 0.119808 {m^3/kg}) < 0.0001 {m^3/kg};
117 ASSERT abs(x - 0.6142) < 0.0001;
118 ASSERT abs(s - 4.8696 {kJ/kg/K}) < 0.0001 {kJ/kg/K};
119 END on_load;
120 END stream_state_test;
121
122
123 MODEL stream_state_test_co2 REFINES stream_state;
124 cd.component :== 'carbondioxide';
125 cd.type :== 'helmholtz';
126 METHODS
127 METHOD on_load;
128 RUN default_all;
129 h := 350 {kJ/kg};
130 FIX p, x;
131 p := 6 {bar};
132 x := 1e-6;
133 SOLVER QRSlv;
134 OPTION convopt 'RELNOM_SCALE';
135 SOLVE;
136 ASSERT abs(T - 220.03 {K}) < 0.005 {K};
137 ASSERT abs(v - 1/(1166 {kg/m^3})) < 1/(0.5 {kg/m^3});
138 END on_load;
139 END stream_state_test_co2;
140
141
142 MODEL stream_state_test_toluene REFINES stream_state;
143 cd.component :== 'toluene';
144 cd.type :== 'helmholtz';
145 METHODS
146 METHOD on_load;
147 RUN default_all;
148 FIX p, x;
149 p := 8 {kPa};
150 x := 1e-6;
151 SOLVER QRSlv;
152 OPTION convopt 'RELNOM_SCALE';
153 SOLVE;
154 ASSERT abs(T - 313.45 {K}) < 0.005 {K};
155 ASSERT abs(v - 1/(874.84 {kg/m^3})) < 1/(0.005 {kg/m^3});
156 END on_load;
157 END stream_state_test_toluene;
158
159
160 (* a simple connector that includes calculation of steam properties *)
161 MODEL stream_node;
162 state IS_A stream_state;
163 cd ALIASES state.cd;
164 p ALIASES state.p;
165 h ALIASES state.h;
166 v ALIASES state.v;
167 T ALIASES state.T;
168 s ALIASES state.s;
169 x ALIASES state.x;
170 mdot IS_A mass_rate;
171 METHODS
172
173 METHOD default_self;
174 RUN state.default_self;
175 RUN default;
176 END default_self;
177
178 METHOD default;
179 mdot.nominal := 2 {kg/s};
180 END default;
181 METHOD solve;
182 EXTERNAL do_solve(SELF);
183 END solve;
184 METHOD on_load;
185 RUN default_all; RUN reset; RUN values;
186 FIX p,h;
187 END on_load;
188 END stream_node;
189
190 MODEL stream_equipment;
191 inlet "in: inlet steam stream" IS_A stream_node;
192 outlet "out: outlet steam stream" IS_A stream_node;
193 inlet.cd, outlet.cd ARE_THE_SAME;
194 inlet.mdot, outlet.mdot ARE_THE_SAME;
195 cd ALIASES inlet.cd;
196 mdot ALIASES inlet.mdot;
197 END stream_equipment;
198
199 (*------------------------------------------------------------------------------
200 PUMP COMPONENT
201 *)
202
203 MODEL pump_simple REFINES stream_equipment;
204 NOTES
205 'block' SELF {Simple model of a pump using isentropic efficiency}
206 END NOTES;
207
208 dp IS_A delta_pressure;
209 inlet.p + dp = outlet.p;
210
211 outlet_is IS_A stream_state;
212 outlet_is.p, outlet.p ARE_THE_SAME;
213 outlet_is.cd, outlet.cd ARE_THE_SAME;
214 outlet_is.s, inlet.s ARE_THE_SAME;
215 eta IS_A fraction;
216
217 eta_eq:eta * (inlet.h - outlet.h) = (inlet.h - outlet_is.h);
218
219 (* work done on the environment, will be negative *)
220 Wdot IS_A energy_rate;
221 Wdot_eq:Wdot = mdot * w;
222
223 w IS_A negative_specific_work;
224 w_eq:w = inlet.h - outlet.h;
225 METHODS
226 METHOD default_self;
227 RUN inlet.default_self;
228 RUN outlet.default_self;
229 RUN outlet_is.default_self;
230 END default_self;
231 END pump_simple;
232
233 MODEL pump_simple_test REFINES pump_simple;
234 cd.component :== 'water';
235 cd.type :== 'helmholtz';
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 SOLVE;
252 END on_load;
253 END pump_simple_test;
254
255 (*------------------------------------------------------------------------------
256 TURBINE COMPONENT
257 *)
258
259 MODEL turbine_simple REFINES stream_equipment;
260 NOTES
261 'block' SELF {Simple turbine model}
262 END NOTES;
263
264 dp IS_A delta_pressure;
265 inlet.p + dp = outlet.p;
266
267 outlet_is IS_A stream_state;
268 outlet_is.cd, outlet.cd ARE_THE_SAME;
269 outlet_is.p, outlet.p ARE_THE_SAME;
270 outlet_is.s, inlet.s ARE_THE_SAME;
271
272 eta IS_A fraction;
273 eta_eq:eta * (inlet.h - outlet_is.h) = (inlet.h - outlet.h);
274
275 (* work done on the environment, will be positive *)
276 Wdot IS_A energy_rate;
277 Wedot_eq:Wdot = mdot * w;
278
279 w IS_A positive_specific_work;
280 w_eq:w = inlet.h - outlet.h;
281 METHODS
282 METHOD default_self;
283 RUN inlet.default_self;
284 RUN outlet.default_self;
285 RUN outlet_is.default_self;
286 END default_self;
287 END turbine_simple;
288
289 MODEL turbine_simple_test REFINES turbine_simple;
290 cd.component :== 'water';
291 METHODS
292 METHOD on_load;
293 RUN default_self;
294 FIX inlet.p;
295 FIX inlet.h;
296 FIX outlet.p;
297 FIX eta;
298 FIX mdot;
299
300 inlet.p := 100 {bar};
301 inlet.h := 3000 {kJ/kg};
302 outlet.p := 5 {bar};
303 eta := 0.85;
304 mdot := 900 {t/d};
305 END on_load;
306 END turbine_simple_test;
307
308 (*------------------------------------------------------------------------------
309 BOILER COMPONENT
310 *)
311
312 (*
313 simple model assumes no pressure drop, but heating losses due to
314 flue gas temperature
315 *)
316 MODEL boiler_simple REFINES stream_equipment;
317 NOTES
318 'block' SELF {Simple boiler model}
319 END NOTES;
320
321 inlet.p, outlet.p ARE_THE_SAME;
322 Qdot_fuel IS_A energy_rate;
323
324 q IS_A specific_energy;
325 q = (outlet.h - inlet.h);
326
327 Qdot IS_A energy_rate;
328 heateqn: Qdot = mdot * q;
329
330 eta IS_A fraction;
331 Qdot = eta * Qdot_fuel;
332 METHODS
333 METHOD default_self;
334 RUN inlet.default_self;
335 RUN outlet.default_self;
336 END default_self;
337 END boiler_simple;
338
339 MODEL boiler_simple_test REFINES boiler_simple;
340 cd.component :== 'water';
341 METHODS
342 METHOD on_load;
343 RUN default_self;
344 FIX inlet.p;
345 FIX inlet.h;
346 FIX eta;
347 FIX mdot;
348
349 inlet.p := 100 {bar};
350 inlet.h := 500 {kJ/kg};
351
352 eta := 0.8;
353 outlet.h := 3000 {kJ/kg};
354 mdot := 900 {t/d};
355 END on_load;
356 END boiler_simple_test;
357
358 (*------------------------------------------------------------------------------
359 CONDENSER COMPONENT
360 *)
361
362 (*
363 this is really simple (fluid props permitting): just work out the heat
364 that must be expelled to get the water down to a certain state
365 *)
366 MODEL condenser_simple REFINES stream_equipment;
367 NOTES
368 'block' SELF {Simple condenser model}
369 'inline' inlet {in: yahoooo}
370 END NOTES;
371
372 inlet.p, outlet.p ARE_THE_SAME;
373 Qdot IS_A energy_rate;
374
375 cons_en: Qdot = mdot * (outlet.h - inlet.h);
376 METHODS
377 METHOD default_self;
378 RUN inlet.default_self;
379 RUN outlet.default_self;
380 END default_self;
381 END condenser_simple;
382
383 MODEL condenser_simple_test REFINES condenser_simple;
384 cd.component :== 'water';
385 METHODS
386 METHOD on_load;
387 RUN default_self;
388 FIX inlet.p, inlet.x;
389 FIX outlet.h;
390 FIX mdot;
391
392 inlet.p := 5 {bar};
393 inlet.x := 0.95;
394 outlet.h := 500 {kJ/kg};
395 mdot := 900 {t/d};
396 END on_load;
397 END condenser_simple_test;
398
399 (*------------------------------------------------------------------------------
400 FEEDWATER HEATER
401 *)
402
403 (*
404 open heater does not have inlet.mdot==outlet.mdot, so not a refinement
405 of 'stream_equipment'.
406 *)
407 MODEL heater_open;
408 NOTES
409 'block' SELF {Simple open feedwater heater model}
410 END NOTES;
411
412 inlet "in:" IS_A stream_node;
413 inlet_heat "in:" IS_A stream_node;
414 outlet "out:" IS_A stream_node;
415 inlet_heat.p, inlet.p, outlet.p ARE_THE_SAME;
416 inlet.cd, outlet.cd, inlet_heat.cd ARE_THE_SAME;
417 cd ALIASES inlet.cd;
418
419 (* cons. mass *)
420 cons_mass: inlet.mdot + inlet_heat.mdot = outlet.mdot;
421
422 m_ratio IS_A factor;
423 inlet_heat.mdot = m_ratio * inlet.mdot;
424 (* cons. energy *)
425 cons_en: inlet.h + m_ratio * inlet_heat.h = outlet.h;
426 METHODS
427 METHOD default_self;
428 RUN inlet.default_self;
429 RUN inlet_heat.default_self;
430 RUN outlet.default_self;
431 END default_self;
432 END heater_open;
433
434 MODEL heater_open_test REFINES heater_open;
435 cd.component :== 'water';
436 METHODS
437 METHOD on_load;
438 RUN default_self;
439 FIX inlet.p, inlet.h;
440 inlet.p := 40 {bar};
441 inlet.h := 634 {kJ/kg};
442 FIX inlet_heat.h;
443 inlet_heat.h := 2960 {kJ/kg};
444
445 FIX outlet.mdot;
446 outlet.mdot := 900 {t/d};
447
448 FIX inlet.mdot;
449 inlet.mdot := 700 {t/d};
450 END on_load;
451 END heater_open_test;
452
453 MODEL heater_open2;
454 NOTES
455 'block' SELF {Simple open feedwater heater model}
456 END NOTES;
457
458 inlet "in:" IS_A stream_node;
459 inlet_heat1 "in:" IS_A stream_node;
460 inlet_heat2 "in:" IS_A stream_node;
461 outlet "out:" IS_A stream_node;
462 inlet.cd, inlet_heat1.cd, inlet_heat2.cd, outlet.cd ARE_THE_SAME;
463 inlet_heat1.p, inlet_heat2.p, inlet.p, outlet.p ARE_THE_SAME;
464 cd ALIASES inlet.cd;
465
466 (* cons. mass *)
467 cons_mass: inlet.mdot + inlet_heat1.mdot + inlet_heat2.mdot = outlet.mdot;
468
469 (* cons. energy *)
470 cons_en: inlet.mdot * inlet.h + inlet_heat1.mdot * inlet_heat1.h
471 + inlet_heat2.mdot * inlet_heat2.h = outlet.mdot * outlet.h;
472 METHODS
473 METHOD default_self;
474 RUN inlet.default_self;
475 RUN inlet_heat.default_self;
476 RUN inlet_heat2.default_self;
477 RUN outlet.default_self;
478 END default_self;
479 END heater_open2;
480
481 MODEL heater_closed;
482 NOTES
483 'block' SELF {Simple open feedwater heater model}
484 END NOTES;
485
486 inlet "in:" IS_A stream_node;
487 inlet_heat "in:" IS_A stream_node;
488 outlet "out:" IS_A stream_node;
489 outlet_heat "out:" IS_A stream_node;
490
491 inlet.cd, outlet.cd ARE_THE_SAME;
492 inlet_heat.cd, outlet_heat.cd ARE_THE_SAME;
493 cd ALIASES inlet.cd;
494 cd_heat ALIASES inlet_heat.cd;
495
496 inlet_heat.p, outlet_heat.p ARE_THE_SAME;
497 inlet.p, outlet.p ARE_THE_SAME;
498
499 Qdot "heat transferred to main flow stream" IS_A energy_rate;
500
501 q IS_A specific_energy;
502 Qdot = q * inlet.mdot;
503
504 (* cons. mass *)
505 cons_mass: inlet.mdot = outlet.mdot;
506 cons_mass_heat: inlet_heat.mdot = outlet_heat.mdot;
507
508 m_ratio IS_A factor;
509 inlet_heat.mdot = inlet.mdot * m_ratio;
510
511 (* cons. energy *)
512 cons_en: q + inlet.h = outlet.h;
513 cons_en_heat: m_ratio * inlet_heat.h = m_ratio * outlet_heat.h + q;
514 METHODS
515 METHOD default_self;
516 RUN inlet.default_self;
517 RUN inlet_heat.default_self;
518 RUN outlet.default_self;
519 RUN outlet_heat.default_self;
520 END default_self;
521 END heater_closed;
522
523 MODEL heater_closed_test REFINES heater_closed;
524 cd.component :== 'water';
525 cd_heat.component :== 'water';
526 METHODS
527 METHOD on_load;
528 FIX inlet.p, inlet.h, inlet.mdot;
529 inlet.p := 40 {bar};
530 inlet.h := 634 {kJ/kg};
531 inlet.mdot := 700 {t/d};
532
533 FIX inlet_heat.p, inlet_heat.h, inlet_heat.mdot;
534 inlet_heat.p := 50 {bar};
535 inlet_heat.h := 2960 {kJ/kg};
536 inlet_heat.mdot := 500 {t/d};
537
538 FIX outlet.h;
539 outlet.h := 900 {kJ/kg};
540
541 SOLVER QRSlv;
542 OPTION convopt 'RELNOM_SCALE';
543 OPTION iterationlimit 200;
544 END on_load;
545 END heater_closed_test;
546
547 (*------------------------------------------------------------------------------
548 TEE PIECE
549 *)
550
551 (*
552 it's not a car :-)
553 *)
554 MODEL tee;
555 NOTES
556 'block' SELF {Model of a branching of two flow streams}
557 END NOTES;
558
559 inlet "in:" IS_A stream_node;
560 outlet "out:" IS_A stream_node;
561 outlet_branch "out:" IS_A stream_node;
562
563 inlet.cd, outlet.cd, outlet_branch.cd ARE_THE_SAME;
564 cd ALIASES inlet.cd;
565
566 inlet.p, outlet.p, outlet_branch.p ARE_THE_SAME;
567 inlet.h, outlet.h, outlet_branch.h ARE_THE_SAME;
568
569 (* cons. mass *)
570 cons_mass: inlet.mdot = outlet.mdot + outlet_branch.mdot;
571
572 phi IS_A fraction;
573 phi_eq: phi * inlet.mdot = outlet_branch.mdot;
574
575 END tee;
576
577 (*------------------------------------------------------------------------------
578 OVERALL CYCLE
579 *)
580
581 (*
582 simplest possible rankine cycle
583 *)
584 MODEL rankine_common;
585
586 BO IS_A boiler_simple;
587 TU IS_A turbine_simple;
588 CO IS_A condenser_simple;
589 PU IS_A pump_simple;
590 cd ALIASES BO.cd;
591
592 BO.outlet, TU.inlet ARE_THE_SAME;
593 TU.outlet, CO.inlet ARE_THE_SAME;
594 CO.outlet, PU.inlet ARE_THE_SAME;
595 PU.outlet, BO.inlet ARE_THE_SAME;
596
597 Qdot_loss ALIASES CO.Qdot;
598 Wdot IS_A energy_rate;
599 Wdot = TU.Wdot + PU.Wdot;
600
601 T_H ALIASES BO.outlet.T;
602 T_C ALIASES CO.outlet.T;
603
604 eta IS_A fraction;
605 eta * (BO.Qdot_fuel) = TU.Wdot + PU.Wdot;
606
607 eta_carnot IS_A fraction;
608 eta_carnot = 1 - T_C / T_H;
609
610 DE_cycle "cycle energy balance, should be zero" IS_A energy_rate;
611 DE_cycle = BO.Qdot + CO.Qdot - TU.Wdot - PU.Wdot;
612
613 mdot ALIASES TU.mdot;
614 x_turb_out ALIASES TU.outlet.x;
615 METHODS
616 METHOD default_self;
617 RUN BO.default_self;
618 RUN TU.default_self;
619 RUN CO.default_self;
620 RUN PU.default_self;
621 END default_self;
622 END rankine_common;
623
624
625 MODEL rankine_water REFINES rankine_common;
626 cd.component :== 'water';
627 cd.type :== 'helmholtz';
628 METHODS
629 (* first test case: just some plausible values *)
630 METHOD on_load;
631 RUN ClearAll;
632 RUN default_self;
633 FIX BO.eta; BO.eta := 1.0;
634 FIX TU.eta; TU.eta := 0.85;
635 FIX PU.eta; PU.eta := 0.8;
636 FIX Wdot; Wdot := 100 {MW};
637 (* FIX CO.outlet.p; CO.outlet.p := 10 {kPa};*)
638 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
639 FIX CO.outlet.x; CO.outlet.x := 1e-6;
640 FIX PU.outlet.p; PU.outlet.p := 150 {bar};
641 PU.outlet.p.upper_bound := 150 {bar};
642 FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
643
644 SOLVER QRSlv;
645 OPTION convopt 'RELNOM_SCALE';
646 OPTION iterationlimit 200;
647 END on_load;
648 METHOD set_x_limit;
649 FREE PU.outlet.p;
650 PU.outlet.p.upper_bound := 150 {bar};
651 FIX TU.outlet.x; TU.outlet.x := 0.9;
652 END set_x_limit;
653 (*
654 second test case: numbers from Example 2.1, K Weston, 'Energy Conversion',
655 1992, http://www.personal.utulsa.edu/~kenneth-weston/
656 *)
657 METHOD specify;
658 RUN ClearAll;
659 FIX PU.outlet.p;
660 FIX BO.outlet.T;
661 FIX PU.inlet.p;
662 FIX CO.outlet.x;
663 FIX TU.eta;
664 FIX PU.eta;
665 FIX BO.eta;
666 FIX mdot;
667 END specify;
668 METHOD values;
669 PU.outlet.p := 2000 {psi};
670 BO.outlet.T := 1460 {R}; BO.outlet.h := 3400 {kJ/kg};
671 PU.inlet.p := 1 {psi};
672 CO.outlet.x := 1e-6; (*PU.inlet.h := 69.73 {btu/lbm};*)
673 TU.eta := 1.0;
674 PU.eta := 1.0;
675 BO.eta := 1.0;
676 mdot := 900 {t/d};
677 END values;
678 METHOD self_test;
679 (* check the results against those from K Weston's book *)
680 (* note that we have NOT neglected pump work in this case! *)
681 ASSERT abs(eta - 0.4294) < 0.0030;
682 ASSERT abs(eta_carnot - 0.6152) < 0.0005;
683 ASSERT abs(TU.outlet.x - 0.7736) < 0.0005;
684 ASSERT abs(TU.w - 603.1 {btu/lbm}) < 0.7 {btu/lbm};
685 END self_test;
686 METHOD default_self;
687 RUN rankine_common::default_self;
688 BO.outlet.h := 3000 {kJ/kg}; (* guess *)
689 TU.outlet.h := 3000 {kJ/kg}; (* guess *)
690 CO.outlet.h := 200 {kJ/kg};
691 CO.outlet.p := 10 {kPa};
692 END default_self;
693 END rankine_water;
694
695 MODEL rankine_co2 REFINES rankine_common;
696 cd.component :== 'carbondioxide';
697 cd.type :== 'helmholtz';
698 METHODS
699 METHOD on_load_1;
700 RUN ClearAll;
701 RUN default_self;
702 FIX BO.eta; BO.eta := 1.0;
703 FIX TU.eta; TU.eta := 0.85;
704 FIX PU.eta; PU.eta := 0.8;
705 FIX Wdot; Wdot := 100 {MW};
706 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
707 FIX CO.outlet.p; CO.outlet.p := 80 {bar};
708 FIX PU.outlet.p; PU.outlet.p := 150 {bar};
709 FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
710
711 SOLVER QRSlv;
712 OPTION convopt 'RELNOM_SCALE';
713 OPTION iterationlimit 200;
714 END on_load_1;
715 METHOD on_load;
716 RUN ClearAll;
717 RUN default_self;
718 FIX BO.eta; BO.eta := 1.0;
719 FIX TU.eta; TU.eta := 0.85;
720 FIX PU.eta; PU.eta := 0.8;
721 FIX Wdot; Wdot := 100 {MW};
722 FIX CO.outlet.T; CO.outlet.T := 10 {K} + 273.15 {K};
723 FIX CO.outlet.x; CO.outlet.x := 1e-6;
724 FIX PU.outlet.p; PU.outlet.p := 150 {bar};
725 FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
726
727 SOLVER QRSlv;
728 OPTION convopt 'RELNOM_SCALE';
729 OPTION iterationlimit 200;
730 END on_load;
731 METHOD default_self;
732 RUN rankine_common::default_self;
733 BO.outlet.h := 350 {kJ/kg}; (* guess *)
734 TU.outlet.h := 1000 {kJ/kg}; (* guess *)
735 CO.outlet.h := 350 {kJ/kg};
736 CO.outlet.p := 60 {bar};
737 CO.outlet.p.lower_bound := 5.2 {bar};
738 END default_self;
739 END rankine_co2;
740
741 MODEL rankine_toluene REFINES rankine_common;
742 cd.component :== 'toluene';
743 cd.type :== 'helmholtz';
744 METHODS
745 METHOD on_load;
746 RUN ClearAll;
747 RUN default_self;
748 FIX BO.eta; BO.eta := 1.0;
749 FIX TU.eta; TU.eta := 0.85;
750 FIX PU.eta; PU.eta := 0.8;
751 FIX Wdot; Wdot := 100 {MW};
752 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
753 FIX CO.outlet.x; CO.outlet.x := 1e-6;
754 FIX PU.outlet.p; PU.outlet.p := 150 {bar};
755 FIX BO.outlet.T; BO.outlet.T := 375. {K} + 273.15 {K};
756
757 SOLVER QRSlv;
758 OPTION convopt 'RELNOM_SCALE';
759 OPTION iterationlimit 200;
760
761 FREE CO.outlet.h;
762 FIX CO.outlet.x; CO.outlet.x := 1e-6;
763
764 END on_load;
765 METHOD default_self;
766 RUN rankine_common::default_self;
767 PU.inlet.h := 400 {kJ/kg};
768 BO.outlet.h := 400 {kJ/kg};
769 CO.outlet.h := 400 {kJ/kg};
770 CO.outlet.p := 10 {kPa};
771 END default_self;
772 END rankine_toluene;
773
774
775
776 MODEL rankine_ammonia REFINES rankine_common;
777 cd.component :== 'ammonia';
778 METHODS
779 METHOD on_load;
780 RUN ClearAll;
781 RUN default_self;
782 FIX BO.eta; BO.eta := 1.0;
783 FIX TU.eta; TU.eta := 0.85;
784 FIX PU.eta; PU.eta := 0.8;
785 FIX Wdot; Wdot := 100 {MW};
786 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
787 FIX CO.outlet.x; CO.outlet.x := 1e-6;
788 FIX PU.outlet.p; PU.outlet.p := 150 {bar};
789 FIX BO.outlet.T; BO.outlet.T := 580 {K} + 273.15 {K};
790
791 SOLVER QRSlv;
792 OPTION convopt 'RELNOM_SCALE';
793 OPTION iterationlimit 200;
794
795 FREE CO.outlet.h;
796 FIX CO.outlet.x; CO.outlet.x := 1e-6;
797
798 END on_load;
799 METHOD default_self;
800 RUN rankine_common::default_self;
801 PU.inlet.h := 400 {kJ/kg};
802 BO.outlet.h := 400 {kJ/kg};
803 CO.outlet.h := 400 {kJ/kg};
804 CO.outlet.p := 10 {kPa};
805 END default_self;
806 END rankine_ammonia;
807
808
809
810 (*------------------------------------------------------------------------------
811 REHEAT RANKINE CYCLE
812 *)
813 MODEL rankine_reheat_common;
814 BO1 IS_A boiler_simple;
815 BO2 IS_A boiler_simple;
816 TU1 IS_A turbine_simple;
817 TU2 IS_A turbine_simple;
818 CO IS_A condenser_simple;
819 PU IS_A pump_simple;
820
821 BO1.outlet, TU1.inlet ARE_THE_SAME;
822 TU1.outlet, BO2.inlet ARE_THE_SAME;
823 BO2.outlet, TU2.inlet ARE_THE_SAME;
824 TU2.outlet, CO.inlet ARE_THE_SAME;
825 CO.outlet, PU.inlet ARE_THE_SAME;
826 PU.outlet, BO1.inlet ARE_THE_SAME;
827
828 BO1.eta, BO2.eta ARE_THE_SAME;
829
830 (* boiler peak temperature is reached for both main and reheat... *)
831 BO1.outlet.T, BO2.outlet.T ARE_THE_SAME;
832
833 mdot ALIASES PU.mdot;
834
835 T_H ALIASES BO1.outlet.T;
836 T_C ALIASES CO.outlet.T;
837
838 eta IS_A fraction;
839 eta * (BO1.Qdot_fuel + BO2.Qdot_fuel) = TU1.Wdot + TU2.Wdot + PU.Wdot;
840
841 DE_cycle IS_A energy_rate;
842 DE_cycle = BO1.Qdot + BO2.Qdot + CO.Qdot - TU1.Wdot - TU2.Wdot - PU.Wdot;
843
844 eta_carnot IS_A fraction;
845 eta_carnot = 1 - T_C / T_H;
846 METHODS
847 METHOD default_self;
848 RUN BO1.default_self;
849 RUN BO2.default_self;
850 RUN TU1.default_self;
851 RUN TU2.default_self;
852 RUN CO.default_self;
853 RUN PU.default_self;
854 END default_self;
855 END rankine_reheat_common;
856
857 (*
858 A model for Rankine cycle with water as the working fluid
859 *)
860 MODEL rankine_reheat_water REFINES rankine_reheat_common;
861 BO1.cd.component :== 'water';
862 METHODS
863 METHOD on_load;
864 RUN default_self;
865 RUN cengel_ex_10_4;
866 END on_load;
867 METHOD cengel_ex_10_4;
868 (* This example 10.4 from Cengel & Boles, 2011, 'Thermodynamics: An
869 Engineering Approach', 7th Ed., McGraw-Hill. *)
870 RUN ClearAll;
871 RUN default_self;
872 FIX BO1.eta; BO1.eta := 1.0;
873 FIX TU1.eta; TU1.eta := 1.0;
874 FIX TU2.eta; TU2.eta := 1.0;
875 FIX PU.eta; PU.eta := 1.0;
876
877 FIX TU1.inlet.p; TU1.inlet.p := 15 {MPa};
878 FIX TU1.inlet.T; TU1.inlet.T := (600 {K} + 273.15 {K});
879 FIX BO2.outlet.T; BO2.outlet.T := TU1.inlet.T;
880 FIX TU2.outlet.x; TU2.outlet.x := 0.896;
881 FIX CO.inlet.p; CO.inlet.p := 10 {kPa};
882 FIX CO.outlet.x; CO.outlet.x := 1e-6;
883 FIX mdot; mdot := 1 {kg/s};
884 END cengel_ex_10_4;
885 METHOD self_test_cengel;
886 ASSERT abs(TU2.outlet.s -7.3688 {kJ/kg/K}) < 0.0001 {kJ/kg/K};
887 ASSERT abs(TU2.outlet.h - 2335.1 {kJ/kg}) < 0.1 {kJ/kg};
888 ASSERT abs(BO2.outlet.p - 4.0 {MPa}) < 0.05 {MPa};
889 ASSERT abs(BO2.outlet.h - 3674.9 {kJ/kg}) < 0.2 {kJ/kg};
890 ASSERT abs(eta - 0.450) < 0.0005;
891 END self_test_cengel;
892 METHOD default_self;
893 RUN rankine_reheat_common::default_self;
894 BO1.outlet.h := 3000 {kJ/kg}; (* guess *)
895 TU1.outlet.h := 3000 {kJ/kg}; (* guess *)
896 TU2.inlet.h := 3000 {kJ/kg}; (* guess *)
897 END default_self;
898 END rankine_reheat_water;

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