diff --git a/honeybee_grasshopper_energy/icon/HB Annual Loads.png b/honeybee_grasshopper_energy/icon/HB Annual Loads.png index 3c1ace8d..93db7963 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Annual Loads.png and b/honeybee_grasshopper_energy/icon/HB Annual Loads.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Balance Temperature.png b/honeybee_grasshopper_energy/icon/HB Balance Temperature.png index 1c18d292..76b87954 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Balance Temperature.png and b/honeybee_grasshopper_energy/icon/HB Balance Temperature.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Run IDF.png b/honeybee_grasshopper_energy/icon/HB Run IDF.png index ba056c8f..a9b50328 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Run IDF.png and b/honeybee_grasshopper_energy/icon/HB Run IDF.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Run OSM.png b/honeybee_grasshopper_energy/icon/HB Run OSM.png index ba18f9f5..5a559ba6 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Run OSM.png and b/honeybee_grasshopper_energy/icon/HB Run OSM.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Run OSW.png b/honeybee_grasshopper_energy/icon/HB Run OSW.png index 1397e7a7..42b7a996 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Run OSW.png and b/honeybee_grasshopper_energy/icon/HB Run OSW.png differ diff --git a/honeybee_grasshopper_energy/icon/HB Thermal Load Balance.png b/honeybee_grasshopper_energy/icon/HB Thermal Load Balance.png index ecf3a690..0b6156a7 100644 Binary files a/honeybee_grasshopper_energy/icon/HB Thermal Load Balance.png and b/honeybee_grasshopper_energy/icon/HB Thermal Load Balance.png differ diff --git a/honeybee_grasshopper_energy/json/HB_Annual_Loads.json b/honeybee_grasshopper_energy/json/HB_Annual_Loads.json index 87e748c3..58da481e 100644 --- a/honeybee_grasshopper_energy/json/HB_Annual_Loads.json +++ b/honeybee_grasshopper_energy/json/HB_Annual_Loads.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "AnnualLoads", "outputs": [ [ @@ -127,7 +127,7 @@ } ], "subcategory": "5 :: Simulate", - "code": "\nimport os\nimport subprocess\nimport json\n\ntry:\n from ladybug.futil import write_to_file_by_name, nukedir\n from ladybug.epw import EPW\n from ladybug.sql import SQLiteResult\n from ladybug.datacollection import MonthlyCollection\n from ladybug.header import Header\n from ladybug.analysisperiod import AnalysisPeriod\n from ladybug.datatype.energyintensity import EnergyIntensity\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from honeybee.config import folders\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\n from honeybee_energy.simulation.parameter import SimulationParameter\n from honeybee_energy.run import run_idf\n from honeybee_energy.result.err import Err\n from honeybee_energy.writer import energyplus_idf_version\n from honeybee_energy.config import folders as energy_folders\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from lbt_recipes.version import check_energyplus_version\nexcept ImportError as e:\n raise ImportError('\\nFailed to import lbt_recipes:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.togeometry import to_vector2d\n from ladybug_{{cad}}.config import conversion_to_meters, units_system, \\\n tolerance, angle_tolerance\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_window_vent(rooms):\n \"\"\"Check a rooms to make sure there's no opening of windows as coarse timestep.\"\"\"\n for room in rooms:\n if room.properties.energy.window_vent_control is not None:\n msg = 'Window ventilation was detected but your timestep is too low ' \\\n 'to model window opening correctly.\\nIt is recommended that you ' \\\n 'increase your timestep to at least 4 to get loads for this case.'\n print msg\n give_warning(ghenv.Component, msg)\n\n\ndef data_to_load_intensity(data_colls, floor_area, data_type, cop=1, mults=None):\n \"\"\"Convert data collections output by EnergyPlus to a single load intensity collection.\n\n Args:\n data_colls: A list of monthly data collections for an energy term.\n floor_area: The total floor area of the rooms, used to compute EUI.\n data_type: Text for the data type of the collections (eg. \"Cooling\").\n cop: Optional number for the COP, which the results will be divided by.\n \"\"\"\n if len(data_colls) != 0:\n if mults is not None:\n if 'Zone' in data_colls[0].header.metadata:\n rel_mults = [mults[data.header.metadata['Zone']] for data in data_colls]\n data_colls = [dat * mul for dat, mul in zip(data_colls, rel_mults)]\n total_vals = [sum(month_vals) / floor_area for month_vals in zip(*data_colls)]\n if cop != 1:\n total_vals = [val / cop for val in total_vals]\n else: # just make a \"filler\" collection of 0 values\n total_vals = [0] * 12\n meta_dat = {'type': data_type}\n total_head = Header(EnergyIntensity(), 'kWh/m2', AnalysisPeriod(), meta_dat)\n return MonthlyCollection(total_head, total_vals, range(12))\n\n\ndef serialize_data(data_dicts):\n \"\"\"Reserialize a list of MonthlyCollection dictionaries.\"\"\"\n return [MonthlyCollection.from_dict(data) for data in data_dicts]\n\n\n# List of all the output strings that will be requested\ncool_out = 'Zone Ideal Loads Supply Air Total Cooling Energy'\nheat_out = 'Zone Ideal Loads Supply Air Total Heating Energy'\nlight_out = 'Zone Lights Electricity Energy'\nel_equip_out = 'Zone Electric Equipment Electricity Energy'\ngas_equip_out = 'Zone Gas Equipment NaturalGas Energy'\nprocess1_out = 'Zone Other Equipment Total Heating Energy'\nprocess2_out = 'Zone Other Equipment Lost Heat Energy'\nshw_out = 'Water Use Equipment Heating Energy'\ngl_el_equip_out = 'Zone Electric Equipment Total Heating Energy'\ngl_gas_equip_out = 'Zone Gas Equipment Total Heating Energy'\ngl1_shw_out = 'Water Use Equipment Zone Sensible Heat Gain Energy'\ngl2_shw_out = 'Water Use Equipment Zone Latent Gain Energy'\nenergy_output = (cool_out, heat_out, light_out, el_equip_out, gas_equip_out,\n process1_out, process2_out, shw_out)\n\n\nif all_required_inputs(ghenv.Component) and _run:\n # check the presence of energyplus and check that the version is compatible\n check_energyplus_version()\n\n # set defaults for COP\n _heat_cop_ = 1 if _heat_cop_ is None else _heat_cop_\n _cool_cop_ = 1 if _cool_cop_ is None else _cool_cop_\n\n # create the Model from the _rooms and shades_\n _model = Model('Annual_Loads', _rooms, orphaned_shades=shades_, units=units_system(),\n tolerance=tolerance, angle_tolerance=angle_tolerance)\n floor_area = _model.floor_area\n assert floor_area != 0, 'Connected _rooms have no floors with which to compute EUI.'\n floor_area = floor_area * conversion_to_meters() ** 2\n mults = {rm.identifier.upper(): rm.multiplier for rm in _model.rooms}\n mults = None if all(mul == 1 for mul in mults.values()) else mults\n\n # process the simulation folder name and the directory\n directory = os.path.join(folders.default_simulation_folder, _model.identifier)\n sch_directory = os.path.join(directory, 'schedules')\n nukedir(directory) # delete any existing files in the directory\n\n # create simulation parameters for the coarsest/fastest E+ sim possible\n _sim_par_ = SimulationParameter()\n _sim_par_.timestep = _timestep_ if _timestep_ is not None else 1\n _sim_par_.shadow_calculation.solar_distribution = 'FullExterior'\n _sim_par_.output.add_zone_energy_use()\n _sim_par_.output.reporting_frequency = 'Monthly'\n if run_bal_:\n _sim_par_.output.add_output(gl_el_equip_out)\n _sim_par_.output.add_output(gl_gas_equip_out)\n _sim_par_.output.add_output(gl1_shw_out)\n _sim_par_.output.add_output(gl2_shw_out)\n _sim_par_.output.add_gains_and_losses('Total')\n _sim_par_.output.add_surface_energy_flow()\n # set the north if it is not defaulted\n if _north_ is not None:\n try:\n _sim_par_.north_vector = to_vector2d(_north_)\n except AttributeError: # north angle instead of vector\n _sim_par_.north_angle = float(_north_)\n\n # check the rooms for inaccurate cases\n if _sim_par_.timestep < 4:\n check_window_vent(_rooms)\n\n # assign design days from the EPW\n msg = None\n folder, epw_file_name = os.path.split(_epw_file)\n ddy_file = os.path.join(folder, epw_file_name.replace('.epw', '.ddy'))\n if os.path.isfile(ddy_file):\n try:\n _sim_par_.sizing_parameter.add_from_ddy_996_004(ddy_file)\n except AssertionError:\n msg = 'No design days were found in the .ddy file next to the _epw_file.'\n else:\n msg = 'No .ddy file was found next to the _epw_file.'\n if msg is not None:\n epw_obj = EPW(_epw_file)\n des_days = [epw_obj.approximate_design_day('WinterDesignDay'),\n epw_obj.approximate_design_day('SummerDesignDay')]\n _sim_par_.sizing_parameter.design_days = des_days\n msg = msg + '\\nDesign days were generated from the input _epw_file but this ' \\\n '\\nis not as accurate as design days from DDYs distributed with the EPW.'\n give_warning(ghenv.Component, msg)\n print msg\n\n # create the strings for simulation paramters and model\n ver_str = energyplus_idf_version() if energy_folders.energyplus_version \\\n is not None else energyplus_idf_version(compatibe_ep_version)\n sim_par_str = _sim_par_.to_idf()\n model_str = _model.to.idf(\n _model, schedule_directory=sch_directory, patch_missing_adjacencies=True)\n idf_str = '\\n\\n'.join([ver_str, sim_par_str, model_str])\n\n # write the final string into an IDF\n idf = os.path.join(directory, 'in.idf')\n write_to_file_by_name(directory, 'in.idf', idf_str, True)\n\n # run the IDF through EnergyPlus\n silent = True if _run == 1 else False\n sql, zsz, rdd, html, err = run_idf(idf, _epw_file, silent=silent)\n if html is None and err is not None: # something went wrong; parse the errors\n err_obj = Err(err)\n print(err_obj.file_contents)\n for error in err_obj.fatal_errors:\n raise Exception(error)\n\n # parse the result sql and get the monthly data collections\n if os.name == 'nt': # we are on windows; use IronPython like usual\n sql_obj = SQLiteResult(sql)\n cool_init = sql_obj.data_collections_by_output_name(cool_out)\n heat_init = sql_obj.data_collections_by_output_name(heat_out)\n light_init = sql_obj.data_collections_by_output_name(light_out)\n elec_equip_init = sql_obj.data_collections_by_output_name(el_equip_out)\n gas_equip_init = sql_obj.data_collections_by_output_name(gas_equip_out)\n process1_init = sql_obj.data_collections_by_output_name(process1_out)\n process2_init = sql_obj.data_collections_by_output_name(process2_out)\n shw_init = sql_obj.data_collections_by_output_name(shw_out)\n else: # we are on Mac; sqlite3 module doesn't work in Mac IronPython\n # Execute the honybee CLI to obtain the results via CPython\n cmds = [folders.python_exe_path, '-m', 'honeybee_energy', 'result',\n 'data-by-outputs', sql]\n for outp in energy_output:\n cmds.append('[\"{}\"]'.format(outp))\n process = subprocess.Popen(cmds, stdout=subprocess.PIPE)\n stdout = process.communicate()\n data_coll_dicts = json.loads(stdout[0])\n cool_init = serialize_data(data_coll_dicts[0])\n heat_init = serialize_data(data_coll_dicts[1])\n light_init = serialize_data(data_coll_dicts[2])\n elec_equip_init = serialize_data(data_coll_dicts[3])\n gas_equip_init = serialize_data(data_coll_dicts[4])\n process1_init = serialize_data(data_coll_dicts[5])\n process2_init = serialize_data(data_coll_dicts[6])\n shw_init = serialize_data(data_coll_dicts[7])\n\n # convert the results to EUI and ouput them\n cooling = data_to_load_intensity(cool_init, floor_area, 'Cooling', _cool_cop_)\n heating = data_to_load_intensity(heat_init, floor_area, 'Heating', _heat_cop_)\n lighting = data_to_load_intensity(light_init, floor_area, 'Lighting', 1, mults)\n equip = data_to_load_intensity(elec_equip_init, floor_area, 'Electric Equipment', 1, mults)\n total_load = [cooling.total, heating.total, lighting.total, equip.total]\n\n # add gas equipment if it is there\n if len(gas_equip_init) != 0:\n gas_equip = data_to_load_intensity(gas_equip_init, floor_area, 'Gas Equipment', 1, mults)\n equip = [equip, gas_equip]\n total_load.append(gas_equip.total)\n # add process load if it is there\n process = []\n if len(process1_init) != 0:\n process1 = data_to_load_intensity(process1_init, floor_area, 'Process', 1, mults)\n process2 = data_to_load_intensity(process2_init, floor_area, 'Process', 1, mults)\n process = process1 + process2\n total_load.append(process.total)\n # add hot water if it is there\n hot_water = []\n if len(shw_init) != 0:\n hot_water = data_to_load_intensity(shw_init, floor_area, 'Service Hot Water', 1, mults)\n total_load.append(hot_water.total)\n\n # construct the load balance if requested\n if run_bal_:\n if os.name == 'nt': # we are on windows; use IronPython like usual\n bal_obj = LoadBalance.from_sql_file(_model, sql)\n balance = bal_obj.load_balance_terms(True, True)\n else: # we are on Mac; sqlite3 module doesn't work in Mac IronPython\n # Execute the honybee CLI to obtain the results via CPython\n model_json = os.path.join(directory, 'in.hbjson')\n with open(model_json, 'w') as fp:\n json.dump(_model.to_dict(), fp)\n cmds = [folders.python_exe_path, '-m', 'honeybee_energy', 'result',\n 'load-balance', model_json, sql]\n process = subprocess.Popen(cmds, stdout=subprocess.PIPE)\n stdout = process.communicate()\n balance = serialize_data(json.loads(stdout[0]))\n", + "code": "\nimport os\nimport subprocess\nimport json\n\ntry:\n from ladybug.futil import write_to_file_by_name, nukedir\n from ladybug.epw import EPW\n from ladybug.sql import SQLiteResult\n from ladybug.datacollection import MonthlyCollection\n from ladybug.header import Header\n from ladybug.analysisperiod import AnalysisPeriod\n from ladybug.datatype.energyintensity import EnergyIntensity\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from honeybee.config import folders\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\n from honeybee_energy.simulation.parameter import SimulationParameter\n from honeybee_energy.run import run_idf\n from honeybee_energy.result.err import Err\n from honeybee_energy.writer import energyplus_idf_version\n from honeybee_energy.config import folders as energy_folders\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from lbt_recipes.version import check_energyplus_version\nexcept ImportError as e:\n raise ImportError('\\nFailed to import lbt_recipes:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.togeometry import to_vector2d\n from ladybug_{{cad}}.config import conversion_to_meters, units_system, \\\n tolerance, angle_tolerance\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_window_vent(rooms):\n \"\"\"Check a rooms to make sure there's no opening of windows as coarse timestep.\"\"\"\n for room in rooms:\n if room.properties.energy.window_vent_control is not None:\n msg = 'Window ventilation was detected but your timestep is too low ' \\\n 'to model window opening correctly.\\nIt is recommended that you ' \\\n 'increase your timestep to at least 4 to get loads for this case.'\n print(msg)\n give_warning(ghenv.Component, msg)\n\n\ndef data_to_load_intensity(data_colls, floor_area, data_type, cop=1, mults=None):\n \"\"\"Convert data collections output by EnergyPlus to a single load intensity collection.\n\n Args:\n data_colls: A list of monthly data collections for an energy term.\n floor_area: The total floor area of the rooms, used to compute EUI.\n data_type: Text for the data type of the collections (eg. \"Cooling\").\n cop: Optional number for the COP, which the results will be divided by.\n \"\"\"\n if len(data_colls) != 0:\n if mults is not None:\n if 'Zone' in data_colls[0].header.metadata:\n rel_mults = [mults[data.header.metadata['Zone']] for data in data_colls]\n data_colls = [dat * mul for dat, mul in zip(data_colls, rel_mults)]\n total_vals = [sum(month_vals) / floor_area for month_vals in zip(*data_colls)]\n if cop != 1:\n total_vals = [val / cop for val in total_vals]\n else: # just make a \"filler\" collection of 0 values\n total_vals = [0] * 12\n meta_dat = {'type': data_type}\n total_head = Header(EnergyIntensity(), 'kWh/m2', AnalysisPeriod(), meta_dat)\n return MonthlyCollection(total_head, total_vals, range(12))\n\n\ndef serialize_data(data_dicts):\n \"\"\"Reserialize a list of MonthlyCollection dictionaries.\"\"\"\n return [MonthlyCollection.from_dict(data) for data in data_dicts]\n\n\n# List of all the output strings that will be requested\ncool_out = 'Zone Ideal Loads Supply Air Total Cooling Energy'\nheat_out = 'Zone Ideal Loads Supply Air Total Heating Energy'\nlight_out = 'Zone Lights Electricity Energy'\nel_equip_out = 'Zone Electric Equipment Electricity Energy'\ngas_equip_out = 'Zone Gas Equipment NaturalGas Energy'\nprocess1_out = 'Zone Other Equipment Total Heating Energy'\nprocess2_out = 'Zone Other Equipment Lost Heat Energy'\nshw_out = 'Water Use Equipment Heating Energy'\ngl_el_equip_out = 'Zone Electric Equipment Total Heating Energy'\ngl_gas_equip_out = 'Zone Gas Equipment Total Heating Energy'\ngl1_shw_out = 'Water Use Equipment Zone Sensible Heat Gain Energy'\ngl2_shw_out = 'Water Use Equipment Zone Latent Gain Energy'\nenergy_output = (cool_out, heat_out, light_out, el_equip_out, gas_equip_out,\n process1_out, process2_out, shw_out)\n\n\nif all_required_inputs(ghenv.Component) and _run:\n # check the presence of energyplus and check that the version is compatible\n check_energyplus_version()\n\n # set defaults for COP\n _heat_cop_ = 1 if _heat_cop_ is None else _heat_cop_\n _cool_cop_ = 1 if _cool_cop_ is None else _cool_cop_\n\n # create the Model from the _rooms and shades_\n _model = Model('Annual_Loads', _rooms, orphaned_shades=shades_, units=units_system(),\n tolerance=tolerance, angle_tolerance=angle_tolerance)\n floor_area = _model.floor_area\n assert floor_area != 0, 'Connected _rooms have no floors with which to compute EUI.'\n floor_area = floor_area * conversion_to_meters() ** 2\n mults = {rm.identifier.upper(): rm.multiplier for rm in _model.rooms}\n mults = None if all(mul == 1 for mul in mults.values()) else mults\n\n # process the simulation folder name and the directory\n directory = os.path.join(folders.default_simulation_folder, _model.identifier)\n sch_directory = os.path.join(directory, 'schedules')\n nukedir(directory) # delete any existing files in the directory\n\n # create simulation parameters for the coarsest/fastest E+ sim possible\n _sim_par_ = SimulationParameter()\n _sim_par_.timestep = _timestep_ if _timestep_ is not None else 1\n _sim_par_.shadow_calculation.solar_distribution = 'FullExterior'\n _sim_par_.output.add_zone_energy_use()\n _sim_par_.output.reporting_frequency = 'Monthly'\n if run_bal_:\n _sim_par_.output.add_output(gl_el_equip_out)\n _sim_par_.output.add_output(gl_gas_equip_out)\n _sim_par_.output.add_output(gl1_shw_out)\n _sim_par_.output.add_output(gl2_shw_out)\n _sim_par_.output.add_gains_and_losses('Total')\n _sim_par_.output.add_surface_energy_flow()\n # set the north if it is not defaulted\n if _north_ is not None:\n try:\n _sim_par_.north_vector = to_vector2d(_north_)\n except AttributeError: # north angle instead of vector\n _sim_par_.north_angle = float(_north_)\n\n # check the rooms for inaccurate cases\n if _sim_par_.timestep < 4:\n check_window_vent(_rooms)\n\n # assign design days from the EPW\n msg = None\n folder, epw_file_name = os.path.split(_epw_file)\n ddy_file = os.path.join(folder, epw_file_name.replace('.epw', '.ddy'))\n if os.path.isfile(ddy_file):\n try:\n _sim_par_.sizing_parameter.add_from_ddy_996_004(ddy_file)\n except AssertionError:\n msg = 'No design days were found in the .ddy file next to the _epw_file.'\n else:\n msg = 'No .ddy file was found next to the _epw_file.'\n if msg is not None:\n epw_obj = EPW(_epw_file)\n des_days = [epw_obj.approximate_design_day('WinterDesignDay'),\n epw_obj.approximate_design_day('SummerDesignDay')]\n _sim_par_.sizing_parameter.design_days = des_days\n msg = msg + '\\nDesign days were generated from the input _epw_file but this ' \\\n '\\nis not as accurate as design days from DDYs distributed with the EPW.'\n give_warning(ghenv.Component, msg)\n print(msg)\n\n # create the strings for simulation paramters and model\n ver_str = energyplus_idf_version() if energy_folders.energyplus_version \\\n is not None else energyplus_idf_version(compatibe_ep_version)\n sim_par_str = _sim_par_.to_idf()\n model_str = _model.to.idf(\n _model, schedule_directory=sch_directory, patch_missing_adjacencies=True)\n idf_str = '\\n\\n'.join([ver_str, sim_par_str, model_str])\n\n # write the final string into an IDF\n idf = os.path.join(directory, 'in.idf')\n write_to_file_by_name(directory, 'in.idf', idf_str, True)\n\n # run the IDF through EnergyPlus\n silent = True if _run == 1 else False\n sql, zsz, rdd, html, err = run_idf(idf, _epw_file, silent=silent)\n if html is None and err is not None: # something went wrong; parse the errors\n err_obj = Err(err)\n print(err_obj.file_contents)\n for error in err_obj.fatal_errors:\n raise Exception(error)\n\n # parse the result sql and get the monthly data collections\n if os.name == 'nt': # we are on windows; use IronPython like usual\n sql_obj = SQLiteResult(sql)\n cool_init = sql_obj.data_collections_by_output_name(cool_out)\n heat_init = sql_obj.data_collections_by_output_name(heat_out)\n light_init = sql_obj.data_collections_by_output_name(light_out)\n elec_equip_init = sql_obj.data_collections_by_output_name(el_equip_out)\n gas_equip_init = sql_obj.data_collections_by_output_name(gas_equip_out)\n process1_init = sql_obj.data_collections_by_output_name(process1_out)\n process2_init = sql_obj.data_collections_by_output_name(process2_out)\n shw_init = sql_obj.data_collections_by_output_name(shw_out)\n else: # we are on Mac; sqlite3 module doesn't work in Mac IronPython\n # Execute the honybee CLI to obtain the results via CPython\n cmds = [folders.python_exe_path, '-m', 'honeybee_energy', 'result',\n 'data-by-outputs', sql]\n for outp in energy_output:\n cmds.append('[\"{}\"]'.format(outp))\n process = subprocess.Popen(cmds, stdout=subprocess.PIPE)\n stdout = process.communicate()\n data_coll_dicts = json.loads(stdout[0])\n cool_init = serialize_data(data_coll_dicts[0])\n heat_init = serialize_data(data_coll_dicts[1])\n light_init = serialize_data(data_coll_dicts[2])\n elec_equip_init = serialize_data(data_coll_dicts[3])\n gas_equip_init = serialize_data(data_coll_dicts[4])\n process1_init = serialize_data(data_coll_dicts[5])\n process2_init = serialize_data(data_coll_dicts[6])\n shw_init = serialize_data(data_coll_dicts[7])\n\n # convert the results to EUI and ouput them\n cooling = data_to_load_intensity(cool_init, floor_area, 'Cooling', _cool_cop_)\n heating = data_to_load_intensity(heat_init, floor_area, 'Heating', _heat_cop_)\n lighting = data_to_load_intensity(light_init, floor_area, 'Lighting', 1, mults)\n equip = data_to_load_intensity(elec_equip_init, floor_area, 'Electric Equipment', 1, mults)\n total_load = [cooling.total, heating.total, lighting.total, equip.total]\n\n # add gas equipment if it is there\n if len(gas_equip_init) != 0:\n gas_equip = data_to_load_intensity(gas_equip_init, floor_area, 'Gas Equipment', 1, mults)\n equip = [equip, gas_equip]\n total_load.append(gas_equip.total)\n # add process load if it is there\n process = []\n if len(process1_init) != 0:\n process1 = data_to_load_intensity(process1_init, floor_area, 'Process', 1, mults)\n process2 = data_to_load_intensity(process2_init, floor_area, 'Process', 1, mults)\n process = process1 + process2\n total_load.append(process.total)\n # add hot water if it is there\n hot_water = []\n if len(shw_init) != 0:\n hot_water = data_to_load_intensity(shw_init, floor_area, 'Service Hot Water', 1, mults)\n total_load.append(hot_water.total)\n\n # construct the load balance if requested\n if run_bal_:\n if os.name == 'nt': # we are on windows; use IronPython like usual\n bal_obj = LoadBalance.from_sql_file(_model, sql)\n balance = bal_obj.load_balance_terms(True, True)\n else: # we are on Mac; sqlite3 module doesn't work in Mac IronPython\n # Execute the honybee CLI to obtain the results via CPython\n model_json = os.path.join(directory, 'in.hbjson')\n with open(model_json, 'w') as fp:\n json.dump(_model.to_dict(), fp)\n cmds = [folders.python_exe_path, '-m', 'honeybee_energy', 'result',\n 'load-balance', model_json, sql]\n process = subprocess.Popen(cmds, stdout=subprocess.PIPE)\n stdout = process.communicate()\n balance = serialize_data(json.loads(stdout[0]))\n", "category": "HB-Energy", "name": "HB Annual Loads", "description": "Run Honeybee Rooms through a quick energy simulation to obtain an estimate of\nannual heating, cooling, lighting, equipment, and service hot water loads.\n_\nNote that the default settings used by this component are only suitable for evaluating\nannual loads in the case where an error of up to 5% is acceptable. Also\nnote that annual loads are not the same as annual energy use or utility costs\nand, while the \"cop\" inputs can be used to approximate some effects of real\nheating + cooling systems, any evaulation of actual energy use, utility costs,\nor GHG emissions should be done by modeling a detailed HVAC using the \"HB\nModel to OSM\" component.\n-" diff --git a/honeybee_grasshopper_energy/json/HB_Balance_Temperature.json b/honeybee_grasshopper_energy/json/HB_Balance_Temperature.json index 03940436..e54954a4 100644 --- a/honeybee_grasshopper_energy/json/HB_Balance_Temperature.json +++ b/honeybee_grasshopper_energy/json/HB_Balance_Temperature.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "BalTemp", "outputs": [ [ @@ -50,7 +50,7 @@ } ], "subcategory": "6 :: Result", - "code": "\ntry:\n from ladybug.datacollection import HourlyContinuousCollection, DailyCollection\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\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 sum_collection(data):\n \"\"\"Sum a list of data collections into a single daily collection.\"\"\"\n total_data = data[0]\n for data_i in data[1:]:\n total_data = total_data + data_i\n if isinstance(total_data, HourlyContinuousCollection):\n total_data = total_data.average_daily()\n elif not isinstance(total_data, DailyCollection):\n raise TypeError('Expected Hourly or Daily data collection. '\n 'Got {}'.format(type(_temperature)))\n return total_data\n\n\nif all_required_inputs(ghenv.Component):\n # set the defaut day count and ensure temperature is daily\n _day_count_ = 10 if _day_count_ is None else _day_count_\n if isinstance(_temperature, HourlyContinuousCollection):\n _temperature = _temperature.average_daily()\n elif not isinstance(_temperature, DailyCollection):\n raise TypeError('Expected Hourly or Daily data collection for '\n '_temperature. Got {}'.format(type(_temperature)))\n\n # convert the heating and cooling collections to a single daily balance\n total_cool = sum_collection(_cooling)\n total_heat = sum_collection(_heating)\n total_load = total_cool + total_heat\n\n # check that all data collections are annual\n assert len(total_load) >= 365, 'Cooling and heating loads are not annual.'\n assert len(_temperature) >= 365, 'Temperature is not annual.'\n\n # sort the load to find the days with the lowest load\n temp_sort = []\n load_sort = []\n for i, (load, temp) in enumerate(sorted(zip(total_load, _temperature))):\n if i == _day_count_:\n break\n temp_sort.append(temp)\n load_sort.append(load)\n\n # return the average temperature and balance day load\n print len(temp_sort)\n bal_day_load = sum(load_sort) / _day_count_\n bal_temp = sum(temp_sort) / _day_count_\n", + "code": "\ntry:\n from ladybug.datacollection import HourlyContinuousCollection, DailyCollection\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\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 sum_collection(data):\n \"\"\"Sum a list of data collections into a single daily collection.\"\"\"\n total_data = data[0]\n for data_i in data[1:]:\n total_data = total_data + data_i\n if isinstance(total_data, HourlyContinuousCollection):\n total_data = total_data.average_daily()\n elif not isinstance(total_data, DailyCollection):\n raise TypeError('Expected Hourly or Daily data collection. '\n 'Got {}'.format(type(_temperature)))\n return total_data\n\n\nif all_required_inputs(ghenv.Component):\n # set the defaut day count and ensure temperature is daily\n _day_count_ = 10 if _day_count_ is None else _day_count_\n if isinstance(_temperature, HourlyContinuousCollection):\n _temperature = _temperature.average_daily()\n elif not isinstance(_temperature, DailyCollection):\n raise TypeError('Expected Hourly or Daily data collection for '\n '_temperature. Got {}'.format(type(_temperature)))\n\n # convert the heating and cooling collections to a single daily balance\n total_cool = sum_collection(_cooling)\n total_heat = sum_collection(_heating)\n total_load = total_cool + total_heat\n\n # check that all data collections are annual\n assert len(total_load) >= 365, 'Cooling and heating loads are not annual.'\n assert len(_temperature) >= 365, 'Temperature is not annual.'\n\n # sort the load to find the days with the lowest load\n temp_sort = []\n load_sort = []\n for i, (load, temp) in enumerate(sorted(zip(total_load, _temperature))):\n if i == _day_count_:\n break\n temp_sort.append(temp)\n load_sort.append(load)\n\n # return the average temperature and balance day load\n bal_day_load = sum(load_sort) / _day_count_\n bal_temp = sum(temp_sort) / _day_count_\n", "category": "HB-Energy", "name": "HB Balance Temperature", "description": "Calculate a building (or zone) balance temperature from a ideal air load simulation\nresults. The balance point is the outdoor temperature at which a building switches\nbetween heating and cooling.\n_\nIf the outdoor temperture drops below the balance temperature, the building will\nusually be in heating mode and, if the outdoor temperture is above the balance\ntemperature, the building will usually be in cooling mode.\n_\nThe balance temperture concept is useful for setting things such as automated\nblinds and airflow schedules since having these things directly controlled by\nhourly cooling or heating demand isn't always straightforward.\n_\nThis component works by taking the average combined heating/cooling values for\neach day and the average outdoor air temperature for each day. The days with\nthe smallest combined heating + cooling will have their daily mean outdoor air\ntempertures averaged to produce the output balance temperture.\n-" diff --git a/honeybee_grasshopper_energy/json/HB_Run_IDF.json b/honeybee_grasshopper_energy/json/HB_Run_IDF.json index 2ec05914..7f116060 100644 --- a/honeybee_grasshopper_energy/json/HB_Run_IDF.json +++ b/honeybee_grasshopper_energy/json/HB_Run_IDF.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "RunIDF", "outputs": [ [ @@ -71,7 +71,7 @@ } ], "subcategory": "5 :: Simulate", - "code": "\nimport os\nimport shutil\n\ntry:\n from ladybug.futil import preparedir\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.run import run_idf\n from honeybee_energy.result.err import Err\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, give_warning, \\\n recommended_processor_count, run_function_in_parallel\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef run_idf_and_report_errors(i):\n \"\"\"Run an IDF file through EnergyPlus and report errors/warnings on this component.\"\"\"\n # process the additional strings\n idf_i = idfs[i]\n if add_str_ != [] and add_str_[0] is not None:\n a_str = '/n'.join(add_str_)\n with open(idf_i, \"a\") as idf_file:\n idf_file.write(a_str)\n sql_i, zsz_i, rdd_i, html_i, err_i = run_idf(idf_i, _epw_file, silent=silent)\n\n # report any errors on this component\n if err_i is not None:\n err_obj = Err(err_i)\n err_objs[i] = err_obj\n for warn in err_obj.severe_errors:\n give_warning(ghenv.Component, warn)\n for error in err_obj.fatal_errors:\n print err_obj.file_contents # print before raising the error\n raise Exception(error)\n\n # append everything to the global lists\n sql[i] = sql_i\n zsz[i] = zsz_i\n rdd[i] = rdd_i\n html[i] = html_i\n err[i] = err_i\n\n\nif all_required_inputs(ghenv.Component) and _run:\n # global lists of outputs to be filled\n iter_count = len(_idf)\n sql = [None] * iter_count\n zsz = [None] * iter_count\n rdd = [None] * iter_count\n html = [None] * iter_count\n err = [None] * iter_count\n err_objs = [None] * iter_count\n\n # copy the IDFs into a sub-directory if they are not already labeled as in.idf\n idfs = []\n for idf_file_path in _idf:\n idf_dir, idf_file_name = os.path.split(idf_file_path)\n if idf_file_name != 'in.idf': # copy the IDF file into a sub-directory\n sub_dir = os.path.join(idf_dir, 'run')\n target = os.path.join(sub_dir, 'in.idf')\n preparedir(sub_dir)\n shutil.copy(idf_file_path, target)\n idfs.append(target)\n else:\n idfs.append(idf_file_path)\n\n # run the IDF files through E+\n silent = True if _run == 2 else False\n if _cpu_count_ is not None:\n workers = _cpu_count_\n else:\n workers = recommended_processor_count() if iter_count != 1 else 1\n run_function_in_parallel(run_idf_and_report_errors, iter_count, workers)\n\n # print out error report if it's only one\n # otherwise it's too much data to be read-able\n if len(err_objs) == 1:\n print(err_objs[0].file_contents)\n", + "code": "\nimport os\nimport shutil\n\ntry:\n from ladybug.futil import preparedir\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.run import run_idf\n from honeybee_energy.result.err import Err\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, give_warning, \\\n recommended_processor_count, run_function_in_parallel\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef run_idf_and_report_errors(i):\n \"\"\"Run an IDF file through EnergyPlus and report errors/warnings on this component.\"\"\"\n # process the additional strings\n idf_i = idfs[i]\n if add_str_ != [] and add_str_[0] is not None:\n a_str = '/n'.join(add_str_)\n with open(idf_i, \"a\") as idf_file:\n idf_file.write(a_str)\n sql_i, zsz_i, rdd_i, html_i, err_i = run_idf(idf_i, _epw_file, silent=silent)\n\n # report any errors on this component\n if err_i is not None:\n err_obj = Err(err_i)\n err_objs[i] = err_obj\n for warn in err_obj.severe_errors:\n give_warning(ghenv.Component, warn)\n for error in err_obj.fatal_errors:\n print(err_obj.file_contents) # print before raising the error\n raise Exception(error)\n\n # append everything to the global lists\n sql[i] = sql_i\n zsz[i] = zsz_i\n rdd[i] = rdd_i\n html[i] = html_i\n err[i] = err_i\n\n\nif all_required_inputs(ghenv.Component) and _run:\n # global lists of outputs to be filled\n iter_count = len(_idf)\n sql = [None] * iter_count\n zsz = [None] * iter_count\n rdd = [None] * iter_count\n html = [None] * iter_count\n err = [None] * iter_count\n err_objs = [None] * iter_count\n\n # copy the IDFs into a sub-directory if they are not already labeled as in.idf\n idfs = []\n for idf_file_path in _idf:\n idf_dir, idf_file_name = os.path.split(idf_file_path)\n if idf_file_name != 'in.idf': # copy the IDF file into a sub-directory\n sub_dir = os.path.join(idf_dir, 'run')\n target = os.path.join(sub_dir, 'in.idf')\n preparedir(sub_dir)\n shutil.copy(idf_file_path, target)\n idfs.append(target)\n else:\n idfs.append(idf_file_path)\n\n # run the IDF files through E+\n silent = True if _run == 2 else False\n if _cpu_count_ is not None:\n workers = _cpu_count_\n else:\n workers = recommended_processor_count() if iter_count != 1 else 1\n run_function_in_parallel(run_idf_and_report_errors, iter_count, workers)\n\n # print out error report if it's only one\n # otherwise it's too much data to be read-able\n if len(err_objs) == 1:\n print(err_objs[0].file_contents)\n", "category": "HB-Energy", "name": "HB Run IDF", "description": "Run an IDF file through EnergyPlus.\n-" diff --git a/honeybee_grasshopper_energy/json/HB_Run_OSM.json b/honeybee_grasshopper_energy/json/HB_Run_OSM.json index a631bcef..2379bb5f 100644 --- a/honeybee_grasshopper_energy/json/HB_Run_OSM.json +++ b/honeybee_grasshopper_energy/json/HB_Run_OSM.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "RunOSM", "outputs": [ [ @@ -85,7 +85,7 @@ } ], "subcategory": "5 :: Simulate", - "code": "\nimport os\nimport json\n\ntry:\n from honeybee_energy.run import run_osw, run_idf\n from honeybee_energy.result.err import Err\n from honeybee_energy.result.osw import OSW\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, give_warning, \\\n recommended_processor_count, run_function_in_parallel\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef run_osm_and_report_errors(i):\n \"\"\"Run an OSW through OpenStudio CLI.\"\"\"\n # create a blank osw for the translation\n osw_dict = {\n 'seed_file': _osm[i],\n 'weather_file': _epw_file\n }\n osw_directory = os.path.dirname(_osm[i])\n sch_directory1 = os.path.join(os.path.dirname(osw_directory), 'schedules')\n sch_directory2 = os.path.join(osw_directory, 'schedules')\n if os.path.isdir(sch_directory1):\n osw_dict['file_paths'] = [sch_directory1]\n elif os.path.isdir(sch_directory2):\n osw_dict['file_paths'] = [sch_directory2]\n osw = os.path.join(osw_directory, 'workflow.osw')\n with open(osw, 'w') as fp:\n json.dump(osw_dict, fp, indent=4)\n\n # get an IDF from the OSM using the OpenStudio CLI\n osm_i, idf_i = run_osw(osw, silent=silent)\n if idf_i is None:\n log_osw = OSW(os.path.join(osw_directory, 'out.osw'))\n errors = []\n print(log_osw.stdout)\n for error, tb in zip(log_osw.errors, log_osw.error_tracebacks):\n print(tb)\n errors.append(error)\n raise Exception('Failed to run OpenStudio CLI:\\n{}'.format('\\n'.join(errors)))\n\n # process the additional strings\n if add_str_ != [] and add_str_[0] is not None and idf is not None:\n a_str = '/n'.join(add_str_)\n with open(idf_i, \"a\") as idf_file:\n idf_file.write(a_str)\n osm[i] = osm_i\n idf[i] = idf_i\n\n # run the IDF through EnergyPlus\n if run_:\n sql_i, zsz_i, rdd_i, html_i, err_i = run_idf(idf_i, _epw_file, silent=silent)\n\n # report any errors on this component\n if err_i is not None:\n err_obj = Err(err_i)\n err_objs[i] = err_obj\n for warn in err_obj.severe_errors:\n give_warning(ghenv.Component, warn)\n for error in err_obj.fatal_errors:\n print err_obj.file_contents # print before raising the error\n raise Exception(error)\n\n # append everything to the global lists\n sql[i] = sql_i\n zsz[i] = zsz_i\n rdd[i] = rdd_i\n html[i] = html_i\n err[i] = err_i\n\n\nif all_required_inputs(ghenv.Component) and _translate:\n # global lists of outputs to be filled\n iter_count = len(_osm)\n osm = [None] * iter_count\n idf = [None] * iter_count\n sql = [None] * iter_count\n zsz = [None] * iter_count\n rdd = [None] * iter_count\n html = [None] * iter_count\n err = [None] * iter_count\n err_objs = [None] * iter_count\n\n # run the OSW files through OpenStudio CLI\n silent = True if run_ == 2 else False\n if _cpu_count_ is not None:\n workers = _cpu_count_\n else:\n workers = recommended_processor_count() if iter_count != 1 else 1\n run_function_in_parallel(run_osm_and_report_errors, iter_count, workers)\n\n # print out error report if it's only one file\n # otherwise it's too much data to be read-able\n if len(err_objs) == 1 and err_objs[0] is not None:\n print(err_objs[0].file_contents)\n", + "code": "\nimport os\nimport json\n\ntry:\n from honeybee_energy.run import run_osw, run_idf\n from honeybee_energy.result.err import Err\n from honeybee_energy.result.osw import OSW\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, give_warning, \\\n recommended_processor_count, run_function_in_parallel\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef run_osm_and_report_errors(i):\n \"\"\"Run an OSW through OpenStudio CLI.\"\"\"\n # create a blank osw for the translation\n osw_dict = {\n 'seed_file': _osm[i],\n 'weather_file': _epw_file\n }\n osw_directory = os.path.dirname(_osm[i])\n sch_directory1 = os.path.join(os.path.dirname(osw_directory), 'schedules')\n sch_directory2 = os.path.join(osw_directory, 'schedules')\n if os.path.isdir(sch_directory1):\n osw_dict['file_paths'] = [sch_directory1]\n elif os.path.isdir(sch_directory2):\n osw_dict['file_paths'] = [sch_directory2]\n osw = os.path.join(osw_directory, 'workflow.osw')\n with open(osw, 'w') as fp:\n json.dump(osw_dict, fp, indent=4)\n\n # get an IDF from the OSM using the OpenStudio CLI\n osm_i, idf_i = run_osw(osw, silent=silent)\n if idf_i is None:\n log_osw = OSW(os.path.join(osw_directory, 'out.osw'))\n errors = []\n print(log_osw.stdout)\n for error, tb in zip(log_osw.errors, log_osw.error_tracebacks):\n print(tb)\n errors.append(error)\n raise Exception('Failed to run OpenStudio CLI:\\n{}'.format('\\n'.join(errors)))\n\n # process the additional strings\n if add_str_ != [] and add_str_[0] is not None and idf is not None:\n a_str = '/n'.join(add_str_)\n with open(idf_i, \"a\") as idf_file:\n idf_file.write(a_str)\n osm[i] = osm_i\n idf[i] = idf_i\n\n # run the IDF through EnergyPlus\n if run_:\n sql_i, zsz_i, rdd_i, html_i, err_i = run_idf(idf_i, _epw_file, silent=silent)\n\n # report any errors on this component\n if err_i is not None:\n err_obj = Err(err_i)\n err_objs[i] = err_obj\n for warn in err_obj.severe_errors:\n give_warning(ghenv.Component, warn)\n for error in err_obj.fatal_errors:\n print(err_obj.file_contents) # print before raising the error\n raise Exception(error)\n\n # append everything to the global lists\n sql[i] = sql_i\n zsz[i] = zsz_i\n rdd[i] = rdd_i\n html[i] = html_i\n err[i] = err_i\n\n\nif all_required_inputs(ghenv.Component) and _translate:\n # global lists of outputs to be filled\n iter_count = len(_osm)\n osm = [None] * iter_count\n idf = [None] * iter_count\n sql = [None] * iter_count\n zsz = [None] * iter_count\n rdd = [None] * iter_count\n html = [None] * iter_count\n err = [None] * iter_count\n err_objs = [None] * iter_count\n\n # run the OSW files through OpenStudio CLI\n silent = True if run_ == 2 else False\n if _cpu_count_ is not None:\n workers = _cpu_count_\n else:\n workers = recommended_processor_count() if iter_count != 1 else 1\n run_function_in_parallel(run_osm_and_report_errors, iter_count, workers)\n\n # print out error report if it's only one file\n # otherwise it's too much data to be read-able\n if len(err_objs) == 1 and err_objs[0] is not None:\n print(err_objs[0].file_contents)\n", "category": "HB-Energy", "name": "HB Run OSM", "description": "Translate a fully-simualte-able OpenStudio model (.osm) to an IDF and run the it\nthrough EnergyPlus.\n-" diff --git a/honeybee_grasshopper_energy/json/HB_Run_OSW.json b/honeybee_grasshopper_energy/json/HB_Run_OSW.json index 9084b6ad..2b87abd9 100644 --- a/honeybee_grasshopper_energy/json/HB_Run_OSW.json +++ b/honeybee_grasshopper_energy/json/HB_Run_OSW.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "RunOSW", "outputs": [ [ @@ -92,7 +92,7 @@ } ], "subcategory": "5 :: Simulate", - "code": "\ntry:\n from honeybee_energy.run import run_osw, run_idf\n from honeybee_energy.result.err import Err\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, give_warning, \\\n recommended_processor_count, run_function_in_parallel\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef run_osw_and_report_errors(i):\n \"\"\"Run an OSW through OpenStudio CLI.\"\"\"\n osw = _osw[i]\n osm_i, idf_i = run_osw(osw, silent=silent)\n # process the additional strings\n if add_str_ != [] and add_str_[0] is not None and idf is not None:\n add_str = '/n'.join(add_str_)\n with open(idf_i, \"a\") as idf_file:\n idf_file.write(add_str)\n osm[i] = osm_i\n idf[i] = idf_i\n\n # run the IDF through EnergyPlus\n if run_:\n sql_i, zsz_i, rdd_i, html_i, err_i = run_idf(idf_i, _epw_file, silent=silent)\n\n # report any errors on this component\n if err_i is not None:\n err_obj = Err(err_i)\n err_objs[i] = err_obj\n for warn in err_obj.severe_errors:\n give_warning(ghenv.Component, warn)\n for error in err_obj.fatal_errors:\n print err_obj.file_contents # print before raising the error\n raise Exception(error)\n\n # append everything to the global lists\n sql[i] = sql_i\n zsz[i] = zsz_i\n rdd[i] = rdd_i\n html[i] = html_i\n err[i] = err_i\n\n\nif all_required_inputs(ghenv.Component) and _translate:\n # global lists of outputs to be filled\n iter_count = len(_osw)\n osm = [None] * iter_count\n idf = [None] * iter_count\n sql = [None] * iter_count\n zsz = [None] * iter_count\n rdd = [None] * iter_count\n html = [None] * iter_count\n err = [None] * iter_count\n err_objs = [None] * iter_count\n\n # run the OSW files through OpenStudio CLI\n silent = True if run_ == 2 else False\n workers = _cpu_count_ if _cpu_count_ is not None else recommended_processor_count()\n run_function_in_parallel(run_osw_and_report_errors, iter_count, workers)\n\n # print out error report if it's only one file\n # otherwise it's too much data to be read-able\n if len(err_objs) == 1 and err_objs[0] is not None:\n print(err_objs[0].file_contents)\n", + "code": "\ntry:\n from honeybee_energy.run import run_osw, run_idf\n from honeybee_energy.result.err import Err\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, give_warning, \\\n recommended_processor_count, run_function_in_parallel\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\ndef run_osw_and_report_errors(i):\n \"\"\"Run an OSW through OpenStudio CLI.\"\"\"\n osw = _osw[i]\n osm_i, idf_i = run_osw(osw, silent=silent)\n # process the additional strings\n if add_str_ != [] and add_str_[0] is not None and idf is not None:\n add_str = '/n'.join(add_str_)\n with open(idf_i, \"a\") as idf_file:\n idf_file.write(add_str)\n osm[i] = osm_i\n idf[i] = idf_i\n\n # run the IDF through EnergyPlus\n if run_:\n sql_i, zsz_i, rdd_i, html_i, err_i = run_idf(idf_i, _epw_file, silent=silent)\n\n # report any errors on this component\n if err_i is not None:\n err_obj = Err(err_i)\n err_objs[i] = err_obj\n for warn in err_obj.severe_errors:\n give_warning(ghenv.Component, warn)\n for error in err_obj.fatal_errors:\n print(err_obj.file_contents) # print before raising the error\n raise Exception(error)\n\n # append everything to the global lists\n sql[i] = sql_i\n zsz[i] = zsz_i\n rdd[i] = rdd_i\n html[i] = html_i\n err[i] = err_i\n\n\nif all_required_inputs(ghenv.Component) and _translate:\n # global lists of outputs to be filled\n iter_count = len(_osw)\n osm = [None] * iter_count\n idf = [None] * iter_count\n sql = [None] * iter_count\n zsz = [None] * iter_count\n rdd = [None] * iter_count\n html = [None] * iter_count\n err = [None] * iter_count\n err_objs = [None] * iter_count\n\n # run the OSW files through OpenStudio CLI\n silent = True if run_ == 2 else False\n workers = _cpu_count_ if _cpu_count_ is not None else recommended_processor_count()\n run_function_in_parallel(run_osw_and_report_errors, iter_count, workers)\n\n # print out error report if it's only one file\n # otherwise it's too much data to be read-able\n if len(err_objs) == 1 and err_objs[0] is not None:\n print(err_objs[0].file_contents)\n", "category": "HB-Energy", "name": "HB Run OSW", "description": "Execute an OpenStudio workflow (.osw) and run the resulting IDF file through\nEnergyPlus.\n-" diff --git a/honeybee_grasshopper_energy/json/HB_Thermal_Load_Balance.json b/honeybee_grasshopper_energy/json/HB_Thermal_Load_Balance.json index 68b65b71..7ce6314d 100644 --- a/honeybee_grasshopper_energy/json/HB_Thermal_Load_Balance.json +++ b/honeybee_grasshopper_energy/json/HB_Thermal_Load_Balance.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "LoadBalance", "outputs": [ [ @@ -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, 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 hot_water_ = [hw.duplicate() * 0.25 for hw in hot_water_]\n for hw in hot_water_:\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", + "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 hot_water_ = [hw.duplicate() * 0.25 for hw in hot_water_]\n for hw in hot_water_:\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-" diff --git a/honeybee_grasshopper_energy/src/HB Annual Loads.py b/honeybee_grasshopper_energy/src/HB Annual Loads.py index 60762e90..ec7e2d6a 100644 --- a/honeybee_grasshopper_energy/src/HB Annual Loads.py +++ b/honeybee_grasshopper_energy/src/HB Annual Loads.py @@ -96,7 +96,7 @@ ghenv.Component.Name = 'HB Annual Loads' ghenv.Component.NickName = 'AnnualLoads' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '5 :: Simulate' ghenv.Component.AdditionalHelpFromDocStrings = '2' @@ -153,7 +153,7 @@ def check_window_vent(rooms): msg = 'Window ventilation was detected but your timestep is too low ' \ 'to model window opening correctly.\nIt is recommended that you ' \ 'increase your timestep to at least 4 to get loads for this case.' - print msg + print(msg) give_warning(ghenv.Component, msg) @@ -268,7 +268,7 @@ def serialize_data(data_dicts): msg = msg + '\nDesign days were generated from the input _epw_file but this ' \ '\nis not as accurate as design days from DDYs distributed with the EPW.' give_warning(ghenv.Component, msg) - print msg + print(msg) # create the strings for simulation paramters and model ver_str = energyplus_idf_version() if energy_folders.energyplus_version \ diff --git a/honeybee_grasshopper_energy/src/HB Balance Temperature.py b/honeybee_grasshopper_energy/src/HB Balance Temperature.py index 453db61e..73be61f4 100644 --- a/honeybee_grasshopper_energy/src/HB Balance Temperature.py +++ b/honeybee_grasshopper_energy/src/HB Balance Temperature.py @@ -55,7 +55,7 @@ ghenv.Component.Name = 'HB Balance Temperature' ghenv.Component.NickName = 'BalTemp' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '6 :: Result' ghenv.Component.AdditionalHelpFromDocStrings = '0' @@ -112,6 +112,5 @@ def sum_collection(data): load_sort.append(load) # return the average temperature and balance day load - print len(temp_sort) bal_day_load = sum(load_sort) / _day_count_ bal_temp = sum(temp_sort) / _day_count_ diff --git a/honeybee_grasshopper_energy/src/HB Run IDF.py b/honeybee_grasshopper_energy/src/HB Run IDF.py index a0fb2d41..4d05a135 100644 --- a/honeybee_grasshopper_energy/src/HB Run IDF.py +++ b/honeybee_grasshopper_energy/src/HB Run IDF.py @@ -47,7 +47,7 @@ ghenv.Component.Name = 'HB Run IDF' ghenv.Component.NickName = 'RunIDF' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '5 :: Simulate' ghenv.Component.AdditionalHelpFromDocStrings = '5' @@ -90,7 +90,7 @@ def run_idf_and_report_errors(i): for warn in err_obj.severe_errors: give_warning(ghenv.Component, warn) for error in err_obj.fatal_errors: - print err_obj.file_contents # print before raising the error + print(err_obj.file_contents) # print before raising the error raise Exception(error) # append everything to the global lists diff --git a/honeybee_grasshopper_energy/src/HB Run OSM.py b/honeybee_grasshopper_energy/src/HB Run OSM.py index 59405be6..dc2cdd48 100644 --- a/honeybee_grasshopper_energy/src/HB Run OSM.py +++ b/honeybee_grasshopper_energy/src/HB Run OSM.py @@ -52,7 +52,7 @@ ghenv.Component.Name = 'HB Run OSM' ghenv.Component.NickName = 'RunOSM' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '5 :: Simulate' ghenv.Component.AdditionalHelpFromDocStrings = '5' @@ -122,7 +122,7 @@ def run_osm_and_report_errors(i): for warn in err_obj.severe_errors: give_warning(ghenv.Component, warn) for error in err_obj.fatal_errors: - print err_obj.file_contents # print before raising the error + print(err_obj.file_contents) # print before raising the error raise Exception(error) # append everything to the global lists diff --git a/honeybee_grasshopper_energy/src/HB Run OSW.py b/honeybee_grasshopper_energy/src/HB Run OSW.py index cf888091..b5551af6 100644 --- a/honeybee_grasshopper_energy/src/HB Run OSW.py +++ b/honeybee_grasshopper_energy/src/HB Run OSW.py @@ -55,7 +55,7 @@ ghenv.Component.Name = 'HB Run OSW' ghenv.Component.NickName = 'RunOSW' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '5 :: Simulate' ghenv.Component.AdditionalHelpFromDocStrings = '4' @@ -96,7 +96,7 @@ def run_osw_and_report_errors(i): for warn in err_obj.severe_errors: give_warning(ghenv.Component, warn) for error in err_obj.fatal_errors: - print err_obj.file_contents # print before raising the error + print(err_obj.file_contents) # print before raising the error raise Exception(error) # append everything to the global lists diff --git a/honeybee_grasshopper_energy/src/HB Thermal Load Balance.py b/honeybee_grasshopper_energy/src/HB Thermal Load Balance.py index 9eca63ff..7b905bd4 100644 --- a/honeybee_grasshopper_energy/src/HB Thermal Load Balance.py +++ b/honeybee_grasshopper_energy/src/HB Thermal Load Balance.py @@ -67,7 +67,7 @@ ghenv.Component.Name = 'HB Thermal Load Balance' ghenv.Component.NickName = 'LoadBalance' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '6 :: Result' ghenv.Component.AdditionalHelpFromDocStrings = '3' @@ -113,7 +113,7 @@ def check_input(input_list): '_rooms_model to ensure correct representaiton of solar.' for coll in solar_gain_: if 'Solar Enclosure' in coll.header.metadata['Zone']: - print msg + print(msg) give_warning(ghenv.Component, msg) # process all of the inputs diff --git a/honeybee_grasshopper_energy/user_objects/HB Annual Loads.ghuser b/honeybee_grasshopper_energy/user_objects/HB Annual Loads.ghuser index 19e82a45..8dc48db0 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Annual Loads.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Annual Loads.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Balance Temperature.ghuser b/honeybee_grasshopper_energy/user_objects/HB Balance Temperature.ghuser index 701be7b9..aa48a19f 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Balance Temperature.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Balance Temperature.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Run IDF.ghuser b/honeybee_grasshopper_energy/user_objects/HB Run IDF.ghuser index 09653faf..596383ac 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Run IDF.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Run IDF.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Run OSM.ghuser b/honeybee_grasshopper_energy/user_objects/HB Run OSM.ghuser index 1e64b9a3..156215f0 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Run OSM.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Run OSM.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Run OSW.ghuser b/honeybee_grasshopper_energy/user_objects/HB Run OSW.ghuser index 058059b9..84b8c38d 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Run OSW.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Run OSW.ghuser differ diff --git a/honeybee_grasshopper_energy/user_objects/HB Thermal Load Balance.ghuser b/honeybee_grasshopper_energy/user_objects/HB Thermal Load Balance.ghuser index 263bbd60..ce64cc7b 100644 Binary files a/honeybee_grasshopper_energy/user_objects/HB Thermal Load Balance.ghuser and b/honeybee_grasshopper_energy/user_objects/HB Thermal Load Balance.ghuser differ