1 |
#!/bin/csh -f |
2 |
# RCSid: $Id$ |
3 |
# |
4 |
# Complex glazing model (goes with glaze1.cal and glaze2.cal) |
5 |
# |
6 |
# Oct. 2002 Greg Ward |
7 |
# |
8 |
|
9 |
################################################################# |
10 |
# |
11 |
# Supported surface types: |
12 |
# |
13 |
set sn_arr=("clear glass" "VE1-2M low-E coating" "PVB laminated" "V-175 white frit" "V-933 warm gray frit") |
14 |
# Glass-side hemispherical reflectances for each surface type: |
15 |
set rg_r_arr=(0.074 0.065 .11 0.33 0.15) |
16 |
set rg_g_arr=(0.077 0.058 .11 0.33 0.15) |
17 |
set rg_b_arr=(0.079 0.067 .11 0.33 0.15) |
18 |
# Coating-side hemispherical reflectance for each surface type: |
19 |
set rc_r_arr=(0.074 0.042 .11 0.59 0.21) |
20 |
set rc_g_arr=(0.077 0.049 .11 0.59 0.21) |
21 |
set rc_b_arr=(0.079 0.043 .11 0.59 0.21) |
22 |
# Hemispherical (normal) transmittance for each surface type: |
23 |
set tn_r_arr=(0.862 0.756 0.63 0.21 0.09) |
24 |
set tn_g_arr=(0.890 0.808 0.63 0.21 0.09) |
25 |
set tn_b_arr=(0.886 0.744 0.63 0.21 0.09) |
26 |
# Boolean whether coatings can have partial coverage: |
27 |
set part_arr=(0 0 0 1 1) |
28 |
|
29 |
################################################################# |
30 |
# |
31 |
# Get user input |
32 |
# |
33 |
echo -n "Enter the number of panes in the system: " |
34 |
set np="$<" |
35 |
if ($np != 1 && $np != 2) then |
36 |
echo "Must be 1 or 2 pane system" |
37 |
exit 1 |
38 |
endif |
39 |
echo "" |
40 |
echo "Window normal faces interior" |
41 |
echo "" |
42 |
if ($np == 1) then |
43 |
echo " | |" |
44 |
echo " | |" |
45 |
echo " | |" |
46 |
echo " | |-->" |
47 |
echo " | |" |
48 |
echo " | |" |
49 |
echo " | |" |
50 |
echo " s1 s2" |
51 |
else |
52 |
echo " | | | |" |
53 |
echo " | | | |" |
54 |
echo " | | | |" |
55 |
echo " | | | |-->" |
56 |
echo " | | | |" |
57 |
echo " | | | |" |
58 |
echo " | | | |" |
59 |
echo " s1 s2 s3 s4" |
60 |
endif |
61 |
echo "" |
62 |
echo "Supported surface types are:" |
63 |
set i=1 |
64 |
while ($i <= $#sn_arr) |
65 |
echo " " $i - $sn_arr[$i] |
66 |
@ i++ |
67 |
end |
68 |
echo "" |
69 |
echo -n "What is the type of s1? " |
70 |
set s1t="$<" |
71 |
echo -n "What is the type of s2? " |
72 |
set s2t="$<" |
73 |
if ($s1t != 1 && $s2t != 1) then |
74 |
echo "One surface of each pane must be $sn_arr[1]" |
75 |
exit 1 |
76 |
endif |
77 |
if ($part_arr[$s1t]) then |
78 |
echo -n "Enter fraction coverage for s1 (0-1): " |
79 |
set s1c="$<" |
80 |
endif |
81 |
if ($part_arr[$s2t]) then |
82 |
echo -n "Enter fraction coverage for s2 (0-1): " |
83 |
set s2c="$<" |
84 |
endif |
85 |
if ($np == 2) then |
86 |
echo -n "What is the type of s3? " |
87 |
set s3t="$<" |
88 |
echo -n "What is the type of s4? " |
89 |
set s4t="$<" |
90 |
if ($s3t != 1 && $s4t != 1) then |
91 |
echo "One surface of each pane must be $sn_arr[1]" |
92 |
exit 1 |
93 |
endif |
94 |
if ($part_arr[$s3t]) then |
95 |
echo -n "Enter fraction coverage for s3 (0-1): " |
96 |
set s3c="$<" |
97 |
endif |
98 |
if ($part_arr[$s4t]) then |
99 |
echo -n "Enter fraction coverage for s4 (0-1): " |
100 |
set s4c="$<" |
101 |
endif |
102 |
endif |
103 |
|
104 |
################################################################# |
105 |
# |
106 |
# Begin material comments |
107 |
# |
108 |
echo "" |
109 |
echo "############################################" |
110 |
echo "# Glazing produced by Radiance glaze script" |
111 |
echo "# `date`" |
112 |
echo "# Material surface normal points to interior" |
113 |
echo "# Number of panes in system: $np" |
114 |
|
115 |
if ($np == 2) goto glaze2 |
116 |
################################################################# |
117 |
# |
118 |
# Compute single glazing |
119 |
# |
120 |
set sc=1 |
121 |
echo "# Exterior surface s1 type: $sn_arr[$s1t]" |
122 |
if ($?s1c) then |
123 |
echo "# s1 coating coverage: $s1c" |
124 |
set sc=$s1c |
125 |
endif |
126 |
echo "# Interior surface s2 type: $sn_arr[$s2t]" |
127 |
if ($?s2c) then |
128 |
echo "# s2 coating coverage: $s2c" |
129 |
set sc=$s2c |
130 |
endif |
131 |
if ($s1t != 1) then |
132 |
set ct=$s1t |
133 |
echo -n "# Exterior normal hemispherical reflectance: " |
134 |
ev ".265*($sc*$rc_r_arr[$ct]+(1-$sc)*$rc_r_arr[1])+.670*($sc*$rc_g_arr[$ct]+(1-$sc)*$rc_g_arr[1])+.065*($sc*$rc_b_arr[$ct]+(1-$sc)*$rc_b_arr[1])" |
135 |
echo -n "# Interior normal hemispherical reflectance: " |
136 |
ev ".265*($sc*$rg_r_arr[$ct]+(1-$sc)*$rg_r_arr[1])+.670*($sc*$rg_g_arr[$ct]+(1-$sc)*$rg_g_arr[1])+.065*($sc*$rg_b_arr[$ct]+(1-$sc)*$rg_b_arr[1])" |
137 |
else |
138 |
set ct=$s2t |
139 |
echo -n "# Exterior normal hemispherical reflectance: " |
140 |
ev ".265*($sc*$rg_r_arr[$ct]+(1-$sc)*$rg_r_arr[1])+.670*($sc*$rg_g_arr[$ct]+(1-$sc)*$rg_g_arr[1])+.065*($sc*$rg_b_arr[$ct]+(1-$sc)*$rg_b_arr[1])" |
141 |
echo -n "# Interior normal hemispherical reflectance: " |
142 |
ev ".265*($sc*$rc_r_arr[$ct]+(1-$sc)*$rc_r_arr[1])+.670*($sc*$rc_g_arr[$ct]+(1-$sc)*$rc_g_arr[1])+.065*($sc*$rc_b_arr[$ct]+(1-$sc)*$rc_b_arr[1])" |
143 |
endif |
144 |
echo -n "# Normal hemispherical transmittance: " |
145 |
ev ".265*($sc*$tn_r_arr[$ct]+(1-$sc)*$tn_r_arr[1])+.670*($sc*$tn_g_arr[$ct]+(1-$sc)*$tn_g_arr[1])+.065*($sc*$tn_b_arr[$ct]+(1-$sc)*$tn_b_arr[1])" |
146 |
echo "#" |
147 |
echo "void BRTDfunc glaze1_unnamed" |
148 |
if ($part_arr[$s1t] || $part_arr[$s2t]) then |
149 |
### Frit glazing |
150 |
echo "10" |
151 |
echo " sr_frit_r sr_frit_g sr_frit_b" |
152 |
echo " st_frit_r st_frit_g st_frit_b" |
153 |
echo " 0 0 0" |
154 |
echo " glaze1.cal" |
155 |
echo "0" |
156 |
echo "11" |
157 |
if ($s2t == 1) then |
158 |
ev "$s1c*($rg_r_arr[$s1t]-$rg_r_arr[1])" \ |
159 |
"$s1c*($rg_g_arr[$s1t]-$rg_g_arr[1])" \ |
160 |
"$s1c*($rg_b_arr[$s1t]-$rg_b_arr[1])" |
161 |
ev "$s1c*$rc_r_arr[$s1t]" "$s1c*$rc_g_arr[$s1t]" "$s1c*$rc_b_arr[$s1t]" |
162 |
ev "$s1c*$tn_r_arr[$s1t]" "$s1c*$tn_g_arr[$s1t]" "$s1c*$tn_b_arr[$s1t]" |
163 |
echo " 1 $s1c" |
164 |
else |
165 |
ev "$s2c*$rc_r_arr[$s2t]" "$s2c*$rc_g_arr[$s2t]" "$s2c*$rc_b_arr[$s2t]" |
166 |
ev "$s2c*($rg_r_arr[$s2t]-$rg_r_arr[1])" \ |
167 |
"$s2c*($rg_g_arr[$s2t]-$rg_g_arr[1])" \ |
168 |
"$s2c*($rg_b_arr[$s2t]-$rg_b_arr[1])" |
169 |
ev "$s2c*$tn_r_arr[$s2t]" "$s2c*$tn_g_arr[$s2t]" "$s2c*$tn_b_arr[$s2t]" |
170 |
echo " -1 $s2c" |
171 |
endif |
172 |
else |
173 |
### Low-E glazing |
174 |
echo "10" |
175 |
echo " sr_lowE_r sr_lowE_g sr_lowE_b" |
176 |
echo " st_lowE_r st_lowE_g st_lowE_b" |
177 |
echo " 0 0 0" |
178 |
echo " glaze1.cal" |
179 |
echo "0" |
180 |
echo "19" |
181 |
echo " 0 0 0" |
182 |
echo " 0 0 0" |
183 |
echo " 0 0 0" |
184 |
if ($s2t == 1) then |
185 |
echo " 1" |
186 |
set st=$s1t |
187 |
else |
188 |
echo " -1" |
189 |
set st=$s2t |
190 |
endif |
191 |
echo " $rg_r_arr[$st] $rg_g_arr[$st] $rg_b_arr[$st]" |
192 |
echo " $rc_r_arr[$st] $rc_g_arr[$st] $rc_b_arr[$st]" |
193 |
echo " $tn_r_arr[$st] $tn_g_arr[$st] $tn_b_arr[$st]" |
194 |
endif |
195 |
echo "" |
196 |
exit 0 |
197 |
|
198 |
glaze2: |
199 |
################################################################# |
200 |
# |
201 |
# Compute double glazing |
202 |
# |
203 |
if ($s2t != 1) then |
204 |
set s2r_rgb=($rc_r_arr[$s2t] $rc_g_arr[$s2t] $rc_b_arr[$s2t]) |
205 |
set s1r_rgb=($rg_r_arr[$s2t] $rg_g_arr[$s2t] $rg_b_arr[$s2t]) |
206 |
set s12t_rgb=($tn_r_arr[$s2t] $tn_g_arr[$s2t] $tn_b_arr[$s2t]) |
207 |
else |
208 |
set s2r_rgb=($rg_r_arr[$s1t] $rg_g_arr[$s1t] $rg_b_arr[$s1t]) |
209 |
set s1r_rgb=($rc_r_arr[$s1t] $rc_g_arr[$s1t] $rc_b_arr[$s1t]) |
210 |
set s12t_rgb=($tn_r_arr[$s1t] $tn_g_arr[$s1t] $tn_b_arr[$s1t]) |
211 |
endif |
212 |
if ($s4t != 1) then |
213 |
set s4r_rgb=($rc_r_arr[$s4t] $rc_g_arr[$s4t] $rc_b_arr[$s4t]) |
214 |
set s3r_rgb=($rg_r_arr[$s4t] $rg_g_arr[$s4t] $rg_b_arr[$s4t]) |
215 |
set s34t_rgb=($tn_r_arr[$s4t] $tn_g_arr[$s4t] $tn_b_arr[$s4t]) |
216 |
else |
217 |
set s4r_rgb=($rg_r_arr[$s3t] $rg_g_arr[$s3t] $rg_b_arr[$s3t]) |
218 |
set s3r_rgb=($rc_r_arr[$s3t] $rc_g_arr[$s3t] $rc_b_arr[$s3t]) |
219 |
set s34t_rgb=($tn_r_arr[$s3t] $tn_g_arr[$s3t] $tn_b_arr[$s3t]) |
220 |
endif |
221 |
set s12c=1 |
222 |
echo "# Exterior surface s1 type: $sn_arr[$s1t]" |
223 |
if ($?s1c) then |
224 |
echo "# s1 coating coverage: $s1c" |
225 |
set s12c=$s1c |
226 |
endif |
227 |
echo "# Inner surface s2 type: $sn_arr[$s2t]" |
228 |
if ($?s2c) then |
229 |
echo "# s2 coating coverage: $s2c" |
230 |
set s12c=$s2c |
231 |
endif |
232 |
set s34c=1 |
233 |
echo "# Inner surface s3 type: $sn_arr[$s3t]" |
234 |
if ($?s3c) then |
235 |
echo "# s3 coating coverage: $s3c" |
236 |
set s34c=$s3c |
237 |
endif |
238 |
echo "# Interior surface s4 type: $sn_arr[$s4t]" |
239 |
if ($?s4c) then |
240 |
echo "# s4 coating coverage: $s4c" |
241 |
set s34c=$s4c |
242 |
endif |
243 |
# Approximate reflectance and transmittance for comment using gray values |
244 |
set rglass=`ev ".265*$rg_r_arr[1]+.670*$rg_g_arr[1]+.065*$rg_b_arr[1]"` |
245 |
set tglass=`ev ".265*$tn_r_arr[1]+.670*$tn_g_arr[1]+.065*$tn_b_arr[1]"` |
246 |
set s1r_gry=`ev "$s12c*(.265*$s1r_rgb[1]+.670*$s1r_rgb[2]+.065*$s1r_rgb[3])+(1-$s12c)*$rglass"` |
247 |
set s2r_gry=`ev "$s12c*(.265*$s2r_rgb[1]+.670*$s2r_rgb[2]+.065*$s2r_rgb[3])+(1-$s12c)*$rglass"` |
248 |
set s12t_gry=`ev "$s12c*(.265*$s12t_rgb[1]+.670*$s12t_rgb[2]+.065*$s12t_rgb[3])+(1-$s12c)*$tglass"` |
249 |
set s3r_gry=`ev "$s34c*(.265*$s3r_rgb[1]+.670*$s3r_rgb[2]+.065*$s3r_rgb[3])+(1-$s34c)*$rglass"` |
250 |
set s4r_gry=`ev "$s34c*(.265*$s4r_rgb[1]+.670*$s4r_rgb[2]+.065*$s4r_rgb[3])+(1-$s34c)*$rglass"` |
251 |
set s34t_gry=`ev "$s34c*(.265*$s34t_rgb[1]+.670*$s34t_rgb[2]+.065*$s34t_rgb[3])+(1-$s34c)*$tglass"` |
252 |
echo -n "# Exterior normal hemispherical reflectance: " |
253 |
ev "$s1r_gry + $s12t_gry^2*$s3r_gry" |
254 |
echo -n "# Interior normal hemispherical reflectance: " |
255 |
ev "$s4r_gry + $s34t_gry^2*$s2r_gry" |
256 |
echo -n "# Normal hemispherical transmittance: " |
257 |
ev "$s12t_gry*$s34t_gry" |
258 |
echo "#" |
259 |
echo "void BRTDfunc glaze2_unnamed" |
260 |
|
261 |
if ($part_arr[$s3t] || $part_arr[$s4t]) then |
262 |
### Front pane has frit |
263 |
if ($part_arr[$s1t] || $part_arr[$s2t]) then |
264 |
echo "Only one pane can have frit" |
265 |
exit 1 |
266 |
endif |
267 |
if ($?s3c) then |
268 |
set sc=$s3c |
269 |
set s3g=`ev "1-$s3c"` |
270 |
else |
271 |
set s3c=0 |
272 |
set s3g=1 |
273 |
endif |
274 |
if ($?s4c) then |
275 |
set sc=$s4c |
276 |
set s4g=`ev "1-$s4c"` |
277 |
else |
278 |
set s4c=0 |
279 |
set s4g=1 |
280 |
endif |
281 |
echo "10" |
282 |
echo "if(Rdot,cr($s4g*rclr,$s3g*$s4g*tclr,fr($s2r_rgb[1])),cr(fr($s1r_rgb[1]),ft($s12t_rgb[1]),$s3g*rclr))" |
283 |
echo "if(Rdot,cr($s4g*rclr,$s3g*$s4g*tclr,fr($s2r_rgb[2])),cr(fr($s1r_rgb[2]),ft($s12t_rgb[2]),$s3g*rclr))" |
284 |
echo "if(Rdot,cr($s4g*rclr,$s3g*$s4g*tclr,fr($s2r_rgb[3])),cr(fr($s1r_rgb[3]),ft($s12t_rgb[3]),$s3g*rclr))" |
285 |
echo "$s3g*$s4g*ft($s12t_rgb[1])*tclr" |
286 |
echo "$s3g*$s4g*ft($s12t_rgb[2])*tclr" |
287 |
echo "$s3g*$s4g*ft($s12t_rgb[3])*tclr" |
288 |
echo " 0 0 0" |
289 |
echo " glaze2.cal" |
290 |
echo "0" |
291 |
echo "9" |
292 |
ev "$sc*$s4r_rgb[1]-$s3c*$rg_r_arr[1]" \ |
293 |
"$sc*$s4r_rgb[2]-$s3c*$rg_g_arr[1]" \ |
294 |
"$sc*$s4r_rgb[3]-$s3c*$rg_b_arr[1]" |
295 |
ev "$s12t_rgb[1]^2*($sc*$s3r_rgb[1]-$s4c*$rg_r_arr[1])" \ |
296 |
"$s12t_rgb[2]^2*($sc*$s3r_rgb[2]-$s4c*$rg_g_arr[1])" \ |
297 |
"$s12t_rgb[3]^2*($sc*$s3r_rgb[3]-$s4c*$rg_b_arr[1])" |
298 |
ev "$sc*$s12t_rgb[1]*$s34t_rgb[1]" \ |
299 |
"$sc*$s12t_rgb[2]*$s34t_rgb[2]" \ |
300 |
"$sc*$s12t_rgb[3]*$s34t_rgb[3]" |
301 |
else if ($part_arr[$s1t] || $part_arr[$s2t]) then |
302 |
### Back pane has frit |
303 |
if ($?s1c) then |
304 |
set sc=$s1c |
305 |
set s1g=`ev "1-$s1c"` |
306 |
else |
307 |
set s1c=0 |
308 |
set s1g=1 |
309 |
endif |
310 |
if ($?s2c) then |
311 |
set sc=$s2c |
312 |
set s2g=`ev "1-$s2c"` |
313 |
else |
314 |
set s2c=0 |
315 |
set s2g=1 |
316 |
endif |
317 |
echo "10" |
318 |
echo "if(Rdot,cr(fr($s4r_rgb[1]),ft($s34t_rgb[1]),$s2g*rclr),cr($s1g*rclr,$s1g*$s2g*tclr,fr($s3r_rgb[1])))" |
319 |
echo "if(Rdot,cr(fr($s4r_rgb[2]),ft($s34t_rgb[2]),$s2g*rclr),cr($s1g*rclr,$s1g*$s2g*tclr,fr($s3r_rgb[2])))" |
320 |
echo "if(Rdot,cr(fr($s4r_rgb[3]),ft($s34t_rgb[3]),$s2g*rclr),cr($s1g*rclr,$s1g*$s2g*tclr,fr($s3r_rgb[3])))" |
321 |
echo "$s1g*$s2g*ft($s34t_rgb[1])*tclr" |
322 |
echo "$s1g*$s2g*ft($s34t_rgb[2])*tclr" |
323 |
echo "$s1g*$s2g*ft($s34t_rgb[3])*tclr" |
324 |
echo " 0 0 0" |
325 |
echo " glaze2.cal" |
326 |
echo "0" |
327 |
echo "9" |
328 |
ev "$s34t_rgb[1]^2*($sc*$s2r_rgb[1]-$s1c*$rg_r_arr[1])" \ |
329 |
"$s34t_rgb[2]^2*($sc*$s2r_rgb[2]-$s1c*$rg_g_arr[1])" \ |
330 |
"$s34t_rgb[3]^2*($sc*$s2r_rgb[3]-$s1c*$rg_b_arr[1])" |
331 |
ev "$sc*$s1r_rgb[1]-$s2c*$rg_r_arr[1]" \ |
332 |
"$sc*$s1r_rgb[2]-$s2c*$rg_g_arr[1]" \ |
333 |
"$sc*$s1r_rgb[3]-$s2c*$rg_b_arr[1]" |
334 |
ev "$sc*$s34t_rgb[1]*$s12t_rgb[1]" \ |
335 |
"$sc*$s34t_rgb[2]*$s12t_rgb[2]" \ |
336 |
"$sc*$s34t_rgb[3]*$s12t_rgb[3]" |
337 |
else |
338 |
### Low-E and regular glazing only |
339 |
echo "10" |
340 |
echo "if(Rdot,cr(fr($s4r_rgb[1]),ft($s34t_rgb[1]),fr($s2r_rgb[1])),cr(fr($s1r_rgb[1]),ft($s12t_rgb[1]),fr($s3r_rgb[1])))" |
341 |
echo "if(Rdot,cr(fr($s4r_rgb[2]),ft($s34t_rgb[2]),fr($s2r_rgb[2])),cr(fr($s1r_rgb[2]),ft($s12t_rgb[2]),fr($s3r_rgb[2])))" |
342 |
echo "if(Rdot,cr(fr($s4r_rgb[3]),ft($s34t_rgb[3]),fr($s2r_rgb[3])),cr(fr($s1r_rgb[3]),ft($s12t_rgb[3]),fr($s3r_rgb[3])))" |
343 |
echo "ft($s34t_rgb[1])*ft($s12t_rgb[1])" |
344 |
echo "ft($s34t_rgb[2])*ft($s12t_rgb[2])" |
345 |
echo "ft($s34t_rgb[3])*ft($s12t_rgb[3])" |
346 |
echo " 0 0 0" |
347 |
echo " glaze2.cal" |
348 |
echo "0" |
349 |
echo "9" |
350 |
echo " 0 0 0" |
351 |
echo " 0 0 0" |
352 |
echo " 0 0 0" |
353 |
endif |
354 |
echo "" |
355 |
exit 0 |