Closed mostaphaRoudsari closed 8 years ago
1 - Using honeybee library I need to create .pts, material file and geometry file.
2 - I can use sunpath library to generate sun vectors for any custom time period and write them to two files. For each sun position sun geometry file looks like:
solar1 source sun1 0 0 4 sunvector.X sunvector.Y sunvector.Z 0.533
where solar1 is a material in sun material file:
void light [materialName] 0 0 3 1.0 1.0 1.0
.
There is also a third file which all the modifier names are listed (one name for each sun position.
solar1
solar2
solar3
...
3 - Now that it's all set running these two lines generates the results in a rct file.
oconv [material file] [geometry file] [sun materials file] [sun geometries file] > [octree file]
rcontrib -ab 0 -ad 10000 -I -M [sunlist.txt] -dc 1 [octree file]< [pts file] > [rcontrib results file]
The result file looks like this where each line after line 11 is the results for a test point and each 3 values are R, G, B values for one of the sun positions. In this case there is only 1 test point (1 line) and 8 sun positions (24 values).
#?RADIANCE
oconv [material file] [geometry file] [sun materials file] [sun geometries file] > [octree file]
rcontrib -ab 0 -ad 10000 -I -M [sunlist.txt] -dc 1 [octree file]< [pts file] > [rcontrib results file]
SOFTWARE= RADIANCE 5.0a lastmod 10:30:00 by googs on rgugliel-W7-VM
CAPDATE= 2016:03:27 19:19:44
GMT= 2016:03:27 23:19:44
NCOMP=3
NCOLS=8
FORMAT=ascii
0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 1.863716e-005 1.863716e-005 1.863716e-005 8.653568e-006 8.653568e-006 8.653568e-006
4 - Finally, we only care if the point sees the sun or not and the coefficient values itself doesn't really matter. Something like this will get us what we need for each test point.
def parseline(line):
_values = line.strip().split("\t")
_rgb = [_values[x:x + 3] for x in xrange(0, len(_values), 3)]
return [1 if sum(map(float, v)) > 0 else 0 for v in _rgb]
with open(resultFile, 'rb', 10) as inf:
for c, line in enumerate(inf):
if c < 10: continue
# here is the results for the test point
results = parseline(line)
print "{} Hours >> {}".format(sum(results), results)
>> 2 Hours >> [0, 0, 0, 0, 0, 0, 1, 1]