Skip to content

Commit

Permalink
Merge branch 'ansi_301_2022' of https://github.com/NREL/OpenStudio-ERI
Browse files Browse the repository at this point in the history
…into ansi_301_2022_airflow
  • Loading branch information
shorowit committed Jan 18, 2024
2 parents f835f40 + cc803e9 commit 849c1f1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 60 deletions.
35 changes: 16 additions & 19 deletions rulesets/resources/301ruleset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1198,10 +1198,14 @@ def self.set_systems_hvac_reference(orig_bldg, new_bldg, is_all_electric: false)

# Table 303.4.1(1) - Thermostat
control_type = HPXML::HVACControlTypeManual
htg_weekday_setpoints, htg_weekend_setpoints = HVAC.get_default_heating_setpoint(control_type, @eri_version)
clg_weekday_setpoints, clg_weekend_setpoints = HVAC.get_default_cooling_setpoint(control_type, @eri_version)
new_bldg.hvac_controls.add(id: 'HVACControl',
control_type: control_type,
heating_setpoint_temp: HVAC.get_default_heating_setpoint(control_type)[0],
cooling_setpoint_temp: HVAC.get_default_cooling_setpoint(control_type)[0])
weekday_heating_setpoints: htg_weekday_setpoints,
weekend_heating_setpoints: htg_weekend_setpoints,
weekday_cooling_setpoints: clg_weekday_setpoints,
weekend_cooling_setpoints: clg_weekend_setpoints)

# Distribution system
add_reference_distribution_system(new_bldg)
Expand Down Expand Up @@ -1369,26 +1373,19 @@ def self.set_systems_hvac_rated(orig_bldg, new_bldg)
if orig_bldg.hvac_controls.size > 0
hvac_control = orig_bldg.hvac_controls[0]
control_type = hvac_control.control_type
htg_sp, htg_setback_sp, htg_setback_hrs_per_week, htg_setback_start_hr = HVAC.get_default_heating_setpoint(control_type)
clg_sp, clg_setup_sp, clg_setup_hrs_per_week, clg_setup_start_hr = HVAC.get_default_cooling_setpoint(control_type)
new_bldg.hvac_controls.add(id: hvac_control.id,
control_type: control_type,
heating_setpoint_temp: htg_sp,
heating_setback_temp: htg_setback_sp,
heating_setback_hours_per_week: htg_setback_hrs_per_week,
heating_setback_start_hour: htg_setback_start_hr,
cooling_setpoint_temp: clg_sp,
cooling_setup_temp: clg_setup_sp,
cooling_setup_hours_per_week: clg_setup_hrs_per_week,
cooling_setup_start_hour: clg_setup_start_hr)

hvac_control_id = hvac_control_id
else
control_type = HPXML::HVACControlTypeManual
new_bldg.hvac_controls.add(id: 'HVACControl',
control_type: control_type,
heating_setpoint_temp: HVAC.get_default_heating_setpoint(control_type)[0],
cooling_setpoint_temp: HVAC.get_default_cooling_setpoint(control_type)[0])
hvac_control_id = 'HVACControl'
end
htg_weekday_setpoints, htg_weekend_setpoints = HVAC.get_default_heating_setpoint(control_type, @eri_version)
clg_weekday_setpoints, clg_weekend_setpoints = HVAC.get_default_cooling_setpoint(control_type, @eri_version)
new_bldg.hvac_controls.add(id: hvac_control_id,
control_type: control_type,
weekday_heating_setpoints: htg_weekday_setpoints,
weekend_heating_setpoints: htg_weekend_setpoints,
weekday_cooling_setpoints: clg_weekday_setpoints,
weekend_cooling_setpoints: clg_weekend_setpoints)

# Table 4.2.2(1) - Thermal distribution systems
orig_bldg.hvac_distributions.each do |orig_hvac_distribution|
Expand Down
76 changes: 35 additions & 41 deletions rulesets/tests/test_hvac.rb
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,9 @@ def test_manual_thermostat

_all_calc_types.each do |calc_type|
_hpxml, hpxml_bldg = _test_ruleset(hpxml_name, calc_type)
_check_thermostat(hpxml_bldg, control_type: HPXML::HVACControlTypeManual, htg_sp: 68, clg_sp: 78)
_check_thermostat(hpxml_bldg, control_type: HPXML::HVACControlTypeManual,
htg_setpoints: '68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68',
clg_setpoints: '78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78')
end
end

Expand All @@ -863,9 +865,28 @@ def test_programmable_thermostat
_all_calc_types.each do |calc_type|
_hpxml, hpxml_bldg = _test_ruleset(hpxml_name, calc_type)
if [Constants.CalcTypeERIRatedHome].include? calc_type
_check_thermostat(hpxml_bldg, control_type: HPXML::HVACControlTypeProgrammable, htg_sp: 68, clg_sp: 78, htg_setback: 66, htg_setback_hrs: 49, htg_setback_start_hr: 23, clg_setup: 80, clg_setup_hrs: 42, clg_setup_start_hr: 9)
_check_thermostat(hpxml_bldg, control_type: HPXML::HVACControlTypeProgrammable,
htg_setpoints: '66, 66, 66, 66, 66, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 66',
clg_setpoints: '78, 78, 78, 78, 78, 78, 78, 78, 78, 80, 80, 80, 80, 80, 79, 78, 78, 78, 78, 78, 78, 78, 78, 78')
else
_check_thermostat(hpxml_bldg, control_type: HPXML::HVACControlTypeManual, htg_sp: 68, clg_sp: 78)
_check_thermostat(hpxml_bldg, control_type: HPXML::HVACControlTypeManual,
htg_setpoints: '68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68',
clg_setpoints: '78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78')
end
end

hpxml_name = _change_eri_version(hpxml_name, '2019ABCD')

_all_calc_types.each do |calc_type|
_hpxml, hpxml_bldg = _test_ruleset(hpxml_name, calc_type)
if [Constants.CalcTypeERIRatedHome].include? calc_type
_check_thermostat(hpxml_bldg, control_type: HPXML::HVACControlTypeProgrammable,
htg_setpoints: '66, 66, 66, 66, 66, 66, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 66',
clg_setpoints: '78, 78, 78, 78, 78, 78, 78, 78, 78, 80, 80, 80, 80, 80, 80, 78, 78, 78, 78, 78, 78, 78, 78, 78')
else
_check_thermostat(hpxml_bldg, control_type: HPXML::HVACControlTypeManual,
htg_setpoints: '68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68',
clg_setpoints: '78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78')
end
end
end
Expand Down Expand Up @@ -1245,52 +1266,25 @@ def _check_cooling_system(hpxml_bldg, all_expected_values = [])
end
end

def _check_thermostat(hpxml_bldg, control_type:, htg_sp:, clg_sp:, htg_setback: nil, htg_setback_hrs: nil, htg_setback_start_hr: nil,
clg_setup: nil, clg_setup_hrs: nil, clg_setup_start_hr: nil)
def _check_thermostat(hpxml_bldg, control_type:, htg_setpoints:, clg_setpoints:)
assert_equal(1, hpxml_bldg.hvac_controls.size)
hvac_control = hpxml_bldg.hvac_controls[0]
assert_equal(control_type, hvac_control.control_type)

if htg_sp.nil?
assert_nil(hvac_control.heating_setpoint_temp)
else
assert_equal(htg_sp, hvac_control.heating_setpoint_temp)
end
if htg_setback.nil?
assert_nil(hvac_control.heating_setback_temp)
if htg_setpoints.nil?
assert_nil(hvac_control.weekday_heating_setpoints)
assert_nil(hvac_control.weekend_heating_setpoints)
else
assert_equal(htg_setback, hvac_control.heating_setback_temp)
end
if htg_setback_hrs.nil?
assert_nil(hvac_control.heating_setback_hours_per_week)
else
assert_equal(htg_setback_hrs, hvac_control.heating_setback_hours_per_week)
end
if htg_setback_start_hr.nil?
assert_nil(hvac_control.heating_setback_start_hour)
else
assert_equal(htg_setback_start_hr, hvac_control.heating_setback_start_hour)
assert_equal(htg_setpoints.split(', ').map(&:to_f), hvac_control.weekday_heating_setpoints.split(', ').map(&:to_f))
assert_equal(htg_setpoints.split(', ').map(&:to_f), hvac_control.weekend_heating_setpoints.split(', ').map(&:to_f))
end

if clg_sp.nil?
assert_nil(hvac_control.cooling_setpoint_temp)
else
assert_equal(clg_sp, hvac_control.cooling_setpoint_temp)
end
if clg_setup.nil?
assert_nil(hvac_control.cooling_setup_temp)
else
assert_equal(clg_setup, hvac_control.cooling_setup_temp)
end
if clg_setup_hrs.nil?
assert_nil(hvac_control.cooling_setup_hours_per_week)
else
assert_equal(clg_setup_hrs, hvac_control.cooling_setup_hours_per_week)
end
if clg_setup_start_hr.nil?
assert_nil(hvac_control.cooling_setup_start_hour)
if clg_setpoints.nil?
assert_nil(hvac_control.weekday_cooling_setpoints)
assert_nil(hvac_control.weekend_cooling_setpoints)
else
assert_equal(clg_setup_start_hr, hvac_control.cooling_setup_start_hour)
assert_equal(clg_setpoints.split(', ').map(&:to_f), hvac_control.weekday_cooling_setpoints.split(', ').map(&:to_f))
assert_equal(clg_setpoints.split(', ').map(&:to_f), hvac_control.weekend_cooling_setpoints.split(', ').map(&:to_f))
end
end

Expand Down

0 comments on commit 849c1f1

Please sign in to comment.