Skip to content

Commit

Permalink
Merge pull request #337 from NREL/os351
Browse files Browse the repository at this point in the history
Update to OS v3.5.1
  • Loading branch information
nmerket committed Jan 30, 2023
2 parents 8579ab9 + 6942c8b commit 2b47b41
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
6 changes: 3 additions & 3 deletions buildstockbatch/base.py
Expand Up @@ -43,8 +43,8 @@
class BuildStockBatchBase(object):

# http://openstudio-builds.s3-website-us-east-1.amazonaws.com
DEFAULT_OS_VERSION = '3.5.0'
DEFAULT_OS_SHA = '7b14ce1588'
DEFAULT_OS_VERSION = '3.5.1'
DEFAULT_OS_SHA = '22e1db7be5'
CONTAINER_RUNTIME = None
LOGO = '''
_ __ _ __, _ __
Expand Down Expand Up @@ -782,7 +782,7 @@ def validate_openstudio_version(project_file):
versions[tool] = eval(version.strip())
OS_HPXML_Version = versions['OS_HPXML_Version']
OS_Version = versions['OS_Version']
if os_version != OS_Version:
if not os_version.startswith(OS_Version):
val_err = f"OS version {OS_Version} is required" \
f" for OS-HPXML version {OS_HPXML_Version}. Found {os_version}"
raise ValidationError(val_err)
Expand Down
26 changes: 25 additions & 1 deletion buildstockbatch/workflow_generator/residential_hpxml.py
Expand Up @@ -31,6 +31,16 @@ def get_measure_xml(xml_path):
return root


def get_measure_arguments(xml_path):
arguments = []
if os.path.isfile(xml_path):
root = get_measure_xml(xml_path)
for argument in root.findall('./arguments/argument'):
name = argument.find('./name').text
arguments.append(name)
return arguments


class ResidentialHpxmlWorkflowGenerator(WorkflowGeneratorBase):

@classmethod
Expand Down Expand Up @@ -95,10 +105,12 @@ def validate(cls, cfg):
include_timeseries_hot_water_uses: bool(required=False)
include_timeseries_total_loads: bool(required=False)
include_timeseries_component_loads: bool(required=False)
include_timeseries_unmet_hours: bool(required=False)
include_timeseries_zone_temperatures: bool(required=False)
include_timeseries_airflows: bool(required=False)
include_timeseries_weather: bool(required=False)
timeseries_timestamp_convention: enum('start', 'end', required=False)
timeseries_num_decimal_places: int(required=False)
add_timeseries_dst_column: bool(required=False)
add_timeseries_utc_column: bool(required=False)
output_variables: list(include('output-var-spec'), required=False)
Expand Down Expand Up @@ -143,7 +155,7 @@ def reporting_measures(self):
@staticmethod
def validate_measures_and_arguments(cfg):

buildstock_dir = cfg["buildstock_directory"]
buildstock_dir = cfg['buildstock_directory']
measures_dir = os.path.join(buildstock_dir, 'measures')

measure_names = {
Expand Down Expand Up @@ -320,6 +332,18 @@ def create_osw(self, sim_id, building_id, upgrade_idx):
'add_timeseries_dst_column': True,
'add_timeseries_utc_column': True
}

buildstock_dir = self.cfg['buildstock_directory']
measures_dir = os.path.join(buildstock_dir, 'resources/hpxml-measures')
measure_path = os.path.join(measures_dir, 'ReportSimulationOutput')
sim_out_rep_args_avail = get_measure_arguments(os.path.join(measure_path, 'measure.xml'))

if 'include_timeseries_unmet_hours' in sim_out_rep_args_avail:
sim_out_rep_args['include_timeseries_unmet_hours'] = False

if 'timeseries_num_decimal_places' in sim_out_rep_args_avail:
sim_out_rep_args['timeseries_num_decimal_places'] = 3

sim_out_rep_args.update(workflow_args['simulation_output_report'])

if 'output_variables' in sim_out_rep_args:
Expand Down
3 changes: 3 additions & 0 deletions buildstockbatch/workflow_generator/test_workflow_generator.py
Expand Up @@ -322,6 +322,7 @@ def test_residential_hpxml(mocker):
building_id = 1
upgrade_idx = 0
cfg = {
'buildstock_directory': '../',
'baseline': {
'n_buildings_represented': 100
},
Expand Down Expand Up @@ -387,10 +388,12 @@ def test_residential_hpxml(mocker):
assert simulation_output_step['arguments']['include_timeseries_hot_water_uses'] is False
assert simulation_output_step['arguments']['include_timeseries_total_loads'] is True
assert simulation_output_step['arguments']['include_timeseries_component_loads'] is False
# assert simulation_output_step['arguments']['include_timeseries_unmet_hours'] is False
assert simulation_output_step['arguments']['include_timeseries_zone_temperatures'] is False
assert simulation_output_step['arguments']['include_timeseries_airflows'] is False
assert simulation_output_step['arguments']['include_timeseries_weather'] is False
assert simulation_output_step['arguments']['timeseries_timestamp_convention'] == 'end'
# assert simulation_output_step['arguments']['timeseries_num_decimal_places'] == 3
assert simulation_output_step['arguments']['add_timeseries_dst_column'] is True
assert simulation_output_step['arguments']['add_timeseries_utc_column'] is True

Expand Down
2 changes: 2 additions & 0 deletions docs/workflow_generators/residential_hpxml.rst
Expand Up @@ -103,10 +103,12 @@ Arguments
- ``include_timeseries_hot_water_uses``: Generates timeseries hot water usages for each end use type (in gallons).
- ``include_timeseries_total_loads``: Generates timeseries total heating, cooling, and hot water loads (in kBtu) for the building.
- ``include_timeseries_component_loads``: Generates timeseries heating and cooling loads (in kBtu) disaggregated by component type (e.g., Walls, Windows, Infiltration, Ducts, etc.).
- ``include_timeseries_unmet_hours``: Generates timeseries unmet hours for heating and cooling.
- ``include_timeseries_zone_temperatures``: Generates timeseries average temperatures (in deg-F) for each space modeled (e.g., living space, attic, garage, basement, crawlspace, etc.).
- ``include_timeseries_airflows``: Generates timeseries airflow rates (in cfm) for infiltration, mechanical ventilation (including clothes dryer exhaust), natural ventilation, whole house fans.
- ``include_timeseries_weather``: Generates timeseries weather file data including outdoor temperatures, relative humidity, wind speed, and solar.
- ``timeseries_timestamp_convention``: Determines whether timeseries timestamps use the start-of-timestep or end-of-timestep convention. Valid choices are 'start' and 'end'.
- ``timeseries_num_decimal_places``: Allows overriding the default number of decimal places for timeseries output.
- ``add_timeseries_dst_column``: Optionally add, in addition to the default local standard Time column, a local clock TimeDST column. Requires that daylight saving time is enabled.
- ``add_timeseries_utc_column``: Optionally add, in addition to the default local standard Time column, a local clock TimeUTC column. If the time zone UTC offset is not provided in the HPXML file, the time zone in the EPW header will be used.
- ``output_variables``: Optionally request EnergyPlus output variables. Do not include key values; by default all key values will be requested.
Expand Down

0 comments on commit 2b47b41

Please sign in to comment.