scripting problem

Hi all,
I'm trying to automate the calculation of illuminance values inside an
office, during 4 different days of each month of the year. I've saved
the script below as venezia.csh and then I've written chmod u+x
venezia.csh, and finally ./venezia.csh.

#! /bin/csh
set opzioni = (-ab 7 -aa .1 -ad 2048 -as 1024 -ar 512)
foreach mo (1 2 3 4 5 6 7 8 9 10 11 12)
foreach da (7 14 21 28)
foreach hh (4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21)
gensky -a 45.50 -o -12.33 -m -15 $mo":"$da":"$hh -u -g 0.2 > sky.rad
oconv sky.rad office.rad glaze70.rad mirr_ss.rad > model.oct
rtrace -w -h -opv -I+ $opzioni model.oct < office_sensor.pts > |rcalc
-e '$1=$1;$2=$2;$3=179*(.265074126*$4+.670114631*$5+.064811243*$6)' >
$mo.$da.$hh.V.mss.dat
end
end
end

The problem is : use error - bad month, oconv: sky.rad - empty-file
and, finally, missing name for redirect. Does anybody know how to make
it work?
Thanks in advance,
Valeria

Valeria

The syntax for gensky is

     gensky month day hour:minute [anything else]

In your script you create

     gensky -a 45.5 -o 12.33 -m -15 month:day:hour -u -g 0.2

which is not accepted by gensky. Use the line

     gensky $mo $da $hh":00" -a 45.50 -o -12.33 -m -15 -u -g 0.2 > sky.rad

instead of your command. I assume that the CSH syntax
otherwise is correct. I have not checked that the output
of $hh":00" returns something like "13:00".

I also noticed that you use a uniform sky here (-u).
This is not realistic sky distribution and only appropriate
in specialist cases. If you want a "standard" sky you should
use "-c" to create an CIE overcast sky (probably not very
accurate for Venice either - I'm sure you get some sun there.).

Regards,
Thomas

···

On 18 Feb 2009, at 10:30, Valeria De Giuli wrote:

Hi all,
I'm trying to automate the calculation of illuminance values inside an
office, during 4 different days of each month of the year. I've saved
the script below as venezia.csh and then I've written chmod u+x
venezia.csh, and finally ./venezia.csh.

#! /bin/csh
set opzioni = (-ab 7 -aa .1 -ad 2048 -as 1024 -ar 512)
foreach mo (1 2 3 4 5 6 7 8 9 10 11 12)
foreach da (7 14 21 28)
foreach hh (4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21)
gensky -a 45.50 -o -12.33 -m -15 $mo":"$da":"$hh -u -g 0.2 > sky.rad
oconv sky.rad office.rad glaze70.rad mirr_ss.rad > model.oct
rtrace -w -h -opv -I+ $opzioni model.oct < office_sensor.pts > |rcalc
-e '$1=$1;$2=$2;$3=179*(.265074126*$4+.670114631*$5+.064811243*$6)' >
$mo.$da.$hh.V.mss.dat
end

The problem is : use error - bad month, oconv: sky.rad - empty-file
and, finally, missing name for redirect. Does anybody know how to make
it work?
Thanks in advance,
Valeria

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Hi,

you must first specify month day hour (without ':' in between!!!), than the options (just type gensky, it will show you the possible ways to call it).

gensky $mo $da $hh -a 45.50 -o -12.33 -m -15 -u -g 0.2 > sky.rad

Should do the job.

However, instead of your foreach loops, you can use the radiance tool 'cnt', which counts thru an array, combined with rcalc and awk, to write a shell script that will do the calculation:

cnt 12 4 18 | rcalc -e '$1=1+$1;$2=(1+$2)*7;$3=$3+4' | awk '{ print "gensky "$1, $2, $3" -a 45.50 -o -12.33 -m -15 -u -g .2 > sky.rad; oconv sky.rad office.rad glaze70.rad mirr_ss.rad > model.oct"; }' > skys.bash

As you see, I did not write the rtace part - as I am too lazy to do all the escaping work for awk. Still, it is just a proposal to do this in an one-liner :wink:

Good luck, CU Lars.

Valeria,

If the following material and source descriptions are *not* in your other .rad, files, then you will only have a description for the sun.

skyfunc glow skyglow
0
4 1 1 1 0

skyglow source sky
0
4 0 0 1 180

skyfunc glow groundglow
0
4 1 1 1 0

groundglow source ground
0
4 0 0 -1 180

If that is the case, put the lines above into a file called, say, sky_glow.rad and include it in the oconv command, e.g:
oconv sky.rad sky_glow.rad office.rad glaze70.rad mirr_ss.rad > model.oct
Also, there's a typo here:
rtrace -w -h -opv -I+ $opzioni model.oct < office_sensor.pts > |rcalc -e '$1=$1;$2=$2;$3=179*(.265074126*$4+.670114631*$5+.064811243*$6)' > $mo.$da.$hh.V.mss.dat
I'm assuming this is all one line, in any case you don't need the ">" redirection before the pipe to rcalc, just delete it.
A presto!
-John

···

-----------------------------------------------
Dr. John Mardaljevic
Senior Research Fellow
Institute of Energy and Sustainable Development
De Montfort University
The Gateway
Leicester
LE1 9BH, UK
+44 (0) 116 257 7972
+44 (0) 116 257 7981 (fax)

[email protected]
http://www.iesd.dmu.ac.uk/~jm

Thank you John,
I forgot the glow description! I've noticed that without the glow
description I have only the sun description and it results 0 lux all
the time.
Thank you,
Valeria

···

2009/2/18 John Mardaljevic <[email protected]>:

Valeria,

If the following material and source descriptions are *not* in your other
.rad, files, then you will only have a description for the sun.

skyfunc glow skyglow
0
0
4 1 1 1 0

skyglow source sky
0
0
4 0 0 1 180

skyfunc glow groundglow
0
0
4 1 1 1 0

groundglow source ground
0
0
4 0 0 -1 180

If that is the case, put the lines above into a file called, say,
sky_glow.rad and include it in the oconv command, e.g:
oconv sky.rad sky_glow.rad office.rad glaze70.rad mirr_ss.rad > model.oct
Also, there's a typo here:
rtrace -w -h -opv -I+ $opzioni model.oct < office_sensor.pts > |rcalc -e
'$1=$1;$2=$2;$3=179*(.265074126*$4+.670114631*$5+.064811243*$6)' >
$mo.$da.$hh.V.mss.dat
I'm assuming this is all one line, in any case you don't need the ">"
redirection before the pipe to rcalc, just delete it.
A presto!
-John
-----------------------------------------------
Dr. John Mardaljevic
Senior Research Fellow
Institute of Energy and Sustainable Development
De Montfort University
The Gateway
Leicester
LE1 9BH, UK
+44 (0) 116 257 7972
+44 (0) 116 257 7981 (fax)

[email protected]
http://www.iesd.dmu.ac.uk/~jm

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Thank you Lars! It runs now! I'll try in the other way you suggest me!
Bye,
Valeria

···

2009/2/18 Lars O. Grobe <[email protected]>:

Hi,

you must first specify month day hour (without ':' in between!!!), than the
options (just type gensky, it will show you the possible ways to call it).

gensky $mo $da $hh -a 45.50 -o -12.33 -m -15 -u -g 0.2 > sky.rad

Should do the job.

However, instead of your foreach loops, you can use the radiance tool 'cnt',
which counts thru an array, combined with rcalc and awk, to write a shell
script that will do the calculation:

cnt 12 4 18 | rcalc -e '$1=1+$1;$2=(1+$2)*7;$3=$3+4' | awk '{ print "gensky
"$1, $2, $3" -a 45.50 -o -12.33 -m -15 -u -g .2 > sky.rad; oconv sky.rad
office.rad glaze70.rad mirr_ss.rad > model.oct"; }' > skys.bash

As you see, I did not write the rtace part - as I am too lazy to do all the
escaping work for awk. Still, it is just a proposal to do this in an
one-liner :wink:

Good luck, CU Lars.

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Thank you Thomas,
it runs now!
Bye,
Valeria

···

2009/2/18 Thomas Bleicher <[email protected]>:

Valeria

The syntax for gensky is

   gensky month day hour:minute [anything else]

In your script you create

   gensky -a 45.5 -o 12.33 -m -15 month:day:hour -u -g 0.2

which is not accepted by gensky. Use the line

   gensky $mo $da $hh":00" -a 45.50 -o -12.33 -m -15 -u -g 0.2 > sky.rad

instead of your command. I assume that the CSH syntax
otherwise is correct. I have not checked that the output
of $hh":00" returns something like "13:00".

I also noticed that you use a uniform sky here (-u).
This is not realistic sky distribution and only appropriate
in specialist cases. If you want a "standard" sky you should
use "-c" to create an CIE overcast sky (probably not very
accurate for Venice either - I'm sure you get some sun there.).

Regards,
Thomas

On 18 Feb 2009, at 10:30, Valeria De Giuli wrote:

Hi all,
I'm trying to automate the calculation of illuminance values inside an
office, during 4 different days of each month of the year. I've saved
the script below as venezia.csh and then I've written chmod u+x
venezia.csh, and finally ./venezia.csh.

#! /bin/csh
set opzioni = (-ab 7 -aa .1 -ad 2048 -as 1024 -ar 512)
foreach mo (1 2 3 4 5 6 7 8 9 10 11 12)
foreach da (7 14 21 28)
foreach hh (4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21)
gensky -a 45.50 -o -12.33 -m -15 $mo":"$da":"$hh -u -g 0.2 > sky.rad
oconv sky.rad office.rad glaze70.rad mirr_ss.rad > model.oct
rtrace -w -h -opv -I+ $opzioni model.oct < office_sensor.pts > |rcalc
-e '$1=$1;$2=$2;$3=179*(.265074126*$4+.670114631*$5+.064811243*$6)' >
$mo.$da.$hh.V.mss.dat
end
end
end

The problem is : use error - bad month, oconv: sky.rad - empty-file
and, finally, missing name for redirect. Does anybody know how to make
it work?
Thanks in advance,
Valeria

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general