Skip to content

Commit

Permalink
fix(thermal_map): Expose comfort parameters on UTCI map
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Sep 15, 2023
1 parent ddd8e08 commit 4d0728a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
11 changes: 9 additions & 2 deletions honeybee_grasshopper_energy/json/HB_UTCI_Comfort_Map.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.6.0",
"version": "1.6.1",
"nickname": "UTCIMap",
"outputs": [
[
Expand Down Expand Up @@ -104,6 +104,13 @@
"type": "System.Object",
"default": null
},
{
"access": "item",
"name": "comfort_par_",
"description": "Optional comfort parameters from the \"LB UTCI Comfort Parameters\"\ncomponent to specify the temperatures (in Celcius) that are\nconsidered acceptable/comfortable. The default will assume a that\nthe comfort range is between 9C and 26C.",
"type": "string",
"default": null
},
{
"access": "item",
"name": "solar_body_par_",
Expand Down Expand Up @@ -134,7 +141,7 @@
}
],
"subcategory": "7 :: Thermal Map",
"code": "\nimport os\n\ntry:\n from lbt_recipes.recipe import Recipe\n from honeybee.model import Model\nexcept ImportError as e:\n raise ImportError('\\nFailed to import lbt_recipes:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.config import units_system\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, recipe_result\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component) and _run:\n # create the recipe and set the input arguments\n recipe = Recipe('utci_comfort_map')\n recipe.input_value_by_name('model', _model)\n recipe.input_value_by_name('epw', _epw)\n recipe.input_value_by_name('ddy', ddy_)\n recipe.input_value_by_name('north', north_)\n recipe.input_value_by_name('run-period', run_period_)\n if isinstance(_wind_speed_, str) and os.path.isdir(_wind_speed_):\n recipe.input_value_by_name('air-speed-matrices', _wind_speed_)\n else:\n recipe.input_value_by_name('wind-speed', _wind_speed_)\n recipe.input_value_by_name('schedule', schedule_)\n recipe.input_value_by_name('solarcal-parameters', solar_body_par_)\n recipe.input_value_by_name('radiance-parameters', radiance_par_)\n\n # perform an extra check for units because many people forget to check them\n if isinstance(_model, Model):\n check_model = _model\n if check_model.units != 'Meters':\n check_model = _model.duplicate()\n check_model.convert_to_units('Meters')\n # remove degenerate geometry within native E+ tolerance of 0.01 meters\n for room in check_model.rooms:\n try:\n room.remove_colinear_vertices_envelope(\n tolerance=0.01, delete_degenerate=True)\n except AssertionError as e: # room removed; likely wrong units\n error = 'Your Model units system is: {}. ' \\\n 'Is this correct?\\n{}'.format(_model.units, e)\n raise ValueError(error)\n\n # run the recipe\n silent = True if _run > 1 else False\n project_folder = recipe.run(\n run_settings_, radiance_check=True, openstudio_check=True, silent=silent)\n\n # load the results\n try:\n env_conds = recipe_result(recipe.output_value_by_name('environmental-conditions', project_folder))\n utci = recipe_result(recipe.output_value_by_name('utci', project_folder))\n condition = recipe_result(recipe.output_value_by_name('condition', project_folder))\n category = recipe_result(recipe.output_value_by_name('category', project_folder))\n TCP = recipe_result(recipe.output_value_by_name('tcp', project_folder))\n HSP = recipe_result(recipe.output_value_by_name('hsp', project_folder))\n CSP = recipe_result(recipe.output_value_by_name('csp', project_folder))\n except Exception:\n raise Exception(recipe.failure_message(project_folder))\n",
"code": "\nimport os\n\ntry:\n from lbt_recipes.recipe import Recipe\n from honeybee.model import Model\nexcept ImportError as e:\n raise ImportError('\\nFailed to import lbt_recipes:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.config import units_system\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, recipe_result\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component) and _run:\n # create the recipe and set the input arguments\n recipe = Recipe('utci_comfort_map')\n recipe.input_value_by_name('model', _model)\n recipe.input_value_by_name('epw', _epw)\n recipe.input_value_by_name('ddy', ddy_)\n recipe.input_value_by_name('north', north_)\n recipe.input_value_by_name('run-period', run_period_)\n if isinstance(_wind_speed_, str) and os.path.isdir(_wind_speed_):\n recipe.input_value_by_name('air-speed-matrices', _wind_speed_)\n else:\n recipe.input_value_by_name('wind-speed', _wind_speed_)\n recipe.input_value_by_name('schedule', schedule_)\n recipe.input_value_by_name('comfort-parameters', comfort_par_)\n recipe.input_value_by_name('solarcal-parameters', solar_body_par_)\n recipe.input_value_by_name('radiance-parameters', radiance_par_)\n\n # perform an extra check for units because many people forget to check them\n if isinstance(_model, Model):\n check_model = _model\n if check_model.units != 'Meters':\n check_model = _model.duplicate()\n check_model.convert_to_units('Meters')\n # remove degenerate geometry within native E+ tolerance of 0.01 meters\n for room in check_model.rooms:\n try:\n room.remove_colinear_vertices_envelope(\n tolerance=0.01, delete_degenerate=True)\n except AssertionError as e: # room removed; likely wrong units\n error = 'Your Model units system is: {}. ' \\\n 'Is this correct?\\n{}'.format(_model.units, e)\n raise ValueError(error)\n\n # run the recipe\n silent = True if _run > 1 else False\n project_folder = recipe.run(\n run_settings_, radiance_check=True, openstudio_check=True, silent=silent)\n\n # load the results\n try:\n env_conds = recipe_result(recipe.output_value_by_name('environmental-conditions', project_folder))\n utci = recipe_result(recipe.output_value_by_name('utci', project_folder))\n condition = recipe_result(recipe.output_value_by_name('condition', project_folder))\n category = recipe_result(recipe.output_value_by_name('category', project_folder))\n TCP = recipe_result(recipe.output_value_by_name('tcp', project_folder))\n HSP = recipe_result(recipe.output_value_by_name('hsp', project_folder))\n CSP = recipe_result(recipe.output_value_by_name('csp', project_folder))\n except Exception:\n raise Exception(recipe.failure_message(project_folder))\n",
"category": "HB-Energy",
"name": "HB UTCI Comfort Map",
"description": "Compute spatially-resolved Universal Thermal Climate Index (UTCI) and heat/cold\nstress conditions an EPW and Honeybee model.\n_\nThis recipe uses EnergyPlus to obtain surface temperatures and indoor air\ntemperatures + humidities. Outdoor air temperatures, relative humidities, and\nair speeds are taken directly from the EPW. The energy properties of the model\ngeometry are what determine the outcome of the simulation, though the model's\nRadiance sensor grids are what determine where the comfort mapping occurs.\n_\nLongwave radiant temperatures are obtained by computing spherical view factors\nfrom each sensor to the Room surfaces of the model using Radiance. These view factors\nare then multiplied by the surface temperatures output by EnergyPlus to yield\nlongwave MRT at each sensor. For outdoor sensors, each sensor's sky view is multiplied\nby the EPW sky temperature to account for longwave radiant exchange with the sky.\nAll outdoor context shades and the ground are assumed to be at the EPW air\ntemperature unless they have been modeled as Honeybee rooms.\n_\nA Radiance-based enhanced 2-phase method is used for all shortwave MRT calculations,\nwhich precisely represents direct sun by tracing a ray from each sensor to the\nsolar position. To determine Thermal Comfort Percent (TCP), the occupancy schedules\nof the energy model are used for indoor sensors if no schedule_ is input. Any\nhour of the energy model occupancy schedule that is 0.1 or greater will be\nconsidered occupied. If no schedule_ is input, all hours of the outdoors are\nconsidered occupied.\n-"
Expand Down
7 changes: 6 additions & 1 deletion honeybee_grasshopper_energy/src/HB UTCI Comfort Map.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
If unspecified, it will be assumed that all times are relevant for
outdoor sensors and the energy model occupancy schedules will be
used for indoor sensors.
comfort_par_: Optional comfort parameters from the "LB UTCI Comfort Parameters"
component to specify the temperatures (in Celcius) that are
considered acceptable/comfortable. The default will assume a that
the comfort range is between 9C and 26C.
solar_body_par_: Optional solar body parameters from the "LB Solar Body Parameters"
object to specify the properties of the human geometry assumed in the
shortwave MRT calculation. The default assumes average skin/clothing
Expand Down Expand Up @@ -154,7 +158,7 @@

ghenv.Component.Name = 'HB UTCI Comfort Map'
ghenv.Component.NickName = 'UTCIMap'
ghenv.Component.Message = '1.6.0'
ghenv.Component.Message = '1.6.1'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '7 :: Thermal Map'
ghenv.Component.AdditionalHelpFromDocStrings = '1'
Expand Down Expand Up @@ -187,6 +191,7 @@
else:
recipe.input_value_by_name('wind-speed', _wind_speed_)
recipe.input_value_by_name('schedule', schedule_)
recipe.input_value_by_name('comfort-parameters', comfort_par_)
recipe.input_value_by_name('solarcal-parameters', solar_body_par_)
recipe.input_value_by_name('radiance-parameters', radiance_par_)

Expand Down
Binary file modified honeybee_grasshopper_energy/user_objects/HB UTCI Comfort Map.ghuser
Binary file not shown.

0 comments on commit 4d0728a

Please sign in to comment.