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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2305 - (show annotations) (download) (as text)
Sun Aug 22 11:22:34 2010 UTC (11 years, 10 months ago) by jpye
File MIME type: text/x-ascend
File size: 11397 byte(s)
Rename 'node' to 'air_node' and 'stream' to 'air_stream' in brayton.a4c.
More plotting routines in cycle_plot.
Finalised combined cycle models including ammonia.
Small bug in nitrogen.c when testing (./test.py nitrogen).
1 (* ASCEND modelling environment
2 Copyright (C) 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 a model of a combined-cycle power station, with
20 a gas turbine (Brayton) cycle running as the 'topping' cycle and a steam
21 turbine (Rankine) cycle running as the 'bottoming' cycle. Initially the
22 model is being based on Example 9.13 from Moran & Shapiro, 'Fundamentals of
23 Engineering Thermodynamics', 4th Ed, Wiley, 2000.
24
25 See also Example 10-9 from the book Çengel & Boles
26 'Thermodynamcs: An Engineering Approach, 6th Ed, McGraw-Hill, 2008.
27
28 This file was based on models/johnpye/combinedcycle.a4c which originally
29 made use of the external library 'freesteam' for calculation of steam
30 properties in the bottoming cycle. This version has been modified to make
31 use of FPROPS for the property calculations, allowing the model to be
32 adapted for use with various different fluids.
33
34 Author: John Pye
35 *)
36 IMPORT "johnpye/extpy/extpy";
37 IMPORT "johnpye/fprops/cycle_plot";
38
39 REQUIRE "johnpye/fprops/rankine_fprops.a4c";
40 REQUIRE "johnpye/brayton.a4c";
41
42 MODEL air_stream_heat_exchanger REFINES air_equipment;
43 inlet_cold, outlet_cold IS_A stream_node;
44 inlet.p, outlet.p ARE_THE_SAME;
45 inlet_cold.p, outlet_cold.p ARE_THE_SAME;
46 inlet_cold.mdot, outlet_cold.mdot ARE_THE_SAME;
47 inlet_cold.cd, outlet_cold.cd ARE_THE_SAME;
48
49 mdot_cold ALIASES inlet_cold.mdot;
50 cd_cold ALIASES inlet_cold.cd;
51
52 (* some very simplistics checks that temperatures are feasible: not totally safe! *)
53 DT_1, DT_2 IS_A delta_temperature;
54 DT_1 = inlet.T - outlet_cold.T;
55 DT_2 = outlet.T - inlet_cold.T;
56
57 (* some intermediate temperatures for plotting *)
58 n IS_A integer_constant;
59 n :== 20;
60 H[0..n] IS_A air_node;
61 H[0..n].p, inlet.p ARE_THE_SAME;
62 H[0..n].mdot, inlet.mdot ARE_THE_SAME;
63 H[0].h, inlet.h ARE_THE_SAME;
64 H[n].h, outlet.h ARE_THE_SAME;
65 FOR i IN [1..n-1] CREATE
66 H[i].h = H[0].h + (H[n].h - H[0].h)/n * i;
67 END FOR;
68
69 Qdot IS_A energy_rate;
70 (* Strange, but the following form solves better than the obvious form,
71 Could maybe be something to do with scaling. *)
72 outlet.h - inlet.h = Qdot/inlet.mdot;
73 outlet_cold.h = inlet_cold.h - Qdot/inlet_cold.mdot;
74 METHODS
75 METHOD default_self;
76 RUN inlet_cold.default_self;
77 RUN outlet_cold.default_self;
78 DT_1.lower_bound := 0 {K};
79 DT_2.lower_bound := 0 {K};
80 END default_self;
81 METHOD heat_exchanger_plot;
82 EXTERNAL air_stream_heat_exchanger_plot(SELF);
83 END heat_exchanger_plot;
84 END air_stream_heat_exchanger;
85
86
87 MODEL air_stream_heat_exchanger_test REFINES air_stream_heat_exchanger;
88 cd_cold.component :== 'water';
89 METHODS
90 METHOD on_load;
91 RUN default_self;
92 FIX inlet_cold.p; inlet_cold.p := 50 {bar};
93 FIX inlet_cold.h; inlet_cold.h := 200 {kJ/kg};
94 FIX inlet.p; inlet.p := 1 {bar};
95 FIX inlet.T; inlet.T := 700 {K};
96 FIX mdot; mdot := 1 {kg/s};
97 FIX mdot_cold; mdot_cold := 0.1 {kg/s};
98 FIX Qdot; Qdot := 10 {kW};
99 END on_load;
100 END air_stream_heat_exchanger_test;
101
102 (* --- whole cycle models --- *)
103
104 MODEL combinedcycle_fprops_common;
105 (* define the blocks *)
106 GC IS_A compressor;
107 BU IS_A combustor;
108 GT IS_A gas_turbine;
109 HE IS_A air_stream_heat_exchanger;
110 DI IS_A dissipator;
111 TU IS_A turbine_simple;
112 CO IS_A condenser_simple;
113 PU IS_A pump_simple;
114
115 (* wire up the model *)
116 GC.outlet, BU.inlet ARE_THE_SAME;
117 BU.outlet, GT.inlet ARE_THE_SAME;
118 GT.outlet, HE.inlet ARE_THE_SAME;
119 HE.outlet, DI.inlet ARE_THE_SAME;
120 DI.outlet, GC.inlet ARE_THE_SAME;
121
122 HE.outlet_cold, TU.inlet ARE_THE_SAME;
123 TU.outlet, CO.inlet ARE_THE_SAME;
124 CO.outlet, PU.inlet ARE_THE_SAME;
125 PU.outlet, HE.inlet_cold ARE_THE_SAME;
126
127 cd_rankine ALIASES TU.inlet.cd;
128
129 Wdot, Wdot_gas, Wdot_vap IS_A energy_rate;
130 Wdot_gas = GC.Wdot + GT.Wdot;
131 Wdot_vap = TU.Wdot + PU.Wdot;
132 Wdot = Wdot_gas + Wdot_vap;
133
134 braytonpowerfraction IS_A fraction;
135 braytonpowerfraction = Wdot_gas / Wdot;
136
137 Qdot_H ALIASES BU.Qdot;
138 Qdot_HE ALIASES HE.Qdot;
139 Qdot_DI ALIASES DI.Qdot;
140
141 eta IS_A fraction;
142 eta = Wdot / Qdot_H;
143
144 massflowratio IS_A factor;
145 massflowratio = TU.mdot / GT.mdot;
146
147 braytonpressureratio IS_A positive_factor;
148 braytonpressureratio * GC.inlet.p = GC.outlet.p;
149
150 METHODS
151 METHOD default_self;
152 RUN TU.default_self;
153 RUN PU.default_self;
154 RUN CO.default_self;
155 RUN HE.default_self;
156 END default_self;
157 METHOD specify;
158 (* these values should be independent of the fluid we choose to use *)
159 FIX GC.eta; GC.eta := 0.84;
160 FIX GT.eta; GT.eta := 0.88;
161 FIX TU.eta; TU.eta := 0.85;
162 FIX PU.eta; PU.eta := 0.8;
163 FIX CO.outlet.x; CO.outlet.x := 1e-6;
164 FIX BU.eta; BU.eta := 1;
165 END specify;
166 METHOD cycle_plot;
167 EXTERNAL cycle_plot_ccgt(SELF);
168 END cycle_plot;
169 END combinedcycle_fprops_common;
170
171
172 MODEL combinedcycle_toluene REFINES combinedcycle_fprops_common;
173 TU.inlet.cd.component :== 'toluene';
174 HE.outlet.T = PU.outlet.T + 50 {K};
175 HE.outlet_cold.T = GT.outlet.T - 20 {K};
176 METHODS
177 METHOD default_self;
178 RUN combinedcycle_fprops_common::default_self;
179 (* starting guess, for easy solving *)
180 HE.outlet_cold.h := 400 {kJ/kg};
181 CO.outlet.h := 400 {kJ/kg};
182 END default_self;
183 METHOD on_load;
184 RUN ClearAll;
185 RUN default_self;
186 RUN combinedcycle_fprops_common::specify;
187 FIX Wdot; Wdot := 100 {MW};
188
189 (* ambient conditions *)
190 FIX GC.inlet.T, GC.inlet.p;
191 GC.inlet.T := 30 {K} + 273.15 {K};
192 GC.inlet.p := 1 {bar};
193
194 (* Brayton parameters *)
195 FIX braytonpressureratio; braytonpressureratio := 10.9; (* optimise this *)
196 FIX BU.outlet.T; BU.outlet.T := 970 {K} + 273.15 {K};
197
198 (* Rankine cycle condenser *)
199 CO.outlet.p := 8 {kPa};
200 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
201 FIX TU.inlet.p; TU.inlet.p := 150 {bar};
202
203 (* optimisable *)
204
205 (* heat exchange cycle *)
206 (* FIX HE.outlet.T; HE.outlet.T := 60 {K} + 273.15 {K};
207 FIX HE.outlet_cold.T; HE.outlet_cold.T := 470 {K} + 273.15 {K};
208 *)
209 SOLVER QRSlv;
210 OPTION convopt 'RELNOM_SCALE';
211 END on_load;
212 END combinedcycle_toluene;
213
214
215 MODEL combinedcycle_water REFINES combinedcycle_fprops_common;
216 TU.inlet.cd.component :== 'water';
217 x_turb_out ALIASES TU.outlet.x;
218 (* the difference values in these formula have to be corrected by looking
219 at the heat exchanger temperature profiles; haven't thoroughly modelled
220 this bit yet! *)
221 HE.outlet.T = PU.outlet.T + 130 {K};
222 HE.outlet_cold.T = GT.outlet.T - 20 {K};
223 METHODS
224 METHOD default_self;
225 RUN combinedcycle_fprops_common::default_self;
226 (* starting guess, for easy solving *)
227 HE.outlet_cold.h := 3000 {kJ/kg};
228 TU.inlet.h := 4000 {kJ/kg};
229 END default_self;
230 METHOD on_load;
231 RUN ClearAll;
232 RUN default_self;
233 RUN combinedcycle_fprops_common::specify;
234 FIX Wdot; Wdot := 100 {MW};
235
236 (* ambient conditions *)
237 FIX GC.inlet.T, GC.inlet.p;
238 GC.inlet.T := 30 {K} + 273.15 {K};
239 GC.inlet.p := 1 {bar};
240
241 (* Brayton parameters *)
242 FIX braytonpressureratio; braytonpressureratio := 7.2; (* optimise this *)
243 FIX BU.outlet.T; BU.outlet.T := 970 {K} + 273.15 {K};
244
245 (* Rankine cycle condenser *)
246 CO.outlet.p := 8 {kPa};
247 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
248 FIX TU.inlet.p; TU.inlet.p := 150 {bar};
249
250 SOLVER QRSlv;
251 OPTION convopt 'RELNOM_SCALE';
252 END on_load;
253 METHOD set_x_limit;
254 FREE PU.outlet.p;
255 PU.outlet.p.upper_bound := 150 {bar};
256 FIX TU.outlet.x; TU.outlet.x := 0.9;
257 END set_x_limit;
258
259 END combinedcycle_water;
260
261
262
263 MODEL combinedcycle_ammonia REFINES combinedcycle_fprops_common;
264 TU.inlet.cd.component :== 'ammonia';
265 HE.outlet.T = PU.outlet.T + 15 {K};
266 HE.outlet_cold.T = GT.outlet.T - 12 {K};
267 METHODS
268 METHOD default_self;
269 RUN combinedcycle_fprops_common::default_self;
270 (* starting guess, for easy solving *)
271 HE.outlet_cold.h := 400 {kJ/kg};
272 CO.outlet.h := 400 {kJ/kg};
273 END default_self;
274 METHOD on_load;
275 RUN ClearAll;
276 RUN default_self;
277 RUN combinedcycle_fprops_common::specify;
278 FIX Wdot; Wdot := 100 {MW};
279
280 (* ambient conditions *)
281 FIX GC.inlet.T, GC.inlet.p;
282 GC.inlet.T := 30 {K} + 273.15 {K};
283 GC.inlet.p := 1 {bar};
284
285 (* Brayton parameters *)
286 FIX braytonpressureratio; braytonpressureratio := 11.2; (* optimise this *)
287 FIX BU.outlet.T; BU.outlet.T := 970 {K} + 273.15 {K};
288
289 (* Rankine cycle condenser *)
290 CO.outlet.p := 8 {kPa};
291 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
292 FIX TU.inlet.p; TU.inlet.p := 150 {bar};
293
294 SOLVER QRSlv;
295 OPTION convopt 'RELNOM_SCALE';
296 END on_load;
297 END combinedcycle_ammonia;
298
299
300
301
302
303
304
305 MODEL combinedcycle_co2 REFINES combinedcycle_fprops_common;
306 TU.inlet.cd.component :== 'carbondioxide';
307 METHODS
308 METHOD default_self;
309 RUN combinedcycle_fprops_common::default_self;
310 (* starting guess, for easy solving *)
311 HE.outlet_cold.h := 200 {kJ/kg};
312 CO.outlet.h := 200 {kJ/kg};
313 END default_self;
314 METHOD on_load;
315 RUN ClearAll;
316 RUN default_self;
317 RUN combinedcycle_fprops_common::specify;
318 FIX Wdot; Wdot := 100 {MW};
319 FIX GC.inlet.T, GC.inlet.p;
320 GC.inlet.T := 300 {K};
321 GC.inlet.p := 1 {bar};
322 FIX CO.outlet.p; CO.outlet.p := 5.2 {bar};
323
324 (* optimisable *)
325 FIX braytonpressureratio; braytonpressureratio := 8;
326
327 FIX HE.outlet.T; HE.outlet.T := 400 {K};
328 FIX BU.outlet.T; BU.outlet.T := 1300 {K};
329 FIX TU.inlet.T; TU.inlet.T := 600 {K};
330 FIX TU.inlet.p; TU.inlet.p := 50 {bar};
331
332 SOLVER QRSlv;
333 OPTION convopt 'RELNOM_SCALE';
334 END on_load;
335 END combinedcycle_co2;
336
337
338
339
340
341
342 MODEL combinedcycle_fprops REFINES combinedcycle_water;
343 METHODS
344 METHOD on_load;
345 RUN default_self;
346 RUN cengel_ex_10_9;
347 SOLVER QRSlv;
348 OPTION convopt 'RELNOM_SCALE';
349 END on_load;
350
351 METHOD moran_ex_9_13;
352 RUN ClearAll;
353 FIX Wdot; Wdot := 45 {MW};
354
355 FIX GC.inlet.T, GC.inlet.p;
356 GC.inlet.T := 300 {K};
357 GC.inlet.p := 100 {kPa};
358
359 FIX GC.outlet.p;
360 GC.outlet.p := 1200 {kPa};
361
362 FIX GC.eta; GC.eta := 0.84;
363
364 FIX BU.outlet.T; BU.outlet.T := 1400 {K};
365
366 FIX GT.eta; GT.eta := 0.88;
367
368 (* GT.outlet.p := 100 {kPa};*)
369 FIX HE.outlet.T; HE.outlet.T := 400 {K};
370
371 FIX TU.inlet.T, TU.inlet.p;
372 TU.inlet.T := 400 {K} + 273.15 {K};
373 TU.inlet.p := 8 {MPa};
374 FIX TU.outlet.p; TU.outlet.p := 8 {kPa};
375
376 FIX PU.inlet.x;
377 PU.inlet.x := 0.0001;
378
379 FIX TU.eta; TU.eta := 0.90;
380 FIX PU.eta; PU.eta := 0.8;
381
382 (* assumed *)
383 FIX BU.eta;
384 BU.eta := 1;
385 END moran_ex_9_13;
386
387 METHOD cengel_ex_10_9;
388 RUN ClearAll;
389 FIX Wdot; Wdot := 100 {MW};
390
391 FIX GC.inlet.p; GC.inlet.p := 1 {atm}; (* assumed *)
392
393 FIX braytonpressureratio; braytonpressureratio := 8;
394
395 FIX GC.inlet.T; GC.inlet.T := 300 {K};
396 FIX GT.inlet.T; GT.inlet.T := 1300 {K};
397
398 FIX GC.eta; GC.eta := 0.8;
399 FIX GT.eta; GT.eta := 0.85;
400
401 FIX TU.inlet.p; TU.inlet.p := 7 {MPa};
402 FIX CO.outlet.p; CO.outlet.p := 5 {kPa};
403
404 FIX TU.inlet.T; TU.inlet.T := 500 {K} + 273.15 {K};
405 FIX DI.inlet.T; DI.inlet.T := 450 {K};
406
407 (* 'complete' condensation... bit of a hack *)
408 FIX CO.outlet.x; CO.outlet.x := 0.0001;
409
410 (* 'simple ideal Rankine cycle *)
411 FIX TU.eta; TU.eta := 1;
412 FIX BU.eta; BU.eta := 1;
413 FIX PU.eta; PU.eta := 1;
414
415 (* first guess, for easy solving *)
416 HE.outlet_cold.h := 3000 {kJ/kg};
417 END cengel_ex_10_9;
418
419 END combinedcycle_fprops;

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