1 |
REQUIRE "solar/solar_types.a4l"; |
2 |
REQUIRE "johnpye/thermo_types.a4c"; |
3 |
|
4 |
|
5 |
MODEL Air_Properties( |
6 |
T WILL_BE temperature; |
7 |
); |
8 |
(* Variables *) |
9 |
rho IS_A mass_density; (* Air density *) |
10 |
Cp IS_A specific_heat_capacity; (* Constant pressure heat capacity *) |
11 |
|
12 |
T_dimless IS_A factor; |
13 |
rho_dimless IS_A factor; |
14 |
Cp_dimless IS_A factor; |
15 |
|
16 |
|
17 |
(* Equations *) |
18 |
T_dimless * 1{K} = T; |
19 |
rho = rho_dimless * 1{kg/m^3}; |
20 |
Cp = Cp_dimless * 1{J/kg/K}; |
21 |
|
22 |
rho_dimless * (8314.32 * T_dimless) = 1000 * 101.325 * 28.9645; |
23 |
(* rho = 1.2466 {kg/m^3}; *) |
24 |
|
25 |
Cp_dimless = (1 + ( 2.5e-10 * T_dimless^3 )) * 1000 ; |
26 |
(* Cp = 1.012 {kJ/kg/K}; *) |
27 |
|
28 |
METHODS |
29 |
METHOD bound_self; |
30 |
rho.lower_bound := 0 {kg/m^3}; |
31 |
rho_dimless.lower_bound := 0; |
32 |
Cp.lower_bound := 0 {J/kg/K}; |
33 |
Cp_dimless.lower_bound := 0; |
34 |
END bound_self; |
35 |
END Air_Properties; |
36 |
|
37 |
|
38 |
MODEL test_Air_Properties; |
39 |
T IS_A temperature; |
40 |
instance IS_A Air_Properties (T); |
41 |
|
42 |
METHODS |
43 |
METHOD specify; |
44 |
FIX T; |
45 |
END specify; |
46 |
|
47 |
METHOD values; |
48 |
T := 25{K} + 273.15{K}; |
49 |
END values; |
50 |
|
51 |
METHOD on_load; |
52 |
RUN specify; |
53 |
RUN values; |
54 |
|
55 |
RUN instance.bound_self; |
56 |
END on_load; |
57 |
END test_Air_Properties; |
58 |
|
59 |
|
60 |
MODEL layer; |
61 |
e IS_A real_constant; |
62 |
e :== 2.718; |
63 |
|
64 |
(* Variables *) |
65 |
T_f_after IS_A temperature; |
66 |
T_f_before IS_A temperature; |
67 |
|
68 |
T_b IS_A temperature; |
69 |
NTU_by_N IS_A factor; |
70 |
|
71 |
(* Equations *) |
72 |
(T_f_after - T_b) * e^NTU_by_N = T_f_before - T_b; |
73 |
END layer; |
74 |
|
75 |
|
76 |
MODEL packed_bed_tank; |
77 |
(* Constants *) |
78 |
NL IS_A integer_constant; |
79 |
NL :== 3; |
80 |
e IS_A real_constant; |
81 |
e :== 2.718; |
82 |
|
83 |
(* Variables *) |
84 |
T_amb IS_A temperature; |
85 |
T_in IS_A temperature; |
86 |
V IS_A speed; (* Fluid velocity *) |
87 |
D IS_A distance; (* diameter of pebbles *) |
88 |
A IS_A area; (* Cross sectional area of bed [input] *) |
89 |
L IS_A distance; (* length of bed [input] *) |
90 |
delta_t IS_A time; (* process starts from zero (Input: 0 to 5hrs) *) |
91 |
epsilon IS_A fraction; (* bed void fraction (input) *) |
92 |
|
93 |
Tavg IS_A temperature; |
94 |
T_out IS_A temperature; |
95 |
NTU IS_A factor; |
96 |
hv IS_A volumetric_heat_transfer_coefficient; (* volumetric heat transfer coefficient *) |
97 |
G_dimless IS_A factor; |
98 |
D_dimless IS_A factor; |
99 |
mdot IS_A mass_rate; |
100 |
NTU_by_N IS_A factor; |
101 |
delta_x IS_A distance; |
102 |
delta_theta IS_A time; |
103 |
|
104 |
|
105 |
(* parts *) |
106 |
air_props IS_A Air_Properties (Tavg); |
107 |
bed[1..NL] IS_A layer; |
108 |
|
109 |
(* Interconnections *) |
110 |
bed[1].T_f_before, T_in ARE_THE_SAME; |
111 |
bed[NL].T_f_after, T_out ARE_THE_SAME; |
112 |
NTU_by_N, bed[1..NL].NTU_by_N ARE_THE_SAME; |
113 |
FOR i IN [2..NL] CREATE |
114 |
bed[i-1].T_f_after, bed[i].T_f_before ARE_THE_SAME; |
115 |
END FOR; |
116 |
|
117 |
|
118 |
(* Equations *) |
119 |
Tavg = (T_in + T_out)/2; |
120 |
NTU * (mdot * air_props.Cp) = hv * A * L; |
121 |
|
122 |
hv * (D_dimless^0.7) = 650 * (G_dimless^0.7); |
123 |
|
124 |
D_dimless = D / 1{m}; |
125 |
G_dimless = V * air_props.rho / 1{kg/m^2/s}; |
126 |
mdot = air_props.rho * V * A; |
127 |
|
128 |
delta_x = L / NL; |
129 |
NTU_by_N = NTU / NL; |
130 |
|
131 |
delta_theta * (air_props.rho * air_props.Cp) * (1-epsilon) * A * L = delta_t * mdot * air_props.Cp; |
132 |
|
133 |
(bed[1].T_b - T_amb) * e^NTU_by_N = delta_theta * NL * (T_in - (T_amb + bed[1].T_b)/2); |
134 |
FOR i IN [2..NL] CREATE |
135 |
(bed[i].T_b - bed[i-1].T_b) * e^NTU_by_N = delta_theta * NL * (bed[i-1].T_f_after - (bed[i-1].T_b + bed[i].T_b)/2); |
136 |
END FOR; |
137 |
|
138 |
|
139 |
METHODS |
140 |
METHOD specify; |
141 |
FIX T_amb, T_in, V, D, A, L, delta_t, epsilon; |
142 |
END specify; |
143 |
|
144 |
METHOD bound_self; |
145 |
RUN air_props.bound_self; |
146 |
G_dimless.lower_bound := 0; |
147 |
mdot.lower_bound := 0{kg/s}; |
148 |
NTU.lower_bound := 0; |
149 |
NTU_by_N.lower_bound := 0; |
150 |
hv.lower_bound := 0{watt/m^3/K}; |
151 |
delta_theta.lower_bound := 0 {s}; |
152 |
NTU_by_N.upper_bound := 100; |
153 |
END bound_self; |
154 |
|
155 |
METHOD values; |
156 |
T_amb := 10 {K} + 273.15 {K}; |
157 |
T_in := 40 {K} + 273.15 {K}; |
158 |
V := 0.053 {m/s}; |
159 |
D := 0.0125 {m}; |
160 |
A := 14.8 {m^2}; |
161 |
L := 1.8 {m}; |
162 |
delta_t := 1 {hr}; |
163 |
epsilon := 0.47; |
164 |
END values; |
165 |
|
166 |
METHOD default_self; |
167 |
G_dimless := 0.0638; |
168 |
NTU := 57; |
169 |
hv := 2030{watt/m^3/K}; |
170 |
T_out := 20 {K} + 273.15 {K}; |
171 |
END default_self; |
172 |
|
173 |
METHOD on_load; |
174 |
RUN specify; |
175 |
RUN bound_self; |
176 |
RUN default_self; |
177 |
RUN values; |
178 |
|
179 |
SOLVER QRSlv; |
180 |
OPTION convopt 'RELNOM_SCALE'; |
181 |
OPTION iterationlimit 100; |
182 |
END on_load; |
183 |
END packed_bed_tank; |
184 |
|
185 |
|
186 |
MODEL example_packed_bed_tank REFINES packed_bed_tank; |
187 |
|
188 |
METHODS |
189 |
METHOD specify; |
190 |
RUN packed_bed_tank::specify; |
191 |
END specify; |
192 |
|
193 |
METHOD values; |
194 |
T_amb := 10 {K} + 273.15 {K}; |
195 |
T_in := 40 {K} + 273.15 {K}; |
196 |
V := 0.053 {m/s}; |
197 |
D := 0.0125 {m}; |
198 |
A := 14.8 {m^2}; |
199 |
L := 1.8 {m}; |
200 |
delta_t := 1 {hr}; |
201 |
epsilon := 0.47; |
202 |
END values; |
203 |
|
204 |
METHOD on_load; |
205 |
RUN packed_bed_tank::specify; |
206 |
RUN packed_bed_tank::bound_self; |
207 |
RUN packed_bed_tank::default_self; |
208 |
RUN values; |
209 |
|
210 |
SOLVER QRSlv; |
211 |
OPTION convopt 'RELNOM_SCALE'; |
212 |
OPTION iterationlimit 100; |
213 |
END on_load; |
214 |
|
215 |
END example_packed_bed_tank; |