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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 112 - (show annotations) (download) (as text)
Wed Dec 14 06:25:28 2005 UTC (14 years, 3 months ago) by johnpye
File MIME type: text/x-ascend
File size: 6141 byte(s)
Moving saturation curves into a separate file.
Adding a simple loop simulation using ideal-steam and fixed-density water.
1 REQUIRE "johnpye/thermo_types.a4c";
2 REQUIRE "johnpye/ideal_steam.a4c";
3 REQUIRE "johnpye/iapws_sat_curves.a4c";
4
5 MODEL water_and_ideal_steam REFINES thermo_state;
6 S IS_A ideal_steam;
7 W IS_A thermo_state;
8 x IS_A fraction;
9
10 p, S.p, W.p ARE_THE_SAME;
11 T, S.T, W.T ARE_THE_SAME;
12 z01: W.u = (T - 273.15 {K}) * 4.2 {kJ/kg/K};
13 z02:W.h = W.u + p / 1000 {kg/m^3};
14 (* Gibb's free energy needed to create an exprssion for entropy *)
15 z03:W.s = 0 {kJ/kg/K};
16 z04:W.cp = 4.2 {kJ/kg/K};
17 z05:W.cv = 4.2 {kJ/kg/K}; (* correction? *)
18 z06:W.w = 10000 {m/s}; (* correction? *)
19
20 z07:h = S.h * x + W.h * (1-x);
21 z08:s = S.s * x + W.s * (1-x);
22 z09:cp = S.cp * x + W.cp * (1-x);
23 z10:cv = S.cv * x + W.cv * (1-x);
24 z11:w = S.w * x + W.w * (1-x);
25
26 METHODS
27 METHOD default_self;
28 RUN reset;
29 RUN values;
30 END default_self;
31
32 METHOD specify;
33 p.fixed := TRUE;
34 h.fixed := TRUE;
35 END specify;
36
37 METHOD values;
38 p := 1 {bar};
39 h := 1000 {kJ/kg};
40 END values;
41
42 END water_and_ideal_steam;
43
44 MODEL simple_water_stream REFINES water_and_ideal_steam;
45 mdot IS_A mass_rate;
46
47 METHODS
48 METHOD default_self;
49 RUN reset;
50 RUN values;
51 END default_self;
52
53 METHOD specify;
54 mdot.fixed := TRUE;
55 RUN water_and_ideal_steam::specify;
56 END specify;
57
58 METHOD values;
59 mdot := 1 {kg/s};
60 RUN water_and_ideal_steam::values;
61 END values;
62
63 END simple_water_stream;
64
65 (*
66 Here is a fixed volume of gas confined in a volume.
67 We can see that fixing the mass in the vessel then
68 heating it up will increase the pressure.
69 *)
70 MODEL gas_vessel;
71 S IS_A ideal_steam;
72 T ALIASES S.T;
73 p ALIASES S.p;
74 rho ALIASES S.rho;
75 h ALIASES S.h;
76 m_gas IS_A mass;
77 V_gas IS_A volume;
78 m_gas = S.rho * V_gas;
79 METHODS
80 METHOD default_self;
81 RUN reset; RUN values;
82 END default_self;
83 METHOD specify;
84 RUN S.specify;
85 V_gas.fixed := TRUE;
86 m_gas.fixed := TRUE;
87 END specify;
88 METHOD values;
89 RUN S.values;
90 V_gas := 1 {m^3};
91 m_gas := 0.727101 {kg};
92 END values;
93 END gas_vessel;
94
95
96 MODEL vessel_with_water REFINES gas_vessel;
97 m_water IS_A mass;
98 V_water IS_A volume;
99 V_vessel IS_A volume;
100 V_water + V_gas = V_vessel;
101 m_water = 1000 {kg/m^3} * V_water; (* incompressible water *)
102 METHODS
103 METHOD default_self;
104 RUN reset; RUN values;
105 END default_self;
106 METHOD specify;
107 V_vessel.fixed := TRUE;
108 m_gas.fixed := TRUE;
109 m_water.fixed := TRUE;
110 END specify;
111 METHOD values;
112 V_vessel := 1000 {L};
113 m_gas := 0.727101 {kg};
114 m_water := 200 {kg};
115 END values;
116 END vessel_with_water;
117
118
119 MODEL absorber;
120 (* assumptions:
121 outlet is saturated steam
122 inlet is saturated water
123 no pressure drop
124 no temperature change
125 all Q is absorbed by water
126 steam generation is constant along length as mass rate, so x rises linearly.
127 *)
128 S IS_A ideal_steam;
129 sat IS_A iapws_sat_curves;
130 T ALIASES S.T;
131 T,sat.T ARE_THE_SAME;
132 rho_gas ALIASES S.rho;
133 rho_gas, sat.rhog ARE_THE_SAME;
134
135 p ALIASES S.p;
136
137 mdot_water_in IS_A mass_rate;
138 mdot_water_out IS_A mass_rate;
139 mdot_gas_out IS_A mass_rate;
140
141 m_water IS_A mass;
142 m_gas IS_A mass;
143
144 Q IS_A energy_rate; (* heat absorbed *)
145
146 (* assume saturated water at inlet, so any heat added immediately creates some steam *)
147 Hdot_in IS_A energy_rate;
148 Hdot_out IS_A energy_rate;
149 h_water IS_A specific_enthalpy;
150 h_water = 400 {kJ/kg} + p / (1000 {kg/m^3});
151
152 Hdot_in = mdot_water_in * h_water;
153 Hdot_out = mdot_water_out * h_water + mdot_gas_out * S.h;
154
155 (* 1st law thermo *)
156 Q = Hdot_out - Hdot_in;
157
158 (* mass conservation *)
159 mdot_water_in = mdot_water_out + mdot_gas_out;
160
161 x_exit IS_A fraction;
162 x_exit * mdot_water_in = mdot_gas_out;
163
164 (* assume that steam evolves linearly along length, so average x allow mass of water to be calculated *)
165 x IS_A fraction;
166 x = (0 + x_exit)/2;
167
168 (* assuming a slip-ratio of 1, we can get the average void ratio, eq 2.13 from Behnia *)
169 alpha IS_A fraction;
170 alpha * S.rho * (1-x) = 1000{kg/m^3} * x * (1-alpha);
171
172 m_water = 1000{kg/m^3} * (1-alpha)*V_total;
173 m_gas = S.rho * alpha*V_total;
174
175 V_total IS_A volume;
176
177 METHODS
178 METHOD default_self;
179 RUN reset;
180 RUN values;
181 END default_self;
182 METHOD specify;
183 V_total.fixed := TRUE;
184 mdot_water_in.fixed := TRUE;
185 Q.fixed := TRUE;
186 p.fixed := TRUE;
187 END specify;
188 METHOD values;
189 V_total := 300{m} * 16 * 1{PI}*( 40{mm} )^2;
190 mdot_water_in := 1 {kg/s};
191 Q := 400 {W/m^2} * 20 * 40{mm} * 300{m};
192 p := 5 {bar};
193 END values;
194 END absorber;
195
196 MODEL condenser;
197 (* assumptions:
198 inlet is saturated steam. water has already be separated out.
199 outlet is water with enthalpy 400 kJ/kg and same pressure as inlet.
200 we don't need to enforce saturation inlet conditions. we will just query the enthalpy and that's it.
201 *)
202 S IS_A ideal_steam; (* inlet steam state *)
203
204 mdot_gas_in IS_A mass_rate;
205 mdot_water_out IS_A mass_rate;
206 Q IS_A energy_rate; (* heat taken away by condenser *)
207
208 Q = mdot_gas_in * S.h - mdot_water_out * 400{kJ/kg};
209 mdot_water_out = mdot_gas_in;
210
211 METHODS
212 METHOD default_self;
213 RUN reset;
214 RUN values;
215 END default_self;
216 METHOD specify;
217 mdot_gas_in.fixed := TRUE;
218 S.p.fixed := TRUE;
219 S.T.fixed := TRUE;
220 END specify;
221 METHOD values;
222 mdot_gas_in := 1 {kg/s};
223 S.p := 5 {bar};
224 S.T := 473.15 {K};
225 END values;
226
227 END condenser;
228
229 MODEL loop;
230 A IS_A absorber;
231 C IS_A condenser;
232 S IS_A vessel_with_water;
233
234 m_water_total IS_A mass;
235
236 A.S, C.S ARE_THE_SAME; (* absorber outlet steam goes to the condenser *)
237 A.p, S.p ARE_THE_SAME; (* absorber pressure equals surge tank pressure *)
238
239 A.Q, C.Q ARE_THE_SAME; (* heat out of condenser must balance that absorbed *)
240
241 p ALIASES A.p;
242 Q ALIASES A.Q;
243 T_abs_out ALIASES A.T;
244 m_abs_water ALIASES A.m_water;
245 m_surge_water ALIASES S.m_water;
246 m_gas ALIASES S.m_gas;
247 V_surge ALIASES S.V_vessel;
248 V_absorber ALIASES A.V_total;
249 absorber_void_fraction ALIASES A.alpha;
250
251 m_surge_water + m_abs_water = m_water_total;
252
253 METHODS
254 METHOD default_self;
255 RUN reset;
256 RUN values;
257 END default_self;
258
259 METHOD specify;
260 A.Q.fixed := TRUE;
261 A.V_total.fixed := TRUE;
262 S.V_vessel.fixed := TRUE;
263 S.m_gas.fixed := TRUE;
264 m_water_total.fixed := TRUE;
265 END specify;
266
267 METHOD values;
268 A.Q := 400 {W/m^2} * 20 * 40{mm} * 300{m};
269 A.V_total := 300{m} * 16 * 1{PI}*( 40{mm} )^2;
270 S.V_vessel := 10 {m^3};
271 S.m_gas := 7.27101 {kg};
272 m_water_total := 3000 {kg};
273 END values;
274
275 END loop;

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