orig/glaze.csh
author Axel Jacobs <axel@jaloxa.eu>
Mon, 14 Apr 2014 22:21:17 +0100
changeset 73 87fa3132a136
parent 0 0aa115157c9c
permissions -rw-r--r--
New IES test file with spaces in file name
axel@0
     1
#!/bin/csh -f
axel@0
     2
# RCSid: $Id: glaze.csh,v 2.8 2009/11/05 19:00:50 greg Exp $
axel@0
     3
#
axel@0
     4
# Complex glazing model (goes with glaze1.cal and glaze2.cal)
axel@0
     5
#
axel@0
     6
# Oct. 2002 Greg Ward
axel@0
     7
# Aug. 2004 GW (added -f option to read glazings from file)
axel@0
     8
# Funding for this development generously provided by Visarc, Inc.
axel@0
     9
# (http://www.visarc.com)
axel@0
    10
#
axel@0
    11
# Nov. 2009 Jack de Valpine - Visarc, Inc.
axel@0
    12
#     -f option now clears the internal demo database and accepts
axel@0
    13
#        a clear glass definition as the first entry
axel@0
    14
#        in the database file
axel@0
    15
#         
axel@0
    16
axel@0
    17
#################################################################
axel@0
    18
#
axel@0
    19
# The general assumption is that one surface is uncoated, and
axel@0
    20
# reflectances and transmittances are computed from this fact.
axel@0
    21
# If the user tries to enter two coated surfaces on the same
axel@0
    22
# pane, the script complains and exits.
axel@0
    23
#
axel@0
    24
# Supported surface types (clear glass prepended below):
axel@0
    25
#
axel@0
    26
set sn_arr=("VE1-2M low-E coating" "PVB laminated" "V-175 white frit" "V-933 warm gray frit")
axel@0
    27
# Glass-side hemispherical reflectances for each surface type:
axel@0
    28
set rg_r_arr=(0.065 .11 0.33 0.15)
axel@0
    29
set rg_g_arr=(0.058 .11 0.33 0.15)
axel@0
    30
set rg_b_arr=(0.067 .11 0.33 0.15)
axel@0
    31
# Coating-side hemispherical reflectance for each surface type:
axel@0
    32
set rc_r_arr=(0.042 .11 0.59 0.21)
axel@0
    33
set rc_g_arr=(0.049 .11 0.59 0.21)
axel@0
    34
set rc_b_arr=(0.043 .11 0.59 0.21)
axel@0
    35
# Hemispherical (normal) transmittance for each surface type:
axel@0
    36
set tn_r_arr=(0.756 0.63 0.21 0.09)
axel@0
    37
set tn_g_arr=(0.808 0.63 0.21 0.09)
axel@0
    38
set tn_b_arr=(0.744 0.63 0.21 0.09)
axel@0
    39
# Boolean whether coatings can have partial coverage:
axel@0
    40
set part_arr=(0 0 1 1)
axel@0
    41
axel@0
    42
set gfiles=()
axel@0
    43
while ($#argv > 0)
axel@0
    44
	set header="Surface	Tr	Tg	Tb	Rcr	Rcg	Rcb	Rgr	Rgg	Rgb	Part"
axel@0
    45
	if ($#argv < 2 || "$argv[1]" != '-f') then
axel@0
    46
		echo "Usage: $0 [-f glazing.dat ..]"
axel@0
    47
		exit 1
axel@0
    48
	endif
axel@0
    49
	shift argv
axel@0
    50
	# Clear internal default database
axel@0
    51
	set sn_arr=()
axel@0
    52
	set rg_r_arr=() ; set rg_g_arr=() ; set rg_b_arr=()
axel@0
    53
	set rc_r_arr=() ; set rc_g_arr=() ; set rc_b_arr=()
axel@0
    54
	set tn_r_arr=() ; set tn_g_arr=() ; set tn_b_arr=()
axel@0
    55
	set part_arr=()
axel@0
    56
	set gf="$argv[1]"
axel@0
    57
	shift argv
axel@0
    58
	set gfiles=($gfiles:q $gf:q)
axel@0
    59
	if ("`sed -n 1p $gf:q`" != "$header") then
axel@0
    60
		echo "Bad header in $gf -- Expected: $header"
axel@0
    61
		exit 1
axel@0
    62
	endif
axel@0
    63
	echo "Adding glazing types from file $gf :"
axel@0
    64
	set nl=`wc -l < $gf:q`
axel@0
    65
	@ i=2
axel@0
    66
	while ($i <= $nl)
axel@0
    67
		set ln=(`sed -n ${i}p $gf:q`)
axel@0
    68
		if ($#ln != 11) then
axel@0
    69
			echo "Expected 11 words in line: $ln"
axel@0
    70
			exit 1
axel@0
    71
		endif
axel@0
    72
		echo $ln[1]
axel@0
    73
		set sn_arr=($sn_arr:q $ln[1])
axel@0
    74
		set tn_r_arr=($tn_r_arr $ln[2])
axel@0
    75
		set tn_g_arr=($tn_g_arr $ln[3])
axel@0
    76
		set tn_b_arr=($tn_b_arr $ln[4])
axel@0
    77
		set rc_r_arr=($rc_r_arr $ln[5])
axel@0
    78
		set rc_g_arr=($rc_g_arr $ln[6])
axel@0
    79
		set rc_b_arr=($rc_b_arr $ln[7])
axel@0
    80
		set rg_r_arr=($rg_r_arr $ln[8])
axel@0
    81
		set rg_g_arr=($rg_g_arr $ln[9])
axel@0
    82
		set rg_b_arr=($rg_b_arr $ln[10])
axel@0
    83
		set part_arr=($part_arr $ln[11])
axel@0
    84
		@ i++
axel@0
    85
	end
axel@0
    86
end
axel@0
    87
if (! $#gfiles) then
axel@0
    88
	unset gfiles
axel@0
    89
	echo "###"
axel@0
    90
	echo "### NOTE: Using internal demo database!"
axel@0
    91
	echo "###"
axel@0
    92
	echo
axel@0
    93
endif
axel@0
    94
#
axel@0
    95
# Make sure we have a clear glazing definition
axel@0
    96
#
axel@0
    97
if (`rcalc -n -e 'ad(a,b)=if(a-b,a-b,b-a);$1=if('"ad($rg_r_arr[1],$rc_r_arr[1])+ad($rg_g_arr[1],$rc_g_arr[1])+ad($rg_b_arr[1],$rc_b_arr[1])-.005,1,0)"`) then
axel@0
    98
	set sn_arr=("clear glass" $sn_arr:q)
axel@0
    99
	set rg_r_arr=(0.074 $rg_r_arr)
axel@0
   100
	set rg_g_arr=(0.077 $rg_g_arr)
axel@0
   101
	set rg_b_arr=(0.079 $rg_b_arr)
axel@0
   102
	set rc_r_arr=(0.074 $rc_r_arr)
axel@0
   103
	set rc_g_arr=(0.077 $rc_g_arr)
axel@0
   104
	set rc_b_arr=(0.079 $rc_b_arr)
axel@0
   105
	set tn_r_arr=(0.862 $tn_r_arr)
axel@0
   106
	set tn_g_arr=(0.890 $tn_g_arr)
axel@0
   107
	set tn_b_arr=(0.886 $tn_b_arr)
axel@0
   108
	set part_arr=(0 $part_arr)
axel@0
   109
endif
axel@0
   110
axel@0
   111
#################################################################
axel@0
   112
#
axel@0
   113
# Get user input
axel@0
   114
#
axel@0
   115
echo -n "Enter the number of panes in the system: "
axel@0
   116
set np="$<"
axel@0
   117
if ($np != 1 && $np != 2) then
axel@0
   118
	echo "Must be 1 or 2 pane system"
axel@0
   119
	exit 1
axel@0
   120
endif
axel@0
   121
echo ""
axel@0
   122
echo "Window normal faces interior"
axel@0
   123
echo ""
axel@0
   124
if ($np == 1) then
axel@0
   125
echo "  | |"
axel@0
   126
echo "  | |"
axel@0
   127
echo "  | |"
axel@0
   128
echo "  | |-->"
axel@0
   129
echo "  | |"
axel@0
   130
echo "  | |"
axel@0
   131
echo "  | |"
axel@0
   132
echo " s1 s2"
axel@0
   133
else
axel@0
   134
echo "  | |    | |"
axel@0
   135
echo "  | |    | |"
axel@0
   136
echo "  | |    | |"
axel@0
   137
echo "  | |    | |-->"
axel@0
   138
echo "  | |    | |"
axel@0
   139
echo "  | |    | |"
axel@0
   140
echo "  | |    | |"
axel@0
   141
echo " s1 s2  s3 s4"
axel@0
   142
endif
axel@0
   143
echo ""
axel@0
   144
echo "Supported surface types are:"
axel@0
   145
set i=1
axel@0
   146
while ($i <= $#sn_arr)
axel@0
   147
	echo "  " $i - $sn_arr[$i]
axel@0
   148
	@ i++
axel@0
   149
end
axel@0
   150
echo ""
axel@0
   151
echo -n "What is the type of s1? "
axel@0
   152
set s1t="$<"
axel@0
   153
echo -n "What is the type of s2? "
axel@0
   154
set s2t="$<"
axel@0
   155
if ($s1t != 1 && $s2t != 1) then
axel@0
   156
	echo "One surface of each pane must be $sn_arr[1]"
axel@0
   157
	exit 1
axel@0
   158
endif
axel@0
   159
if ($part_arr[$s1t]) then
axel@0
   160
	echo -n "Enter fraction coverage for s1 (0-1): "
axel@0
   161
	set s1c="$<"
axel@0
   162
endif
axel@0
   163
if ($part_arr[$s2t]) then
axel@0
   164
	echo -n "Enter fraction coverage for s2 (0-1): "
axel@0
   165
	set s2c="$<"
axel@0
   166
endif
axel@0
   167
if ($np == 2) then
axel@0
   168
echo -n "What is the type of s3? "
axel@0
   169
set s3t="$<"
axel@0
   170
echo -n "What is the type of s4? "
axel@0
   171
set s4t="$<"
axel@0
   172
if ($s3t != 1 && $s4t != 1) then
axel@0
   173
	echo "One surface of each pane must be $sn_arr[1]"
axel@0
   174
	exit 1
axel@0
   175
endif
axel@0
   176
if ($part_arr[$s3t]) then
axel@0
   177
	echo -n "Enter fraction coverage for s3 (0-1): "
axel@0
   178
	set s3c="$<"
axel@0
   179
endif
axel@0
   180
if ($part_arr[$s4t]) then
axel@0
   181
	echo -n "Enter fraction coverage for s4 (0-1): "
axel@0
   182
	set s4c="$<"
axel@0
   183
endif
axel@0
   184
endif
axel@0
   185
axel@0
   186
#################################################################
axel@0
   187
#
axel@0
   188
# Begin material comments
axel@0
   189
#
axel@0
   190
echo ""
axel@0
   191
echo "############################################"
axel@0
   192
echo "# Glazing produced by Radiance glaze script"
axel@0
   193
echo '# $Revision: 2.8 $'
axel@0
   194
if ($?gfiles) then
axel@0
   195
	echo "# Loaded: $gfiles:q"
axel@0
   196
	echo -n "# " ; date
axel@0
   197
endif
axel@0
   198
echo "# Material surface normal points to interior"
axel@0
   199
echo "# Number of panes in system: $np"
axel@0
   200
axel@0
   201
if ($np == 2) goto glaze2
axel@0
   202
#################################################################
axel@0
   203
#
axel@0
   204
# Compute single glazing
axel@0
   205
#
axel@0
   206
set sc=1
axel@0
   207
echo "# Exterior surface s1 type: $sn_arr[$s1t]"
axel@0
   208
if ($?s1c) then
axel@0
   209
	echo "# s1 coating coverage: $s1c"
axel@0
   210
	set sc=$s1c
axel@0
   211
endif
axel@0
   212
echo "# Interior surface s2 type: $sn_arr[$s2t]"
axel@0
   213
if ($?s2c) then
axel@0
   214
	echo "# s2 coating coverage: $s2c"
axel@0
   215
	set sc=$s2c
axel@0
   216
endif
axel@0
   217
if ($s1t != 1) then
axel@0
   218
	set ct=$s1t
axel@0
   219
	echo -n "# Exterior normal hemispherical reflectance: "
axel@0
   220
	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])"
axel@0
   221
	echo -n "# Interior normal hemispherical reflectance: "
axel@0
   222
	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])"
axel@0
   223
else
axel@0
   224
	set ct=$s2t
axel@0
   225
	echo -n "# Exterior normal hemispherical reflectance: "
axel@0
   226
	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])"
axel@0
   227
	echo -n "# Interior normal hemispherical reflectance: "
axel@0
   228
	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])"
axel@0
   229
endif
axel@0
   230
echo -n "# Normal hemispherical transmittance: "
axel@0
   231
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])"
axel@0
   232
echo "#"
axel@0
   233
echo "void BRTDfunc glaze1_unnamed"
axel@0
   234
if ($part_arr[$s1t] || $part_arr[$s2t]) then
axel@0
   235
### Frit glazing
axel@0
   236
echo "10"
axel@0
   237
echo "	sr_frit_r sr_frit_g sr_frit_b"
axel@0
   238
echo "	st_frit_r st_frit_g st_frit_b"
axel@0
   239
echo "	0 0 0"
axel@0
   240
echo "	glaze1.cal"
axel@0
   241
echo "0"
axel@0
   242
echo "11"
axel@0
   243
if ($s2t == 1) then
axel@0
   244
	ev "$s1c*($rg_r_arr[$s1t]-$rg_r_arr[1])" \
axel@0
   245
		"$s1c*($rg_g_arr[$s1t]-$rg_g_arr[1])" \
axel@0
   246
		"$s1c*($rg_b_arr[$s1t]-$rg_b_arr[1])"
axel@0
   247
	ev "$s1c*$rc_r_arr[$s1t]" "$s1c*$rc_g_arr[$s1t]" "$s1c*$rc_b_arr[$s1t]"
axel@0
   248
	ev "$s1c*$tn_r_arr[$s1t]" "$s1c*$tn_g_arr[$s1t]" "$s1c*$tn_b_arr[$s1t]"
axel@0
   249
	echo "	1	$s1c"
axel@0
   250
else
axel@0
   251
	ev "$s2c*$rc_r_arr[$s2t]" "$s2c*$rc_g_arr[$s2t]" "$s2c*$rc_b_arr[$s2t]"
axel@0
   252
	ev "$s2c*($rg_r_arr[$s2t]-$rg_r_arr[1])" \
axel@0
   253
		"$s2c*($rg_g_arr[$s2t]-$rg_g_arr[1])" \
axel@0
   254
		"$s2c*($rg_b_arr[$s2t]-$rg_b_arr[1])"
axel@0
   255
	ev "$s2c*$tn_r_arr[$s2t]" "$s2c*$tn_g_arr[$s2t]" "$s2c*$tn_b_arr[$s2t]"
axel@0
   256
	echo "	-1	$s2c"
axel@0
   257
endif
axel@0
   258
else
axel@0
   259
### Low-E glazing
axel@0
   260
echo "10"
axel@0
   261
echo "	sr_clear_r sr_clear_g sr_clear_b"
axel@0
   262
echo "	st_clear_r st_clear_g st_clear_b"
axel@0
   263
echo "	0 0 0"
axel@0
   264
echo "	glaze1.cal"
axel@0
   265
echo "0"
axel@0
   266
echo "19"
axel@0
   267
echo "	0 0 0"
axel@0
   268
echo "	0 0 0"
axel@0
   269
echo "	0 0 0"
axel@0
   270
if ($s2t == 1) then
axel@0
   271
	echo "	1"
axel@0
   272
	set st=$s1t
axel@0
   273
else
axel@0
   274
	echo "	-1"
axel@0
   275
	set st=$s2t
axel@0
   276
endif
axel@0
   277
echo "	$rg_r_arr[$st] $rg_g_arr[$st] $rg_b_arr[$st]"
axel@0
   278
echo "	$rc_r_arr[$st] $rc_g_arr[$st] $rc_b_arr[$st]"
axel@0
   279
echo "	$tn_r_arr[$st] $tn_g_arr[$st] $tn_b_arr[$st]"
axel@0
   280
endif
axel@0
   281
echo ""
axel@0
   282
exit 0
axel@0
   283
axel@0
   284
glaze2:
axel@0
   285
#################################################################
axel@0
   286
#
axel@0
   287
# Compute double glazing
axel@0
   288
#
axel@0
   289
if ($s2t != 1) then
axel@0
   290
	set s2r_rgb=($rc_r_arr[$s2t] $rc_g_arr[$s2t] $rc_b_arr[$s2t])
axel@0
   291
	set s1r_rgb=($rg_r_arr[$s2t] $rg_g_arr[$s2t] $rg_b_arr[$s2t])
axel@0
   292
	set s12t_rgb=($tn_r_arr[$s2t] $tn_g_arr[$s2t] $tn_b_arr[$s2t])
axel@0
   293
else
axel@0
   294
	set s2r_rgb=($rg_r_arr[$s1t] $rg_g_arr[$s1t] $rg_b_arr[$s1t])
axel@0
   295
	set s1r_rgb=($rc_r_arr[$s1t] $rc_g_arr[$s1t] $rc_b_arr[$s1t])
axel@0
   296
	set s12t_rgb=($tn_r_arr[$s1t] $tn_g_arr[$s1t] $tn_b_arr[$s1t])
axel@0
   297
endif
axel@0
   298
if ($s4t != 1) then
axel@0
   299
	set s4r_rgb=($rc_r_arr[$s4t] $rc_g_arr[$s4t] $rc_b_arr[$s4t])
axel@0
   300
	set s3r_rgb=($rg_r_arr[$s4t] $rg_g_arr[$s4t] $rg_b_arr[$s4t])
axel@0
   301
	set s34t_rgb=($tn_r_arr[$s4t] $tn_g_arr[$s4t] $tn_b_arr[$s4t])
axel@0
   302
else
axel@0
   303
	set s4r_rgb=($rg_r_arr[$s3t] $rg_g_arr[$s3t] $rg_b_arr[$s3t])
axel@0
   304
	set s3r_rgb=($rc_r_arr[$s3t] $rc_g_arr[$s3t] $rc_b_arr[$s3t])
axel@0
   305
	set s34t_rgb=($tn_r_arr[$s3t] $tn_g_arr[$s3t] $tn_b_arr[$s3t])
axel@0
   306
endif
axel@0
   307
set s12c=1
axel@0
   308
echo "# Exterior surface s1 type: $sn_arr[$s1t]"
axel@0
   309
if ($?s1c) then
axel@0
   310
	echo "# s1 coating coverage: $s1c"
axel@0
   311
	set s12c=$s1c
axel@0
   312
endif
axel@0
   313
echo "# Inner surface s2 type: $sn_arr[$s2t]"
axel@0
   314
if ($?s2c) then
axel@0
   315
	echo "# s2 coating coverage: $s2c"
axel@0
   316
	set s12c=$s2c
axel@0
   317
endif
axel@0
   318
set s34c=1
axel@0
   319
echo "# Inner surface s3 type: $sn_arr[$s3t]"
axel@0
   320
if ($?s3c) then
axel@0
   321
	echo "# s3 coating coverage: $s3c"
axel@0
   322
	set s34c=$s3c
axel@0
   323
endif
axel@0
   324
echo "# Interior surface s4 type: $sn_arr[$s4t]"
axel@0
   325
if ($?s4c) then
axel@0
   326
	echo "# s4 coating coverage: $s4c"
axel@0
   327
	set s34c=$s4c
axel@0
   328
endif
axel@0
   329
# Approximate reflectance and transmittance for comment using gray values
axel@0
   330
set rglass=`ev ".265*$rg_r_arr[1]+.670*$rg_g_arr[1]+.065*$rg_b_arr[1]"`
axel@0
   331
set tglass=`ev ".265*$tn_r_arr[1]+.670*$tn_g_arr[1]+.065*$tn_b_arr[1]"`
axel@0
   332
set s1r_gry=`ev "$s12c*(.265*$s1r_rgb[1]+.670*$s1r_rgb[2]+.065*$s1r_rgb[3])+(1-$s12c)*$rglass"`
axel@0
   333
set s2r_gry=`ev "$s12c*(.265*$s2r_rgb[1]+.670*$s2r_rgb[2]+.065*$s2r_rgb[3])+(1-$s12c)*$rglass"`
axel@0
   334
set s12t_gry=`ev "$s12c*(.265*$s12t_rgb[1]+.670*$s12t_rgb[2]+.065*$s12t_rgb[3])+(1-$s12c)*$tglass"`
axel@0
   335
set s3r_gry=`ev "$s34c*(.265*$s3r_rgb[1]+.670*$s3r_rgb[2]+.065*$s3r_rgb[3])+(1-$s34c)*$rglass"`
axel@0
   336
set s4r_gry=`ev "$s34c*(.265*$s4r_rgb[1]+.670*$s4r_rgb[2]+.065*$s4r_rgb[3])+(1-$s34c)*$rglass"`
axel@0
   337
set s34t_gry=`ev "$s34c*(.265*$s34t_rgb[1]+.670*$s34t_rgb[2]+.065*$s34t_rgb[3])+(1-$s34c)*$tglass"`
axel@0
   338
echo -n "# Exterior normal hemispherical reflectance: "
axel@0
   339
ev "$s1r_gry + $s12t_gry^2*$s3r_gry"
axel@0
   340
echo -n "# Interior normal hemispherical reflectance: "
axel@0
   341
ev "$s4r_gry + $s34t_gry^2*$s2r_gry"
axel@0
   342
echo -n "# Normal hemispherical transmittance: "
axel@0
   343
ev "$s12t_gry*$s34t_gry"
axel@0
   344
echo "#"
axel@0
   345
echo "void BRTDfunc glaze2_unnamed"
axel@0
   346
axel@0
   347
if ($part_arr[$s3t] || $part_arr[$s4t]) then
axel@0
   348
### Front pane has frit
axel@0
   349
if ($part_arr[$s1t] || $part_arr[$s2t]) then
axel@0
   350
	echo "Only one pane can have frit"
axel@0
   351
	exit 1
axel@0
   352
endif
axel@0
   353
if ($?s3c) then
axel@0
   354
	set sc=$s3c
axel@0
   355
	set s3g=`ev "1-$s3c"`
axel@0
   356
else
axel@0
   357
	set s3c=0
axel@0
   358
	set s3g=1
axel@0
   359
endif
axel@0
   360
if ($?s4c) then
axel@0
   361
	set sc=$s4c
axel@0
   362
	set s4g=`ev "1-$s4c"`
axel@0
   363
else
axel@0
   364
	set s4c=0
axel@0
   365
	set s4g=1
axel@0
   366
endif
axel@0
   367
echo "10"
axel@0
   368
echo "if(Rdot,cr($s4g*rclr,$s3g*$s4g*tclr,fr($s2r_rgb[1])),cr(fr($s1r_rgb[1]),ft($s12t_rgb[1]),$s3g*rclr))"
axel@0
   369
echo "if(Rdot,cr($s4g*rclr,$s3g*$s4g*tclr,fr($s2r_rgb[2])),cr(fr($s1r_rgb[2]),ft($s12t_rgb[2]),$s3g*rclr))"
axel@0
   370
echo "if(Rdot,cr($s4g*rclr,$s3g*$s4g*tclr,fr($s2r_rgb[3])),cr(fr($s1r_rgb[3]),ft($s12t_rgb[3]),$s3g*rclr))"
axel@0
   371
echo "$s3g*$s4g*ft($s12t_rgb[1])*tclr"
axel@0
   372
echo "$s3g*$s4g*ft($s12t_rgb[2])*tclr"
axel@0
   373
echo "$s3g*$s4g*ft($s12t_rgb[3])*tclr"
axel@0
   374
echo "	0 0 0"
axel@0
   375
echo "	glaze2.cal"
axel@0
   376
echo "0"
axel@0
   377
echo "9"
axel@0
   378
ev "$sc*$s4r_rgb[1]-$s3c*$rg_r_arr[1]" \
axel@0
   379
	"$sc*$s4r_rgb[2]-$s3c*$rg_g_arr[1]" \
axel@0
   380
	"$sc*$s4r_rgb[3]-$s3c*$rg_b_arr[1]"
axel@0
   381
ev "$s12t_rgb[1]^2*($sc*$s3r_rgb[1]-$s4c*$rg_r_arr[1])" \
axel@0
   382
	"$s12t_rgb[2]^2*($sc*$s3r_rgb[2]-$s4c*$rg_g_arr[1])" \
axel@0
   383
	"$s12t_rgb[3]^2*($sc*$s3r_rgb[3]-$s4c*$rg_b_arr[1])"
axel@0
   384
ev "$sc*$s12t_rgb[1]*$s34t_rgb[1]" \
axel@0
   385
	"$sc*$s12t_rgb[2]*$s34t_rgb[2]" \
axel@0
   386
	"$sc*$s12t_rgb[3]*$s34t_rgb[3]"
axel@0
   387
else if ($part_arr[$s1t] || $part_arr[$s2t]) then
axel@0
   388
### Back pane has frit
axel@0
   389
if ($?s1c) then
axel@0
   390
	set sc=$s1c
axel@0
   391
	set s1g=`ev "1-$s1c"`
axel@0
   392
else
axel@0
   393
	set s1c=0
axel@0
   394
	set s1g=1
axel@0
   395
endif
axel@0
   396
if ($?s2c) then
axel@0
   397
	set sc=$s2c
axel@0
   398
	set s2g=`ev "1-$s2c"`
axel@0
   399
else
axel@0
   400
	set s2c=0
axel@0
   401
	set s2g=1
axel@0
   402
endif
axel@0
   403
echo "10"
axel@0
   404
echo "if(Rdot,cr(fr($s4r_rgb[1]),ft($s34t_rgb[1]),$s2g*rclr),cr($s1g*rclr,$s1g*$s2g*tclr,fr($s3r_rgb[1])))"
axel@0
   405
echo "if(Rdot,cr(fr($s4r_rgb[2]),ft($s34t_rgb[2]),$s2g*rclr),cr($s1g*rclr,$s1g*$s2g*tclr,fr($s3r_rgb[2])))"
axel@0
   406
echo "if(Rdot,cr(fr($s4r_rgb[3]),ft($s34t_rgb[3]),$s2g*rclr),cr($s1g*rclr,$s1g*$s2g*tclr,fr($s3r_rgb[3])))"
axel@0
   407
echo "$s1g*$s2g*ft($s34t_rgb[1])*tclr"
axel@0
   408
echo "$s1g*$s2g*ft($s34t_rgb[2])*tclr"
axel@0
   409
echo "$s1g*$s2g*ft($s34t_rgb[3])*tclr"
axel@0
   410
echo "	0 0 0"
axel@0
   411
echo "	glaze2.cal"
axel@0
   412
echo "0"
axel@0
   413
echo "9"
axel@0
   414
ev "$s34t_rgb[1]^2*($sc*$s2r_rgb[1]-$s1c*$rg_r_arr[1])" \
axel@0
   415
	"$s34t_rgb[2]^2*($sc*$s2r_rgb[2]-$s1c*$rg_g_arr[1])" \
axel@0
   416
	"$s34t_rgb[3]^2*($sc*$s2r_rgb[3]-$s1c*$rg_b_arr[1])"
axel@0
   417
ev "$sc*$s1r_rgb[1]-$s2c*$rg_r_arr[1]" \
axel@0
   418
	"$sc*$s1r_rgb[2]-$s2c*$rg_g_arr[1]" \
axel@0
   419
	"$sc*$s1r_rgb[3]-$s2c*$rg_b_arr[1]"
axel@0
   420
ev "$sc*$s34t_rgb[1]*$s12t_rgb[1]" \
axel@0
   421
	"$sc*$s34t_rgb[2]*$s12t_rgb[2]" \
axel@0
   422
	"$sc*$s34t_rgb[3]*$s12t_rgb[3]"
axel@0
   423
else
axel@0
   424
### Low-E and regular glazing only
axel@0
   425
echo "10"
axel@0
   426
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])))"
axel@0
   427
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])))"
axel@0
   428
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])))"
axel@0
   429
echo "ft($s34t_rgb[1])*ft($s12t_rgb[1])"
axel@0
   430
echo "ft($s34t_rgb[2])*ft($s12t_rgb[2])"
axel@0
   431
echo "ft($s34t_rgb[3])*ft($s12t_rgb[3])"
axel@0
   432
echo "	0 0 0"
axel@0
   433
echo "	glaze2.cal"
axel@0
   434
echo "0"
axel@0
   435
echo "9"
axel@0
   436
echo "	0 0 0"
axel@0
   437
echo "	0 0 0"
axel@0
   438
echo "	0 0 0"
axel@0
   439
endif
axel@0
   440
echo ""
axel@0
   441
exit 0