Skip to content

Commit

Permalink
fix(apply): Update components to assign properties to Models
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Oct 1, 2023
1 parent 4d0728a commit 5e48793
Show file tree
Hide file tree
Showing 44 changed files with 253 additions and 128 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Apply ConstructionSet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Apply Daylight Control.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Apply Load Values.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Apply ProgramType.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Apply Room Schedules.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Apply Setpoint Values.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Apply Shade Construction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Apply Shade Schedule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.6.1",
"version": "1.6.2",
"nickname": "AbsoluteLoadVals",
"outputs": [
[
Expand All @@ -16,7 +16,7 @@
{
"access": "list",
"name": "_rooms",
"description": "Honeybee Rooms to which the input load values should be assigned.",
"description": "Honeybee Rooms to which the input load values should be assigned.\nThis can also be a Honeybee Model for which all Rooms will be\nassigned the loads.",
"type": "System.Object",
"default": null
},
Expand Down Expand Up @@ -71,7 +71,7 @@
}
],
"subcategory": "3 :: Loads",
"code": "\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list\n from ladybug_{{cad}}.config import conversion_to_meters\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n conversion = conversion_to_meters()\n rooms = [room.duplicate() for room in _rooms] # duplicate the initial objects\n\n # assign the person_count_\n if len(person_count_) != 0:\n for i, room in enumerate(rooms):\n room.properties.energy.absolute_people(\n longest_list(person_count_, i), conversion)\n\n # assign the lighting_watts_\n if len(lighting_watts_) != 0:\n for i, room in enumerate(rooms):\n room.properties.energy.absolute_lighting(\n longest_list(lighting_watts_, i), conversion)\n\n # assign the electric_watts_\n if len(electric_watts_) != 0:\n for i, room in enumerate(rooms):\n room.properties.energy.absolute_electric_equipment(\n longest_list(electric_watts_, i), conversion)\n\n # assign the gas_watts_\n if len(gas_watts_) != 0:\n for i, room in enumerate(rooms):\n room.properties.energy.absolute_gas_equipment(\n longest_list(gas_watts_, i), conversion)\n\n # assign the hot_wtr_flow_\n if len(hot_wtr_flow_) != 0:\n for i, room in enumerate(rooms):\n room.properties.energy.absolute_service_hot_water(\n longest_list(hot_wtr_flow_, i), conversion)\n\n # assign the infiltration_ach_\n if len(infiltration_ach_) != 0:\n for i, room in enumerate(rooms):\n room.properties.energy.absolute_infiltration_ach(\n longest_list(infiltration_ach_, i), conversion)\n\n # assign the vent_flow_\n if len(vent_flow_) != 0:\n for i, room in enumerate(rooms):\n room.properties.energy.absolute_ventilation(longest_list(vent_flow_, i))\n",
"code": "\ntry:\n from honeybee.model import Model\n from honeybee.room import Room\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list\n from ladybug_{{cad}}.config import conversion_to_meters\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n conversion = conversion_to_meters()\n rooms = [room.duplicate() for room in _rooms] # duplicate the initial objects\n\n # extract any rooms from the input Models\n hb_objs = []\n for hb_obj in rooms:\n if isinstance(hb_obj, Model):\n hb_objs.extend(hb_obj.rooms)\n elif isinstance(hb_obj, Room):\n hb_objs.append(hb_obj)\n else:\n raise ValueError(\n 'Expected Honeybee Room or Model. Got {}.'.format(type(hb_obj)))\n\n # assign the person_count_\n if len(person_count_) != 0:\n for i, room in enumerate(hb_objs):\n room.properties.energy.absolute_people(\n longest_list(person_count_, i), conversion)\n\n # assign the lighting_watts_\n if len(lighting_watts_) != 0:\n for i, room in enumerate(hb_objs):\n room.properties.energy.absolute_lighting(\n longest_list(lighting_watts_, i), conversion)\n\n # assign the electric_watts_\n if len(electric_watts_) != 0:\n for i, room in enumerate(hb_objs):\n room.properties.energy.absolute_electric_equipment(\n longest_list(electric_watts_, i), conversion)\n\n # assign the gas_watts_\n if len(gas_watts_) != 0:\n for i, room in enumerate(hb_objs):\n room.properties.energy.absolute_gas_equipment(\n longest_list(gas_watts_, i), conversion)\n\n # assign the hot_wtr_flow_\n if len(hot_wtr_flow_) != 0:\n for i, room in enumerate(hb_objs):\n room.properties.energy.absolute_service_hot_water(\n longest_list(hot_wtr_flow_, i), conversion)\n\n # assign the infiltration_ach_\n if len(infiltration_ach_) != 0:\n for i, room in enumerate(hb_objs):\n room.properties.energy.absolute_infiltration_ach(\n longest_list(infiltration_ach_, i), conversion)\n\n # assign the vent_flow_\n if len(vent_flow_) != 0:\n for i, room in enumerate(hb_objs):\n room.properties.energy.absolute_ventilation(longest_list(vent_flow_, i))\n",
"category": "HB-Energy",
"name": "HB Apply Abolute Load Values",
"description": "Apply absolute load values to Rooms.\n_\nNote that, while the assigned load values are absolute, this component will convert\nthem to the \"normalized\" value for each room (eg. lighting per floor area) in\norder to apply them to the rooms. So any existing specification of load intensity\nis overwritten with the absolute load here.\n_\nThis also means that, if a room has no floors (or exterior walls for infiltration),\nthe resulting load values will be equal to 0 regardless of the input here. The\nonly exception is the vent_flow_, which will be applied regardless of the room\nproperties.\n_\nThis component will not edit any of the schedules or other properties associated\nwith each load value. If no schedule currently exists to describe how the load\nvaries over the simulation, the \"Always On\" schedule will be used as a default.\n-"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.6.0",
"version": "1.6.1",
"nickname": "ApplyConstrSet",
"outputs": [
[
Expand All @@ -16,7 +16,7 @@
{
"access": "list",
"name": "_rooms",
"description": "Honeybee Rooms to which the input _constr_set should be assigned.",
"description": "Honeybee Rooms to which the input _constr_set should be assigned.\nThis can also be a Honeybee Model for which all Rooms will be\nassigned the ConstructionSet.",
"type": "System.Object",
"default": null
},
Expand All @@ -29,8 +29,8 @@
}
],
"subcategory": "1 :: Constructions",
"code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructionsets import construction_set_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n rooms = [obj.duplicate() for obj in _rooms]\n \n # process the input construction set if it's a string\n if isinstance(_constr_set, str):\n _constr_set = construction_set_by_identifier(_constr_set)\n \n # assign the construction set\n for rm in rooms:\n rm.properties.energy.construction_set = _constr_set\n",
"code": "\ntry: # import the honeybee extension\n from honeybee.model import Model\n from honeybee.room import Room\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructionsets import construction_set_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n rooms = [obj.duplicate() for obj in _rooms]\n\n # extract any rooms from the input Models\n hb_objs = []\n for hb_obj in rooms:\n if isinstance(hb_obj, Model):\n hb_objs.extend(hb_obj.rooms)\n elif isinstance(hb_obj, Room):\n hb_objs.append(hb_obj)\n else:\n raise ValueError(\n 'Expected Honeybee Room or Model. Got {}.'.format(type(hb_obj)))\n\n # process the input construction set if it's a string\n if isinstance(_constr_set, str):\n _constr_set = construction_set_by_identifier(_constr_set)\n\n # assign the construction set\n for rm in hb_objs:\n rm.properties.energy.construction_set = _constr_set\n",
"category": "HB-Energy",
"name": "HB Apply ConstructionSet",
"description": "Apply ConstructionSet to Honeybee Rooms.\n-"
"description": "Apply ConstructionSet to Honeybee Rooms or a Model.\n-"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.6.1",
"version": "1.6.2",
"nickname": "DaylightControl",
"outputs": [
[
Expand All @@ -16,7 +16,7 @@
{
"access": "list",
"name": "_rooms",
"description": "Honeybee Rooms to which simple daylight controls should be assigned.",
"description": "Honeybee Rooms to which simple daylight controls should be assigned.\nThis can also be a Honeybee Model for which all Rooms will be\nassigned daylight control sensors.",
"type": "System.Object",
"default": null
},
Expand Down Expand Up @@ -64,7 +64,7 @@
}
],
"subcategory": "3 :: Loads",
"code": "\ntry: # import the honeybee-energy extension\n from honeybee_energy.load.daylight import DaylightingControl\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.togeometry import to_point3d\n from ladybug_{{cad}}.config import conversion_to_meters, tolerance\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list, \\\n give_warning\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n rooms = [room.duplicate() for room in _rooms]\n\n # set default values and perform checks\n dist_from_floor = 0.8 / conversion_to_meters()\n if len(_sensor_points_) != 0:\n assert len(_sensor_points_) == len(_rooms), 'Number of sensor points ({}) ' \\\n 'must align exactly with the number of rooms ({}).'.format(\n len(_sensor_points_), len(_rooms))\n _ill_setpoint_ = [300] if len(_ill_setpoint_) == 0 else _ill_setpoint_\n _control_fract_ = [1] if len(_control_fract_) == 0 else _control_fract_\n _min_power_in_ = [0.3] if len(_min_power_in_) == 0 else _min_power_in_\n _min_light_out_ = [0.2] if len(_min_light_out_) == 0 else _min_light_out_\n off_at_min_ = [False] if len(off_at_min_) == 0 else off_at_min_\n\n # loop through the rooms and assign daylight sensors\n unassigned_rooms = []\n if len(_sensor_points_) == 0:\n for i, room in enumerate(rooms):\n dl_control = room.properties.energy.add_daylight_control_to_center(\n dist_from_floor, longest_list(_ill_setpoint_, i),\n longest_list(_control_fract_, i), longest_list(_min_power_in_, i),\n longest_list(_min_light_out_, i), longest_list(off_at_min_, i),\n tolerance)\n if dl_control is None:\n unassigned_rooms.append(room.display_name)\n else:\n for i, room in enumerate(rooms):\n sensor_pt = to_point3d(_sensor_points_[i])\n if room.geometry.is_point_inside(sensor_pt):\n dl_control = DaylightingControl(\n sensor_pt, longest_list(_ill_setpoint_, i),\n longest_list(_control_fract_, i), longest_list(_min_power_in_, i),\n longest_list(_min_light_out_, i), longest_list(off_at_min_, i))\n room.properties.energy.daylighting_control = dl_control\n else:\n unassigned_rooms.append(room.display_name)\n\n # give a warning about any rooms to which a sensor could not be assinged\n for room in unassigned_rooms:\n msg = 'Sensor point for room \"{}\" does not lie within the room volume.\\n' \\\n 'No daylight sensors have been added to this room.'.format(room)\n print(msg)\n give_warning(ghenv.Component, msg)\n",
"code": "\ntry:\n from honeybee.model import Model\n from honeybee.room import Room\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.load.daylight import DaylightingControl\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.togeometry import to_point3d\n from ladybug_{{cad}}.config import conversion_to_meters, tolerance\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list, \\\n give_warning\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n rooms = [room.duplicate() for room in _rooms]\n\n # extract any rooms from the input Models\n hb_objs = []\n for hb_obj in rooms:\n if isinstance(hb_obj, Model):\n hb_objs.extend(hb_obj.rooms)\n elif isinstance(hb_obj, Room):\n hb_objs.append(hb_obj)\n else:\n raise ValueError(\n 'Expected Honeybee Room or Model. Got {}.'.format(type(hb_obj)))\n\n # set default values and perform checks\n dist_from_floor = 0.8 / conversion_to_meters()\n if len(_sensor_points_) != 0:\n assert len(_sensor_points_) == len(hb_objs), 'Number of sensor points ({}) ' \\\n 'must align exactly with the number of rooms ({}).'.format(\n len(_sensor_points_), len(hb_objs))\n _ill_setpoint_ = [300] if len(_ill_setpoint_) == 0 else _ill_setpoint_\n _control_fract_ = [1] if len(_control_fract_) == 0 else _control_fract_\n _min_power_in_ = [0.3] if len(_min_power_in_) == 0 else _min_power_in_\n _min_light_out_ = [0.2] if len(_min_light_out_) == 0 else _min_light_out_\n off_at_min_ = [False] if len(off_at_min_) == 0 else off_at_min_\n\n # loop through the rooms and assign daylight sensors\n unassigned_rooms = []\n if len(_sensor_points_) == 0:\n for i, room in enumerate(hb_objs):\n dl_control = room.properties.energy.add_daylight_control_to_center(\n dist_from_floor, longest_list(_ill_setpoint_, i),\n longest_list(_control_fract_, i), longest_list(_min_power_in_, i),\n longest_list(_min_light_out_, i), longest_list(off_at_min_, i),\n tolerance)\n if dl_control is None:\n unassigned_rooms.append(room.display_name)\n else:\n for i, room in enumerate(hb_objs):\n sensor_pt = to_point3d(_sensor_points_[i])\n if room.geometry.is_point_inside(sensor_pt):\n dl_control = DaylightingControl(\n sensor_pt, longest_list(_ill_setpoint_, i),\n longest_list(_control_fract_, i), longest_list(_min_power_in_, i),\n longest_list(_min_light_out_, i), longest_list(off_at_min_, i))\n room.properties.energy.daylighting_control = dl_control\n else:\n unassigned_rooms.append(room.display_name)\n\n # give a warning about any rooms to which a sensor could not be assinged\n for room in unassigned_rooms:\n msg = 'Sensor point for room \"{}\" does not lie within the room volume.\\n' \\\n 'No daylight sensors have been added to this room.'.format(room)\n print(msg)\n give_warning(ghenv.Component, msg)\n",
"category": "HB-Energy",
"name": "HB Apply Daylight Control",
"description": "Apply simple daylight controls to Rooms.\n_\nSuch simple controls will dim the lights in the energy simulation according to\nwhether the illuminance at a sensor location is at a target illuminance setpoint.\nThe method used to estimate illuiminance is fairly simple and, for more detailed\ncontrol over the parameters used to compute illuminance, the \"HB Daylight Control\nSchedule\" component under HB-Radiance should be used.\n-"
Expand Down
Loading

0 comments on commit 5e48793

Please sign in to comment.