Skip to content

Commit

Permalink
feat(map): Add command to post-process results into TCP
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Mackey committed Mar 1, 2021
1 parent f493ea7 commit b821740
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 10 deletions.
74 changes: 66 additions & 8 deletions pollination/ladybug_comfort/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def run_pmv_map(self):

@dataclass
class AdaptiveMap(Function):
"""Get CSV files with maps of Adaptive comfort from EnergyPlus and Radiance results."""
"""Get CSV files with maps of Adaptive comfort from EnergyPlus and Radiance results.
"""

result_sql = Inputs.file(
description='A SQLite file that was generated by EnergyPlus and contains '
Expand Down Expand Up @@ -292,9 +293,9 @@ def run_utci_map(self):
return 'ladybug-comfort map utci result.sql enclosure_info.json ' \
'weather.epw --total-irradiance total.ill --direct-irradiance direct.ill ' \
'--ref-irradiance ref.ill --sun-up-hours sun-up-hours.txt ' \
'--wind-speed "{{self.wind_speed}}" --solarcal-par "{{self.solarcal_par}}" ' \
'--comfort-par "{{self.comfort_par}}" --run-period "{{self.run_period}}" ' \
'--folder output'
'--wind-speed "{{self.wind_speed}}" --solarcal-par ' \
'"{{self.solarcal_par}}" --comfort-par "{{self.comfort_par}}" ' \
'--run-period "{{self.run_period}}" --folder output'

result_folder = Outputs.folder(
description='Folder containing all of the output CSV files.', path='output'
Expand Down Expand Up @@ -350,10 +351,67 @@ class MapResultInfo(Function):
def map_results_information(self):
return 'ladybug-comfort map map-result-info {{self.comfort_model}} ' \
'--run-period "{{self.run_period}}" --qualifier "{{self.qualifier}}" ' \
'--output-file results_info.json'
'--folder output --log-file results_info.json'

results_info_file = Outputs.file(
description='A JSON that specifies the data type and units for comfort map '
'outputs. This JSON is needed by interfaces to correctly parse comfort map '
'results.', path='results_info.json'
description='A JSON that specifies the data type and units for all comfort map '
'outputs.', path='results_info.json'
)

temperature_info = Outputs.file(
description='A JSON that specifies the data type and units for temperature map '
'results.', path='output/temperature.json'
)

condition_info = Outputs.file(
description='A JSON that specifies the data type and units for thermal '
'condition map results.', path='output/condition.json'
)

condition_intensity_info = Outputs.file(
description='A JSON that specifies the data type and units for '
'condition intensity map results.', path='output/condition_intensity.json'
)


@dataclass
class Tcp(Function):
"""Compute Thermal Comfort Petcent (TCP) from thermal condition CSV map."""

condition_csv = Inputs.file(
description='A CSV file of thermal conditions output by a thermal mapping '
'function.', path='condition.csv', extensions=['csv', 'cond']
)

enclosure_info = Inputs.file(
description='A JSON file containing information about the radiant '
'enclosure that sensor points belong to.', path='enclosure_info.json',
extensions=['json']
)

occ_schedule_json = Inputs.file(
description='An occupancy schedule JSON output by the honeybee-energy '
'model-occ-schedules function.', path='occ_schedule.json',
extensions=['json']
)

@command
def compute_tcp(self):
return 'ladybug-comfort map tcp {{self.condition_csv}} ' \
'{{self.enclosure_info}} --occ-schedule-json "{{self.occ_schedule_json}}" ' \
'--folder output'

tcp = Outputs.file(
description='A CSV that contains the Thermal Comfort Percent (TCP) for '
'each sensor.', path='output/tcp.csv'
)

hsp = Outputs.file(
description='A CSV that contains the Heat Sensation Percent (HSP) for '
'each sensor.', path='output/hsp.csv'
)

csp = Outputs.file(
description='A CSV that contains the Cold Sensation Percent (CSP) for '
'each sensor.', path='output/csp.csv'
)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pollination-dsl>=0.10.0
ladybug-comfort>=0.11.7
ladybug-comfort>=0.12.1
9 changes: 8 additions & 1 deletion tests/map_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pollination.ladybug_comfort.map import PmvMap, AdaptiveMap, UtciMap, MapResultInfo
from pollination.ladybug_comfort.map import PmvMap, AdaptiveMap, UtciMap, \
MapResultInfo, Tcp
from queenbee.plugin.function import Function


Expand All @@ -24,3 +25,9 @@ def test_map_result_info():
function = MapResultInfo().queenbee
assert function.name == 'map-result-info'
assert isinstance(function, Function)


def test_tcp():
function = Tcp().queenbee
assert function.name == 'tcp'
assert isinstance(function, Function)

0 comments on commit b821740

Please sign in to comment.