(Couldn't come up with a sillier subject line for this)
Dear list,
I am trying to use rcontrib and dctimestep in my only-just-invented
2.5-phase method. The idea is simple: Instead of relying on the patch
brightness to represent both sun and sky, I would like to only use the
patches for the sky, and rely on 'real' suns for an annual simulation.
This is somewhat related to Andy's 5-phase method, but but I'm still
at the stage where I have simple windows and no BSDF or Klems stuff.
What I am hoping to find out is whether the inclusion of 'proper' suns
makes a difference compared to the old skool rcontrib approach where
the sky patches represent the sun + sky.
I've tarred up the script and all the input files. They are available here:
http://www.jaloxa.eu/pickup/cbdm4_diffdir.tgz
The script is a bit lengthy:
---------------------8<-----------------------
#!/bin/bash
PROJECT="dds4"
OPT="ab7rtc"
SKYOCT="octrees/${PROJECT}_sky.oct"
SUNOCT="octrees/${PROJECT}_sun.oct"
REINHART=1
WEA="weather/gatwick.wea"
NPROC=5
# Sensor results with header
stmp="tmp"
if [ ! -d $stmp ]; then
mkdir $stmp
else
rm -f $stmp/*
fi
wbase=$(basename $WEA .wea)
fsmx="$stmp/${wbase}_m$REINHART.fsmx" # annual diffuse sky matrix
dsmx="$stmp/${wbase}_m$REINHART.dsmx" # annual direct sun matrix
csmx="$stmp/${wbase}_m$REINHART.csmx" # annual combined matrix
suns="$stmp/suns_m${REINHART}.rad" # annual suns
# Build the diffuse sky matrix for Tregenza subdivision
# -O1 (total solar irradiance), so we can compare against WEA file
echo " Building annual diffuse sky matrix $fsmx..."
gendaymtx -s -m $REINHART -c 1 1 1 -O1 $WEA > $fsmx
# Build the direct suns
echo " Building annual suns $suns..."
echo "void light solar 0 0 3 1e6 1e6 1e6" > $suns
npatch=$( echo 1 |rcalc -e MF:2 -f reinhart.cal -e '$1=Nrbins' )
cnt $npatch |rcalc -e MF:$REINHART -f reinsrc.cal -e Rbin=recno \
-o 'solar source sun 0 0 4 ${ Dx } ${ Dy } ${ Dz } 0.533' >> $suns
gendaymtx -5 -d -m $REINHART -c 1 1 1 -O1 $WEA > $dsmx
# Build direct+diffuse (old skool)
echo " Building annual combined sun+sky matrix $csmx..."
gendaymtx -m $REINHART -c 1 1 1 -O1 $WEA > $csmx
echo " Compiling octrees..."
oconv skies/sky_white.rad > $SKYOCT
oconv $suns > $SUNOCT
echo "Grid: roof.pts"
grid=roof.pts
base=$(basename roof .pts)
skdc="$stmp/${PROJECT}_${OPT}_$base.skdc" # diffuse sky DC
sndc="$stmp/${PROJECT}_${OPT}_$base.sndc" # direct sun DC
# Run the DDS calculations: Daylight Matrix with header
echo " Calculating sky DC $skdc..."
cat $grid \
>rcontrib -n $NPROC @$OPT.opt \
-e MF:$REINHART -f reinhart.cal -bn Nrbins -b rbin \
-o $skdc -m sky_glow $SKYOCT
echo " Calculating sun DC $sndc..."
cat $grid \
>rcontrib -n $NPROC @$OPT.opt \
-e MF:$REINHART -f reinhart.cal -bn Nrbins -b rbin \
-o $sndc -m solar $SUNOCT
fimx="$stmp/${PROJECT}_${OPT}_$base.fimx" # annual diffuse irradiance matrix
dimx="$stmp/${PROJECT}_${OPT}_$base.dimx" # annual direct irradiance matrix
cimx="$stmp/${PROJECT}_${OPT}_$base.cimx" # annual combined
irradiance matrix
# Produce annual (grey) sensor irradiance matrix
echo " Calculating annual direct irradiance $dimx..."
dctimestep -n 8760 $sndc $dsmx |tr '\t' '\n' |sed -e '/^\s*$/d' \
>rcalc -e '$1=$1' > $dimx
echo " Calculating annual diffuse irradiance $fimx..."
dctimestep -n 8760 $skdc $fsmx |tr '\t' '\n' |sed -e '/^\s*$/d' \
>rcalc -e '$1=$1' > $fimx
echo " Calculating annual combined irradiance $cimx..."
dctimestep -n 8760 $skdc $csmx |tr '\t' '\n' |sed -e '/^\s*$/d' \
>rcalc -e '$1=$1' > $cimx
imx2="$stmp/${PROJECT}_${OPT}_$base.imx2" # annual sky+sun irradiance matrix
irr="$stmp/${PROJECT}_${OPT}_$base.irr" # annual grey irradiance
# Add direct and diffuse
rlam $fimx $dimx |rcalc -e '$1=$1+$2' > $imx2
echo -e "month\tday\ttime\tin_dir\tin_diff\tdir\tdiff\tdir+diff\tcomb" > $irr
tail -n +7 $WEA |rlam - $dimx $fimx $imx2 $cimx >> $irr
#EOF
---------------------8<-----------------------
There is absolutely no geometry at all--just the sky/suns. The final
resuls are stored under ./tmp/ in the file with the *.irr extension
here are the first few lines:
month day time in_dir in_diff dir diff dir+diff comb
1 1 0.500 0 0 0 0 0 0
1 1 1.500 0 0 0 0 0 0
1 1 2.500 0 0 0 0 0 0
1 1 3.500 0 0 0 0 0 0
1 1 4.500 0 0 0 0 0 0
1 1 5.500 0 0 0 0 0 0
1 1 6.500 0 0 0 0 0 0
1 1 7.500 0 0 0 0 0 0
1 1 8.500 0 19 6.01 6.01 12.02 6.01
1 1 9.500 7 51 16.6 16.6 33.2 16.6
1 1 10.500 17 88 28.2 28.2 56.4 28.2
1 1 11.500 22 109 34.8 34.8 69.6 34.8
1 1 12.500 22 110 35.2 35.2 70.4 35.2
1 1 13.500 17 91 29.2 29.2 58.4 29.2
1 1 14.500 4 56 18.2 18.2 36.4 18.2
1 1 15.500 0 6 2.14 2.14 4.28 2.14
1 1 16.500 0 0 0 0 0 0
...
What I am measuring is the horizontal unobstructed irradiance.
The first five columns are essentially the wea file:
month day time in_dir in_diff
to which the following have been laminated:
dir: gendaymtx -5 -d; no sky, just 145 suns
diff: gendaymtx -s; no suns, Tregenza patches, only diffuse contribution
dir+diff: dir + diff
comb: gendaymtx; no suns, Tregenza patches, diffuse and direct
contribution. This is old skool for comparison.
I simply cannot make any sense of the results, so I'm wondering
whether I am misunderstanding the concept behind the -5 option to
gendaymtx.
Take, for instance, this row:
1 1 8.500 0 19 6.01 6.01 12.02 6.01
There is no direct irradiance recorded in the wea file. Yet, the
gendaymtx/rcontrib calculation produces 6.01 W/m2 (very low-angle
sun).
Also, I don't get why dir = diff = comb ???
I am probably using gendaymtx and rcontrib improperly, but have been
staring at this for quite a few hours now, without being able to work
out where I am making the mistakes.
Would anybody be able to offer assistance with this?
I have also tried doing the same think with genskyvec. It doesn't
complain when I give it the -5 option, but the results are simularly
confusing.
Many thanks for your help
Best regards
Axel