/usr/bin/dayfact is in radiance 4R0+20110410-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | #!/bin/csh -f
# RCSid: $Id: dayfact.csh,v 2.9 2008/11/10 19:08:19 greg Exp $
#
# Interactive script to calculate daylight factors
#
set nofile="none"
set illumpic=$nofile
set octree=$nofile
set dfpict=$nofile
set ilpict=$nofile
set dspict=$nofile
set nodaysav=1
set fcopts=($*)
set designlvl=500
set wporig=(0 0 0)
set wpsize=(1 1)
set rtargs=(-ab 1 -ad 256 -as 128 -aa .15 -av .3 .3 .3)
set maxres=128
set td=`mktemp -d /tmp/df.XXXXXX`
alias readvar 'echo -n Enter \!:1 "[$\!:1]: ";set ans="$<";if("$ans" != "")set \!:1="$ans"'
cat <<_EOF_
DAYLIGHT FACTOR CALCULATION
This script calculates daylight factors, illuminance levels, and/or
energy savings due to daylight on a rectangular workplane and produces
a contour plot from the result. The input is a Radiance scene description
(and octree) and the output is one or more color Radiance pictures.
_EOF_
echo "Have you already calculated an illuminance picture using dayfact?"
readvar illumpic
if ( $illumpic != $nofile ) then
if ( ! -r $illumpic ) then
echo "Cannot read $illumpic"
exit 1
endif
set title=$illumpic:r
set gotillumpic
goto getgenskyf
endif
readvar octree
if ( $octree == $nofile || ! -f $octree ) then
echo "You must first create an octree with"
echo "oconv before running this script."
exit 1
endif
set title="$octree:r"
echo -n "Is the z-axis your zenith direction? "
if ( "$<" !~ [yY]* ) then
echo "I'm sorry, you cannot use this script"
exit 1
endif
echo "What is the origin (smallest x y z coordinates) of the workplane?"
readvar wporig
set wporig=($wporig)
echo "What is the x and y size (width and length) of the workplane?"
readvar wpsize
set wpsize=($wpsize)
set wpres=(`rcalc -n -e '$1=if(l,'"floor($maxres*$wpsize[1]/$wpsize[2]),$maxres);"'$2=if(l,'"$maxres,floor($maxres*$wpsize[2]/$wpsize[1]));l=$wpsize[2]-$wpsize[1]"`)
set rtargs=($rtargs -ar `getinfo -d<$octree|rcalc -e '$1=floor(16*$4/'"($wpsize[1]+$wpsize[2]))"`)
echo "What calculation options do you want to give to rtrace?"
echo "(It is very important to set the -a* options correctly.)"
readvar rtargs
echo "Do you want to save the illuminance picture for later runs?"
readvar illumpic
############
getgenskyf:
set genskyf=$nofile
echo "In what scene file is the gensky command located?"
readvar genskyf
if ( $genskyf == $nofile ) then
echo "You will not be able to compute daylight factors"
echo "or energy savings since there is no gensky file."
else
xform -e $genskyf > $td/gsf
grep '^# gensky ' $td/gsf
if ( $status ) then
echo "The file $genskyf does not contain a gensky command\!"
rm -f $td/gsf
goto getgenskyf
endif
set title=$title\ `sed -n 's/^# gensky *\([0-9][0-9]* *[0-9][0-9]* *[0-9][0-9.]*\).*$/\1/p' $td/gsf`
set extamb=`sed -n 's/^# Ground ambient level: //p' $td/gsf`
grep -s '^# gensky .* -c' $td/gsf
set nodaysav=$status
rm -f $td/gsf
if ( $nodaysav ) then
echo "The gensky command was not done for an overcast sky"
echo "(-c option), so energy savings cannot be calculated."
echo -n "Continue anyway? "
if ( "$<" =~ [nN]* ) then
exit 0
endif
endif
endif
echo "Illuminance contour picture if you want one"
readvar ilpict
if ( $?extamb ) then
echo "Daylight factor contour picture if you want one"
readvar dfpict
endif
if ( ! $nodaysav ) then
echo "Energy savings contour picture if you want one"
readvar dspict
if ( $dspict != $nofile ) then
echo "Workplane design level (lux)"
readvar designlvl
endif
endif
if ( $ilpict == $nofile && $dfpict == $nofile && $dspict == $nofile ) then
echo "Since you don't want any output, I guess we're done."
exit 0
endif
echo "Title for output picture"
readvar title
set sctemp=$td/sc.csh
cat <<'_EOF_' > $sctemp
if ( $illumpic != $nofile ) then
set iltemp=""
else
set iltemp=$td/il.hdr
set illumpic=$iltemp
endif
set tltemp=$td/tl.hdr
set dstemp=$td/ds.hdr
set temp1=$td/tfa
echo "Your dayfact job is finished."
echo "Please check for error messages below."
echo ""
set echo
if ( ! $?gotillumpic ) then
cnt $wpres[2] $wpres[1] \
| rcalc -e '$1=($2+.5)/'"$wpres[1]*$wpsize[1]+$wporig[1]" \
-e '$2=(1-($1+.5)/'"$wpres[2])*$wpsize[2]+$wporig[2]" \
-e '$3='"$wporig[3]" -e '$4=0;$5=0;$6=1' \
| rtrace $rtargs -h+ -I+ -ov -fac -x $wpres[1] -y $wpres[2] $octree \
> $temp1
pfilt -h 20 -n 0 -x 300 -y 300 -p 1 -r 1 $temp1 > $illumpic
endif
set maxval=`getinfo < $illumpic | rcalc -i 'EXPOSURE=${e}' -e '$1=3/e'`
if ("$maxval" == "") set maxval=3
psign -h 42 " $title " | pfilt -1 -x /2 -y /2 > $tltemp
'_EOF_'
if ( $ilpict != $nofile ) then
echo 'falsecolor -cb -l Lux -s "$maxval*179" \\
$fcopts -m 179 -ip $illumpic \\
| pcompos -a 1 - $tltemp > $ilpict' >> $sctemp
endif
if ( $dfpict != $nofile ) then
echo 'falsecolor -cb -l DF -s 16 \\
$fcopts -m "100/PI/$extamb" -ip $illumpic \\
| pcompos -a 1 - $tltemp > $dfpict' >> $sctemp
endif
if ( $dspict != $nofile ) then
echo 'pcomb -e "lo=1-$designlvl/20000*3.1416*$extamb/li(1)" \\
-o $illumpic | falsecolor -cb -l "%Save" -s 100 \\
$fcopts -m 100 -p $illumpic \\
| pcompos -a 1 - $tltemp > $dspict' >> $sctemp
endif
echo 'rm -r $td' >> $sctemp
(source $sctemp) |& mail `whoami` &
echo "Your job is started in the background."
echo "You will be notified by mail when it is done."
|