1 |
REQUIRE "atoms.a4l"; |
2 |
REQUIRE "solar/solar_types.a4l"; |
3 |
REQUIRE "johnpye/thermo_types.a4c"; |
4 |
|
5 |
REQUIRE "johnpye/sunpos.a4c"; |
6 |
|
7 |
IMPORT "johnpye/fprops/helmholtz"; |
8 |
|
9 |
MODEL helmholtz_conf; |
10 |
component IS_A symbol_constant; |
11 |
component :== 'water'; |
12 |
END helmholtz_conf; |
13 |
|
14 |
MODEL sunpos_tracker2 REFINES sunpos; |
15 |
(* The collector is rotated about a horizontal east-west axis with continuous adjustment to minimize the angle of incidence *) |
16 |
|
17 |
sin(delta) * ( sin(phi)*sin(beta) + cos(phi)*cos(beta)*cos(gamma) ) = cos(delta) * cos(omega) * ( sin(phi) * cos(beta) * cos(gamma) - cos(phi) * sin(beta) ) + cos(delta) * cos(beta) * sin(gamma) * sin(omega); |
18 |
|
19 |
METHODS |
20 |
METHOD specify; |
21 |
FIX t, L_st, L_loc, phi; (* time and location *) |
22 |
FIX gamma; (* surface orientation *) |
23 |
END specify; |
24 |
|
25 |
METHOD bound_self; |
26 |
beta.lower_bound := 0 {deg}; |
27 |
beta.upper_bound := 90 {deg}; |
28 |
END bound_self; |
29 |
|
30 |
METHOD values; |
31 |
L_st := -90{deg}; |
32 |
L_loc := -89.4{deg}; |
33 |
phi := +43{deg}; |
34 |
(* t := 32.4375 {d}; *) |
35 |
t := 32{d} + 10{h}+30{min}; |
36 |
gamma := 15{deg}; (* surface orientation *) |
37 |
END values; |
38 |
|
39 |
METHOD default_self; |
40 |
beta := 45{deg}; |
41 |
END default_self; |
42 |
|
43 |
METHOD on_load; |
44 |
RUN specify; |
45 |
RUN values; |
46 |
RUN bound_self; |
47 |
RUN default_self; |
48 |
END on_load; |
49 |
END sunpos_tracker2; |
50 |
|
51 |
|
52 |
MODEL hconv_c_a( |
53 |
D WILL_BE distance; |
54 |
V WILL_BE speed; |
55 |
T_amb WILL_BE temperature; |
56 |
); |
57 |
|
58 |
r IS_A mass_density; |
59 |
u IS_A viscosity; |
60 |
Re IS_A factor; |
61 |
(* Reynolds Number *) |
62 |
Nu IS_A factor; |
63 |
k IS_A thermal_conductivity; |
64 |
value IS_A heat_transfer_coefficient; |
65 |
|
66 |
Re*u = r*V*D; |
67 |
Nu = 0.40 + 0.54 * Re^0.52; |
68 |
value*D = Nu*k; |
69 |
|
70 |
METHODS |
71 |
METHOD specify; |
72 |
FIX r; |
73 |
FIX u; |
74 |
FIX k; |
75 |
END specify; |
76 |
|
77 |
METHOD values; |
78 |
r := 1.2466 {kg/m^3}; |
79 |
u := 1.78e-5 {kg/m/s}; |
80 |
k := 0.0253 {W/m/K}; |
81 |
END values; |
82 |
END hconv_c_a; |
83 |
|
84 |
MODEL test_hconv_c_a(); |
85 |
D IS_A distance; |
86 |
V IS_A speed; |
87 |
T_amb IS_A temperature; |
88 |
|
89 |
instance IS_A hconv_c_a(D,V,T_amb); |
90 |
|
91 |
METHODS |
92 |
METHOD specify; |
93 |
FIX D; |
94 |
FIX V; |
95 |
FIX T_amb; |
96 |
RUN instance.specify; |
97 |
END specify; |
98 |
|
99 |
METHOD values; |
100 |
D := 1 {cm}; |
101 |
V := 10 {m/s}; |
102 |
T_amb := 10 {K} + 273.15 {K}; |
103 |
RUN instance.values; |
104 |
END values; |
105 |
|
106 |
METHOD on_load; |
107 |
RUN specify; |
108 |
RUN values; |
109 |
END on_load; |
110 |
|
111 |
END test_hconv_c_a; |
112 |
|
113 |
|
114 |
|
115 |
MODEL hr_c_a( |
116 |
Tc WILL_BE temperature; |
117 |
T_amb WILL_BE temperature; |
118 |
e WILL_BE fraction; |
119 |
); |
120 |
|
121 |
S IS_A stefan_boltzman_constant; |
122 |
S :== 5.670e-8 {watt/m^2/K^4}; |
123 |
|
124 |
value IS_A heat_transfer_coefficient; |
125 |
|
126 |
value = 4*S*e*(Tc+T_amb)^3; |
127 |
|
128 |
METHODS |
129 |
METHOD specify; |
130 |
END specify; |
131 |
|
132 |
METHOD values; |
133 |
END values; |
134 |
END hr_c_a; |
135 |
|
136 |
|
137 |
MODEL test_hr_c_a(); |
138 |
Tc IS_A temperature; |
139 |
T_amb IS_A temperature; |
140 |
e IS_A fraction; |
141 |
|
142 |
instance IS_A hr_c_a(Tc,T_amb,e); |
143 |
|
144 |
METHODS |
145 |
METHOD specify; |
146 |
FIX Tc; |
147 |
FIX T_amb; |
148 |
FIX e; |
149 |
RUN instance.specify; |
150 |
END specify; |
151 |
|
152 |
METHOD values; |
153 |
Tc := 40 {K} + 273.15 {K}; |
154 |
T_amb := 10 {K} + 273.15 {K}; |
155 |
e := 0.9; |
156 |
RUN instance.values; |
157 |
END values; |
158 |
|
159 |
METHOD on_load; |
160 |
RUN specify; |
161 |
RUN values; |
162 |
END on_load; |
163 |
|
164 |
END test_hr_c_a; |
165 |
|
166 |
|
167 |
MODEL hr_r_c( |
168 |
Tc WILL_BE temperature; |
169 |
Tr WILL_BE temperature; |
170 |
e1 WILL_BE fraction; |
171 |
e2 WILL_BE fraction; |
172 |
Ar WILL_BE area; |
173 |
Aa WILL_BE area; |
174 |
); |
175 |
|
176 |
S IS_A stefan_boltzman_constant; |
177 |
S :== 5.670e-8 {watt/m^2/K^4}; |
178 |
|
179 |
value IS_A heat_transfer_coefficient; |
180 |
|
181 |
value = S*(Tc^2+Tr^2)*(Tc+Tr) / (((1-e1)/e1)+1+((1-e2)/e2)*(Ar/Aa)); |
182 |
|
183 |
|
184 |
METHODS |
185 |
METHOD specify; |
186 |
END specify; |
187 |
|
188 |
METHOD values; |
189 |
END values; |
190 |
END hr_r_c; |
191 |
|
192 |
|
193 |
MODEL test_hr_r_c(); |
194 |
|
195 |
Tc IS_A temperature; |
196 |
Tr IS_A temperature; |
197 |
e1 IS_A fraction; |
198 |
e2 IS_A fraction; |
199 |
Ar IS_A area; |
200 |
Aa IS_A area; |
201 |
|
202 |
instance IS_A hr_r_c (Tc,Tr,e1,e2,Ar,Aa); |
203 |
|
204 |
METHODS |
205 |
METHOD specify; |
206 |
FIX Tc; |
207 |
FIX Tr; |
208 |
FIX e1; |
209 |
FIX e2; |
210 |
FIX Ar; |
211 |
FIX Aa; |
212 |
RUN instance.specify; |
213 |
END specify; |
214 |
|
215 |
METHOD values; |
216 |
Tc := 40 {K} + 273.15 {K}; |
217 |
Tr := 100 {K} + 273.15 {K}; |
218 |
e1 := 0.9; |
219 |
e2 := 0.88; |
220 |
Ar := 16 {cm^2}; |
221 |
Aa := 4 {cm^2}; |
222 |
RUN instance.values; |
223 |
END values; |
224 |
|
225 |
METHOD on_load; |
226 |
RUN specify; |
227 |
RUN values; |
228 |
END on_load; |
229 |
END test_hr_r_c; |
230 |
|
231 |
|
232 |
|
233 |
MODEL Ul; |
234 |
Tc IS_A temperature; |
235 |
Tr IS_A temperature; |
236 |
T_amb IS_A temperature; |
237 |
e IS_A fraction; |
238 |
e1 IS_A fraction; |
239 |
e2 IS_A fraction; |
240 |
Ar IS_A area; |
241 |
Aa IS_A area; |
242 |
D IS_A distance; |
243 |
V IS_A speed; |
244 |
|
245 |
|
246 |
hconv_c_a_instance IS_A hconv_c_a(D,V,T_amb); |
247 |
|
248 |
hr_c_a_instance IS_A hr_c_a(Tc,T_amb,e); |
249 |
|
250 |
hr_r_c_instance IS_A hr_r_c (Tc,Tr,e1,e2,Ar,Aa); |
251 |
|
252 |
C IS_A factor; |
253 |
|
254 |
value IS_A heat_transfer_coefficient; |
255 |
|
256 |
|
257 |
|
258 |
Tc = (Ar*hr_r_c_instance.value*Tr + Aa*(hr_c_a_instance.value + hconv_c_a_instance.value)*T_amb) / (Ar*hr_r_c_instance.value + Aa*(hr_c_a_instance.value + hconv_c_a_instance.value)); |
259 |
|
260 |
C * Ar = Aa; |
261 |
|
262 |
value * C * hr_r_c_instance.value = (hconv_c_a_instance.value + hr_c_a_instance.value) * (hr_r_c_instance.value - value); |
263 |
|
264 |
|
265 |
METHODS |
266 |
METHOD specify; |
267 |
FIX Tr; |
268 |
FIX T_amb; |
269 |
FIX e; |
270 |
FIX e1; |
271 |
FIX e2; |
272 |
FIX Ar; |
273 |
FIX Aa; |
274 |
FIX D; |
275 |
FIX V; |
276 |
|
277 |
RUN hconv_c_a_instance.specify; |
278 |
RUN hr_c_a_instance.specify; |
279 |
RUN hr_r_c_instance.specify; |
280 |
END specify; |
281 |
|
282 |
METHOD values; |
283 |
Tr := 100 {K} + 273.15 {K}; |
284 |
T_amb := 10 {K} + 273.15 {K}; |
285 |
e := 0.9; |
286 |
e1 := 0.9; |
287 |
e2 := 0.88; |
288 |
Ar := 16 {cm^2}; |
289 |
Aa := 4 {cm^2}; |
290 |
D := 1 {cm}; |
291 |
V := 10 {m/s}; |
292 |
|
293 |
RUN hconv_c_a_instance.values; |
294 |
RUN hr_c_a_instance.values; |
295 |
RUN hr_r_c_instance.values; |
296 |
END values; |
297 |
|
298 |
METHOD on_load; |
299 |
RUN specify; |
300 |
RUN values; |
301 |
END on_load; |
302 |
END Ul; |
303 |
|
304 |
|
305 |
MODEL S1; |
306 |
|
307 |
(* Variables *) |
308 |
|
309 |
sp IS_A sunpos_tracker2; |
310 |
|
311 |
value IS_A factor; |
312 |
|
313 |
DNI IS_A factor; |
314 |
kT IS_A factor; |
315 |
|
316 |
IAM IS_A factor; |
317 |
|
318 |
f IS_A distance; (* focal length of the concentrator (distance from vertex to the focus) *) |
319 |
L IS_A distance; (* length of collector assembly (same as earlier L, length of receiver tube) *) |
320 |
EndLoss IS_A factor; |
321 |
|
322 |
Eta_field IS_A factor; (* field efficiency *) |
323 |
TrkTwstErr IS_A factor; (* twisting and tracking error associated with the collector type *) |
324 |
GeoAcc IS_A factor; (* geometric accuracy of the collector mirrors *) |
325 |
MirRef IS_A fraction; (* mirror reflectivity *) |
326 |
MirCln IS_A fraction; (* mirror cleanliness *) |
327 |
|
328 |
Eta_HCE IS_A fraction; (* Heat Collection Element Efficiency *) |
329 |
HCEdust IS_A factor; (* losses due to shading of HCE by dust on the envelope *) |
330 |
BelShad IS_A factor; (* losses from shading of ends of HCEs due to bellows (WHAT is this *) |
331 |
EnvTrans IS_A fraction; (* transmissivity of the glass envelope *) |
332 |
HCEabs IS_A fraction; (* absorbtivity of the HCE selective coating *) |
333 |
HCEmisc IS_A factor; (* miscellaneous factor to adjust for other HCE losses *) |
334 |
|
335 |
SFAvail IS_A fraction; (* fraction of the solar field that is operable and tracking the sun *) |
336 |
|
337 |
|
338 |
|
339 |
(* Equations *) |
340 |
|
341 |
DNI = 1; |
342 |
|
343 |
value = DNI * cos(sp.theta) * IAM * EndLoss * Eta_field * Eta_HCE * SFAvail; |
344 |
|
345 |
IAM = 1 + 0.000884 {1/rad} * (sp.theta / cos(sp.theta)) - 0.00005369 {1/rad^2} * (sp.theta / cos(sp.theta))^2; |
346 |
|
347 |
EndLoss * L = L - f*tan(sp.theta); |
348 |
|
349 |
Eta_field = TrkTwstErr * GeoAcc * MirRef * MirCln; (* Assuming all the collectors (in cases there are more than one) are identical. *) |
350 |
|
351 |
Eta_HCE = HCEdust * BelShad * EnvTrans * HCEabs * HCEmisc; |
352 |
|
353 |
|
354 |
METHODS |
355 |
METHOD specify; |
356 |
FIX kT; |
357 |
FIX f; |
358 |
FIX L; |
359 |
|
360 |
FIX TrkTwstErr; |
361 |
FIX GeoAcc; |
362 |
FIX MirRef; |
363 |
FIX MirCln; |
364 |
|
365 |
FIX HCEdust; |
366 |
FIX BelShad; |
367 |
FIX EnvTrans; |
368 |
FIX HCEabs; |
369 |
FIX HCEmisc; |
370 |
|
371 |
FIX SFAvail; |
372 |
|
373 |
RUN sp.specify; |
374 |
END specify; |
375 |
|
376 |
METHOD values; |
377 |
kT := 0.75; |
378 |
f := 1{cm}; |
379 |
L := 2{cm}; |
380 |
RUN sp.values; |
381 |
END values; |
382 |
|
383 |
METHOD on_load; |
384 |
RUN specify; |
385 |
RUN values; |
386 |
|
387 |
RUN sp.bound_self; |
388 |
RUN sp.default_self; |
389 |
END on_load; |
390 |
END S1; |
391 |
|
392 |
|
393 |
MODEL water_props( |
394 |
T WILL_BE temperature; |
395 |
); |
396 |
Cp IS_A specific_heat_capacity; |
397 |
Cp_dimless IS_A factor; |
398 |
|
399 |
rho IS_A mass_density; |
400 |
mu IS_A viscosity; |
401 |
k IS_A thermal_conductivity; |
402 |
|
403 |
T_dimless IS_A factor; |
404 |
|
405 |
|
406 |
T_dimless * 1{K} = T; |
407 |
Cp_dimless = 4.2204 - 4.2587e-3 + 1.3575e-4*T_dimless^2 - 1.8660e-6*T_dimless^3 + 1.3008e-8*T_dimless^4 - 4.2341e-11*T_dimless^5 + 5.2769e-14*T_dimless^6; |
408 |
|
409 |
Cp = Cp_dimless * 1{kJ/kg/K}; |
410 |
|
411 |
(* Cp = 7.573 {kJ/kg/K}; Cp is assumed constant temporarily *) |
412 |
(*h = 21 {kJ};*) |
413 |
|
414 |
rho = 1000 {kg/m^3}; |
415 |
mu = 0.152 {N*s/m^2}; |
416 |
k = 0.58 {watt/m/K}; |
417 |
|
418 |
p IS_A pressure; |
419 |
h IS_A specific_enthalpy; |
420 |
u IS_A specific_energy; |
421 |
|
422 |
|
423 |
conf IS_A helmholtz_conf; |
424 |
|
425 |
props1: helmholtz_p( |
426 |
T, rho : INPUT; |
427 |
p : OUTPUT; |
428 |
conf : DATA |
429 |
); |
430 |
|
431 |
props2: helmholtz_u( |
432 |
T, rho : INPUT; |
433 |
u : OUTPUT; |
434 |
conf : DATA |
435 |
); |
436 |
|
437 |
rho*(h - u) = p; |
438 |
|
439 |
METHODS |
440 |
METHOD bound_self; |
441 |
T_dimless.lower_bound := 0; |
442 |
T_dimless.upper_bound := 5000; |
443 |
END bound_self; |
444 |
END water_props; |
445 |
|
446 |
|
447 |
MODEL test_water_props; |
448 |
T IS_A temperature; |
449 |
wp IS_A water_props(T); |
450 |
|
451 |
METHODS |
452 |
METHOD on_load; |
453 |
FIX T; |
454 |
T := 40 {K} + 273.15 {K}; |
455 |
RUN wp.bound_self; |
456 |
END on_load; |
457 |
END test_water_props; |
458 |
|
459 |
|
460 |
MODEL h_fi( |
461 |
Di WILL_BE distance; |
462 |
V_f WILL_BE speed; (* Velocity of fluid in the tube *) |
463 |
wp_f WILL_BE water_props; (* Density of the fluid at T_f *) |
464 |
L WILL_BE distance; (* length of receiver tube (Input) *) |
465 |
Tc WILL_BE temperature; |
466 |
); |
467 |
(* Variables *) |
468 |
value IS_A heat_transfer_coefficient; |
469 |
Nu1 IS_A factor; |
470 |
Re1 IS_A factor; |
471 |
Pr IS_A factor; |
472 |
wp_Tc IS_A water_props(Tc); |
473 |
|
474 |
|
475 |
(* Equations *) |
476 |
|
477 |
value = Nu1 * wp_f.k / Di; |
478 |
|
479 |
(* For Re1 less than 10000 *) |
480 |
Nu1 = 1.86/((Re1*Pr)^(2/3)) * ((Di/L)^(1/3)) * ((wp_f.mu/wp_Tc.mu)^0.14); |
481 |
(* For Re more than 10000, Nu1 = 0.023*Re^0.8*Pr^0.4 *) |
482 |
|
483 |
Re1 = wp_f.rho * V_f * Di / wp_f.mu; (* Reynolds Number inside the tube *) |
484 |
Pr = wp_f.Cp * wp_f.mu / wp_f.k; (* Prandtl Number *) |
485 |
|
486 |
END h_fi; |
487 |
|
488 |
|
489 |
MODEL Cylindrical_Absorber; |
490 |
(* constants *) |
491 |
e IS_A real_constant; |
492 |
e :== 2.718; |
493 |
|
494 |
|
495 |
(* Variables *) |
496 |
T_in IS_A temperature; |
497 |
V_f IS_A speed; (* Velocity of fluid in the tube *) |
498 |
L IS_A distance; (* length of receiver tube (Input) *) |
499 |
W IS_A distance; (* Width of aparture *) |
500 |
N IS_A factor; (* Number of solar collector assemblies *) |
501 |
Do IS_A distance; (* Outer diameter of the receiver tube (Input) *) |
502 |
Di IS_A distance; (* Inner diameter of the receiver tube (Input) *) |
503 |
k_tube IS_A thermal_conductivity; (* thermal conductivity of the tube material *) |
504 |
|
505 |
Ul_instance IS_A Ul; |
506 |
S1_instance IS_A S1; |
507 |
wp_in IS_A water_props(T_in); |
508 |
wp_f IS_A water_props(T_f); |
509 |
h_fi_instance IS_A h_fi (Di, V_f, wp_f, L, Ul_instance.Tc); (* Heat transfer coefficient inside the tube *) |
510 |
|
511 |
Qu IS_A intensity; |
512 |
T_out IS_A temperature; |
513 |
T_f IS_A temperature; |
514 |
FR IS_A factor; |
515 |
F_dash IS_A factor; |
516 |
m_dot IS_A mass_rate; |
517 |
delta_h IS_A specific_enthalpy; (* delta_enthalpy; Change in enthalpy *) |
518 |
Vdot_f IS_A volume_rate; |
519 |
power IS_A factor; |
520 |
|
521 |
(* Equations *) |
522 |
Qu * Ul_instance.Aa + FR * Ul_instance.Aa * Ul_instance.Ar * Ul_instance.value * (T_in - Ul_instance.T_amb) = Ul_instance.Aa * S1_instance.value * Ul_instance.Aa; |
523 |
T_f * 2 = (T_in + T_out); |
524 |
FR * (Ul_instance.Ar * Ul_instance.value) = (m_dot * wp_f.Cp) * (1 - e^power); |
525 |
power = -1 * Ul_instance.Ar * Ul_instance.value * F_dash / m_dot * wp_f.Cp; |
526 |
F_dash * ( (h_fi_instance.value*Di) + (Do*Ul_instance.value) + (h_fi_instance.value*Di)*Ul_instance.value*(Do/2*k_tube)*ln(Do/Di)) = (h_fi_instance.value*Di); |
527 |
m_dot * 4 = wp_f.rho * (3.14 * Di^2) * V_f; |
528 |
delta_h = wp_f.h - wp_in.h; |
529 |
delta_h * (Vdot_f * wp_in.rho) = Qu * W * L * N; |
530 |
Vdot_f = 3.14 * Di^2 / 4; |
531 |
|
532 |
|
533 |
METHODS |
534 |
METHOD specify; |
535 |
FIX T_in; |
536 |
FIX V_f; |
537 |
FIX L; |
538 |
FIX W; |
539 |
FIX N; |
540 |
FIX Do; |
541 |
FIX Di; |
542 |
FIX k_tube; |
543 |
|
544 |
RUN Ul_instance.specify; |
545 |
RUN S1_instance.specify; |
546 |
RUN wp_in.specify; |
547 |
RUN wp_f.specify; |
548 |
RUN h_fi_instance.specify; |
549 |
END specify; |
550 |
|
551 |
METHOD bound_self; |
552 |
power.lower_bound := -100; |
553 |
power.upper_bound := 100; |
554 |
|
555 |
FR.upper_bound := 10000; |
556 |
|
557 |
RUN wp_in.bound_self; |
558 |
RUN wp_f.bound_self; |
559 |
END bound_self; |
560 |
|
561 |
METHOD other; |
562 |
RUN bound_self; |
563 |
RUN S1_instance.sp.bound_self; |
564 |
RUN S1_instance.sp.default_self; |
565 |
|
566 |
RUN Ul_instance.values; |
567 |
RUN S1_instance.values; |
568 |
RUN wp_in.values; |
569 |
RUN wp_f.values; |
570 |
RUN h_fi_instance.values; |
571 |
END other; |
572 |
|
573 |
(* |
574 |
METHOD on_load; |
575 |
RUN specify; |
576 |
RUN other; |
577 |
|
578 |
SOLVER QRSlv; |
579 |
OPTION convopt 'RELNOM_SCALE'; |
580 |
END on_load; |
581 |
*) |
582 |
END Cylindrical_Absorber; |
583 |
|
584 |
|
585 |
MODEL example_Cylindrical_Absorber REFINES Cylindrical_Absorber; |
586 |
|
587 |
METHODS |
588 |
METHOD values; |
589 |
T_in := 10 {K} + 273.15 {K};(* Inlet temperature of water *) |
590 |
V_f := 0.5 {m/s}; (* Velocity of fluid in the tube *) |
591 |
L := 10 {m}; (* length of receiver tube (Input) *) |
592 |
W := 2.5 {m}; (* Width of aparture *) |
593 |
N := 1; (* Number of solar collector assemblies *) |
594 |
Do := 0.06 {m}; (* Outer diameter of the receiver tube (Input) *) |
595 |
Di := 0.055 {m}; (* Inner diameter of the receiver tube (Input) *) |
596 |
k_tube := 16 {watt/m/K}; (* thermal conductivity of the tube material *) |
597 |
END values; |
598 |
|
599 |
METHOD on_load; |
600 |
RUN Cylindrical_Absorber::specify; |
601 |
RUN Cylindrical_Absorber::other; |
602 |
RUN values; |
603 |
|
604 |
SOLVER QRSlv; |
605 |
OPTION convopt 'RELNOM_SCALE'; |
606 |
END on_load; |
607 |
END example_Cylindrical_Absorber; |