diff --git a/honeybee_grasshopper_energy/icon/HB Apply Abolute Load Values.png b/honeybee_grasshopper_energy/icon/HB Apply Abolute Load Values.png index 37f9a421..108d1d9d 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Abolute Load Values.png and b/honeybee_grasshopper_energy/icon/HB Apply Abolute Load Values.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply ConstructionSet.png b/honeybee_grasshopper_energy/icon/HB Apply ConstructionSet.png index 49cdd2fa..48c8b9a0 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply ConstructionSet.png and b/honeybee_grasshopper_energy/icon/HB Apply ConstructionSet.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply Daylight Control.png b/honeybee_grasshopper_energy/icon/HB Apply Daylight Control.png index 64320835..9e9b9234 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Daylight Control.png and b/honeybee_grasshopper_energy/icon/HB Apply Daylight Control.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply Load Values.png b/honeybee_grasshopper_energy/icon/HB Apply Load Values.png index b2a7677a..0d2ee530 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Load Values.png and b/honeybee_grasshopper_energy/icon/HB Apply Load Values.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply Opaque Construction.png b/honeybee_grasshopper_energy/icon/HB Apply Opaque Construction.png index 71b52439..ca79b4fc 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Opaque Construction.png and b/honeybee_grasshopper_energy/icon/HB Apply Opaque Construction.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply ProgramType.png b/honeybee_grasshopper_energy/icon/HB Apply ProgramType.png index 4b90b319..94b9bedc 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply ProgramType.png and b/honeybee_grasshopper_energy/icon/HB Apply ProgramType.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply Room Schedules.png b/honeybee_grasshopper_energy/icon/HB Apply Room Schedules.png index b3300761..fe79ec89 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Room Schedules.png and b/honeybee_grasshopper_energy/icon/HB Apply Room Schedules.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply Setpoint Values.png b/honeybee_grasshopper_energy/icon/HB Apply Setpoint Values.png index 09b58a08..0e7c508f 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Setpoint Values.png and b/honeybee_grasshopper_energy/icon/HB Apply Setpoint Values.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply Shade Construction.png b/honeybee_grasshopper_energy/icon/HB Apply Shade Construction.png index e677b43d..93c9a811 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Shade Construction.png and b/honeybee_grasshopper_energy/icon/HB Apply Shade Construction.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply Shade Schedule.png b/honeybee_grasshopper_energy/icon/HB Apply Shade Schedule.png index d74d05b8..a8047308 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Shade Schedule.png and b/honeybee_grasshopper_energy/icon/HB Apply Shade Schedule.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Apply Window Construction.png b/honeybee_grasshopper_energy/icon/HB Apply Window Construction.png index 45324e15..573854f2 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Apply Window Construction.png and b/honeybee_grasshopper_energy/icon/HB Apply Window Construction.png differ diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Abolute_Load_Values.json b/honeybee_grasshopper_energy/json/HB_Apply_Abolute_Load_Values.json index 3717ce94..851adbd5 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Abolute_Load_Values.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Abolute_Load_Values.json @@ -1,5 +1,5 @@ { - "version": "1.6.1", + "version": "1.6.2", "nickname": "AbsoluteLoadVals", "outputs": [ [ @@ -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 }, @@ -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-" diff --git a/honeybee_grasshopper_energy/json/HB_Apply_ConstructionSet.json b/honeybee_grasshopper_energy/json/HB_Apply_ConstructionSet.json index a65e5863..7e255d32 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_ConstructionSet.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_ConstructionSet.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplyConstrSet", "outputs": [ [ @@ -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 }, @@ -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-" } \ No newline at end of file diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Daylight_Control.json b/honeybee_grasshopper_energy/json/HB_Apply_Daylight_Control.json index 7bc58430..8ab139d7 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Daylight_Control.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Daylight_Control.json @@ -1,5 +1,5 @@ { - "version": "1.6.1", + "version": "1.6.2", "nickname": "DaylightControl", "outputs": [ [ @@ -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 }, @@ -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-" diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Load_Values.json b/honeybee_grasshopper_energy/json/HB_Apply_Load_Values.json index c7247216..d136834b 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Load_Values.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Load_Values.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplyLoadVals", "outputs": [ [ @@ -16,7 +16,7 @@ { "access": "list", "name": "_room_or_program", - "description": "Honeybee Rooms or ProgramType objects to which the input\nload objects should be assigned. This can also be the identifier of a\nProgramType to be looked up in the program type library.", + "description": "Honeybee Rooms or ProgramType objects to which the input\nload objects should be assigned. This can also be the identifier of a\nProgramType to be looked up in the program type library. This can\nalso be a Honeybee Model for which all Rooms will be assigned\nthe loads.", "type": "System.Object", "default": null }, @@ -85,7 +85,7 @@ } ], "subcategory": "3 :: Loads", - "code": "\nimport uuid\n\ntry:\n from honeybee.room import Room\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.load.people import People\n from honeybee_energy.load.lighting import Lighting\n from honeybee_energy.load.equipment import ElectricEquipment, GasEquipment\n from honeybee_energy.load.hotwater import ServiceHotWater\n from honeybee_energy.load.infiltration import Infiltration\n from honeybee_energy.load.ventilation import Ventilation\n from honeybee_energy.lib.schedules import schedule_by_identifier\n from honeybee_energy.lib.programtypes import program_type_by_identifier, \\\n building_program_type_by_identifier\n from honeybee_energy.programtype import ProgramType\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\n# get the always on schedule\nalways_on = schedule_by_identifier('Always On')\n\n\ndef dup_load(hb_obj, object_name, object_class):\n \"\"\"Duplicate a load object assigned to a Room or ProgramType.\"\"\"\n # try to get the load object assgined to the Room or ProgramType\n try: # assume it's a Room\n load_obj = hb_obj.properties\n for attribute in ('energy', object_name):\n load_obj = getattr(load_obj, attribute)\n except AttributeError: # it's a ProgramType\n load_obj = getattr(hb_obj, object_name)\n\n load_id = '{}_{}'.format(hb_obj.identifier, object_name)\n try: # duplicate the load object\n dup_load = load_obj.duplicate()\n dup_load.identifier = load_id\n return dup_load\n except AttributeError: # create a new object\n try: # assume it's People, Lighting, Equipment or Infiltration\n return object_class(load_id, 0, always_on)\n except: # it's a Ventilation object\n return object_class(load_id)\n\n\ndef assign_load(hb_obj, load_obj, object_name):\n \"\"\"Assign a load object to a Room or a ProgramType.\"\"\"\n try: # assume it's a Room\n setattr(hb_obj.properties.energy, object_name, load_obj)\n except AttributeError: # it's a ProgramType\n setattr(hb_obj, object_name, load_obj)\n\n\ndef duplicate_and_id_program(program):\n \"\"\"Duplicate a program and give it a new unique ID.\"\"\"\n new_prog = program.duplicate()\n new_prog.identifier = '{}_{}'.format(program.identifier, str(uuid.uuid4())[:8])\n return new_prog\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n mod_obj = []\n for obj in _room_or_program:\n if isinstance(obj, Room):\n mod_obj.append(obj.duplicate())\n elif isinstance(obj, ProgramType):\n mod_obj.append(duplicate_and_id_program(obj))\n elif isinstance(obj, str):\n try:\n program = building_program_type_by_identifier(obj)\n except ValueError:\n program = program_type_by_identifier(obj)\n mod_obj.append(duplicate_and_id_program(program))\n else:\n raise TypeError('Expected Honeybee Room or ProgramType. '\n 'Got {}.'.format(type(obj)))\n\n # assign the people_per_floor_\n if len(people_per_floor_) != 0:\n for i, obj in enumerate(mod_obj):\n people = dup_load(obj, 'people', People)\n people.people_per_area = longest_list(people_per_floor_, i)\n assign_load(obj, people, 'people')\n\n # assign the lighting_per_floor_\n if len(lighting_per_floor_) != 0:\n for i, obj in enumerate(mod_obj):\n lighting = dup_load(obj, 'lighting', Lighting)\n lighting.watts_per_area = longest_list(lighting_per_floor_, i)\n assign_load(obj, lighting, 'lighting')\n\n # assign the electric_per_floor_\n if len(electric_per_floor_) != 0:\n for i, obj in enumerate(mod_obj):\n equip = dup_load(obj, 'electric_equipment', ElectricEquipment)\n equip.watts_per_area = longest_list(electric_per_floor_, i)\n assign_load(obj, equip, 'electric_equipment')\n\n # assign the gas_per_floor_\n if len(gas_per_floor_) != 0:\n for i, obj in enumerate(mod_obj):\n equip = dup_load(obj, 'gas_equipment', GasEquipment)\n equip.watts_per_area = longest_list(gas_per_floor_, i)\n assign_load(obj, equip, 'gas_equipment')\n\n # assign the hot_wtr_per_floor_\n if len(hot_wtr_per_floor_) != 0:\n for i, obj in enumerate(mod_obj):\n shw = dup_load(obj, 'service_hot_water', ServiceHotWater)\n shw.flow_per_area = longest_list(hot_wtr_per_floor_, i)\n assign_load(obj, shw, 'service_hot_water')\n\n # assign the infilt_per_exterior_\n if len(infilt_per_exterior_) != 0:\n for i, obj in enumerate(mod_obj):\n infilt = dup_load(obj, 'infiltration', Infiltration)\n infilt.flow_per_exterior_area = longest_list(infilt_per_exterior_, i)\n assign_load(obj, infilt, 'infiltration')\n\n # assign the vent_per_floor_\n if len(vent_per_floor_) != 0:\n for i, obj in enumerate(mod_obj):\n vent = dup_load(obj, 'ventilation', Ventilation)\n vent.flow_per_area = longest_list(vent_per_floor_, i)\n assign_load(obj, vent, 'ventilation')\n\n # assign the vent_per_person_\n if len(vent_per_person_) != 0:\n for i, obj in enumerate(mod_obj):\n vent = dup_load(obj, 'ventilation', Ventilation)\n vent.flow_per_person = longest_list(vent_per_person_, i)\n assign_load(obj, vent, 'ventilation')\n\n # assign the vent_ach_\n if len(vent_ach_) != 0:\n for i, obj in enumerate(mod_obj):\n vent = dup_load(obj, 'ventilation', Ventilation)\n vent.air_changes_per_hour = longest_list(vent_ach_, i)\n assign_load(obj, vent, 'ventilation')\n", + "code": "\nimport uuid\n\ntry:\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:\n from honeybee_energy.load.people import People\n from honeybee_energy.load.lighting import Lighting\n from honeybee_energy.load.equipment import ElectricEquipment, GasEquipment\n from honeybee_energy.load.hotwater import ServiceHotWater\n from honeybee_energy.load.infiltration import Infiltration\n from honeybee_energy.load.ventilation import Ventilation\n from honeybee_energy.lib.schedules import schedule_by_identifier\n from honeybee_energy.lib.programtypes import program_type_by_identifier, \\\n building_program_type_by_identifier\n from honeybee_energy.programtype import ProgramType\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\n# get the always on schedule\nalways_on = schedule_by_identifier('Always On')\n\n\ndef dup_load(hb_obj, object_name, object_class):\n \"\"\"Duplicate a load object assigned to a Room or ProgramType.\"\"\"\n # try to get the load object assgined to the Room or ProgramType\n try: # assume it's a Room\n load_obj = hb_obj.properties\n for attribute in ('energy', object_name):\n load_obj = getattr(load_obj, attribute)\n except AttributeError: # it's a ProgramType\n load_obj = getattr(hb_obj, object_name)\n\n load_id = '{}_{}'.format(hb_obj.identifier, object_name)\n try: # duplicate the load object\n dup_load = load_obj.duplicate()\n dup_load.identifier = load_id\n return dup_load\n except AttributeError: # create a new object\n try: # assume it's People, Lighting, Equipment or Infiltration\n return object_class(load_id, 0, always_on)\n except: # it's a Ventilation object\n return object_class(load_id)\n\n\ndef assign_load(hb_obj, load_obj, object_name):\n \"\"\"Assign a load object to a Room or a ProgramType.\"\"\"\n try: # assume it's a Room\n setattr(hb_obj.properties.energy, object_name, load_obj)\n except AttributeError: # it's a ProgramType\n setattr(hb_obj, object_name, load_obj)\n\n\ndef duplicate_and_id_program(program):\n \"\"\"Duplicate a program and give it a new unique ID.\"\"\"\n new_prog = program.duplicate()\n new_prog.identifier = '{}_{}'.format(program.identifier, str(uuid.uuid4())[:8])\n return new_prog\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n mod_obj, edit_objs = [], []\n for obj in _room_or_program:\n if isinstance(obj, Room):\n new_obj = obj.duplicate()\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n elif isinstance(obj, Model):\n new_obj = obj.duplicate()\n mod_obj.append(new_obj)\n edit_objs.extend(new_obj.rooms)\n elif isinstance(obj, ProgramType):\n new_obj = duplicate_and_id_program(obj)\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n elif isinstance(obj, str):\n try:\n program = building_program_type_by_identifier(obj)\n except ValueError:\n program = program_type_by_identifier(obj)\n new_obj = duplicate_and_id_program(obj)\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n else:\n raise TypeError('Expected Honeybee Room, Model or ProgramType. '\n 'Got {}.'.format(type(obj)))\n\n # assign the people_per_floor_\n if len(people_per_floor_) != 0:\n for i, obj in enumerate(edit_objs):\n people = dup_load(obj, 'people', People)\n people.people_per_area = longest_list(people_per_floor_, i)\n assign_load(obj, people, 'people')\n\n # assign the lighting_per_floor_\n if len(lighting_per_floor_) != 0:\n for i, obj in enumerate(edit_objs):\n lighting = dup_load(obj, 'lighting', Lighting)\n lighting.watts_per_area = longest_list(lighting_per_floor_, i)\n assign_load(obj, lighting, 'lighting')\n\n # assign the electric_per_floor_\n if len(electric_per_floor_) != 0:\n for i, obj in enumerate(edit_objs):\n equip = dup_load(obj, 'electric_equipment', ElectricEquipment)\n equip.watts_per_area = longest_list(electric_per_floor_, i)\n assign_load(obj, equip, 'electric_equipment')\n\n # assign the gas_per_floor_\n if len(gas_per_floor_) != 0:\n for i, obj in enumerate(edit_objs):\n equip = dup_load(obj, 'gas_equipment', GasEquipment)\n equip.watts_per_area = longest_list(gas_per_floor_, i)\n assign_load(obj, equip, 'gas_equipment')\n\n # assign the hot_wtr_per_floor_\n if len(hot_wtr_per_floor_) != 0:\n for i, obj in enumerate(edit_objs):\n shw = dup_load(obj, 'service_hot_water', ServiceHotWater)\n shw.flow_per_area = longest_list(hot_wtr_per_floor_, i)\n assign_load(obj, shw, 'service_hot_water')\n\n # assign the infilt_per_exterior_\n if len(infilt_per_exterior_) != 0:\n for i, obj in enumerate(edit_objs):\n infilt = dup_load(obj, 'infiltration', Infiltration)\n infilt.flow_per_exterior_area = longest_list(infilt_per_exterior_, i)\n assign_load(obj, infilt, 'infiltration')\n\n # assign the vent_per_floor_\n if len(vent_per_floor_) != 0:\n for i, obj in enumerate(edit_objs):\n vent = dup_load(obj, 'ventilation', Ventilation)\n vent.flow_per_area = longest_list(vent_per_floor_, i)\n assign_load(obj, vent, 'ventilation')\n\n # assign the vent_per_person_\n if len(vent_per_person_) != 0:\n for i, obj in enumerate(edit_objs):\n vent = dup_load(obj, 'ventilation', Ventilation)\n vent.flow_per_person = longest_list(vent_per_person_, i)\n assign_load(obj, vent, 'ventilation')\n\n # assign the vent_ach_\n if len(vent_ach_) != 0:\n for i, obj in enumerate(edit_objs):\n vent = dup_load(obj, 'ventilation', Ventilation)\n vent.air_changes_per_hour = longest_list(vent_ach_, i)\n assign_load(obj, vent, 'ventilation')\n", "category": "HB-Energy", "name": "HB Apply Load Values", "description": "Apply or edit load values on a Room or ProgramType.\n_\nThis component will not edit any of the schedule objects associated with each load\nvalue. If no schedule currently exists to describe how the load varies over the\nsimulation, the \"Always On\" schedule will be used as a default.\n-" diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Opaque_Construction.json b/honeybee_grasshopper_energy/json/HB_Apply_Opaque_Construction.json index b013227d..859deec7 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Opaque_Construction.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Opaque_Construction.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplyOpaqueConstr", "outputs": [ [ @@ -16,7 +16,7 @@ { "access": "list", "name": "_hb_objs", - "description": "Honeybee Faces, Doors or Rooms to which the input _constr should\nbe assigned. For the case of a Honeybee Room, the construction\nwill only be applied to the Room's outdoor walls. Note that, if you\nneed to assign a construction to all the roofs, floors, etc. of a\nRoom, the best practice is to create a ConstructionSet and assing that\nto the Room.", + "description": "Honeybee Faces, Doors, Rooms or a Model to which the input _constr should\nbe assigned. For the case of a Room or a Model, the construction\nwill only be applied to the Room's outdoor walls. Note that, if you\nneed to assign a construction to all the roofs, floors, etc. of a\nRoom, the best practice is to create a ConstructionSet and assing that\nto the Room.", "type": "System.Object", "default": null }, @@ -29,7 +29,7 @@ } ], "subcategory": "1 :: Constructions", - "code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructions import opaque_construction_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the core honeybee dependencies\n from honeybee.boundarycondition import Outdoors\n from honeybee.facetype import Wall\n from honeybee.room import Room\n from honeybee.face import Face\n from honeybee.door import Door\n from honeybee.orientation import angles_from_num_orient, face_orient_index\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\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\ndef is_exterior_wall(face):\n \"\"\"Check whether a given Face is an exterior Wall.\"\"\"\n return isinstance(face.boundary_condition, Outdoors) and \\\n isinstance(face.type, Wall)\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n hb_objs = [obj.duplicate() for obj in _hb_objs]\n \n # process the input constructions\n for i, constr in enumerate(_constr):\n if isinstance(constr, str):\n _constr[i] = opaque_construction_by_identifier(constr)\n \n # error message for unrecognized object\n error_msg = 'Input _hb_objs must be a Room, Face, or Door. Not {}.'\n \n # assign the constructions\n if len(_constr) == 1: # assign indiscriminately, even if it's horizontal\n for obj in hb_objs:\n if isinstance(obj, (Face, Door)):\n obj.properties.energy.construction = _constr[0]\n elif isinstance(obj, Room):\n for face in obj.faces:\n if is_exterior_wall(face):\n face.properties.energy.construction = _constr[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n else: # assign constructions based on cardinal direction\n angles = angles_from_num_orient(len(_constr))\n for obj in hb_objs:\n if isinstance(obj, (Face, Door)):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n obj.properties.energy.construction = _constr[orient_i]\n elif isinstance(obj, Room):\n for face in obj.faces:\n if is_exterior_wall(face):\n orient_i = face_orient_index(face, angles)\n if orient_i is not None:\n face.properties.energy.construction = _constr[orient_i]\n else:\n raise TypeError(error_msg.format(type(obj)))\n\n", + "code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructions import opaque_construction_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the core honeybee dependencies\n from honeybee.boundarycondition import Outdoors\n from honeybee.facetype import Wall\n from honeybee.model import Model\n from honeybee.room import Room\n from honeybee.face import Face\n from honeybee.door import Door\n from honeybee.orientation import angles_from_num_orient, face_orient_index\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\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\ndef is_exterior_wall(face):\n \"\"\"Check whether a given Face is an exterior Wall.\"\"\"\n return isinstance(face.boundary_condition, Outdoors) and \\\n isinstance(face.type, Wall)\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n hb_objs = [obj.duplicate() for obj in _hb_objs]\n\n # process the input constructions\n for i, constr in enumerate(_constr):\n if isinstance(constr, str):\n _constr[i] = opaque_construction_by_identifier(constr)\n\n # error message for unrecognized object\n error_msg = 'Input _hb_objs must be a Room, Face, or Door. Not {}.'\n\n # assign the constructions\n if len(_constr) == 1: # assign indiscriminately, even if it's horizontal\n for obj in hb_objs:\n if isinstance(obj, (Face, Door)):\n obj.properties.energy.construction = _constr[0]\n elif isinstance(obj, (Room, Model)):\n for face in obj.faces:\n if is_exterior_wall(face):\n face.properties.energy.construction = _constr[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n else: # assign constructions based on cardinal direction\n angles = angles_from_num_orient(len(_constr))\n for obj in hb_objs:\n if isinstance(obj, (Face, Door)):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n obj.properties.energy.construction = _constr[orient_i]\n elif isinstance(obj, (Room, Model)):\n for face in obj.faces:\n if is_exterior_wall(face):\n orient_i = face_orient_index(face, angles)\n if orient_i is not None:\n face.properties.energy.construction = _constr[orient_i]\n else:\n raise TypeError(error_msg.format(type(obj)))\n\n", "category": "HB-Energy", "name": "HB Apply Opaque Construction", "description": "Apply OpaqueConstruction to Honeybee Faces, Doors or Room walls.\n_\nThis component supports the assigning of different constructions based on cardinal\norientation, provided that a list of OpaqueConstructions are input to the _constr. \n-" diff --git a/honeybee_grasshopper_energy/json/HB_Apply_ProgramType.json b/honeybee_grasshopper_energy/json/HB_Apply_ProgramType.json index de935d98..fafe5c88 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_ProgramType.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_ProgramType.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplyProgram", "outputs": [ [ @@ -16,7 +16,7 @@ { "access": "list", "name": "_rooms", - "description": "Honeybee Rooms to which the input load objects should be assigned.", + "description": "Honeybee Rooms to which the input program should be assigned.\nThis can also be a Honeybee Model for which all Rooms will be\nassigned the ProgramType.", "type": "System.Object", "default": null }, @@ -29,8 +29,8 @@ } ], "subcategory": "3 :: Loads", - "code": "\ntry:\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 honeybee_energy.lib.programtypes import program_type_by_identifier, \\\n building_program_type_by_identifier\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\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 if isinstance(obj, Room)]\n\n # apply the program to the rooms\n for i, room in enumerate(rooms):\n prog = longest_list(_program, i)\n if isinstance(prog, str): # get the program object if it is a string\n try:\n prog = building_program_type_by_identifier(prog)\n except ValueError:\n prog = program_type_by_identifier(prog)\n room.properties.energy.program_type = prog", + "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 honeybee_energy.lib.programtypes import program_type_by_identifier, \\\n building_program_type_by_identifier\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\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 # apply the program to the rooms\n for i, room in enumerate(hb_objs):\n prog = longest_list(_program, i)\n if isinstance(prog, str): # get the program object if it is a string\n try:\n prog = building_program_type_by_identifier(prog)\n except ValueError:\n prog = program_type_by_identifier(prog)\n room.properties.energy.program_type = prog", "category": "HB-Energy", "name": "HB Apply ProgramType", - "description": "Apply ProgramType objects to Rooms.\n-" + "description": "Apply ProgramType objects to Rooms or a Model.\n-" } \ No newline at end of file diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Room_Schedules.json b/honeybee_grasshopper_energy/json/HB_Apply_Room_Schedules.json index e9402c7e..5673fae5 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Room_Schedules.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Room_Schedules.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplyRoomSch", "outputs": [ [ @@ -16,7 +16,7 @@ { "access": "list", "name": "_room_or_program", - "description": "Honeybee Rooms or Honeybee ProgramType objects for which\nschedules should be changed. This can also be the identifier of a\nProgramType to be looked up in the program type library.", + "description": "Honeybee Rooms or Honeybee ProgramType objects for which\nschedules should be changed. This can also be the identifier of a\nProgramType to be looked up in the program type library. This can\nalso be a Honeybee Model for which all Rooms will be assigned\nthe schedules.", "type": "System.Object", "default": null }, @@ -92,8 +92,8 @@ } ], "subcategory": "2 :: Schedules", - "code": "\nimport uuid\n\ntry:\n from honeybee.room import Room\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.lib.schedules import schedule_by_identifier\n from honeybee_energy.lib.programtypes import program_type_by_identifier, \\\n building_program_type_by_identifier\n from honeybee_energy.programtype import ProgramType\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\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef schedule_object(schedule):\n \"\"\"Get a schedule object by its identifier or return it it it's already a schedule.\"\"\"\n if isinstance(schedule, str):\n return schedule_by_identifier(schedule)\n return schedule\n\n\ndef dup_load(hb_obj, object_name, input_name):\n \"\"\"Duplicate a load object assigned to a Room or ProgramType.\"\"\"\n # try to get the load object assgined to the Room or ProgramType\n try: # assume it's a Room\n load_obj = hb_obj.properties\n for attribute in ('energy', object_name):\n load_obj = getattr(load_obj, attribute)\n except AttributeError: # it's a ProgramType\n load_obj = getattr(hb_obj, object_name)\n\n try: # duplicate the load object\n dup_load = load_obj.duplicate()\n dup_load.identifier = '{}_{}'.format(hb_obj.identifier, object_name)\n return dup_load\n except AttributeError:\n raise ValueError(\n '{0} has been input but the Room or ProgramType posseses no {1} object.'\n '\\nUse the \"HB Apply Load Values\" component to define a {1} '\n 'object.'.format(input_name, object_name))\n\n\ndef assign_load(hb_obj, load_obj, object_name):\n \"\"\"Assign a load object to a Room or a ProgramType.\"\"\"\n try: # assume it's a Room\n setattr(hb_obj.properties.energy, object_name, load_obj)\n except AttributeError: # it's a ProgramType\n setattr(hb_obj, object_name, load_obj)\n\n\ndef duplicate_and_id_program(program):\n \"\"\"Duplicate a program and give it a new unique ID.\"\"\"\n new_prog = program.duplicate()\n new_prog.identifier = '{}_{}'.format(program.identifier, str(uuid.uuid4())[:8])\n return new_prog\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n mod_obj = []\n for obj in _room_or_program:\n if isinstance(obj, Room):\n mod_obj.append(obj.duplicate())\n elif isinstance(obj, ProgramType):\n mod_obj.append(duplicate_and_id_program(obj))\n elif isinstance(obj, str):\n try:\n program = building_program_type_by_identifier(obj)\n except ValueError:\n program = program_type_by_identifier(obj)\n mod_obj.append(duplicate_and_id_program(program))\n else:\n raise TypeError('Expected Honeybee Room or ProgramType. '\n 'Got {}.'.format(type(obj)))\n\n # assign the occupancy schedule\n if len(occupancy_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n people = dup_load(obj, 'people', 'occupancy_sch_')\n people.occupancy_schedule = schedule_object(longest_list(occupancy_sch_, i))\n assign_load(obj, people, 'people')\n\n # assign the activity schedule\n if len(activity_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n people = dup_load(obj, 'people', 'activity_sch_')\n people.activity_schedule = schedule_object(longest_list(activity_sch_, i))\n assign_load(obj, people, 'people')\n\n # assign the lighting schedule\n if len(lighting_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n lighting = dup_load(obj, 'lighting', 'lighting_sch_')\n lighting.schedule = schedule_object(longest_list(lighting_sch_, i))\n assign_load(obj, lighting, 'lighting')\n\n # assign the electric equipment schedule\n if len(electric_equip_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n equip = dup_load(obj, 'electric_equipment', 'electric_equip_sch_')\n equip.schedule = schedule_object(longest_list(electric_equip_sch_, i))\n assign_load(obj, equip, 'electric_equipment')\n\n # assign the gas equipment schedule\n if len(gas_equip_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n equip = dup_load(obj, 'gas_equipment', 'gas_equip_sch_')\n equip.schedule = schedule_object(longest_list(gas_equip_sch_, i))\n assign_load(obj, equip, 'gas_equipment')\n\n # assign the hot water schedule\n if len(hot_water_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n shw = dup_load(obj, 'service_hot_water', 'hot_water_sch_')\n shw.schedule = schedule_object(longest_list(hot_water_sch_, i))\n assign_load(obj, shw, 'service_hot_water')\n\n # assign the infiltration schedule\n if len(infiltration_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n infiltration = dup_load(obj, 'infiltration', 'infiltration_sch_')\n infiltration.schedule = schedule_object(longest_list(infiltration_sch_, i))\n assign_load(obj, infiltration, 'infiltration')\n\n # assign the ventilation schedule\n if len(ventilation_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n ventilation = dup_load(obj, 'ventilation', 'ventilation_sch_')\n ventilation.schedule = schedule_object(longest_list(ventilation_sch_, i))\n assign_load(obj, ventilation, 'ventilation')\n\n # assign the heating setpoint schedule\n if len(heating_setpt_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n setpoint = dup_load(obj, 'setpoint', 'heating_setpt_sch_')\n setpoint.heating_schedule = schedule_object(longest_list(heating_setpt_sch_, i))\n assign_load(obj, setpoint, 'setpoint')\n\n # assign the cooling setpoint schedule\n if len(cooling_setpt_sch_) != 0:\n for i, obj in enumerate(mod_obj):\n setpoint = dup_load(obj, 'setpoint', 'cooling_setpt_sch_')\n setpoint.cooling_schedule = schedule_object(longest_list(cooling_setpt_sch_, i))\n assign_load(obj, setpoint, 'setpoint')\n", + "code": "\nimport uuid\n\ntry:\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:\n from honeybee_energy.lib.schedules import schedule_by_identifier\n from honeybee_energy.lib.programtypes import program_type_by_identifier, \\\n building_program_type_by_identifier\n from honeybee_energy.programtype import ProgramType\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\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef schedule_object(schedule):\n \"\"\"Get a schedule object by its identifier or return it it it's already a schedule.\"\"\"\n if isinstance(schedule, str):\n return schedule_by_identifier(schedule)\n return schedule\n\n\ndef dup_load(hb_obj, object_name, input_name):\n \"\"\"Duplicate a load object assigned to a Room or ProgramType.\"\"\"\n # try to get the load object assgined to the Room or ProgramType\n try: # assume it's a Room\n load_obj = hb_obj.properties\n for attribute in ('energy', object_name):\n load_obj = getattr(load_obj, attribute)\n except AttributeError: # it's a ProgramType\n load_obj = getattr(hb_obj, object_name)\n\n try: # duplicate the load object\n dup_load = load_obj.duplicate()\n dup_load.identifier = '{}_{}'.format(hb_obj.identifier, object_name)\n return dup_load\n except AttributeError:\n raise ValueError(\n '{0} has been input but the Room or ProgramType posseses no {1} object.'\n '\\nUse the \"HB Apply Load Values\" component to define a {1} '\n 'object.'.format(input_name, object_name))\n\n\ndef assign_load(hb_obj, load_obj, object_name):\n \"\"\"Assign a load object to a Room or a ProgramType.\"\"\"\n try: # assume it's a Room\n setattr(hb_obj.properties.energy, object_name, load_obj)\n except AttributeError: # it's a ProgramType\n setattr(hb_obj, object_name, load_obj)\n\n\ndef duplicate_and_id_program(program):\n \"\"\"Duplicate a program and give it a new unique ID.\"\"\"\n new_prog = program.duplicate()\n new_prog.identifier = '{}_{}'.format(program.identifier, str(uuid.uuid4())[:8])\n return new_prog\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n mod_obj, edit_objs = [], []\n for obj in _room_or_program:\n if isinstance(obj, Room):\n new_obj = obj.duplicate()\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n elif isinstance(obj, Model):\n new_obj = obj.duplicate()\n mod_obj.append(new_obj)\n edit_objs.extend(new_obj.rooms)\n elif isinstance(obj, ProgramType):\n new_obj = duplicate_and_id_program(obj)\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n elif isinstance(obj, str):\n try:\n program = building_program_type_by_identifier(obj)\n except ValueError:\n program = program_type_by_identifier(obj)\n new_obj = duplicate_and_id_program(obj)\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n else:\n raise TypeError('Expected Honeybee Room, Model or ProgramType. '\n 'Got {}.'.format(type(obj)))\n\n # assign the occupancy schedule\n if len(occupancy_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n people = dup_load(obj, 'people', 'occupancy_sch_')\n people.occupancy_schedule = schedule_object(longest_list(occupancy_sch_, i))\n assign_load(obj, people, 'people')\n\n # assign the activity schedule\n if len(activity_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n people = dup_load(obj, 'people', 'activity_sch_')\n people.activity_schedule = schedule_object(longest_list(activity_sch_, i))\n assign_load(obj, people, 'people')\n\n # assign the lighting schedule\n if len(lighting_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n lighting = dup_load(obj, 'lighting', 'lighting_sch_')\n lighting.schedule = schedule_object(longest_list(lighting_sch_, i))\n assign_load(obj, lighting, 'lighting')\n\n # assign the electric equipment schedule\n if len(electric_equip_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n equip = dup_load(obj, 'electric_equipment', 'electric_equip_sch_')\n equip.schedule = schedule_object(longest_list(electric_equip_sch_, i))\n assign_load(obj, equip, 'electric_equipment')\n\n # assign the gas equipment schedule\n if len(gas_equip_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n equip = dup_load(obj, 'gas_equipment', 'gas_equip_sch_')\n equip.schedule = schedule_object(longest_list(gas_equip_sch_, i))\n assign_load(obj, equip, 'gas_equipment')\n\n # assign the hot water schedule\n if len(hot_water_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n shw = dup_load(obj, 'service_hot_water', 'hot_water_sch_')\n shw.schedule = schedule_object(longest_list(hot_water_sch_, i))\n assign_load(obj, shw, 'service_hot_water')\n\n # assign the infiltration schedule\n if len(infiltration_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n infiltration = dup_load(obj, 'infiltration', 'infiltration_sch_')\n infiltration.schedule = schedule_object(longest_list(infiltration_sch_, i))\n assign_load(obj, infiltration, 'infiltration')\n\n # assign the ventilation schedule\n if len(ventilation_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n ventilation = dup_load(obj, 'ventilation', 'ventilation_sch_')\n ventilation.schedule = schedule_object(longest_list(ventilation_sch_, i))\n assign_load(obj, ventilation, 'ventilation')\n\n # assign the heating setpoint schedule\n if len(heating_setpt_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n setpoint = dup_load(obj, 'setpoint', 'heating_setpt_sch_')\n setpoint.heating_schedule = schedule_object(longest_list(heating_setpt_sch_, i))\n assign_load(obj, setpoint, 'setpoint')\n\n # assign the cooling setpoint schedule\n if len(cooling_setpt_sch_) != 0:\n for i, obj in enumerate(edit_objs):\n setpoint = dup_load(obj, 'setpoint', 'cooling_setpt_sch_')\n setpoint.cooling_schedule = schedule_object(longest_list(cooling_setpt_sch_, i))\n assign_load(obj, setpoint, 'setpoint')\n", "category": "HB-Energy", "name": "HB Apply Room Schedules", - "description": "Apply schedules to a Room or ProgramType.\n_\nNote that, if a schedule is assigned to a Room or ProgramType that posseses\nno value for a given load, an error will be raised. For example, assigning a\ngas_equip_sch_ to a Room that has no GasEquipment object associated with it.\nThis situation can be avoided by first passing the Rooms or ProgramTypes\nthrough the \"HB Apply Load Values\" component to eastablish a value for a\ngiven load.\n-" + "description": "Apply schedules to a Room, Model or ProgramType.\n_\nNote that, if a schedule is assigned to a Room or ProgramType that posseses\nno value for a given load, an error will be raised. For example, assigning a\ngas_equip_sch_ to a Room that has no GasEquipment object associated with it.\nThis situation can be avoided by first passing the Rooms or ProgramTypes\nthrough the \"HB Apply Load Values\" component to eastablish a value for a\ngiven load.\n-" } \ No newline at end of file diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Setpoint_Values.json b/honeybee_grasshopper_energy/json/HB_Apply_Setpoint_Values.json index f671f899..1f0dfb87 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Setpoint_Values.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Setpoint_Values.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplySetpointVals", "outputs": [ [ @@ -16,7 +16,7 @@ { "access": "list", "name": "_room_or_program", - "description": "Honeybee Rooms or ProgramType objects to which the input\nsetpoints should be assigned. This can also be the identifier of a\nProgramType to be looked up in the program type library.", + "description": "Honeybee Rooms or ProgramType objects to which the input\nsetpoints should be assigned. This can also be the identifier of a\nProgramType to be looked up in the program type library. This can\nalso be a Honeybee Model for which all Rooms will be assigned\nthe setpoints.", "type": "System.Object", "default": null }, @@ -50,7 +50,7 @@ } ], "subcategory": "3 :: Loads", - "code": "\nimport uuid\n\ntry:\n from honeybee.room import Room\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.load.setpoint import Setpoint\n from honeybee_energy.schedule.ruleset import ScheduleRuleset\n import honeybee_energy.lib.scheduletypelimits as _type_lib\n from honeybee_energy.lib.programtypes import program_type_by_identifier, \\\n building_program_type_by_identifier\n from honeybee_energy.programtype import ProgramType\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef dup_setpoint(hb_obj):\n \"\"\"Duplicate a setpoint object assigned to a Room or ProgramType.\"\"\"\n # try to get the setpoint object assgined to the Room or ProgramType\n try: # assume it's a Room\n setpt_obj = hb_obj.properties.energy.setpoint\n except AttributeError: # it's a ProgramType\n setpt_obj = hb_obj.setpoint\n\n load_id = '{}_Setpoint'.format(hb_obj.identifier)\n try: # duplicate the setpoint object\n dup_load = setpt_obj.duplicate()\n dup_load.identifier = load_id\n return dup_load\n except AttributeError: # create a new object if it does not exist\n heat_sch = ScheduleRuleset.from_constant_value(\n '{}_HtgSetp'.format(hb_obj.identifier), -50, _type_lib.temperature)\n cool_sch = ScheduleRuleset.from_constant_value(\n '{}_ClgSetp'.format(hb_obj.identifier), 50, _type_lib.temperature)\n return Setpoint(load_id, heat_sch, cool_sch)\n\n\ndef assign_setpoint(hb_obj, setpt_obj):\n \"\"\"Assign a setpoint object to a Room or a ProgramType.\"\"\"\n try: # assume it's a Room\n hb_obj.properties.energy.setpoint = setpt_obj\n except AttributeError: # it's a ProgramType\n hb_obj.setpoint = setpt_obj\n\n\ndef duplicate_and_id_program(program):\n \"\"\"Duplicate a program and give it a new unique ID.\"\"\"\n new_prog = program.duplicate()\n new_prog.identifier = '{}_{}'.format(program.identifier, str(uuid.uuid4())[:8])\n return new_prog\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n mod_obj = []\n for obj in _room_or_program:\n if isinstance(obj, Room):\n mod_obj.append(obj.duplicate())\n elif isinstance(obj, ProgramType):\n mod_obj.append(duplicate_and_id_program(obj))\n elif isinstance(obj, str):\n try:\n program = building_program_type_by_identifier(obj)\n except ValueError:\n program = program_type_by_identifier(obj)\n mod_obj.append(duplicate_and_id_program(program))\n else:\n raise TypeError('Expected Honeybee Room or ProgramType. '\n 'Got {}.'.format(type(obj)))\n\n # assign the cooling_setpt_\n if len(cooling_setpt_) != 0:\n for i, obj in enumerate(mod_obj):\n setpoint = dup_setpoint(obj)\n setpoint.cooling_setpoint = longest_list(cooling_setpt_, i)\n assign_setpoint(obj, setpoint)\n\n # assign the heating_setpt_\n if len(heating_setpt_) != 0:\n for i, obj in enumerate(mod_obj):\n setpoint = dup_setpoint(obj)\n setpoint.heating_setpoint = longest_list(heating_setpt_, i)\n assign_setpoint(obj, setpoint)\n\n # assign the humid_setpt_\n if len(humid_setpt_) != 0:\n for i, obj in enumerate(mod_obj):\n setpoint = dup_setpoint(obj)\n setpoint.humidifying_setpoint = longest_list(humid_setpt_, i)\n assign_setpoint(obj, setpoint)\n\n # assign the dehumid_setpt_\n if len(dehumid_setpt_) != 0:\n for i, obj in enumerate(mod_obj):\n setpoint = dup_setpoint(obj)\n setpoint.dehumidifying_setpoint = longest_list(dehumid_setpt_, i)\n assign_setpoint(obj, setpoint)\n", + "code": "\nimport uuid\n\ntry:\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:\n from honeybee_energy.load.setpoint import Setpoint\n from honeybee_energy.schedule.ruleset import ScheduleRuleset\n import honeybee_energy.lib.scheduletypelimits as _type_lib\n from honeybee_energy.lib.programtypes import program_type_by_identifier, \\\n building_program_type_by_identifier\n from honeybee_energy.programtype import ProgramType\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, longest_list\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef dup_setpoint(hb_obj):\n \"\"\"Duplicate a setpoint object assigned to a Room or ProgramType.\"\"\"\n # try to get the setpoint object assgined to the Room or ProgramType\n try: # assume it's a Room\n setpt_obj = hb_obj.properties.energy.setpoint\n except AttributeError: # it's a ProgramType\n setpt_obj = hb_obj.setpoint\n\n load_id = '{}_Setpoint'.format(hb_obj.identifier)\n try: # duplicate the setpoint object\n dup_load = setpt_obj.duplicate()\n dup_load.identifier = load_id\n return dup_load\n except AttributeError: # create a new object if it does not exist\n heat_sch = ScheduleRuleset.from_constant_value(\n '{}_HtgSetp'.format(hb_obj.identifier), -50, _type_lib.temperature)\n cool_sch = ScheduleRuleset.from_constant_value(\n '{}_ClgSetp'.format(hb_obj.identifier), 50, _type_lib.temperature)\n return Setpoint(load_id, heat_sch, cool_sch)\n\n\ndef assign_setpoint(hb_obj, setpt_obj):\n \"\"\"Assign a setpoint object to a Room or a ProgramType.\"\"\"\n try: # assume it's a Room\n hb_obj.properties.energy.setpoint = setpt_obj\n except AttributeError: # it's a ProgramType\n hb_obj.setpoint = setpt_obj\n\n\ndef duplicate_and_id_program(program):\n \"\"\"Duplicate a program and give it a new unique ID.\"\"\"\n new_prog = program.duplicate()\n new_prog.identifier = '{}_{}'.format(program.identifier, str(uuid.uuid4())[:8])\n return new_prog\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n mod_obj, edit_objs = [], []\n for obj in _room_or_program:\n if isinstance(obj, Room):\n new_obj = obj.duplicate()\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n elif isinstance(obj, Model):\n new_obj = obj.duplicate()\n mod_obj.append(new_obj)\n edit_objs.extend(new_obj.rooms)\n elif isinstance(obj, ProgramType):\n new_obj = duplicate_and_id_program(obj)\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n elif isinstance(obj, str):\n try:\n program = building_program_type_by_identifier(obj)\n except ValueError:\n program = program_type_by_identifier(obj)\n new_obj = duplicate_and_id_program(obj)\n mod_obj.append(new_obj)\n edit_objs.append(new_obj)\n else:\n raise TypeError('Expected Honeybee Room, Model or ProgramType. '\n 'Got {}.'.format(type(obj)))\n\n # assign the cooling_setpt_\n if len(cooling_setpt_) != 0:\n for i, obj in enumerate(edit_objs):\n setpoint = dup_setpoint(obj)\n setpoint.cooling_setpoint = longest_list(cooling_setpt_, i)\n assign_setpoint(obj, setpoint)\n\n # assign the heating_setpt_\n if len(heating_setpt_) != 0:\n for i, obj in enumerate(edit_objs):\n setpoint = dup_setpoint(obj)\n setpoint.heating_setpoint = longest_list(heating_setpt_, i)\n assign_setpoint(obj, setpoint)\n\n # assign the humid_setpt_\n if len(humid_setpt_) != 0:\n for i, obj in enumerate(edit_objs):\n setpoint = dup_setpoint(obj)\n setpoint.humidifying_setpoint = longest_list(humid_setpt_, i)\n assign_setpoint(obj, setpoint)\n\n # assign the dehumid_setpt_\n if len(dehumid_setpt_) != 0:\n for i, obj in enumerate(edit_objs):\n setpoint = dup_setpoint(obj)\n setpoint.dehumidifying_setpoint = longest_list(dehumid_setpt_, i)\n assign_setpoint(obj, setpoint)\n", "category": "HB-Energy", "name": "HB Apply Setpoint Values", "description": "Apply values for setpoints to a Room or ProgramType.\n-" diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Shade_Construction.json b/honeybee_grasshopper_energy/json/HB_Apply_Shade_Construction.json index 2657030c..5b815441 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Shade_Construction.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Shade_Construction.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplyShadeConstr", "outputs": [ [ @@ -29,7 +29,7 @@ } ], "subcategory": "1 :: Constructions", - "code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructions import shade_construction_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the core honeybee dependencies\n from honeybee.shade import Shade\n from honeybee.room import Room\n from honeybee.face import Face\n from honeybee.aperture import Aperture\n from honeybee.door import Door\n from honeybee.orientation import angles_from_num_orient, face_orient_index\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\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 hb_objs = [obj.duplicate() for obj in _hb_objs]\n \n # process the input constructions\n for i, constr in enumerate(_constr):\n if isinstance(constr, str):\n _constr[i] = shade_construction_by_identifier(constr)\n \n # error message for unrecognized object\n error_msg = 'Input _hb_objs must be a Room, Face, Aperture, Door, or Shade. Not {}.'\n \n # assign the constructions\n if len(_constr) == 1:\n for obj in hb_objs:\n if isinstance(obj, Shade):\n obj.properties.energy.construction = _constr[0]\n elif isinstance(obj, (Aperture, Face, Room, Door)):\n for shd in obj.shades:\n shd.properties.energy.construction = _constr[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n else: # assign constructions based on cardinal direction\n angles = angles_from_num_orient(len(_constr))\n for obj in hb_objs:\n if isinstance(obj, (Aperture, Face, Door)):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n for shd in obj.shades:\n shd.properties.energy.construction = _constr[orient_i]\n elif isinstance(obj, Shade):\n obj.properties.energy.construction = _constr[0]\n elif isinstance(obj, Room):\n for shd in obj.shades:\n shd.properties.energy.construction = _constr[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n\n", + "code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructions import shade_construction_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the core honeybee dependencies\n from honeybee.shade import Shade\n from honeybee.model import Model\n from honeybee.room import Room\n from honeybee.face import Face\n from honeybee.aperture import Aperture\n from honeybee.door import Door\n from honeybee.orientation import angles_from_num_orient, face_orient_index\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\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 hb_objs = [obj.duplicate() for obj in _hb_objs]\n \n # process the input constructions\n for i, constr in enumerate(_constr):\n if isinstance(constr, str):\n _constr[i] = shade_construction_by_identifier(constr)\n \n # error message for unrecognized object\n error_msg = 'Input _hb_objs must be a Room, Face, Aperture, Door, or Shade. Not {}.'\n \n # assign the constructions\n if len(_constr) == 1:\n for obj in hb_objs:\n if isinstance(obj, Shade):\n obj.properties.energy.construction = _constr[0]\n elif isinstance(obj, (Aperture, Face, Room, Door)):\n for shd in obj.shades:\n shd.properties.energy.construction = _constr[0]\n elif isinstance(obj, Model):\n for shd in obj.orphaned_shades:\n shd.properties.energy.construction = _constr[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n else: # assign constructions based on cardinal direction\n angles = angles_from_num_orient(len(_constr))\n for obj in hb_objs:\n if isinstance(obj, (Aperture, Face, Door)):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n for shd in obj.shades:\n shd.properties.energy.construction = _constr[orient_i]\n elif isinstance(obj, Shade):\n obj.properties.energy.construction = _constr[0]\n elif isinstance(obj, Room):\n for shd in obj.shades:\n shd.properties.energy.construction = _constr[0]\n elif isinstance(obj, Model):\n for shd in obj.orphaned_shades:\n shd.properties.energy.construction = _constr[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n\n", "category": "HB-Energy", "name": "HB Apply Shade Construction", "description": "Apply a ShadeConstruction to Honeybee Shade objects. Alternatively, it can\nassign a ShadeConstruction to all of the child shades of an Aperture, Door,\nFace, or a Room.\n_\nThis component supports the assigning of different constructions based on cardinal\norientation, provided that a list of ShadeConstructions are input to the _constr. \n-" diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Shade_Schedule.json b/honeybee_grasshopper_energy/json/HB_Apply_Shade_Schedule.json index 7fa63e7e..69c01225 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Shade_Schedule.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Shade_Schedule.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplyShadeSch", "outputs": [ [ @@ -16,7 +16,7 @@ { "access": "list", "name": "_hb_objs", - "description": "Honeybee Shades, Apertures, Door, Faces, or Rooms to which the\ninput _trans_sch should be assigned. For the case of a Honeybee Aperture,\nDoor, Face or Room, the ShadeConstruction will be assigned to only the\nchild shades directly assigned to that object. So passing in a Room\nwill not change the schedule of shades assigned to Apertures\nof the Room's Faces. If this is the desired outcome, then the Room\nshould be deconstructed into its child objects before using\nthis component.", + "description": "Honeybee Shades, Apertures, Door, Faces, Rooms or a Model to which the\ninput _trans_sch should be assigned. For the case of a Honeybee Aperture,\nDoor, Face, Room, or Model, the ShadeConstruction will be assigned to only\nthe child shades directly assigned to that object. So passing in a Room\nwill not change the schedule of shades assigned to Apertures\nof the Room's Faces. If changing these sub-children is the desired\noutcome, then the Room should be deconstructed into its child objects\nbefore using this component.", "type": "System.Object", "default": null }, @@ -29,7 +29,7 @@ } ], "subcategory": "2 :: Schedules", - "code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the core honeybee dependencies\n from honeybee.shade import Shade\n from honeybee.room import Room\n from honeybee.face import Face\n from honeybee.aperture import Aperture\n from honeybee.door import Door\n from honeybee.orientation import angles_from_num_orient, face_orient_index\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\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 hb_objs = [obj.duplicate() for obj in _hb_objs]\n\n # process the input schedule\n for i, sch in enumerate(_trans_sch):\n if isinstance(sch, str):\n _trans_sch[i] = schedule_by_identifier(sch)\n\n # error message for unrecognized object\n error_msg = 'Input _hb_objs must be a Room, Face, Aperture, Door, or Shade. Not {}.'\n\n # assign the schedules\n if len(_trans_sch) == 1:\n for obj in hb_objs:\n if isinstance(obj, Shade):\n obj.properties.energy.transmittance_schedule = _trans_sch[0]\n elif isinstance(obj, (Aperture, Face, Room, Door)):\n for shd in obj.shades:\n shd.properties.energy.transmittance_schedule = _trans_sch[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n else: # assign schedules based on cardinal direction\n angles = angles_from_num_orient(len(_trans_sch))\n for obj in hb_objs:\n if isinstance(obj, (Aperture, Face, Door)):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n for shd in obj.shades:\n shd.properties.energy.transmittance_schedule = _trans_sch[orient_i]\n elif isinstance(obj, Shade):\n obj.properties.energy.transmittance_schedule = _trans_sch[0]\n elif isinstance(obj, Room):\n for shd in obj.shades:\n shd.properties.energy.transmittance_schedule = _trans_sch[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n", + "code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the core honeybee dependencies\n from honeybee.shade import Shade\n from honeybee.model import Model\n from honeybee.room import Room\n from honeybee.face import Face\n from honeybee.aperture import Aperture\n from honeybee.door import Door\n from honeybee.orientation import angles_from_num_orient, face_orient_index\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\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 hb_objs = [obj.duplicate() for obj in _hb_objs]\n\n # process the input schedule\n for i, sch in enumerate(_trans_sch):\n if isinstance(sch, str):\n _trans_sch[i] = schedule_by_identifier(sch)\n\n # error message for unrecognized object\n error_msg = 'Input _hb_objs must be a Room, Face, Aperture, Door, or Shade. Not {}.'\n\n # assign the schedules\n if len(_trans_sch) == 1:\n for obj in hb_objs:\n if isinstance(obj, Shade):\n obj.properties.energy.transmittance_schedule = _trans_sch[0]\n elif isinstance(obj, (Aperture, Face, Room, Door)):\n for shd in obj.shades:\n shd.properties.energy.transmittance_schedule = _trans_sch[0]\n elif isinstance(obj, Model):\n for shd in obj.orphaned_shades:\n shd.properties.energy.transmittance_schedule = _trans_sch[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n else: # assign schedules based on cardinal direction\n angles = angles_from_num_orient(len(_trans_sch))\n for obj in hb_objs:\n if isinstance(obj, (Aperture, Face, Door)):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n for shd in obj.shades:\n shd.properties.energy.transmittance_schedule = _trans_sch[orient_i]\n elif isinstance(obj, Shade):\n obj.properties.energy.transmittance_schedule = _trans_sch[0]\n elif isinstance(obj, Room):\n for shd in obj.shades:\n shd.properties.energy.transmittance_schedule = _trans_sch[0]\n elif isinstance(obj, Model):\n for shd in obj.orphaned_shades:\n shd.properties.energy.transmittance_schedule = _trans_sch[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n", "category": "HB-Energy", "name": "HB Apply Shade Schedule", "description": "Apply a transmittance schedule to Honeybee Shade objects. Alternatively, it can\nassign a transmittance schedule to all of the child shades of an Aperture, Door,\nFace, or a Room.\n_\nThis component supports the assigning of different schedules based on cardinal\norientation, provided that a list of transmittance schedule are input to\nthe _trans_sch. \n-" diff --git a/honeybee_grasshopper_energy/json/HB_Apply_Window_Construction.json b/honeybee_grasshopper_energy/json/HB_Apply_Window_Construction.json index 1b1980eb..71eedc31 100644 --- a/honeybee_grasshopper_energy/json/HB_Apply_Window_Construction.json +++ b/honeybee_grasshopper_energy/json/HB_Apply_Window_Construction.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "ApplyWindowConstr", "outputs": [ [ @@ -16,7 +16,7 @@ { "access": "list", "name": "_hb_objs", - "description": "Honeybee Apertures, Faces, Doors or Rooms to which the input\n_constr should be assigned. For the case of a Honeybee Room, the\nconstruction will only be applied to the apertures in the the\nRoom's outdoor walls. Note that, if you need to assign a construction\nto all the skylights, glass doors, etc. of a Room, the best practice\nis to create a ConstructionSet and assing that to the Room.", + "description": "Honeybee Apertures, Faces, Doors, Rooms or a Model to which the input\n_constr should be assigned. For the case of a Room or a Model, the\nconstruction will only be applied to the apertures in the the\nRoom's outdoor walls. Note that, if you need to assign a construction\nto all the skylights, glass doors, etc. of a Room, the best practice\nis to create a ConstructionSet and assing that to the Room.", "type": "System.Object", "default": null }, @@ -29,7 +29,7 @@ } ], "subcategory": "1 :: Constructions", - "code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructions import window_construction_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the core honeybee dependencies\n from honeybee.boundarycondition import Outdoors\n from honeybee.facetype import Wall\n from honeybee.room import Room\n from honeybee.face import Face\n from honeybee.aperture import Aperture\n from honeybee.door import Door\n from honeybee.orientation import angles_from_num_orient, face_orient_index\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\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\ndef is_exterior_wall(face):\n \"\"\"Check whether a given Face is an exterior Wall.\"\"\"\n return isinstance(face.boundary_condition, Outdoors) and \\\n isinstance(face.type, Wall)\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n hb_objs = [obj.duplicate() for obj in _hb_objs]\n \n # process the input constructions\n for i, constr in enumerate(_constr):\n if isinstance(constr, str):\n _constr[i] = window_construction_by_identifier(constr)\n \n # error message for unrecognized object\n error_msg = 'Input _hb_objs must be a Room, Face, Aperture, or Door. Not {}.'\n \n # assign the constructions\n if len(_constr) == 1: # assign indiscriminately, even if it's a horizontal object\n for obj in hb_objs:\n if isinstance(obj, (Aperture, Door)):\n obj.properties.energy.construction = _constr[0]\n elif isinstance(obj, Face):\n for ap in obj.apertures:\n ap.properties.energy.construction = _constr[0]\n elif isinstance(obj, Room):\n for face in obj.faces:\n if is_exterior_wall(face):\n for ap in face.apertures:\n ap.properties.energy.construction = _constr[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n else: # assign constructions only to non-horizontal objects based on cardinal direction\n angles = angles_from_num_orient(len(_constr))\n for obj in hb_objs:\n if isinstance(obj, (Aperture, Door)):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n obj.properties.energy.construction = _constr[orient_i]\n elif isinstance(obj, Face):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n for ap in obj.apertures:\n ap.properties.energy.construction = _constr[orient_i]\n elif isinstance(obj, Room):\n for face in obj.faces:\n if is_exterior_wall(face):\n orient_i = face_orient_index(face, angles)\n if orient_i is not None:\n for ap in face.apertures:\n ap.properties.energy.construction = _constr[orient_i]\n else:\n raise TypeError(error_msg.format(type(obj)))\n\n", + "code": "\n\ntry: # import the honeybee-energy extension\n from honeybee_energy.lib.constructions import window_construction_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry: # import the core honeybee dependencies\n from honeybee.boundarycondition import Outdoors\n from honeybee.facetype import Wall\n from honeybee.model import Model\n from honeybee.room import Room\n from honeybee.face import Face\n from honeybee.aperture import Aperture\n from honeybee.door import Door\n from honeybee.orientation import angles_from_num_orient, face_orient_index\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\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\ndef is_exterior_wall(face):\n \"\"\"Check whether a given Face is an exterior Wall.\"\"\"\n return isinstance(face.boundary_condition, Outdoors) and \\\n isinstance(face.type, Wall)\n\n\nif all_required_inputs(ghenv.Component):\n # duplicate the initial objects\n hb_objs = [obj.duplicate() for obj in _hb_objs]\n \n # process the input constructions\n for i, constr in enumerate(_constr):\n if isinstance(constr, str):\n _constr[i] = window_construction_by_identifier(constr)\n \n # error message for unrecognized object\n error_msg = 'Input _hb_objs must be a Room, Face, Aperture, or Door. Not {}.'\n \n # assign the constructions\n if len(_constr) == 1: # assign indiscriminately, even if it's a horizontal object\n for obj in hb_objs:\n if isinstance(obj, (Aperture, Door)):\n obj.properties.energy.construction = _constr[0]\n elif isinstance(obj, Face):\n for ap in obj.apertures:\n ap.properties.energy.construction = _constr[0]\n elif isinstance(obj, (Room, Model)):\n for face in obj.faces:\n if is_exterior_wall(face):\n for ap in face.apertures:\n ap.properties.energy.construction = _constr[0]\n else:\n raise TypeError(error_msg.format(type(obj)))\n else: # assign constructions only to non-horizontal objects based on cardinal direction\n angles = angles_from_num_orient(len(_constr))\n for obj in hb_objs:\n if isinstance(obj, (Aperture, Door)):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n obj.properties.energy.construction = _constr[orient_i]\n elif isinstance(obj, Face):\n orient_i = face_orient_index(obj, angles)\n if orient_i is not None:\n for ap in obj.apertures:\n ap.properties.energy.construction = _constr[orient_i]\n elif isinstance(obj, (Room, Model)):\n for face in obj.faces:\n if is_exterior_wall(face):\n orient_i = face_orient_index(face, angles)\n if orient_i is not None:\n for ap in face.apertures:\n ap.properties.energy.construction = _constr[orient_i]\n else:\n raise TypeError(error_msg.format(type(obj)))\n\n", "category": "HB-Energy", "name": "HB Apply Window Construction", "description": "Apply WindowConstruction or WindowConstructionShade to Honeybee Apertures or\nglass Doors. Alternatively, it can assign WindowConstructions to the child\napertures of input Faces or the apertures within Room walls.\n_\nThis component supports the assigning of different constructions based on cardinal\norientation, provided that a list of WindowConstructions are input to the _constr. \n-" diff --git a/honeybee_grasshopper_energy/src/HB Apply Abolute Load Values.py b/honeybee_grasshopper_energy/src/HB Apply Abolute Load Values.py index 298592a0..c324c5a5 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Abolute Load Values.py +++ b/honeybee_grasshopper_energy/src/HB Apply Abolute Load Values.py @@ -27,6 +27,8 @@ Args: _rooms: Honeybee Rooms to which the input load values should be assigned. + This can also be a Honeybee Model for which all Rooms will be + assigned the loads. person_count_: A number for the quantity of people in the room. lighting_watts_: A number for the installed wattage of lighting in the room (W). electric_watts_: A number for the installed wattage of electric equipment @@ -48,11 +50,17 @@ ghenv.Component.Name = 'HB Apply Abolute Load Values' ghenv.Component.NickName = 'AbsoluteLoadVals' -ghenv.Component.Message = '1.6.1' +ghenv.Component.Message = '1.6.2' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '3 :: Loads' ghenv.Component.AdditionalHelpFromDocStrings = '2' +try: + from honeybee.model import Model + from honeybee.room import Room +except ImportError as e: + raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e)) + try: from ladybug_rhino.grasshopper import all_required_inputs, longest_list from ladybug_rhino.config import conversion_to_meters @@ -64,43 +72,54 @@ conversion = conversion_to_meters() rooms = [room.duplicate() for room in _rooms] # duplicate the initial objects + # extract any rooms from the input Models + hb_objs = [] + for hb_obj in rooms: + if isinstance(hb_obj, Model): + hb_objs.extend(hb_obj.rooms) + elif isinstance(hb_obj, Room): + hb_objs.append(hb_obj) + else: + raise ValueError( + 'Expected Honeybee Room or Model. Got {}.'.format(type(hb_obj))) + # assign the person_count_ if len(person_count_) != 0: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): room.properties.energy.absolute_people( longest_list(person_count_, i), conversion) # assign the lighting_watts_ if len(lighting_watts_) != 0: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): room.properties.energy.absolute_lighting( longest_list(lighting_watts_, i), conversion) # assign the electric_watts_ if len(electric_watts_) != 0: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): room.properties.energy.absolute_electric_equipment( longest_list(electric_watts_, i), conversion) # assign the gas_watts_ if len(gas_watts_) != 0: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): room.properties.energy.absolute_gas_equipment( longest_list(gas_watts_, i), conversion) # assign the hot_wtr_flow_ if len(hot_wtr_flow_) != 0: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): room.properties.energy.absolute_service_hot_water( longest_list(hot_wtr_flow_, i), conversion) # assign the infiltration_ach_ if len(infiltration_ach_) != 0: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): room.properties.energy.absolute_infiltration_ach( longest_list(infiltration_ach_, i), conversion) # assign the vent_flow_ if len(vent_flow_) != 0: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): room.properties.energy.absolute_ventilation(longest_list(vent_flow_, i)) diff --git a/honeybee_grasshopper_energy/src/HB Apply ConstructionSet.py b/honeybee_grasshopper_energy/src/HB Apply ConstructionSet.py index 191921aa..9b21a2fe 100644 --- a/honeybee_grasshopper_energy/src/HB Apply ConstructionSet.py +++ b/honeybee_grasshopper_energy/src/HB Apply ConstructionSet.py @@ -8,26 +8,33 @@ # @license AGPL-3.0-or-later """ -Apply ConstructionSet to Honeybee Rooms. +Apply ConstructionSet to Honeybee Rooms or a Model. - Args: _rooms: Honeybee Rooms to which the input _constr_set should be assigned. + This can also be a Honeybee Model for which all Rooms will be + assigned the ConstructionSet. _constr_set: A Honeybee ConstructionSet to be applied to the input _room. This can also be text for a construction set to be looked up in the construction set library. - + Returns: rooms: The input Rooms with their construction sets edited. """ ghenv.Component.Name = "HB Apply ConstructionSet" ghenv.Component.NickName = 'ApplyConstrSet' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '1 :: Constructions' ghenv.Component.AdditionalHelpFromDocStrings = '3' +try: # import the honeybee extension + from honeybee.model import Model + from honeybee.room import Room +except ImportError as e: + raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e)) try: # import the honeybee-energy extension from honeybee_energy.lib.constructionsets import construction_set_by_identifier @@ -43,11 +50,22 @@ if all_required_inputs(ghenv.Component): # duplicate the initial objects rooms = [obj.duplicate() for obj in _rooms] - + + # extract any rooms from the input Models + hb_objs = [] + for hb_obj in rooms: + if isinstance(hb_obj, Model): + hb_objs.extend(hb_obj.rooms) + elif isinstance(hb_obj, Room): + hb_objs.append(hb_obj) + else: + raise ValueError( + 'Expected Honeybee Room or Model. Got {}.'.format(type(hb_obj))) + # process the input construction set if it's a string if isinstance(_constr_set, str): _constr_set = construction_set_by_identifier(_constr_set) - + # assign the construction set - for rm in rooms: + for rm in hb_objs: rm.properties.energy.construction_set = _constr_set diff --git a/honeybee_grasshopper_energy/src/HB Apply Daylight Control.py b/honeybee_grasshopper_energy/src/HB Apply Daylight Control.py index 6425371e..c7451be2 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Daylight Control.py +++ b/honeybee_grasshopper_energy/src/HB Apply Daylight Control.py @@ -19,6 +19,8 @@ Args: _rooms: Honeybee Rooms to which simple daylight controls should be assigned. + This can also be a Honeybee Model for which all Rooms will be + assigned daylight control sensors. _sensor_points_: A list of point objects that align with the input _rooms and assign the position of the daylight sensor within the Room. This point should lie within the Room volume and a warning will @@ -61,11 +63,17 @@ ghenv.Component.Name = 'HB Apply Daylight Control' ghenv.Component.NickName = 'DaylightControl' -ghenv.Component.Message = '1.6.1' +ghenv.Component.Message = '1.6.2' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '3 :: Loads' ghenv.Component.AdditionalHelpFromDocStrings = '2' +try: + from honeybee.model import Model + from honeybee.room import Room +except ImportError as e: + raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e)) + try: # import the honeybee-energy extension from honeybee_energy.load.daylight import DaylightingControl except ImportError as e: @@ -84,12 +92,23 @@ # duplicate the initial objects rooms = [room.duplicate() for room in _rooms] + # extract any rooms from the input Models + hb_objs = [] + for hb_obj in rooms: + if isinstance(hb_obj, Model): + hb_objs.extend(hb_obj.rooms) + elif isinstance(hb_obj, Room): + hb_objs.append(hb_obj) + else: + raise ValueError( + 'Expected Honeybee Room or Model. Got {}.'.format(type(hb_obj))) + # set default values and perform checks dist_from_floor = 0.8 / conversion_to_meters() if len(_sensor_points_) != 0: - assert len(_sensor_points_) == len(_rooms), 'Number of sensor points ({}) ' \ + assert len(_sensor_points_) == len(hb_objs), 'Number of sensor points ({}) ' \ 'must align exactly with the number of rooms ({}).'.format( - len(_sensor_points_), len(_rooms)) + len(_sensor_points_), len(hb_objs)) _ill_setpoint_ = [300] if len(_ill_setpoint_) == 0 else _ill_setpoint_ _control_fract_ = [1] if len(_control_fract_) == 0 else _control_fract_ _min_power_in_ = [0.3] if len(_min_power_in_) == 0 else _min_power_in_ @@ -99,7 +118,7 @@ # loop through the rooms and assign daylight sensors unassigned_rooms = [] if len(_sensor_points_) == 0: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): dl_control = room.properties.energy.add_daylight_control_to_center( dist_from_floor, longest_list(_ill_setpoint_, i), longest_list(_control_fract_, i), longest_list(_min_power_in_, i), @@ -108,7 +127,7 @@ if dl_control is None: unassigned_rooms.append(room.display_name) else: - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): sensor_pt = to_point3d(_sensor_points_[i]) if room.geometry.is_point_inside(sensor_pt): dl_control = DaylightingControl( diff --git a/honeybee_grasshopper_energy/src/HB Apply Load Values.py b/honeybee_grasshopper_energy/src/HB Apply Load Values.py index a8c46c9e..89907339 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Load Values.py +++ b/honeybee_grasshopper_energy/src/HB Apply Load Values.py @@ -18,7 +18,9 @@ Args: _room_or_program: Honeybee Rooms or ProgramType objects to which the input load objects should be assigned. This can also be the identifier of a - ProgramType to be looked up in the program type library. + ProgramType to be looked up in the program type library. This can + also be a Honeybee Model for which all Rooms will be assigned + the loads. people_per_floor_: A numerical value for the number of people per square meter of floor area. lighting_per_floor_: A numerical value for the lighting power density in @@ -61,7 +63,7 @@ ghenv.Component.Name = "HB Apply Load Values" ghenv.Component.NickName = 'ApplyLoadVals' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '3 :: Loads' ghenv.Component.AdditionalHelpFromDocStrings = "2" @@ -69,6 +71,7 @@ import uuid try: + from honeybee.model import Model from honeybee.room import Room except ImportError as e: raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e)) @@ -135,81 +138,91 @@ def duplicate_and_id_program(program): if all_required_inputs(ghenv.Component): # duplicate the initial objects - mod_obj = [] + mod_obj, edit_objs = [], [] for obj in _room_or_program: if isinstance(obj, Room): - mod_obj.append(obj.duplicate()) + new_obj = obj.duplicate() + mod_obj.append(new_obj) + edit_objs.append(new_obj) + elif isinstance(obj, Model): + new_obj = obj.duplicate() + mod_obj.append(new_obj) + edit_objs.extend(new_obj.rooms) elif isinstance(obj, ProgramType): - mod_obj.append(duplicate_and_id_program(obj)) + new_obj = duplicate_and_id_program(obj) + mod_obj.append(new_obj) + edit_objs.append(new_obj) elif isinstance(obj, str): try: program = building_program_type_by_identifier(obj) except ValueError: program = program_type_by_identifier(obj) - mod_obj.append(duplicate_and_id_program(program)) + new_obj = duplicate_and_id_program(obj) + mod_obj.append(new_obj) + edit_objs.append(new_obj) else: - raise TypeError('Expected Honeybee Room or ProgramType. ' + raise TypeError('Expected Honeybee Room, Model or ProgramType. ' 'Got {}.'.format(type(obj))) # assign the people_per_floor_ if len(people_per_floor_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): people = dup_load(obj, 'people', People) people.people_per_area = longest_list(people_per_floor_, i) assign_load(obj, people, 'people') # assign the lighting_per_floor_ if len(lighting_per_floor_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): lighting = dup_load(obj, 'lighting', Lighting) lighting.watts_per_area = longest_list(lighting_per_floor_, i) assign_load(obj, lighting, 'lighting') # assign the electric_per_floor_ if len(electric_per_floor_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): equip = dup_load(obj, 'electric_equipment', ElectricEquipment) equip.watts_per_area = longest_list(electric_per_floor_, i) assign_load(obj, equip, 'electric_equipment') # assign the gas_per_floor_ if len(gas_per_floor_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): equip = dup_load(obj, 'gas_equipment', GasEquipment) equip.watts_per_area = longest_list(gas_per_floor_, i) assign_load(obj, equip, 'gas_equipment') # assign the hot_wtr_per_floor_ if len(hot_wtr_per_floor_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): shw = dup_load(obj, 'service_hot_water', ServiceHotWater) shw.flow_per_area = longest_list(hot_wtr_per_floor_, i) assign_load(obj, shw, 'service_hot_water') # assign the infilt_per_exterior_ if len(infilt_per_exterior_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): infilt = dup_load(obj, 'infiltration', Infiltration) infilt.flow_per_exterior_area = longest_list(infilt_per_exterior_, i) assign_load(obj, infilt, 'infiltration') # assign the vent_per_floor_ if len(vent_per_floor_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): vent = dup_load(obj, 'ventilation', Ventilation) vent.flow_per_area = longest_list(vent_per_floor_, i) assign_load(obj, vent, 'ventilation') # assign the vent_per_person_ if len(vent_per_person_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): vent = dup_load(obj, 'ventilation', Ventilation) vent.flow_per_person = longest_list(vent_per_person_, i) assign_load(obj, vent, 'ventilation') # assign the vent_ach_ if len(vent_ach_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): vent = dup_load(obj, 'ventilation', Ventilation) vent.air_changes_per_hour = longest_list(vent_ach_, i) assign_load(obj, vent, 'ventilation') diff --git a/honeybee_grasshopper_energy/src/HB Apply Opaque Construction.py b/honeybee_grasshopper_energy/src/HB Apply Opaque Construction.py index 5091ac83..103b2418 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Opaque Construction.py +++ b/honeybee_grasshopper_energy/src/HB Apply Opaque Construction.py @@ -15,8 +15,8 @@ - Args: - _hb_objs: Honeybee Faces, Doors or Rooms to which the input _constr should - be assigned. For the case of a Honeybee Room, the construction + _hb_objs: Honeybee Faces, Doors, Rooms or a Model to which the input _constr should + be assigned. For the case of a Room or a Model, the construction will only be applied to the Room's outdoor walls. Note that, if you need to assign a construction to all the roofs, floors, etc. of a Room, the best practice is to create a ConstructionSet and assing that @@ -33,7 +33,7 @@ ghenv.Component.Name = "HB Apply Opaque Construction" ghenv.Component.NickName = 'ApplyOpaqueConstr' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '1 :: Constructions' ghenv.Component.AdditionalHelpFromDocStrings = '3' @@ -47,6 +47,7 @@ try: # import the core honeybee dependencies from honeybee.boundarycondition import Outdoors from honeybee.facetype import Wall + from honeybee.model import Model from honeybee.room import Room from honeybee.face import Face from honeybee.door import Door @@ -69,21 +70,21 @@ def is_exterior_wall(face): if all_required_inputs(ghenv.Component): # duplicate the initial objects hb_objs = [obj.duplicate() for obj in _hb_objs] - + # process the input constructions for i, constr in enumerate(_constr): if isinstance(constr, str): _constr[i] = opaque_construction_by_identifier(constr) - + # error message for unrecognized object error_msg = 'Input _hb_objs must be a Room, Face, or Door. Not {}.' - + # assign the constructions if len(_constr) == 1: # assign indiscriminately, even if it's horizontal for obj in hb_objs: if isinstance(obj, (Face, Door)): obj.properties.energy.construction = _constr[0] - elif isinstance(obj, Room): + elif isinstance(obj, (Room, Model)): for face in obj.faces: if is_exterior_wall(face): face.properties.energy.construction = _constr[0] @@ -96,7 +97,7 @@ def is_exterior_wall(face): orient_i = face_orient_index(obj, angles) if orient_i is not None: obj.properties.energy.construction = _constr[orient_i] - elif isinstance(obj, Room): + elif isinstance(obj, (Room, Model)): for face in obj.faces: if is_exterior_wall(face): orient_i = face_orient_index(face, angles) diff --git a/honeybee_grasshopper_energy/src/HB Apply ProgramType.py b/honeybee_grasshopper_energy/src/HB Apply ProgramType.py index 4325d74b..4480232f 100644 --- a/honeybee_grasshopper_energy/src/HB Apply ProgramType.py +++ b/honeybee_grasshopper_energy/src/HB Apply ProgramType.py @@ -8,13 +8,15 @@ # @license AGPL-3.0-or-later """ -Apply ProgramType objects to Rooms. +Apply ProgramType objects to Rooms or a Model. - Args: - _rooms: Honeybee Rooms to which the input load objects should be assigned. + _rooms: Honeybee Rooms to which the input program should be assigned. + This can also be a Honeybee Model for which all Rooms will be + assigned the ProgramType. _program: A ProgramType object to apply to the input rooms, - + Returns: report: Reports, errors, warnings, etc. rooms: The input Rooms with their loads edited. @@ -22,12 +24,13 @@ ghenv.Component.Name = "HB Apply ProgramType" ghenv.Component.NickName = 'ApplyProgram' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '3 :: Loads' ghenv.Component.AdditionalHelpFromDocStrings = "1" try: + from honeybee.model import Model from honeybee.room import Room except ImportError as e: raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e)) @@ -46,10 +49,21 @@ if all_required_inputs(ghenv.Component): # duplicate the initial objects - rooms = [obj.duplicate() for obj in _rooms if isinstance(obj, Room)] + rooms = [obj.duplicate() for obj in _rooms] + + # extract any rooms from the input Models + hb_objs = [] + for hb_obj in rooms: + if isinstance(hb_obj, Model): + hb_objs.extend(hb_obj.rooms) + elif isinstance(hb_obj, Room): + hb_objs.append(hb_obj) + else: + raise ValueError( + 'Expected Honeybee Room or Model. Got {}.'.format(type(hb_obj))) # apply the program to the rooms - for i, room in enumerate(rooms): + for i, room in enumerate(hb_objs): prog = longest_list(_program, i) if isinstance(prog, str): # get the program object if it is a string try: diff --git a/honeybee_grasshopper_energy/src/HB Apply Room Schedules.py b/honeybee_grasshopper_energy/src/HB Apply Room Schedules.py index 4efa4d5e..7e99a8ce 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Room Schedules.py +++ b/honeybee_grasshopper_energy/src/HB Apply Room Schedules.py @@ -8,7 +8,7 @@ # @license AGPL-3.0-or-later """ -Apply schedules to a Room or ProgramType. +Apply schedules to a Room, Model or ProgramType. _ Note that, if a schedule is assigned to a Room or ProgramType that posseses no value for a given load, an error will be raised. For example, assigning a @@ -21,7 +21,9 @@ Args: _room_or_program: Honeybee Rooms or Honeybee ProgramType objects for which schedules should be changed. This can also be the identifier of a - ProgramType to be looked up in the program type library. + ProgramType to be looked up in the program type library. This can + also be a Honeybee Model for which all Rooms will be assigned + the schedules. occupancy_sch_: A fractional schedule for the occupancy over the course of the year. This can also be the identifier of a schedule to be looked up in the schedule library. @@ -70,7 +72,7 @@ ghenv.Component.Name = "HB Apply Room Schedules" ghenv.Component.NickName = 'ApplyRoomSch' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '2 :: Schedules' ghenv.Component.AdditionalHelpFromDocStrings = "3" @@ -78,6 +80,7 @@ import uuid try: + from honeybee.model import Model from honeybee.room import Room except ImportError as e: raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e)) @@ -141,88 +144,98 @@ def duplicate_and_id_program(program): if all_required_inputs(ghenv.Component): # duplicate the initial objects - mod_obj = [] + mod_obj, edit_objs = [], [] for obj in _room_or_program: if isinstance(obj, Room): - mod_obj.append(obj.duplicate()) + new_obj = obj.duplicate() + mod_obj.append(new_obj) + edit_objs.append(new_obj) + elif isinstance(obj, Model): + new_obj = obj.duplicate() + mod_obj.append(new_obj) + edit_objs.extend(new_obj.rooms) elif isinstance(obj, ProgramType): - mod_obj.append(duplicate_and_id_program(obj)) + new_obj = duplicate_and_id_program(obj) + mod_obj.append(new_obj) + edit_objs.append(new_obj) elif isinstance(obj, str): try: program = building_program_type_by_identifier(obj) except ValueError: program = program_type_by_identifier(obj) - mod_obj.append(duplicate_and_id_program(program)) + new_obj = duplicate_and_id_program(obj) + mod_obj.append(new_obj) + edit_objs.append(new_obj) else: - raise TypeError('Expected Honeybee Room or ProgramType. ' + raise TypeError('Expected Honeybee Room, Model or ProgramType. ' 'Got {}.'.format(type(obj))) # assign the occupancy schedule if len(occupancy_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): people = dup_load(obj, 'people', 'occupancy_sch_') people.occupancy_schedule = schedule_object(longest_list(occupancy_sch_, i)) assign_load(obj, people, 'people') # assign the activity schedule if len(activity_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): people = dup_load(obj, 'people', 'activity_sch_') people.activity_schedule = schedule_object(longest_list(activity_sch_, i)) assign_load(obj, people, 'people') # assign the lighting schedule if len(lighting_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): lighting = dup_load(obj, 'lighting', 'lighting_sch_') lighting.schedule = schedule_object(longest_list(lighting_sch_, i)) assign_load(obj, lighting, 'lighting') # assign the electric equipment schedule if len(electric_equip_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): equip = dup_load(obj, 'electric_equipment', 'electric_equip_sch_') equip.schedule = schedule_object(longest_list(electric_equip_sch_, i)) assign_load(obj, equip, 'electric_equipment') # assign the gas equipment schedule if len(gas_equip_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): equip = dup_load(obj, 'gas_equipment', 'gas_equip_sch_') equip.schedule = schedule_object(longest_list(gas_equip_sch_, i)) assign_load(obj, equip, 'gas_equipment') # assign the hot water schedule if len(hot_water_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): shw = dup_load(obj, 'service_hot_water', 'hot_water_sch_') shw.schedule = schedule_object(longest_list(hot_water_sch_, i)) assign_load(obj, shw, 'service_hot_water') # assign the infiltration schedule if len(infiltration_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): infiltration = dup_load(obj, 'infiltration', 'infiltration_sch_') infiltration.schedule = schedule_object(longest_list(infiltration_sch_, i)) assign_load(obj, infiltration, 'infiltration') # assign the ventilation schedule if len(ventilation_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): ventilation = dup_load(obj, 'ventilation', 'ventilation_sch_') ventilation.schedule = schedule_object(longest_list(ventilation_sch_, i)) assign_load(obj, ventilation, 'ventilation') # assign the heating setpoint schedule if len(heating_setpt_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): setpoint = dup_load(obj, 'setpoint', 'heating_setpt_sch_') setpoint.heating_schedule = schedule_object(longest_list(heating_setpt_sch_, i)) assign_load(obj, setpoint, 'setpoint') # assign the cooling setpoint schedule if len(cooling_setpt_sch_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): setpoint = dup_load(obj, 'setpoint', 'cooling_setpt_sch_') setpoint.cooling_schedule = schedule_object(longest_list(cooling_setpt_sch_, i)) assign_load(obj, setpoint, 'setpoint') diff --git a/honeybee_grasshopper_energy/src/HB Apply Setpoint Values.py b/honeybee_grasshopper_energy/src/HB Apply Setpoint Values.py index 650e7b09..4555615d 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Setpoint Values.py +++ b/honeybee_grasshopper_energy/src/HB Apply Setpoint Values.py @@ -14,7 +14,9 @@ Args: _room_or_program: Honeybee Rooms or ProgramType objects to which the input setpoints should be assigned. This can also be the identifier of a - ProgramType to be looked up in the program type library. + ProgramType to be looked up in the program type library. This can + also be a Honeybee Model for which all Rooms will be assigned + the setpoints. cooling_setpt_: A numerical value for a single constant temperature for the cooling setpoint [C]. heating_setpt_: A numerical value for a single constant temperature for @@ -31,7 +33,7 @@ ghenv.Component.Name = "HB Apply Setpoint Values" ghenv.Component.NickName = 'ApplySetpointVals' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '3 :: Loads' ghenv.Component.AdditionalHelpFromDocStrings = "2" @@ -39,6 +41,7 @@ import uuid try: + from honeybee.model import Model from honeybee.room import Room except ImportError as e: raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e)) @@ -96,46 +99,56 @@ def duplicate_and_id_program(program): if all_required_inputs(ghenv.Component): # duplicate the initial objects - mod_obj = [] + mod_obj, edit_objs = [], [] for obj in _room_or_program: if isinstance(obj, Room): - mod_obj.append(obj.duplicate()) + new_obj = obj.duplicate() + mod_obj.append(new_obj) + edit_objs.append(new_obj) + elif isinstance(obj, Model): + new_obj = obj.duplicate() + mod_obj.append(new_obj) + edit_objs.extend(new_obj.rooms) elif isinstance(obj, ProgramType): - mod_obj.append(duplicate_and_id_program(obj)) + new_obj = duplicate_and_id_program(obj) + mod_obj.append(new_obj) + edit_objs.append(new_obj) elif isinstance(obj, str): try: program = building_program_type_by_identifier(obj) except ValueError: program = program_type_by_identifier(obj) - mod_obj.append(duplicate_and_id_program(program)) + new_obj = duplicate_and_id_program(obj) + mod_obj.append(new_obj) + edit_objs.append(new_obj) else: - raise TypeError('Expected Honeybee Room or ProgramType. ' + raise TypeError('Expected Honeybee Room, Model or ProgramType. ' 'Got {}.'.format(type(obj))) # assign the cooling_setpt_ if len(cooling_setpt_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): setpoint = dup_setpoint(obj) setpoint.cooling_setpoint = longest_list(cooling_setpt_, i) assign_setpoint(obj, setpoint) # assign the heating_setpt_ if len(heating_setpt_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): setpoint = dup_setpoint(obj) setpoint.heating_setpoint = longest_list(heating_setpt_, i) assign_setpoint(obj, setpoint) # assign the humid_setpt_ if len(humid_setpt_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): setpoint = dup_setpoint(obj) setpoint.humidifying_setpoint = longest_list(humid_setpt_, i) assign_setpoint(obj, setpoint) # assign the dehumid_setpt_ if len(dehumid_setpt_) != 0: - for i, obj in enumerate(mod_obj): + for i, obj in enumerate(edit_objs): setpoint = dup_setpoint(obj) setpoint.dehumidifying_setpoint = longest_list(dehumid_setpt_, i) assign_setpoint(obj, setpoint) diff --git a/honeybee_grasshopper_energy/src/HB Apply Shade Construction.py b/honeybee_grasshopper_energy/src/HB Apply Shade Construction.py index bc0b0f83..e2d016ca 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Shade Construction.py +++ b/honeybee_grasshopper_energy/src/HB Apply Shade Construction.py @@ -30,14 +30,14 @@ construction library. If an array of text or construction objects are input here, different constructions will be assigned based on cardinal direction, starting with north and moving clockwise. - + Returns: hb_objs: The input honeybee objects with their constructions edited. """ ghenv.Component.Name = "HB Apply Shade Construction" ghenv.Component.NickName = 'ApplyShadeConstr' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '1 :: Constructions' ghenv.Component.AdditionalHelpFromDocStrings = '3' @@ -50,6 +50,7 @@ try: # import the core honeybee dependencies from honeybee.shade import Shade + from honeybee.model import Model from honeybee.room import Room from honeybee.face import Face from honeybee.aperture import Aperture @@ -84,6 +85,9 @@ elif isinstance(obj, (Aperture, Face, Room, Door)): for shd in obj.shades: shd.properties.energy.construction = _constr[0] + elif isinstance(obj, Model): + for shd in obj.orphaned_shades: + shd.properties.energy.construction = _constr[0] else: raise TypeError(error_msg.format(type(obj))) else: # assign constructions based on cardinal direction @@ -99,6 +103,9 @@ elif isinstance(obj, Room): for shd in obj.shades: shd.properties.energy.construction = _constr[0] + elif isinstance(obj, Model): + for shd in obj.orphaned_shades: + shd.properties.energy.construction = _constr[0] else: raise TypeError(error_msg.format(type(obj))) diff --git a/honeybee_grasshopper_energy/src/HB Apply Shade Schedule.py b/honeybee_grasshopper_energy/src/HB Apply Shade Schedule.py index 9fcaf7da..a336e87d 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Shade Schedule.py +++ b/honeybee_grasshopper_energy/src/HB Apply Shade Schedule.py @@ -18,21 +18,21 @@ - Args: - _hb_objs: Honeybee Shades, Apertures, Door, Faces, or Rooms to which the + _hb_objs: Honeybee Shades, Apertures, Door, Faces, Rooms or a Model to which the input _trans_sch should be assigned. For the case of a Honeybee Aperture, - Door, Face or Room, the ShadeConstruction will be assigned to only the - child shades directly assigned to that object. So passing in a Room + Door, Face, Room, or Model, the ShadeConstruction will be assigned to only + the child shades directly assigned to that object. So passing in a Room will not change the schedule of shades assigned to Apertures - of the Room's Faces. If this is the desired outcome, then the Room - should be deconstructed into its child objects before using - this component. + of the Room's Faces. If changing these sub-children is the desired + outcome, then the Room should be deconstructed into its child objects + before using this component. _trans_sch: A Honeybee ScheduleRuleset or ScheduleFixedInterval to be applied to the input _hb_objs. This can also be text for a schedule to be looked up in the shade schedule library. If an array of text or schedule objects are input here, different schedules will be assigned based on cardinal direction, starting with north and moving clockwise. - + Returns: hb_objs: The input honeybee objects with their shade transmittance schedules edited. @@ -40,7 +40,7 @@ ghenv.Component.Name = "HB Apply Shade Schedule" ghenv.Component.NickName = 'ApplyShadeSch' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '2 :: Schedules' ghenv.Component.AdditionalHelpFromDocStrings = '3' @@ -53,6 +53,7 @@ try: # import the core honeybee dependencies from honeybee.shade import Shade + from honeybee.model import Model from honeybee.room import Room from honeybee.face import Face from honeybee.aperture import Aperture @@ -87,6 +88,9 @@ elif isinstance(obj, (Aperture, Face, Room, Door)): for shd in obj.shades: shd.properties.energy.transmittance_schedule = _trans_sch[0] + elif isinstance(obj, Model): + for shd in obj.orphaned_shades: + shd.properties.energy.transmittance_schedule = _trans_sch[0] else: raise TypeError(error_msg.format(type(obj))) else: # assign schedules based on cardinal direction @@ -102,5 +106,8 @@ elif isinstance(obj, Room): for shd in obj.shades: shd.properties.energy.transmittance_schedule = _trans_sch[0] + elif isinstance(obj, Model): + for shd in obj.orphaned_shades: + shd.properties.energy.transmittance_schedule = _trans_sch[0] else: raise TypeError(error_msg.format(type(obj))) diff --git a/honeybee_grasshopper_energy/src/HB Apply Window Construction.py b/honeybee_grasshopper_energy/src/HB Apply Window Construction.py index 7d3f51dd..f36ae012 100644 --- a/honeybee_grasshopper_energy/src/HB Apply Window Construction.py +++ b/honeybee_grasshopper_energy/src/HB Apply Window Construction.py @@ -17,8 +17,8 @@ - Args: - _hb_objs: Honeybee Apertures, Faces, Doors or Rooms to which the input - _constr should be assigned. For the case of a Honeybee Room, the + _hb_objs: Honeybee Apertures, Faces, Doors, Rooms or a Model to which the input + _constr should be assigned. For the case of a Room or a Model, the construction will only be applied to the apertures in the the Room's outdoor walls. Note that, if you need to assign a construction to all the skylights, glass doors, etc. of a Room, the best practice @@ -36,7 +36,7 @@ ghenv.Component.Name = "HB Apply Window Construction" ghenv.Component.NickName = 'ApplyWindowConstr' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '1 :: Constructions' ghenv.Component.AdditionalHelpFromDocStrings = '3' @@ -50,6 +50,7 @@ try: # import the core honeybee dependencies from honeybee.boundarycondition import Outdoors from honeybee.facetype import Wall + from honeybee.model import Model from honeybee.room import Room from honeybee.face import Face from honeybee.aperture import Aperture @@ -90,7 +91,7 @@ def is_exterior_wall(face): elif isinstance(obj, Face): for ap in obj.apertures: ap.properties.energy.construction = _constr[0] - elif isinstance(obj, Room): + elif isinstance(obj, (Room, Model)): for face in obj.faces: if is_exterior_wall(face): for ap in face.apertures: @@ -109,7 +110,7 @@ def is_exterior_wall(face): if orient_i is not None: for ap in obj.apertures: ap.properties.energy.construction = _constr[orient_i] - elif isinstance(obj, Room): + elif isinstance(obj, (Room, Model)): for face in obj.faces: if is_exterior_wall(face): orient_i = face_orient_index(face, angles) diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Abolute Load Values.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Abolute Load Values.ghuser index 7c4ff07d..5456ba91 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Abolute Load Values.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Abolute Load Values.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply ConstructionSet.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply ConstructionSet.ghuser index 8210ae0b..50db28c6 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply ConstructionSet.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply ConstructionSet.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Daylight Control.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Daylight Control.ghuser index 7242a842..8d5d873d 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Daylight Control.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Daylight Control.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Load Values.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Load Values.ghuser index ed5c27f3..5b382dd5 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Load Values.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Load Values.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Opaque Construction.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Opaque Construction.ghuser index bc5fd9c8..cc5d7d3d 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Opaque Construction.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Opaque Construction.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply ProgramType.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply ProgramType.ghuser index 5faff5cc..8ddd06bd 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply ProgramType.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply ProgramType.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Room Schedules.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Room Schedules.ghuser index 0be5edab..3cff14c0 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Room Schedules.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Room Schedules.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Setpoint Values.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Setpoint Values.ghuser index eeb93b1d..41a5b338 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Setpoint Values.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Setpoint Values.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Shade Construction.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Shade Construction.ghuser index f614a45c..859f1217 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Shade Construction.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Shade Construction.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Shade Schedule.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Shade Schedule.ghuser index e78f3b74..2f8ce32f 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Shade Schedule.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Shade Schedule.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Apply Window Construction.ghuser b/honeybee_grasshopper_energy/user_objects/HB Apply Window Construction.ghuser index 78b8b6df..e03994d0 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Apply Window Construction.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Apply Window Construction.ghuser differ