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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 265 - (show annotations) (download) (as text)
Fri Feb 3 04:27:15 2006 UTC (19 years, 3 months ago) by johnpye
File MIME type: text/x-ascend
File size: 5019 byte(s)
More progress with loop/condenser. But also a crash, see bug #217
1 REQUIRE "johnpye/ideal_steam.a4c";
2 REQUIRE "johnpye/iapws_sat_curves.a4c";
3 REQUIRE "johnpye/iapws95.a4c";
4
5 MODEL condenser_lmtd(
6 S_in WILL_BE thermo_state;
7 S_out WILL_BE thermo_state;
8 );
9 T_h1 ALIASES S_in.T;
10 T_h2 ALIASES S_out.T;
11 h_h1 ALIASES S_in.h;
12 h_h2 ALIASES S_out.h;
13
14 mdot_in IS_A mass_rate;
15
16 T_c1 IS_A temperature;
17 T_c2 IS_A temperature;
18
19 T_c_in ALIASES T_c2;
20 T_c_out ALIASES T_c1;
21
22
23 LMTD IS_A delta_temperature;
24
25 DT_1, DT_2 IS_A delta_temperature;
26
27 DT_1 = T_h1 - T_c1;
28 DT_2 = T_h2 - T_c2;
29
30 lmtd: LMTD = (DT_2 - DT_1) / ln(DT_2/DT_1);
31
32 UA IS_A ua_value;
33 q IS_A energy_rate;
34
35 q = UA * LMTD;
36
37 q = mdot_in * (h_h1 - h_h2);
38
39 S_out.p = S_in.p;
40
41 METHODS
42 METHOD specify;
43 FIX UA;
44 FIX T_c_in;
45 FIX mdot_in;
46 END specify;
47 METHOD values;
48 UA := 1000 {W/m^2/K} * 4 {m} * 900 * 2*3.1415926* (0.01 {m})/2;
49 T_c_in := 273.15{K} + 20 {K};
50 mdot_in := 1 {kg/s};
51 (* free values *)
52 T_h2 := T_h1 - 20{K};
53 h_h2 := h_h1 - 4.2{kJ/kg/K}*20{K};
54 END values;
55 METHOD bound_self;
56 DT_1.lower_bound := 0{K};
57 DT_2.lower_bound := 0{K};
58 q.lower_bound := 0{W};
59 T_h2.upper_bound := T_h1;
60 T_h2.lower_bound := T_c_out;
61 h_h2.upper_bound := h_h1;
62 END bound_self;
63 END condenser_lmtd;
64
65 (*--------------------------*)
66
67 (* test model for the above *)
68 MODEL condenser_lmtd_test;
69 S1 IS_A iapws95_1phase;
70 S2 IS_A iapws95_1phase;
71
72 T_in ALIASES S1.T;
73 p_in ALIASES S1.p;
74
75 C IS_A condenser_lmtd(S1,S2);
76
77 q ALIASES C.q;
78
79 METHODS
80 METHOD default_self;
81 RUN reset; RUN values; RUN bound_self;
82 END default_self;
83 METHOD specify;
84 RUN C.specify;
85 FIX T_in;
86 FIX p_in;
87 FIX C.T_c_out;
88 END specify;
89 METHOD values;
90 RUN C.values;
91 T_in := 273.15{K} + 280 {K};
92 p_in := 1{bar};
93 q := 4.2{kJ/s};
94 C.T_c_out := 273.15{K} + 25 {K};
95 END values;
96 METHOD bound_self;
97 RUN C.bound_self;
98 END bound_self;
99 END condenser_lmtd_test;
100
101
102 (*--------------------------*)
103 MODEL condenser_lmtd_sat(
104 S_in WILL_BE thermo_state;
105 S_out WILL_BE thermo_state;
106 );
107 T_in ALIASES S_in.T;
108
109 mdot_in IS_A mass_rate;
110 mdot_out ALIASES mdot_in;
111
112 T_c1 IS_A temperature; (* cold inlet *)
113 T_c2 IS_A temperature; (* cold outlet *)
114
115 LMTD_fg IS_A delta_temperature;
116
117 DT_c_fg, DT_1, DT_2 IS_A delta_temperature;
118
119 DT_c_fg = T_c2 - T_c1;
120 DT_1 = T_in - T_c1;
121 DT_2 = T_in - T_c2;
122
123 lmtd: LMTD_fg = (DT_c_fg) / ln(DT_1/DT_2);
124 (* lmtd: LMTD_fg * -ln((T_in - T_c1)/(T_in - T_c2)) = (T_c2 - T_c1); *)
125
126 UA_fg IS_A ua_value;
127 q_fg IS_A energy_rate;
128
129 q_fg = UA_fg * LMTD_fg;
130
131 (* condensation point *)
132 Sf ALIASES S_out;
133
134 sat IS_A iapws_sat_density;
135 sat.rhof = Sf.rho;
136 sat.T = Sf.T;
137
138 S_in.T = Sf.T;
139
140 q_fg = mdot_in * (S_in.h - Sf.h);
141 METHODS
142 METHOD specify;
143 FIX UA_fg;
144 FIX T_c1;
145 FIX mdot_in;
146 END specify;
147 METHOD values;
148 UA_fg := 4000 {W/m^2/K} * 4 {m} * 900 * 2*3.1415926* (0.01 {m})/2;
149 T_c1 := 273.15{K} + 200 {K};
150 mdot_in := 10 {kg/s};
151 (* free values *)
152 T_c2 := 273.15{K} + 240 {K};
153 END values;
154 METHOD bound_self;
155 Sf.tau.lower_bound := 1;
156 DT_c_fg.lower_bound := 0{K};
157 DT_1.lower_bound := 0{K};
158 DT_2.lower_bound := 0{K};
159 Sf.rho.lower_bound := Sf.rhoc;
160 END bound_self;
161 END condenser_lmtd_sat;
162
163 (*------------------------------*)
164
165 MODEL condenser_lmtd_sat_test;
166 Sg IS_A iapws95_1phase;
167 Sf IS_A iapws95_1phase;
168
169 sat IS_A iapws_sat_density;
170 sat.rhog, Sg.rho ARE_THE_SAME;
171 sat.T, Sg.T ARE_THE_SAME;
172 T_in ALIASES Sg.T;
173
174 C IS_A condenser_lmtd_sat(Sg,Sf);
175
176 METHODS
177 METHOD default_self;
178 RUN reset; RUN values; RUN bound_self;
179 END default_self;
180 METHOD specify;
181 RUN C.specify;
182 FIX T_in;
183 END specify;
184 METHOD values;
185 RUN C.values;
186 T_in := 273.15{K} + 280 {K};
187 END values;
188 METHOD bound_self;
189 RUN C.bound_self;
190 END bound_self;
191 METHOD self_test;
192 ASSERT (C.q_fg - 15430{kW}) < 1{kW};
193 END self_test;
194 END condenser_lmtd_sat_test;
195
196 (*-----------------------------*)
197
198 MODEL condenser;
199 (* assumptions:
200 inlet is ideal-gas steam at specified temperature and pressure.
201 output is water of fixed enthalpy.
202 whatever energy is required to be taken away to acheive that is what will be taken away.
203
204 we don't need to enforce saturation inlet conditions. we will just query the enthalpy for the ideal-gas steam
205 and that's it.
206 *)
207 S_in IS_A ideal_steam;
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 h_in ALIASES S_in.h;
214 p_in ALIASES S_in.p;
215 T_in ALIASES S_in.T;
216
217 (*
218 h2 will be the enthalpy of the condensed water. because we are
219 ignoring pressure effects, we have to assume a constant fixed
220 value for the enthalpy of water at x=0.
221 *)
222 h_out IS_A specific_enthalpy;
223
224 Q = mdot_gas_in * h_in - mdot_water_out * h_out;
225 mdot_water_out = mdot_gas_in;
226
227 (*
228 we will assume there is NO water in the condenser for now; the
229 surge tank will play the role of the mass holdup in this case.
230 *)
231 METHODS
232 METHOD default_self;
233 RUN reset;
234 RUN values;
235 END default_self;
236 METHOD specify;
237 FIX mdot_gas_in;
238 FIX S_in.p, S_in.T;
239 FIX h_out;
240 END specify;
241 METHOD values;
242 mdot_gas_in := 1 {kg/s};
243 S_in.p := 5 {bar};
244 S_in.T := 473.15 {K};
245 h_out := 400{kJ/kg};
246 END values;
247 END condenser;

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