Skip to content

Commit

Permalink
fix(simulate): Add warning when both standard and factors are set
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Jun 4, 2024
1 parent d8a6b2e commit 6ddc523
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
Binary file modified honeybee_grasshopper_energy/icon/HB Sizing Parameter.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_Sizing_Parameter.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.0",
"version": "1.8.1",
"nickname": "SizingPar",
"outputs": [
[
Expand Down Expand Up @@ -64,7 +64,7 @@
}
],
"subcategory": "5 :: Simulate",
"code": "\ntry:\n from honeybee_energy.simulation.sizing import SizingParameter\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import turn_off_old_tag\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\nturn_off_old_tag(ghenv.Component)\n\n\n# dictionary to get correct efficiency standards\nEFF_STANDARDS = {\n 'DOE_Ref_Pre_1980': 'DOE_Ref_Pre_1980',\n 'DOE_Ref_1980_2004': 'DOE_Ref_1980_2004',\n 'ASHRAE_2004': 'ASHRAE_2004',\n 'ASHRAE_2007': 'ASHRAE_2007',\n 'ASHRAE_2010': 'ASHRAE_2010',\n 'ASHRAE_2013': 'ASHRAE_2013',\n 'ASHRAE_2016': 'ASHRAE_2016',\n 'ASHRAE_2019': 'ASHRAE_2019',\n 'pre_1980': 'DOE_Ref_Pre_1980',\n '1980_2004': 'DOE_Ref_1980_2004',\n '2004': 'ASHRAE_2004',\n '2007': 'ASHRAE_2007',\n '2010': 'ASHRAE_2010',\n '2013': 'ASHRAE_2013',\n '2016': 'ASHRAE_2016',\n '2019': 'ASHRAE_2019'\n}\n\n# set default sizing factors\nheating_fac = 1.25 if _heating_fac_ is None else _heating_fac_\ncooling_fac = 1.15 if _cooling_fac_ is None else _cooling_fac_\n\n# create the object\nsizing = SizingParameter(None, heating_fac, cooling_fac)\n\n# apply design days from ddy\nif ddy_file_ is not None:\n if filter_ddays_ == 1:\n sizing.add_from_ddy_996_004(ddy_file_)\n elif filter_ddays_ == 2:\n sizing.add_from_ddy_990_010(ddy_file_)\n else:\n sizing.add_from_ddy(ddy_file_)\n\n# set the efficiency standard if provided\nif eff_standard_ is not None:\n sizing.efficiency_standard = EFF_STANDARDS[eff_standard_]\nif climate_zone_ is not None:\n sizing.climate_zone = climate_zone_\nif bldg_type_ is not None:\n sizing.building_type = bldg_type_\n",
"code": "\ntry:\n from honeybee_energy.simulation.sizing import SizingParameter\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import turn_off_old_tag, give_warning\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\nturn_off_old_tag(ghenv.Component)\n\n\n# dictionary to get correct efficiency standards\nEFF_STANDARDS = {\n 'DOE_Ref_Pre_1980': 'DOE_Ref_Pre_1980',\n 'DOE_Ref_1980_2004': 'DOE_Ref_1980_2004',\n 'ASHRAE_2004': 'ASHRAE_2004',\n 'ASHRAE_2007': 'ASHRAE_2007',\n 'ASHRAE_2010': 'ASHRAE_2010',\n 'ASHRAE_2013': 'ASHRAE_2013',\n 'ASHRAE_2016': 'ASHRAE_2016',\n 'ASHRAE_2019': 'ASHRAE_2019',\n 'pre_1980': 'DOE_Ref_Pre_1980',\n '1980_2004': 'DOE_Ref_1980_2004',\n '2004': 'ASHRAE_2004',\n '2007': 'ASHRAE_2007',\n '2010': 'ASHRAE_2010',\n '2013': 'ASHRAE_2013',\n '2016': 'ASHRAE_2016',\n '2019': 'ASHRAE_2019'\n}\n\n# give a warning if both efficiency standard and factors are set\nif eff_standard_ is not None and (_heating_fac_ is not None or _cooling_fac_ is not None):\n msg = 'Applying an ASHRAE efficiency standard requires the use of\\n '\\\n 'a heating factor of 1.25 and a cooling factor of 1.15.\\n' \\\n 'The input _heating_fac_ and _cooling_fac_ will be ignored.'\n give_warning(ghenv.Component, msg)\n\n# set default sizing factors\nheating_fac = 1.25 if _heating_fac_ is None else _heating_fac_\ncooling_fac = 1.15 if _cooling_fac_ is None else _cooling_fac_\n\n# create the object\nsizing = SizingParameter(None, heating_fac, cooling_fac)\n\n# apply design days from ddy\nif ddy_file_ is not None:\n if filter_ddays_ == 1:\n sizing.add_from_ddy_996_004(ddy_file_)\n elif filter_ddays_ == 2:\n sizing.add_from_ddy_990_010(ddy_file_)\n else:\n sizing.add_from_ddy(ddy_file_)\n\n# set the efficiency standard if provided\nif eff_standard_ is not None:\n sizing.efficiency_standard = EFF_STANDARDS[eff_standard_]\nif climate_zone_ is not None:\n sizing.climate_zone = climate_zone_\nif bldg_type_ is not None:\n sizing.building_type = bldg_type_\n",
"category": "HB-Energy",
"name": "HB Sizing Parameter",
"description": "Create parameters with criteria for sizing the heating and cooling system.\n-"
Expand Down
11 changes: 9 additions & 2 deletions honeybee_grasshopper_energy/src/HB Sizing Parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

ghenv.Component.Name = 'HB Sizing Parameter'
ghenv.Component.NickName = 'SizingPar'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Message = '1.8.1'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '5 :: Simulate'
ghenv.Component.AdditionalHelpFromDocStrings = '3'
Expand All @@ -97,7 +97,7 @@
raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e))

try:
from ladybug_rhino.grasshopper import turn_off_old_tag
from ladybug_rhino.grasshopper import turn_off_old_tag, give_warning
except ImportError as e:
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
turn_off_old_tag(ghenv.Component)
Expand All @@ -123,6 +123,13 @@
'2019': 'ASHRAE_2019'
}

# give a warning if both efficiency standard and factors are set
if eff_standard_ is not None and (_heating_fac_ is not None or _cooling_fac_ is not None):
msg = 'Applying an ASHRAE efficiency standard requires the use of\n '\
'a heating factor of 1.25 and a cooling factor of 1.15.\n' \
'The input _heating_fac_ and _cooling_fac_ will be ignored.'
give_warning(ghenv.Component, msg)

# set default sizing factors
heating_fac = 1.25 if _heating_fac_ is None else _heating_fac_
cooling_fac = 1.15 if _cooling_fac_ is None else _cooling_fac_
Expand Down
Binary file modified honeybee_grasshopper_energy/user_objects/HB Sizing Parameter.ghuser
Binary file not shown.
Binary file modified samples/shoe_box_energy_model.gh
Binary file not shown.

0 comments on commit 6ddc523

Please sign in to comment.