/[ascend]/trunk/models/test/bug567/combinedcycle_fprops.a4c
ViewVC logotype

Contents of /trunk/models/test/bug567/combinedcycle_fprops.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2687 - (show annotations) (download) (as text)
Fri Mar 1 02:15:09 2013 UTC (11 years, 7 months ago) by jpye
File MIME type: text/x-ascend
File size: 8954 byte(s)
Moving reproducible version of bug 567 into models/test directory.
Valgrind test shows invalid memory access in RemoveRelation of data freed in DestroyInstanceParts.
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, see <http://www.gnu.org/licenses/>.
16 *)(*
17 This file contains a model of a combined-cycle power station, with
18 a gas turbine (Brayton) cycle running as the 'topping' cycle and a steam
19 turbine (Rankine) cycle running as the 'bottoming' cycle. Initially the
20 model is being based on Example 9.13 from Moran & Shapiro, 'Fundamentals of
21 Engineering Thermodynamics', 4th Ed, Wiley, 2000.
22
23 See also Example 10-9 from the book Çengel & Boles
24 'Thermodynamcs: An Engineering Approach, 6th Ed, McGraw-Hill, 2008.
25
26 This file was based on models/johnpye/combinedcycle.a4c which originally
27 made use of the external library 'freesteam' for calculation of steam
28 properties in the bottoming cycle. This version has been modified to make
29 use of FPROPS for the property calculations, allowing the model to be
30 adapted for use with various different fluids.
31
32 Author: John Pye
33 *)
34 REQUIRE "test/bug567/rankine_fprops.a4c";
35 REQUIRE "test/bug567/brayton.a4c";
36
37 MODEL air_stream_heat_exchanger REFINES air_equipment;
38 inlet_cold, outlet_cold IS_A stream_node;
39 inlet.p, outlet.p ARE_THE_SAME;
40 inlet_cold.p, outlet_cold.p ARE_THE_SAME;
41 inlet_cold.mdot, outlet_cold.mdot ARE_THE_SAME;
42 inlet_cold.cd, outlet_cold.cd ARE_THE_SAME;
43
44 mdot_cold ALIASES inlet_cold.mdot;
45 cd_cold ALIASES inlet_cold.cd;
46
47 (* some very simplistics checks that temperatures are feasible: not totally safe! *)
48 DT_1, DT_2 IS_A delta_temperature;
49 DT_1 = inlet.T - outlet_cold.T;
50 DT_2 = outlet.T - inlet_cold.T;
51
52 (* some intermediate temperatures for plotting *)
53 n IS_A integer_constant;
54 n :== 20;
55 H[0..n] IS_A air_node;
56 H[0..n].p, inlet.p ARE_THE_SAME;
57 H[0..n].mdot, inlet.mdot ARE_THE_SAME;
58 H[0].h, inlet.h ARE_THE_SAME;
59 H[n].h, outlet.h ARE_THE_SAME;
60 FOR i IN [1..n-1] CREATE
61 H[i].h = H[0].h + (H[n].h - H[0].h)/n * i;
62 END FOR;
63
64 Qdot IS_A energy_rate;
65 (* Strange, but the following form solves better than the obvious form,
66 Could maybe be something to do with scaling. *)
67 outlet.h - inlet.h = Qdot/inlet.mdot;
68 outlet_cold.h = inlet_cold.h - Qdot/inlet_cold.mdot;
69 METHODS
70 METHOD default_self;
71 RUN inlet_cold.default_self;
72 RUN outlet_cold.default_self;
73 DT_1.lower_bound := 0 {K};
74 DT_2.lower_bound := 0 {K};
75 END default_self;
76 END air_stream_heat_exchanger;
77
78
79 MODEL air_stream_heat_exchanger_test REFINES air_stream_heat_exchanger;
80 cd_cold.component :== 'water';
81 METHODS
82 METHOD on_load;
83 RUN default_self;
84 FIX inlet_cold.p; inlet_cold.p := 50 {bar};
85 FIX inlet_cold.h; inlet_cold.h := 200 {kJ/kg};
86 FIX inlet.p; inlet.p := 1 {bar};
87 FIX inlet.T; inlet.T := 700 {K};
88 FIX mdot; mdot := 1 {kg/s};
89 FIX mdot_cold; mdot_cold := 0.1 {kg/s};
90 FIX Qdot; Qdot := 10 {kW};
91 END on_load;
92 END air_stream_heat_exchanger_test;
93
94 (* --- whole cycle models --- *)
95
96 MODEL combinedcycle_fprops_common;
97 (* define the blocks *)
98 GC IS_A compressor;
99 BU IS_A combustor;
100 GT IS_A gas_turbine;
101 HE IS_A air_stream_heat_exchanger;
102 DI IS_A dissipator;
103 TU IS_A turbine_simple;
104 CO IS_A condenser_simple;
105 PU IS_A pump_simple;
106
107 (* wire up the model *)
108 GC.outlet, BU.inlet ARE_THE_SAME;
109 BU.outlet, GT.inlet ARE_THE_SAME;
110 GT.outlet, HE.inlet ARE_THE_SAME;
111 HE.outlet, DI.inlet ARE_THE_SAME;
112 DI.outlet, GC.inlet ARE_THE_SAME;
113
114 HE.outlet_cold, TU.inlet ARE_THE_SAME;
115 TU.outlet, CO.inlet ARE_THE_SAME;
116 CO.outlet, PU.inlet ARE_THE_SAME;
117 PU.outlet, HE.inlet_cold ARE_THE_SAME;
118
119 cd_rankine ALIASES TU.inlet.cd;
120
121 Wdot, Wdot_gas, Wdot_vap IS_A energy_rate;
122 Wdot_gas = GC.Wdot + GT.Wdot;
123 Wdot_vap = TU.Wdot + PU.Wdot;
124 Wdot = Wdot_gas + Wdot_vap;
125
126 braytonpowerfraction IS_A fraction;
127 braytonpowerfraction = Wdot_gas / Wdot;
128
129 Qdot_H ALIASES BU.Qdot;
130 Qdot_HE ALIASES HE.Qdot;
131 Qdot_DI ALIASES DI.Qdot;
132
133 eta IS_A fraction;
134 eta = Wdot / Qdot_H;
135
136 massflowratio IS_A factor;
137 massflowratio = TU.mdot / GT.mdot;
138
139 braytonpressureratio IS_A positive_factor;
140 braytonpressureratio * GC.inlet.p = GC.outlet.p;
141
142 METHODS
143 METHOD default_self;
144 RUN TU.default_self;
145 RUN PU.default_self;
146 RUN CO.default_self;
147 RUN HE.default_self;
148 END default_self;
149 METHOD specify;
150 (* these values should be independent of the fluid we choose to use *)
151 FIX GC.eta; GC.eta := 0.84;
152 FIX GT.eta; GT.eta := 0.88;
153 FIX TU.eta; TU.eta := 0.85;
154 FIX PU.eta; PU.eta := 0.8;
155 FIX CO.outlet.x; CO.outlet.x := 1e-6;
156 FIX BU.eta; BU.eta := 1;
157 END specify;
158 END combinedcycle_fprops_common;
159
160
161 MODEL combinedcycle_toluene REFINES combinedcycle_fprops_common;
162 TU.inlet.cd.component :== 'toluene';
163 HE.outlet.T = PU.outlet.T + 40 {K};
164 HE.outlet_cold.T = GT.outlet.T - 20 {K};
165 Tmax_rankine ALIASES HE.outlet_cold.T;
166 METHODS
167 METHOD default_self;
168 RUN combinedcycle_fprops_common::default_self;
169 (* starting guess, for easy solving *)
170 HE.outlet_cold.h := 400 {kJ/kg};
171 CO.outlet.h := 400 {kJ/kg};
172 END default_self;
173 METHOD on_load;
174 RUN ClearAll;
175 RUN default_self;
176 RUN combinedcycle_fprops_common::specify;
177 FIX Wdot; Wdot := 100 {MW};
178
179 (* ambient conditions *)
180 FIX GC.inlet.T, GC.inlet.p;
181 GC.inlet.T := 30 {K} + 273.15 {K};
182 GC.inlet.p := 1 {bar};
183
184 (* Brayton parameters *)
185 FIX braytonpressureratio; braytonpressureratio := 10.9; (* optimise this *)
186 FIX BU.outlet.T; BU.outlet.T := 970 {K} + 273.15 {K};
187
188 (* Rankine cycle condenser *)
189 CO.outlet.p := 8 {kPa};
190 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
191 FIX TU.inlet.p; TU.inlet.p := 150 {bar};
192
193 (* optimisable *)
194
195 (* heat exchange cycle *)
196 (* FIX HE.outlet.T; HE.outlet.T := 60 {K} + 273.15 {K};
197 FIX HE.outlet_cold.T; HE.outlet_cold.T := 470 {K} + 273.15 {K};
198 *)
199 SOLVER QRSlv;
200 OPTION convopt 'RELNOM_SCALE';
201 END on_load;
202 END combinedcycle_toluene;
203
204
205 MODEL combinedcycle_water REFINES combinedcycle_fprops_common;
206 TU.inlet.cd.component :== 'water';
207 x_turb_out ALIASES TU.outlet.x;
208 (* the difference values in these formula have to be corrected by looking
209 at the heat exchanger temperature profiles; haven't thoroughly modelled
210 this bit yet! *)
211 HE.outlet.T = PU.outlet.T + 130 {K};
212 HE.outlet_cold.T = GT.outlet.T - 20 {K};
213 METHODS
214 METHOD default_self;
215 RUN combinedcycle_fprops_common::default_self;
216 (* starting guess, for easy solving *)
217 HE.outlet_cold.h := 3000 {kJ/kg};
218 TU.inlet.h := 4000 {kJ/kg};
219 END default_self;
220 METHOD on_load;
221 RUN ClearAll;
222 RUN default_self;
223 RUN combinedcycle_fprops_common::specify;
224 FIX Wdot; Wdot := 100 {MW};
225
226 (* ambient conditions *)
227 FIX GC.inlet.T, GC.inlet.p;
228 GC.inlet.T := 30 {K} + 273.15 {K};
229 GC.inlet.p := 1 {bar};
230
231 (* Brayton parameters *)
232 FIX braytonpressureratio; braytonpressureratio := 7.2; (* optimise this *)
233 FIX BU.outlet.T; BU.outlet.T := 970 {K} + 273.15 {K};
234
235 (* Rankine cycle condenser *)
236 CO.outlet.p := 8 {kPa};
237 FIX CO.outlet.T; CO.outlet.T := 40 {K} + 273.15 {K};
238 FIX TU.inlet.p; TU.inlet.p := 150 {bar};
239
240 SOLVER QRSlv;
241 OPTION convopt 'RELNOM_SCALE';
242 END on_load;
243 METHOD set_x_limit;
244 FREE PU.outlet.p;
245 PU.outlet.p.upper_bound := 150 {bar};
246 FIX TU.outlet.x; TU.outlet.x := 0.9;
247 END set_x_limit;
248
249 END combinedcycle_water;
250
251 MODEL combinedcycle_water_opt REFINES combinedcycle_water;
252 MAXIMIZE eta;
253 METHODS
254 METHOD on_load;
255 RUN combinedcycle_water::on_load;
256 braytonpressureratio.lower_bound := 8;
257 braytonpressureratio.upper_bound := 20;
258 END on_load;
259 END combinedcycle_water_opt;
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 the combinedcycle_co2 model is removed, because it wasn't viable due to the
301 location of the CO2 critical point.
302 *)

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