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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 121 - (show annotations) (download) (as text)
Mon Dec 19 06:11:50 2005 UTC (14 years, 9 months ago) by johnpye
File MIME type: text/x-ascend
File size: 6201 byte(s)
Adding self-test method, still working on this
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 expression 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 := 800 {W/m^2} * 20 * 40{mm} * 300{m};
192 p := 5 {bar};
193 END values;
194
195 METHOD self_test;
196 RUN reset;
197 RUN values;
198 END self_test;
199 END absorber;
200
201 MODEL condenser;
202 (* assumptions:
203 inlet is saturated steam. water has already be separated out.
204 outlet is water with enthalpy 400 kJ/kg and same pressure as inlet.
205 we don't need to enforce saturation inlet conditions. we will just query the enthalpy and that's it.
206 *)
207 S IS_A ideal_steam; (* inlet steam state *)
208
209 mdot_gas_in IS_A mass_rate;
210 mdot_water_out IS_A mass_rate;
211 Q IS_A energy_rate; (* heat taken away by condenser *)
212
213 Q = mdot_gas_in * S.h - mdot_water_out * 400{kJ/kg};
214 mdot_water_out = mdot_gas_in;
215
216 METHODS
217 METHOD default_self;
218 RUN reset;
219 RUN values;
220 END default_self;
221 METHOD specify;
222 mdot_gas_in.fixed := TRUE;
223 S.p.fixed := TRUE;
224 S.T.fixed := TRUE;
225 END specify;
226 METHOD values;
227 mdot_gas_in := 1 {kg/s};
228 S.p := 5 {bar};
229 S.T := 473.15 {K};
230 END values;
231
232 END condenser;
233
234 MODEL loop;
235 A IS_A absorber;
236 C IS_A condenser;
237 S IS_A vessel_with_water;
238
239 m_water_total IS_A mass;
240
241 A.S, C.S ARE_THE_SAME; (* absorber outlet steam goes to the condenser *)
242 A.p, S.p ARE_THE_SAME; (* absorber pressure equals surge tank pressure *)
243
244 A.Q, C.Q ARE_THE_SAME; (* heat out of condenser must balance that absorbed *)
245
246 p ALIASES A.p;
247 Q ALIASES A.Q;
248 T_abs_out ALIASES A.T;
249 m_abs_water ALIASES A.m_water;
250 m_surge_water ALIASES S.m_water;
251 m_gas ALIASES S.m_gas;
252 V_surge ALIASES S.V_vessel;
253 V_absorber ALIASES A.V_total;
254 absorber_void_fraction ALIASES A.alpha;
255
256 m_surge_water + m_abs_water = m_water_total;
257
258 METHODS
259 METHOD default_self;
260 RUN reset;
261 RUN values;
262 END default_self;
263
264 METHOD specify;
265 A.Q.fixed := TRUE;
266 A.V_total.fixed := TRUE;
267 S.V_vessel.fixed := TRUE;
268 S.m_gas.fixed := TRUE;
269 m_water_total.fixed := TRUE;
270 END specify;
271
272 METHOD values;
273 A.Q := 400 {W/m^2} * 20 * 40{mm} * 300{m};
274 A.V_total := 300{m} * 16 * 1{PI}*( 40{mm} )^2;
275 S.V_vessel := 10 {m^3};
276 S.m_gas := 7.27101 {kg};
277 m_water_total := 3000 {kg};
278 END values;
279
280 END loop;

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