Skip to content

Commit

Permalink
feat(comfort): Update comfort recipes for dynamic windows
Browse files Browse the repository at this point in the history
I'm also exposing an output for the raw environmental conditions on all recipes. Lastly, I'm exposing additional string inputs on the indoor comfort recipes (PMV  + Adaptive).
  • Loading branch information
chriswmackey authored and Chris Mackey committed Mar 9, 2022
1 parent 61aebeb commit 7b1f436
Show file tree
Hide file tree
Showing 23 changed files with 3,737 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

_default_inputs = { 'air_speed': None,
'comfort_parameters': '--standard ASHRAE-55',
'contributions': None,
'direct_irradiance': None,
'enclosure_info': None,
'epw': None,
Expand Down Expand Up @@ -431,6 +432,17 @@ def sun_up_hours(self):
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def contributions(self):
try:
pathlib.Path(self._input_params['contributions'])
except TypeError:
# optional artifact
return None
value = pathlib.Path(self._input_params['contributions'])
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def execution_folder(self):
return pathlib.Path(self._input_params['simulation_folder']).as_posix()
Expand All @@ -444,7 +456,7 @@ def params_folder(self):
return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix()

def command(self):
return 'ladybug-comfort map shortwave-mrt weather.epw indirect.ill direct.ill ref.ill sun-up-hours.txt --solarcal-par "{solarcal_par}" --run-period "{run_period}" --{indirect_is_total} --output-file shortwave.csv'.format(solarcal_par=self.solarcal_par, run_period=self.run_period, indirect_is_total=self.indirect_is_total)
return 'ladybug-comfort map shortwave-mrt weather.epw indirect.ill direct.ill ref.ill sun-up-hours.txt --contributions dynamic --solarcal-par "{solarcal_par}" --run-period "{run_period}" --{indirect_is_total} --output-file shortwave.csv'.format(solarcal_par=self.solarcal_par, run_period=self.run_period, indirect_is_total=self.indirect_is_total)

def output(self):
return {
Expand All @@ -460,7 +472,8 @@ def input_artifacts(self):
{'name': 'indirect_irradiance', 'to': 'indirect.ill', 'from': self.indirect_irradiance, 'optional': False},
{'name': 'direct_irradiance', 'to': 'direct.ill', 'from': self.direct_irradiance, 'optional': False},
{'name': 'ref_irradiance', 'to': 'ref.ill', 'from': self.ref_irradiance, 'optional': False},
{'name': 'sun_up_hours', 'to': 'sun-up-hours.txt', 'from': self.sun_up_hours, 'optional': False}]
{'name': 'sun_up_hours', 'to': 'sun-up-hours.txt', 'from': self.sun_up_hours, 'optional': False},
{'name': 'contributions', 'to': 'dynamic', 'from': self.contributions, 'optional': True}]

@property
def output_artifacts(self):
Expand Down Expand Up @@ -585,7 +598,7 @@ def output_artifacts(self):
}]


class _ComfortMappingEntryPoint_119480b7Orchestrator(luigi.WrapperTask):
class _ComfortMappingEntryPoint_5e24b5e4Orchestrator(luigi.WrapperTask):
"""Runs all the tasks in this module."""
# user input for this module
_input_params = luigi.DictParameter()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
"""
This file is auto-generated from a Queenbee recipe. It is unlikely that
you should be editing this file directly. Instead try to edit the recipe
itself and regenerate the code.
Contact the recipe maintainers with additional questions.
chris: [email protected]
ladybug-tools: [email protected]
This file is licensed under "PolyForm Shield License 1.0.0".
See https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt for more information.
"""


import luigi
import os
import pathlib
from queenbee_local import QueenbeeTask
from queenbee_local import load_input_param as qb_load_input_param


_default_inputs = { 'aperture_id': None,
'direct_specular': None,
'grid_name': None,
'indirect_diffuse': None,
'indirect_specular': None,
'params_folder': '__params',
'ref_diffuse': None,
'ref_specular': None,
'result_sql': None,
'simulation_folder': '.',
'sun_up_hours': None}


class CreateIrradianceContribMap(QueenbeeTask):
"""Get .ill files with maps of irradiance contributions from dynamic windows."""

# DAG Input parameters
_input_params = luigi.DictParameter()

# Task inputs
@property
def aperture_id(self):
return self._input_params['aperture_id']

@property
def name(self):
return self._input_params['grid_name']

@property
def result_sql(self):
value = pathlib.Path(self._input_params['result_sql'])
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def direct_specular(self):
value = pathlib.Path(self._input_params['direct_specular'])
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def indirect_specular(self):
value = pathlib.Path(self._input_params['indirect_specular'])
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def ref_specular(self):
value = pathlib.Path(self._input_params['ref_specular'])
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def indirect_diffuse(self):
value = pathlib.Path(self._input_params['indirect_diffuse'])
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def ref_diffuse(self):
value = pathlib.Path(self._input_params['ref_diffuse'])
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def sun_up_hours(self):
value = pathlib.Path(self._input_params['sun_up_hours'])
return value.as_posix() if value.is_absolute() \
else pathlib.Path(self.initiation_folder, value).resolve().as_posix()

@property
def execution_folder(self):
return pathlib.Path(self._input_params['simulation_folder']).as_posix()

@property
def initiation_folder(self):
return pathlib.Path(self._input_params['simulation_folder']).as_posix()

@property
def params_folder(self):
return pathlib.Path(self.execution_folder, self._input_params['params_folder']).resolve().as_posix()

def command(self):
return 'ladybug-comfort map irradiance-contrib result.sql direct_spec.ill indirect_spec.ill ref_spec.ill indirect_diff.ill ref_diff.ill sun-up-hours.txt --aperture-id "{aperture_id}" --folder output'.format(aperture_id=self.aperture_id)

def output(self):
return {
'result_folder': luigi.LocalTarget(
pathlib.Path(self.execution_folder, 'dynamic/final/{name}/{aperture_id}'.format(name=self.name, aperture_id=self.aperture_id)).resolve().as_posix()
)
}

@property
def input_artifacts(self):
return [
{'name': 'result_sql', 'to': 'result.sql', 'from': self.result_sql, 'optional': False},
{'name': 'direct_specular', 'to': 'direct_spec.ill', 'from': self.direct_specular, 'optional': False},
{'name': 'indirect_specular', 'to': 'indirect_spec.ill', 'from': self.indirect_specular, 'optional': False},
{'name': 'ref_specular', 'to': 'ref_spec.ill', 'from': self.ref_specular, 'optional': False},
{'name': 'indirect_diffuse', 'to': 'indirect_diff.ill', 'from': self.indirect_diffuse, 'optional': False},
{'name': 'ref_diffuse', 'to': 'ref_diff.ill', 'from': self.ref_diffuse, 'optional': False},
{'name': 'sun_up_hours', 'to': 'sun-up-hours.txt', 'from': self.sun_up_hours, 'optional': False}]

@property
def output_artifacts(self):
return [
{
'name': 'result-folder', 'from': 'output',
'to': pathlib.Path(self.execution_folder, 'dynamic/final/{name}/{aperture_id}'.format(name=self.name, aperture_id=self.aperture_id)).resolve().as_posix(),
'optional': False,
'type': 'folder'
}]


class _DynamicBehaviorEntryPoint_5e24b5e4Orchestrator(luigi.WrapperTask):
"""Runs all the tasks in this module."""
# user input for this module
_input_params = luigi.DictParameter()

@property
def input_values(self):
params = dict(_default_inputs)
params.update(dict(self._input_params))
return params

def requires(self):
yield [CreateIrradianceContribMap(_input_params=self.input_values)]
Loading

0 comments on commit 7b1f436

Please sign in to comment.