Skip to content

Commit

Permalink
Merge branch 'ev_batteries' into ev_schedules
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeee committed Oct 23, 2024
2 parents b077dcc + 18bf8fc commit 9e03d1d
Show file tree
Hide file tree
Showing 199 changed files with 77,024 additions and 15,993 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
run-unit-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
container:
image: docker://nrel/openstudio:3.8.0
steps:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
path: docs/_build/html/

run-workflow1-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
container:
image: docker://nrel/openstudio:3.8.0
steps:
Expand All @@ -98,7 +98,7 @@ jobs:
name: results-workflow1-tests

run-workflow2-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
container:
image: docker://nrel/openstudio:3.8.0
steps:
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
& .\OpenStudio-${env:OS_VERSION}+${env:OS_SHA}-Windows\bin\openstudio.exe workflow\run_simulation.rb -x workflow\sample_files\base.xml --hourly ALL --add-component-loads --add-stochastic-schedules
merge-results:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: [run-workflow1-tests, run-workflow2-tests, run-unit-tests]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:

compare-results:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: merge-results
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
name: comparisons

update-results:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: merge-results
steps:
- uses: actions/checkout@v4
Expand Down
121 changes: 93 additions & 28 deletions BuildResidentialHPXML/README.md

Large diffs are not rendered by default.

251 changes: 165 additions & 86 deletions BuildResidentialHPXML/measure.rb

Large diffs are not rendered by default.

181 changes: 146 additions & 35 deletions BuildResidentialHPXML/measure.xml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions BuildResidentialHPXML/resources/geometry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def self.create_single_family_detached(runner:,
assign_indexes(model: model, footprint_polygon: conditioned_polygon, space: conditioned_space)

if floor > 0
conditioned_space_name = "#{HPXML::LocationConditionedSpace}|story #{floor + 1}"
conditioned_space_name = "#{HPXML::LocationConditionedSpace} story #{floor + 1}"
else
conditioned_space_name = HPXML::LocationConditionedSpace
end
Expand Down Expand Up @@ -578,7 +578,7 @@ def self.create_single_family_detached(runner:,
garage_attic_space.remove

# remove other unused surfaces
# TODO: remove this once geometry methods are fixed in openstudio 3.x
# FUTURE: remove this once geometry methods are fixed in openstudio 3.x
attic_space.surfaces.each do |surface1|
next if surface1.surfaceType != EPlus::SurfaceTypeRoofCeiling

Expand Down Expand Up @@ -2151,7 +2151,7 @@ def self.get_wall_area_for_windows(surface:,
end

# Gable too short?
# TODO: super crude safety factor of 1.5
# super crude safety factor of 1.5
if is_gable_wall(surface: surface) && (min_wall_height > get_surface_height(surface: surface) / 1.5)
return 0.0
end
Expand Down
43 changes: 25 additions & 18 deletions BuildResidentialHPXML/tests/test_build_residential_hpxml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ def test_workflows
'error-sfd-with-shared-system.xml' => 'base-sfd.xml',
'error-rim-joist-height-but-no-assembly-r.xml' => 'base-sfd.xml',
'error-rim-joist-assembly-r-but-no-height.xml' => 'base-sfd.xml',
'error-power-outage-args-not-all-same-size.xml' => 'base-sfd.xml',
'error-power-outage-window-natvent-invalid.xml' => 'base-sfd.xml',
'error-unavailable-period-args-not-all-specified' => 'base-sfd.xml',
'error-unavailable-period-args-not-all-same-size.xml' => 'base-sfd.xml',
'error-unavailable-period-window-natvent-invalid.xml' => 'base-sfd.xml',
'error-heating-perf-data-not-all-specified.xml' => 'base-sfd.xml',
'error-heating-perf-data-not-all-same-size.xml' => 'base-sfd.xml',
'error-cooling-perf-data-not-all-specified.xml' => 'base-sfd.xml',
Expand Down Expand Up @@ -253,8 +254,9 @@ def test_workflows
'error-sfd-with-shared-system.xml' => ['Specified a shared system for a single-family detached unit.'],
'error-rim-joist-height-but-no-assembly-r.xml' => ['Specified a rim joist height but no rim joist assembly R-value.'],
'error-rim-joist-assembly-r-but-no-height.xml' => ['Specified a rim joist assembly R-value but no rim joist height.'],
'error-power-outage-args-not-all-same-size.xml' => ['One power outage periods schedule argument does not have enough comma-separated elements specified.'],
'error-power-outage-window-natvent-invalid.xml' => ["Window natural ventilation availability 'invalid' during a power outage is invalid."],
'error-unavailable-period-args-not-all-specified' => ['Did not specify all required unavailable period arguments.'],
'error-unavailable-period-args-not-all-same-size.xml' => ['One or more unavailable period arguments does not have enough comma-separated elements specified.'],
'error-unavailable-period-window-natvent-invalid.xml' => ["Window natural ventilation availability 'invalid' during an unavailable period is invalid."],
'error-heating-perf-data-not-all-specified.xml' => ['Did not specify all required heating detailed performance data arguments.'],
'error-heating-perf-data-not-all-same-size.xml' => ['One or more detailed heating performance data arguments does not have enough comma-separated elements specified.'],
'error-cooling-perf-data-not-all-specified.xml' => ['Did not specify all required cooling detailed performance data arguments.'],
Expand Down Expand Up @@ -729,9 +731,9 @@ def _set_measure_argument_values(hpxml_file, args)
elsif ['base-sfd-header.xml'].include? hpxml_file
args['software_info_program_used'] = 'Program'
args['software_info_program_version'] = '1'
args['schedules_vacancy_periods'] = 'Jan 2 - Jan 5'
args['schedules_power_outage_periods'] = 'Feb 10 - Feb 12'
args['schedules_power_outage_periods_window_natvent_availability'] = HPXML::ScheduleAvailable
args['schedules_unavailable_period_types'] = 'Vacancy, Power Outage'
args['schedules_unavailable_period_dates'] = 'Jan 2 - Jan 5, Feb 10 - Feb 12'
args['schedules_unavailable_period_window_natvent_availabilities'] = "#{HPXML::ScheduleUnavailable}, #{HPXML::ScheduleAvailable}"
args['simulation_control_run_period'] = 'Jan 1 - Dec 31'
args['simulation_control_run_period_calendar_year'] = 2007
args['simulation_control_temperature_capacitance_multiplier'] = 1.0
Expand Down Expand Up @@ -967,8 +969,8 @@ def _set_measure_argument_values(hpxml_file, args)
args['hvac_perf_data_cooling_min_speed_cops'] = '4.47, 6.34'
args['hvac_perf_data_cooling_max_speed_cops'] = '2.71, 3.53'
elsif ['extra-power-outage-periods.xml'].include? hpxml_file
args['schedules_power_outage_periods'] = 'Jan 1 - Jan 5, Jan 7 - Jan 9'
args['schedules_power_outage_periods_window_natvent_availability'] = "#{HPXML::ScheduleRegular}, #{HPXML::ScheduleAvailable}"
args['schedules_unavailable_period_types'] = 'Power Outage, Power Outage'
args['schedules_unavailable_period_dates'] = 'Jan 1 - Jan 5, Jan 7 - Jan 9'
elsif ['extra-sfa-atticroof-flat.xml'].include? hpxml_file
args['geometry_attic_type'] = HPXML::AtticTypeFlatRoof
args['ducts_supply_leakage_to_outside_value'] = 0.0
Expand Down Expand Up @@ -1214,11 +1216,16 @@ def _set_measure_argument_values(hpxml_file, args)
args.delete('rim_joist_assembly_r')
elsif ['error-rim-joist-assembly-r-but-no-height.xml'].include? hpxml_file
args.delete('geometry_rim_joist_height')
elsif ['error-power-outage-args-not-all-same-size.xml'].include? hpxml_file
args['schedules_power_outage_periods'] = 'Jan 1 - Jan 5, Jan 7 - Jan 9'
args['schedules_power_outage_periods_window_natvent_availability'] = HPXML::ScheduleRegular
elsif ['error-power-outage-window-natvent-invalid.xml'].include? hpxml_file
args['schedules_power_outage_periods_window_natvent_availability'] = 'invalid'
elsif ['error-unavailable-period-args-not-all-specified'].include? hpxml_file
args['schedules_unavailable_period_types'] = 'Vacancy'
elsif ['error-unavailable-period-args-not-all-same-size.xml'].include? hpxml_file
args['schedules_unavailable_period_types'] = 'Vacancy, Power Outage'
args['schedules_unavailable_period_dates'] = 'Jan 1 - Jan 5, Jan 7 - Jan 9'
args['schedules_unavailable_period_window_natvent_availabilities'] = HPXML::ScheduleRegular
elsif ['error-unavailable-period-window-natvent-invalid.xml'].include? hpxml_file
args['schedules_unavailable_period_types'] = 'Power Outage'
args['schedules_unavailable_period_dates'] = 'Jan 7 - Jan 9'
args['schedules_unavailable_period_window_natvent_availabilities'] = 'invalid'
elsif ['error-heating-perf-data-not-all-specified.xml'].include? hpxml_file
args['hvac_perf_data_heating_outdoor_temperatures'] = '47.0'
elsif ['error-heating-perf-data-not-all-same-size.xml'].include? hpxml_file
Expand Down Expand Up @@ -1361,22 +1368,22 @@ def _test_measure(runner, expected_errors, expected_warnings)
# check warnings/errors
if not expected_errors.nil?
expected_errors.each do |expected_error|
if runner.result.stepErrors.select { |s| s.include?(expected_error) }.size <= 0
if runner.result.stepErrors.count { |s| s.include?(expected_error) } <= 0
runner.result.stepErrors.each do |s|
puts "ERROR: #{s}"
end
end
assert(runner.result.stepErrors.select { |s| s.include?(expected_error) }.size > 0)
assert(runner.result.stepErrors.count { |s| s.include?(expected_error) } > 0)
end
end
if not expected_warnings.nil?
expected_warnings.each do |expected_warning|
if runner.result.stepWarnings.select { |s| s.include?(expected_warning) }.size <= 0
if runner.result.stepWarnings.count { |s| s.include?(expected_warning) } <= 0
runner.result.stepWarnings.each do |s|
puts "WARNING: #{s}"
end
end
assert(runner.result.stepWarnings.select { |s| s.include?(expected_warning) }.size > 0)
assert(runner.result.stepWarnings.count { |s| s.include?(expected_warning) } > 0)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions BuildResidentialScheduleFile/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def get_simulation_parameters(hpxml, weather, args)
# @param weather [WeatherFile] Weather object containing EPW information
# @param args [Hash] Map of :argument_name => value
def get_generator_inputs(hpxml_bldg, weather, args)
state_code = HPXMLDefaults.get_default_state_code(hpxml_bldg.state_code, weather)
state_code = Defaults.get_state_code(hpxml_bldg.state_code, weather)
if Constants::StateCodesMap.keys.include?(state_code)
args[:state] = state_code
else
Expand All @@ -275,9 +275,9 @@ def get_generator_inputs(hpxml_bldg, weather, args)
end
args[:geometry_num_occupants] = Float(Integer(args[:geometry_num_occupants]))

args[:time_zone_utc_offset] = HPXMLDefaults.get_default_time_zone(hpxml_bldg.time_zone_utc_offset, weather)
args[:latitude] = HPXMLDefaults.get_default_latitude(hpxml_bldg.latitude, weather)
args[:longitude] = HPXMLDefaults.get_default_longitude(hpxml_bldg.longitude, weather)
args[:time_zone_utc_offset] = Defaults.get_time_zone(hpxml_bldg.time_zone_utc_offset, weather)
args[:latitude] = Defaults.get_latitude(hpxml_bldg.latitude, weather)
args[:longitude] = Defaults.get_longitude(hpxml_bldg.longitude, weather)
end
end

Expand Down
10 changes: 5 additions & 5 deletions BuildResidentialScheduleFile/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>build_residential_schedule_file</name>
<uid>f770b2db-1a9f-4e99-99a7-7f3161a594b1</uid>
<version_id>c51b1eff-b508-42dd-a77e-671265e526ab</version_id>
<version_modified>2024-08-28T16:06:34Z</version_modified>
<version_id>fac68af6-8045-433e-8eca-df53c8274e61</version_id>
<version_modified>2024-09-29T23:07:27Z</version_modified>
<xml_checksum>03F02484</xml_checksum>
<class_name>BuildResidentialScheduleFile</class_name>
<display_name>Schedule File Builder</display_name>
Expand Down Expand Up @@ -133,7 +133,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>19F7FF66</checksum>
<checksum>655C4010</checksum>
</file>
<file>
<filename>README.md</filename>
Expand Down Expand Up @@ -229,7 +229,7 @@
<filename>schedules.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>1E6EB1B1</checksum>
<checksum>F53FB2CB</checksum>
</file>
<file>
<filename>shower_cluster_size_probability.csv</filename>
Expand Down Expand Up @@ -931,7 +931,7 @@
<filename>test_build_residential_schedule_file.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>656C80A2</checksum>
<checksum>04AE998D</checksum>
</file>
</files>
</measure>
13 changes: 8 additions & 5 deletions BuildResidentialScheduleFile/resources/schedules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def create(args:,
# @return [Boolean] true if successful
def create_stochastic_schedules(args:,
weather:)
default_schedules_csv_data = HPXMLDefaults.get_default_schedules_csv_data()
default_schedules_csv_data = Defaults.get_schedules_csv_data()
schedules_csv_data = get_schedules_csv_data()

# initialize a random number generator
Expand Down Expand Up @@ -178,7 +178,7 @@ def create_stochastic_schedules(args:,
plugload_tv_monthly_multiplier = Schedule.validate_values(schedules_csv_data[SchedulesFile::Columns[:PlugLoadsTV].name]['PlugLoadsTVMonthlyMultipliers'], 12, 'monthly') # American Time Use Survey
ceiling_fan_weekday_sch = Schedule.validate_values(default_schedules_csv_data[SchedulesFile::Columns[:CeilingFan].name]['WeekdayScheduleFractions'], 24, 'weekday') # Table C.3(5) of ANSI/RESNET/ICC 301-2022 Addendum C
ceiling_fan_weekend_sch = Schedule.validate_values(default_schedules_csv_data[SchedulesFile::Columns[:CeilingFan].name]['WeekendScheduleFractions'], 24, 'weekend') # Table C.3(5) of ANSI/RESNET/ICC 301-2022 Addendum C
ceiling_fan_monthly_multiplier = Schedule.validate_values(HVAC.get_default_ceiling_fan_months(weather).join(', '), 12, 'monthly') # based on monthly average outdoor temperatures per ANSI/RESNET/ICC 301-2019
ceiling_fan_monthly_multiplier = Schedule.validate_values(Defaults.get_ceiling_fan_months(weather).join(', '), 12, 'monthly') # based on monthly average outdoor temperatures per ANSI/RESNET/ICC 301-2019

sch = get_building_america_lighting_schedule(args[:time_zone_utc_offset], args[:latitude], args[:longitude], schedules_csv_data)
interior_lighting_schedule = []
Expand Down Expand Up @@ -858,12 +858,15 @@ def export(schedules_path:)
schedule_keys = table[0] + schedule_keys
schedule_rows = schedule_rows.map.with_index { |row, i| table[i + 1] + row }
end
CSV.open(schedules_path, 'w') do |csv|
csv << schedule_keys

# Note: We don't use the CSV library here because it's slow for large files
File.open(schedules_path, 'w') do |csv|
csv << "#{schedule_keys.join(',')}\n"
schedule_rows.each do |row|
csv << row
csv << "#{row.join(',')}\n"
end
end

return true
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,17 @@ def test_stochastic_location_detailed
assert(info_msgs.any? { |info_msg| info_msg.include?('State=CO') })
assert(!info_msgs.any? { |info_msg| info_msg.include?('RandomSeed') })
assert(info_msgs.any? { |info_msg| info_msg.include?('GeometryNumOccupants=3.0') })
assert(info_msgs.any? { |info_msg| info_msg.include?('TimeZoneUTCOffset=-7.0') })
assert(info_msgs.any? { |info_msg| info_msg.include?('Latitude=40.51') })
assert(info_msgs.any? { |info_msg| info_msg.include?('Longitude=-107.55') })
assert(info_msgs.any? { |info_msg| info_msg.include?('TimeZoneUTCOffset=-6.0') })
assert(info_msgs.any? { |info_msg| info_msg.include?('Latitude=39.77') })
assert(info_msgs.any? { |info_msg| info_msg.include?('Longitude=-104.73') })

sf = SchedulesFile.new(schedules_paths: hpxml.buildings[0].header.schedules_filepaths,
year: @year,
output_path: @tmp_schedule_file_path)

assert_in_epsilon(6689, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Occupants].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2062, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2062, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(1992, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(1992, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(534, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(213, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(134, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, schedules: sf.tmp_schedules), @tol)
Expand Down
Loading

0 comments on commit 9e03d1d

Please sign in to comment.