| 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: DT_2/DT_1 = exp( (DT_2 - DT_1) / LMTD ); |
| 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_hi ALIASES C.S_in.T; |
| 73 |
T_ho ALIASES C.S_out.T; |
| 74 |
T_ci ALIASES C.T_c_in; |
| 75 |
T_co ALIASES C.T_c_out; |
| 76 |
|
| 77 |
p_in ALIASES S1.p; |
| 78 |
|
| 79 |
C IS_A condenser_lmtd(S1,S2); |
| 80 |
|
| 81 |
q ALIASES C.q; |
| 82 |
|
| 83 |
METHODS |
| 84 |
METHOD default_self; |
| 85 |
RUN reset; RUN values; RUN bound_self; |
| 86 |
END default_self; |
| 87 |
METHOD specify; |
| 88 |
RUN C.specify; |
| 89 |
FIX T_hi; |
| 90 |
FIX T_co; |
| 91 |
FIX p_in; |
| 92 |
END specify; |
| 93 |
METHOD values; |
| 94 |
RUN C.values; |
| 95 |
T_hi := 273.15{K} + 280 {K}; |
| 96 |
T_co := 273.15{K} + 25 {K}; |
| 97 |
p_in := 1{bar}; |
| 98 |
q := 4.2{kJ/s}; |
| 99 |
END values; |
| 100 |
METHOD bound_self; |
| 101 |
RUN C.bound_self; |
| 102 |
END bound_self; |
| 103 |
END condenser_lmtd_test; |
| 104 |
|
| 105 |
|
| 106 |
(*--------------------------*) |
| 107 |
|
| 108 |
(* |
| 109 |
This model is parameterised in order that we |
| 110 |
don't end up with multiple assertions about the |
| 111 |
saturated state at the inlet, see condenser_lmtd_sat_test |
| 112 |
*) |
| 113 |
MODEL condenser_lmtd_sat( |
| 114 |
S_in WILL_BE thermo_state; |
| 115 |
S_out WILL_BE thermo_state; |
| 116 |
); |
| 117 |
mdot_in IS_A mass_rate; |
| 118 |
mdot_out ALIASES mdot_in; |
| 119 |
|
| 120 |
T_ci IS_A temperature; (* cold inlet *) |
| 121 |
T_co IS_A temperature; (* cold outlet *) |
| 122 |
T_hi ALIASES S_in.T; |
| 123 |
T_ho ALIASES S_out.T; |
| 124 |
|
| 125 |
LMTD IS_A delta_temperature; |
| 126 |
|
| 127 |
DT_c, DT_1, DT_2 IS_A delta_temperature; |
| 128 |
|
| 129 |
z_DT_c: DT_c = T_co - T_ci; |
| 130 |
z_DT_1: DT_1 = T_hi - T_ci; |
| 131 |
z_DT_2: DT_2 = T_hi - T_co; |
| 132 |
|
| 133 |
(* this is a better-converging form for the LMTD equation *) |
| 134 |
lmtd: DT_1/DT_2 = exp(DT_c / LMTD); |
| 135 |
|
| 136 |
UA IS_A ua_value; |
| 137 |
q IS_A energy_rate; |
| 138 |
|
| 139 |
z_q_LMTD: q = UA * LMTD; |
| 140 |
|
| 141 |
sat IS_A iapws_sat_density; |
| 142 |
z_rhof: sat.rhof = S_out.rho; |
| 143 |
z_T_sat: sat.T = S_out.T; |
| 144 |
|
| 145 |
z_T_const: S_in.T = S_out.T; |
| 146 |
|
| 147 |
C_c IS_A heat_capacity; |
| 148 |
cp_c IS_A specific_heat_capacity; |
| 149 |
mdot_c IS_A mass_rate; |
| 150 |
C_c = cp_c * mdot_c; |
| 151 |
z_Q_h: q = mdot_in * (S_in.h - S_out.h); |
| 152 |
z_Q_c: q = C_c * (T_co - T_ci); |
| 153 |
|
| 154 |
METHODS |
| 155 |
METHOD specify; |
| 156 |
FIX UA; |
| 157 |
FIX T_ci; |
| 158 |
FIX mdot_in; |
| 159 |
FIX cp_c; |
| 160 |
END specify; |
| 161 |
METHOD values; |
| 162 |
UA := 4000 {W/m^2/K} * 4 {m} * 900 * 2*3.1415926* (0.01 {m})/2; |
| 163 |
T_ci := 273.15{K} + 200 {K}; |
| 164 |
mdot_in := 10 {kg/s}; |
| 165 |
cp_c := 4.2 {kJ/kg/K}; |
| 166 |
(* free values *) |
| 167 |
T_co := 273.15{K} + 240 {K}; |
| 168 |
C_c := 200 {kJ/K}; |
| 169 |
q := 15000 {kW}; |
| 170 |
LMTD := 34 {K}; |
| 171 |
END values; |
| 172 |
METHOD bound_self; |
| 173 |
(* Sf.tau.lower_bound := 1; *) |
| 174 |
DT_c.lower_bound := 0{K}; |
| 175 |
DT_1.lower_bound := 0{K}; |
| 176 |
DT_2.lower_bound := 0{K}; |
| 177 |
(* Sf.rho.lower_bound := Sf.rhoc; *) |
| 178 |
mdot_c.upper_bound := 1000 {kg/s}; |
| 179 |
mdot_c.lower_bound := 0.1 {kg/s}; |
| 180 |
END bound_self; |
| 181 |
END condenser_lmtd_sat; |
| 182 |
|
| 183 |
(*------------------------------*) |
| 184 |
|
| 185 |
MODEL condenser_lmtd_sat_test; |
| 186 |
Sg IS_A iapws95_1phase; |
| 187 |
Sf IS_A iapws95_1phase; |
| 188 |
|
| 189 |
sat IS_A iapws_sat_density; |
| 190 |
sat.rhog, Sg.rho ARE_THE_SAME; |
| 191 |
sat.T, Sg.T ARE_THE_SAME; |
| 192 |
|
| 193 |
C IS_A condenser_lmtd_sat(Sg,Sf); |
| 194 |
|
| 195 |
T_hi ALIASES Sg.T; |
| 196 |
T_ho ALIASES Sf.T; |
| 197 |
|
| 198 |
T_ci ALIASES C.T_ci; |
| 199 |
T_co ALIASES C.T_co; |
| 200 |
|
| 201 |
mdot ALIASES C.mdot_in; |
| 202 |
|
| 203 |
Q ALIASES C.q; |
| 204 |
C_c ALIASES C.C_c; |
| 205 |
mdot_c ALIASES C.mdot_c; |
| 206 |
|
| 207 |
METHODS |
| 208 |
METHOD default_self; |
| 209 |
RUN reset; RUN values; RUN bound_self; |
| 210 |
END default_self; |
| 211 |
METHOD specify; |
| 212 |
RUN C.specify; |
| 213 |
FIX T_hi; |
| 214 |
END specify; |
| 215 |
METHOD values; |
| 216 |
RUN C.values; |
| 217 |
T_hi := 273.15{K} + 280 {K}; |
| 218 |
END values; |
| 219 |
METHOD bound_self; |
| 220 |
RUN C.bound_self; |
| 221 |
END bound_self; |
| 222 |
METHOD self_test; |
| 223 |
ASSERT (C.q - 15430{kW}) < 1{kW}; |
| 224 |
ASSERT T_hi - T_ho < 0.01 {K}; |
| 225 |
END self_test; |
| 226 |
END condenser_lmtd_sat_test; |