# With a minimum of 4 parameters # (limits of a rectangle, relative to pole height), # this script makes a sorted overview of the best performing photometries # to illuminate the rectangle # (relative flux hitting it, average and minimum ill.) # To achieve this, the script tries four rotations (0, 90, 180, 360 degrees) # and then uses a such one, which performs the best. # Further parameter may be -co, to compute a continuous row of lights for # at least one case (that one sorted on minimum illuminances). # Or -n as well (this is slow!), to compute even preliminary numbers # more accurately (as averages and minima are concerned), per pixel. # (by Jan Hollan, using his ies2tab programme, Oct 2007) D='ldt' P='Easy Light - Save the Sky' N=${1}_${2}_${3}_${4} ND=`echo $@ | sed -nr "s/.*-co.*/c/p"` if [[ $ND = 'c' ]] then ND=c`echo $@ | sed -nr "s/.*-rh([0-9.]+).*/\1/p"` fi if [[ $ND = 'c' ]] then ND=c4 fi if [ ! -d r$N$ND ] then mkdir r$N$ND fi shopt -s nullglob for H in $D/*.ldt $D/*.LDT $D/*.ies $D/*.IES $D/*.eld $D/*.ELD do # G is the file name without the directory (ldt assumed as a default) G=${H/$D\/} # E is the suffix E=${G/*\.} # F is the file name without directory and suffix F=${G/\.$E} echo $F R="-u$1:$2:$3:$4 $5 $6 $7 $8" I="-l -mi $R" if [[ $E != 'IES' ]] then if [[ $E != 'ies' ]] then L="-e" I="$I -e" fi fi ies2tab $I $H >012.txt ies2tab $I -rv90 $H >>012.txt ies2tab $I -rv180 $H >>012.txt ies2tab $I -rv270 $H >>012.txt sed -rn "/^.+$/{ s|$D/|| s/\.$E//p}" 012.txt | grep -n . | sort -k 16 -r -n >012sM.txt sed -rn "/^.+$/{ s|$D/|| s/\.$E//p}" 012.txt | grep -n . | sort -k 15 -r -n >012sA.txt sed -rn "/^.+$/{ s|$D/|| s/\.$E//p}" 012.txt | grep -n . | sort -k 13 -r -n >012sR.txt head -n1 012sR.txt >>r${N}_ur.txt head -n1 012sM.txt >>r${N}_mi.txt RON=`head -n1 012sM.txt | sed -nr "s/^(.).*/\1/p"` ROT=`calc -d "(90*($RON-1))" | sed -r 's/[[:blank:]]*//g'` # for the found optimal rotation, a plot is created: ies2tab $I -rv$ROT -n$F $H >012.txt convert $F.ppm r$N$ND/$F.png rm $F.ppm sed -rn "/^.+$/{ s/^/$RON: / s|$D/|| s/\.$E//p}" 012.txt >>r${N}_min.txt head -n1 012sA.txt >>r${N}_av.txt done rm 012.txt rm 012sM.txt rm 012sA.txt rm 012sR.txt echo " Luminaires are sorted according to decreasing minimum illuminance they provide within a rectangle of $1:$2:$3:$4 pole heights Ev. rotation of the luminaire needed to maximize this value is indicated by the 1st column larger than 1: -- 2: 90, 3: 180 and 4: 270 degrees " >r${N}_Smi.txt cp r${N}_Smi.txt r${N}_Smin.txt echo " Luminaires are sorted according to decreasing average illuminance they provide within a rectangle of $1:$2:$3:$4 pole heights Ev. rotation of the luminaire needed to maximize this value is indicated by the 1st column larger than 1: -- 2: 90, 3: 180 and 4: 270 degrees " >r${N}_Sav.txt echo " Luminaires are sorted according to decreasing useful fraction (of the outcoming luminaire flux) they provide within a rectangle of $1:$2:$3:$4 pole heights Ev. rotation of the luminaire needed to maximize this value is indicated by the 1st column larger than 1: -- 2: 90, 3: 180 and 4: 270 degrees " >r${N}_Sur.txt ies2tab -c $I -n$F | sed "s/^/ /" >>r${N}_Smin.txt ies2tab -c $I | sed "s/^/ /" >>r${N}_Smi.txt ies2tab -c $I | sed "s/^/ /" >>r${N}_Sav.txt ies2tab -c $I | sed "s/^/ /" >>r${N}_Sur.txt #sed -r 's/([0-9.]+ +[0-9.]+ +[0-9.]+ +[0-9.]+ +).+Full_CutOff +([^ ]+) +(.+)/\3 \1\2/ # s/ / /g ' fco.txt >ron.txt sort -k 16 -r -n r${N}_min.txt >>r${N}_Smin.txt sort -k 16 -r -n r${N}_mi.txt >>r${N}_Smi.txt sort -k 15 -r -n r${N}_av.txt >>r${N}_Sav.txt sort -k 13 -r -n r${N}_ur.txt >>r${N}_Sur.txt mv r${N}_Smin.txt r${N}_min.txt mv r${N}_Smi.txt r${N}_mi.txt mv r${N}_Sav.txt r${N}_av.txt mv r${N}_Sur.txt r${N}_ur.txt for FI in r${N}_ur.txt r${N}_av.txt r${N}_mi.txt do echo '
' >${FI/txt/htm}
 sed -r '
s/^([[:blank:]]*)#  //
s/^([[:blank:]]*)#//
s/^([[:blank:]]*FiOut)/        \1/
s/^([[:blank:]]*%  )/          \1/
   /^[1-4]/{
s|(.+) ([^ ]+)$|img \1\2|
} ' $FI >>${FI/txt/htm}
 echo '
' >>${FI/txt/htm} done for FI in r${N}_min.txt do echo '
' >${FI/txt/htm}
 sed -r "
s/^([[:blank:]]*)#  //
s/^([[:blank:]]*)#//
s/^([[:blank:]]*FiOut)/        \1/
s/^([[:blank:]]*%  )/          \1/
   /^[1-4]/{
s|(.+) ([^ ]+)$|\"img\" \1\2|
} " $FI >>${FI/txt/htm}
 echo '
' >>${FI/txt/htm} done