Skip to content

Commit

Permalink
fix(direct): Add support for direct illuminance results next to total
Browse files Browse the repository at this point in the history
We already store the direct results in the annual-irradiance recipe and I figured that we are eventually going to want the same here when we add support for ASE. Given that some advanced users were asking for these direct results and they know better that these results aren't suitable for LEED ASE, I am just adding some tasks that give them the direct result matrices. All of these tweaks are purely under the hood and I didn't change any of the outputs.
  • Loading branch information
chriswmackey authored and Chris Mackey committed Jan 8, 2022
1 parent ce9e058 commit 1447054
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 14 deletions.
8 changes: 5 additions & 3 deletions pollination/annual_daylight/_raytracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ class AnnualDaylightRayTracing(DAG):
@task(template=DaylightContribution)
def direct_sunlight(
self,
name=grid_name,
radiance_parameters=radiance_parameters,
fixed_radiance_parameters='-aa 0.0 -I -faf -ab 0 -dc 1.0 -dt 0.0 -dj 0.0 -dr 0',
fixed_radiance_parameters='-aa 0.0 -I -ab 0 -dc 1.0 -dt 0.0 -dj 0.0 -dr 0',
sensor_count=sensor_count,
modifiers=sun_modifiers,
sensor_grid=sensor_grid,
output_format='a', # make it ascii so we expose the file as a separate output
scene_file=octree_file_with_suns,
bsdf_folder=bsdfs
):
return [
{
'from': DaylightContribution()._outputs.result_file,
'to': 'direct_sunlight.ill'
'to': '../final/direct/{{self.name}}.ill'
}
]

Expand Down Expand Up @@ -131,6 +133,6 @@ def output_matrix_math(
return [
{
'from': AddRemoveSkyMatrix()._outputs.results_file,
'to': '../final/{{self.name}}.ill'
'to': '../final/total/{{self.name}}.ill'
}
]
71 changes: 62 additions & 9 deletions pollination/annual_daylight/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pollination.honeybee_radiance.sky import CreateSkyDome, CreateSkyMatrix
from pollination.honeybee_radiance.grid import SplitGridFolder, MergeFolderData
from pollination.honeybee_radiance.post_process import AnnualDaylightMetrics
from pollination.path.copy import Copy

# input/output alias
from pollination.alias.inputs.model import hbjson_model_grid_input
Expand All @@ -17,7 +18,8 @@
min_sensor_count_input, cpu_count
from pollination.alias.inputs.schedule import schedule_csv_input
from pollination.alias.outputs.daylight import annual_daylight_results, \
daylight_autonomy_results, continuous_daylight_autonomy_results, \
annual_daylight_direct_results, daylight_autonomy_results, \
continuous_daylight_autonomy_results, \
udi_results, udi_lower_results, udi_upper_results


Expand Down Expand Up @@ -125,14 +127,23 @@ def create_rad_folder(self, input_model=model, grid_filter=grid_filter):
},
{
'from': CreateRadianceFolderGrid()._outputs.sensor_grids_file,
'to': 'results/grids_info.json'
'to': 'results/total/grids_info.json'
},
{
'from': CreateRadianceFolderGrid()._outputs.sensor_grids,
'description': 'Sensor grids information.'
}
]

@task(template=Copy, needs=[create_rad_folder])
def copy_grid_info(self, src=create_rad_folder._outputs.sensor_grids_file):
return [
{
'from': Copy()._outputs.dst,
'to': 'results/direct/grids_info.json'
}
]

@task(template=CreateOctree, needs=[create_rad_folder])
def create_octree(self, model=create_rad_folder._outputs.model_folder):
"""Create octree from radiance folder."""
Expand All @@ -159,14 +170,23 @@ def split_grid_folder(
},
{
'from': SplitGridFolder()._outputs.dist_info,
'to': 'initial_results/final/_redist_info.json'
'to': 'initial_results/final/total/_redist_info.json'
},
{
'from': SplitGridFolder()._outputs.sensor_grids,
'description': 'Sensor grids information.'
}
]

@task(template=Copy, needs=[split_grid_folder])
def copy_redist_info(self, src=split_grid_folder._outputs.dist_info):
return [
{
'from': Copy()._outputs.dst,
'to': 'initial_results/final/direct/_redist_info.json'
}
]

@task(
template=CreateOctreeWithSky, needs=[
generate_sunpath, create_rad_folder]
Expand Down Expand Up @@ -213,7 +233,16 @@ def parse_sun_up_hours(self, sun_modifiers=generate_sunpath._outputs.sun_modifie
return [
{
'from': ParseSunUpHours()._outputs.sun_up_hours,
'to': 'results/sun-up-hours.txt'
'to': 'results/total/sun-up-hours.txt'
}
]

@task(template=Copy, needs=[parse_sun_up_hours])
def copy_sun_up_hours(self, src=parse_sun_up_hours._outputs.sun_up_hours):
return [
{
'from': Copy()._outputs.dst,
'to': 'results/direct/sun-up-hours.txt'
}
]

Expand Down Expand Up @@ -250,11 +279,28 @@ def annual_daylight_raytracing(
template=MergeFolderData,
needs=[annual_daylight_raytracing]
)
def restructure_results(self, input_folder='initial_results/final', extension='ill'):
def restructure_results(
self, input_folder='initial_results/final/total', extension='ill'
):
return [
{
'from': MergeFolderData()._outputs.output_folder,
'to': 'results/total'
}
]

@task(
template=MergeFolderData,
needs=[annual_daylight_raytracing]
)
def restructure_direct_results(
self, input_folder='initial_results/final/direct',
extension='ill'
):
return [
{
'from': MergeFolderData()._outputs.output_folder,
'to': 'results'
'to': 'results/direct'
}
]

Expand All @@ -263,7 +309,7 @@ def restructure_results(self, input_folder='initial_results/final', extension='i
needs=[parse_sun_up_hours, annual_daylight_raytracing, restructure_results]
)
def calculate_annual_metrics(
self, folder='results', schedule=schedule, thresholds=thresholds
self, folder='results/total', schedule=schedule, thresholds=thresholds
):
return [
{
Expand All @@ -273,8 +319,15 @@ def calculate_annual_metrics(
]

results = Outputs.folder(
source='results', description='Folder with raw result files (.ill) that '
'contain illuminance matrices.', alias=annual_daylight_results
source='results/total', description='Folder with raw result files (.ill) that '
'contain illuminance matrices for each sensor at each timestep of the analysis.',
alias=annual_daylight_results
)

results_direct = Outputs.folder(
source='results/direct', description='Folder with raw result files (.ill) that '
'contain matrices for just the direct illuminance.',
alias=annual_daylight_direct_results
)

metrics = Outputs.folder(
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pollination-honeybee-radiance==0.15.1
pollination-alias==0.9.12
pollination-honeybee-radiance==0.16.4
pollination-alias==0.9.13
pollination-path==0.3.0

0 comments on commit 1447054

Please sign in to comment.