| 1 |
|
#!/bin/csh -f |
| 2 |
< |
# SCCSid "$SunId$ LBL" |
| 2 |
> |
# RCSid: $Id$ |
| 3 |
|
# |
| 4 |
|
# Interactive script to calculate daylight factors |
| 5 |
|
# |
| 16 |
|
set wpsize=(1 1) |
| 17 |
|
set rtargs=(-ab 1 -ad 256 -as 128 -aa .15 -av .3 .3 .3) |
| 18 |
|
set maxres=128 |
| 19 |
+ |
set td=`mktemp -d /tmp/df.XXXXXX` |
| 20 |
|
|
| 21 |
|
alias readvar 'echo -n Enter \!:1 "[$\!:1]: ";set ans="$<";if("$ans" != "")set \!:1="$ans"' |
| 22 |
|
|
| 29 |
|
(and octree) and the output is one or more color Radiance pictures. |
| 30 |
|
|
| 31 |
|
_EOF_ |
| 32 |
< |
echo -n "Have you already calculated an illuminance picture with dayfact? " |
| 33 |
< |
if ( "$<" =~ [yY]* ) then |
| 34 |
< |
readvar illumpic |
| 32 |
> |
echo "Have you already calculated an illuminance picture using dayfact?" |
| 33 |
> |
readvar illumpic |
| 34 |
> |
if ( $illumpic != $nofile ) then |
| 35 |
|
if ( ! -r $illumpic ) then |
| 36 |
|
echo "Cannot read $illumpic" |
| 37 |
|
exit 1 |
| 75 |
|
echo "You will not be able to compute daylight factors" |
| 76 |
|
echo "or energy savings since there is no gensky file." |
| 77 |
|
else |
| 78 |
< |
xform -e $genskyf > /usr/tmp/gsf$$ |
| 79 |
< |
grep '^# gensky ' /usr/tmp/gsf$$ |
| 78 |
> |
xform -e $genskyf > $td/gsf |
| 79 |
> |
grep '^# gensky ' $td/gsf |
| 80 |
|
if ( $status ) then |
| 81 |
|
echo "The file $genskyf does not contain a gensky command\!" |
| 82 |
< |
rm -f /usr/tmp/gsf$$ |
| 82 |
> |
rm -f $td/gsf |
| 83 |
|
goto getgenskyf |
| 84 |
|
endif |
| 85 |
< |
set title=$title\ `sed -n 's/^# gensky *\([0-9][0-9]* *[0-9][0-9]* *[0-9][0-9.]*\).*$/\1/p' /usr/tmp/gsf$$` |
| 86 |
< |
set extamb=`sed -n 's/^# Ground ambient level: //p' /usr/tmp/gsf$$` |
| 87 |
< |
grep -s '^# gensky .* -c' /usr/tmp/gsf$$ |
| 85 |
> |
set title=$title\ `sed -n 's/^# gensky *\([0-9][0-9]* *[0-9][0-9]* *[0-9][0-9.]*\).*$/\1/p' $td/gsf` |
| 86 |
> |
set extamb=`sed -n 's/^# Ground ambient level: //p' $td/gsf` |
| 87 |
> |
grep -s '^# gensky .* -c' $td/gsf |
| 88 |
|
set nodaysav=$status |
| 89 |
< |
rm -f /usr/tmp/gsf$$ |
| 89 |
> |
rm -f $td/gsf |
| 90 |
|
if ( $nodaysav ) then |
| 91 |
|
echo "The gensky command was not done for an overcast sky" |
| 92 |
|
echo "(-c option), so energy savings cannot be calculated." |
| 116 |
|
endif |
| 117 |
|
echo "Title for output picture" |
| 118 |
|
readvar title |
| 119 |
< |
set sctemp=/usr/tmp/sc$$.csh |
| 119 |
> |
set sctemp=$td/sc.csh |
| 120 |
|
cat <<'_EOF_' > $sctemp |
| 121 |
|
if ( $illumpic != $nofile ) then |
| 122 |
|
set iltemp="" |
| 123 |
|
else |
| 124 |
< |
set iltemp=/usr/tmp/il$$.pic |
| 124 |
> |
set iltemp=$td/il.hdr |
| 125 |
|
set illumpic=$iltemp |
| 126 |
|
endif |
| 127 |
< |
set tltemp=/usr/tmp/tl$$.pic |
| 128 |
< |
set dstemp=/usr/tmp/ds$$.pic |
| 129 |
< |
set temp1=/usr/tmp/tfa$$ |
| 129 |
< |
set tempfiles=($iltemp $sctemp $tltemp $dstemp $temp1) |
| 127 |
> |
set tltemp=$td/tl.hdr |
| 128 |
> |
set dstemp=$td/ds.hdr |
| 129 |
> |
set temp1=$td/tfa |
| 130 |
|
echo "Your dayfact job is finished." |
| 131 |
|
echo "Please check for error messages below." |
| 132 |
|
echo "" |
| 136 |
|
| rcalc -e '$1=($2+.5)/'"$wpres[1]*$wpsize[1]+$wporig[1]" \ |
| 137 |
|
-e '$2=(1-($1+.5)/'"$wpres[2])*$wpsize[2]+$wporig[2]" \ |
| 138 |
|
-e '$3='"$wporig[3]" -e '$4=0;$5=0;$6=1' \ |
| 139 |
< |
| rtrace $rtargs -h+ -I+ -ov -faf $octree \ |
| 140 |
< |
| pvalue -r -y $wpres[2] +x $wpres[1] -df > $temp1 |
| 139 |
> |
| rtrace $rtargs -h+ -I+ -ov -fac -x $wpres[1] -y $wpres[2] $octree \ |
| 140 |
> |
> $temp1 |
| 141 |
|
pfilt -h 20 -n 0 -x 300 -y 300 -p 1 -r 1 $temp1 > $illumpic |
| 142 |
|
endif |
| 143 |
|
set maxval=`getinfo < $illumpic | rcalc -i 'EXPOSURE=${e}' -e '$1=3/e'` |
| 144 |
+ |
if ("$maxval" == "") set maxval=3 |
| 145 |
|
psign -h 42 " $title " | pfilt -1 -x /2 -y /2 > $tltemp |
| 146 |
|
'_EOF_' |
| 147 |
|
if ( $ilpict != $nofile ) then |
| 150 |
|
| pcompos -a 1 - $tltemp > $ilpict' >> $sctemp |
| 151 |
|
endif |
| 152 |
|
if ( $dfpict != $nofile ) then |
| 153 |
< |
echo 'falsecolor -cb -l DF -s 50 \\ |
| 153 |
> |
echo 'falsecolor -cb -l DF -s 16 \\ |
| 154 |
|
$fcopts -m "100/PI/$extamb" -ip $illumpic \\ |
| 155 |
|
| pcompos -a 1 - $tltemp > $dfpict' >> $sctemp |
| 156 |
|
endif |
| 160 |
|
$fcopts -m 100 -p $illumpic \\ |
| 161 |
|
| pcompos -a 1 - $tltemp > $dspict' >> $sctemp |
| 162 |
|
endif |
| 163 |
< |
echo 'rm -f $tempfiles' >> $sctemp |
| 163 |
> |
echo 'rm -r $td' >> $sctemp |
| 164 |
|
(source $sctemp) |& mail `whoami` & |
| 165 |
|
echo "Your job is started in the background." |
| 166 |
|
echo "You will be notified by mail when it is done." |