Skip to content

Commit

Permalink
fix(result): Change load balance to exclude floor area for model input
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Sep 20, 2022
1 parent 1d5d027 commit 9eaae84
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Binary file modified honeybee_grasshopper_energy/icon/HB Thermal Load Balance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions honeybee_grasshopper_energy/json/HB_Thermal_Load_Balance.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.5.0",
"version": "1.5.1",
"nickname": "LoadBalance",
"outputs": [
[
Expand Down Expand Up @@ -134,7 +134,7 @@
}
],
"subcategory": "6 :: Result",
"code": "\ntry:\n from honeybee.model import Model\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.result.loadbalance import LoadBalance\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.config import units_system\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, give_warning\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef check_input(input_list):\n \"\"\"Check that an input isn't a zero-length list or None.\"\"\"\n return None if len(input_list) == 0 or input_list[0] is None else input_list\n\n\nif all_required_inputs(ghenv.Component):\n # extract any rooms from input Models\n is_model = False\n rooms = []\n for hb_obj in _rooms_model:\n if isinstance(hb_obj, Model):\n rooms.extend(hb_obj.rooms)\n is_model = True\n else:\n rooms.append(hb_obj)\n\n # if the input is for individual rooms, check the solar to ensure no groued zones\n if not is_model and len(solar_gain_) != 0:\n msg = 'Air boundaries with grouped zones detected in solar data but individual ' \\\n 'rooms were input.\\nIt is recommended that the full model be input for ' \\\n '_rooms_model to ensure correct representaiton of solar.'\n for coll in solar_gain_:\n if 'Solar Enclosure' in coll.header.metadata['Zone']:\n print msg\n give_warning(ghenv.Component, msg)\n\n # process all of the inputs\n cooling_ = check_input(cooling_)\n heating_ = check_input(heating_)\n lighting_ = check_input(lighting_)\n electric_equip_ = check_input(electric_equip_)\n gas_equip_ = check_input(gas_equip_)\n hot_water_ = check_input(hot_water_)\n people_gain_ = check_input(people_gain_)\n solar_gain_ = check_input(solar_gain_)\n infiltration_load_ = check_input(infiltration_load_)\n mech_vent_load_ = check_input(mech_vent_load_)\n nat_vent_load_ = check_input(nat_vent_load_)\n face_energy_flow_ = check_input(face_energy_flow_)\n\n # process hot water to ensure it's the correct type\n hw_type = 'Water Use Equipment Heating Energy'\n if hot_water_ is not None and hot_water_[0].header.metadata['type'] == hw_type:\n new_hw = [hw * 0.25 for hw in hot_water_]\n for hw in new_hw:\n hw.header.metadata = {\n 'type': 'Water Use Equipment Zone Sensible Heat Gain Energy',\n 'System': hw.header.metadata['System']\n }\n\n # construct the load balance object and output the results\n load_bal_obj = LoadBalance(\n rooms, cooling_, heating_, lighting_, electric_equip_, gas_equip_, process_,\n hot_water_, people_gain_, solar_gain_, infiltration_load_, mech_vent_load_,\n nat_vent_load_, face_energy_flow_, units_system(), use_all_solar=is_model)\n\n balance = load_bal_obj.load_balance_terms(False, False)\n if len(balance) != 0:\n balance_stor = balance + [load_bal_obj.storage]\n norm_bal = load_bal_obj.load_balance_terms(True, False)\n norm_bal_stor = load_bal_obj.load_balance_terms(True, True)\n",
"code": "\ntry:\n from honeybee.model import Model\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.result.loadbalance import LoadBalance\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.config import units_system\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, give_warning\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef check_input(input_list):\n \"\"\"Check that an input isn't a zero-length list or None.\"\"\"\n return None if len(input_list) == 0 or input_list[0] is None else input_list\n\n\nif all_required_inputs(ghenv.Component):\n # extract any rooms from input Models\n is_model, floor_area = False, 0\n rooms = []\n for hb_obj in _rooms_model:\n if isinstance(hb_obj, Model):\n rooms.extend(hb_obj.rooms)\n is_model = True\n floor_area += hb_obj.floor_area\n else:\n rooms.append(hb_obj)\n\n # if the input is for individual rooms, check the solar to ensure no groued zones\n if not is_model and len(solar_gain_) != 0:\n msg = 'Air boundaries with grouped zones detected in solar data but individual ' \\\n 'rooms were input.\\nIt is recommended that the full model be input for ' \\\n '_rooms_model to ensure correct representaiton of solar.'\n for coll in solar_gain_:\n if 'Solar Enclosure' in coll.header.metadata['Zone']:\n print msg\n give_warning(ghenv.Component, msg)\n\n # process all of the inputs\n cooling_ = check_input(cooling_)\n heating_ = check_input(heating_)\n lighting_ = check_input(lighting_)\n electric_equip_ = check_input(electric_equip_)\n gas_equip_ = check_input(gas_equip_)\n hot_water_ = check_input(hot_water_)\n people_gain_ = check_input(people_gain_)\n solar_gain_ = check_input(solar_gain_)\n infiltration_load_ = check_input(infiltration_load_)\n mech_vent_load_ = check_input(mech_vent_load_)\n nat_vent_load_ = check_input(nat_vent_load_)\n face_energy_flow_ = check_input(face_energy_flow_)\n\n # process hot water to ensure it's the correct type\n hw_type = 'Water Use Equipment Heating Energy'\n if hot_water_ is not None and hot_water_[0].header.metadata['type'] == hw_type:\n new_hw = [hw * 0.25 for hw in hot_water_]\n for hw in new_hw:\n hw.header.metadata = {\n 'type': 'Water Use Equipment Zone Sensible Heat Gain Energy',\n 'System': hw.header.metadata['System']\n }\n\n # construct the load balance object and output the results\n load_bal_obj = LoadBalance(\n rooms, cooling_, heating_, lighting_, electric_equip_, gas_equip_, process_,\n hot_water_, people_gain_, solar_gain_, infiltration_load_, mech_vent_load_,\n nat_vent_load_, face_energy_flow_, units_system(), use_all_solar=is_model)\n if is_model:\n load_bal_obj.floor_area = floor_area\n\n balance = load_bal_obj.load_balance_terms(False, False)\n if len(balance) != 0:\n balance_stor = balance + [load_bal_obj.storage]\n norm_bal = load_bal_obj.load_balance_terms(True, False)\n norm_bal_stor = load_bal_obj.load_balance_terms(True, True)\n",
"category": "HB-Energy",
"name": "HB Thermal Load Balance",
"description": "Construct a complete thermal load balance from energy simulation results and\nhoneybee Rooms or a Model.\n-"
Expand Down
7 changes: 5 additions & 2 deletions honeybee_grasshopper_energy/src/HB Thermal Load Balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

ghenv.Component.Name = 'HB Thermal Load Balance'
ghenv.Component.NickName = 'LoadBalance'
ghenv.Component.Message = '1.5.0'
ghenv.Component.Message = '1.5.1'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '6 :: Result'
ghenv.Component.AdditionalHelpFromDocStrings = '3'
Expand Down Expand Up @@ -96,12 +96,13 @@ def check_input(input_list):

if all_required_inputs(ghenv.Component):
# extract any rooms from input Models
is_model = False
is_model, floor_area = False, 0
rooms = []
for hb_obj in _rooms_model:
if isinstance(hb_obj, Model):
rooms.extend(hb_obj.rooms)
is_model = True
floor_area += hb_obj.floor_area
else:
rooms.append(hb_obj)

Expand Down Expand Up @@ -144,6 +145,8 @@ def check_input(input_list):
rooms, cooling_, heating_, lighting_, electric_equip_, gas_equip_, process_,
hot_water_, people_gain_, solar_gain_, infiltration_load_, mech_vent_load_,
nat_vent_load_, face_energy_flow_, units_system(), use_all_solar=is_model)
if is_model:
load_bal_obj.floor_area = floor_area

balance = load_bal_obj.load_balance_terms(False, False)
if len(balance) != 0:
Expand Down
Binary file not shown.
Binary file modified samples/single_family_energy_model.gh
Binary file not shown.

0 comments on commit 9eaae84

Please sign in to comment.