diff --git a/BuildResidentialHPXML/measure.rb b/BuildResidentialHPXML/measure.rb
index 782fbaad2f..80a46f96dd 100644
--- a/BuildResidentialHPXML/measure.rb
+++ b/BuildResidentialHPXML/measure.rb
@@ -195,7 +195,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
site_iecc_zone_choices = OpenStudio::StringVector.new
- Constants.IECCZones.each do |iz|
+ Constants::IECCZones.each do |iz|
site_iecc_zone_choices << iz
end
@@ -210,7 +210,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
site_state_code_choices = OpenStudio::StringVector.new
- Constants.StateCodesMap.keys.each do |sc|
+ Constants::StateCodesMap.keys.each do |sc|
site_state_code_choices << sc
end
@@ -276,11 +276,6 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg.setDefaultValue(HPXML::ResidentialTypeSFD)
args << arg
- level_choices = OpenStudio::StringVector.new
- level_choices << 'Bottom'
- level_choices << 'Middle'
- level_choices << 'Top'
-
arg = OpenStudio::Measure::OSArgument::makeBoolArgument('geometry_unit_left_wall_is_adiabatic', false)
arg.setDisplayName('Geometry: Unit Left Wall Is Adiabatic')
arg.setDescription('Presence of an adiabatic left wall.')
@@ -387,13 +382,13 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
garage_position_choices = OpenStudio::StringVector.new
- garage_position_choices << 'Right'
- garage_position_choices << 'Left'
+ garage_position_choices << Constants::PositionRight
+ garage_position_choices << Constants::PositionLeft
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('geometry_garage_position', garage_position_choices, true)
arg.setDisplayName('Geometry: Garage Position')
arg.setDescription("The position of the garage. Only applies to #{HPXML::ResidentialTypeSFD} units.")
- arg.setDefaultValue('Right')
+ arg.setDefaultValue(Constants::PositionRight)
args << arg
foundation_type_choices = OpenStudio::StringVector.new
@@ -448,13 +443,13 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
roof_type_choices = OpenStudio::StringVector.new
- roof_type_choices << 'gable'
- roof_type_choices << 'hip'
+ roof_type_choices << Constants::RoofTypeGable
+ roof_type_choices << Constants::RoofTypeHip
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('geometry_roof_type', roof_type_choices, true)
arg.setDisplayName('Geometry: Roof Type')
arg.setDescription('The roof type of the building. Ignored if the building has a flat roof.')
- arg.setDefaultValue('gable')
+ arg.setDefaultValue(Constants::RoofTypeGable)
args << arg
roof_pitch_choices = OpenStudio::StringVector.new
@@ -591,14 +586,14 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
wall_ins_location_choices = OpenStudio::StringVector.new
- wall_ins_location_choices << 'interior'
- wall_ins_location_choices << 'exterior'
+ wall_ins_location_choices << Constants::LocationInterior
+ wall_ins_location_choices << Constants::LocationExterior
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('foundation_wall_insulation_location', wall_ins_location_choices, false)
arg.setDisplayName('Foundation Wall: Insulation Location')
arg.setUnits('ft')
arg.setDescription('Whether the insulation is on the interior or exterior of the foundation wall. Only applies to basements/crawlspaces.')
- arg.setDefaultValue('exterior')
+ arg.setDefaultValue(Constants::LocationExterior)
args << arg
arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('foundation_wall_insulation_distance_to_top', false)
@@ -714,7 +709,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
radiant_barrier_attic_location_choices = OpenStudio::StringVector.new
- radiant_barrier_attic_location_choices << 'none'
+ radiant_barrier_attic_location_choices << Constants::None
radiant_barrier_attic_location_choices << HPXML::RadiantBarrierLocationAtticRoofOnly
radiant_barrier_attic_location_choices << HPXML::RadiantBarrierLocationAtticRoofAndGableWalls
radiant_barrier_attic_location_choices << HPXML::RadiantBarrierLocationAtticFloor
@@ -1104,7 +1099,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
heating_system_type_choices = OpenStudio::StringVector.new
- heating_system_type_choices << 'none'
+ heating_system_type_choices << Constants::None
heating_system_type_choices << HPXML::HVACTypeFurnace
heating_system_type_choices << HPXML::HVACTypeWallFurnace
heating_system_type_choices << HPXML::HVACTypeFloorFurnace
@@ -1126,7 +1121,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
heating_system_fuel_choices << HPXML::FuelTypeCoal
cooling_system_type_choices = OpenStudio::StringVector.new
- cooling_system_type_choices << 'none'
+ cooling_system_type_choices << Constants::None
cooling_system_type_choices << HPXML::HVACTypeCentralAirConditioner
cooling_system_type_choices << HPXML::HVACTypeRoomAirConditioner
cooling_system_type_choices << HPXML::HVACTypeEvaporativeCooler
@@ -1146,7 +1141,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('heating_system_type', heating_system_type_choices, true)
arg.setDisplayName('Heating System: Type')
- arg.setDescription("The type of heating system. Use 'none' if there is no heating system or if there is a heat pump serving a heating load.")
+ arg.setDescription("The type of heating system. Use '#{Constants::None}' if there is no heating system or if there is a heat pump serving a heating load.")
arg.setDefaultValue(HPXML::HVACTypeFurnace)
args << arg
@@ -1201,7 +1196,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('cooling_system_type', cooling_system_type_choices, true)
arg.setDisplayName('Cooling System: Type')
- arg.setDescription("The type of cooling system. Use 'none' if there is no cooling system or if there is a heat pump serving a cooling load.")
+ arg.setDescription("The type of cooling system. Use '#{Constants::None}' if there is no cooling system or if there is a heat pump serving a cooling load.")
arg.setDefaultValue(HPXML::HVACTypeCentralAirConditioner)
args << arg
@@ -1300,7 +1295,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
heat_pump_type_choices = OpenStudio::StringVector.new
- heat_pump_type_choices << 'none'
+ heat_pump_type_choices << Constants::None
heat_pump_type_choices << HPXML::HVACTypeHeatPumpAirToAir
heat_pump_type_choices << HPXML::HVACTypeHeatPumpMiniSplit
heat_pump_type_choices << HPXML::HVACTypeHeatPumpGroundToAir
@@ -1313,7 +1308,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
heat_pump_heating_efficiency_type_choices << HPXML::UnitsCOP
heat_pump_backup_type_choices = OpenStudio::StringVector.new
- heat_pump_backup_type_choices << 'none'
+ heat_pump_backup_type_choices << Constants::None
heat_pump_backup_type_choices << HPXML::HeatPumpBackupTypeIntegrated
heat_pump_backup_type_choices << HPXML::HeatPumpBackupTypeSeparate
@@ -1334,8 +1329,8 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('heat_pump_type', heat_pump_type_choices, true)
arg.setDisplayName('Heat Pump: Type')
- arg.setDescription("The type of heat pump. Use 'none' if there is no heat pump.")
- arg.setDefaultValue('none')
+ arg.setDescription("The type of heat pump. Use '#{Constants::None}' if there is no heat pump.")
+ arg.setDefaultValue(Constants::None)
args << arg
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('heat_pump_heating_efficiency_type', heat_pump_heating_efficiency_type_choices, true)
@@ -1441,7 +1436,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('heat_pump_backup_type', heat_pump_backup_type_choices, true)
arg.setDisplayName('Heat Pump: Backup Type')
- arg.setDescription("The backup type of the heat pump. If '#{HPXML::HeatPumpBackupTypeIntegrated}', represents e.g. built-in electric strip heat or dual-fuel integrated furnace. If '#{HPXML::HeatPumpBackupTypeSeparate}', represents e.g. electric baseboard or boiler based on the Heating System 2 specified below. Use 'none' if there is no backup heating.")
+ arg.setDescription("The backup type of the heat pump. If '#{HPXML::HeatPumpBackupTypeIntegrated}', represents e.g. built-in electric strip heat or dual-fuel integrated furnace. If '#{HPXML::HeatPumpBackupTypeSeparate}', represents e.g. electric baseboard or boiler based on the Heating System 2 specified below. Use '#{Constants::None}' if there is no backup heating.")
arg.setDefaultValue(HPXML::HeatPumpBackupTypeIntegrated)
args << arg
@@ -1584,7 +1579,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
geothermal_loop_configuration_choices = OpenStudio::StringVector.new
- geothermal_loop_configuration_choices << 'none'
+ geothermal_loop_configuration_choices << Constants::None
# geothermal_loop_configuration_choices << HPXML::GeothermalLoopLoopConfigurationDiagonal
# geothermal_loop_configuration_choices << HPXML::GeothermalLoopLoopConfigurationHorizontal
# geothermal_loop_configuration_choices << HPXML::GeothermalLoopLoopConfigurationOther
@@ -1662,7 +1657,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
heating_system_2_type_choices = OpenStudio::StringVector.new
- heating_system_2_type_choices << 'none'
+ heating_system_2_type_choices << Constants::None
heating_system_2_type_choices << HPXML::HVACTypeFurnace
heating_system_2_type_choices << HPXML::HVACTypeWallFurnace
heating_system_2_type_choices << HPXML::HVACTypeFloorFurnace
@@ -1675,7 +1670,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('heating_system_2_type', heating_system_2_type_choices, true)
arg.setDisplayName('Heating System 2: Type')
arg.setDescription("The type of the second heating system. If a heat pump is specified and the backup type is '#{HPXML::HeatPumpBackupTypeSeparate}', this heating system represents '#{HPXML::HeatPumpBackupTypeSeparate}' backup heating. For ducted heat pumps where the backup heating system is a '#{HPXML::HVACTypeFurnace}', the backup would typically be characterized as '#{HPXML::HeatPumpBackupTypeIntegrated}' in that the furnace and heat pump share the same distribution system and blower fan; a '#{HPXML::HVACTypeFurnace}' as '#{HPXML::HeatPumpBackupTypeSeparate}' backup to a ducted heat pump is not supported.")
- arg.setDefaultValue('none')
+ arg.setDefaultValue(Constants::None)
args << arg
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('heating_system_2_fuel', heating_system_fuel_choices, true)
@@ -1741,12 +1736,12 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeStringArgument('hvac_control_heating_season_period', false)
arg.setDisplayName('HVAC Control: Heating Season Period')
- arg.setDescription("Enter a date like 'Nov 1 - Jun 30'. If not provided, the OS-HPXML default (see HPXML HVAC Control) is used. Can also provide '#{HPXML::BuildingAmerica}' to use automatic seasons from the Building America House Simulation Protocols.")
+ arg.setDescription("Enter a date like 'Nov 1 - Jun 30'. If not provided, the OS-HPXML default (see HPXML HVAC Control) is used. Can also provide '#{Constants::BuildingAmerica}' to use automatic seasons from the Building America House Simulation Protocols.")
args << arg
arg = OpenStudio::Measure::OSArgument::makeStringArgument('hvac_control_cooling_season_period', false)
arg.setDisplayName('HVAC Control: Cooling Season Period')
- arg.setDescription("Enter a date like 'Jun 1 - Oct 31'. If not provided, the OS-HPXML default (see HPXML HVAC Control) is used. Can also provide '#{HPXML::BuildingAmerica}' to use automatic seasons from the Building America House Simulation Protocols.")
+ arg.setDescription("Enter a date like 'Jun 1 - Oct 31'. If not provided, the OS-HPXML default (see HPXML HVAC Control) is used. Can also provide '#{Constants::BuildingAmerica}' to use automatic seasons from the Building America House Simulation Protocols.")
args << arg
arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('hvac_blower_fan_watts_per_cfm', false)
@@ -1883,7 +1878,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
mech_vent_fan_type_choices = OpenStudio::StringVector.new
- mech_vent_fan_type_choices << 'none'
+ mech_vent_fan_type_choices << Constants::None
mech_vent_fan_type_choices << HPXML::MechVentTypeExhaust
mech_vent_fan_type_choices << HPXML::MechVentTypeSupply
mech_vent_fan_type_choices << HPXML::MechVentTypeERV
@@ -1897,8 +1892,8 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('mech_vent_fan_type', mech_vent_fan_type_choices, true)
arg.setDisplayName('Mechanical Ventilation: Fan Type')
- arg.setDescription("The type of the mechanical ventilation. Use 'none' if there is no mechanical ventilation system.")
- arg.setDefaultValue('none')
+ arg.setDescription("The type of the mechanical ventilation. Use '#{Constants::None}' if there is no mechanical ventilation system.")
+ arg.setDefaultValue(Constants::None)
args << arg
arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('mech_vent_flow_rate', false)
@@ -1990,7 +1985,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
mech_vent_2_fan_type_choices = OpenStudio::StringVector.new
- mech_vent_2_fan_type_choices << 'none'
+ mech_vent_2_fan_type_choices << Constants::None
mech_vent_2_fan_type_choices << HPXML::MechVentTypeExhaust
mech_vent_2_fan_type_choices << HPXML::MechVentTypeSupply
mech_vent_2_fan_type_choices << HPXML::MechVentTypeERV
@@ -1999,8 +1994,8 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('mech_vent_2_fan_type', mech_vent_2_fan_type_choices, true)
arg.setDisplayName('Mechanical Ventilation 2: Fan Type')
- arg.setDescription("The type of the second mechanical ventilation. Use 'none' if there is no second mechanical ventilation system.")
- arg.setDefaultValue('none')
+ arg.setDescription("The type of the second mechanical ventilation. Use '#{Constants::None}' if there is no second mechanical ventilation system.")
+ arg.setDefaultValue(Constants::None)
args << arg
arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('mech_vent_2_flow_rate', true)
@@ -2123,7 +2118,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
water_heater_type_choices = OpenStudio::StringVector.new
- water_heater_type_choices << 'none'
+ water_heater_type_choices << Constants::None
water_heater_type_choices << HPXML::WaterHeaterTypeStorage
water_heater_type_choices << HPXML::WaterHeaterTypeTankless
water_heater_type_choices << HPXML::WaterHeaterTypeHeatPump
@@ -2168,7 +2163,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('water_heater_type', water_heater_type_choices, true)
arg.setDisplayName('Water Heater: Type')
- arg.setDescription("The type of water heater. Use 'none' if there is no water heater.")
+ arg.setDescription("The type of water heater. Use '#{Constants::None}' if there is no water heater.")
arg.setDefaultValue(HPXML::WaterHeaterTypeStorage)
args << arg
@@ -2319,14 +2314,14 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
dwhr_facilities_connected_choices = OpenStudio::StringVector.new
- dwhr_facilities_connected_choices << 'none'
+ dwhr_facilities_connected_choices << Constants::None
dwhr_facilities_connected_choices << HPXML::DWHRFacilitiesConnectedOne
dwhr_facilities_connected_choices << HPXML::DWHRFacilitiesConnectedAll
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('dwhr_facilities_connected', dwhr_facilities_connected_choices, true)
arg.setDisplayName('Drain Water Heat Recovery: Facilities Connected')
- arg.setDescription("Which facilities are connected for the drain water heat recovery. Use 'none' if there is no drain water heat recovery system.")
- arg.setDefaultValue('none')
+ arg.setDescription("Which facilities are connected for the drain water heat recovery. Use '#{Constants::None}' if there is no drain water heat recovery system.")
+ arg.setDefaultValue(Constants::None)
args << arg
arg = OpenStudio::Measure::OSArgument::makeBoolArgument('dwhr_equal_flow', false)
@@ -2365,7 +2360,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
solar_thermal_system_type_choices = OpenStudio::StringVector.new
- solar_thermal_system_type_choices << 'none'
+ solar_thermal_system_type_choices << Constants::None
solar_thermal_system_type_choices << HPXML::SolarThermalSystemTypeHotWater
solar_thermal_collector_loop_type_choices = OpenStudio::StringVector.new
@@ -2381,8 +2376,8 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('solar_thermal_system_type', solar_thermal_system_type_choices, true)
arg.setDisplayName('Solar Thermal: System Type')
- arg.setDescription("The type of solar thermal system. Use 'none' if there is no solar thermal system.")
- arg.setDefaultValue('none')
+ arg.setDescription("The type of solar thermal system. Use '#{Constants::None}' if there is no solar thermal system.")
+ arg.setDefaultValue(Constants::None)
args << arg
arg = OpenStudio::Measure::OSArgument::makeDoubleArgument('solar_thermal_collector_area', true)
@@ -2710,7 +2705,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
args << arg
dehumidifier_type_choices = OpenStudio::StringVector.new
- dehumidifier_type_choices << 'none'
+ dehumidifier_type_choices << Constants::None
dehumidifier_type_choices << HPXML::DehumidifierTypePortable
dehumidifier_type_choices << HPXML::DehumidifierTypeWholeHome
@@ -2721,7 +2716,7 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('dehumidifier_type', dehumidifier_type_choices, true)
arg.setDisplayName('Dehumidifier: Type')
arg.setDescription('The type of dehumidifier.')
- arg.setDefaultValue('none')
+ arg.setDefaultValue(Constants::None)
args << arg
arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('dehumidifier_efficiency_type', dehumidifier_efficiency_type_choices, true)
@@ -3584,7 +3579,7 @@ def argument_warnings(args)
warning = (args[:geometry_attic_type] == HPXML::AtticTypeConditioned) && (args[:ceiling_assembly_r] > max_uninsulated_ceiling_rvalue)
warnings << 'Home with conditioned attic has ceiling insulation.' if warning
- warning = (args[:heat_pump_type] != HPXML::HVACTypeHeatPumpGroundToAir) && (!args[:geothermal_loop_configuration].nil? && args[:geothermal_loop_configuration] != 'none')
+ warning = (args[:heat_pump_type] != HPXML::HVACTypeHeatPumpGroundToAir) && (!args[:geothermal_loop_configuration].nil? && args[:geothermal_loop_configuration] != Constants::None)
warnings << 'Specified an attached geothermal loop but home has no ground source heat pump.' if warning
return warnings
@@ -3598,10 +3593,10 @@ def argument_warnings(args)
def argument_errors(args)
errors = []
- error = (args[:heating_system_type] != 'none') && (args[:heat_pump_type] != 'none') && (args[:heating_system_fraction_heat_load_served] > 0) && (args[:heat_pump_fraction_heat_load_served] > 0)
+ error = (args[:heating_system_type] != Constants::None) && (args[:heat_pump_type] != Constants::None) && (args[:heating_system_fraction_heat_load_served] > 0) && (args[:heat_pump_fraction_heat_load_served] > 0)
errors << 'Multiple central heating systems are not currently supported.' if error
- error = (args[:cooling_system_type] != 'none') && (args[:heat_pump_type] != 'none') && (args[:cooling_system_fraction_cool_load_served] > 0) && (args[:heat_pump_fraction_cool_load_served] > 0)
+ error = (args[:cooling_system_type] != Constants::None) && (args[:heat_pump_type] != Constants::None) && (args[:cooling_system_fraction_cool_load_served] > 0) && (args[:heat_pump_fraction_cool_load_served] > 0)
errors << 'Multiple central cooling systems are not currently supported.' if error
error = ![HPXML::FoundationTypeSlab, HPXML::FoundationTypeAboveApartment].include?(args[:geometry_foundation_type]) && (args[:geometry_foundation_height] == 0)
@@ -3610,7 +3605,7 @@ def argument_errors(args)
error = (args[:geometry_unit_type] == HPXML::ResidentialTypeApartment) && ([HPXML::FoundationTypeBasementConditioned, HPXML::FoundationTypeCrawlspaceConditioned].include? args[:geometry_foundation_type])
errors << 'Conditioned basement/crawlspace foundation type for apartment units is not currently supported.' if error
- error = (args[:heating_system_type] == 'none') && (args[:heat_pump_type] == 'none') && (args[:heating_system_2_type] != 'none')
+ error = (args[:heating_system_type] == Constants::None) && (args[:heat_pump_type] == Constants::None) && (args[:heating_system_2_type] != Constants::None)
errors << 'A second heating system was specified without a primary heating system.' if error
if ((args[:heat_pump_backup_type] == HPXML::HeatPumpBackupTypeSeparate) && (args[:heating_system_2_type] == HPXML::HVACTypeFurnace)) # separate ducted backup
@@ -3771,10 +3766,10 @@ def argument_errors(args)
error = (args[:geometry_unit_type] == HPXML::ResidentialTypeSFA) && (args[:geometry_attic_type] == HPXML::AtticTypeBelowApartment)
errors << 'Single-family attached units cannot be below another unit.' if error
- error = (args[:geometry_garage_protrusion] > 0) && (args[:geometry_roof_type] == 'hip') && (args[:geometry_garage_width] * args[:geometry_garage_depth] > 0)
+ error = (args[:geometry_garage_protrusion] > 0) && (args[:geometry_roof_type] == Constants::RoofTypeHip) && (args[:geometry_garage_width] * args[:geometry_garage_depth] > 0)
errors << 'Cannot handle protruding garage and hip roof.' if error
- error = (args[:geometry_garage_protrusion] > 0) && (args[:geometry_unit_aspect_ratio] < 1) && (args[:geometry_garage_width] * args[:geometry_garage_depth] > 0) && (args[:geometry_roof_type] == 'gable')
+ error = (args[:geometry_garage_protrusion] > 0) && (args[:geometry_unit_aspect_ratio] < 1) && (args[:geometry_garage_width] * args[:geometry_garage_depth] > 0) && (args[:geometry_roof_type] == Constants::RoofTypeGable)
errors << 'Cannot handle protruding garage and attic ridge running from front to back.' if error
error = (args[:geometry_foundation_type] == HPXML::FoundationTypeAmbient) && (args[:geometry_garage_width] * args[:geometry_garage_depth] > 0)
@@ -3887,7 +3882,7 @@ def self.create(runner, model, args, epw_path, hpxml_path, existing_hpxml_path)
return false
end
- eri_version = Constants.ERIVersions[-1]
+ eri_version = Constants::ERIVersions[-1]
HPXMLDefaults.apply(runner, hpxml, hpxml_bldg, eri_version, weather)
hpxml_doc = hpxml.to_doc()
hpxml.set_unique_hpxml_ids(hpxml_doc, true) if hpxml.buildings.size > 1
@@ -3909,9 +3904,9 @@ def self.create(runner, model, args, epw_path, hpxml_path, existing_hpxml_path)
# @param args [Hash] Map of :argument_name => value
# @return [Boolean] True if we need to process the weather file
def self.need_weather_based_on_args(args)
- if (args[:hvac_control_heating_season_period].to_s == HPXML::BuildingAmerica) ||
- (args[:hvac_control_cooling_season_period].to_s == HPXML::BuildingAmerica) ||
- (args[:solar_thermal_system_type] != 'none' && args[:solar_thermal_collector_tilt].start_with?('latitude')) ||
+ if (args[:hvac_control_heating_season_period].to_s == Constants::BuildingAmerica) ||
+ (args[:hvac_control_cooling_season_period].to_s == Constants::BuildingAmerica) ||
+ (args[:solar_thermal_system_type] != Constants::None && args[:solar_thermal_collector_tilt].start_with?('latitude')) ||
(args[:pv_system_present] && args[:pv_system_array_tilt].start_with?('latitude')) ||
(args[:pv_system_2_present] && args[:pv_system_2_array_tilt].start_with?('latitude')) ||
(args[:apply_defaults])
@@ -4073,7 +4068,7 @@ def self.set_header(runner, hpxml, args)
if not args[:schedules_vacancy_periods].nil?
schedules_vacancy_periods = args[:schedules_vacancy_periods].split(',').map(&:strip)
schedules_vacancy_periods.each do |schedules_vacancy_period|
- begin_month, begin_day, begin_hour, end_month, end_day, end_hour = Schedule.parse_date_time_range(schedules_vacancy_period)
+ begin_month, begin_day, begin_hour, end_month, end_day, end_hour = Calendar.parse_date_time_range(schedules_vacancy_period)
if not unavailable_period_exists(hpxml, 'Vacancy', begin_month, begin_day, begin_hour, end_month, end_day, end_hour)
hpxml.header.unavailable_periods.add(column_name: 'Vacancy', begin_month: begin_month, begin_day: begin_day, begin_hour: begin_hour, end_month: end_month, end_day: end_day, end_hour: end_hour, natvent_availability: HPXML::ScheduleUnavailable)
@@ -4092,7 +4087,7 @@ def self.set_header(runner, hpxml, args)
schedules_power_outage_periods = schedules_power_outage_periods.zip(natvent_availabilities)
schedules_power_outage_periods.each do |schedules_power_outage_period|
outage_period, natvent_availability = schedules_power_outage_period
- begin_month, begin_day, begin_hour, end_month, end_day, end_hour = Schedule.parse_date_time_range(outage_period)
+ begin_month, begin_day, begin_hour, end_month, end_day, end_hour = Calendar.parse_date_time_range(outage_period)
if not unavailable_period_exists(hpxml, 'Power Outage', begin_month, begin_day, begin_hour, end_month, end_day, end_hour, natvent_availability)
hpxml.header.unavailable_periods.add(column_name: 'Power Outage', begin_month: begin_month, begin_day: begin_day, begin_hour: begin_hour, end_month: end_month, end_day: end_day, end_hour: end_hour, natvent_availability: natvent_availability)
@@ -4121,7 +4116,7 @@ def self.set_header(runner, hpxml, args)
end
if not args[:simulation_control_run_period].nil?
- begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Schedule.parse_date_time_range(args[:simulation_control_run_period])
+ begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Calendar.parse_date_time_range(args[:simulation_control_run_period])
if (!hpxml.header.sim_begin_month.nil? && (hpxml.header.sim_begin_month != begin_month)) ||
(!hpxml.header.sim_begin_day.nil? && (hpxml.header.sim_begin_day != begin_day)) ||
(!hpxml.header.sim_end_month.nil? && (hpxml.header.sim_end_month != end_month)) ||
@@ -4483,7 +4478,7 @@ def self.set_header(runner, hpxml, args)
# @return [HPXML::Building] HPXML Building object representing an individual dwelling unit
def self.add_building(hpxml, args)
if not args[:simulation_control_daylight_saving_period].nil?
- begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Schedule.parse_date_time_range(args[:simulation_control_daylight_saving_period])
+ begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Calendar.parse_date_time_range(args[:simulation_control_daylight_saving_period])
dst_begin_month = begin_month
dst_begin_day = begin_day
dst_end_month = end_month
@@ -4574,10 +4569,10 @@ def self.set_site(hpxml_bldg, args)
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_neighbor_buildings(hpxml_bldg, args)
- nbr_map = { Constants.FacadeFront => [args[:neighbor_front_distance], args[:neighbor_front_height]],
- Constants.FacadeBack => [args[:neighbor_back_distance], args[:neighbor_back_height]],
- Constants.FacadeLeft => [args[:neighbor_left_distance], args[:neighbor_left_height]],
- Constants.FacadeRight => [args[:neighbor_right_distance], args[:neighbor_right_height]] }
+ nbr_map = { Constants::FacadeFront => [args[:neighbor_front_distance], args[:neighbor_front_height]],
+ Constants::FacadeBack => [args[:neighbor_back_distance], args[:neighbor_back_height]],
+ Constants::FacadeLeft => [args[:neighbor_left_distance], args[:neighbor_left_height]],
+ Constants::FacadeRight => [args[:neighbor_right_distance], args[:neighbor_right_height]] }
nbr_map.each do |facade, data|
distance, neighbor_height = data
@@ -4662,7 +4657,7 @@ def self.set_building_header(hpxml_bldg, args)
hpxml_bldg.header.natvent_days_per_week = args[:window_natvent_availability]
if not args[:window_shading_summer_season].nil?
- begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Schedule.parse_date_time_range(args[:window_shading_summer_season])
+ begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Calendar.parse_date_time_range(args[:window_shading_summer_season])
hpxml_bldg.header.shading_summer_begin_month = begin_month
hpxml_bldg.header.shading_summer_begin_day = begin_day
hpxml_bldg.header.shading_summer_end_month = end_month
@@ -4761,8 +4756,8 @@ def self.set_roofs(hpxml_bldg, args, sorted_surfaces)
end
sorted_surfaces.each do |surface|
- next unless ['Outdoors'].include? surface.outsideBoundaryCondition
- next if surface.surfaceType != 'RoofCeiling'
+ next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors
+ next if surface.surfaceType != EPlus::SurfaceTypeRoofCeiling
interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
next if [HPXML::LocationOtherHousingUnit].include? interior_adjacent_to
@@ -4805,8 +4800,8 @@ def self.set_roofs(hpxml_bldg, args, sorted_surfaces)
# @return [nil]
def self.set_rim_joists(hpxml_bldg, model, args, sorted_surfaces)
sorted_surfaces.each do |surface|
- next if surface.surfaceType != 'Wall'
- next unless ['Outdoors', 'Adiabatic'].include? surface.outsideBoundaryCondition
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
+ next unless [EPlus::BoundaryConditionOutdoors, EPlus::BoundaryConditionAdiabatic].include? surface.outsideBoundaryCondition
next unless Geometry.surface_is_rim_joist(surface: surface, height: args[:geometry_rim_joist_height])
interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
@@ -4817,7 +4812,7 @@ def self.set_rim_joists(hpxml_bldg, model, args, sorted_surfaces)
HPXML::LocationCrawlspaceConditioned].include? interior_adjacent_to
exterior_adjacent_to = HPXML::LocationOutside
- if surface.outsideBoundaryCondition == 'Adiabatic' # can be adjacent to foundation space
+ if surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic # can be adjacent to foundation space
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model: model, surface: surface)
if adjacent_surface.nil? # adjacent to a space that is not explicitly in the model
unless [HPXML::ResidentialTypeSFD].include?(args[:geometry_unit_type])
@@ -4868,7 +4863,7 @@ def self.set_rim_joists(hpxml_bldg, model, args, sorted_surfaces)
# @return [nil]
def self.set_walls(hpxml_bldg, model, args, sorted_surfaces)
sorted_surfaces.each do |surface|
- next if surface.surfaceType != 'Wall'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
next if Geometry.surface_is_rim_joist(surface: surface, height: args[:geometry_rim_joist_height])
interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
@@ -4877,7 +4872,7 @@ def self.set_walls(hpxml_bldg, model, args, sorted_surfaces)
exterior_adjacent_to = HPXML::LocationOutside
if surface.adjacentSurface.is_initialized
exterior_adjacent_to = Geometry.get_adjacent_to(surface: surface.adjacentSurface.get)
- elsif surface.outsideBoundaryCondition == 'Adiabatic' # can be adjacent to conditioned space, attic
+ elsif surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic # can be adjacent to conditioned space, attic
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model: model, surface: surface)
if adjacent_surface.nil? # adjacent to a space that is not explicitly in the model
exterior_adjacent_to = interior_adjacent_to
@@ -4962,8 +4957,8 @@ def self.set_walls(hpxml_bldg, model, args, sorted_surfaces)
# @return [nil]
def self.set_foundation_walls(hpxml_bldg, model, args, sorted_surfaces)
sorted_surfaces.each do |surface|
- next if surface.surfaceType != 'Wall'
- next unless ['Foundation', 'Adiabatic'].include? surface.outsideBoundaryCondition
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
+ next unless [EPlus::BoundaryConditionFoundation, EPlus::BoundaryConditionAdiabatic].include? surface.outsideBoundaryCondition
next if Geometry.surface_is_rim_joist(surface: surface, height: args[:geometry_rim_joist_height])
interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
@@ -4974,7 +4969,7 @@ def self.set_foundation_walls(hpxml_bldg, model, args, sorted_surfaces)
HPXML::LocationCrawlspaceConditioned].include? interior_adjacent_to
exterior_adjacent_to = HPXML::LocationGround
- if surface.outsideBoundaryCondition == 'Adiabatic' # can be adjacent to foundation space
+ if surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic # can be adjacent to foundation space
adjacent_surface = Geometry.get_adiabatic_adjacent_surface(model: model, surface: surface)
if adjacent_surface.nil? # adjacent to a space that is not explicitly in the model
unless [HPXML::ResidentialTypeSFD].include?(args[:geometry_unit_type])
@@ -4988,7 +4983,7 @@ def self.set_foundation_walls(hpxml_bldg, model, args, sorted_surfaces)
end
end
- foundation_wall_insulation_location = 'exterior' # default
+ foundation_wall_insulation_location = Constants::LocationExterior # default
if not args[:foundation_wall_insulation_location].nil?
foundation_wall_insulation_location = args[:foundation_wall_insulation_location]
end
@@ -5000,13 +4995,13 @@ def self.set_foundation_walls(hpxml_bldg, model, args, sorted_surfaces)
insulation_exterior_r_value = 0
if interior_adjacent_to == exterior_adjacent_to # E.g., don't insulate wall between basement and neighbor basement
# nop
- elsif foundation_wall_insulation_location == 'interior'
+ elsif foundation_wall_insulation_location == Constants::LocationInterior
insulation_interior_r_value = args[:foundation_wall_insulation_r]
if insulation_interior_r_value > 0
insulation_interior_distance_to_top = args[:foundation_wall_insulation_distance_to_top]
insulation_interior_distance_to_bottom = args[:foundation_wall_insulation_distance_to_bottom]
end
- elsif foundation_wall_insulation_location == 'exterior'
+ elsif foundation_wall_insulation_location == Constants::LocationExterior
insulation_exterior_r_value = args[:foundation_wall_insulation_r]
if insulation_exterior_r_value > 0
insulation_exterior_distance_to_top = args[:foundation_wall_insulation_distance_to_top]
@@ -5058,8 +5053,8 @@ def self.set_floors(hpxml_bldg, args, sorted_surfaces)
end
sorted_surfaces.each do |surface|
- next if surface.outsideBoundaryCondition == 'Foundation'
- next unless ['Floor', 'RoofCeiling'].include? surface.surfaceType
+ next if surface.outsideBoundaryCondition == EPlus::BoundaryConditionFoundation
+ next unless [EPlus::SurfaceTypeFloor, EPlus::SurfaceTypeRoofCeiling].include? surface.surfaceType
interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
next unless [HPXML::LocationConditionedSpace, HPXML::LocationGarage].include? interior_adjacent_to
@@ -5067,17 +5062,17 @@ def self.set_floors(hpxml_bldg, args, sorted_surfaces)
exterior_adjacent_to = HPXML::LocationOutside
if surface.adjacentSurface.is_initialized
exterior_adjacent_to = Geometry.get_adjacent_to(surface: surface.adjacentSurface.get)
- elsif surface.outsideBoundaryCondition == 'Adiabatic'
+ elsif surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic
exterior_adjacent_to = HPXML::LocationOtherHousingUnit
- if surface.surfaceType == 'Floor'
+ if surface.surfaceType == EPlus::SurfaceTypeFloor
floor_or_ceiling = HPXML::FloorOrCeilingFloor
- elsif surface.surfaceType == 'RoofCeiling'
+ elsif surface.surfaceType == EPlus::SurfaceTypeRoofCeiling
floor_or_ceiling = HPXML::FloorOrCeilingCeiling
end
end
next if interior_adjacent_to == exterior_adjacent_to
- next if (surface.surfaceType == 'RoofCeiling') && (exterior_adjacent_to == HPXML::LocationOutside)
+ next if (surface.surfaceType == EPlus::SurfaceTypeRoofCeiling) && (exterior_adjacent_to == HPXML::LocationOutside)
next if [HPXML::LocationConditionedSpace,
HPXML::LocationBasementConditioned,
HPXML::LocationCrawlspaceConditioned].include? exterior_adjacent_to
@@ -5132,8 +5127,8 @@ def self.set_floors(hpxml_bldg, args, sorted_surfaces)
# @return [nil]
def self.set_slabs(hpxml_bldg, model, args, sorted_surfaces)
sorted_surfaces.each do |surface|
- next unless ['Foundation'].include? surface.outsideBoundaryCondition
- next if surface.surfaceType != 'Floor'
+ next unless [EPlus::BoundaryConditionFoundation].include? surface.outsideBoundaryCondition
+ next if surface.surfaceType != EPlus::SurfaceTypeFloor
interior_adjacent_to = Geometry.get_adjacent_to(surface: surface)
next if [HPXML::LocationOutside, HPXML::LocationOtherHousingUnit].include? interior_adjacent_to
@@ -5203,26 +5198,26 @@ def self.set_slabs(hpxml_bldg, model, args, sorted_surfaces)
# @return [nil]
def self.set_windows(hpxml_bldg, model, args, sorted_subsurfaces)
sorted_subsurfaces.each do |sub_surface|
- next if sub_surface.subSurfaceType != 'FixedWindow'
+ next if sub_surface.subSurfaceType != EPlus::SubSurfaceTypeWindow
surface = sub_surface.surface.get
sub_surface_height = Geometry.get_surface_height(surface: sub_surface)
sub_surface_facade = Geometry.get_facade_for_surface(surface: sub_surface)
- if (sub_surface_facade == Constants.FacadeFront) && ((args[:overhangs_front_depth] > 0) || args[:overhangs_front_distance_to_top_of_window] > 0)
+ if (sub_surface_facade == Constants::FacadeFront) && ((args[:overhangs_front_depth] > 0) || args[:overhangs_front_distance_to_top_of_window] > 0)
overhangs_depth = args[:overhangs_front_depth]
overhangs_distance_to_top_of_window = args[:overhangs_front_distance_to_top_of_window]
overhangs_distance_to_bottom_of_window = args[:overhangs_front_distance_to_bottom_of_window]
- elsif (sub_surface_facade == Constants.FacadeBack) && ((args[:overhangs_back_depth] > 0) || args[:overhangs_back_distance_to_top_of_window] > 0)
+ elsif (sub_surface_facade == Constants::FacadeBack) && ((args[:overhangs_back_depth] > 0) || args[:overhangs_back_distance_to_top_of_window] > 0)
overhangs_depth = args[:overhangs_back_depth]
overhangs_distance_to_top_of_window = args[:overhangs_back_distance_to_top_of_window]
overhangs_distance_to_bottom_of_window = args[:overhangs_back_distance_to_bottom_of_window]
- elsif (sub_surface_facade == Constants.FacadeLeft) && ((args[:overhangs_left_depth] > 0) || args[:overhangs_left_distance_to_top_of_window] > 0)
+ elsif (sub_surface_facade == Constants::FacadeLeft) && ((args[:overhangs_left_depth] > 0) || args[:overhangs_left_distance_to_top_of_window] > 0)
overhangs_depth = args[:overhangs_left_depth]
overhangs_distance_to_top_of_window = args[:overhangs_left_distance_to_top_of_window]
overhangs_distance_to_bottom_of_window = args[:overhangs_left_distance_to_bottom_of_window]
- elsif (sub_surface_facade == Constants.FacadeRight) && ((args[:overhangs_right_depth] > 0) || args[:overhangs_right_distance_to_top_of_window] > 0)
+ elsif (sub_surface_facade == Constants::FacadeRight) && ((args[:overhangs_right_depth] > 0) || args[:overhangs_right_distance_to_top_of_window] > 0)
overhangs_depth = args[:overhangs_right_depth]
overhangs_distance_to_top_of_window = args[:overhangs_right_distance_to_top_of_window]
overhangs_distance_to_bottom_of_window = args[:overhangs_right_distance_to_bottom_of_window]
@@ -5321,7 +5316,7 @@ def self.set_skylights(hpxml_bldg, args, sorted_subsurfaces)
# @return [nil]
def self.set_doors(hpxml_bldg, model, args, sorted_subsurfaces)
sorted_subsurfaces.each do |sub_surface|
- next if sub_surface.subSurfaceType != 'Door'
+ next if sub_surface.subSurfaceType != EPlus::SubSurfaceTypeDoor
surface = sub_surface.surface.get
@@ -5450,7 +5445,7 @@ def self.set_foundations(hpxml_bldg, args)
def self.set_heating_systems(hpxml_bldg, args)
heating_system_type = args[:heating_system_type]
- return if heating_system_type == 'none'
+ return if heating_system_type == Constants::None
if [HPXML::HVACTypeElectricResistance].include? heating_system_type
args[:heating_system_fuel] = HPXML::FuelTypeElectricity
@@ -5524,7 +5519,7 @@ def self.set_heating_systems(hpxml_bldg, args)
def self.set_cooling_systems(hpxml_bldg, args)
cooling_system_type = args[:cooling_system_type]
- return if cooling_system_type == 'none'
+ return if cooling_system_type == Constants::None
if [HPXML::HVACTypeCentralAirConditioner, HPXML::HVACTypeMiniSplitAirConditioner].include? cooling_system_type
compressor_type = args[:cooling_system_cooling_compressor_type]
@@ -5643,7 +5638,7 @@ def self.set_cooling_systems(hpxml_bldg, args)
def self.set_heat_pumps(hpxml_bldg, args)
heat_pump_type = args[:heat_pump_type]
- return if heat_pump_type == 'none'
+ return if heat_pump_type == Constants::None
if args[:heat_pump_backup_type] == HPXML::HeatPumpBackupTypeIntegrated
backup_type = args[:heat_pump_backup_type]
@@ -5656,7 +5651,7 @@ def self.set_heat_pumps(hpxml_bldg, args)
backup_heating_efficiency_afue = args[:heat_pump_backup_heating_efficiency]
end
elsif args[:heat_pump_backup_type] == HPXML::HeatPumpBackupTypeSeparate
- if args[:heating_system_2_type] == 'none'
+ if args[:heating_system_2_type] == Constants::None
fail "Heat pump backup type specified as '#{args[:heat_pump_backup_type]}' but no heating system provided."
end
@@ -5831,7 +5826,7 @@ def self.set_heat_pumps(hpxml_bldg, args)
# @return [nil]
def self.set_geothermal_loop(hpxml_bldg, args)
return if hpxml_bldg.heat_pumps.select { |hp| hp.heat_pump_type == HPXML::HVACTypeHeatPumpGroundToAir }.size == 0
- return if args[:geothermal_loop_configuration].nil? || args[:geothermal_loop_configuration] == 'none'
+ return if args[:geothermal_loop_configuration].nil? || args[:geothermal_loop_configuration] == Constants::None
if not args[:geothermal_loop_pipe_diameter].nil?
pipe_diameter = args[:geothermal_loop_pipe_diameter]
@@ -5870,9 +5865,9 @@ def self.set_geothermal_loop(hpxml_bldg, args)
# @return [nil]
def self.set_secondary_heating_systems(hpxml_bldg, args)
heating_system_type = args[:heating_system_2_type]
- heating_system_is_heatpump_backup = (args[:heat_pump_type] != 'none' && args[:heat_pump_backup_type] == HPXML::HeatPumpBackupTypeSeparate)
+ heating_system_is_heatpump_backup = (args[:heat_pump_type] != Constants::None && args[:heat_pump_backup_type] == HPXML::HeatPumpBackupTypeSeparate)
- return if heating_system_type == 'none' && (not heating_system_is_heatpump_backup)
+ return if heating_system_type == Constants::None && (not heating_system_is_heatpump_backup)
if args[:heating_system_2_fuel] == HPXML::HVACTypeElectricResistance
args[:heating_system_2_fuel] = HPXML::FuelTypeElectricity
@@ -6198,7 +6193,7 @@ def self.set_ducts(hpxml_bldg, args, hvac_distribution)
# @param weather [WeatherFile] Weather object containing EPW information
# @return [nil]
def self.set_hvac_control(hpxml, hpxml_bldg, args, weather)
- return if (args[:heating_system_type] == 'none') && (args[:cooling_system_type] == 'none') && (args[:heat_pump_type] == 'none')
+ return if (args[:heating_system_type] == Constants::None) && (args[:cooling_system_type] == Constants::None) && (args[:heat_pump_type] == Constants::None)
latitude = HPXMLDefaults.get_default_latitude(args[:site_latitude], weather) unless weather.nil?
@@ -6216,12 +6211,12 @@ def self.set_hvac_control(hpxml, hpxml_bldg, args, weather)
if not args[:hvac_control_heating_season_period].nil?
hvac_control_heating_season_period = args[:hvac_control_heating_season_period]
- if hvac_control_heating_season_period == HPXML::BuildingAmerica
+ if hvac_control_heating_season_period == Constants::BuildingAmerica
heating_months, _cooling_months = HVAC.get_default_heating_and_cooling_seasons(weather, latitude)
sim_calendar_year = Location.get_sim_calendar_year(hpxml.header.sim_calendar_year, weather)
- begin_month, begin_day, end_month, end_day = Schedule.get_begin_and_end_dates_from_monthly_array(heating_months, sim_calendar_year)
+ begin_month, begin_day, end_month, end_day = Calendar.get_begin_and_end_dates_from_monthly_array(heating_months, sim_calendar_year)
else
- begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Schedule.parse_date_time_range(hvac_control_heating_season_period)
+ begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Calendar.parse_date_time_range(hvac_control_heating_season_period)
end
seasons_heating_begin_month = begin_month
seasons_heating_begin_day = begin_day
@@ -6245,12 +6240,12 @@ def self.set_hvac_control(hpxml, hpxml_bldg, args, weather)
if not args[:hvac_control_cooling_season_period].nil?
hvac_control_cooling_season_period = args[:hvac_control_cooling_season_period]
- if hvac_control_cooling_season_period == HPXML::BuildingAmerica
+ if hvac_control_cooling_season_period == Constants::BuildingAmerica
_heating_months, cooling_months = HVAC.get_default_heating_and_cooling_seasons(weather, latitude)
sim_calendar_year = Location.get_sim_calendar_year(hpxml.header.sim_calendar_year, weather)
- begin_month, begin_day, end_month, end_day = Schedule.get_begin_and_end_dates_from_monthly_array(cooling_months, sim_calendar_year)
+ begin_month, begin_day, end_month, end_day = Calendar.get_begin_and_end_dates_from_monthly_array(cooling_months, sim_calendar_year)
else
- begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Schedule.parse_date_time_range(hvac_control_cooling_season_period)
+ begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Calendar.parse_date_time_range(hvac_control_cooling_season_period)
end
seasons_cooling_begin_month = begin_month
seasons_cooling_begin_day = begin_day
@@ -6299,7 +6294,7 @@ def self.set_hvac_control(hpxml, hpxml_bldg, args, weather)
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_ventilation_fans(hpxml_bldg, args)
- if args[:mech_vent_fan_type] != 'none'
+ if args[:mech_vent_fan_type] != Constants::None
if [HPXML::MechVentTypeERV].include?(args[:mech_vent_fan_type])
if args[:mech_vent_recovery_efficiency_type] == 'Unadjusted'
@@ -6363,7 +6358,7 @@ def self.set_ventilation_fans(hpxml_bldg, args)
precooling_fraction_load_served: precooling_fraction_load_served)
end
- if args[:mech_vent_2_fan_type] != 'none'
+ if args[:mech_vent_2_fan_type] != Constants::None
if [HPXML::MechVentTypeERV].include?(args[:mech_vent_2_fan_type])
@@ -6442,7 +6437,7 @@ def self.set_ventilation_fans(hpxml_bldg, args)
# @return [nil]
def self.set_water_heating_systems(hpxml_bldg, args)
water_heater_type = args[:water_heater_type]
- return if water_heater_type == 'none'
+ return if water_heater_type == Constants::None
if water_heater_type == HPXML::WaterHeaterTypeHeatPump
args[:water_heater_fuel_type] = HPXML::FuelTypeElectricity
@@ -6559,9 +6554,9 @@ def self.set_water_heating_systems(hpxml_bldg, args)
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_hot_water_distribution(hpxml_bldg, args)
- return if args[:water_heater_type] == 'none'
+ return if args[:water_heater_type] == Constants::None
- if args[:dwhr_facilities_connected] != 'none'
+ if args[:dwhr_facilities_connected] != Constants::None
dwhr_facilities_connected = args[:dwhr_facilities_connected]
dwhr_equal_flow = args[:dwhr_equal_flow]
dwhr_efficiency = args[:dwhr_efficiency]
@@ -6597,7 +6592,7 @@ def self.set_hot_water_distribution(hpxml_bldg, args)
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_water_fixtures(hpxml_bldg, args)
- return if args[:water_heater_type] == 'none'
+ return if args[:water_heater_type] == Constants::None
hpxml_bldg.water_fixtures.add(id: "WaterFixture#{hpxml_bldg.water_fixtures.size + 1}",
water_fixture_type: HPXML::WaterFixtureTypeShowerhead,
@@ -6621,7 +6616,7 @@ def self.set_water_fixtures(hpxml_bldg, args)
# @param weather [WeatherFile] Weather object containing EPW information
# @return [nil]
def self.set_solar_thermal(hpxml_bldg, args, weather)
- return if args[:solar_thermal_system_type] == 'none'
+ return if args[:solar_thermal_system_type] == Constants::None
if args[:solar_thermal_solar_fraction] > 0
solar_fraction = args[:solar_thermal_solar_fraction]
@@ -6822,7 +6817,7 @@ def self.set_lighting(hpxml_bldg, args)
hpxml_bldg.lighting.holiday_kwh_per_day = args[:holiday_lighting_daily_kwh]
if not args[:holiday_lighting_period].nil?
- begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Schedule.parse_date_time_range(args[:holiday_lighting_period])
+ begin_month, begin_day, _begin_hour, end_month, end_day, _end_hour = Calendar.parse_date_time_range(args[:holiday_lighting_period])
hpxml_bldg.lighting.holiday_period_begin_month = begin_month
hpxml_bldg.lighting.holiday_period_begin_day = begin_day
hpxml_bldg.lighting.holiday_period_end_month = end_month
@@ -6841,7 +6836,7 @@ def self.set_lighting(hpxml_bldg, args)
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_dehumidifier(hpxml_bldg, args)
- return if args[:dehumidifier_type] == 'none'
+ return if args[:dehumidifier_type] == Constants::None
if args[:dehumidifier_efficiency_type] == 'EnergyFactor'
energy_factor = args[:dehumidifier_efficiency]
@@ -6872,7 +6867,7 @@ def self.set_dehumidifier(hpxml_bldg, args)
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_clothes_washer(hpxml_bldg, args)
- return if args[:water_heater_type] == 'none'
+ return if args[:water_heater_type] == Constants::None
return unless args[:clothes_washer_present]
if args[:clothes_washer_efficiency_type] == 'ModifiedEnergyFactor'
@@ -6905,7 +6900,7 @@ def self.set_clothes_washer(hpxml_bldg, args)
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_clothes_dryer(hpxml_bldg, args)
- return if args[:water_heater_type] == 'none'
+ return if args[:water_heater_type] == Constants::None
return unless args[:clothes_washer_present]
return unless args[:clothes_dryer_present]
@@ -6946,7 +6941,7 @@ def self.set_clothes_dryer(hpxml_bldg, args)
# @param args [Hash] Map of :argument_name => value
# @return [nil]
def self.set_dishwasher(hpxml_bldg, args)
- return if args[:water_heater_type] == 'none'
+ return if args[:water_heater_type] == Constants::None
return unless args[:dishwasher_present]
if args[:dishwasher_efficiency_type] == 'RatedAnnualkWh'
diff --git a/BuildResidentialHPXML/measure.xml b/BuildResidentialHPXML/measure.xml
index 7a43c02a40..27dff2580d 100644
--- a/BuildResidentialHPXML/measure.xml
+++ b/BuildResidentialHPXML/measure.xml
@@ -3,8 +3,8 @@
3.1
build_residential_hpxml
a13a8983-2b01-4930-8af2-42030b6e4233
- c97d3318-e2a9-46bc-b476-17509ea82a22
- 2024-08-21T17:55:23Z
+ 85f5790a-07a6-4ceb-829a-7738e682fa6f
+ 2024-08-21T17:13:24Z
2C38F48B
BuildResidentialHPXML
HPXML Builder
@@ -7406,19 +7406,25 @@
measure.rb
rb
script
- 3E87E8F5
+ E52B375E
+
+
+ constants.rb
+ rb
+ resource
+ 079FF429
geometry.rb
rb
resource
- 7FDF7979
+ C62D3E76
test_build_residential_hpxml.rb
rb
test
- 4924B90F
+ BC30D013
diff --git a/BuildResidentialHPXML/resources/constants.rb b/BuildResidentialHPXML/resources/constants.rb
new file mode 100644
index 0000000000..639a49592e
--- /dev/null
+++ b/BuildResidentialHPXML/resources/constants.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+# Collection of constants.
+module Constants
+ BuildingAmerica = 'BuildingAmerica'
+ FacadeFront = 'front'
+ FacadeBack = 'back'
+ FacadeLeft = 'left'
+ FacadeRight = 'right'
+ FacadeNone = 'none'
+ LocationInterior = 'interior'
+ LocationExterior = 'exterior'
+ None = 'none'
+ PositionRight = 'Right'
+ PositionLeft = 'Left'
+ RoofTypeGable = 'gable'
+ RoofTypeHip = 'hip'
+end
diff --git a/BuildResidentialHPXML/resources/geometry.rb b/BuildResidentialHPXML/resources/geometry.rb
index 3231e51cbd..c68c7f5764 100644
--- a/BuildResidentialHPXML/resources/geometry.rb
+++ b/BuildResidentialHPXML/resources/geometry.rb
@@ -120,13 +120,13 @@ def self.create_single_family_detached(runner:,
garage_zone.setName(garage_space_name)
# make points and polygons
- if garage_position == 'Right'
+ if garage_position == Constants::PositionRight
garage_sw_point = OpenStudio::Point3d.new(length - garage_width, -garage_protrusion * garage_depth, z)
garage_nw_point = OpenStudio::Point3d.new(length - garage_width, garage_depth - garage_protrusion * garage_depth, z)
garage_ne_point = OpenStudio::Point3d.new(length, garage_depth - garage_protrusion * garage_depth, z)
garage_se_point = OpenStudio::Point3d.new(length, -garage_protrusion * garage_depth, z)
garage_polygon = make_polygon(garage_sw_point, garage_nw_point, garage_ne_point, garage_se_point)
- elsif garage_position == 'Left'
+ elsif garage_position == Constants::PositionLeft
garage_sw_point = OpenStudio::Point3d.new(0, -garage_protrusion * garage_depth, z)
garage_nw_point = OpenStudio::Point3d.new(0, garage_depth - garage_protrusion * garage_depth, z)
garage_ne_point = OpenStudio::Point3d.new(garage_width, garage_depth - garage_protrusion * garage_depth, z)
@@ -150,7 +150,7 @@ def self.create_single_family_detached(runner:,
m[2, 3] = z
garage_space.changeTransformation(OpenStudio::Transformation.new(m))
- if garage_position == 'Right'
+ if garage_position == Constants::PositionRight
sw_point = OpenStudio::Point3d.new(0, 0, z)
nw_point = OpenStudio::Point3d.new(0, width, z)
ne_point = OpenStudio::Point3d.new(length, width, z)
@@ -163,7 +163,7 @@ def self.create_single_family_detached(runner:,
else # garage fully protrudes
conditioned_polygon = make_polygon(sw_point, nw_point, ne_point, se_point)
end
- elsif garage_position == 'Left'
+ elsif garage_position == Constants::PositionLeft
sw_point = OpenStudio::Point3d.new(0, 0, z)
nw_point = OpenStudio::Point3d.new(0, width, z)
ne_point = OpenStudio::Point3d.new(length, width, z)
@@ -185,7 +185,7 @@ def self.create_single_family_detached(runner:,
garage_sw_point = OpenStudio::Point3d.new(garage_sw_point.x, garage_sw_point.y, z)
garage_nw_point = OpenStudio::Point3d.new(garage_nw_point.x, garage_nw_point.y, z)
garage_ne_point = OpenStudio::Point3d.new(garage_ne_point.x, garage_ne_point.y, z)
- if garage_position == 'Right'
+ if garage_position == Constants::PositionRight
sw_point = OpenStudio::Point3d.new(0, 0, z)
nw_point = OpenStudio::Point3d.new(0, width, z)
ne_point = OpenStudio::Point3d.new(length, width, z)
@@ -196,7 +196,7 @@ def self.create_single_family_detached(runner:,
else # garage does not protrude
conditioned_polygon = make_polygon(sw_point, nw_point, ne_point, se_point)
end
- elsif garage_position == 'Left'
+ elsif garage_position == Constants::PositionLeft
sw_point = OpenStudio::Point3d.new(0, 0, z)
nw_point = OpenStudio::Point3d.new(0, width, z)
ne_point = OpenStudio::Point3d.new(length, width, z)
@@ -268,7 +268,7 @@ def self.create_single_family_detached(runner:,
# make polygons
polygon_floor = make_polygon(roof_nw_point, roof_ne_point, roof_se_point, roof_sw_point)
side_type = nil
- if roof_type == 'gable'
+ if roof_type == Constants::RoofTypeGable
if length >= width
roof_w_point = OpenStudio::Point3d.new(0, width / 2.0, z + attic_height)
roof_e_point = OpenStudio::Point3d.new(length, width / 2.0, z + attic_height)
@@ -284,8 +284,8 @@ def self.create_single_family_detached(runner:,
polygon_w_wall = make_polygon(roof_w_point, roof_sw_point, roof_se_point)
polygon_e_wall = make_polygon(roof_e_point, roof_ne_point, roof_nw_point)
end
- side_type = 'Wall'
- elsif roof_type == 'hip'
+ side_type = EPlus::SurfaceTypeWall
+ elsif roof_type == Constants::RoofTypeHip
if length >= width
roof_w_point = OpenStudio::Point3d.new(width / 2.0, width / 2.0, z + attic_height)
roof_e_point = OpenStudio::Point3d.new(length - width / 2.0, width / 2.0, z + attic_height)
@@ -301,25 +301,25 @@ def self.create_single_family_detached(runner:,
polygon_w_wall = make_polygon(roof_w_point, roof_sw_point, roof_se_point)
polygon_e_wall = make_polygon(roof_e_point, roof_ne_point, roof_nw_point)
end
- side_type = 'RoofCeiling'
+ side_type = EPlus::SurfaceTypeRoofCeiling
end
# make surfaces
surface_floor = create_surface(polygon: polygon_floor, model: model)
- surface_floor.setSurfaceType('Floor')
- surface_floor.setOutsideBoundaryCondition('Surface')
+ surface_floor.setSurfaceType(EPlus::SurfaceTypeFloor)
+ surface_floor.setOutsideBoundaryCondition(EPlus::BoundaryConditionSurface)
surface_n_roof = create_surface(polygon: polygon_n_roof, model: model)
- surface_n_roof.setSurfaceType('RoofCeiling')
- surface_n_roof.setOutsideBoundaryCondition('Outdoors')
+ surface_n_roof.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
+ surface_n_roof.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
surface_e_wall = create_surface(polygon: polygon_e_wall, model: model)
surface_e_wall.setSurfaceType(side_type)
- surface_e_wall.setOutsideBoundaryCondition('Outdoors')
+ surface_e_wall.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
surface_s_roof = create_surface(polygon: polygon_s_roof, model: model)
- surface_s_roof.setSurfaceType('RoofCeiling')
- surface_s_roof.setOutsideBoundaryCondition('Outdoors')
+ surface_s_roof.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
+ surface_s_roof.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
surface_w_wall = create_surface(polygon: polygon_w_wall, model: model)
surface_w_wall.setSurfaceType(side_type)
- surface_w_wall.setOutsideBoundaryCondition('Outdoors')
+ surface_w_wall.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
# assign surfaces to the space
attic_space = create_space(model: model)
@@ -410,9 +410,9 @@ def self.create_single_family_detached(runner:,
surfaces = space.surfaces
surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'wall'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
- surface.setOutsideBoundaryCondition('Ground')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionGround)
end
end
@@ -441,7 +441,7 @@ def self.create_single_family_detached(runner:,
space_with_roof_over_garage = garage_space
end
space_with_roof_over_garage.surfaces.each do |surface|
- next unless (surface.surfaceType.downcase == 'roofceiling') && (surface.outsideBoundaryCondition.downcase == 'outdoors')
+ next unless (surface.surfaceType == EPlus::SurfaceTypeRoofCeiling) && (surface.outsideBoundaryCondition == EPlus::BoundaryConditionOutdoors)
n_points = []
s_points = []
@@ -488,7 +488,7 @@ def self.create_single_family_detached(runner:,
end
if num_floors == 1
- if not attic_type == HPXML::AtticTypeConditioned
+ if attic_type != HPXML::AtticTypeConditioned
roof_n_point = OpenStudio::Point3d.new((nw_point.x + ne_point.x) / 2, nw_point.y + garage_attic_height / roof_pitch, conditioned_space.zOrigin + average_ceiling_height + garage_attic_height)
roof_s_point = OpenStudio::Point3d.new((sw_point.x + se_point.x) / 2, sw_point.y, conditioned_space.zOrigin + average_ceiling_height + garage_attic_height)
else
@@ -506,16 +506,16 @@ def self.create_single_family_detached(runner:,
polygon_s_wall = make_polygon(sw_point, se_point, roof_s_point)
wall_n = create_surface(polygon: polygon_n_wall, model: model)
- wall_n.setSurfaceType('Wall')
+ wall_n.setSurfaceType(EPlus::SurfaceTypeWall)
deck_e = create_surface(polygon: polygon_e_roof, model: model)
- deck_e.setSurfaceType('RoofCeiling')
- deck_e.setOutsideBoundaryCondition('Outdoors')
+ deck_e.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
+ deck_e.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
wall_s = create_surface(polygon: polygon_s_wall, model: model)
- wall_s.setSurfaceType('Wall')
- wall_s.setOutsideBoundaryCondition('Outdoors')
+ wall_s.setSurfaceType(EPlus::SurfaceTypeWall)
+ wall_s.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
deck_w = create_surface(polygon: polygon_w_roof, model: model)
- deck_w.setSurfaceType('RoofCeiling')
- deck_w.setOutsideBoundaryCondition('Outdoors')
+ deck_w.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
+ deck_w.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
garage_attic_space = create_space(model: model)
deck_w.setSpace(garage_attic_space)
@@ -556,7 +556,7 @@ def self.create_single_family_detached(runner:,
# remove triangular surface between unconditioned attic and garage attic
unless attic_space.nil?
attic_space.surfaces.each do |surface|
- next if roof_type == 'hip'
+ next if roof_type == Constants::RoofTypeHip
next unless surface.vertices.length == 3
next unless (90 - surface.tilt * 180 / Math::PI).abs > 0.01 # don't remove the vertical attic walls
next unless surface.adjacentSurface.is_initialized
@@ -580,10 +580,10 @@ def self.create_single_family_detached(runner:,
# remove other unused surfaces
# TODO: remove this once geometry methods are fixed in openstudio 3.x
attic_space.surfaces.each do |surface1|
- next if surface1.surfaceType != 'RoofCeiling'
+ next if surface1.surfaceType != EPlus::SurfaceTypeRoofCeiling
attic_space.surfaces.each do |surface2|
- next if surface2.surfaceType != 'RoofCeiling'
+ next if surface2.surfaceType != EPlus::SurfaceTypeRoofCeiling
next if surface1 == surface2
if has_same_vertices(surface1: surface1, surface2: surface2)
@@ -601,19 +601,19 @@ def self.create_single_family_detached(runner:,
# set foundation outside boundary condition to Kiva "foundation"
model.getSurfaces.each do |surface|
- if surface.outsideBoundaryCondition.downcase == 'ground'
- surface.setOutsideBoundaryCondition('Foundation') if foundation_type != HPXML::FoundationTypeAmbient
- surface.setOutsideBoundaryCondition('Outdoors') if foundation_type == HPXML::FoundationTypeAmbient
+ if surface.outsideBoundaryCondition == EPlus::BoundaryConditionGround
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionFoundation) if foundation_type != HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors) if foundation_type == HPXML::FoundationTypeAmbient
elsif (UnitConversions.convert(rim_joist_height, 'm', 'ft') - get_surface_height(surface: surface)).abs < 0.001
- next if surface.surfaceType.downcase != 'wall'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
garage_spaces.each do |garage_space|
garage_space.surfaces.each do |garage_surface|
- next if garage_surface.surfaceType.downcase != 'floor'
+ next if garage_surface.surfaceType != EPlus::SurfaceTypeFloor
if get_walls_connected_to_floor(wall_surfaces: [surface], floor_surface: garage_surface, same_space: false).include? surface
- surface.setOutsideBoundaryCondition('Foundation') if foundation_type != HPXML::FoundationTypeAmbient
- surface.setOutsideBoundaryCondition('Outdoors') if foundation_type == HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionFoundation) if foundation_type != HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors) if foundation_type == HPXML::FoundationTypeAmbient
end
end
end
@@ -623,19 +623,19 @@ def self.create_single_family_detached(runner:,
# set foundation walls adjacent to garage to adiabatic
foundation_walls = []
model.getSurfaces.each do |surface|
- next if surface.surfaceType.downcase != 'wall'
- next if surface.outsideBoundaryCondition.downcase != 'foundation'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
+ next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionFoundation
foundation_walls << surface
end
garage_spaces.each do |garage_space|
garage_space.surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'floor'
+ next if surface.surfaceType != EPlus::SurfaceTypeFloor
adjacent_wall_surfaces = get_walls_connected_to_floor(wall_surfaces: foundation_walls, floor_surface: surface, same_space: false)
adjacent_wall_surfaces.each do |adjacent_wall_surface|
- adjacent_wall_surface.setOutsideBoundaryCondition('Adiabatic')
+ adjacent_wall_surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
end
end
end
@@ -749,14 +749,14 @@ def self.create_single_family_attached(model:,
conditioned_space.setThermalZone(conditioned_zone)
# Adiabatic surfaces for walls
- adb_facade_hash = { 'left' => adiabatic_left_wall, 'right' => adiabatic_right_wall, 'front' => adiabatic_front_wall, 'back' => adiabatic_back_wall }
+ adb_facade_hash = { Constants::FacadeLeft => adiabatic_left_wall, Constants::FacadeRight => adiabatic_right_wall, Constants::FacadeFront => adiabatic_front_wall, Constants::FacadeBack => adiabatic_back_wall }
adb_facades = adb_facade_hash.select { |_, v| v == true }.keys
# Make surfaces adiabatic
model.getSpaces.each do |space|
space.surfaces.each do |surface|
os_facade = get_facade_for_surface(surface: surface)
- next unless surface.surfaceType == 'Wall'
+ next unless surface.surfaceType == EPlus::SurfaceTypeWall
next unless adb_facades.include? os_facade
x_ft = UnitConversions.convert(x, 'm', 'ft')
@@ -764,7 +764,7 @@ def self.create_single_family_attached(model:,
min_x = get_surface_x_values(surfaceArray: [surface]).min
next if ((max_x - x_ft).abs >= 0.01) && (min_x > 0)
- surface.setOutsideBoundaryCondition('Adiabatic')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
end
end
@@ -856,16 +856,16 @@ def self.create_single_family_attached(model:,
surfaces = space.surfaces
surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'wall'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
os_facade = get_facade_for_surface(surface: surface)
if adb_facades.include? os_facade
- surface.setOutsideBoundaryCondition('Adiabatic')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
elsif get_surface_z_values(surfaceArray: [surface]).min < 0
- surface.setOutsideBoundaryCondition('Foundation') if foundation_type != HPXML::FoundationTypeAmbient
- surface.setOutsideBoundaryCondition('Outdoors') if foundation_type == HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionFoundation) if foundation_type != HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors) if foundation_type == HPXML::FoundationTypeAmbient
else
- surface.setOutsideBoundaryCondition('Outdoors')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
end
end
end
@@ -910,7 +910,7 @@ def self.create_single_family_attached(model:,
if [HPXML::AtticTypeVented, HPXML::AtticTypeUnvented, HPXML::AtticTypeConditioned].include? attic_type
attic_space.surfaces.each do |surface|
os_facade = get_facade_for_surface(surface: surface)
- next unless surface.surfaceType == 'Wall'
+ next unless surface.surfaceType == EPlus::SurfaceTypeWall
next unless adb_facades.include? os_facade
x_ft = UnitConversions.convert(x, 'm', 'ft')
@@ -918,7 +918,7 @@ def self.create_single_family_attached(model:,
min_x = get_surface_x_values(surfaceArray: [surface]).min
next if ((max_x - x_ft).abs >= 0.01) && (min_x > 0)
- surface.setOutsideBoundaryCondition('Adiabatic')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
end
end
@@ -934,10 +934,10 @@ def self.create_single_family_attached(model:,
# set foundation outside boundary condition to Kiva "foundation"
model.getSurfaces.each do |surface|
- next if surface.outsideBoundaryCondition.downcase != 'ground'
+ next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionGround
- surface.setOutsideBoundaryCondition('Foundation') if foundation_type != HPXML::FoundationTypeAmbient
- surface.setOutsideBoundaryCondition('Outdoors') if foundation_type == HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionFoundation) if foundation_type != HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors) if foundation_type == HPXML::FoundationTypeAmbient
end
assign_remaining_surface_indexes(model: model)
@@ -1049,34 +1049,34 @@ def self.create_apartment(model:,
conditioned_space.setThermalZone(conditioned_zone)
# Map surface facades to adiabatic walls
- adb_facade_hash = { 'left' => adiabatic_left_wall, 'right' => adiabatic_right_wall, 'front' => adiabatic_front_wall, 'back' => adiabatic_back_wall }
+ adb_facade_hash = { Constants::FacadeLeft => adiabatic_left_wall, Constants::FacadeRight => adiabatic_right_wall, Constants::FacadeFront => adiabatic_front_wall, Constants::FacadeBack => adiabatic_back_wall }
adb_facades = adb_facade_hash.select { |_, v| v == true }.keys
# Adiabatic floor/ceiling
adb_levels = []
if attic_type == HPXML::LocationOtherHousingUnit
- adb_levels += ['RoofCeiling']
+ adb_levels += [EPlus::SurfaceTypeRoofCeiling]
end
if foundation_type == HPXML::LocationOtherHousingUnit
- adb_levels += ['Floor']
+ adb_levels += [EPlus::SurfaceTypeFloor]
end
# Make conditioned space surfaces adiabatic
model.getSpaces.each do |space|
space.surfaces.each do |surface|
os_facade = get_facade_for_surface(surface: surface)
- if surface.surfaceType == 'Wall'
+ if surface.surfaceType == EPlus::SurfaceTypeWall
if adb_facades.include? os_facade
x_ft = UnitConversions.convert(x, 'm', 'ft')
max_x = get_surface_x_values(surfaceArray: [surface]).max
min_x = get_surface_x_values(surfaceArray: [surface]).min
next if ((max_x - x_ft).abs >= 0.01) && (min_x > 0)
- surface.setOutsideBoundaryCondition('Adiabatic')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
end
else
if (adb_levels.include? surface.surfaceType)
- surface.setOutsideBoundaryCondition('Adiabatic')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
end
end
end
@@ -1147,16 +1147,16 @@ def self.create_apartment(model:,
surfaces = space.surfaces
surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'wall' # skip if not a wall surface
+ next unless surface.surfaceType == EPlus::SurfaceTypeWall
os_facade = get_facade_for_surface(surface: surface)
- if adb_facades.include?(os_facade)
- surface.setOutsideBoundaryCondition('Adiabatic')
+ if adb_facades.include?(os_facade) && (os_facade != EPlus::SurfaceTypeRoofCeiling) && (os_facade != EPlus::SurfaceTypeFloor)
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
elsif get_surface_z_values(surfaceArray: [surface]).min < 0
- surface.setOutsideBoundaryCondition('Foundation') if foundation_type != HPXML::FoundationTypeAmbient
- surface.setOutsideBoundaryCondition('Outdoors') if foundation_type == HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionFoundation) if foundation_type != HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors) if foundation_type == HPXML::FoundationTypeAmbient
else
- surface.setOutsideBoundaryCondition('Outdoors')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
end
end
end
@@ -1198,7 +1198,7 @@ def self.create_apartment(model:,
# Adiabatic surfaces for attic walls
attic_space.surfaces.each do |surface|
os_facade = get_facade_for_surface(surface: surface)
- next unless surface.surfaceType == 'Wall'
+ next unless surface.surfaceType == EPlus::SurfaceTypeWall
next unless adb_facades.include? os_facade
x_ft = UnitConversions.convert(x, 'm', 'ft')
@@ -1206,7 +1206,7 @@ def self.create_apartment(model:,
min_x = get_surface_x_values(surfaceArray: [surface]).min
next if ((max_x - x_ft).abs >= 0.01) && (min_x > 0)
- surface.setOutsideBoundaryCondition('Adiabatic')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
end
end
@@ -1222,10 +1222,10 @@ def self.create_apartment(model:,
# set foundation outside boundary condition to Kiva "foundation"
model.getSurfaces.each do |surface|
- next if surface.outsideBoundaryCondition.downcase != 'ground'
+ next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionGround
- surface.setOutsideBoundaryCondition('Foundation') if foundation_type != HPXML::FoundationTypeAmbient
- surface.setOutsideBoundaryCondition('Outdoors') if foundation_type == HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionFoundation) if foundation_type != HPXML::FoundationTypeAmbient
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors) if foundation_type == HPXML::FoundationTypeAmbient
end
assign_remaining_surface_indexes(model: model)
@@ -1256,7 +1256,7 @@ def self.create_doors(runner:,
door_offset = 0.5 # ft
# Get all exterior walls prioritized by front, then back, then left, then right
- facades = [Constants.FacadeFront, Constants.FacadeBack]
+ facades = [Constants::FacadeFront, Constants::FacadeBack]
avail_walls = []
facades.each do |_facade|
sorted_spaces = model.getSpaces.sort_by { |s| s.additionalProperties.getFeatureAsInteger('Index').get }
@@ -1265,8 +1265,8 @@ def self.create_doors(runner:,
sorted_surfaces = space.surfaces.sort_by { |s| s.additionalProperties.getFeatureAsInteger('Index').get }
sorted_surfaces.each do |surface|
- next unless get_facade_for_surface(surface: surface) == Constants.FacadeFront
- next unless (surface.outsideBoundaryCondition.downcase == 'outdoors') || (surface.outsideBoundaryCondition.downcase == 'adiabatic')
+ next unless get_facade_for_surface(surface: surface) == Constants::FacadeFront
+ next unless (surface.outsideBoundaryCondition == EPlus::BoundaryConditionOutdoors) || (surface.outsideBoundaryCondition == EPlus::BoundaryConditionAdiabatic)
next if (90 - surface.tilt * 180 / Math::PI).abs > 0.01 # Not a vertical wall
avail_walls << surface
@@ -1312,7 +1312,7 @@ def self.create_doors(runner:,
num_existing_doors_on_this_surface = 0
min_story_avail_wall.subSurfaces.each do |sub_surface|
- if sub_surface.subSurfaceType.downcase == 'door'
+ if sub_surface.subSurfaceType == EPlus::SubSurfaceTypeDoor
num_existing_doors_on_this_surface += 1
end
end
@@ -1326,20 +1326,20 @@ def self.create_doors(runner:,
# Convert to 3D geometry; assign to surface
door_polygon = OpenStudio::Point3dVector.new
- if facade == Constants.FacadeFront
+ if facade == Constants::FacadeFront
multx = 1
multy = 0
- elsif facade == Constants.FacadeBack
+ elsif facade == Constants::FacadeBack
multx = -1
multy = 0
- elsif facade == Constants.FacadeLeft
+ elsif facade == Constants::FacadeLeft
multx = 0
multy = -1
- elsif facade == Constants.FacadeRight
+ elsif facade == Constants::FacadeRight
multx = 0
multy = 1
end
- if (facade == Constants.FacadeBack) || (facade == Constants.FacadeLeft)
+ if (facade == Constants::FacadeBack) || (facade == Constants::FacadeLeft)
leftx = get_surface_x_values(surfaceArray: [min_story_avail_wall]).max
lefty = get_surface_y_values(surfaceArray: [min_story_avail_wall]).max
else
@@ -1359,7 +1359,7 @@ def self.create_doors(runner:,
door_sub_surface = create_sub_surface(polygon: door_polygon, model: model)
door_sub_surface.setName("#{min_story_avail_wall.name} - Door")
door_sub_surface.setSurface(min_story_avail_wall)
- door_sub_surface.setSubSurfaceType('Door')
+ door_sub_surface.setSubSurfaceType(EPlus::SubSurfaceTypeDoor)
break
end
@@ -1405,38 +1405,38 @@ def self.create_windows_and_skylights(runner:,
skylight_area_left:,
skylight_area_right:,
**)
- facades = [Constants.FacadeBack, Constants.FacadeRight, Constants.FacadeFront, Constants.FacadeLeft]
+ facades = [Constants::FacadeBack, Constants::FacadeRight, Constants::FacadeFront, Constants::FacadeLeft]
wwrs = {}
- wwrs[Constants.FacadeBack] = window_back_wwr
- wwrs[Constants.FacadeRight] = window_right_wwr
- wwrs[Constants.FacadeFront] = window_front_wwr
- wwrs[Constants.FacadeLeft] = window_left_wwr
+ wwrs[Constants::FacadeBack] = window_back_wwr
+ wwrs[Constants::FacadeRight] = window_right_wwr
+ wwrs[Constants::FacadeFront] = window_front_wwr
+ wwrs[Constants::FacadeLeft] = window_left_wwr
window_areas = {}
- window_areas[Constants.FacadeBack] = window_area_back
- window_areas[Constants.FacadeRight] = window_area_right
- window_areas[Constants.FacadeFront] = window_area_front
- window_areas[Constants.FacadeLeft] = window_area_left
+ window_areas[Constants::FacadeBack] = window_area_back
+ window_areas[Constants::FacadeRight] = window_area_right
+ window_areas[Constants::FacadeFront] = window_area_front
+ window_areas[Constants::FacadeLeft] = window_area_left
skylight_areas = {}
- skylight_areas[Constants.FacadeBack] = skylight_area_back
- skylight_areas[Constants.FacadeRight] = skylight_area_right
- skylight_areas[Constants.FacadeFront] = skylight_area_front
- skylight_areas[Constants.FacadeLeft] = skylight_area_left
- skylight_areas['none'] = 0
+ skylight_areas[Constants::FacadeBack] = skylight_area_back
+ skylight_areas[Constants::FacadeRight] = skylight_area_right
+ skylight_areas[Constants::FacadeFront] = skylight_area_front
+ skylight_areas[Constants::FacadeLeft] = skylight_area_left
+ skylight_areas[Constants::FacadeNone] = 0
# Store surfaces that should get windows by facade
- wall_surfaces = { Constants.FacadeFront => [], Constants.FacadeBack => [],
- Constants.FacadeLeft => [], Constants.FacadeRight => [] }
- roof_surfaces = { Constants.FacadeFront => [], Constants.FacadeBack => [],
- Constants.FacadeLeft => [], Constants.FacadeRight => [],
- 'none' => [] }
+ wall_surfaces = { Constants::FacadeFront => [], Constants::FacadeBack => [],
+ Constants::FacadeLeft => [], Constants::FacadeRight => [] }
+ roof_surfaces = { Constants::FacadeFront => [], Constants::FacadeBack => [],
+ Constants::FacadeLeft => [], Constants::FacadeRight => [],
+ Constants::FacadeNone => [] }
sorted_spaces = model.getSpaces.sort_by { |s| s.additionalProperties.getFeatureAsInteger('Index').get }
get_conditioned_spaces(spaces: sorted_spaces).each do |space|
sorted_surfaces = space.surfaces.sort_by { |s| s.additionalProperties.getFeatureAsInteger('Index').get }
sorted_surfaces.each do |surface|
- next unless (surface.surfaceType.downcase == 'wall') && (surface.outsideBoundaryCondition.downcase == 'outdoors')
+ next unless (surface.surfaceType == EPlus::SurfaceTypeWall) && (surface.outsideBoundaryCondition == EPlus::BoundaryConditionOutdoors)
next if (90 - surface.tilt * 180 / Math::PI).abs > 0.01 # Not a vertical wall
facade = get_facade_for_surface(surface: surface)
@@ -1448,12 +1448,12 @@ def self.create_windows_and_skylights(runner:,
sorted_spaces.each do |space|
sorted_surfaces = space.surfaces.sort_by { |s| s.additionalProperties.getFeatureAsInteger('Index').get }
sorted_surfaces.each do |surface|
- next unless (surface.surfaceType.downcase == 'roofceiling') && (surface.outsideBoundaryCondition.downcase == 'outdoors')
+ next unless (surface.surfaceType == EPlus::SurfaceTypeRoofCeiling) && (surface.outsideBoundaryCondition == EPlus::BoundaryConditionOutdoors)
facade = get_facade_for_surface(surface: surface)
if facade.nil?
if surface.tilt == 0 # flat roof
- roof_surfaces['none'] << surface
+ roof_surfaces[Constants::FacadeNone] << surface
end
next
end
@@ -1566,13 +1566,13 @@ def self.create_windows_and_skylights(runner:,
end
# Skylights
- unless roof_surfaces['none'].empty?
+ unless roof_surfaces[Constants::FacadeNone].empty?
tot_sky_area = 0
skylight_areas.each do |facade, skylight_area|
- next if facade == 'none'
+ next if facade == Constants::FacadeNone
- skylight_area /= roof_surfaces['none'].length
- skylight_areas['none'] += skylight_area
+ skylight_area /= roof_surfaces[Constants::FacadeNone].length
+ skylight_areas[Constants::FacadeNone] += skylight_area
skylight_areas[facade] = 0
end
end
@@ -1583,7 +1583,7 @@ def self.create_windows_and_skylights(runner:,
surfaces = roof_surfaces[facade]
- if surfaces.empty? && (not facade == 'none')
+ if surfaces.empty? && (facade != Constants::FacadeNone)
runner.registerError("There are no #{facade} roof surfaces, but #{skylight_area} ft^2 of skylights were specified.")
return false
end
@@ -1602,19 +1602,19 @@ def self.create_windows_and_skylights(runner:,
leftx = skylight_bottom_left.x
lefty = skylight_bottom_left.y
bottomz = skylight_bottom_left.z
- if (facade == Constants.FacadeFront) || (facade == 'none')
+ if (facade == Constants::FacadeFront) || (facade == Constants::FacadeNone)
skylight_top_left = OpenStudio::Point3d.new(leftx, lefty + Math.cos(surface.tilt) * skylight_length, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_top_right = OpenStudio::Point3d.new(leftx + skylight_width, lefty + Math.cos(surface.tilt) * skylight_length, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_bottom_right = OpenStudio::Point3d.new(leftx + skylight_width, lefty, bottomz)
- elsif facade == Constants.FacadeBack
+ elsif facade == Constants::FacadeBack
skylight_top_left = OpenStudio::Point3d.new(leftx, lefty - Math.cos(surface.tilt) * skylight_length, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_top_right = OpenStudio::Point3d.new(leftx - skylight_width, lefty - Math.cos(surface.tilt) * skylight_length, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_bottom_right = OpenStudio::Point3d.new(leftx - skylight_width, lefty, bottomz)
- elsif facade == Constants.FacadeLeft
+ elsif facade == Constants::FacadeLeft
skylight_top_left = OpenStudio::Point3d.new(leftx + Math.cos(surface.tilt) * skylight_length, lefty, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_top_right = OpenStudio::Point3d.new(leftx + Math.cos(surface.tilt) * skylight_length, lefty - skylight_width, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_bottom_right = OpenStudio::Point3d.new(leftx, lefty - skylight_width, bottomz)
- elsif facade == Constants.FacadeRight
+ elsif facade == Constants::FacadeRight
skylight_top_left = OpenStudio::Point3d.new(leftx - Math.cos(surface.tilt) * skylight_length, lefty, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_top_right = OpenStudio::Point3d.new(leftx - Math.cos(surface.tilt) * skylight_length, lefty + skylight_width, bottomz + Math.sin(surface.tilt) * skylight_length)
skylight_bottom_right = OpenStudio::Point3d.new(leftx, lefty + skylight_width, bottomz)
@@ -1702,7 +1702,7 @@ def self.calculate_exposed_perimeter(model:,
foundation_space = ground_floor_surface.space.get
wall_surfaces = []
foundation_space.surfaces.each do |surface|
- next if not surface.surfaceType.downcase == 'wall'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
next if surface.adjacentSurface.is_initialized
wall_surfaces << surface
@@ -1718,8 +1718,8 @@ def self.calculate_exposed_perimeter(model:,
# Get bottom edges of exterior walls (building footprint)
surfaces = []
model.getSurfaces.each do |surface|
- next if not surface.surfaceType.downcase == 'wall'
- next if surface.outsideBoundaryCondition.downcase != 'outdoors'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
+ next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors
surfaces << surface
end
@@ -1773,23 +1773,23 @@ def self.get_facade_for_surface(surface:)
facade = nil
if n.z.abs < tol
if (n.x.abs < tol) && ((n.y + 1).abs < tol)
- facade = Constants.FacadeFront
+ facade = Constants::FacadeFront
elsif ((n.x - 1).abs < tol) && (n.y.abs < tol)
- facade = Constants.FacadeRight
+ facade = Constants::FacadeRight
elsif (n.x.abs < tol) && ((n.y - 1).abs < tol)
- facade = Constants.FacadeBack
+ facade = Constants::FacadeBack
elsif ((n.x + 1).abs < tol) && (n.y.abs < tol)
- facade = Constants.FacadeLeft
+ facade = Constants::FacadeLeft
end
else
if (n.x.abs < tol) && (n.y < 0)
- facade = Constants.FacadeFront
+ facade = Constants::FacadeFront
elsif (n.x > 0) && (n.y.abs < tol)
- facade = Constants.FacadeRight
+ facade = Constants::FacadeRight
elsif (n.x.abs < tol) && (n.y > 0)
- facade = Constants.FacadeBack
+ facade = Constants::FacadeBack
elsif (n.x < 0) && (n.y.abs < tol)
- facade = Constants.FacadeLeft
+ facade = Constants::FacadeLeft
end
end
return facade
@@ -1802,13 +1802,13 @@ def self.get_facade_for_surface(surface:)
# @return [Double] the absolute azimuth based on relative azimuth of the facade and building orientation
def self.get_azimuth_from_facade(facade:,
orientation:)
- if facade == Constants.FacadeFront
+ if facade == Constants::FacadeFront
return get_abs_azimuth(relative_azimuth: 0, building_orientation: orientation)
- elsif facade == Constants.FacadeBack
+ elsif facade == Constants::FacadeBack
return get_abs_azimuth(relative_azimuth: 180, building_orientation: orientation)
- elsif facade == Constants.FacadeLeft
+ elsif facade == Constants::FacadeLeft
return get_abs_azimuth(relative_azimuth: 90, building_orientation: orientation)
- elsif facade == Constants.FacadeRight
+ elsif facade == Constants::FacadeRight
return get_abs_azimuth(relative_azimuth: 270, building_orientation: orientation)
else
fail 'Unexpected facade.'
@@ -1822,19 +1822,19 @@ def self.get_azimuth_from_facade(facade:,
# @return [OpenStudio::Model::Surface] the adiabatic adjacent OpenStudio Surface
def self.get_adiabatic_adjacent_surface(model:,
surface:)
- return if surface.outsideBoundaryCondition != 'Adiabatic'
+ return if surface.outsideBoundaryCondition != EPlus::BoundaryConditionAdiabatic
- adjacentSurfaceType = 'Wall'
- if surface.surfaceType == 'RoofCeiling'
- adjacentSurfaceType = 'Floor'
- elsif surface.surfaceType == 'Floor'
- adjacentSurfaceType = 'RoofCeiling'
+ adjacentSurfaceType = EPlus::SurfaceTypeWall
+ if surface.surfaceType == EPlus::SurfaceTypeRoofCeiling
+ adjacentSurfaceType = EPlus::SurfaceTypeFloor
+ elsif surface.surfaceType == EPlus::SurfaceTypeFloor
+ adjacentSurfaceType = EPlus::SurfaceTypeRoofCeiling
end
model.getSurfaces.sort.each do |adjacent_surface|
next if surface == adjacent_surface
next if adjacent_surface.surfaceType != adjacentSurfaceType
- next if adjacent_surface.outsideBoundaryCondition != 'Adiabatic'
+ next if adjacent_surface.outsideBoundaryCondition != EPlus::BoundaryConditionAdiabatic
next unless has_same_vertices(surface1: surface, surface2: adjacent_surface)
return adjacent_surface
@@ -1871,8 +1871,8 @@ def self.get_conditioned_attic_height(spaces:)
get_conditioned_spaces(spaces: spaces).each do |space|
space.surfaces.each do |surface|
next if surface.vertices.size != 3
- next if surface.outsideBoundaryCondition != 'Outdoors'
- next if surface.surfaceType != 'Wall'
+ next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
return get_height_of_spaces(spaces: [space])
end
@@ -1881,8 +1881,8 @@ def self.get_conditioned_attic_height(spaces:)
# hip roof type
get_conditioned_spaces(spaces: spaces).each do |space|
space.surfaces.each do |surface|
- next if surface.outsideBoundaryCondition != 'Outdoors'
- next if surface.surfaceType != 'RoofCeiling'
+ next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors
+ next if surface.surfaceType != EPlus::SurfaceTypeRoofCeiling
return get_height_of_spaces(spaces: [space])
end
@@ -1939,13 +1939,13 @@ def self.add_rim_joist(model:,
assign_indexes(model: model, footprint_polygon: rim_joist_polygon, space: rim_joist_space)
space.surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'roofceiling'
+ next if surface.surfaceType != EPlus::SurfaceTypeRoofCeiling
surface.remove
end
rim_joist_space.surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'floor'
+ next if surface.surfaceType != EPlus::SurfaceTypeFloor
surface.remove
end
@@ -1970,7 +1970,7 @@ def self.assign_indexes(model:,
space.additionalProperties.setFeature('Index', indexer(model: model))
space.surfaces.each do |surface|
- next if surface.surfaceType != 'Floor'
+ next if surface.surfaceType != EPlus::SurfaceTypeFloor
surface.additionalProperties.setFeature('Index', indexer(model: model))
end
@@ -1982,7 +1982,7 @@ def self.assign_indexes(model:,
polygon_points = [pt1, pt2]
space.surfaces.each do |surface|
- next if surface.surfaceType != 'Wall'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
num_points_matched = 0
polygon_points.each do |polygon_point|
@@ -1990,7 +1990,7 @@ def self.assign_indexes(model:,
x = polygon_point.x - surface_point.x
y = polygon_point.y - surface_point.y
z = polygon_point.z - surface_point.z
- num_points_matched += 1 if x.abs < Constants.small && y.abs < Constants.small && z.abs < Constants.small
+ num_points_matched += 1 if x.abs < Constants::Small && y.abs < Constants::Small && z.abs < Constants::Small
end
end
next if num_points_matched < 2 # match at least 2 points of the footprint_polygon and you've found the correct wall surface
@@ -2000,7 +2000,7 @@ def self.assign_indexes(model:,
end
space.surfaces.each do |surface|
- next if surface.surfaceType != 'RoofCeiling'
+ next if surface.surfaceType != EPlus::SurfaceTypeRoofCeiling
surface.additionalProperties.setFeature('Index', indexer(model: model))
end
@@ -2115,7 +2115,7 @@ def self.initialize_transformation_matrix(m:)
# @return [Double] the z value corresponding to floor surface in the provided space
def self.get_space_floor_z(space:)
space.surfaces.each do |surface|
- next unless surface.surfaceType.downcase == 'floor'
+ next unless surface.surfaceType == EPlus::SurfaceTypeFloor
return get_surface_z_values(surfaceArray: [surface])[0]
end
@@ -2228,7 +2228,7 @@ def self.add_windows_to_wall(surface:,
sub_surface = create_sub_surface(polygon: window_vertices, model: model)
sub_surface.setName("#{surface.name} - Window 1")
sub_surface.setSurface(surface)
- sub_surface.setSubSurfaceType('FixedWindow')
+ sub_surface.setSubSurfaceType(EPlus::SubSurfaceTypeWindow)
return true
end
@@ -2290,20 +2290,20 @@ def self.add_window_to_wall(surface:,
# Convert to 3D geometry; assign to surface
window_polygon = OpenStudio::Point3dVector.new
- if facade == Constants.FacadeFront
+ if facade == Constants::FacadeFront
multx = 1
multy = 0
- elsif facade == Constants.FacadeBack
+ elsif facade == Constants::FacadeBack
multx = -1
multy = 0
- elsif facade == Constants.FacadeLeft
+ elsif facade == Constants::FacadeLeft
multx = 0
multy = -1
- elsif facade == Constants.FacadeRight
+ elsif facade == Constants::FacadeRight
multx = 0
multy = 1
end
- if (facade == Constants.FacadeBack) || (facade == Constants.FacadeLeft)
+ if (facade == Constants::FacadeBack) || (facade == Constants::FacadeLeft)
leftx = get_surface_x_values(surfaceArray: [surface]).max
lefty = get_surface_y_values(surfaceArray: [surface]).max
else
@@ -2321,7 +2321,7 @@ def self.add_window_to_wall(surface:,
sub_surface = create_sub_surface(polygon: window_polygon, model: model)
sub_surface.setName("#{surface.name} - Window #{win_num}")
sub_surface.setSurface(surface)
- sub_surface.setSubSurfaceType('FixedWindow')
+ sub_surface.setSubSurfaceType(EPlus::SubSurfaceTypeWindow)
end
# From a provided array of OpenStudio spaces, return the subset for which the standards space type is equal to the HPXML location for conditioned space.
@@ -2360,7 +2360,7 @@ def self.get_garage_spaces(spaces:)
# @param surface [OpenStudio::Model::Surface] the surface of interest
# @return [Boolean] true if surface satisfies rectangular wall criteria
def self.is_rectangular_wall(surface:)
- if ((surface.surfaceType.downcase != 'wall') || (surface.outsideBoundaryCondition.downcase != 'outdoors'))
+ if ((surface.surfaceType != EPlus::SurfaceTypeWall) || (surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors))
return false
end
if surface.vertices.size != 4
@@ -2374,7 +2374,7 @@ def self.is_rectangular_wall(surface:)
((xvalues.uniq.size == 2) && (yvalues.uniq.size == 1)))
return false
end
- if not zvalues.uniq.size == 2
+ if zvalues.uniq.size != 2
return false
end
@@ -2390,7 +2390,7 @@ def self.is_rectangular_wall(surface:)
# @param surface [OpenStudio::Model::Surface] the surface of interest
# @return [Boolean] true if surface satisfies gable wall criteria
def self.is_gable_wall(surface:)
- if ((surface.surfaceType.downcase != 'wall') || (surface.outsideBoundaryCondition.downcase != 'outdoors'))
+ if ((surface.surfaceType != EPlus::SurfaceTypeWall) || (surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors))
return false
end
if surface.vertices.size != 3
@@ -2417,8 +2417,8 @@ def self.is_gable_wall(surface:)
# @return [Boolean] true if space has a roof deck
def self.space_has_roof(space:)
space.surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'roofceiling'
- next if surface.outsideBoundaryCondition.downcase != 'outdoors'
+ next if surface.surfaceType != EPlus::SurfaceTypeRoofCeiling
+ next if surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors
next if surface.tilt == 0
return true
@@ -2458,15 +2458,15 @@ def self.get_attic_space(model:,
attic_height = (y_tot / 2.0) * roof_pitch + rim_joist_height # Roof always has same orientation
side_type = nil
- if roof_type == 'gable'
+ if roof_type == Constants::RoofTypeGable
roof_w_point = OpenStudio::Point3d.new(0, y_peak, average_ceiling_height * num_floors + attic_height)
roof_e_point = OpenStudio::Point3d.new(x, y_peak, average_ceiling_height * num_floors + attic_height)
polygon_w_roof = make_polygon(roof_w_point, roof_e_point, ne_point, nw_point)
polygon_e_roof = make_polygon(roof_e_point, roof_w_point, sw_point, se_point)
polygon_s_wall = make_polygon(roof_w_point, nw_point, sw_point)
polygon_n_wall = make_polygon(roof_e_point, se_point, ne_point)
- side_type = 'Wall'
- elsif roof_type == 'hip'
+ side_type = EPlus::SurfaceTypeWall
+ elsif roof_type == Constants::RoofTypeHip
if y > 0
if x <= (y + y_rear)
roof_n_point = OpenStudio::Point3d.new(x / 2.0, y_rear - x / 2.0, average_ceiling_height * num_floors + attic_height)
@@ -2500,24 +2500,24 @@ def self.get_attic_space(model:,
polygon_n_wall = make_polygon(roof_w_point, nw_point, sw_point)
end
end
- side_type = 'RoofCeiling'
+ side_type = EPlus::SurfaceTypeRoofCeiling
end
surface_floor = create_surface(polygon: attic_polygon, model: model)
- surface_floor.setSurfaceType('Floor')
- surface_floor.setOutsideBoundaryCondition('Surface')
+ surface_floor.setSurfaceType(EPlus::SurfaceTypeFloor)
+ surface_floor.setOutsideBoundaryCondition(EPlus::BoundaryConditionSurface)
surface_w_roof = create_surface(polygon: polygon_w_roof, model: model)
- surface_w_roof.setSurfaceType('RoofCeiling')
- surface_w_roof.setOutsideBoundaryCondition('Outdoors')
+ surface_w_roof.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
+ surface_w_roof.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
surface_e_roof = create_surface(polygon: polygon_e_roof, model: model)
- surface_e_roof.setSurfaceType('RoofCeiling')
- surface_e_roof.setOutsideBoundaryCondition('Outdoors')
+ surface_e_roof.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
+ surface_e_roof.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
surface_s_wall = create_surface(polygon: polygon_s_wall, model: model)
surface_s_wall.setSurfaceType(side_type)
- surface_s_wall.setOutsideBoundaryCondition('Outdoors')
+ surface_s_wall.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
surface_n_wall = create_surface(polygon: polygon_n_wall, model: model)
surface_n_wall.setSurfaceType(side_type)
- surface_n_wall.setOutsideBoundaryCondition('Outdoors')
+ surface_n_wall.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
attic_space = create_space(model: model)
@@ -2557,8 +2557,8 @@ def self.apply_ambient_foundation_shift(model:,
# @return [Boolean] true if space is below grade
def self.space_is_below_grade(space:)
space.surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'wall'
- if surface.outsideBoundaryCondition.downcase == 'foundation'
+ next if surface.surfaceType != EPlus::SurfaceTypeWall
+ if surface.outsideBoundaryCondition == EPlus::BoundaryConditionFoundation
return true
end
end
diff --git a/BuildResidentialHPXML/tests/test_build_residential_hpxml.rb b/BuildResidentialHPXML/tests/test_build_residential_hpxml.rb
index 4bf22bc2e6..9d654cf9f3 100644
--- a/BuildResidentialHPXML/tests/test_build_residential_hpxml.rb
+++ b/BuildResidentialHPXML/tests/test_build_residential_hpxml.rb
@@ -409,12 +409,12 @@ def _set_measure_argument_values(hpxml_file, args)
args['geometry_garage_width'] = 0.0
args['geometry_garage_depth'] = 20.0
args['geometry_garage_protrusion'] = 0.0
- args['geometry_garage_position'] = 'Right'
+ args['geometry_garage_position'] = Constants::PositionRight
args['geometry_foundation_type'] = HPXML::FoundationTypeBasementConditioned
args['geometry_foundation_height'] = 8.0
args['geometry_foundation_height_above_grade'] = 1.0
args['geometry_rim_joist_height'] = 9.25
- args['geometry_roof_type'] = 'gable'
+ args['geometry_roof_type'] = Constants::RoofTypeGable
args['geometry_roof_pitch'] = '6:12'
args['geometry_attic_type'] = HPXML::AtticTypeUnvented
args['geometry_eaves_depth'] = 0
@@ -440,7 +440,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['roof_material_type'] = HPXML::RoofTypeAsphaltShingles
args['roof_color'] = HPXML::ColorMedium
args['roof_assembly_r'] = 2.3
- args['radiant_barrier_attic_location'] = 'none'
+ args['radiant_barrier_attic_location'] = Constants::None
args['radiant_barrier_grade'] = 1
args['neighbor_front_distance'] = 0
args['neighbor_back_distance'] = 0
@@ -500,7 +500,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['cooling_system_cooling_capacity'] = 24000.0
args['cooling_system_fraction_cool_load_served'] = 1
args['cooling_system_is_ducted'] = false
- args['heat_pump_type'] = 'none'
+ args['heat_pump_type'] = Constants::None
args['heat_pump_heating_efficiency_type'] = HPXML::UnitsHSPF
args['heat_pump_heating_efficiency'] = 7.7
args['heat_pump_cooling_efficiency_type'] = HPXML::UnitsSEER
@@ -515,7 +515,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['heat_pump_backup_fuel'] = HPXML::FuelTypeElectricity
args['heat_pump_backup_heating_efficiency'] = 1
args['heat_pump_backup_heating_capacity'] = 36000.0
- args['geothermal_loop_configuration'] = 'none'
+ args['geothermal_loop_configuration'] = Constants::None
args['hvac_control_heating_weekday_setpoint'] = 68
args['hvac_control_heating_weekend_setpoint'] = 68
args['hvac_control_cooling_weekday_setpoint'] = 78
@@ -530,11 +530,11 @@ def _set_measure_argument_values(hpxml_file, args)
args['ducts_supply_surface_area'] = 150.0
args['ducts_return_surface_area'] = 50.0
args['ducts_number_of_return_registers'] = 2
- args['heating_system_2_type'] = 'none'
+ args['heating_system_2_type'] = Constants::None
args['heating_system_2_fuel'] = HPXML::FuelTypeElectricity
args['heating_system_2_heating_efficiency'] = 1.0
args['heating_system_2_fraction_heat_load_served'] = 0.25
- args['mech_vent_fan_type'] = 'none'
+ args['mech_vent_fan_type'] = Constants::None
args['mech_vent_flow_rate'] = 110
args['mech_vent_hours_in_operation'] = 24
args['mech_vent_recovery_efficiency_type'] = 'Unadjusted'
@@ -542,7 +542,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['mech_vent_sensible_recovery_efficiency'] = 0.72
args['mech_vent_fan_power'] = 30
args['mech_vent_num_units_served'] = 1
- args['mech_vent_2_fan_type'] = 'none'
+ args['mech_vent_2_fan_type'] = Constants::None
args['mech_vent_2_flow_rate'] = 110
args['mech_vent_2_hours_in_operation'] = 24
args['mech_vent_2_recovery_efficiency_type'] = 'Unadjusted'
@@ -571,12 +571,12 @@ def _set_measure_argument_values(hpxml_file, args)
args['hot_water_distribution_recirc_branch_piping_length'] = 50
args['hot_water_distribution_recirc_pump_power'] = 50
args['hot_water_distribution_pipe_r'] = 0.0
- args['dwhr_facilities_connected'] = 'none'
+ args['dwhr_facilities_connected'] = Constants::None
args['dwhr_equal_flow'] = true
args['dwhr_efficiency'] = 0.55
args['water_fixtures_shower_low_flow'] = true
args['water_fixtures_sink_low_flow'] = false
- args['solar_thermal_system_type'] = 'none'
+ args['solar_thermal_system_type'] = Constants::None
args['solar_thermal_collector_area'] = 40.0
args['solar_thermal_collector_loop_type'] = HPXML::SolarThermalLoopTypeDirect
args['solar_thermal_collector_type'] = HPXML::SolarThermalCollectorTypeEvacuatedTube
@@ -605,7 +605,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['lighting_garage_fraction_lfl'] = 0.1
args['lighting_garage_fraction_led'] = 0.25
args['holiday_lighting_present'] = false
- args['dehumidifier_type'] = 'none'
+ args['dehumidifier_type'] = Constants::None
args['dehumidifier_efficiency_type'] = 'EnergyFactor'
args['dehumidifier_efficiency'] = 1.8
args['dehumidifier_capacity'] = 40
@@ -784,7 +784,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['heating_system_heating_efficiency'] = 1.0
args['heating_system_heating_capacity'] = 48000.0
args['heating_system_fraction_heat_load_served'] = 0.75
- args['cooling_system_type'] = 'none'
+ args['cooling_system_type'] = Constants::None
args['heating_system_2_type'] = HPXML::HVACTypeFireplace
args['heating_system_2_heating_capacity'] = 16000.0
elsif ['extra-second-heating-system-boiler-to-heating-system.xml'].include? hpxml_file
@@ -792,8 +792,8 @@ def _set_measure_argument_values(hpxml_file, args)
args['heating_system_fraction_heat_load_served'] = 0.75
args['heating_system_2_type'] = HPXML::HVACTypeBoiler
elsif ['extra-second-heating-system-portable-heater-to-heat-pump.xml'].include? hpxml_file
- args['heating_system_type'] = 'none'
- args['cooling_system_type'] = 'none'
+ args['heating_system_type'] = Constants::None
+ args['cooling_system_type'] = Constants::None
args['heat_pump_type'] = HPXML::HVACTypeHeatPumpAirToAir
args['heat_pump_backup_type'] = HPXML::HeatPumpBackupTypeIntegrated
args['heat_pump_backup_fuel'] = HPXML::FuelTypeElectricity
@@ -806,8 +806,8 @@ def _set_measure_argument_values(hpxml_file, args)
args['heating_system_2_type'] = HPXML::HVACTypeSpaceHeater
args['heating_system_2_heating_capacity'] = 16000.0
elsif ['extra-second-heating-system-fireplace-to-heat-pump.xml'].include? hpxml_file
- args['heating_system_type'] = 'none'
- args['cooling_system_type'] = 'none'
+ args['heating_system_type'] = Constants::None
+ args['cooling_system_type'] = Constants::None
args['heat_pump_type'] = HPXML::HVACTypeHeatPumpMiniSplit
args.delete('heat_pump_cooling_compressor_type')
args['heat_pump_heating_efficiency'] = 10.0
@@ -818,8 +818,8 @@ def _set_measure_argument_values(hpxml_file, args)
args['heating_system_2_type'] = HPXML::HVACTypeFireplace
args['heating_system_2_heating_capacity'] = 16000.0
elsif ['extra-second-heating-system-boiler-to-heat-pump.xml'].include? hpxml_file
- args['heating_system_type'] = 'none'
- args['cooling_system_type'] = 'none'
+ args['heating_system_type'] = Constants::None
+ args['cooling_system_type'] = Constants::None
args['heat_pump_type'] = HPXML::HVACTypeHeatPumpGroundToAir
args['heat_pump_heating_efficiency_type'] = HPXML::UnitsCOP
args['heat_pump_heating_efficiency'] = 3.6
@@ -860,7 +860,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['ducts_supply_location'] = HPXML::LocationUnderSlab
args['ducts_return_location'] = HPXML::LocationUnderSlab
elsif ['extra-enclosure-atticroof-conditioned-eaves-hip.xml'].include? hpxml_file
- args['geometry_roof_type'] = 'hip'
+ args['geometry_roof_type'] = Constants::RoofTypeHip
elsif ['extra-gas-pool-heater-with-zero-kwh.xml'].include? hpxml_file
args['pool_present'] = true
args['pool_heater_type'] = HPXML::HeaterTypeGas
@@ -902,8 +902,8 @@ def _set_measure_argument_values(hpxml_file, args)
args['utility_bill_wood_pellets_fixed_charges'] = '16, 17'
args['utility_bill_wood_pellets_marginal_rates'] = '18, 19'
elsif ['extra-seasons-building-america.xml'].include? hpxml_file
- args['hvac_control_heating_season_period'] = HPXML::BuildingAmerica
- args['hvac_control_cooling_season_period'] = HPXML::BuildingAmerica
+ args['hvac_control_heating_season_period'] = Constants::BuildingAmerica
+ args['hvac_control_cooling_season_period'] = Constants::BuildingAmerica
elsif ['extra-ducts-crawlspace.xml'].include? hpxml_file
args['geometry_foundation_type'] = HPXML::FoundationTypeCrawlspaceUnvented
args['geometry_foundation_height'] = 4
@@ -933,8 +933,8 @@ def _set_measure_argument_values(hpxml_file, args)
args['battery_present'] = true
args['battery_location'] = HPXML::LocationAttic
elsif ['extra-detailed-performance-autosize.xml'].include? hpxml_file
- args['heating_system_type'] = 'none'
- args['cooling_system_type'] = 'none'
+ args['heating_system_type'] = Constants::None
+ args['cooling_system_type'] = Constants::None
args['heat_pump_type'] = HPXML::HVACTypeHeatPumpAirToAir
args['heat_pump_heating_efficiency'] = 10.0
args['heat_pump_cooling_efficiency'] = 17.25
@@ -969,7 +969,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['ducts_supply_location'] = HPXML::LocationConditionedSpace
args['ducts_return_location'] = HPXML::LocationConditionedSpace
elsif ['extra-sfa-atticroof-conditioned-eaves-hip.xml'].include? hpxml_file
- args['geometry_roof_type'] = 'hip'
+ args['geometry_roof_type'] = Constants::RoofTypeHip
elsif ['extra-mf-eaves.xml'].include? hpxml_file
args['geometry_eaves_depth'] = 2
elsif ['extra-sfa-slab.xml'].include? hpxml_file
@@ -1138,10 +1138,10 @@ def _set_measure_argument_values(hpxml_file, args)
# Error
if ['error-heating-system-and-heat-pump.xml'].include? hpxml_file
- args['cooling_system_type'] = 'none'
+ args['cooling_system_type'] = Constants::None
args['heat_pump_type'] = HPXML::HVACTypeHeatPumpAirToAir
elsif ['error-cooling-system-and-heat-pump.xml'].include? hpxml_file
- args['heating_system_type'] = 'none'
+ args['heating_system_type'] = Constants::None
args['heat_pump_type'] = HPXML::HVACTypeHeatPumpAirToAir
elsif ['error-sfd-conditioned-basement-zero-foundation-height.xml'].include? hpxml_file
args['geometry_foundation_height'] = 0.0
@@ -1158,11 +1158,11 @@ def _set_measure_argument_values(hpxml_file, args)
args['geometry_attic_type'] = HPXML::AtticTypeBelowApartment
args.delete('foundation_wall_insulation_distance_to_bottom')
elsif ['error-second-heating-system-but-no-primary-heating.xml'].include? hpxml_file
- args['heating_system_type'] = 'none'
+ args['heating_system_type'] = Constants::None
args['heating_system_2_type'] = HPXML::HVACTypeFireplace
elsif ['error-second-heating-system-ducted-with-ducted-primary-heating.xml'].include? hpxml_file
- args['heating_system_type'] = 'none'
- args['cooling_system_type'] = 'none'
+ args['heating_system_type'] = Constants::None
+ args['cooling_system_type'] = Constants::None
args['heat_pump_type'] = HPXML::HVACTypeHeatPumpMiniSplit
args.delete('heat_pump_cooling_compressor_type')
args['heat_pump_is_ducted'] = true
@@ -1248,7 +1248,7 @@ def _set_measure_argument_values(hpxml_file, args)
args['geometry_unit_front_wall_is_adiabatic'] = true
args['geometry_unit_back_wall_is_adiabatic'] = true
elsif ['error-hip-roof-and-protruding-garage.xml'].include? hpxml_file
- args['geometry_roof_type'] = 'hip'
+ args['geometry_roof_type'] = Constants::RoofTypeHip
args['geometry_garage_width'] = 12
args['geometry_garage_protrusion'] = 0.5
elsif ['error-protruding-garage-under-gable-roof.xml'].include? hpxml_file
diff --git a/BuildResidentialScheduleFile/measure.rb b/BuildResidentialScheduleFile/measure.rb
index b800842228..dbb34533fe 100644
--- a/BuildResidentialScheduleFile/measure.rb
+++ b/BuildResidentialScheduleFile/measure.rb
@@ -250,7 +250,7 @@ def get_simulation_parameters(hpxml, weather, args)
calendar_year = Location.get_sim_calendar_year(hpxml.header.sim_calendar_year, weather)
args[:sim_year] = calendar_year
args[:sim_start_day] = DateTime.new(args[:sim_year], 1, 1)
- args[:total_days_in_year] = Constants.NumDaysInYear(calendar_year)
+ args[:total_days_in_year] = Calendar.num_days_in_year(calendar_year)
end
# Get generator inputs that are required for the stochastic schedule generator.
@@ -260,7 +260,7 @@ def get_simulation_parameters(hpxml, weather, args)
# @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)
- if Constants.StateCodesMap.keys.include?(state_code)
+ if Constants::StateCodesMap.keys.include?(state_code)
args[:state] = state_code
else
# Unhandled state code, fallback to CO
diff --git a/BuildResidentialScheduleFile/measure.xml b/BuildResidentialScheduleFile/measure.xml
index a2a4dcf59b..a6209e1a2f 100644
--- a/BuildResidentialScheduleFile/measure.xml
+++ b/BuildResidentialScheduleFile/measure.xml
@@ -3,8 +3,8 @@
3.1
build_residential_schedule_file
f770b2db-1a9f-4e99-99a7-7f3161a594b1
- 9033e5e4-4876-4392-8a4a-77401a93c4ae
- 2024-08-21T18:55:44Z
+ 27a369c7-3136-4a71-9ecd-af6392b6c251
+ 2024-08-21T20:28:58Z
03F02484
BuildResidentialScheduleFile
Schedule File Builder
@@ -133,7 +133,7 @@
measure.rb
rb
script
- 038D2D11
+ 19F7FF66
README.md
@@ -229,7 +229,7 @@
schedules.rb
rb
resource
- 08F7AF68
+ 23F6E830
shower_cluster_size_probability.csv
diff --git a/BuildResidentialScheduleFile/resources/schedules.rb b/BuildResidentialScheduleFile/resources/schedules.rb
index 58714ce53a..75c9c97006 100644
--- a/BuildResidentialScheduleFile/resources/schedules.rb
+++ b/BuildResidentialScheduleFile/resources/schedules.rb
@@ -176,11 +176,11 @@ 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(Schedule.CeilingFanMonthlyMultipliers(weather: weather), 12, 'monthly') # based on monthly average outdoor temperatures per ANSI/RESNET/ICC 301-2019
+ 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
sch = get_building_america_lighting_schedule(args[:time_zone_utc_offset], args[:latitude], args[:longitude], schedules_csv_data)
interior_lighting_schedule = []
- num_days_in_months = Constants.NumDaysInMonths(@sim_year)
+ num_days_in_months = Calendar.num_days_in_months(@sim_year)
for month in 0..11
interior_lighting_schedule << sch[month] * num_days_in_months[month]
end
@@ -1000,7 +1000,7 @@ def get_building_america_lighting_schedule(time_zone_utc_offset, latitude, longi
stdDevCons2 = 2.36567663279954
monthly_kwh_per_day = []
- days_m = Constants.NumDaysInMonths(1999) # Intentionally excluding leap year designation
+ days_m = Calendar.num_days_in_months(1999) # Intentionally excluding leap year designation
wtd_avg_monthly_kwh_per_day = 0
for monthNum in 1..12
month = monthNum - 1
diff --git a/HPXMLtoOpenStudio/measure.rb b/HPXMLtoOpenStudio/measure.rb
index 8532cabc24..b7b5171a5f 100644
--- a/HPXMLtoOpenStudio/measure.rb
+++ b/HPXMLtoOpenStudio/measure.rb
@@ -157,7 +157,7 @@ def run(model, runner, user_arguments)
eri_version = hpxml.header.eri_calculation_version # Hidden feature
eri_version = 'latest' if eri_version.nil?
- eri_version = Constants.ERIVersions[-1] if eri_version == 'latest'
+ eri_version = Constants::ERIVersions[-1] if eri_version == 'latest'
# Process weather once upfront
epw_path = Location.get_epw_path(hpxml.buildings[0], args[:hpxml_path])
@@ -726,8 +726,8 @@ def add_roofs(runner, model, spaces)
else
surface.setName(roof.id)
end
- surface.setSurfaceType('RoofCeiling')
- surface.setOutsideBoundaryCondition('Outdoors')
+ surface.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
set_surface_interior(model, spaces, surface, roof)
end
@@ -842,12 +842,12 @@ def add_walls(runner, model, spaces)
else
surface.setName(wall.id)
end
- surface.setSurfaceType('Wall')
+ surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, wall)
set_surface_exterior(model, spaces, surface, wall)
if wall.is_interior
- surface.setSunExposure('NoSun')
- surface.setWindExposure('NoWind')
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
end
end
@@ -918,12 +918,12 @@ def add_rim_joists(runner, model, spaces)
else
surface.setName(rim_joist.id)
end
- surface.setSurfaceType('Wall')
+ surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, rim_joist)
set_surface_exterior(model, spaces, surface, rim_joist)
if rim_joist.is_interior
- surface.setSunExposure('NoSun')
- surface.setWindExposure('NoWind')
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
end
end
@@ -992,14 +992,14 @@ def add_floors(runner, model, spaces)
set_surface_exterior(model, spaces, surface, floor)
surface.setName(floor.id)
if floor.is_interior
- surface.setSunExposure('NoSun')
- surface.setWindExposure('NoWind')
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
elsif floor.is_floor
- surface.setSunExposure('NoSun')
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
if floor.exterior_adjacent_to == HPXML::LocationManufacturedHomeUnderBelly
foundation = @hpxml_bldg.foundations.find { |x| x.to_location == floor.exterior_adjacent_to }
if foundation.belly_wing_skirt_present
- surface.setWindExposure('NoWind')
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
end
end
end
@@ -1025,7 +1025,7 @@ def add_floors(runner, model, spaces)
# Raised floor
inside_film = Material.AirFilmFloorASHRAE140
outside_film = Material.AirFilmFloorZeroWindASHRAE140
- surface.setWindExposure('NoWind')
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
mat_int_finish_or_covering = Material.CoveringBare(1.0)
else
inside_film = Material.AirFilmFloorReduced
@@ -1128,11 +1128,11 @@ def add_foundation_walls_slabs(runner, model, weather, spaces)
surface.additionalProperties.setFeature('Tilt', 90.0)
surface.additionalProperties.setFeature('SurfaceType', 'FoundationWall')
surface.setName(fnd_wall.id)
- surface.setSurfaceType('Wall')
+ surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, fnd_wall)
set_surface_exterior(model, spaces, surface, fnd_wall)
- surface.setSunExposure('NoSun')
- surface.setWindExposure('NoWind')
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
# Apply construction
@@ -1208,7 +1208,7 @@ def add_foundation_wall(runner, model, spaces, foundation_wall, exposed_length,
surface.additionalProperties.setFeature('Tilt', 90.0)
surface.additionalProperties.setFeature('SurfaceType', 'FoundationWall')
surface.setName(foundation_wall.id)
- surface.setSurfaceType('Wall')
+ surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, foundation_wall)
set_surface_exterior(model, spaces, surface, foundation_wall)
@@ -1285,12 +1285,12 @@ def add_foundation_slab(model, weather, spaces, slab, z_origin, exposed_length,
vertices = Geometry.create_floor_vertices(length: slab_length, width: slab_width, z_origin: z_origin, default_azimuths: @default_azimuths)
surface = OpenStudio::Model::Surface.new(vertices, model)
surface.setName(slab.id)
- surface.setSurfaceType('Floor')
- surface.setOutsideBoundaryCondition('Foundation')
+ surface.setSurfaceType(EPlus::SurfaceTypeFloor)
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionFoundation)
surface.additionalProperties.setFeature('SurfaceType', 'Slab')
set_surface_interior(model, spaces, surface, slab)
- surface.setSunExposure('NoSun')
- surface.setWindExposure('NoWind')
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
slab_perim_r = slab.perimeter_insulation_r_value
slab_perim_depth = slab.perimeter_insulation_depth
@@ -1396,12 +1396,12 @@ def add_conditioned_floor_area(model, spaces)
vertices = Geometry.create_floor_vertices(length: floor_length, width: floor_width, z_origin: z_origin, default_azimuths: @default_azimuths)
floor_surface = OpenStudio::Model::Surface.new(vertices, model)
- floor_surface.setSunExposure('NoSun')
- floor_surface.setWindExposure('NoWind')
+ floor_surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ floor_surface.setWindExposure(EPlus::SurfaceWindExposureNo)
floor_surface.setName('inferred conditioned floor')
- floor_surface.setSurfaceType('Floor')
+ floor_surface.setSurfaceType(EPlus::SurfaceTypeFloor)
floor_surface.setSpace(create_or_get_space(model, spaces, HPXML::LocationConditionedSpace))
- floor_surface.setOutsideBoundaryCondition('Adiabatic')
+ floor_surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
floor_surface.additionalProperties.setFeature('SurfaceType', 'InferredFloor')
floor_surface.additionalProperties.setFeature('Tilt', 0.0)
@@ -1409,12 +1409,12 @@ def add_conditioned_floor_area(model, spaces)
vertices = Geometry.create_ceiling_vertices(length: floor_length, width: floor_width, z_origin: z_origin, default_azimuths: @default_azimuths)
ceiling_surface = OpenStudio::Model::Surface.new(vertices, model)
- ceiling_surface.setSunExposure('NoSun')
- ceiling_surface.setWindExposure('NoWind')
+ ceiling_surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ ceiling_surface.setWindExposure(EPlus::SurfaceWindExposureNo)
ceiling_surface.setName('inferred conditioned ceiling')
- ceiling_surface.setSurfaceType('RoofCeiling')
+ ceiling_surface.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
ceiling_surface.setSpace(create_or_get_space(model, spaces, HPXML::LocationConditionedSpace))
- ceiling_surface.setOutsideBoundaryCondition('Adiabatic')
+ ceiling_surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
ceiling_surface.additionalProperties.setFeature('SurfaceType', 'InferredCeiling')
ceiling_surface.additionalProperties.setFeature('Tilt', 0.0)
@@ -1487,14 +1487,14 @@ def add_windows(model, spaces)
surface.additionalProperties.setFeature('Tilt', 90.0)
surface.additionalProperties.setFeature('SurfaceType', 'Window')
surface.setName("surface #{window.id}")
- surface.setSurfaceType('Wall')
+ surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, window.wall)
vertices = Geometry.create_wall_vertices(length: window_length, height: window_height, z_origin: z_origin, azimuth: window.azimuth)
sub_surface = OpenStudio::Model::SubSurface.new(vertices, model)
sub_surface.setName(window.id)
sub_surface.setSurface(surface)
- sub_surface.setSubSurfaceType('FixedWindow')
+ sub_surface.setSubSurfaceType(EPlus::SubSurfaceTypeWindow)
set_subsurface_exterior(surface, spaces, model, window.wall)
surfaces << surface
@@ -1523,14 +1523,14 @@ def add_windows(model, spaces)
surface.additionalProperties.setFeature('Tilt', 90.0)
surface.additionalProperties.setFeature('SurfaceType', 'Door')
surface.setName("surface #{window.id}")
- surface.setSurfaceType('Wall')
+ surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, window.wall)
vertices = Geometry.create_wall_vertices(length: window_length, height: window_height, z_origin: z_origin, azimuth: window.azimuth)
sub_surface = OpenStudio::Model::SubSurface.new(vertices, model)
sub_surface.setName(window.id)
sub_surface.setSurface(surface)
- sub_surface.setSubSurfaceType('Door')
+ sub_surface.setSubSurfaceType(EPlus::SubSurfaceTypeDoor)
set_subsurface_exterior(surface, spaces, model, window.wall)
surfaces << surface
@@ -1596,9 +1596,9 @@ def add_skylights(model, spaces)
surface.additionalProperties.setFeature('Tilt', tilt)
surface.additionalProperties.setFeature('SurfaceType', 'Skylight')
surface.setName("surface #{skylight.id}")
- surface.setSurfaceType('RoofCeiling')
+ surface.setSurfaceType(EPlus::SurfaceTypeRoofCeiling)
surface.setSpace(create_or_get_space(model, spaces, HPXML::LocationConditionedSpace))
- surface.setOutsideBoundaryCondition('Outdoors') # cannot be adiabatic because subsurfaces won't be created
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors) # cannot be adiabatic because subsurfaces won't be created
vertices = Geometry.create_roof_vertices(length: length, width: width, z_origin: z_origin, azimuth: skylight.azimuth, tilt: tilt)
sub_surface = OpenStudio::Model::SubSurface.new(vertices, model)
@@ -1629,11 +1629,11 @@ def add_skylights(model, spaces)
surface.additionalProperties.setFeature('Tilt', 90.0)
surface.additionalProperties.setFeature('SurfaceType', 'Skylight')
surface.setName("surface #{skylight.id} shaft")
- surface.setSurfaceType('Wall')
+ surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, skylight.floor)
set_surface_exterior(model, spaces, surface, skylight.floor)
- surface.setSunExposure('NoSun')
- surface.setWindExposure('NoWind')
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
# Apply construction
shaft_assembly_r_value = [skylight.shaft_assembly_r_value - 2 * Material.AirFilmVertical.rvalue, 0.1].max
@@ -1669,14 +1669,14 @@ def add_doors(model, spaces)
surface.additionalProperties.setFeature('Tilt', 90.0)
surface.additionalProperties.setFeature('SurfaceType', 'Door')
surface.setName("surface #{door.id}")
- surface.setSurfaceType('Wall')
+ surface.setSurfaceType(EPlus::SurfaceTypeWall)
set_surface_interior(model, spaces, surface, door.wall)
vertices = Geometry.create_wall_vertices(length: door_length, height: door_height, z_origin: z_origin, azimuth: door.azimuth)
sub_surface = OpenStudio::Model::SubSurface.new(vertices, model)
sub_surface.setName(door.id)
sub_surface.setSurface(surface)
- sub_surface.setSubSurfaceType('Door')
+ sub_surface.setSubSurfaceType(EPlus::SubSurfaceTypeDoor)
set_subsurface_exterior(surface, spaces, model, door.wall)
surfaces << surface
@@ -2125,13 +2125,13 @@ def add_mels(runner, model, spaces)
# Misc
@hpxml_bldg.plug_loads.each do |plug_load|
if plug_load.plug_load_type == HPXML::PlugLoadTypeOther
- obj_name = Constants.ObjectNameMiscPlugLoads
+ obj_name = Constants::ObjectTypeMiscPlugLoads
elsif plug_load.plug_load_type == HPXML::PlugLoadTypeTelevision
- obj_name = Constants.ObjectNameMiscTelevision
+ obj_name = Constants::ObjectTypeMiscTelevision
elsif plug_load.plug_load_type == HPXML::PlugLoadTypeElectricVehicleCharging
- obj_name = Constants.ObjectNameMiscElectricVehicleCharging
+ obj_name = Constants::ObjectTypeMiscElectricVehicleCharging
elsif plug_load.plug_load_type == HPXML::PlugLoadTypeWellPump
- obj_name = Constants.ObjectNameMiscWellPump
+ obj_name = Constants::ObjectTypeMiscWellPump
end
if obj_name.nil?
runner.registerWarning("Unexpected plug load type '#{plug_load.plug_load_type}'. The plug load will not be modeled.")
@@ -2153,11 +2153,11 @@ def add_mfls(runner, model, spaces)
# Misc
@hpxml_bldg.fuel_loads.each do |fuel_load|
if fuel_load.fuel_load_type == HPXML::FuelLoadTypeGrill
- obj_name = Constants.ObjectNameMiscGrill
+ obj_name = Constants::ObjectTypeMiscGrill
elsif fuel_load.fuel_load_type == HPXML::FuelLoadTypeLighting
- obj_name = Constants.ObjectNameMiscLighting
+ obj_name = Constants::ObjectTypeMiscLighting
elsif fuel_load.fuel_load_type == HPXML::FuelLoadTypeFireplace
- obj_name = Constants.ObjectNameMiscFireplace
+ obj_name = Constants::ObjectTypeMiscFireplace
end
if obj_name.nil?
runner.registerWarning("Unexpected fuel load type '#{fuel_load.fuel_load_type}'. The fuel load will not be modeled.")
@@ -2280,12 +2280,12 @@ def add_airflow(runner, model, weather, spaces, airloop_map)
# Create HVAC availability sensor
hvac_availability_sensor = nil
if not @hvac_unavailable_periods.empty?
- avail_sch = ScheduleConstant.new(model, SchedulesFile::Columns[:HVAC].name, 1.0, Constants.ScheduleTypeLimitsFraction, unavailable_periods: @hvac_unavailable_periods)
+ avail_sch = ScheduleConstant.new(model, SchedulesFile::Columns[:HVAC].name, 1.0, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: @hvac_unavailable_periods)
hvac_availability_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
hvac_availability_sensor.setName('hvac availability s')
hvac_availability_sensor.setKeyName(avail_sch.schedule.name.to_s)
- hvac_availability_sensor.additionalProperties.setFeature('ObjectType', Constants.ObjectNameHVACAvailabilitySensor)
+ hvac_availability_sensor.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeHVACAvailabilitySensor)
end
Airflow.apply(model, runner, weather, spaces, @hpxml_header, @hpxml_bldg, @cfa,
@@ -2516,14 +2516,14 @@ def add_unmet_hours_output(model, hpxml_osm_map, hpxml)
sim_year = @hpxml_header.sim_calendar_year
season_day_nums[unit] = {
- htg_start: Schedule.get_day_num_from_month_day(sim_year, hvac_control.seasons_heating_begin_month, hvac_control.seasons_heating_begin_day),
- htg_end: Schedule.get_day_num_from_month_day(sim_year, hvac_control.seasons_heating_end_month, hvac_control.seasons_heating_end_day),
- clg_start: Schedule.get_day_num_from_month_day(sim_year, hvac_control.seasons_cooling_begin_month, hvac_control.seasons_cooling_begin_day),
- clg_end: Schedule.get_day_num_from_month_day(sim_year, hvac_control.seasons_cooling_end_month, hvac_control.seasons_cooling_end_day)
+ htg_start: Calendar.get_day_num_from_month_day(sim_year, hvac_control.seasons_heating_begin_month, hvac_control.seasons_heating_begin_day),
+ htg_end: Calendar.get_day_num_from_month_day(sim_year, hvac_control.seasons_heating_end_month, hvac_control.seasons_heating_end_day),
+ clg_start: Calendar.get_day_num_from_month_day(sim_year, hvac_control.seasons_cooling_begin_month, hvac_control.seasons_cooling_begin_day),
+ clg_end: Calendar.get_day_num_from_month_day(sim_year, hvac_control.seasons_cooling_end_month, hvac_control.seasons_cooling_end_day)
}
end
- hvac_availability_sensor = model.getEnergyManagementSystemSensors.find { |s| s.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameHVACAvailabilitySensor }
+ hvac_availability_sensor = model.getEnergyManagementSystemSensors.find { |s| s.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeHVACAvailabilitySensor }
# EMS program
clg_hrs = 'clg_unmet_hours'
@@ -2532,7 +2532,7 @@ def add_unmet_hours_output(model, hpxml_osm_map, hpxml)
unit_htg_hrs = 'unit_htg_unmet_hours'
program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
program.setName('unmet hours program')
- program.additionalProperties.setFeature('ObjectType', Constants.ObjectNameUnmetHoursProgram)
+ program.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeUnmetHoursProgram)
program.addLine("Set #{htg_hrs} = 0")
program.addLine("Set #{clg_hrs} = 0")
for unit in 0..hpxml_osm_map.size - 1
@@ -2664,7 +2664,7 @@ def add_total_loads_output(model, hpxml_osm_map)
# EMS program
program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
program.setName('total loads program')
- program.additionalProperties.setFeature('ObjectType', Constants.ObjectNameTotalLoadsProgram)
+ program.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeTotalLoadsProgram)
program.addLine('Set loads_htg_tot = 0')
program.addLine('Set loads_clg_tot = 0')
for unit in 0..hpxml_osm_map.size - 1
@@ -2731,7 +2731,7 @@ def add_component_loads_output(model, hpxml_osm_map, loads_data, season_day_nums
# EMS program
program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
program.setName('component loads program')
- program.additionalProperties.setFeature('ObjectType', Constants.ObjectNameComponentLoadsProgram)
+ program.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeComponentLoadsProgram)
# Initialize
[:htg, :clg].each do |mode|
@@ -2867,11 +2867,11 @@ def add_component_loads_output(model, hpxml_osm_map, loads_data, season_day_nums
airflow_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, var)
airflow_sensor.setName(name)
airflow_sensor.setKeyName(i.name.to_s)
- if object_type == Constants.ObjectNameInfiltration
+ if object_type == Constants::ObjectTypeInfiltration
infil_sensors << airflow_sensor
- elsif object_type == Constants.ObjectNameNaturalVentilation
+ elsif object_type == Constants::ObjectTypeNaturalVentilation
natvent_sensors << airflow_sensor
- elsif object_type == Constants.ObjectNameWholeHouseFan
+ elsif object_type == Constants::ObjectTypeWholeHouseFan
whf_sensors << airflow_sensor
end
end
@@ -2880,7 +2880,7 @@ def add_component_loads_output(model, hpxml_osm_map, loads_data, season_day_nums
# EMS Sensors: Mechanical Ventilation
mechvents_sensors = []
unit_model.getElectricEquipments.sort.each do |o|
- next unless o.endUseSubcategory == Constants.ObjectNameMechanicalVentilation
+ next unless o.endUseSubcategory == Constants::ObjectTypeMechanicalVentilation
objects_already_processed << o
{ 'Electric Equipment Convective Heating Energy' => 'mv_conv',
@@ -2892,7 +2892,7 @@ def add_component_loads_output(model, hpxml_osm_map, loads_data, season_day_nums
end
end
unit_model.getOtherEquipments.sort.each do |o|
- next unless o.endUseSubcategory == Constants.ObjectNameMechanicalVentilationHouseFan
+ next unless o.endUseSubcategory == Constants::ObjectTypeMechanicalVentilationHouseFan
objects_already_processed << o
{ 'Other Equipment Convective Heating Energy' => 'mv_conv',
@@ -2910,7 +2910,7 @@ def add_component_loads_output(model, hpxml_osm_map, loads_data, season_day_nums
ducts_mix_loss_sensor = nil
conditioned_zone.zoneMixing.each do |zone_mix|
object_type = zone_mix.additionalProperties.getFeatureAsString('ObjectType').to_s
- next unless object_type == Constants.ObjectNameDuctLoad
+ next unless object_type == Constants::ObjectTypeDuctLoad
ducts_mix_gain_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Zone Mixing Sensible Heat Gain Energy')
ducts_mix_gain_sensor.setName('duct_mix_gain')
@@ -2922,7 +2922,7 @@ def add_component_loads_output(model, hpxml_osm_map, loads_data, season_day_nums
end
unit_model.getOtherEquipments.sort.each do |o|
next if objects_already_processed.include? o
- next unless o.endUseSubcategory == Constants.ObjectNameDuctLoad
+ next unless o.endUseSubcategory == Constants::ObjectTypeDuctLoad
objects_already_processed << o
{ 'Other Equipment Convective Heating Energy' => 'ducts_conv',
@@ -3165,17 +3165,17 @@ def add_total_airflows_output(model, hpxml_osm_map)
whf_vars = []
unit_multipliers = []
hpxml_osm_map.each do |hpxml_bldg, unit_model|
- infil_vars << unit_model.getEnergyManagementSystemGlobalVariables.find { |v| v.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameInfiltration }
- mechvent_vars << unit_model.getEnergyManagementSystemGlobalVariables.find { |v| v.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameMechanicalVentilation }
- natvent_vars << unit_model.getEnergyManagementSystemGlobalVariables.find { |v| v.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameNaturalVentilation }
- whf_vars << unit_model.getEnergyManagementSystemGlobalVariables.find { |v| v.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameWholeHouseFan }
+ infil_vars << unit_model.getEnergyManagementSystemGlobalVariables.find { |v| v.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeInfiltration }
+ mechvent_vars << unit_model.getEnergyManagementSystemGlobalVariables.find { |v| v.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeMechanicalVentilation }
+ natvent_vars << unit_model.getEnergyManagementSystemGlobalVariables.find { |v| v.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeNaturalVentilation }
+ whf_vars << unit_model.getEnergyManagementSystemGlobalVariables.find { |v| v.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeWholeHouseFan }
unit_multipliers << hpxml_bldg.building_construction.number_of_units
end
# EMS program
program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
program.setName('total airflows program')
- program.additionalProperties.setFeature('ObjectType', Constants.ObjectNameTotalAirflowsProgram)
+ program.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeTotalAirflowsProgram)
program.addLine('Set total_infil_flow_rate = 0')
program.addLine('Set total_mechvent_flow_rate = 0')
program.addLine('Set total_natvent_flow_rate = 0')
@@ -3264,11 +3264,11 @@ def set_surface_exterior(model, spaces, surface, hpxml_surface)
exterior_adjacent_to = hpxml_surface.exterior_adjacent_to
is_adiabatic = hpxml_surface.is_adiabatic
if [HPXML::LocationOutside, HPXML::LocationManufacturedHomeUnderBelly].include? exterior_adjacent_to
- surface.setOutsideBoundaryCondition('Outdoors')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
elsif exterior_adjacent_to == HPXML::LocationGround
- surface.setOutsideBoundaryCondition('Foundation')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionFoundation)
elsif is_adiabatic
- surface.setOutsideBoundaryCondition('Adiabatic')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
elsif [HPXML::LocationOtherHeatedSpace, HPXML::LocationOtherMultifamilyBufferSpace,
HPXML::LocationOtherNonFreezingSpace, HPXML::LocationOtherHousingUnit].include? exterior_adjacent_to
set_surface_otherside_coefficients(surface, exterior_adjacent_to, model, spaces)
@@ -3305,8 +3305,8 @@ def set_surface_otherside_coefficients(surface, exterior_adjacent_to, model, spa
otherside_coeffs.setConstantTemperatureSchedule(sch)
end
surface.setSurfacePropertyOtherSideCoefficients(otherside_coeffs)
- surface.setSunExposure('NoSun')
- surface.setWindExposure('NoWind')
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
end
# TODO
@@ -3487,7 +3487,7 @@ def set_subsurface_exterior(surface, spaces, model, hpxml_surface)
# Subsurface on foundation wall, set it to be adjacent to outdoors
if hpxml_surface.exterior_adjacent_to == HPXML::LocationGround
- surface.setOutsideBoundaryCondition('Outdoors')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionOutdoors)
else
set_surface_exterior(model, spaces, surface, hpxml_surface)
end
@@ -3529,8 +3529,8 @@ def set_heating_and_cooling_seasons(runner)
clg_end_month = hvac_control.seasons_cooling_end_month
clg_end_day = hvac_control.seasons_cooling_end_day
- @heating_days = Schedule.get_daily_season(@hpxml_header.sim_calendar_year, htg_start_month, htg_start_day, htg_end_month, htg_end_day)
- @cooling_days = Schedule.get_daily_season(@hpxml_header.sim_calendar_year, clg_start_month, clg_start_day, clg_end_month, clg_end_day)
+ @heating_days = Calendar.get_daily_season(@hpxml_header.sim_calendar_year, htg_start_month, htg_start_day, htg_end_month, htg_end_day)
+ @cooling_days = Calendar.get_daily_season(@hpxml_header.sim_calendar_year, clg_start_month, clg_start_day, clg_end_month, clg_end_day)
if (htg_start_month != 1) || (htg_start_day != 1) || (htg_end_month != 12) || (htg_end_day != 31) || (clg_start_month != 1) || (clg_start_day != 1) || (clg_end_month != 12) || (clg_end_day != 31)
runner.registerWarning('It is not possible to eliminate all HVAC energy use (e.g. crankcase/defrost energy) in EnergyPlus outside of an HVAC season.')
diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml
index 6f76dd5772..addc7d3670 100644
--- a/HPXMLtoOpenStudio/measure.xml
+++ b/HPXMLtoOpenStudio/measure.xml
@@ -3,8 +3,8 @@
3.1
hpxm_lto_openstudio
b1543b30-9465-45ff-ba04-1d1f85e763bc
- fb3b36e4-8a02-482b-a9aa-38e2a786806d
- 2024-08-21T18:55:47Z
+ 7321ba66-676f-4f45-9829-5507f160b9be
+ 2024-08-21T22:48:41Z
D8922A73
HPXMLtoOpenStudio
HPXML to OpenStudio Translator
@@ -183,31 +183,37 @@
measure.rb
rb
script
- EA01360F
+ 38982B5D
airflow.rb
rb
resource
- 05F43EF2
+ 6D51E306
battery.rb
rb
resource
- 6434EF2B
+ 520825A4
+
+
+ calendar.rb
+ rb
+ resource
+ E9D39EDE
constants.rb
rb
resource
- 94A0E72F
+ 0D8F1C4A
constructions.rb
rb
resource
- 79CD24DB
+ 7C326501
data/Xing_okstate_0664D_13659_Table_A-3.csv
@@ -327,7 +333,7 @@
energyplus.rb
rb
resource
- 690DBF72
+ D01BA3EF
generator.rb
@@ -339,25 +345,25 @@
geometry.rb
rb
resource
- 792F5D7C
+ D4DA7927
hotwater_appliances.rb
rb
resource
- 66CA9ADE
+ 36092007
hpxml.rb
rb
resource
- ACE854BB
+ 84AE64ED
hpxml_defaults.rb
rb
resource
- 8612507E
+ 9F57A47A
hpxml_schema/HPXML.xsd
@@ -387,19 +393,19 @@
hvac.rb
rb
resource
- 0AA28826
+ 64AEF468
hvac_sizing.rb
rb
resource
- FFC7B0E0
+ 35FCD771
lighting.rb
rb
resource
- 4F32AFD6
+ 65744C8E
location.rb
@@ -411,13 +417,13 @@
materials.rb
rb
resource
- 5E87EDAD
+ 0E69FBCE
math.rb
rb
resource
- 1BACCFF8
+ FEB72476
meta_measure.rb
@@ -435,13 +441,13 @@
misc_loads.rb
rb
resource
- 7E224297
+ D04D654F
output.rb
rb
resource
- 37D464E6
+ 1AF3410C
psychrometrics.rb
@@ -579,7 +585,7 @@
schedules.rb
rb
resource
- DBB82EE7
+ 0B74AC68
simcontrols.rb
@@ -603,7 +609,7 @@
utility_bills.rb
rb
resource
- C81B6427
+ 17195DD4
version.rb
@@ -615,13 +621,13 @@
waterheater.rb
rb
resource
- E3E0625C
+ 367FF6D6
weather.rb
rb
resource
- D15242A9
+ D8B07D1D
xmlhelper.rb
@@ -639,43 +645,43 @@
test_airflow.rb
rb
test
- 1204D4D0
+ B8A66D0B
test_battery.rb
rb
test
- 06598B29
+ 3DF46EDF
test_defaults.rb
rb
test
- 621257C3
+ 029FF7CE
test_enclosure.rb
rb
test
- 4D7C8F6E
+ 45F2A863
test_generator.rb
rb
test
- C4F6CF9B
+ 67DD47BA
test_hotwater_appliance.rb
rb
test
- 9F96C198
+ 1DF66ABD
test_hvac.rb
rb
test
- D4FEB694
+ 84D82F35
test_hvac_sizing.rb
@@ -687,55 +693,55 @@
test_lighting.rb
rb
test
- A15B8208
+ 9F945097
test_location.rb
rb
test
- B654FDD7
+ B8AA4C0B
test_miscloads.rb
rb
test
- 0135301B
+ 2BF1CFF1
test_pv.rb
rb
test
- DB1DEFCF
+ EC9BA2EB
test_schedules.rb
rb
test
- 08E3AAFF
+ A7DBC945
test_simcontrols.rb
rb
test
- 211EB384
+ 914A44BF
test_validation.rb
rb
test
- 51E564BC
+ 6EDC8C3A
test_water_heater.rb
rb
test
- 16B0EA4F
+ 3F35600F
test_weather.rb
rb
test
- F670B6D2
+ 995FE666
util.rb
diff --git a/HPXMLtoOpenStudio/resources/airflow.rb b/HPXMLtoOpenStudio/resources/airflow.rb
index de79bcd503..98bb6fbf5a 100644
--- a/HPXMLtoOpenStudio/resources/airflow.rb
+++ b/HPXMLtoOpenStudio/resources/airflow.rb
@@ -4,6 +4,8 @@
module Airflow
# Constants
InfilPressureExponent = 0.65
+ AssumedInsideTemp = 73.5 # (F)
+ Gravity = 32.174 # acceleration of gravity (ft/s2)
# TODO
#
@@ -139,7 +141,7 @@ def self.apply(model, runner, weather, spaces, hpxml_header, hpxml_bldg, cfa,
# Applies to natural ventilation, not HVAC equipment.
# Uses BAHSP cooling season, not user-specified cooling season (which may be, e.g., year-round).
_, default_cooling_months = HVAC.get_default_heating_and_cooling_seasons(weather, hpxml_bldg.latitude)
- clg_season_sch = MonthWeekdayWeekendSchedule.new(model, 'cooling season schedule', Array.new(24, 1), Array.new(24, 1), default_cooling_months, Constants.ScheduleTypeLimitsFraction)
+ clg_season_sch = MonthWeekdayWeekendSchedule.new(model, 'cooling season schedule', Array.new(24, 1), Array.new(24, 1), default_cooling_months, EPlus::ScheduleTypeLimitsFraction)
clg_ssn_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
clg_ssn_sensor.setName('cool_season')
clg_ssn_sensor.setKeyName(clg_season_sch.schedule.name.to_s)
@@ -199,7 +201,7 @@ def self.get_default_mech_vent_fan_power(vent_fan, eri_version)
elsif [HPXML::MechVentTypeERV, HPXML::MechVentTypeHRV].include? vent_fan.fan_type
return 1.00
elsif [HPXML::MechVentTypeCFIS].include? vent_fan.fan_type
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2022')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2022')
return 0.58
else
return 0.50
@@ -506,7 +508,7 @@ def self.apply_infiltration_to_unconditioned_space(model, space, ach, ela, c_w_S
if ach.to_f > 0
# Model ACH as a constant flow rate (typically used for below-grade spaces where wind is zero)
flow_rate = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(model)
- flow_rate.setName("#{Constants.ObjectNameInfiltration}|#{space.name}")
+ flow_rate.setName("#{Constants::ObjectTypeInfiltration}|#{space.name}")
flow_rate.setSchedule(model.alwaysOnDiscreteSchedule)
flow_rate.setAirChangesperHour(ach)
flow_rate.setSpace(space)
@@ -517,7 +519,7 @@ def self.apply_infiltration_to_unconditioned_space(model, space, ach, ela, c_w_S
elsif ela.to_f > 0
# Model ELA with stack/wind coefficients
leakage_area = OpenStudio::Model::SpaceInfiltrationEffectiveLeakageArea.new(model)
- leakage_area.setName("#{Constants.ObjectNameInfiltration}|#{space.name}")
+ leakage_area.setName("#{Constants::ObjectTypeInfiltration}|#{space.name}")
leakage_area.setSchedule(model.alwaysOnDiscreteSchedule)
leakage_area.setEffectiveAirLeakageArea(UnitConversions.convert(ela, 'ft^2', 'cm^2'))
leakage_area.setStackCoefficient(UnitConversions.convert(c_s_SG, 'ft^2/(s^2*R)', 'L^2/(s^2*cm^4*K)'))
@@ -575,10 +577,10 @@ def self.apply_natural_ventilation_and_whole_house_fan(model, site, vent_fans_wh
infil_volume, infil_height, unavailable_periods)
# NV Availability Schedule
- nv_avail_sch = create_nv_and_whf_avail_sch(model, Constants.ObjectNameNaturalVentilation, natvent_days_per_week, unavailable_periods)
+ nv_avail_sch = create_nv_and_whf_avail_sch(model, Constants::ObjectTypeNaturalVentilation, natvent_days_per_week, unavailable_periods)
nv_avail_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
- nv_avail_sensor.setName("#{Constants.ObjectNameNaturalVentilation} s")
+ nv_avail_sensor.setName("#{Constants::ObjectTypeNaturalVentilation} s")
nv_avail_sensor.setKeyName(nv_avail_sch.name.to_s)
# Availability Schedules paired with vent fan class
@@ -586,7 +588,7 @@ def self.apply_natural_ventilation_and_whole_house_fan(model, site, vent_fans_wh
whf_avail_sensors = {}
vent_fans_whf.each_with_index do |vent_whf, index|
whf_num_days_per_week = 7 # FUTURE: Expose via HPXML?
- obj_name = "#{Constants.ObjectNameWholeHouseFan} #{index}"
+ obj_name = "#{Constants::ObjectTypeWholeHouseFan} #{index}"
whf_unavailable_periods = Schedule.get_unavailable_periods(@runner, SchedulesFile::Columns[:WholeHouseFan].name, unavailable_periods)
whf_avail_sch = create_nv_and_whf_avail_sch(model, obj_name, whf_num_days_per_week, whf_unavailable_periods)
@@ -611,32 +613,32 @@ def self.apply_natural_ventilation_and_whole_house_fan(model, site, vent_fans_wh
# Actuators
nv_flow = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(model)
- nv_flow.setName(Constants.ObjectNameNaturalVentilation + ' flow')
+ nv_flow.setName(Constants::ObjectTypeNaturalVentilation + ' flow')
nv_flow.setSchedule(model.alwaysOnDiscreteSchedule)
nv_flow.setSpace(@conditioned_space)
nv_flow_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(nv_flow, *EPlus::EMSActuatorZoneInfiltrationFlowRate)
nv_flow_actuator.setName("#{nv_flow.name} act")
- nv_flow.additionalProperties.setFeature('ObjectType', Constants.ObjectNameNaturalVentilation)
+ nv_flow.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeNaturalVentilation)
whf_flow = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(model)
- whf_flow.setName(Constants.ObjectNameWholeHouseFan + ' flow')
+ whf_flow.setName(Constants::ObjectTypeWholeHouseFan + ' flow')
whf_flow.setSchedule(model.alwaysOnDiscreteSchedule)
whf_flow.setSpace(@conditioned_space)
whf_flow_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(whf_flow, *EPlus::EMSActuatorZoneInfiltrationFlowRate)
whf_flow_actuator.setName("#{whf_flow.name} act")
- whf_flow.additionalProperties.setFeature('ObjectType', Constants.ObjectNameWholeHouseFan)
+ whf_flow.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeWholeHouseFan)
# Electric Equipment (for whole house fan electricity consumption)
whf_equip_def = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
- whf_equip_def.setName(Constants.ObjectNameWholeHouseFan)
+ whf_equip_def.setName(Constants::ObjectTypeWholeHouseFan)
whf_equip = OpenStudio::Model::ElectricEquipment.new(whf_equip_def)
- whf_equip.setName(Constants.ObjectNameWholeHouseFan)
+ whf_equip.setName(Constants::ObjectTypeWholeHouseFan)
whf_equip.setSpace(@conditioned_space) # no heat gain, so assign the equipment to an arbitrary space
whf_equip_def.setFractionRadiant(0)
whf_equip_def.setFractionLatent(0)
whf_equip_def.setFractionLost(1)
whf_equip.setSchedule(model.alwaysOnDiscreteSchedule)
- whf_equip.setEndUseSubcategory(Constants.ObjectNameWholeHouseFan)
+ whf_equip.setEndUseSubcategory(Constants::ObjectTypeWholeHouseFan)
whf_elec_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(whf_equip, *EPlus::EMSActuatorElectricEquipmentPower, whf_equip.space.get)
whf_elec_actuator.setName("#{whf_equip.name} act")
@@ -650,7 +652,7 @@ def self.apply_natural_ventilation_and_whole_house_fan(model, site, vent_fans_wh
if not whf_zone.nil?
# Air from conditioned space to WHF zone (attic)
zone_mixing = OpenStudio::Model::ZoneMixing.new(whf_zone)
- zone_mixing.setName("#{Constants.ObjectNameWholeHouseFan} mix")
+ zone_mixing.setName("#{Constants::ObjectTypeWholeHouseFan} mix")
zone_mixing.setSourceZone(@conditioned_zone)
cond_to_zone_flow_rate_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(zone_mixing, *EPlus::EMSActuatorZoneMixingFlowRate)
cond_to_zone_flow_rate_actuator.setName("#{zone_mixing.name} act")
@@ -666,8 +668,8 @@ def self.apply_natural_ventilation_and_whole_house_fan(model, site, vent_fans_wh
# Program
vent_program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
- vent_program.additionalProperties.setFeature('ObjectType', Constants.ObjectNameNaturalVentilation)
- vent_program.setName(Constants.ObjectNameNaturalVentilation + ' program')
+ vent_program.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeNaturalVentilation)
+ vent_program.setName(Constants::ObjectTypeNaturalVentilation + ' program')
vent_program.addLine("Set Tin = #{@tin_sensor.name}")
vent_program.addLine("Set Tout = #{@tout_sensor.name}")
vent_program.addLine("Set Wout = #{@wout_sensor.name}")
@@ -745,8 +747,8 @@ def self.apply_natural_ventilation_and_whole_house_fan(model, site, vent_fans_wh
# EMS global variables for output reporting
q_nv_var = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "#{vent_program.name}_Qnv")
q_whf_var = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "#{vent_program.name}_Qwhf")
- q_nv_var.additionalProperties.setFeature('ObjectType', Constants.ObjectNameNaturalVentilation)
- q_whf_var.additionalProperties.setFeature('ObjectType', Constants.ObjectNameWholeHouseFan)
+ q_nv_var.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeNaturalVentilation)
+ q_whf_var.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeWholeHouseFan)
vent_program.addLine("Set #{q_nv_var.name} = Qnv")
vent_program.addLine("Set #{q_whf_var.name} = Qwhf")
end
@@ -763,7 +765,7 @@ def self.create_nv_and_whf_avail_sch(model, obj_name, num_days_per_week, unavail
sch_name = "#{obj_name} schedule"
avail_sch.setName(sch_name)
avail_sch.defaultDaySchedule.setName("#{sch_name} default day")
- Schedule.set_schedule_type_limits(model, avail_sch, Constants.ScheduleTypeLimitsOnOff)
+ Schedule.set_schedule_type_limits(model, avail_sch, EPlus::ScheduleTypeLimitsOnOff)
on_rule = OpenStudio::Model::ScheduleRule.new(avail_sch)
on_rule.setName("#{sch_name} rule")
on_rule_day = on_rule.daySchedule
@@ -818,9 +820,9 @@ def self.create_return_air_duct_zone(model, loop_name, unit_multiplier)
end
surface.setConstruction(@adiabatic_const)
- surface.setOutsideBoundaryCondition('Adiabatic')
- surface.setSunExposure('NoSun')
- surface.setWindExposure('NoWind')
+ surface.setOutsideBoundaryCondition(EPlus::BoundaryConditionAdiabatic)
+ surface.setSunExposure(EPlus::SurfaceSunExposureNo)
+ surface.setWindExposure(EPlus::SurfaceWindExposureNo)
surface_property_convection_coefficients = OpenStudio::Model::SurfacePropertyConvectionCoefficients.new(surface)
surface_property_convection_coefficients.setConvectionCoefficient1Location('Inside')
surface_property_convection_coefficients.setConvectionCoefficient1Type('Value')
@@ -837,7 +839,7 @@ def self.create_return_air_duct_zone(model, loop_name, unit_multiplier)
# @param space [OpenStudio::Model::Space] an OpenStudio::Model::Space object
# @param frac_lat [TODO] TODO
# @param frac_lost [TODO] TODO
- # @param hpxml_fuel_type [TODO] TODO
+ # @param hpxml_fuel_type [String] HPXML fuel type (HPXML::FuelTypeXXX)
# @param end_use [TODO] TODO
# @return [TODO] TODO
def self.create_other_equipment_object_and_actuator(model:, name:, space:, frac_lat:, frac_lost:, hpxml_fuel_type: nil, end_use: nil)
@@ -845,11 +847,7 @@ def self.create_other_equipment_object_and_actuator(model:, name:, space:, frac_
other_equip_def.setName("#{name} equip")
other_equip = OpenStudio::Model::OtherEquipment.new(other_equip_def)
other_equip.setName(other_equip_def.name.to_s)
- if hpxml_fuel_type.nil?
- other_equip.setFuelType('None')
- else
- other_equip.setFuelType(EPlus.fuel_type(hpxml_fuel_type))
- end
+ other_equip.setFuelType(EPlus.fuel_type(hpxml_fuel_type))
if not end_use.nil?
other_equip.setEndUseSubcategory(end_use)
end
@@ -890,12 +888,12 @@ def self.initialize_cfis(model, vent_fans_mech, airloop_map, unavailable_periods
@cfis_airloop[vent_mech.id] = airloop_map[cfis_id]
end
- @cfis_t_sum_open_var[vent_mech.id] = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "#{Constants.ObjectNameMechanicalVentilation.gsub(' ', '_')}_cfis_t_sum_open_#{index}") # Sums the time during an hour the CFIS damper has been open
- @cfis_f_damper_extra_open_var[vent_mech.id] = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "#{Constants.ObjectNameMechanicalVentilation.gsub(' ', '_')}_cfis_f_extra_damper_open_#{index}") # Fraction of timestep the CFIS blower is running while hvac is not operating. Used by infiltration and duct leakage programs
+ @cfis_t_sum_open_var[vent_mech.id] = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "#{Constants::ObjectTypeMechanicalVentilation.gsub(' ', '_')}_cfis_t_sum_open_#{index}") # Sums the time during an hour the CFIS damper has been open
+ @cfis_f_damper_extra_open_var[vent_mech.id] = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "#{Constants::ObjectTypeMechanicalVentilation.gsub(' ', '_')}_cfis_f_extra_damper_open_#{index}") # Fraction of timestep the CFIS blower is running while hvac is not operating. Used by infiltration and duct leakage programs
# CFIS Initialization Program
cfis_program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
- cfis_program.setName(Constants.ObjectNameMechanicalVentilation + " cfis init program #{index}")
+ cfis_program.setName(Constants::ObjectTypeMechanicalVentilation + " cfis init program #{index}")
cfis_program.addLine("Set #{@cfis_t_sum_open_var[vent_mech.id].name} = 0")
cfis_program.addLine("Set #{@cfis_f_damper_extra_open_var[vent_mech.id].name} = 0")
@@ -1133,20 +1131,20 @@ def self.apply_ducts(model, ducts, object, vent_fans_mech, unit_multiplier, duct
end
# Other equipment objects to cancel out the supply air leakage directly into the return plenum
- equip_act_infos << ['supply_sens_lk_to_cond', 'SupSensLkToCond', Constants.ObjectNameDuctLoad, @conditioned_space, 0.0, f_regain]
- equip_act_infos << ['supply_lat_lk_to_cond', 'SupLatLkToCond', Constants.ObjectNameDuctLoad, @conditioned_space, 1.0 - f_regain, f_regain]
+ equip_act_infos << ['supply_sens_lk_to_cond', 'SupSensLkToCond', Constants::ObjectTypeDuctLoad, @conditioned_space, 0.0, f_regain]
+ equip_act_infos << ['supply_lat_lk_to_cond', 'SupLatLkToCond', Constants::ObjectTypeDuctLoad, @conditioned_space, 1.0 - f_regain, f_regain]
# Supply duct conduction load added to the conditioned space
- equip_act_infos << ['supply_cond_to_cond', 'SupCondToLv', Constants.ObjectNameDuctLoad, @conditioned_space, 0.0, f_regain]
+ equip_act_infos << ['supply_cond_to_cond', 'SupCondToLv', Constants::ObjectTypeDuctLoad, @conditioned_space, 0.0, f_regain]
# Return duct conduction load added to the return plenum zone
- equip_act_infos << ['return_cond_to_rp', 'RetCondToRP', Constants.ObjectNameDuctLoad, ra_duct_space, 0.0, f_regain]
+ equip_act_infos << ['return_cond_to_rp', 'RetCondToRP', Constants::ObjectTypeDuctLoad, ra_duct_space, 0.0, f_regain]
# Return duct sensible leakage impact on the return plenum
- equip_act_infos << ['return_sens_lk_to_rp', 'RetSensLkToRP', Constants.ObjectNameDuctLoad, ra_duct_space, 0.0, f_regain]
+ equip_act_infos << ['return_sens_lk_to_rp', 'RetSensLkToRP', Constants::ObjectTypeDuctLoad, ra_duct_space, 0.0, f_regain]
# Return duct latent leakage impact on the return plenum
- equip_act_infos << ['return_lat_lk_to_rp', 'RetLatLkToRP', Constants.ObjectNameDuctLoad, ra_duct_space, 1.0 - f_regain, f_regain]
+ equip_act_infos << ['return_lat_lk_to_rp', 'RetLatLkToRP', Constants::ObjectTypeDuctLoad, ra_duct_space, 1.0 - f_regain, f_regain]
# Supply duct conduction impact on the duct zone
if not duct_location.is_a? OpenStudio::Model::ThermalZone # Outside or scheduled temperature
@@ -1241,7 +1239,7 @@ def self.apply_ducts(model, ducts, object, vent_fans_mech, unit_multiplier, duct
zone_mixing.setSourceZone(source_zone)
duct_actuators[var_name] = OpenStudio::Model::EnergyManagementSystemActuator.new(zone_mixing, *EPlus::EMSActuatorZoneMixingFlowRate)
duct_actuators[var_name].setName("#{zone_mixing.name} act")
- zone_mixing.additionalProperties.setFeature('ObjectType', Constants.ObjectNameDuctLoad)
+ zone_mixing.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeDuctLoad)
end
end
@@ -1674,7 +1672,7 @@ def self.apply_local_ventilation(model, vent_object, obj_type_name, index, unava
end
remaining_hrs -= 1
end
- obj_sch = HourlyByMonthSchedule.new(model, "#{obj_name} schedule", [daily_sch] * 12, [daily_sch] * 12, Constants.ScheduleTypeLimitsFraction, false, unavailable_periods: unavailable_periods)
+ obj_sch = HourlyByMonthSchedule.new(model, "#{obj_name} schedule", [daily_sch] * 12, [daily_sch] * 12, EPlus::ScheduleTypeLimitsFraction, false, unavailable_periods: unavailable_periods)
obj_sch_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
obj_sch_sensor.setName("#{obj_name} sch s")
obj_sch_sensor.setKeyName(obj_sch.schedule.name.to_s)
@@ -1689,7 +1687,7 @@ def self.apply_local_ventilation(model, vent_object, obj_type_name, index, unava
equip_def.setFractionLatent(0)
equip_def.setFractionLost(1)
equip.setSchedule(obj_sch.schedule)
- equip.setEndUseSubcategory(Constants.ObjectNameMechanicalVentilation)
+ equip.setEndUseSubcategory(Constants::ObjectTypeMechanicalVentilation)
return obj_sch_sensor
end
@@ -1703,7 +1701,7 @@ def self.apply_local_ventilation(model, vent_object, obj_type_name, index, unava
# @param unavailable_periods [HPXML::UnavailablePeriods] Object that defines periods for, e.g., power outages or vacancies
# @return [TODO] TODO
def self.apply_dryer_exhaust(model, vented_dryer, schedules_file, index, unavailable_periods)
- obj_name = "#{Constants.ObjectNameClothesDryer} exhaust #{index}"
+ obj_name = "#{Constants::ObjectTypeClothesDryer} exhaust #{index}"
# Create schedule
obj_sch = nil
@@ -1716,7 +1714,7 @@ def self.apply_dryer_exhaust(model, vented_dryer, schedules_file, index, unavail
cd_weekday_sch = vented_dryer.weekday_fractions
cd_weekend_sch = vented_dryer.weekend_fractions
cd_monthly_sch = vented_dryer.monthly_multipliers
- obj_sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', cd_weekday_sch, cd_weekend_sch, cd_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: unavailable_periods)
+ obj_sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', cd_weekday_sch, cd_weekend_sch, cd_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: unavailable_periods)
obj_sch = obj_sch.schedule
obj_sch_name = obj_sch.name.to_s
full_load_hrs = Schedule.annual_equivalent_full_load_hrs(@year, obj_sch)
@@ -1729,7 +1727,7 @@ def self.apply_dryer_exhaust(model, vented_dryer, schedules_file, index, unavail
return obj_sch_sensor, 0 if full_load_hrs == 0
# Assume standard dryer exhaust runs 1 hr/day per BA HSP
- cfm_mult = Constants.NumDaysInYear(@year) * vented_dryer.usage_multiplier / full_load_hrs
+ cfm_mult = Calendar.num_days_in_year(@year) * vented_dryer.usage_multiplier / full_load_hrs
return obj_sch_sensor, cfm_mult
end
@@ -1926,11 +1924,11 @@ def self.add_ee_for_vent_fan_power(model, obj_name, sup_fans = [], exh_fans = []
# Calculate fan heat fraction
# 1.0: Fan heat does not enter space (e.g., exhaust)
# 0.0: Fan heat does enter space (e.g., supply)
- if obj_name == Constants.ObjectNameMechanicalVentilationHouseFanCFIS
+ if obj_name == Constants::ObjectTypeMechanicalVentilationHouseFanCFIS
fan_heat_lost_fraction = 0.0
else
# Calculate total fan power
- if obj_name == Constants.ObjectNameMechanicalVentilationHouseFanCFISSupplFan
+ if obj_name == Constants::ObjectTypeMechanicalVentilationHouseFanCFISSupplFan
sup_fans_w = sup_fans.map { |f| f.unit_fan_power }.sum(0.0)
exh_fans_w = exh_fans.map { |f| f.unit_fan_power }.sum(0.0)
bal_fans_w = (bal_fans + erv_hrv_fans).map { |f| f.unit_fan_power }.sum(0.0)
@@ -1950,7 +1948,7 @@ def self.add_ee_for_vent_fan_power(model, obj_name, sup_fans = [], exh_fans = []
end
# Availability Schedule
- avail_sch = ScheduleConstant.new(model, obj_name + ' schedule', 1.0, Constants.ScheduleTypeLimitsFraction, unavailable_periods: unavailable_periods)
+ avail_sch = ScheduleConstant.new(model, obj_name + ' schedule', 1.0, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: unavailable_periods)
avail_sch = avail_sch.schedule
equip_def = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
@@ -1961,11 +1959,11 @@ def self.add_ee_for_vent_fan_power(model, obj_name, sup_fans = [], exh_fans = []
equip_def.setFractionRadiant(0)
equip_def.setFractionLatent(0)
equip.setSchedule(avail_sch)
- equip.setEndUseSubcategory(Constants.ObjectNameMechanicalVentilation)
+ equip.setEndUseSubcategory(Constants::ObjectTypeMechanicalVentilation)
equip_def.setFractionLost(fan_heat_lost_fraction)
equip_actuator = nil
- if [Constants.ObjectNameMechanicalVentilationHouseFanCFIS,
- Constants.ObjectNameMechanicalVentilationHouseFanCFISSupplFan].include? obj_name # actuate its power level in EMS
+ if [Constants::ObjectTypeMechanicalVentilationHouseFanCFIS,
+ Constants::ObjectTypeMechanicalVentilationHouseFanCFISSupplFan].include? obj_name # actuate its power level in EMS
equip_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(equip, *EPlus::EMSActuatorElectricEquipmentPower, equip.space.get)
equip_actuator.setName("#{equip.name} act")
end
@@ -1983,10 +1981,10 @@ def self.add_ee_for_vent_fan_power(model, obj_name, sup_fans = [], exh_fans = []
# @return [TODO] TODO
def self.setup_mech_vent_vars_actuators(model:, program:)
# Actuators for mech vent fan
- sens_name = "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load"
- fan_sens_load_actuator = create_other_equipment_object_and_actuator(model: model, name: sens_name, space: @conditioned_space, frac_lat: 0.0, frac_lost: 0.0, end_use: Constants.ObjectNameMechanicalVentilationHouseFan)
- lat_name = "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load"
- fan_lat_load_actuator = create_other_equipment_object_and_actuator(model: model, name: lat_name, space: @conditioned_space, frac_lat: 1.0, frac_lost: 0.0, end_use: Constants.ObjectNameMechanicalVentilationHouseFan)
+ sens_name = "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load"
+ fan_sens_load_actuator = create_other_equipment_object_and_actuator(model: model, name: sens_name, space: @conditioned_space, frac_lat: 0.0, frac_lost: 0.0, end_use: Constants::ObjectTypeMechanicalVentilationHouseFan)
+ lat_name = "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load"
+ fan_lat_load_actuator = create_other_equipment_object_and_actuator(model: model, name: lat_name, space: @conditioned_space, frac_lat: 1.0, frac_lost: 0.0, end_use: Constants::ObjectTypeMechanicalVentilationHouseFan)
program.addLine("Set #{fan_sens_load_actuator.name} = 0.0")
program.addLine("Set #{fan_lat_load_actuator.name} = 0.0")
# Air property at inlet nodes on both sides
@@ -2034,7 +2032,7 @@ def self.apply_infiltration_adjustment_to_conditioned(model, infil_program, vent
vent_fans_kitchen.each_with_index do |vent_kitchen, index|
# Electricity impact
vent_kitchen_unavailable_periods = Schedule.get_unavailable_periods(@runner, SchedulesFile::Columns[:KitchenFan].name, unavailable_periods)
- obj_sch_sensor = apply_local_ventilation(model, vent_kitchen, Constants.ObjectNameMechanicalVentilationRangeFan, index, vent_kitchen_unavailable_periods)
+ obj_sch_sensor = apply_local_ventilation(model, vent_kitchen, Constants::ObjectTypeMechanicalVentilationRangeFan, index, vent_kitchen_unavailable_periods)
next unless @cooking_range_in_cond_space
# Infiltration impact
@@ -2045,7 +2043,7 @@ def self.apply_infiltration_adjustment_to_conditioned(model, infil_program, vent
vent_fans_bath.each_with_index do |vent_bath, index|
# Electricity impact
vent_bath_unavailable_periods = Schedule.get_unavailable_periods(@runner, SchedulesFile::Columns[:BathFan].name, unavailable_periods)
- obj_sch_sensor = apply_local_ventilation(model, vent_bath, Constants.ObjectNameMechanicalVentilationBathFan, index, vent_bath_unavailable_periods)
+ obj_sch_sensor = apply_local_ventilation(model, vent_bath, Constants::ObjectTypeMechanicalVentilationBathFan, index, vent_bath_unavailable_periods)
# Infiltration impact
infil_program.addLine("Set Qbath = Qbath + #{UnitConversions.convert(vent_bath.flow_rate * vent_bath.count, 'cfm', 'm^3/s').round(5)} * #{obj_sch_sensor.name}")
end
@@ -2085,14 +2083,14 @@ def self.apply_infiltration_adjustment_to_conditioned(model, infil_program, vent
infil_program.addLine('Set Qfan_with_ducts = (@Max Qexhaust Qsupply)')
# Total combined air exchange
- if Constants.ERIVersions.index(@eri_version) >= Constants.ERIVersions.index('2022')
+ if Constants::ERIVersions.index(@eri_version) >= Constants::ERIVersions.index('2022')
infil_program.addLine('Set Qimb = (@Abs (Qsupply - Qexhaust))')
infil_program.addLine('If Qinf + Qimb > 0')
infil_program.addLine(' Set Qtot = Qfan_with_ducts + (Qinf^2) / (Qinf + Qimb)')
infil_program.addLine('Else')
infil_program.addLine(' Set Qtot = Qfan_with_ducts')
infil_program.addLine('EndIf')
- elsif Constants.ERIVersions.index(@eri_version) >= Constants.ERIVersions.index('2019')
+ elsif Constants::ERIVersions.index(@eri_version) >= Constants::ERIVersions.index('2019')
# Follow ASHRAE 62.2-2016, Normative Appendix C equations for time-varying total airflow
infil_program.addLine('If Qfan_with_ducts > 0')
# Balanced system if the total supply airflow and total exhaust airflow are within 10% of their average.
@@ -2119,8 +2117,8 @@ def self.apply_infiltration_adjustment_to_conditioned(model, infil_program, vent
# EMS global variables for output reporting
q_inf_var = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "#{infil_program.name}_Qinf")
q_fan_var = OpenStudio::Model::EnergyManagementSystemGlobalVariable.new(model, "#{infil_program.name}_Qfan")
- q_inf_var.additionalProperties.setFeature('ObjectType', Constants.ObjectNameInfiltration)
- q_fan_var.additionalProperties.setFeature('ObjectType', Constants.ObjectNameMechanicalVentilation)
+ q_inf_var.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeInfiltration)
+ q_fan_var.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeMechanicalVentilation)
infil_program.addLine("Set #{q_inf_var.name} = Qinf_adj")
infil_program.addLine("Set #{q_fan_var.name} = Qfan")
end
@@ -2209,8 +2207,8 @@ def self.calculate_precond_loads(model, infil_program, vent_mech_preheat, vent_m
end
vent_mech_preheat.each_with_index do |f_preheat, i|
infil_program.addLine("If (OASupInTemp < HtgStp) && (#{clg_ssn_sensor.name} < 1)")
- cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants.ObjectNameMechanicalVentilationPreheating }.size # Ensure unique meter for each preheating system
- htg_energy_actuator = create_other_equipment_object_and_actuator(model: model, name: "shared mech vent preheating energy #{i}", space: @conditioned_space, frac_lat: 0.0, frac_lost: 1.0, hpxml_fuel_type: f_preheat.preheating_fuel, end_use: "#{Constants.ObjectNameMechanicalVentilationPreheating}#{cnt + 1}")
+ cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeMechanicalVentilationPreheating }.size # Ensure unique meter for each preheating system
+ htg_energy_actuator = create_other_equipment_object_and_actuator(model: model, name: "shared mech vent preheating energy #{i}", space: @conditioned_space, frac_lat: 0.0, frac_lost: 1.0, hpxml_fuel_type: f_preheat.preheating_fuel, end_use: "#{Constants::ObjectTypeMechanicalVentilationPreheating}#{cnt + 1}")
htg_energy_actuator.actuatedComponent.get.additionalProperties.setFeature('HPXML_ID', f_preheat.id) # Used by reporting measure
infil_program.addLine(" Set Qpreheat = #{UnitConversions.convert(f_preheat.average_oa_unit_flow_rate, 'cfm', 'm^3/s').round(4)}")
if [HPXML::MechVentTypeERV, HPXML::MechVentTypeHRV].include? f_preheat.fan_type
@@ -2235,8 +2233,8 @@ def self.calculate_precond_loads(model, infil_program, vent_mech_preheat, vent_m
end
vent_mech_precool.each_with_index do |f_precool, i|
infil_program.addLine("If (OASupInTemp > ClgStp) && (#{clg_ssn_sensor.name} > 0)")
- cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants.ObjectNameMechanicalVentilationPrecooling }.size # Ensure unique meter for each precooling system
- clg_energy_actuator = create_other_equipment_object_and_actuator(model: model, name: "shared mech vent precooling energy #{i}", space: @conditioned_space, frac_lat: 0.0, frac_lost: 1.0, hpxml_fuel_type: f_precool.precooling_fuel, end_use: "#{Constants.ObjectNameMechanicalVentilationPrecooling}#{cnt + 1}")
+ cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeMechanicalVentilationPrecooling }.size # Ensure unique meter for each precooling system
+ clg_energy_actuator = create_other_equipment_object_and_actuator(model: model, name: "shared mech vent precooling energy #{i}", space: @conditioned_space, frac_lat: 0.0, frac_lost: 1.0, hpxml_fuel_type: f_precool.precooling_fuel, end_use: "#{Constants::ObjectTypeMechanicalVentilationPrecooling}#{cnt + 1}")
clg_energy_actuator.actuatedComponent.get.additionalProperties.setFeature('HPXML_ID', f_precool.id) # Used by reporting measure
infil_program.addLine(" Set Qprecool = #{UnitConversions.convert(f_precool.average_oa_unit_flow_rate, 'cfm', 'm^3/s').round(4)}")
if [HPXML::MechVentTypeERV, HPXML::MechVentTypeHRV].include? f_precool.fan_type
@@ -2297,17 +2295,17 @@ def self.apply_infiltration_ventilation_to_conditioned(model, site, vent_fans_me
# Non-CFIS fan power
house_fan_unavailable_periods = Schedule.get_unavailable_periods(@runner, SchedulesFile::Columns[:HouseFan].name, unavailable_periods)
- add_ee_for_vent_fan_power(model, Constants.ObjectNameMechanicalVentilationHouseFan,
+ add_ee_for_vent_fan_power(model, Constants::ObjectTypeMechanicalVentilationHouseFan,
vent_mech_sup_tot, vent_mech_exh_tot, vent_mech_bal_tot, vent_mech_erv_hrv_tot, house_fan_unavailable_periods)
# CFIS fan power
- cfis_fan_actuator = add_ee_for_vent_fan_power(model, Constants.ObjectNameMechanicalVentilationHouseFanCFIS) # Fan heat enters space
+ cfis_fan_actuator = add_ee_for_vent_fan_power(model, Constants::ObjectTypeMechanicalVentilationHouseFanCFIS) # Fan heat enters space
# CFIS supplemental fan power
if not vent_fans_cfis_suppl.empty?
vent_mech_cfis_suppl_sup_tot = vent_fans_cfis_suppl.select { |vent_mech| vent_mech.fan_type == HPXML::MechVentTypeSupply }
vent_mech_cfis_suppl_exh_tot = vent_fans_cfis_suppl.select { |vent_mech| vent_mech.fan_type == HPXML::MechVentTypeExhaust }
- cfis_suppl_fan_actuator = add_ee_for_vent_fan_power(model, Constants.ObjectNameMechanicalVentilationHouseFanCFISSupplFan,
+ cfis_suppl_fan_actuator = add_ee_for_vent_fan_power(model, Constants::ObjectTypeMechanicalVentilationHouseFanCFISSupplFan,
vent_mech_cfis_suppl_sup_tot, vent_mech_cfis_suppl_exh_tot)
else
cfis_suppl_fan_actuator = nil
@@ -2317,17 +2315,17 @@ def self.apply_infiltration_ventilation_to_conditioned(model, site, vent_fans_me
hrv_erv_effectiveness_map = calc_hrv_erv_effectiveness(vent_mech_erv_hrv_tot)
infil_flow = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(model)
- infil_flow.setName(Constants.ObjectNameInfiltration + ' flow')
+ infil_flow.setName(Constants::ObjectTypeInfiltration + ' flow')
infil_flow.setSchedule(model.alwaysOnDiscreteSchedule)
infil_flow.setSpace(@conditioned_space)
infil_flow_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(infil_flow, *EPlus::EMSActuatorZoneInfiltrationFlowRate)
infil_flow_actuator.setName("#{infil_flow.name} act")
- infil_flow.additionalProperties.setFeature('ObjectType', Constants.ObjectNameInfiltration)
+ infil_flow.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeInfiltration)
# Conditioned Space Infiltration Calculation/Program
infil_program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
- infil_program.additionalProperties.setFeature('ObjectType', Constants.ObjectNameInfiltration)
- infil_program.setName(Constants.ObjectNameInfiltration + ' program')
+ infil_program.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeInfiltration)
+ infil_program.setName(Constants::ObjectTypeInfiltration + ' program')
# Calculate infiltration without adjustment by ventilation
apply_infiltration_to_conditioned(site, conditioned_ach50, conditioned_const_ach, infil_program, weather, has_flue_chimney_in_cond_space, infil_volume, infil_height, elevation)
@@ -2480,7 +2478,7 @@ def self.apply_infiltration_to_conditioned(site, conditioned_ach50, conditioned_
f_i = 0.0 # Additive flue function (eq. 12)
end
f_s = ((1.0 + n_i * r_i) / (n_i + 1.0)) * (0.5 - 0.5 * m_i**1.2)**(n_i + 1.0) + f_i
- stack_coef = f_s * (UnitConversions.convert(outside_air_density * Constants.g * infil_height, 'lbm/(ft*s^2)', 'inH2O') / UnitConversions.convert(Constants.AssumedInsideTemp, 'F', 'R'))**n_i # inH2O^n/R^n
+ stack_coef = f_s * (UnitConversions.convert(outside_air_density * Gravity * infil_height, 'lbm/(ft*s^2)', 'inH2O') / UnitConversions.convert(AssumedInsideTemp, 'F', 'R'))**n_i # inH2O^n/R^n
# Calculate wind coefficient
if not @spaces[HPXML::LocationCrawlspaceVented].nil?
@@ -2541,7 +2539,7 @@ def self.calc_wind_stack_coeffs(site, hor_lk_frac, neutral_level, space, space_h
f_t_SG = site_ap.site_terrain_multiplier * ((space_height + coord_z) / 32.8)**site_ap.site_terrain_exponent / (site_ap.terrain_multiplier * (site_ap.height / 32.8)**site_ap.terrain_exponent)
f_s_SG = 2.0 / 3.0 * (1 + hor_lk_frac / 2.0) * (2.0 * neutral_level * (1.0 - neutral_level))**0.5 / (neutral_level**0.5 + (1.0 - neutral_level)**0.5)
f_w_SG = site_ap.s_g_shielding_coef * (1.0 - hor_lk_frac)**(1.0 / 3.0) * f_t_SG
- c_s_SG = f_s_SG**2.0 * Constants.g * space_height / UnitConversions.convert(Constants.AssumedInsideTemp, 'F', 'R')
+ c_s_SG = f_s_SG**2.0 * Gravity * space_height / UnitConversions.convert(AssumedInsideTemp, 'F', 'R')
c_w_SG = f_w_SG**2.0
return c_w_SG, c_s_SG
end
@@ -2719,7 +2717,7 @@ def self.get_mech_vent_qtot_cfm(nbeds, cfa)
# @return [TODO] TODO
def self.get_mech_vent_qfan_cfm(q_tot, q_inf, is_balanced, frac_imbal, a_ext, bldg_type, eri_version, hours_in_operation)
q_inf_eff = q_inf * a_ext
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2022')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2022')
if frac_imbal == 0
q_fan = q_tot - q_inf_eff
else
@@ -2730,7 +2728,7 @@ def self.get_mech_vent_qfan_cfm(q_tot, q_inf, is_balanced, frac_imbal, a_ext, bl
q_fan = ((frac_imbal**2.0 * q_tot**2.0 - 4.0 * frac_imbal * q_inf_eff**2.0 + 2.0 * frac_imbal * q_inf_eff * q_tot + q_inf_eff**2.0)**0.5 + frac_imbal * q_tot - q_inf_eff) / (2.0 * frac_imbal)
end
end
- elsif Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2019')
+ elsif Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2019')
if is_balanced
phi = 1.0
else
diff --git a/HPXMLtoOpenStudio/resources/battery.rb b/HPXMLtoOpenStudio/resources/battery.rb
index 625073beee..2ff2a16938 100644
--- a/HPXMLtoOpenStudio/resources/battery.rb
+++ b/HPXMLtoOpenStudio/resources/battery.rb
@@ -166,7 +166,7 @@ def self.apply(runner, model, nbeds, pv_systems, battery, schedules_file, unit_m
loss_adj_object_def = OpenStudio::Model::OtherEquipmentDefinition.new(model)
loss_adj_object = OpenStudio::Model::OtherEquipment.new(loss_adj_object_def)
- obj_name = Constants.ObjectNameBatteryLossesAdjustment
+ obj_name = Constants::ObjectTypeBatteryLossesAdjustment
loss_adj_object.setName(obj_name)
loss_adj_object.setEndUseSubcategory(obj_name)
loss_adj_object.setFuelType(EPlus.fuel_type(HPXML::FuelTypeElectricity))
@@ -177,7 +177,7 @@ def self.apply(runner, model, nbeds, pv_systems, battery, schedules_file, unit_m
loss_adj_object_def.setFractionLatent(0)
loss_adj_object_def.setFractionLost(frac_lost)
loss_adj_object.setSchedule(model.alwaysOnDiscreteSchedule)
- loss_adj_object.additionalProperties.setFeature('ObjectType', Constants.ObjectNameBatteryLossesAdjustment)
+ loss_adj_object.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeBatteryLossesAdjustment)
battery_adj_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(loss_adj_object, *EPlus::EMSActuatorOtherEquipmentPower, loss_adj_object.space.get)
battery_adj_actuator.setName('battery loss_adj_act')
diff --git a/HPXMLtoOpenStudio/resources/calendar.rb b/HPXMLtoOpenStudio/resources/calendar.rb
new file mode 100644
index 0000000000..f868557b2f
--- /dev/null
+++ b/HPXMLtoOpenStudio/resources/calendar.rb
@@ -0,0 +1,166 @@
+# frozen_string_literal: true
+
+# Collection of helper methods related to calendar dates/time.
+module Calendar
+ # Returns the number of days in each month of the specified calendar year.
+ #
+ # @param year [Integer] the calendar year
+ # @return [Array] number of days in each month
+ def self.num_days_in_months(year)
+ n_days_in_months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+ n_days_in_months[1] += 1 if Date.leap?(year)
+ return n_days_in_months
+ end
+
+ # Returns the number of days in the specified calendar year.
+ #
+ # @param year [Integer] the calendar year
+ # @return [Integer] number of days in the calendar year
+ def self.num_days_in_year(year)
+ n_days_in_months = num_days_in_months(year)
+ n_days_in_year = n_days_in_months.sum
+ return n_days_in_year
+ end
+
+ # Returns the number of hours in the specified calendar year.
+ #
+ # @param year [Integer] the calendar year
+ # @return [Integer] number of hours in the calendar year
+ def self.num_hours_in_year(year)
+ n_days_in_year = num_days_in_year(year)
+ n_hours_in_year = n_days_in_year * 24
+ return n_hours_in_year
+ end
+
+ # Returns a value between 1 and 365 (or 366 for a leap year).
+ # Returns e.g. 32 for month=2 and day=1 (Feb 1).
+ #
+ # @param year [Integer] the calendar year
+ # @param month [Integer] the month of the year
+ # @param day [Integer] the day of the month
+ # @return [Integer] the day number of the year
+ def self.get_day_num_from_month_day(year, month, day)
+ month_num_days = Calendar.num_days_in_months(year)
+ day_num = day
+ for m in 0..month - 2
+ day_num += month_num_days[m]
+ end
+ return day_num
+ end
+
+ # Returns an array of 365 (or 366 for a leap year) values of 0s and 1s that define a daily season.
+ #
+ # @param year [Integer] the calendar year
+ # @param start_month [Integer] the start month of the year
+ # @param start_day [Integer] the start day of the start month
+ # @param end_month [Integer] the end month of the year
+ # @param end_day [Integer] the end day of the end month
+ # @return [Array] 1s ranging from start month/day to end month/day, and 0s outside of this range
+ def self.get_daily_season(year, start_month, start_day, end_month, end_day)
+ start_day_num = get_day_num_from_month_day(year, start_month, start_day)
+ end_day_num = get_day_num_from_month_day(year, end_month, end_day)
+
+ season = Array.new(Calendar.num_days_in_year(year), 0)
+ if end_day_num >= start_day_num
+ season.fill(1, start_day_num - 1, end_day_num - start_day_num + 1) # Fill between start/end days
+ else # Wrap around year
+ season.fill(1, start_day_num - 1) # Fill between start day and end of year
+ season.fill(1, 0, end_day_num) # Fill between start of year and end day
+ end
+ return season
+ end
+
+ # Convert a 12-element monthly array of 1s and 0s to a 365-element (or 366-element for a leap year) daily array of 1s and 0s.
+ #
+ # @param year [Integer] the calendar year
+ # @param months [Array] monthly array of 1s and 0s
+ # @return [Array] daily array of 1s and 0s
+ def self.months_to_days(year, months)
+ month_num_days = Calendar.num_days_in_months(year)
+ days = []
+ for m in 0..11
+ days.concat([months[m]] * month_num_days[m])
+ end
+
+ return days
+ end
+
+ # Returns a 12-element array of day numbers of the year corresponding to the first days of each month.
+ #
+ # @param year [Integer] the calendar year
+ # @return [Array] day number of the year for the first day of each month
+ def self.day_start_months(year)
+ month_num_days = Calendar.num_days_in_months(year)
+ return month_num_days.each_with_index.map { |_n, i| get_day_num_from_month_day(year, i + 1, 1) }
+ end
+
+ # Returns a 12-element array of day numbers of the year corresponding to the last days of each month.
+ #
+ # @param year [Integer] the calendar year
+ # @return [Array] day number of the year for the last day of each month
+ def self.day_end_months(year)
+ month_num_days = Calendar.num_days_in_months(year)
+ return month_num_days.each_with_index.map { |n, i| get_day_num_from_month_day(year, i + 1, n) }
+ end
+
+ # Return begin month/day/hour and end month/day/hour integers based on a string datetime range.
+ #
+ # @param date_time_range [String] a date like 'Jan 1 - Dec 31' (optionally can enter hour like 'Dec 15 2 - Jan 15 20')
+ # @return [Array] begin/end month/day/hour
+ def self.parse_date_time_range(date_time_range)
+ begin_end_dates = date_time_range.split('-').map { |v| v.strip }
+ if begin_end_dates.size != 2
+ fail "Invalid date format specified for '#{date_time_range}'."
+ end
+
+ begin_values = begin_end_dates[0].split(' ').map { |v| v.strip }
+ end_values = begin_end_dates[1].split(' ').map { |v| v.strip }
+
+ if !(begin_values.size == 2 || begin_values.size == 3) || !(end_values.size == 2 || end_values.size == 3)
+ fail "Invalid date format specified for '#{date_time_range}'."
+ end
+
+ require 'date'
+ begin_month = Date::ABBR_MONTHNAMES.index(begin_values[0].capitalize)
+ end_month = Date::ABBR_MONTHNAMES.index(end_values[0].capitalize)
+ begin_day = begin_values[1].to_i
+ end_day = end_values[1].to_i
+ if begin_values.size == 3
+ begin_hour = begin_values[2].to_i
+ end
+ if end_values.size == 3
+ end_hour = end_values[2].to_i
+ end
+ if begin_month.nil? || end_month.nil? || begin_day == 0 || end_day == 0
+ fail "Invalid date format specified for '#{date_time_range}'."
+ end
+
+ return begin_month, begin_day, begin_hour, end_month, end_day, end_hour
+ end
+
+ # Return begin month/day and end month/day based on a provided monthly availability array.
+ #
+ # @param months [Array] monthly array of 1s and 0s
+ # @param year [Integer] the calendar year
+ # @return [Array] begin month/day and end month/day
+ def self.get_begin_and_end_dates_from_monthly_array(months, year)
+ num_days_in_month = Calendar.num_days_in_months(year)
+
+ if months.uniq.size == 1 && months[0] == 1 # Year-round
+ return 1, 1, 12, num_days_in_month[11]
+ elsif months.uniq.size == 1 && months[0] == 0 # Never
+ return
+ elsif months[0] == 1 && months[11] == 1 # Wrap around year
+ begin_month = 12 - months.reverse.index(0) + 1
+ end_month = months.index(0)
+ else
+ begin_month = months.index(1) + 1
+ end_month = 12 - months.reverse.index(1)
+ end
+
+ begin_day = 1
+ end_day = num_days_in_month[end_month - 1]
+
+ return begin_month, begin_day, end_month, end_day
+ end
+end
diff --git a/HPXMLtoOpenStudio/resources/constants.rb b/HPXMLtoOpenStudio/resources/constants.rb
index 2c1bc13d1e..8fa738db30 100644
--- a/HPXMLtoOpenStudio/resources/constants.rb
+++ b/HPXMLtoOpenStudio/resources/constants.rb
@@ -1,741 +1,143 @@
# frozen_string_literal: true
-# TODO
+# Collection of constants used across the code.
module Constants
- # Numbers --------------------
-
- # TODO
- #
- # @return [Double] the assumed inside temperature (F)
- def self.AssumedInsideTemp
- return 73.5
- end
-
- # TODO
- #
- # @return [Double] gravity (ft/s2)
- def self.g
- return 32.174
- end
-
- # TODO
- #
- # @return [Double] a small constant number
- def self.small
- return 1e-9
- end
-
- # TODO
- #
- # @param year [Integer] the calendar year
- # @return [TODO] TODO
- def self.NumDaysInMonths(year)
- num_days_in_months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
- num_days_in_months[1] += 1 if Date.leap?(year)
- return num_days_in_months
- end
-
- # TODO
- #
- # @param year [Integer] the calendar year
- # @return [Integer] number of days in the calendar year
- def self.NumDaysInYear(year)
- num_days_in_months = NumDaysInMonths(year)
- num_days_in_year = num_days_in_months.sum
- return num_days_in_year
- end
-
- # TODO
- #
- # @param year [Integer] the calendar year
- # @return [Integer] number of hours in the calendar year
- def self.NumHoursInYear(year)
- num_days_in_year = NumDaysInYear(year)
- num_hours_in_year = num_days_in_year * 24
- return num_hours_in_year
- end
-
- # Strings --------------------
-
- # TODO
- #
- # @return [TODO] TODO
- def self.AirFilm
- return 'AirFilm'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.AutomaticallyAdded
- return 'AutomaticallyAdded'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ERIVersions
- return ['2014', '2014A', '2014AE', '2014AEG', '2019', '2019A',
- '2019AB', '2019ABC', '2019ABCD', '2022', '2022C']
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.FacadeFront
- return 'front'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.FacadeBack
- return 'back'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.FacadeLeft
- return 'left'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.FacadeRight
- return 'right'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.FluidWater
- return 'water'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.FluidPropyleneGlycol
- return 'propylene-glycol'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.FluidEthyleneGlycol
- return 'ethylene-glycol'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.IECCZones
- return ['1A', '1B', '1C', '2A', '2B', '2C', '3A', '3B', '3C',
- '4A', '4B', '4C', '5A', '5B', '5C', '6A', '6B', '6C', '7', '8']
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameAirSourceHeatPump
- return 'air source heat pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameBatteryLossesAdjustment
- return 'battery losses adjustment'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameBoiler
- return 'boiler'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameCeilingFan
- return 'ceiling fan'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameCentralAirConditioner
- return 'central ac'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameCentralAirConditionerAndFurnace
- return 'central ac and furnace'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameClothesWasher
- return 'clothes washer'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameClothesDryer
- return 'clothes dryer'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameComponentLoadsProgram
- return 'component loads program'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameCookingRange
- return 'cooking range'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameDehumidifier
- return 'dehumidifier'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameDishwasher
- return 'dishwasher'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameDistributionWaste
- return 'dhw distribution waste'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameDuctLoad
- return 'duct load'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameElectricBaseboard
- return 'electric baseboard'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameEvaporativeCooler
- return 'evap cooler'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameFanPumpDisaggregateCool
- return 'disaggregate clg'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameFanPumpDisaggregatePrimaryHeat
- return 'disaggregate htg primary'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameFanPumpDisaggregateBackupHeat
- return 'disaggregate htg backup'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameFixtures
- return 'dhw fixtures'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameFreezer
- return 'freezer'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameFurnace
- return 'furnace'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameGeneralWaterUse
- return 'general water use'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameGeneralWaterUseLatent
- return 'general water use latent'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameGeneralWaterUseSensible
- return 'general water use sensible'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameGroundSourceHeatPump
- return 'ground source heat pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameGSHPSharedPump
- return 'gshp shared loop pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameHotWaterRecircPump
- return 'dhw recirc pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameHVACAvailabilitySensor
- return 'hvac availability sensor'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameIdealAirSystem
- return 'ideal air system'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameInfiltration
- return 'infil'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameLightingExterior
- return 'exterior lighting'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameLightingExteriorHoliday
- return 'exterior holiday lighting'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameLightingGarage
- return 'garage lighting'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameLightingInterior
- return 'interior lighting'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMechanicalVentilation
- return 'mech vent'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMechanicalVentilationPrecooling
- return 'mech vent precooling'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMechanicalVentilationPreheating
- return 'mech vent preheating'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMechanicalVentilationHouseFan
- return 'mech vent house fan'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMechanicalVentilationHouseFanCFIS
- return 'mech vent house fan cfis'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMechanicalVentilationHouseFanCFISSupplFan
- return 'mech vent house fan cfis suppl'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMechanicalVentilationBathFan
- return 'mech vent bath fan'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMechanicalVentilationRangeFan
- return 'mech vent range fan'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiniSplitAirConditioner
- return 'mini split air conditioner'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiniSplitHeatPump
- return 'mini split heat pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNamePTHP
- return 'packaged terminal heat pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameRoomHP
- return 'room ac with reverse cycle'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNamePTAC
- return 'packaged terminal air conditioner'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameBackupSuppHeat
- return 'back up supp heat'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscGrill
- return 'misc grill'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscLighting
- return 'misc lighting'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscFireplace
- return 'misc fireplace'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscPoolHeater
- return 'misc pool heater'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscPoolPump
- return 'misc pool pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscPermanentSpaHeater
- return 'misc permanent spa heater'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscPermanentSpaPump
- return 'misc permanent spa pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscPlugLoads
- return 'misc plug loads'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscTelevision
- return 'misc tv'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscElectricVehicleCharging
- return 'misc electric vehicle charging'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameMiscWellPump
- return 'misc well pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameNaturalVentilation
- return 'natural vent'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameNeighbors
- return 'neighbors'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameOccupants
- return 'occupants'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameRefrigerator
- return 'fridge'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameRoomAirConditioner
- return 'room ac'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameSolarHotWater
- return 'solar hot water'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameTotalAirflowsProgram
- return 'total airflows program'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameTotalLoadsProgram
- return 'total loads program'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameUnitHeater
- return 'unit heater'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameUnmetHoursProgram
- return 'unmet hours program'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameWaterHeater
- return 'water heater'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameWaterHeaterSetpoint
- return 'water heater setpoint'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameWaterHeaterAdjustment
- return 'water heater energy adjustment'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameWaterLoopHeatPump
- return 'water loop heat pump'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ObjectNameWholeHouseFan
- return 'whole house fan'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ScheduleTypeLimitsFraction
- return 'Fractional'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ScheduleTypeLimitsOnOff
- return 'OnOff'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.ScheduleTypeLimitsTemperature
- return 'Temperature'
- end
-
- # TODO
- #
- # @return [TODO] TODO
- def self.StateCodesMap
- return { 'AK' => 'Alaska',
- 'AL' => 'Alabama',
- 'AR' => 'Arkansas',
- 'AZ' => 'Arizona',
- 'CA' => 'California',
- 'CO' => 'Colorado',
- 'CT' => 'Connecticut',
- 'DC' => 'District of Columbia',
- 'DE' => 'Delaware',
- 'FL' => 'Florida',
- 'GA' => 'Georgia',
- 'HI' => 'Hawaii',
- 'IA' => 'Iowa',
- 'ID' => 'Idaho',
- 'IL' => 'Illinois',
- 'IN' => 'Indiana',
- 'KS' => 'Kansas',
- 'KY' => 'Kentucky',
- 'LA' => 'Louisiana',
- 'MA' => 'Massachusetts',
- 'MD' => 'Maryland',
- 'ME' => 'Maine',
- 'MI' => 'Michigan',
- 'MN' => 'Minnesota',
- 'MO' => 'Missouri',
- 'MS' => 'Mississippi',
- 'MT' => 'Montana',
- 'NC' => 'North Carolina',
- 'ND' => 'North Dakota',
- 'NE' => 'Nebraska',
- 'NH' => 'New Hampshire',
- 'NJ' => 'New Jersey',
- 'NM' => 'New Mexico',
- 'NV' => 'Nevada',
- 'NY' => 'New York',
- 'OH' => 'Ohio',
- 'OK' => 'Oklahoma',
- 'OR' => 'Oregon',
- 'PA' => 'Pennsylvania',
- 'RI' => 'Rhode Island',
- 'SC' => 'South Carolina',
- 'SD' => 'South Dakota',
- 'TN' => 'Tennessee',
- 'TX' => 'Texas',
- 'UT' => 'Utah',
- 'VA' => 'Virginia',
- 'VT' => 'Vermont',
- 'WA' => 'Washington',
- 'WI' => 'Wisconsin',
- 'WV' => 'West Virginia',
- 'WY' => 'Wyoming' }
- end
+ # Strings/Numbers
+ AirFilm = 'AirFilm'
+ AutomaticallyAdded = 'AutomaticallyAdded'
+ Small = 1e-9
+
+ # Object types
+ ObjectTypeAirSourceHeatPump = 'air source heat pump'
+ ObjectTypeBackupSuppHeat = 'back up supp heat'
+ ObjectTypeBatteryLossesAdjustment = 'battery losses adjustment'
+ ObjectTypeBoiler = 'boiler'
+ ObjectTypeCeilingFan = 'ceiling fan'
+ ObjectTypeCentralAirConditioner = 'central ac'
+ ObjectTypeCentralAirConditionerAndFurnace = 'central ac and furnace'
+ ObjectTypeClothesWasher = 'clothes washer'
+ ObjectTypeClothesDryer = 'clothes dryer'
+ ObjectTypeComponentLoadsProgram = 'component loads program'
+ ObjectTypeCookingRange = 'cooking range'
+ ObjectTypeDehumidifier = 'dehumidifier'
+ ObjectTypeDishwasher = 'dishwasher'
+ ObjectTypeDistributionWaste = 'dhw distribution waste'
+ ObjectTypeDuctLoad = 'duct load'
+ ObjectTypeElectricBaseboard = 'electric baseboard'
+ ObjectTypeEvaporativeCooler = 'evap cooler'
+ ObjectTypeFanPumpDisaggregateCool = 'disaggregate clg'
+ ObjectTypeFanPumpDisaggregatePrimaryHeat = 'disaggregate htg primary'
+ ObjectTypeFanPumpDisaggregateBackupHeat = 'disaggregate htg backup'
+ ObjectTypeFixtures = 'dhw fixtures'
+ ObjectTypeFreezer = 'freezer'
+ ObjectTypeFurnace = 'furnace'
+ ObjectTypeGeneralWaterUse = 'general water use'
+ ObjectTypeGeneralWaterUseLatent = 'general water use latent'
+ ObjectTypeGeneralWaterUseSensible = 'general water use sensible'
+ ObjectTypeGroundSourceHeatPump = 'ground source heat pump'
+ ObjectTypeGSHPSharedPump = 'gshp shared loop pump'
+ ObjectTypeHotWaterRecircPump = 'dhw recirc pump'
+ ObjectTypeHVACAvailabilitySensor = 'hvac availability sensor'
+ ObjectTypeIdealAirSystem = 'ideal air system'
+ ObjectTypeInfiltration = 'infil'
+ ObjectTypeLightingExterior = 'exterior lighting'
+ ObjectTypeLightingExteriorHoliday = 'exterior holiday lighting'
+ ObjectTypeLightingGarage = 'garage lighting'
+ ObjectTypeLightingInterior = 'interior lighting'
+ ObjectTypeMechanicalVentilation = 'mech vent'
+ ObjectTypeMechanicalVentilationPrecooling = 'mech vent precooling'
+ ObjectTypeMechanicalVentilationPreheating = 'mech vent preheating'
+ ObjectTypeMechanicalVentilationHouseFan = 'mech vent house fan'
+ ObjectTypeMechanicalVentilationHouseFanCFIS = 'mech vent house fan cfis'
+ ObjectTypeMechanicalVentilationHouseFanCFISSupplFan = 'mech vent house fan cfis suppl'
+ ObjectTypeMechanicalVentilationBathFan = 'mech vent bath fan'
+ ObjectTypeMechanicalVentilationRangeFan = 'mech vent range fan'
+ ObjectTypeMiniSplitAirConditioner = 'mini split air conditioner'
+ ObjectTypeMiniSplitHeatPump = 'mini split heat pump'
+ ObjectTypeMiscGrill = 'misc grill'
+ ObjectTypeMiscLighting = 'misc lighting'
+ ObjectTypeMiscFireplace = 'misc fireplace'
+ ObjectTypeMiscPoolHeater = 'misc pool heater'
+ ObjectTypeMiscPoolPump = 'misc pool pump'
+ ObjectTypeMiscPermanentSpaHeater = 'misc permanent spa heater'
+ ObjectTypeMiscPermanentSpaPump = 'misc permanent spa pump'
+ ObjectTypeMiscPlugLoads = 'misc plug loads'
+ ObjectTypeMiscTelevision = 'misc tv'
+ ObjectTypeMiscElectricVehicleCharging = 'misc electric vehicle charging'
+ ObjectTypeMiscWellPump = 'misc well pump'
+ ObjectTypeNaturalVentilation = 'natural vent'
+ ObjectTypeNeighbors = 'neighbors'
+ ObjectTypeOccupants = 'occupants'
+ ObjectTypePTAC = 'packaged terminal air conditioner'
+ ObjectTypePTHP = 'packaged terminal heat pump'
+ ObjectTypeRefrigerator = 'fridge'
+ ObjectTypeRoomAC = 'room ac'
+ ObjectTypeRoomHP = 'room ac with reverse cycle'
+ ObjectTypeSolarHotWater = 'solar hot water'
+ ObjectTypeTotalAirflowsProgram = 'total airflows program'
+ ObjectTypeTotalLoadsProgram = 'total loads program'
+ ObjectTypeUnitHeater = 'unit heater'
+ ObjectTypeUnmetHoursProgram = 'unmet hours program'
+ ObjectTypeWaterHeater = 'water heater'
+ ObjectTypeWaterHeaterSetpoint = 'water heater setpoint'
+ ObjectTypeWaterHeaterAdjustment = 'water heater energy adjustment'
+ ObjectTypeWaterLoopHeatPump = 'water loop heat pump'
+ ObjectTypeWholeHouseFan = 'whole house fan'
+
+ # Arrays/Maps
+ ERIVersions = ['2014', '2014A', '2014AE', '2014AEG', '2019', '2019A',
+ '2019AB', '2019ABC', '2019ABCD', '2022', '2022C']
+ IECCZones = ['1A', '1B', '1C', '2A', '2B', '2C', '3A', '3B', '3C',
+ '4A', '4B', '4C', '5A', '5B', '5C', '6A', '6B', '6C', '7', '8']
+ StateCodesMap = { 'AK' => 'Alaska',
+ 'AL' => 'Alabama',
+ 'AR' => 'Arkansas',
+ 'AZ' => 'Arizona',
+ 'CA' => 'California',
+ 'CO' => 'Colorado',
+ 'CT' => 'Connecticut',
+ 'DC' => 'District of Columbia',
+ 'DE' => 'Delaware',
+ 'FL' => 'Florida',
+ 'GA' => 'Georgia',
+ 'HI' => 'Hawaii',
+ 'IA' => 'Iowa',
+ 'ID' => 'Idaho',
+ 'IL' => 'Illinois',
+ 'IN' => 'Indiana',
+ 'KS' => 'Kansas',
+ 'KY' => 'Kentucky',
+ 'LA' => 'Louisiana',
+ 'MA' => 'Massachusetts',
+ 'MD' => 'Maryland',
+ 'ME' => 'Maine',
+ 'MI' => 'Michigan',
+ 'MN' => 'Minnesota',
+ 'MO' => 'Missouri',
+ 'MS' => 'Mississippi',
+ 'MT' => 'Montana',
+ 'NC' => 'North Carolina',
+ 'ND' => 'North Dakota',
+ 'NE' => 'Nebraska',
+ 'NH' => 'New Hampshire',
+ 'NJ' => 'New Jersey',
+ 'NM' => 'New Mexico',
+ 'NV' => 'Nevada',
+ 'NY' => 'New York',
+ 'OH' => 'Ohio',
+ 'OK' => 'Oklahoma',
+ 'OR' => 'Oregon',
+ 'PA' => 'Pennsylvania',
+ 'RI' => 'Rhode Island',
+ 'SC' => 'South Carolina',
+ 'SD' => 'South Dakota',
+ 'TN' => 'Tennessee',
+ 'TX' => 'Texas',
+ 'UT' => 'Utah',
+ 'VA' => 'Virginia',
+ 'VT' => 'Vermont',
+ 'WA' => 'Washington',
+ 'WI' => 'Wisconsin',
+ 'WV' => 'West Virginia',
+ 'WY' => 'Wyoming' }
end
diff --git a/HPXMLtoOpenStudio/resources/constructions.rb b/HPXMLtoOpenStudio/resources/constructions.rb
index 714ddbdc4a..b11b9f6261 100644
--- a/HPXMLtoOpenStudio/resources/constructions.rb
+++ b/HPXMLtoOpenStudio/resources/constructions.rb
@@ -1738,7 +1738,7 @@ def self.create_os_int_mass_and_def(model, object_name, space, area)
# @param shgc [TODO] TODO
# @return [TODO] TODO
def self.get_default_interior_shading_factors(eri_version, shgc)
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2022C')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2022C')
summer = 0.92 - (0.21 * shgc)
winter = summer
else
@@ -2140,7 +2140,7 @@ def self.apply_kiva_initial_temp(foundation, slab, weather, conditioned_zone,
# Building has HVAC system
setpoint_sch = conditioned_zone.thermostatSetpointDualSetpoint.get
sim_begin_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new(sim_begin_month), sim_begin_day, sim_year)
- sim_begin_hour = (Schedule.get_day_num_from_month_day(sim_year, sim_begin_month, sim_begin_day) - 1) * 24
+ sim_begin_hour = (Calendar.get_day_num_from_month_day(sim_year, sim_begin_month, sim_begin_day) - 1) * 24
# Get heating/cooling setpoints for the simulation start
htg_setpoint_sch = setpoint_sch.heatingSetpointTemperatureSchedule.get
@@ -2298,12 +2298,12 @@ def self.apply_window_skylight_shading(model, window_or_skylight, sub_surface, s
# Determine transmittance values throughout the year
sf_values = []
- num_days_in_year = Constants.NumDaysInYear(hpxml_header.sim_calendar_year)
+ num_days_in_year = Calendar.num_days_in_year(hpxml_header.sim_calendar_year)
if not hpxml_bldg.header.shading_summer_begin_month.nil?
- summer_start_day_num = Schedule.get_day_num_from_month_day(hpxml_header.sim_calendar_year,
+ summer_start_day_num = Calendar.get_day_num_from_month_day(hpxml_header.sim_calendar_year,
hpxml_bldg.header.shading_summer_begin_month,
hpxml_bldg.header.shading_summer_begin_day)
- summer_end_day_num = Schedule.get_day_num_from_month_day(hpxml_header.sim_calendar_year,
+ summer_end_day_num = Calendar.get_day_num_from_month_day(hpxml_header.sim_calendar_year,
hpxml_bldg.header.shading_summer_end_month,
hpxml_bldg.header.shading_summer_end_day)
for i in 0..(num_days_in_year - 1)
@@ -2335,7 +2335,7 @@ def self.apply_window_skylight_shading(model, window_or_skylight, sub_surface, s
sf_sch.setValue(sf_values[0][0])
sf_sch.setName(sch_name)
else
- sf_sch = HourlyByDaySchedule.new(model, sch_name, sf_values, sf_values, Constants.ScheduleTypeLimitsFraction, false).schedule
+ sf_sch = HourlyByDaySchedule.new(model, sch_name, sf_values, sf_values, EPlus::ScheduleTypeLimitsFraction, false).schedule
end
shading_schedules[sf_values] = sf_sch
end
@@ -3207,7 +3207,7 @@ def construct_materials(model)
materials = []
@layers_materials.each_with_index do |layer_materials, layer_num|
if layer_materials.size == 1
- next if layer_materials[0].name == Constants.AirFilm # Do not include air films in construction
+ next if layer_materials[0].name == Constants::AirFilm # Do not include air films in construction
mat = create_os_material(model, layer_materials[0])
else
diff --git a/HPXMLtoOpenStudio/resources/energyplus.rb b/HPXMLtoOpenStudio/resources/energyplus.rb
index 396e866bf0..4d4de689c1 100644
--- a/HPXMLtoOpenStudio/resources/energyplus.rb
+++ b/HPXMLtoOpenStudio/resources/energyplus.rb
@@ -1,8 +1,14 @@
# frozen_string_literal: true
-# TODO
+# Collection of methods related to the EnergyPlus simulation.
module EPlus
# Constants
+ BoundaryConditionAdiabatic = 'Adiabatic'
+ BoundaryConditionCoefficients = 'OtherSideCoefficients'
+ BoundaryConditionFoundation = 'Foundation'
+ BoundaryConditionGround = 'Ground'
+ BoundaryConditionOutdoors = 'Outdoors'
+ BoundaryConditionSurface = 'Surface'
EMSActuatorElectricEquipmentPower = 'ElectricEquipment', 'Electricity Rate'
EMSActuatorOtherEquipmentPower = 'OtherEquipment', 'Power Level'
EMSActuatorPumpMassFlowRate = 'Pump', 'Pump Mass Flow Rate'
@@ -18,21 +24,39 @@ module EPlus
EMSActuatorZoneMixingFlowRate = 'ZoneMixing', 'Air Exchange Flow Rate'
EMSIntVarFanMFR = 'Fan Maximum Mass Flow Rate'
EMSIntVarPumpMFR = 'Pump Maximum Mass Flow Rate'
+ FluidPropyleneGlycol = 'PropyleneGlycol'
+ FluidWater = 'Water'
+ FuelTypeCoal = 'Coal'
FuelTypeElectricity = 'Electricity'
FuelTypeNaturalGas = 'NaturalGas'
+ FuelTypeNone = 'None'
FuelTypeOil = 'FuelOilNo2'
FuelTypePropane = 'Propane'
FuelTypeWoodCord = 'OtherFuel1'
FuelTypeWoodPellets = 'OtherFuel2'
- FuelTypeCoal = 'Coal'
+ ScheduleTypeLimitsFraction = 'Fractional'
+ ScheduleTypeLimitsOnOff = 'OnOff'
+ ScheduleTypeLimitsTemperature = 'Temperature'
+ SubSurfaceTypeDoor = 'Door'
+ SubSurfaceTypeWindow = 'FixedWindow'
+ SurfaceSunExposureNo = 'NoSun'
+ SurfaceSunExposureYes = 'SunExposed'
+ SurfaceTypeFloor = 'Floor'
+ SurfaceTypeRoofCeiling = 'RoofCeiling'
+ SurfaceTypeWall = 'Wall'
+ SurfaceWindExposureNo = 'NoWind'
+ SurfaceWindExposureYes = 'WindExposed'
- # TODO
+ # Returns the fuel type used in the EnergyPlus simulation that the HPXML fuel type
+ # maps to.
#
- # @param hpxml_fuel [TODO] TODO
- # @return [TODO] TODO
+ # @param hpxml_fuel [String] HPXML fuel type (HPXML::FuelTypeXXX)
+ # @return [String] EnergyPlus fuel type (EPlus::FuelTypeXXX)
def self.fuel_type(hpxml_fuel)
# Name of fuel used as inputs to E+ objects
- if [HPXML::FuelTypeElectricity].include? hpxml_fuel
+ if hpxml_fuel.nil?
+ return FuelTypeNone
+ elsif [HPXML::FuelTypeElectricity].include? hpxml_fuel
return FuelTypeElectricity
elsif [HPXML::FuelTypeNaturalGas].include? hpxml_fuel
return FuelTypeNaturalGas
diff --git a/HPXMLtoOpenStudio/resources/geometry.rb b/HPXMLtoOpenStudio/resources/geometry.rb
index a273a62344..a6abbba192 100644
--- a/HPXMLtoOpenStudio/resources/geometry.rb
+++ b/HPXMLtoOpenStudio/resources/geometry.rb
@@ -184,8 +184,8 @@ def self.create_roof_vertices(length:,
def self.get_roof_pitch(surfaces)
tilts = []
surfaces.each do |surface|
- next if surface.surfaceType.downcase != 'roofceiling'
- next if (surface.outsideBoundaryCondition.downcase != 'outdoors') && (surface.outsideBoundaryCondition.downcase != 'adiabatic')
+ next if surface.surfaceType != EPlus::SurfaceTypeRoofCeiling
+ next if (surface.outsideBoundaryCondition != EPlus::BoundaryConditionOutdoors) && (surface.outsideBoundaryCondition != EPlus::BoundaryConditionAdiabatic)
tilts << surface.tilt
end
@@ -357,8 +357,8 @@ def self.explode_surfaces(model:,
surfaces = []
azimuth_lengths = {}
model.getSurfaces.sort.each do |surface|
- next unless ['wall', 'roofceiling'].include? surface.surfaceType.downcase
- next unless ['outdoors', 'foundation', 'adiabatic', 'othersidecoefficients'].include? surface.outsideBoundaryCondition.downcase
+ next unless [EPlus::SurfaceTypeWall, EPlus::SurfaceTypeRoofCeiling].include? surface.surfaceType
+ next unless [EPlus::BoundaryConditionOutdoors, EPlus::BoundaryConditionFoundation, EPlus::BoundaryConditionAdiabatic, EPlus::BoundaryConditionCoefficients].include? surface.outsideBoundaryCondition
next if surface.additionalProperties.getFeatureAsDouble('Tilt').get <= 0 # skip flat roofs
surfaces << surface
@@ -402,7 +402,7 @@ def self.explode_surfaces(model:,
# Explode neighbors
model.getShadingSurfaceGroups.each do |shading_group|
- next unless shading_group.name.to_s == Constants.ObjectNameNeighbors
+ next unless shading_group.name.to_s == Constants::ObjectTypeNeighbors
shading_group.shadingSurfaces.each do |shading_surface|
azimuth = shading_surface.additionalProperties.getFeatureAsInteger('Azimuth').get
@@ -438,7 +438,7 @@ def self.explode_surfaces(model:,
overhang_surfaces = []
shading_surfaces = []
surface.subSurfaces.each do |subsurface|
- next unless subsurface.subSurfaceType.downcase == 'fixedwindow'
+ next unless subsurface.subSurfaceType == EPlus::SubSurfaceTypeWindow
subsurface.shadingSurfaceGroups.each do |overhang_group|
overhang_group.shadingSurfaces.each do |overhang|
@@ -450,7 +450,7 @@ def self.explode_surfaces(model:,
# Push out horizontally
distance = explode_distance
- if surface.surfaceType.downcase == 'roofceiling'
+ if surface.surfaceType == EPlus::SurfaceTypeRoofCeiling
# Ensure pitched surfaces are positioned outward justified with walls, etc.
tilt = surface.additionalProperties.getFeatureAsDouble('Tilt').get
width = surface.additionalProperties.getFeatureAsDouble('Width').get
@@ -519,7 +519,7 @@ def self.apply_occupants(model, runner, hpxml_bldg, num_occ, space, schedules_fi
weekend_sch = hpxml_bldg.building_occupancy.weekend_fractions.split(',').map(&:to_f)
weekend_sch = weekend_sch.map { |v| v / weekend_sch.max }.join(',')
monthly_sch = hpxml_bldg.building_occupancy.monthly_multipliers
- people_sch = MonthWeekdayWeekendSchedule.new(model, Constants.ObjectNameOccupants + ' schedule', weekday_sch, weekend_sch, monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: people_unavailable_periods)
+ people_sch = MonthWeekdayWeekendSchedule.new(model, Constants::ObjectTypeOccupants + ' schedule', weekday_sch, weekend_sch, monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: people_unavailable_periods)
people_sch = people_sch.schedule
else
runner.registerWarning("Both '#{people_col_name}' schedule file and weekday fractions provided; the latter will be ignored.") if !hpxml_bldg.building_occupancy.weekday_fractions.nil?
@@ -530,14 +530,14 @@ def self.apply_occupants(model, runner, hpxml_bldg, num_occ, space, schedules_fi
# Create schedule
activity_sch = OpenStudio::Model::ScheduleConstant.new(model)
activity_sch.setValue(activity_per_person)
- activity_sch.setName(Constants.ObjectNameOccupants + ' activity schedule')
+ activity_sch.setName(Constants::ObjectTypeOccupants + ' activity schedule')
# Add people definition for the occ
occ_def = OpenStudio::Model::PeopleDefinition.new(model)
occ = OpenStudio::Model::People.new(occ_def)
- occ.setName(Constants.ObjectNameOccupants)
+ occ.setName(Constants::ObjectTypeOccupants)
occ.setSpace(space)
- occ_def.setName(Constants.ObjectNameOccupants)
+ occ_def.setName(Constants::ObjectTypeOccupants)
occ_def.setNumberofPeople(num_occ)
occ_def.setFractionRadiant(occ_rad)
occ_def.setSensibleHeatFraction(occ_sens)
@@ -616,7 +616,7 @@ def self.add_neighbor_shading(model:,
unless shading_surfaces.empty?
shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(model)
- shading_surface_group.setName(Constants.ObjectNameNeighbors)
+ shading_surface_group.setName(Constants::ObjectTypeNeighbors)
shading_surfaces.each do |shading_surface|
shading_surface.setShadingSurfaceGroup(shading_surface_group)
end
diff --git a/HPXMLtoOpenStudio/resources/hotwater_appliances.rb b/HPXMLtoOpenStudio/resources/hotwater_appliances.rb
index d5be25b95f..4bc17bb3e3 100644
--- a/HPXMLtoOpenStudio/resources/hotwater_appliances.rb
+++ b/HPXMLtoOpenStudio/resources/hotwater_appliances.rb
@@ -69,17 +69,17 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
# Create schedule
cw_power_schedule = nil
cw_col_name = SchedulesFile::Columns[:ClothesWasher].name
- cw_object_name = Constants.ObjectNameClothesWasher
+ cw_object_name = Constants::ObjectTypeClothesWasher
if not schedules_file.nil?
cw_design_level_w = schedules_file.calc_design_level_from_daily_kwh(col_name: cw_col_name, daily_kwh: cw_annual_kwh / 365.0)
- cw_power_schedule = schedules_file.create_schedule_file(model, col_name: cw_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ cw_power_schedule = schedules_file.create_schedule_file(model, col_name: cw_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if cw_power_schedule.nil?
cw_unavailable_periods = Schedule.get_unavailable_periods(runner, cw_col_name, unavailable_periods)
cw_weekday_sch = clothes_washer.weekday_fractions
cw_weekend_sch = clothes_washer.weekend_fractions
cw_monthly_sch = clothes_washer.monthly_multipliers
- cw_schedule_obj = MonthWeekdayWeekendSchedule.new(model, cw_object_name + ' schedule', cw_weekday_sch, cw_weekend_sch, cw_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: cw_unavailable_periods)
+ cw_schedule_obj = MonthWeekdayWeekendSchedule.new(model, cw_object_name + ' schedule', cw_weekday_sch, cw_weekend_sch, cw_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: cw_unavailable_periods)
cw_design_level_w = cw_schedule_obj.calc_design_level_from_daily_kwh(cw_annual_kwh / 365.0)
cw_power_schedule = cw_schedule_obj.schedule
else
@@ -100,18 +100,18 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
# Create schedule
cd_schedule = nil
cd_col_name = SchedulesFile::Columns[:ClothesDryer].name
- cd_obj_name = Constants.ObjectNameClothesDryer
+ cd_obj_name = Constants::ObjectTypeClothesDryer
if not schedules_file.nil?
cd_design_level_e = schedules_file.calc_design_level_from_annual_kwh(col_name: cd_col_name, annual_kwh: cd_annual_kwh)
cd_design_level_f = schedules_file.calc_design_level_from_annual_therm(col_name: cd_col_name, annual_therm: cd_annual_therm)
- cd_schedule = schedules_file.create_schedule_file(model, col_name: cd_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ cd_schedule = schedules_file.create_schedule_file(model, col_name: cd_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if cd_schedule.nil?
cd_unavailable_periods = Schedule.get_unavailable_periods(runner, cd_col_name, unavailable_periods)
cd_weekday_sch = clothes_dryer.weekday_fractions
cd_weekend_sch = clothes_dryer.weekend_fractions
cd_monthly_sch = clothes_dryer.monthly_multipliers
- cd_schedule_obj = MonthWeekdayWeekendSchedule.new(model, cd_obj_name + ' schedule', cd_weekday_sch, cd_weekend_sch, cd_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: cd_unavailable_periods)
+ cd_schedule_obj = MonthWeekdayWeekendSchedule.new(model, cd_obj_name + ' schedule', cd_weekday_sch, cd_weekend_sch, cd_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: cd_unavailable_periods)
cd_design_level_e = cd_schedule_obj.calc_design_level_from_daily_kwh(cd_annual_kwh / 365.0)
cd_design_level_f = cd_schedule_obj.calc_design_level_from_daily_therm(cd_annual_therm / 365.0)
cd_schedule = cd_schedule_obj.schedule
@@ -134,17 +134,17 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
# Create schedule
dw_power_schedule = nil
dw_col_name = SchedulesFile::Columns[:Dishwasher].name
- dw_obj_name = Constants.ObjectNameDishwasher
+ dw_obj_name = Constants::ObjectTypeDishwasher
if not schedules_file.nil?
dw_design_level_w = schedules_file.calc_design_level_from_daily_kwh(col_name: dw_col_name, daily_kwh: dw_annual_kwh / 365.0)
- dw_power_schedule = schedules_file.create_schedule_file(model, col_name: dw_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ dw_power_schedule = schedules_file.create_schedule_file(model, col_name: dw_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if dw_power_schedule.nil?
dw_unavailable_periods = Schedule.get_unavailable_periods(runner, dw_col_name, unavailable_periods)
dw_weekday_sch = dishwasher.weekday_fractions
dw_weekend_sch = dishwasher.weekend_fractions
dw_monthly_sch = dishwasher.monthly_multipliers
- dw_schedule_obj = MonthWeekdayWeekendSchedule.new(model, dw_obj_name + ' schedule', dw_weekday_sch, dw_weekend_sch, dw_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: dw_unavailable_periods)
+ dw_schedule_obj = MonthWeekdayWeekendSchedule.new(model, dw_obj_name + ' schedule', dw_weekday_sch, dw_weekend_sch, dw_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: dw_unavailable_periods)
dw_design_level_w = dw_schedule_obj.calc_design_level_from_daily_kwh(dw_annual_kwh / 365.0)
dw_power_schedule = dw_schedule_obj.schedule
else
@@ -165,10 +165,10 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
# Create schedule
fridge_schedule = nil
fridge_col_name = refrigerator.primary_indicator ? SchedulesFile::Columns[:Refrigerator].name : SchedulesFile::Columns[:ExtraRefrigerator].name
- fridge_obj_name = Constants.ObjectNameRefrigerator
+ fridge_obj_name = Constants::ObjectTypeRefrigerator
if not schedules_file.nil?
fridge_design_level = schedules_file.calc_design_level_from_annual_kwh(col_name: fridge_col_name, annual_kwh: rf_annual_kwh)
- fridge_schedule = schedules_file.create_schedule_file(model, col_name: fridge_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ fridge_schedule = schedules_file.create_schedule_file(model, col_name: fridge_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if fridge_schedule.nil?
fridge_unavailable_periods = Schedule.get_unavailable_periods(runner, fridge_col_name, unavailable_periods)
@@ -182,7 +182,7 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
fridge_weekend_sch = refrigerator.weekend_fractions
fridge_monthly_sch = refrigerator.monthly_multipliers
- fridge_schedule_obj = MonthWeekdayWeekendSchedule.new(model, fridge_obj_name + ' schedule', fridge_weekday_sch, fridge_weekend_sch, fridge_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: fridge_unavailable_periods)
+ fridge_schedule_obj = MonthWeekdayWeekendSchedule.new(model, fridge_obj_name + ' schedule', fridge_weekday_sch, fridge_weekend_sch, fridge_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: fridge_unavailable_periods)
fridge_design_level = fridge_schedule_obj.calc_design_level_from_daily_kwh(rf_annual_kwh / 365.0)
fridge_schedule = fridge_schedule_obj.schedule
end
@@ -207,10 +207,10 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
# Create schedule
freezer_schedule = nil
freezer_col_name = SchedulesFile::Columns[:Freezer].name
- freezer_obj_name = Constants.ObjectNameFreezer
+ freezer_obj_name = Constants::ObjectTypeFreezer
if not schedules_file.nil?
freezer_design_level = schedules_file.calc_design_level_from_annual_kwh(col_name: freezer_col_name, annual_kwh: fz_annual_kwh)
- freezer_schedule = schedules_file.create_schedule_file(model, col_name: freezer_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ freezer_schedule = schedules_file.create_schedule_file(model, col_name: freezer_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if freezer_schedule.nil?
freezer_unavailable_periods = Schedule.get_unavailable_periods(runner, freezer_col_name, unavailable_periods)
@@ -224,7 +224,7 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
freezer_weekend_sch = freezer.weekend_fractions
freezer_monthly_sch = freezer.monthly_multipliers
- freezer_schedule_obj = MonthWeekdayWeekendSchedule.new(model, freezer_obj_name + ' schedule', freezer_weekday_sch, freezer_weekend_sch, freezer_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: freezer_unavailable_periods)
+ freezer_schedule_obj = MonthWeekdayWeekendSchedule.new(model, freezer_obj_name + ' schedule', freezer_weekday_sch, freezer_weekend_sch, freezer_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: freezer_unavailable_periods)
freezer_design_level = freezer_schedule_obj.calc_design_level_from_daily_kwh(fz_annual_kwh / 365.0)
freezer_schedule = freezer_schedule_obj.schedule
end
@@ -249,18 +249,18 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
# Create schedule
cook_schedule = nil
cook_col_name = SchedulesFile::Columns[:CookingRange].name
- cook_obj_name = Constants.ObjectNameCookingRange
+ cook_obj_name = Constants::ObjectTypeCookingRange
if not schedules_file.nil?
cook_design_level_e = schedules_file.calc_design_level_from_annual_kwh(col_name: cook_col_name, annual_kwh: cook_annual_kwh)
cook_design_level_f = schedules_file.calc_design_level_from_annual_therm(col_name: cook_col_name, annual_therm: cook_annual_therm)
- cook_schedule = schedules_file.create_schedule_file(model, col_name: cook_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ cook_schedule = schedules_file.create_schedule_file(model, col_name: cook_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if cook_schedule.nil?
cook_unavailable_periods = Schedule.get_unavailable_periods(runner, cook_col_name, unavailable_periods)
cook_weekday_sch = cooking_range.weekday_fractions
cook_weekend_sch = cooking_range.weekend_fractions
cook_monthly_sch = cooking_range.monthly_multipliers
- cook_schedule_obj = MonthWeekdayWeekendSchedule.new(model, cook_obj_name + ' schedule', cook_weekday_sch, cook_weekend_sch, cook_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: cook_unavailable_periods)
+ cook_schedule_obj = MonthWeekdayWeekendSchedule.new(model, cook_obj_name + ' schedule', cook_weekday_sch, cook_weekend_sch, cook_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: cook_unavailable_periods)
cook_design_level_e = cook_schedule_obj.calc_design_level_from_daily_kwh(cook_annual_kwh / 365.0)
cook_design_level_f = cook_schedule_obj.calc_design_level_from_daily_therm(cook_annual_therm / 365.0)
cook_schedule = cook_schedule_obj.schedule
@@ -326,21 +326,21 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
mw_temp_schedule = OpenStudio::Model::ScheduleConstant.new(model)
mw_temp_schedule.setName('mixed water temperature schedule')
mw_temp_schedule.setValue(UnitConversions.convert(t_mix, 'F', 'C'))
- Schedule.set_schedule_type_limits(model, mw_temp_schedule, Constants.ScheduleTypeLimitsTemperature)
+ Schedule.set_schedule_type_limits(model, mw_temp_schedule, EPlus::ScheduleTypeLimitsTemperature)
# Create schedule
fixtures_schedule = nil
fixtures_col_name = SchedulesFile::Columns[:HotWaterFixtures].name
- fixtures_obj_name = Constants.ObjectNameFixtures
+ fixtures_obj_name = Constants::ObjectTypeFixtures
if not schedules_file.nil?
- fixtures_schedule = schedules_file.create_schedule_file(model, col_name: fixtures_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ fixtures_schedule = schedules_file.create_schedule_file(model, col_name: fixtures_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if fixtures_schedule.nil?
fixtures_unavailable_periods = Schedule.get_unavailable_periods(runner, fixtures_col_name, unavailable_periods)
fixtures_weekday_sch = hpxml_bldg.water_heating.water_fixtures_weekday_fractions
fixtures_weekend_sch = hpxml_bldg.water_heating.water_fixtures_weekend_fractions
fixtures_monthly_sch = hpxml_bldg.water_heating.water_fixtures_monthly_multipliers
- fixtures_schedule_obj = MonthWeekdayWeekendSchedule.new(model, fixtures_obj_name + ' schedule', fixtures_weekday_sch, fixtures_weekend_sch, fixtures_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: fixtures_unavailable_periods)
+ fixtures_schedule_obj = MonthWeekdayWeekendSchedule.new(model, fixtures_obj_name + ' schedule', fixtures_weekday_sch, fixtures_weekend_sch, fixtures_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: fixtures_unavailable_periods)
fixtures_schedule = fixtures_schedule_obj.schedule
else
runner.registerWarning("Both '#{fixtures_col_name}' schedule file and weekday fractions provided; the latter will be ignored.") if !hpxml_bldg.water_heating.water_fixtures_weekday_fractions.nil?
@@ -372,7 +372,7 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
add_water_use_equipment(model, fixtures_obj_name, fx_peak_flow * gpd_frac * non_solar_fraction, fixtures_schedule, water_use_connections[water_heating_system.id], unit_multiplier, mw_temp_schedule)
# Distribution waste (primary driven by fixture draws)
- waste_obj_name = Constants.ObjectNameDistributionWaste
+ waste_obj_name = Constants::ObjectTypeDistributionWaste
add_water_use_equipment(model, waste_obj_name, dist_water_peak_flow * gpd_frac * non_solar_fraction, fixtures_schedule, water_use_connections[water_heating_system.id], unit_multiplier, mw_temp_schedule)
# Recirculation pump
@@ -382,17 +382,17 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
# Create schedule
recirc_pump_sch = nil
recirc_pump_col_name = SchedulesFile::Columns[:HotWaterRecirculationPump].name
- recirc_pump_obj_name = Constants.ObjectNameHotWaterRecircPump
+ recirc_pump_obj_name = Constants::ObjectTypeHotWaterRecircPump
if not schedules_file.nil?
recirc_pump_design_level = schedules_file.calc_design_level_from_daily_kwh(col_name: recirc_pump_col_name, daily_kwh: recirc_pump_annual_kwh / 365.0)
- recirc_pump_sch = schedules_file.create_schedule_file(model, col_name: recirc_pump_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ recirc_pump_sch = schedules_file.create_schedule_file(model, col_name: recirc_pump_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if recirc_pump_sch.nil?
recirc_pump_unavailable_periods = Schedule.get_unavailable_periods(runner, recirc_pump_col_name, unavailable_periods)
recirc_pump_weekday_sch = hot_water_distribution.recirculation_pump_weekday_fractions
recirc_pump_weekend_sch = hot_water_distribution.recirculation_pump_weekend_fractions
recirc_pump_monthly_sch = hot_water_distribution.recirculation_pump_monthly_multipliers
- recirc_pump_sch = MonthWeekdayWeekendSchedule.new(model, recirc_pump_obj_name + ' schedule', recirc_pump_weekday_sch, recirc_pump_weekend_sch, recirc_pump_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: recirc_pump_unavailable_periods)
+ recirc_pump_sch = MonthWeekdayWeekendSchedule.new(model, recirc_pump_obj_name + ' schedule', recirc_pump_weekday_sch, recirc_pump_weekend_sch, recirc_pump_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: recirc_pump_unavailable_periods)
recirc_pump_design_level = recirc_pump_sch.calc_design_level_from_daily_kwh(recirc_pump_annual_kwh / 365.0)
recirc_pump_sch = recirc_pump_sch.schedule
else
@@ -401,8 +401,8 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
runner.registerWarning("Both '#{recirc_pump_col_name}' schedule file and monthly multipliers provided; the latter will be ignored.") if !hot_water_distribution.recirculation_pump_monthly_multipliers.nil?
end
if recirc_pump_design_level * gpd_frac != 0
- cnt = model.getElectricEquipments.select { |e| e.endUseSubcategory.start_with? Constants.ObjectNameHotWaterRecircPump }.size # Ensure unique meter for each water heater
- recirc_pump = add_electric_equipment(model, "#{Constants.ObjectNameHotWaterRecircPump}#{cnt + 1}", conditioned_space, recirc_pump_design_level * gpd_frac, 0.0, 0.0, recirc_pump_sch)
+ cnt = model.getElectricEquipments.select { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeHotWaterRecircPump }.size # Ensure unique meter for each water heater
+ recirc_pump = add_electric_equipment(model, "#{Constants::ObjectTypeHotWaterRecircPump}#{cnt + 1}", conditioned_space, recirc_pump_design_level * gpd_frac, 0.0, 0.0, recirc_pump_sch)
recirc_pump.additionalProperties.setFeature('HPXML_ID', water_heating_system.id) # Used by reporting measure
end
end
@@ -423,7 +423,7 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
water_cw_schedule = nil
if not schedules_file.nil?
cw_peak_flow = schedules_file.calc_peak_flow_from_daily_gpm(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, daily_water: cw_gpd)
- water_cw_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ water_cw_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if water_cw_schedule.nil?
cw_peak_flow = cw_schedule_obj.calc_design_level_from_daily_gpm(cw_gpd)
@@ -450,7 +450,7 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
water_dw_schedule = nil
if not schedules_file.nil?
dw_peak_flow = schedules_file.calc_peak_flow_from_daily_gpm(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, daily_water: dw_gpd)
- water_dw_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ water_dw_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if water_dw_schedule.nil?
dw_peak_flow = dw_schedule_obj.calc_design_level_from_daily_gpm(dw_gpd)
@@ -467,18 +467,18 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
# Create schedule
water_schedule = nil
water_col_name = SchedulesFile::Columns[:GeneralWaterUse].name
- water_obj_name = Constants.ObjectNameGeneralWaterUse
+ water_obj_name = Constants::ObjectTypeGeneralWaterUse
if not schedules_file.nil?
water_design_level_sens = schedules_file.calc_design_level_from_daily_kwh(col_name: SchedulesFile::Columns[:GeneralWaterUse].name, daily_kwh: UnitConversions.convert(water_sens_btu, 'Btu', 'kWh') / 365.0)
water_design_level_lat = schedules_file.calc_design_level_from_daily_kwh(col_name: SchedulesFile::Columns[:GeneralWaterUse].name, daily_kwh: UnitConversions.convert(water_lat_btu, 'Btu', 'kWh') / 365.0)
- water_schedule = schedules_file.create_schedule_file(model, col_name: water_col_name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ water_schedule = schedules_file.create_schedule_file(model, col_name: water_col_name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
end
if water_schedule.nil?
water_unavailable_periods = Schedule.get_unavailable_periods(runner, water_col_name, unavailable_periods)
water_weekday_sch = hpxml_bldg.building_occupancy.general_water_use_weekday_fractions
water_weekend_sch = hpxml_bldg.building_occupancy.general_water_use_weekend_fractions
water_monthly_sch = hpxml_bldg.building_occupancy.general_water_use_monthly_multipliers
- water_schedule_obj = MonthWeekdayWeekendSchedule.new(model, water_obj_name + ' schedule', water_weekday_sch, water_weekend_sch, water_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: water_unavailable_periods)
+ water_schedule_obj = MonthWeekdayWeekendSchedule.new(model, water_obj_name + ' schedule', water_weekday_sch, water_weekend_sch, water_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: water_unavailable_periods)
water_design_level_sens = water_schedule_obj.calc_design_level_from_daily_kwh(UnitConversions.convert(water_sens_btu, 'Btu', 'kWh') / 365.0)
water_design_level_lat = water_schedule_obj.calc_design_level_from_daily_kwh(UnitConversions.convert(water_lat_btu, 'Btu', 'kWh') / 365.0)
water_schedule = water_schedule_obj.schedule
@@ -487,8 +487,8 @@ def self.apply(model, runner, hpxml_header, hpxml_bldg, weather, spaces, hot_wat
runner.registerWarning("Both '#{water_col_name}' schedule file and weekend fractions provided; the latter will be ignored.") if !hpxml_bldg.building_occupancy.general_water_use_weekend_fractions.nil?
runner.registerWarning("Both '#{water_col_name}' schedule file and monthly multipliers provided; the latter will be ignored.") if !hpxml_bldg.building_occupancy.general_water_use_monthly_multipliers.nil?
end
- add_other_equipment(model, Constants.ObjectNameGeneralWaterUseSensible, conditioned_space, water_design_level_sens, 1.0, 0.0, water_schedule, nil)
- add_other_equipment(model, Constants.ObjectNameGeneralWaterUseLatent, conditioned_space, water_design_level_lat, 0.0, 1.0, water_schedule, nil)
+ add_other_equipment(model, Constants::ObjectTypeGeneralWaterUseSensible, conditioned_space, water_design_level_sens, 1.0, 0.0, water_schedule, nil)
+ add_other_equipment(model, Constants::ObjectTypeGeneralWaterUseLatent, conditioned_space, water_design_level_lat, 0.0, 1.0, water_schedule, nil)
end
end
@@ -557,7 +557,7 @@ def self.calc_range_oven_energy(nbeds_eq, cooking_range, oven, is_outside = fals
# @param eri_version [String] Version of the ANSI/RESNET/ICC 301 Standard to use for equations/assumptions
# @return [TODO] TODO
def self.get_dishwasher_default_values(eri_version)
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2019A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2019A')
return { rated_annual_kwh: 467.0, # kWh/yr
label_electric_rate: 0.12, # $/kWh
label_gas_rate: 1.09, # $/therm
@@ -583,7 +583,7 @@ def self.get_dishwasher_default_values(eri_version)
# @param n_occ [Double] Number of occupants in the dwelling unit
# @return [TODO] TODO
def self.calc_dishwasher_energy_gpd(eri_version, nbeds, dishwasher, is_outside = false, n_occ = nil)
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2019A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2019A')
if dishwasher.rated_annual_kwh.nil?
dishwasher.rated_annual_kwh = calc_dishwasher_annual_kwh_from_ef(dishwasher.energy_factor)
end
@@ -605,7 +605,7 @@ def self.calc_dishwasher_energy_gpd(eri_version, nbeds, dishwasher, is_outside =
dwcpy = (88.4 + 34.9 * nbeds) * (12.0 / dishwasher.place_setting_capacity)
annual_kwh = ((86.3 + 47.73 / dishwasher.energy_factor) / 215.0) * dwcpy
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2014A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2014A')
gpd = dwcpy * (4.6415 * (1.0 / dishwasher.energy_factor) - 1.9295) / 365.0
else
gpd = ((88.4 + 34.9 * nbeds) * 8.16 - (88.4 + 34.9 * nbeds) * 12.0 / dishwasher.place_setting_capacity * (4.6415 * (1.0 / dishwasher.energy_factor) - 1.9295)) / 365.0
@@ -678,7 +678,7 @@ def self.get_freezer_default_values
# @param fuel_type [TODO] TODO
# @return [TODO] TODO
def self.get_clothes_dryer_default_values(eri_version, fuel_type)
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2019A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2019A')
return { combined_energy_factor: 3.01 }
else
if fuel_type == HPXML::FuelTypeElectricity
@@ -701,7 +701,7 @@ def self.get_clothes_dryer_default_values(eri_version, fuel_type)
# @param n_occ [Double] Number of occupants in the dwelling unit
# @return [TODO] TODO
def self.calc_clothes_dryer_energy(eri_version, nbeds, clothes_dryer, clothes_washer, is_outside = false, n_occ = nil)
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2019A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2019A')
if clothes_dryer.combined_energy_factor.nil?
clothes_dryer.combined_energy_factor = calc_clothes_dryer_cef_from_ef(clothes_dryer.energy_factor)
end
@@ -789,7 +789,7 @@ def self.calc_clothes_dryer_ef_from_cef(cef)
# @param eri_version [String] Version of the ANSI/RESNET/ICC 301 Standard to use for equations/assumptions
# @return [TODO] TODO
def self.get_clothes_washer_default_values(eri_version)
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2019A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2019A')
return { integrated_modified_energy_factor: 1.0, # ft3/(kWh/cyc)
rated_annual_kwh: 400.0, # kWh/yr
label_electric_rate: 0.12, # $/kWh
@@ -817,7 +817,7 @@ def self.get_clothes_washer_default_values(eri_version)
# @param n_occ [Double] Number of occupants in the dwelling unit
# @return [TODO] TODO
def self.calc_clothes_washer_energy_gpd(eri_version, nbeds, clothes_washer, is_outside = false, n_occ = nil)
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2019A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2019A')
gas_h20 = 0.3914 # (gal/cyc) per (therm/y)
elec_h20 = 0.0178 # (gal/cyc) per (kWh/y)
lcy = clothes_washer.label_usage * 52.0 # label cycles per year
@@ -837,7 +837,7 @@ def self.calc_clothes_washer_energy_gpd(eri_version, nbeds, clothes_washer, is_o
annual_kwh = ((clothes_washer.rated_annual_kwh / 392.0) - ((clothes_washer.rated_annual_kwh * clothes_washer.label_electric_rate - clothes_washer.label_annual_gas_cost) / (21.9825 * clothes_washer.label_electric_rate - clothes_washer.label_gas_rate) / 392.0) * 21.9825) * acy
gpd = 60.0 * ((clothes_washer.rated_annual_kwh * clothes_washer.label_electric_rate - clothes_washer.label_annual_gas_cost) / (21.9825 * clothes_washer.label_electric_rate - clothes_washer.label_gas_rate) / 392.0) * acy / 365.0
- if Constants.ERIVersions.index(eri_version) < Constants.ERIVersions.index('2014A')
+ if Constants::ERIVersions.index(eri_version) < Constants::ERIVersions.index('2014A')
gpd -= 3.97 # Section 4.2.2.5.2.10
end
end
@@ -916,7 +916,7 @@ def self.calc_refrigerator_or_freezer_energy(refrigerator_or_freezer, is_outside
def self.refrigerator_or_freezer_coefficients_schedule(model, col_name, obj_name, refrigerator_or_freezer, unavailable_periods)
# Create availability sensor
if not unavailable_periods.empty?
- avail_sch = ScheduleConstant.new(model, col_name, 1.0, Constants.ScheduleTypeLimitsFraction, unavailable_periods: unavailable_periods)
+ avail_sch = ScheduleConstant.new(model, col_name, 1.0, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: unavailable_periods)
availability_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
availability_sensor.setName("#{col_name} availability s")
@@ -1102,11 +1102,7 @@ def self.add_other_equipment(model, obj_name, space, design_level_w, frac_sens,
oe = OpenStudio::Model::OtherEquipment.new(oe_def)
oe.setName(obj_name)
oe.setEndUseSubcategory(obj_name)
- if fuel_type.nil?
- oe.setFuelType('None')
- else
- oe.setFuelType(EPlus.fuel_type(fuel_type))
- end
+ oe.setFuelType(EPlus.fuel_type(fuel_type))
oe.setSpace(space)
oe_def.setName(obj_name)
oe_def.setDesignLevel(design_level_w)
@@ -1295,7 +1291,7 @@ def self.get_fixtures_effectiveness(frac_low_flow_fixtures)
# @param n_occ [Double] Number of occupants in the dwelling unit
# @return [TODO] TODO
def self.get_fixtures_gpd(eri_version, nbeds, frac_low_flow_fixtures, daily_mw_fractions, fixtures_usage_multiplier = 1.0, n_occ = nil)
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2014A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2014A')
# ANSI/RESNET 301-2014 Addendum A-2015
# Amendment on Domestic Hot Water (DHW) Systems
if n_occ.nil? # Asset calculation
@@ -1340,7 +1336,7 @@ def self.get_water_gains_sens_lat(nbeds_eq, general_water_use_usage_multiplier =
# @return [TODO] TODO
def self.get_dist_waste_gpd(eri_version, nbeds, has_uncond_bsmnt, has_cond_bsmnt, cfa, ncfl, hot_water_distribution,
frac_low_flow_fixtures, fixtures_usage_multiplier = 1.0, n_occ = nil)
- if Constants.ERIVersions.index(eri_version) <= Constants.ERIVersions.index('2014')
+ if Constants::ERIVersions.index(eri_version) <= Constants::ERIVersions.index('2014')
return 0.0
end
diff --git a/HPXMLtoOpenStudio/resources/hpxml.rb b/HPXMLtoOpenStudio/resources/hpxml.rb
index 8d9ac8f5a0..194bfce072 100644
--- a/HPXMLtoOpenStudio/resources/hpxml.rb
+++ b/HPXMLtoOpenStudio/resources/hpxml.rb
@@ -72,7 +72,6 @@ class HPXML < Object
BatteryTypeLithiumIon = 'Li-ion'
BatteryLifetimeModelNone = 'None'
BatteryLifetimeModelKandlerSmith = 'KandlerSmith'
- BuildingAmerica = 'BuildingAmerica'
CapacityDescriptionMinimum = 'minimum'
CapacityDescriptionMaximum = 'maximum'
CertificationEnergyStar = 'Energy Star'
diff --git a/HPXMLtoOpenStudio/resources/hpxml_defaults.rb b/HPXMLtoOpenStudio/resources/hpxml_defaults.rb
index 830b83fe1e..5dc0f95eb9 100644
--- a/HPXMLtoOpenStudio/resources/hpxml_defaults.rb
+++ b/HPXMLtoOpenStudio/resources/hpxml_defaults.rb
@@ -150,12 +150,12 @@ def self.unspin_azimuth(azimuth)
def self.add_zones_spaces_if_needed(hpxml, hpxml_bldg, cfa)
bldg_idx = hpxml.buildings.index(hpxml_bldg)
if hpxml_bldg.conditioned_zones.empty?
- hpxml_bldg.zones.add(id: "#{Constants.AutomaticallyAdded}Zone#{bldg_idx + 1}",
+ hpxml_bldg.zones.add(id: "#{Constants::AutomaticallyAdded}Zone#{bldg_idx + 1}",
zone_type: HPXML::ZoneTypeConditioned)
hpxml_bldg.hvac_systems.each do |hvac_system|
hvac_system.attached_to_zone_idref = hpxml_bldg.zones[-1].id
end
- hpxml_bldg.zones[-1].spaces.add(id: "#{Constants.AutomaticallyAdded}Space#{bldg_idx + 1}",
+ hpxml_bldg.zones[-1].spaces.add(id: "#{Constants::AutomaticallyAdded}Space#{bldg_idx + 1}",
floor_area: cfa)
hpxml_bldg.surfaces.each do |surface|
next unless HPXML::conditioned_locations_this_unit.include? surface.interior_adjacent_to
@@ -384,7 +384,7 @@ def self.apply_building_header(hpxml_header, hpxml_bldg, weather)
if not weather.nil?
# Default based on Building America seasons
_, default_cooling_months = HVAC.get_default_heating_and_cooling_seasons(weather, hpxml_bldg.latitude)
- begin_month, begin_day, end_month, end_day = Schedule.get_begin_and_end_dates_from_monthly_array(default_cooling_months, hpxml_header.sim_calendar_year)
+ begin_month, begin_day, end_month, end_day = Calendar.get_begin_and_end_dates_from_monthly_array(default_cooling_months, hpxml_header.sim_calendar_year)
if not begin_month.nil? # Check if no summer
hpxml_bldg.header.shading_summer_begin_month = begin_month
hpxml_bldg.header.shading_summer_begin_day = begin_day
@@ -3418,7 +3418,7 @@ def self.apply_ceiling_fans(hpxml_bldg, nbeds, weather, schedules_file)
ceiling_fan.weekend_fractions_isdefaulted = true
end
if ceiling_fan.monthly_multipliers.nil? && !schedules_file_includes_ceiling_fan
- ceiling_fan.monthly_multipliers = Schedule.CeilingFanMonthlyMultipliers(weather: weather)
+ ceiling_fan.monthly_multipliers = HVAC.get_default_ceiling_fan_months(weather).join(', ')
ceiling_fan.monthly_multipliers_isdefaulted = true
end
end
@@ -3946,9 +3946,9 @@ def self.get_default_state_code(state_code, weather)
# @param hpxml_bldg [HPXML::Building] HPXML Building object representing an individual dwelling unit
# @return [nil]
def self.cleanup_zones_spaces(hpxml_bldg)
- auto_space = hpxml_bldg.conditioned_spaces.find { |space| space.id.start_with? Constants.AutomaticallyAdded }
+ auto_space = hpxml_bldg.conditioned_spaces.find { |space| space.id.start_with? Constants::AutomaticallyAdded }
auto_space.delete if not auto_space.nil?
- auto_zone = hpxml_bldg.conditioned_zones.find { |zone| zone.id.start_with? Constants.AutomaticallyAdded }
+ auto_zone = hpxml_bldg.conditioned_zones.find { |zone| zone.id.start_with? Constants::AutomaticallyAdded }
auto_zone.delete if not auto_zone.nil?
end
diff --git a/HPXMLtoOpenStudio/resources/hvac.rb b/HPXMLtoOpenStudio/resources/hvac.rb
index d853dd4465..5736b7f28c 100644
--- a/HPXMLtoOpenStudio/resources/hvac.rb
+++ b/HPXMLtoOpenStudio/resources/hvac.rb
@@ -52,14 +52,14 @@ def self.apply_air_source_hvac_systems(model, runner, cooling_system, heating_sy
if cooling_system.is_a? HPXML::HeatPump
is_heatpump = true
if cooling_system.heat_pump_type == HPXML::HVACTypeHeatPumpAirToAir
- obj_name = Constants.ObjectNameAirSourceHeatPump
+ obj_name = Constants::ObjectTypeAirSourceHeatPump
elsif cooling_system.heat_pump_type == HPXML::HVACTypeHeatPumpMiniSplit
- obj_name = Constants.ObjectNameMiniSplitHeatPump
+ obj_name = Constants::ObjectTypeMiniSplitHeatPump
elsif cooling_system.heat_pump_type == HPXML::HVACTypeHeatPumpPTHP
- obj_name = Constants.ObjectNamePTHP
+ obj_name = Constants::ObjectTypePTHP
fan_watts_per_cfm = 0.0
elsif cooling_system.heat_pump_type == HPXML::HVACTypeHeatPumpRoom
- obj_name = Constants.ObjectNameRoomHP
+ obj_name = Constants::ObjectTypeRoomHP
fan_watts_per_cfm = 0.0
else
fail "Unexpected heat pump type: #{cooling_system.heat_pump_type}."
@@ -67,9 +67,9 @@ def self.apply_air_source_hvac_systems(model, runner, cooling_system, heating_sy
elsif cooling_system.is_a? HPXML::CoolingSystem
if cooling_system.cooling_system_type == HPXML::HVACTypeCentralAirConditioner
if heating_system.nil?
- obj_name = Constants.ObjectNameCentralAirConditioner
+ obj_name = Constants::ObjectTypeCentralAirConditioner
else
- obj_name = Constants.ObjectNameCentralAirConditionerAndFurnace
+ obj_name = Constants::ObjectTypeCentralAirConditionerAndFurnace
# error checking for fan power
if (cooling_system.fan_watts_per_cfm.to_f != heating_system.fan_watts_per_cfm.to_f)
fail "Fan powers for heating system '#{heating_system.id}' and cooling system '#{cooling_system.id}' are attached to a single distribution system and therefore must be the same."
@@ -78,18 +78,18 @@ def self.apply_air_source_hvac_systems(model, runner, cooling_system, heating_sy
elsif [HPXML::HVACTypeRoomAirConditioner, HPXML::HVACTypePTAC].include? cooling_system.cooling_system_type
fan_watts_per_cfm = 0.0
if cooling_system.cooling_system_type == HPXML::HVACTypeRoomAirConditioner
- obj_name = Constants.ObjectNameRoomAirConditioner
+ obj_name = Constants::ObjectTypeRoomAC
else
- obj_name = Constants.ObjectNamePTAC
+ obj_name = Constants::ObjectTypePTAC
end
elsif cooling_system.cooling_system_type == HPXML::HVACTypeMiniSplitAirConditioner
- obj_name = Constants.ObjectNameMiniSplitAirConditioner
+ obj_name = Constants::ObjectTypeMiniSplitAirConditioner
else
fail "Unexpected cooling system type: #{cooling_system.cooling_system_type}."
end
end
elsif (heating_system.is_a? HPXML::HeatingSystem) && (heating_system.heating_system_type == HPXML::HVACTypeFurnace)
- obj_name = Constants.ObjectNameFurnace
+ obj_name = Constants::ObjectTypeFurnace
else
fail "Unexpected heating system type: #{heating_system.heating_system_type}, expect central air source hvac systems."
end
@@ -273,7 +273,7 @@ def self.apply_air_source_hvac_systems(model, runner, cooling_system, heating_sy
def self.apply_evaporative_cooler(model, cooling_system, sequential_cool_load_fracs, control_zone,
hvac_unavailable_periods, unit_multiplier)
- obj_name = Constants.ObjectNameEvaporativeCooler
+ obj_name = Constants::ObjectTypeEvaporativeCooler
clg_ap = cooling_system.additional_properties
clg_cfm = cooling_system.cooling_airflow_cfm
@@ -345,7 +345,7 @@ def self.apply_ground_to_air_heat_pump(model, runner, weather, heat_pump,
fail 'NumberofUnits greater than 1 is not supported for ground-to-air heat pumps.'
end
- obj_name = Constants.ObjectNameGroundSourceHeatPump
+ obj_name = Constants::ObjectTypeGroundSourceHeatPump
geothermal_loop = heat_pump.geothermal_loop
hp_ap = heat_pump.additional_properties
@@ -356,8 +356,8 @@ def self.apply_ground_to_air_heat_pump(model, runner, weather, heat_pump,
clg_cfm_rated = heat_pump.airflow_defect_ratio.nil? ? clg_cfm : (clg_cfm / (1.0 + heat_pump.airflow_defect_ratio))
if hp_ap.frac_glycol == 0
- hp_ap.fluid_type = Constants.FluidWater
- runner.registerWarning("Specified #{hp_ap.fluid_type} fluid type and 0 fraction of glycol, so assuming #{Constants.FluidWater} fluid type.")
+ hp_ap.fluid_type = EPlus::FluidWater
+ runner.registerWarning("Specified #{hp_ap.fluid_type} fluid type and 0 fraction of glycol, so assuming #{EPlus::FluidWater} fluid type.")
end
# Apply unit multiplier
@@ -434,10 +434,8 @@ def self.apply_ground_to_air_heat_pump(model, runner, weather, heat_pump,
# Plant Loop
plant_loop = OpenStudio::Model::PlantLoop.new(model)
plant_loop.setName(obj_name + ' condenser loop')
- if hp_ap.fluid_type == Constants.FluidWater
- plant_loop.setFluidType('Water')
- else
- plant_loop.setFluidType({ Constants.FluidPropyleneGlycol => 'PropyleneGlycol', Constants.FluidEthyleneGlycol => 'EthyleneGlycol' }[hp_ap.fluid_type])
+ plant_loop.setFluidType(hp_ap.fluid_type)
+ if hp_ap.fluid_type != EPlus::FluidWater
plant_loop.setGlycolConcentration((hp_ap.frac_glycol * 100).to_i)
end
plant_loop.setMaximumLoopTemperature(48.88889)
@@ -509,7 +507,7 @@ def self.apply_ground_to_air_heat_pump(model, runner, weather, heat_pump,
# Shared pump power per ANSI/RESNET/ICC 301-2019 Section 4.4.5.1 (pump runs 8760)
shared_pump_w = heat_pump.shared_loop_watts / heat_pump.number_of_units_served.to_f
equip_def = OpenStudio::Model::ElectricEquipmentDefinition.new(model)
- equip_def.setName(Constants.ObjectNameGSHPSharedPump)
+ equip_def.setName(Constants::ObjectTypeGSHPSharedPump)
equip = OpenStudio::Model::ElectricEquipment.new(equip_def)
equip.setName(equip_def.name.to_s)
equip.setSpace(control_zone.spaces[0]) # no heat gain, so assign the equipment to an arbitrary space
@@ -518,7 +516,7 @@ def self.apply_ground_to_air_heat_pump(model, runner, weather, heat_pump,
equip_def.setFractionLatent(0)
equip_def.setFractionLost(1)
equip.setSchedule(model.alwaysOnDiscreteSchedule)
- equip.setEndUseSubcategory(Constants.ObjectNameGSHPSharedPump)
+ equip.setEndUseSubcategory(Constants::ObjectTypeGSHPSharedPump)
equip.additionalProperties.setFeature('HPXML_ID', heat_pump.id) # Used by reporting measure
end
@@ -549,7 +547,7 @@ def self.apply_water_loop_to_air_heat_pump(model, heat_pump,
fail 'WLHP model should only be called for central boilers.'
end
- obj_name = Constants.ObjectNameWaterLoopHeatPump
+ obj_name = Constants::ObjectTypeWaterLoopHeatPump
htg_cfm = heat_pump.heating_airflow_cfm
@@ -595,7 +593,7 @@ def self.apply_water_loop_to_air_heat_pump(model, heat_pump,
# @param hvac_unavailable_periods [TODO] TODO
# @return [TODO] TODO
def self.apply_boiler(model, runner, heating_system, sequential_heat_load_fracs, control_zone, hvac_unavailable_periods)
- obj_name = Constants.ObjectNameBoiler
+ obj_name = Constants::ObjectTypeBoiler
is_condensing = false # FUTURE: Expose as input; default based on AFUE
oat_reset_enabled = false
oat_high = nil
@@ -614,7 +612,7 @@ def self.apply_boiler(model, runner, heating_system, sequential_heat_load_fracs,
# Plant Loop
plant_loop = OpenStudio::Model::PlantLoop.new(model)
plant_loop.setName(obj_name + ' hydronic heat loop')
- plant_loop.setFluidType('Water')
+ plant_loop.setFluidType(EPlus::FluidWater)
plant_loop.setMaximumLoopTemperature(100)
plant_loop.setMinimumLoopTemperature(0)
plant_loop.setMinimumLoopFlowRate(0)
@@ -791,7 +789,7 @@ def self.apply_boiler(model, runner, heating_system, sequential_heat_load_fracs,
def self.apply_electric_baseboard(model, heating_system,
sequential_heat_load_fracs, control_zone, hvac_unavailable_periods)
- obj_name = Constants.ObjectNameElectricBaseboard
+ obj_name = Constants::ObjectTypeElectricBaseboard
# Baseboard
zone_hvac = OpenStudio::Model::ZoneHVACBaseboardConvectiveElectric.new(model)
@@ -816,7 +814,7 @@ def self.apply_electric_baseboard(model, heating_system,
def self.apply_unit_heater(model, heating_system,
sequential_heat_load_fracs, control_zone, hvac_unavailable_periods)
- obj_name = Constants.ObjectNameUnitHeater
+ obj_name = Constants::ObjectTypeUnitHeater
# Heating Coil
efficiency = heating_system.heating_efficiency_afue
@@ -861,7 +859,7 @@ def self.apply_unit_heater(model, heating_system,
def self.apply_ideal_air_loads(model, sequential_cool_load_fracs,
sequential_heat_load_fracs, control_zone, hvac_unavailable_periods)
- obj_name = Constants.ObjectNameIdealAirSystem
+ obj_name = Constants::ObjectTypeIdealAirSystem
# Ideal Air System
ideal_air = OpenStudio::Model::ZoneHVACIdealLoadsAirSystem.new(model)
@@ -933,7 +931,7 @@ def self.apply_dehumidifiers(runner, model, dehumidifiers, conditioned_space, un
total_capacity *= unit_multiplier
control_zone = conditioned_space.thermalZone.get
- obj_name = Constants.ObjectNameDehumidifier
+ obj_name = Constants::ObjectTypeDehumidifier
rh_setpoint = dehumidifiers[0].rh_setpoint * 100.0 # (EnergyPlus uses 60 for 60% RH)
relative_humidity_setpoint_sch = OpenStudio::Model::ScheduleConstant.new(model)
@@ -956,7 +954,7 @@ def self.apply_dehumidifiers(runner, model, dehumidifiers, conditioned_space, un
# Availability Schedule
dehum_unavailable_periods = Schedule.get_unavailable_periods(runner, SchedulesFile::Columns[:Dehumidifier].name, unavailable_periods)
- avail_sch = ScheduleConstant.new(model, obj_name + ' schedule', 1.0, Constants.ScheduleTypeLimitsFraction, unavailable_periods: dehum_unavailable_periods)
+ avail_sch = ScheduleConstant.new(model, obj_name + ' schedule', 1.0, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: dehum_unavailable_periods)
avail_sch = avail_sch.schedule
# Dehumidifier
@@ -988,7 +986,7 @@ def self.apply_dehumidifiers(runner, model, dehumidifiers, conditioned_space, un
# @return [TODO] TODO
def self.apply_ceiling_fans(model, runner, weather, ceiling_fan, conditioned_space, schedules_file,
unavailable_periods)
- obj_name = Constants.ObjectNameCeilingFan
+ obj_name = Constants::ObjectTypeCeilingFan
hrs_per_day = 10.5 # From ANSI 301-2019
cfm_per_w = ceiling_fan.efficiency
label_energy_use = ceiling_fan.label_energy_use
@@ -1004,7 +1002,7 @@ def self.apply_ceiling_fans(model, runner, weather, ceiling_fan, conditioned_spa
ceiling_fan_sch = nil
ceiling_fan_col_name = SchedulesFile::Columns[:CeilingFan].name
if not schedules_file.nil?
- annual_kwh *= Schedule.CeilingFanMonthlyMultipliers(weather: weather).split(',').map(&:to_f).sum(0.0) / 12.0
+ annual_kwh *= HVAC.get_default_ceiling_fan_months(weather).map(&:to_f).sum(0.0) / 12.0
ceiling_fan_design_level = schedules_file.calc_design_level_from_annual_kwh(col_name: ceiling_fan_col_name, annual_kwh: annual_kwh)
ceiling_fan_sch = schedules_file.create_schedule_file(model, col_name: ceiling_fan_col_name)
end
@@ -1014,7 +1012,7 @@ def self.apply_ceiling_fans(model, runner, weather, ceiling_fan, conditioned_spa
weekday_sch = ceiling_fan.weekday_fractions
weekend_sch = ceiling_fan.weekend_fractions
monthly_sch = ceiling_fan.monthly_multipliers
- ceiling_fan_sch_obj = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', weekday_sch, weekend_sch, monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: ceiling_fan_unavailable_periods)
+ ceiling_fan_sch_obj = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', weekday_sch, weekend_sch, monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: ceiling_fan_unavailable_periods)
ceiling_fan_design_level = ceiling_fan_sch_obj.calc_design_level_from_daily_kwh(annual_kwh / 365.0)
ceiling_fan_sch = ceiling_fan_sch_obj.schedule
else
@@ -1119,7 +1117,7 @@ def self.create_setpoint_schedules(runner, heating_days, cooling_days, htg_weekd
# by natural ventilation, Kiva initialization, and probably other things.
warning = false
- for i in 0..(Constants.NumDaysInYear(year) - 1)
+ for i in 0..(Calendar.num_days_in_year(year) - 1)
if (heating_days[i] == cooling_days[i]) # both (or neither) heating/cooling seasons
htg_wkdy = htg_weekday_setpoints[i].zip(clg_weekday_setpoints[i]).map { |h, c| c < h ? (h + c) / 2.0 : h }
htg_wked = htg_weekend_setpoints[i].zip(clg_weekend_setpoints[i]).map { |h, c| c < h ? (h + c) / 2.0 : h }
@@ -1161,7 +1159,7 @@ def self.create_setpoint_schedules(runner, heating_days, cooling_days, htg_weekd
# @param offset_db [Float] On-off thermostat deadband (F)
# @return [TODO] TODO
def self.get_heating_setpoints(hvac_control, year, offset_db)
- num_days = Constants.NumDaysInYear(year)
+ num_days = Calendar.num_days_in_year(year)
if hvac_control.weekday_heating_setpoints.nil? || hvac_control.weekend_heating_setpoints.nil?
# Base heating setpoint
@@ -1205,7 +1203,7 @@ def self.get_heating_setpoints(hvac_control, year, offset_db)
# @param offset_db [Float] On-off thermostat deadband (F)
# @return [TODO] TODO
def self.get_cooling_setpoints(hvac_control, has_ceiling_fan, year, weather, offset_db)
- num_days = Constants.NumDaysInYear(year)
+ num_days = Calendar.num_days_in_year(year)
if hvac_control.weekday_cooling_setpoints.nil? || hvac_control.weekend_cooling_setpoints.nil?
# Base cooling setpoint
@@ -1235,7 +1233,7 @@ def self.get_cooling_setpoints(hvac_control, has_ceiling_fan, year, weather, off
clg_ceiling_fan_offset = hvac_control.ceiling_fan_cooling_setpoint_temp_offset
if not clg_ceiling_fan_offset.nil?
months = get_default_ceiling_fan_months(weather)
- Schedule.months_to_days(year, months).each_with_index do |operation, d|
+ Calendar.months_to_days(year, months).each_with_index do |operation, d|
next if operation != 1
clg_weekday_setpoints[d] = [clg_weekday_setpoints[d], Array.new(24, clg_ceiling_fan_offset)].transpose.map { |i| i.sum }
@@ -1263,7 +1261,7 @@ def self.get_default_heating_setpoint(control_type, eri_version)
htg_weekday_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'
htg_weekend_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'
if control_type == HPXML::HVACControlTypeProgrammable
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2022')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2022')
htg_weekday_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'
htg_weekend_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'
else
@@ -1286,7 +1284,7 @@ def self.get_default_cooling_setpoint(control_type, eri_version)
clg_weekday_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'
clg_weekend_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'
if control_type == HPXML::HVACControlTypeProgrammable
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2022')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2022')
clg_weekday_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'
clg_weekend_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
@@ -2112,9 +2110,9 @@ def self.disaggregate_fan_or_pump(model, fan_or_pump, htg_object, clg_object, ba
next if sensor.nil?
fan_or_pump_ems_output_var = OpenStudio::Model::EnergyManagementSystemOutputVariable.new(model, "#{fan_or_pump_var}_#{mode}")
- object_type = { 'clg' => Constants.ObjectNameFanPumpDisaggregateCool,
- 'primary_htg' => Constants.ObjectNameFanPumpDisaggregatePrimaryHeat,
- 'backup_htg' => Constants.ObjectNameFanPumpDisaggregateBackupHeat }[mode]
+ object_type = { 'clg' => Constants::ObjectTypeFanPumpDisaggregateCool,
+ 'primary_htg' => Constants::ObjectTypeFanPumpDisaggregatePrimaryHeat,
+ 'backup_htg' => Constants::ObjectTypeFanPumpDisaggregateBackupHeat }[mode]
fan_or_pump_ems_output_var.setName("#{fan_or_pump.name} #{object_type}")
fan_or_pump_ems_output_var.setTypeOfDataInVariable('Summed')
fan_or_pump_ems_output_var.setUpdateFrequency('SystemTimestep')
@@ -2319,7 +2317,7 @@ def self.set_fan_power(fan, fan_watts_per_cfm)
def self.create_air_loop_unitary_system(model, obj_name, fan, htg_coil, clg_coil, htg_supp_coil, htg_cfm, clg_cfm, supp_max_temp = nil)
cycle_fan_sch = OpenStudio::Model::ScheduleConstant.new(model)
cycle_fan_sch.setName(obj_name + ' auto fan schedule')
- Schedule.set_schedule_type_limits(model, cycle_fan_sch, Constants.ScheduleTypeLimitsOnOff)
+ Schedule.set_schedule_type_limits(model, cycle_fan_sch, EPlus::ScheduleTypeLimitsOnOff)
cycle_fan_sch.setValue(0) # 0 denotes that fan cycles on and off to meet the load (i.e., AUTO fan) as opposed to continuous operation
air_loop_unitary = OpenStudio::Model::AirLoopHVACUnitarySystem.new(model)
@@ -3759,7 +3757,7 @@ def self.apply_max_power_EMS(model, runner, air_loop_unitary, control_zone, heat
return if schedules_file.nil?
return if clg_coil.nil? && htg_coil.nil?
- max_pow_ratio_sch = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:HVACMaximumPowerRatio].name, schedule_type_limits_name: Constants.ScheduleTypeLimitsFraction)
+ max_pow_ratio_sch = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:HVACMaximumPowerRatio].name, schedule_type_limits_name: EPlus::ScheduleTypeLimitsFraction)
return if max_pow_ratio_sch.nil?
# Check maximum power ratio schedules only used in var speed systems,
@@ -4258,9 +4256,9 @@ def self.set_gshp_assumptions(heat_pump, weather)
hp_ap.design_chw = [85.0, weather.design.CoolingDrybulb - 15.0, weather.data.DeepGroundAnnualTemp + 10.0].max # Temperature of water entering indoor coil, use 85F as lower bound
hp_ap.design_delta_t = 10.0
- hp_ap.fluid_type = Constants.FluidPropyleneGlycol
+ hp_ap.fluid_type = EPlus::FluidPropyleneGlycol
hp_ap.frac_glycol = 0.2 # This was changed from 0.3 to 0.2 -- more typical based on experts/spec sheets
- if hp_ap.fluid_type == Constants.FluidWater
+ if hp_ap.fluid_type == EPlus::FluidWater
hp_ap.design_hw = [45.0, weather.design.HeatingDrybulb + 35.0, weather.data.DeepGroundAnnualTemp - 10.0].max # Temperature of fluid entering indoor coil, use 45F as lower bound for water
else
hp_ap.design_hw = [35.0, weather.design.HeatingDrybulb + 35.0, weather.data.DeepGroundAnnualTemp - 10.0].min # Temperature of fluid entering indoor coil, use 35F as upper bound
@@ -4327,13 +4325,13 @@ def self.get_sequential_load_schedule(model, fractions, unavailable_periods)
sch_name = 'Sequential Fraction Schedule'
if values.uniq.length == 1
- s = ScheduleConstant.new(model, sch_name, values[0], Constants.ScheduleTypeLimitsFraction, unavailable_periods: unavailable_periods)
+ s = ScheduleConstant.new(model, sch_name, values[0], EPlus::ScheduleTypeLimitsFraction, unavailable_periods: unavailable_periods)
s = s.schedule
else
s = Schedule.create_ruleset_from_daily_season(model, values)
s.setName(sch_name)
Schedule.set_unavailable_periods(s, sch_name, unavailable_periods, model.getYearDescription.assumedYear)
- Schedule.set_schedule_type_limits(model, s, Constants.ScheduleTypeLimitsFraction)
+ Schedule.set_schedule_type_limits(model, s, EPlus::ScheduleTypeLimitsFraction)
end
return s
@@ -4891,7 +4889,7 @@ def self.apply_advanced_defrost(model, htg_coil, air_loop_unitary, conditioned_s
defrost_supp_heat_energy_oe.setSpace(conditioned_space)
defrost_supp_heat_energy_oe.setFuelType(energyplus_fuel)
defrost_supp_heat_energy_oe.setSchedule(model.alwaysOnDiscreteSchedule)
- defrost_supp_heat_energy_oe.setEndUseSubcategory(Constants.ObjectNameBackupSuppHeat)
+ defrost_supp_heat_energy_oe.setEndUseSubcategory(Constants::ObjectTypeBackupSuppHeat)
defrost_supp_heat_energy_oe.additionalProperties.setFeature('HPXML_ID', heat_pump.id) # Used by reporting measure
defrost_supp_heat_energy_oe.additionalProperties.setFeature('IsHeatPumpBackup', true) # Used by reporting measure
diff --git a/HPXMLtoOpenStudio/resources/hvac_sizing.rb b/HPXMLtoOpenStudio/resources/hvac_sizing.rb
index 047b669f5e..ed3b2fdc83 100644
--- a/HPXMLtoOpenStudio/resources/hvac_sizing.rb
+++ b/HPXMLtoOpenStudio/resources/hvac_sizing.rb
@@ -90,7 +90,7 @@ def self.calculate(runner, weather, hpxml_bldg, hvac_systems, update_hpxml: true
bldg_loads = aggregate_zone_loads_to_bldg(all_zone_loads)
# Remove any automatically created spaces from output files
- auto_space = all_space_loads.keys.find { |space| space.id.start_with? Constants.AutomaticallyAdded }
+ auto_space = all_space_loads.keys.find { |space| space.id.start_with? Constants::AutomaticallyAdded }
all_space_loads.delete(auto_space) if not auto_space.nil?
# Assign design loads to HPXML objects for output
@@ -100,7 +100,7 @@ def self.calculate(runner, weather, hpxml_bldg, hvac_systems, update_hpxml: true
# HPXML Zones
all_zone_loads.each do |zone, zone_loads|
- next if zone.id.start_with? Constants.AutomaticallyAdded
+ next if zone.id.start_with? Constants::AutomaticallyAdded
assign_to_hpxml_obj(zone, zone_loads)
end
@@ -2655,7 +2655,7 @@ def self.apply_hvac_autosizing_factors_and_limits(hvac_sizings, hvac_heating, hv
if not hvac_cooling.nil?
cooling_autosizing_limit = hvac_cooling.cooling_autosizing_limit
if cooling_autosizing_limit.nil?
- cooling_autosizing_limit = 1 / Constants.small
+ cooling_autosizing_limit = 1 / Constants::Small
end
cooling_autosizing_factor = [hvac_cooling.cooling_autosizing_factor, cooling_autosizing_limit / hvac_sizings.Cool_Capacity].min
@@ -2667,7 +2667,7 @@ def self.apply_hvac_autosizing_factors_and_limits(hvac_sizings, hvac_heating, hv
if not hvac_heating.nil?
heating_autosizing_limit = hvac_heating.heating_autosizing_limit
if heating_autosizing_limit.nil?
- heating_autosizing_limit = 1 / Constants.small
+ heating_autosizing_limit = 1 / Constants::Small
end
heating_autosizing_factor = [hvac_heating.heating_autosizing_factor, heating_autosizing_limit / hvac_sizings.Heat_Capacity].min
@@ -2678,7 +2678,7 @@ def self.apply_hvac_autosizing_factors_and_limits(hvac_sizings, hvac_heating, hv
if (hvac_cooling.is_a? HPXML::HeatPump) && (hvac_cooling.backup_type == HPXML::HeatPumpBackupTypeIntegrated)
backup_heating_autosizing_limit = hvac_cooling.backup_heating_autosizing_limit
if backup_heating_autosizing_limit.nil?
- backup_heating_autosizing_limit = 1 / Constants.small
+ backup_heating_autosizing_limit = 1 / Constants::Small
end
backup_heating_autosizing_factor = [hvac_cooling.backup_heating_autosizing_factor, backup_heating_autosizing_limit / hvac_sizings.Heat_Capacity_Supp].min
@@ -4749,7 +4749,7 @@ def self.get_surfaces_with_property(obj, additional_property_type)
end
# Note: Every report name must have the HPXML BuildingID in it in case we are running a whole MF building with multiple Building elements.
- if hpxml_bldg.conditioned_zones[0].id.start_with?(Constants.AutomaticallyAdded)
+ if hpxml_bldg.conditioned_zones[0].id.start_with?(Constants::AutomaticallyAdded)
zone_col_names = ["#{hpxml_bldg.building_id}"] # Leave out name of automatically added zone
else
zone_col_names = all_zone_loads.keys.map { |zone| "#{hpxml_bldg.building_id}: #{zone.id}" }
diff --git a/HPXMLtoOpenStudio/resources/lighting.rb b/HPXMLtoOpenStudio/resources/lighting.rb
index 7fd7c7d52f..d78447afb3 100644
--- a/HPXMLtoOpenStudio/resources/lighting.rb
+++ b/HPXMLtoOpenStudio/resources/lighting.rb
@@ -77,7 +77,7 @@ def self.apply(runner, model, spaces, lighting_groups, lighting, eri_version, sc
# Create schedule
interior_sch = nil
interior_col_name = SchedulesFile::Columns[:LightingInterior].name
- interior_obj_name = Constants.ObjectNameLightingInterior
+ interior_obj_name = Constants::ObjectTypeLightingInterior
if not schedules_file.nil?
design_level = schedules_file.calc_design_level_from_annual_kwh(col_name: interior_col_name, annual_kwh: int_kwh)
interior_sch = schedules_file.create_schedule_file(model, col_name: interior_col_name)
@@ -87,7 +87,7 @@ def self.apply(runner, model, spaces, lighting_groups, lighting, eri_version, sc
interior_weekday_sch = lighting.interior_weekday_fractions
interior_weekend_sch = lighting.interior_weekend_fractions
interior_monthly_sch = lighting.interior_monthly_multipliers
- interior_sch = MonthWeekdayWeekendSchedule.new(model, interior_obj_name + ' schedule', interior_weekday_sch, interior_weekend_sch, interior_monthly_sch, Constants.ScheduleTypeLimitsFraction, unavailable_periods: interior_unavailable_periods)
+ interior_sch = MonthWeekdayWeekendSchedule.new(model, interior_obj_name + ' schedule', interior_weekday_sch, interior_weekend_sch, interior_monthly_sch, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: interior_unavailable_periods)
design_level = interior_sch.calc_design_level_from_daily_kwh(int_kwh / 365.0)
interior_sch = interior_sch.schedule
else
@@ -116,14 +116,14 @@ def self.apply(runner, model, spaces, lighting_groups, lighting, eri_version, sc
# Create schedule
garage_sch = nil
garage_col_name = SchedulesFile::Columns[:LightingGarage].name
- garage_obj_name = Constants.ObjectNameLightingGarage
+ garage_obj_name = Constants::ObjectTypeLightingGarage
if not schedules_file.nil?
design_level = schedules_file.calc_design_level_from_annual_kwh(col_name: garage_col_name, annual_kwh: grg_kwh)
garage_sch = schedules_file.create_schedule_file(model, col_name: garage_col_name)
end
if garage_sch.nil?
garage_unavailable_periods = Schedule.get_unavailable_periods(runner, garage_col_name, unavailable_periods)
- garage_sch = MonthWeekdayWeekendSchedule.new(model, garage_obj_name + ' schedule', lighting.garage_weekday_fractions, lighting.garage_weekend_fractions, lighting.garage_monthly_multipliers, Constants.ScheduleTypeLimitsFraction, unavailable_periods: garage_unavailable_periods)
+ garage_sch = MonthWeekdayWeekendSchedule.new(model, garage_obj_name + ' schedule', lighting.garage_weekday_fractions, lighting.garage_weekend_fractions, lighting.garage_monthly_multipliers, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: garage_unavailable_periods)
design_level = garage_sch.calc_design_level_from_daily_kwh(grg_kwh / 365.0)
garage_sch = garage_sch.schedule
else
@@ -152,14 +152,14 @@ def self.apply(runner, model, spaces, lighting_groups, lighting, eri_version, sc
# Create schedule
exterior_sch = nil
exterior_col_name = SchedulesFile::Columns[:LightingExterior].name
- exterior_obj_name = Constants.ObjectNameLightingExterior
+ exterior_obj_name = Constants::ObjectTypeLightingExterior
if not schedules_file.nil?
design_level = schedules_file.calc_design_level_from_annual_kwh(col_name: exterior_col_name, annual_kwh: ext_kwh)
exterior_sch = schedules_file.create_schedule_file(model, col_name: exterior_col_name)
end
if exterior_sch.nil?
exterior_unavailable_periods = Schedule.get_unavailable_periods(runner, exterior_col_name, unavailable_periods)
- exterior_sch = MonthWeekdayWeekendSchedule.new(model, exterior_obj_name + ' schedule', lighting.exterior_weekday_fractions, lighting.exterior_weekend_fractions, lighting.exterior_monthly_multipliers, Constants.ScheduleTypeLimitsFraction, unavailable_periods: exterior_unavailable_periods)
+ exterior_sch = MonthWeekdayWeekendSchedule.new(model, exterior_obj_name + ' schedule', lighting.exterior_weekday_fractions, lighting.exterior_weekend_fractions, lighting.exterior_monthly_multipliers, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: exterior_unavailable_periods)
design_level = exterior_sch.calc_design_level_from_daily_kwh(ext_kwh / 365.0)
exterior_sch = exterior_sch.schedule
else
@@ -184,7 +184,7 @@ def self.apply(runner, model, spaces, lighting_groups, lighting, eri_version, sc
# Create schedule
exterior_holiday_sch = nil
exterior_holiday_col_name = SchedulesFile::Columns[:LightingExteriorHoliday].name
- exterior_holiday_obj_name = Constants.ObjectNameLightingExteriorHoliday
+ exterior_holiday_obj_name = Constants::ObjectTypeLightingExteriorHoliday
exterior_holiday_kwh_per_day = lighting.holiday_kwh_per_day * unit_multiplier
if not schedules_file.nil?
design_level = schedules_file.calc_design_level_from_daily_kwh(col_name: exterior_holiday_col_name, daily_kwh: exterior_holiday_kwh_per_day)
@@ -192,7 +192,7 @@ def self.apply(runner, model, spaces, lighting_groups, lighting, eri_version, sc
end
if exterior_holiday_sch.nil?
exterior_holiday_unavailable_periods = Schedule.get_unavailable_periods(runner, exterior_holiday_col_name, unavailable_periods)
- exterior_holiday_sch = MonthWeekdayWeekendSchedule.new(model, exterior_holiday_obj_name + ' schedule', lighting.holiday_weekday_fractions, lighting.holiday_weekend_fractions, lighting.exterior_monthly_multipliers, Constants.ScheduleTypeLimitsFraction, true, lighting.holiday_period_begin_month, lighting.holiday_period_begin_day, lighting.holiday_period_end_month, lighting.holiday_period_end_day, unavailable_periods: exterior_holiday_unavailable_periods)
+ exterior_holiday_sch = MonthWeekdayWeekendSchedule.new(model, exterior_holiday_obj_name + ' schedule', lighting.holiday_weekday_fractions, lighting.holiday_weekend_fractions, lighting.exterior_monthly_multipliers, EPlus::ScheduleTypeLimitsFraction, true, lighting.holiday_period_begin_month, lighting.holiday_period_begin_day, lighting.holiday_period_end_month, lighting.holiday_period_end_day, unavailable_periods: exterior_holiday_unavailable_periods)
design_level = exterior_holiday_sch.calc_design_level_from_daily_kwh(exterior_holiday_kwh_per_day)
exterior_holiday_sch = exterior_holiday_sch.schedule
else
@@ -240,7 +240,7 @@ def self.get_default_fractions()
def self.calc_interior_energy(eri_version, cfa, f_int_cfl, f_int_lfl, f_int_led)
return if f_int_cfl.nil? || f_int_lfl.nil? || f_int_led.nil?
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2014AEG')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2014AEG')
# Calculate fluorescent (CFL + LFL) fraction
f_int_fl = f_int_cfl + f_int_lfl
@@ -284,7 +284,7 @@ def self.calc_interior_energy(eri_version, cfa, f_int_cfl, f_int_lfl, f_int_led)
def self.calc_exterior_energy(eri_version, cfa, f_ext_cfl, f_ext_lfl, f_ext_led)
return if f_ext_cfl.nil? || f_ext_lfl.nil? || f_ext_led.nil?
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2014AEG')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2014AEG')
# Calculate fluorescent (CFL + LFL) fraction
f_ext_fl = f_ext_cfl + f_ext_lfl
@@ -328,7 +328,7 @@ def self.calc_exterior_energy(eri_version, cfa, f_ext_cfl, f_ext_lfl, f_ext_led)
def self.calc_garage_energy(eri_version, gfa, f_grg_cfl, f_grg_lfl, f_grg_led)
return if f_grg_cfl.nil? || f_grg_lfl.nil? || f_grg_led.nil?
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2014AEG')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2014AEG')
# Calculate fluorescent (CFL + LFL) fraction
f_grg_fl = f_grg_cfl + f_grg_lfl
diff --git a/HPXMLtoOpenStudio/resources/materials.rb b/HPXMLtoOpenStudio/resources/materials.rb
index e247019333..19e7241b3a 100644
--- a/HPXMLtoOpenStudio/resources/materials.rb
+++ b/HPXMLtoOpenStudio/resources/materials.rb
@@ -85,7 +85,7 @@ def self.AirCavityOpen(thick_in)
# @param rvalue [TODO] TODO
# @return [TODO] TODO
def self.AirFilm(rvalue)
- return new(name: Constants.AirFilm, thick_in: 1.0, k_in: 1.0 / rvalue)
+ return new(name: Constants::AirFilm, thick_in: 1.0, k_in: 1.0 / rvalue)
end
# TODO
diff --git a/HPXMLtoOpenStudio/resources/math.rb b/HPXMLtoOpenStudio/resources/math.rb
index e7d21c9a0d..f351ead325 100644
--- a/HPXMLtoOpenStudio/resources/math.rb
+++ b/HPXMLtoOpenStudio/resources/math.rb
@@ -137,7 +137,7 @@ def self.Iterate(x0, f0, x1, f1, x2, f2, icount, cvg)
dx = 0.1
# Test for convergence
- if (((x0 - x1).abs < tolRel * [x0.abs, Constants.small].max) && (icount != 1)) || (f0 == 0)
+ if (((x0 - x1).abs < tolRel * [x0.abs, Constants::Small].max) && (icount != 1)) || (f0 == 0)
x_new = x0
cvg = true
else
@@ -165,9 +165,9 @@ def self.Iterate(x0, f0, x1, f1, x2, f2, icount, cvg)
b = (f1 - f0) / (x1 - x0) - (x1 + x0) * c
a = f0 - (b + c * x0) * x0
- if c.abs < Constants.small # If points are co-linear, use linear fit
+ if c.abs < Constants::Small # If points are co-linear, use linear fit
mode = 2
- elsif ((a + (b + c * x1) * x1 - f1) / f1).abs > Constants.small
+ elsif ((a + (b + c * x1) * x1 - f1) / f1).abs > Constants::Small
# If coefficients do not accurately predict data points due to
# round-off, use linear fit
mode = 2
@@ -220,7 +220,7 @@ def self.Iterate(x0, f0, x1, f1, x2, f2, icount, cvg)
if mode == 1
# Perturbation
- if x0.abs > Constants.small
+ if x0.abs > Constants::Small
x_new = x0 * (1 + dx)
else
x_new = dx
diff --git a/HPXMLtoOpenStudio/resources/misc_loads.rb b/HPXMLtoOpenStudio/resources/misc_loads.rb
index d0cbe2a963..bccb63f2d3 100644
--- a/HPXMLtoOpenStudio/resources/misc_loads.rb
+++ b/HPXMLtoOpenStudio/resources/misc_loads.rb
@@ -38,7 +38,7 @@ def self.apply_plug(model, runner, plug_load, obj_name, conditioned_space, apply
end
if sch.nil?
col_unavailable_periods = Schedule.get_unavailable_periods(runner, col_name, unavailable_periods)
- sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', plug_load.weekday_fractions, plug_load.weekend_fractions, plug_load.monthly_multipliers, Constants.ScheduleTypeLimitsFraction, unavailable_periods: col_unavailable_periods)
+ sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', plug_load.weekday_fractions, plug_load.weekend_fractions, plug_load.monthly_multipliers, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: col_unavailable_periods)
space_design_level = sch.calc_design_level_from_daily_kwh(kwh / 365.0)
sch = sch.schedule
else
@@ -104,7 +104,7 @@ def self.apply_fuel(model, runner, fuel_load, obj_name, conditioned_space, sched
end
if sch.nil?
col_unavailable_periods = Schedule.get_unavailable_periods(runner, col_name, unavailable_periods)
- sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', fuel_load.weekday_fractions, fuel_load.weekend_fractions, fuel_load.monthly_multipliers, Constants.ScheduleTypeLimitsFraction, unavailable_periods: col_unavailable_periods)
+ sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', fuel_load.weekday_fractions, fuel_load.weekend_fractions, fuel_load.monthly_multipliers, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: col_unavailable_periods)
space_design_level = sch.calc_design_level_from_daily_therm(therm / 365.0)
sch = sch.schedule
else
@@ -156,10 +156,10 @@ def self.apply_pool_or_permanent_spa_heater(runner, model, pool_or_spa, conditio
# Create schedule
heater_sch = nil
if pool_or_spa.is_a? HPXML::Pool
- obj_name = Constants.ObjectNameMiscPoolHeater
+ obj_name = Constants::ObjectTypeMiscPoolHeater
col_name = 'pool_heater'
else
- obj_name = Constants.ObjectNameMiscPermanentSpaHeater
+ obj_name = Constants::ObjectTypeMiscPermanentSpaHeater
col_name = 'permanent_spa_heater'
end
if not schedules_file.nil?
@@ -167,7 +167,7 @@ def self.apply_pool_or_permanent_spa_heater(runner, model, pool_or_spa, conditio
end
if heater_sch.nil?
col_unavailable_periods = Schedule.get_unavailable_periods(runner, col_name, unavailable_periods)
- heater_sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', pool_or_spa.heater_weekday_fractions, pool_or_spa.heater_weekend_fractions, pool_or_spa.heater_monthly_multipliers, Constants.ScheduleTypeLimitsFraction, unavailable_periods: col_unavailable_periods)
+ heater_sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', pool_or_spa.heater_weekday_fractions, pool_or_spa.heater_weekend_fractions, pool_or_spa.heater_monthly_multipliers, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: col_unavailable_periods)
else
runner.registerWarning("Both '#{col_name}' schedule file and weekday fractions provided; the latter will be ignored.") if !pool_or_spa.heater_weekday_fractions.nil?
runner.registerWarning("Both '#{col_name}' schedule file and weekend fractions provided; the latter will be ignored.") if !pool_or_spa.heater_weekend_fractions.nil?
@@ -240,10 +240,10 @@ def self.apply_pool_or_permanent_spa_pump(runner, model, pool_or_spa, conditione
# Create schedule
pump_sch = nil
if pool_or_spa.is_a? HPXML::Pool
- obj_name = Constants.ObjectNameMiscPoolPump
+ obj_name = Constants::ObjectTypeMiscPoolPump
col_name = 'pool_pump'
else
- obj_name = Constants.ObjectNameMiscPermanentSpaPump
+ obj_name = Constants::ObjectTypeMiscPermanentSpaPump
col_name = 'permanent_spa_pump'
end
if not schedules_file.nil?
@@ -251,7 +251,7 @@ def self.apply_pool_or_permanent_spa_pump(runner, model, pool_or_spa, conditione
end
if pump_sch.nil?
col_unavailable_periods = Schedule.get_unavailable_periods(runner, col_name, unavailable_periods)
- pump_sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', pool_or_spa.pump_weekday_fractions, pool_or_spa.pump_weekend_fractions, pool_or_spa.pump_monthly_multipliers, Constants.ScheduleTypeLimitsFraction, unavailable_periods: col_unavailable_periods)
+ pump_sch = MonthWeekdayWeekendSchedule.new(model, obj_name + ' schedule', pool_or_spa.pump_weekday_fractions, pool_or_spa.pump_weekend_fractions, pool_or_spa.pump_monthly_multipliers, EPlus::ScheduleTypeLimitsFraction, unavailable_periods: col_unavailable_periods)
else
runner.registerWarning("Both '#{col_name}' schedule file and weekday fractions provided; the latter will be ignored.") if !pool_or_spa.pump_weekday_fractions.nil?
runner.registerWarning("Both '#{col_name}' schedule file and weekend fractions provided; the latter will be ignored.") if !pool_or_spa.pump_weekend_fractions.nil?
diff --git a/HPXMLtoOpenStudio/resources/output.rb b/HPXMLtoOpenStudio/resources/output.rb
index 04003ac598..2281f77ad1 100644
--- a/HPXMLtoOpenStudio/resources/output.rb
+++ b/HPXMLtoOpenStudio/resources/output.rb
@@ -268,7 +268,7 @@ def self.append_sizing_results(hpxml_bldgs, results_out)
# HVAC Zone design loads
hpxml_bldgs.each do |hpxml_bldg|
hpxml_bldg.conditioned_zones.each do |zone|
- next if zone.id.start_with? Constants.AutomaticallyAdded
+ next if zone.id.start_with? Constants::AutomaticallyAdded
results_out << [line_break]
results_out << ["HVAC Zone Design Load: #{zone.id}: Heating: Total (Btu/h)", zone.hdl_total.round(1)]
diff --git a/HPXMLtoOpenStudio/resources/schedules.rb b/HPXMLtoOpenStudio/resources/schedules.rb
index 6e8df224ff..f5b036d5a9 100644
--- a/HPXMLtoOpenStudio/resources/schedules.rb
+++ b/HPXMLtoOpenStudio/resources/schedules.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-# Annual constant schedule.
+# Annual constant schedule object.
class ScheduleConstant
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param sch_name [String] name that is assigned to the OpenStudio Schedule object
@@ -27,9 +27,9 @@ def initialize(model, sch_name, val = 1.0, schedule_type_limits_name = nil, unav
# @return [OpenStudio::Model::ScheduleConstant or OpenStudio::Model::ScheduleRuleset] the OpenStudio Schedule object with constant schedule
def create_schedule(model, sch_name, val, year, schedule_type_limits_name, unavailable_periods)
if unavailable_periods.empty?
- if val == 1.0 && (schedule_type_limits_name.nil? || schedule_type_limits_name == Constants.ScheduleTypeLimitsOnOff)
+ if val == 1.0 && (schedule_type_limits_name.nil? || schedule_type_limits_name == EPlus::ScheduleTypeLimitsOnOff)
schedule = model.alwaysOnDiscreteSchedule
- elsif val == 0.0 && (schedule_type_limits_name.nil? || schedule_type_limits_name == Constants.ScheduleTypeLimitsOnOff)
+ elsif val == 0.0 && (schedule_type_limits_name.nil? || schedule_type_limits_name == EPlus::ScheduleTypeLimitsOnOff)
schedule = model.alwaysOffDiscreteSchedule
else
schedule = OpenStudio::Model::ScheduleConstant.new(model)
@@ -56,7 +56,7 @@ def create_schedule(model, sch_name, val, year, schedule_type_limits_name, unava
end
end
-# Annual schedule defined by 12 24-hour values for weekdays and weekends.
+# Annual schedule object defined by 12 24-hour values for weekdays and weekends.
class HourlyByMonthSchedule
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param sch_name [String] name that is assigned to the OpenStudio Schedule object
@@ -133,8 +133,8 @@ def calc_max_val()
# @param unavailable_periods [HPXML::UnavailablePeriods] Object that defines periods for, e.g., power outages or vacancies
# @return [OpenStudio::Model::Ruleset] the OpenStudio Schedule object with rules
def create_schedule(model, sch_name, year, schedule_type_limits_name, unavailable_periods)
- day_startm = Schedule.day_start_months(year)
- day_endm = Schedule.day_end_months(year)
+ day_startm = Calendar.day_start_months(year)
+ day_endm = Calendar.day_end_months(year)
time = []
for h in 1..24
@@ -231,7 +231,7 @@ def create_schedule(model, sch_name, year, schedule_type_limits_name, unavailabl
end
end
-# Annual schedule defined by 365 24-hour values for weekdays and weekends.
+# Annual schedule object defined by 365 24-hour values for weekdays and weekends.
class HourlyByDaySchedule
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param sch_name [String] name that is assigned to the OpenStudio Schedule object
@@ -242,7 +242,7 @@ class HourlyByDaySchedule
def initialize(model, sch_name, weekday_day_by_hour_values, weekend_day_by_hour_values,
schedule_type_limits_name = nil, normalize_values = true, unavailable_periods: nil)
year = model.getYearDescription.assumedYear
- num_days = Constants.NumDaysInYear(year)
+ num_days = Calendar.num_days_in_year(year)
@weekday_day_by_hour_values = validate_values(weekday_day_by_hour_values, num_days, 24)
@weekend_day_by_hour_values = validate_values(weekend_day_by_hour_values, num_days, 24)
if normalize_values
@@ -404,7 +404,7 @@ def create_schedule(model, sch_name, year, num_days, schedule_type_limits_name,
end
end
-# Annual schedule defined by 24 weekday hourly values, 24 weekend hourly values, and 12 monthly values.
+# Annual schedule object defined by 24 weekday hourly values, 24 weekend hourly values, and 12 monthly values.
class MonthWeekdayWeekendSchedule
# @param model [OpenStudio::Model::Model] OpenStudio Model object
# @param sch_name [String] name that is assigned to the OpenStudio Schedule object
@@ -543,12 +543,12 @@ def calc_sch_adjust()
# @return [OpenStudio::Model::ScheduleRuleset] the OpenStudio Schedule object with rules
def create_schedule(model, sch_name, year, begin_month, begin_day, end_month, end_day,
schedule_type_limits_name, unavailable_periods)
- month_num_days = Constants.NumDaysInMonths(year)
+ month_num_days = Calendar.num_days_in_months(year)
month_num_days[end_month - 1] = end_day
- day_startm = Schedule.day_start_months(year)
+ day_startm = Calendar.day_start_months(year)
day_startm[begin_month - 1] += begin_day - 1
- day_endm = [Schedule.day_start_months(year), month_num_days].transpose.map { |i| i.sum - 1 }
+ day_endm = [Calendar.day_start_months(year), month_num_days].transpose.map { |i| i.sum - 1 }
time = []
for h in 1..24
@@ -691,7 +691,7 @@ def self.annual_equivalent_full_load_hrs(modelYear, schedule)
end
if schedule.to_ScheduleConstant.is_initialized
- annual_flh = schedule.to_ScheduleConstant.get.value * Constants.NumHoursInYear(modelYear)
+ annual_flh = schedule.to_ScheduleConstant.get.value * Calendar.num_hours_in_year(modelYear)
return annual_flh
end
@@ -788,15 +788,15 @@ def self.set_schedule_type_limits(model, schedule, schedule_type_limits_name)
if schedule_type_limits.nil?
schedule_type_limits = OpenStudio::Model::ScheduleTypeLimits.new(model)
schedule_type_limits.setName(schedule_type_limits_name)
- if schedule_type_limits_name == Constants.ScheduleTypeLimitsFraction
+ if schedule_type_limits_name == EPlus::ScheduleTypeLimitsFraction
schedule_type_limits.setLowerLimitValue(0)
schedule_type_limits.setUpperLimitValue(1)
schedule_type_limits.setNumericType('Continuous')
- elsif schedule_type_limits_name == Constants.ScheduleTypeLimitsOnOff
+ elsif schedule_type_limits_name == EPlus::ScheduleTypeLimitsOnOff
schedule_type_limits.setLowerLimitValue(0)
schedule_type_limits.setUpperLimitValue(1)
schedule_type_limits.setNumericType('Discrete')
- elsif schedule_type_limits_name == Constants.ScheduleTypeLimitsTemperature
+ elsif schedule_type_limits_name == EPlus::ScheduleTypeLimitsTemperature
schedule_type_limits.setNumericType('Continuous')
end
end
@@ -851,11 +851,11 @@ def self.set_unavailable_periods(schedule, sch_name, unavailable_periods, year)
# FUTURE: Assign an object type to the schedules and use that to determine what
# kind of schedule each is, rather than looking at object names. That would
# be more robust. See https://github.com/NREL/OpenStudio-HPXML/issues/1450.
- if sch_name.include? Constants.ObjectNameWaterHeaterSetpoint
+ if sch_name.include? Constants::ObjectTypeWaterHeaterSetpoint
# Water heater setpoint
# Temperature of tank < 2C indicates of possibility of freeze.
value = 2.0
- elsif sch_name.include? Constants.ObjectNameNaturalVentilation
+ elsif sch_name.include? Constants::ObjectTypeNaturalVentilation
if period.natvent_availability == HPXML::ScheduleRegular
next # don't change the natural ventilation availability schedule
elsif period.natvent_availability == HPXML::ScheduleAvailable
@@ -867,8 +867,8 @@ def self.set_unavailable_periods(schedule, sch_name, unavailable_periods, year)
value = 0.0
end
- day_s = Schedule.get_day_num_from_month_day(year, period.begin_month, period.begin_day)
- day_e = Schedule.get_day_num_from_month_day(year, period.end_month, period.end_day)
+ day_s = Calendar.get_day_num_from_month_day(year, period.begin_month, period.begin_day)
+ day_e = Calendar.get_day_num_from_month_day(year, period.end_month, period.end_day)
date_s = OpenStudio::Date::fromDayOfYear(day_s, year)
date_e = OpenStudio::Date::fromDayOfYear(day_e, year)
@@ -962,85 +962,6 @@ def self.set_unavailable_period_values(out, day_schedule, begin_hour, end_hour,
end
end
- # Default ceiling fan monthly multipliers.
- #
- # @param weather [WeatherFile] Weather object containing EPW information
- # @return [String] 12 comma-separated monthly multipliers
- def self.CeilingFanMonthlyMultipliers(weather:)
- return HVAC.get_default_ceiling_fan_months(weather).join(', ')
- end
-
- # Returns a value between 1 and 365 (or 366 for a leap year).
- # Returns e.g. 32 for month=2 and day=1 (Feb 1).
- #
- # @param year [Integer] the calendar year
- # @param month [Integer] the month of the year
- # @param day [Integer] the day of the month
- # @return [Integer] the day number of the year
- def self.get_day_num_from_month_day(year, month, day)
- month_num_days = Constants.NumDaysInMonths(year)
- day_num = day
- for m in 0..month - 2
- day_num += month_num_days[m]
- end
- return day_num
- end
-
- # Returns an array of 365 (or 366 for a leap year) values of 0s and 1s that define a daily season.
- #
- # @param year [Integer] the calendar year
- # @param start_month [Integer] the start month of the year
- # @param start_day [Integer] the start day of the start month
- # @param end_month [Integer] the end month of the year
- # @param end_day [Integer] the end day of the end month
- # @return [Array] 1s ranging from start month/day to end month/day, and 0s outside of this range
- def self.get_daily_season(year, start_month, start_day, end_month, end_day)
- start_day_num = get_day_num_from_month_day(year, start_month, start_day)
- end_day_num = get_day_num_from_month_day(year, end_month, end_day)
-
- season = Array.new(Constants.NumDaysInYear(year), 0)
- if end_day_num >= start_day_num
- season.fill(1, start_day_num - 1, end_day_num - start_day_num + 1) # Fill between start/end days
- else # Wrap around year
- season.fill(1, start_day_num - 1) # Fill between start day and end of year
- season.fill(1, 0, end_day_num) # Fill between start of year and end day
- end
- return season
- end
-
- # Convert a 12-element monthly array of 1s and 0s to a 365-element (or 366-element for a leap year) daily array of 1s and 0s.
- #
- # @param year [Integer] the calendar year
- # @param months [Array] monthly array of 1s and 0s
- # @return [Array] daily array of 1s and 0s
- def self.months_to_days(year, months)
- month_num_days = Constants.NumDaysInMonths(year)
- days = []
- for m in 0..11
- days.concat([months[m]] * month_num_days[m])
- end
-
- return days
- end
-
- # Returns a 12-element array of day numbers of the year corresponding to the first days of each month.
- #
- # @param year [Integer] the calendar year
- # @return [Array] day number of the year for the first day of each month
- def self.day_start_months(year)
- month_num_days = Constants.NumDaysInMonths(year)
- return month_num_days.each_with_index.map { |_n, i| get_day_num_from_month_day(year, i + 1, 1) }
- end
-
- # Returns a 12-element array of day numbers of the year corresponding to the last days of each month.
- #
- # @param year [Integer] the calendar year
- # @return [Array] day number of the year for the last day of each month
- def self.day_end_months(year)
- month_num_days = Constants.NumDaysInMonths(year)
- return month_num_days.each_with_index.map { |n, i| get_day_num_from_month_day(year, i + 1, n) }
- end
-
# Create an OpenStudio Schedule object based on a 365-element (or 366 for a leap year) daily season array.
#
# @param model [OpenStudio::Model::Model] OpenStudio Model object
@@ -1072,67 +993,6 @@ def self.create_ruleset_from_daily_season(model, values)
return s
end
- # Return begin month/day/hour and end month/day/hour integers based on a string datetime range.
- #
- # @param date_time_range [String] a date like 'Jan 1 - Dec 31' (optionally can enter hour like 'Dec 15 2 - Jan 15 20')
- # @return [Array] begin/end month/day/hour
- def self.parse_date_time_range(date_time_range)
- begin_end_dates = date_time_range.split('-').map { |v| v.strip }
- if begin_end_dates.size != 2
- fail "Invalid date format specified for '#{date_time_range}'."
- end
-
- begin_values = begin_end_dates[0].split(' ').map { |v| v.strip }
- end_values = begin_end_dates[1].split(' ').map { |v| v.strip }
-
- if !(begin_values.size == 2 || begin_values.size == 3) || !(end_values.size == 2 || end_values.size == 3)
- fail "Invalid date format specified for '#{date_time_range}'."
- end
-
- require 'date'
- begin_month = Date::ABBR_MONTHNAMES.index(begin_values[0].capitalize)
- end_month = Date::ABBR_MONTHNAMES.index(end_values[0].capitalize)
- begin_day = begin_values[1].to_i
- end_day = end_values[1].to_i
- if begin_values.size == 3
- begin_hour = begin_values[2].to_i
- end
- if end_values.size == 3
- end_hour = end_values[2].to_i
- end
- if begin_month.nil? || end_month.nil? || begin_day == 0 || end_day == 0
- fail "Invalid date format specified for '#{date_time_range}'."
- end
-
- return begin_month, begin_day, begin_hour, end_month, end_day, end_hour
- end
-
- # Return begin month/day and end month/day based on a provided monthly availability array.
- #
- # @param months [Array] monthly array of 1s and 0s
- # @param year [Integer] the calendar year
- # @return [Array] begin month/day and end month/day
- def self.get_begin_and_end_dates_from_monthly_array(months, year)
- num_days_in_month = Constants.NumDaysInMonths(year)
-
- if months.uniq.size == 1 && months[0] == 1 # Year-round
- return 1, 1, 12, num_days_in_month[11]
- elsif months.uniq.size == 1 && months[0] == 0 # Never
- return
- elsif months[0] == 1 && months[11] == 1 # Wrap around year
- begin_month = 12 - months.reverse.index(0) + 1
- end_month = months.index(0)
- else
- begin_month = months.index(1) + 1
- end_month = 12 - months.reverse.index(1)
- end
-
- begin_day = 1
- end_day = num_days_in_month[end_month - 1]
-
- return begin_month, begin_day, end_month, end_day
- end
-
# Return a array of maps that reflect the contents of the unavailable_periods.csv file.
#
# @return [Array] array with maps for components that are affected by unavailable period types
@@ -1196,6 +1056,15 @@ def self.unavailable_period_applies(runner, schedule_name, col_name)
# @return [Array] a num_values-element array of numbers
def self.validate_values(values, num_values, sch_name)
err_msg = "A comma-separated string of #{num_values} numbers must be entered for the #{sch_name} schedule."
+
+ # Check whether string is a valid float.
+ #
+ # @param str [String] string representation of a possible float
+ # @return [Boolean] true if valid float
+ def self.valid_float?(str)
+ !!Float(str) rescue false
+ end
+
if values.is_a?(Array)
if values.length != num_values
fail err_msg
@@ -1227,17 +1096,9 @@ def self.validate_values(values, num_values, sch_name)
end
return floats
end
-
- # Check whether string is a valid float.
- #
- # @param str [String] string representation of a possible float
- # @return [Boolean] true if valid float
- def self.valid_float?(str)
- !!Float(str) rescue false
- end
end
-# Wrapper for detailed schedule CSVs.
+# Object that contains information for detailed schedule CSVs.
class SchedulesFile
# Struct for storing schedule CSV column information.
class Column
@@ -1359,7 +1220,7 @@ def includes_col_name(col_name)
# @param schedules_paths [Array] array of file paths pointing to detailed schedule CSVs
# @return [nil]
def import(schedules_paths)
- num_hrs_in_year = Constants.NumHoursInYear(@year)
+ num_hrs_in_year = Calendar.num_hours_in_year(@year)
@schedules = {}
schedules_paths.each do |schedules_path|
columns = CSV.read(schedules_path).transpose
@@ -1465,7 +1326,7 @@ def create_schedule_file(model, col_name:, rows_to_skip: 1,
end
col_index = get_col_index(col_name: col_name)
- num_hrs_in_year = Constants.NumHoursInYear(@year)
+ num_hrs_in_year = Calendar.num_hours_in_year(@year)
schedule_length = @schedules[col_name].length
min_per_item = 60.0 / (schedule_length / num_hrs_in_year)
@@ -1517,19 +1378,19 @@ def period_equivalent_full_load_hrs(col_name:,
return
end
- num_hrs_in_year = Constants.NumHoursInYear(@year)
+ num_hrs_in_year = Calendar.num_hours_in_year(@year)
schedule_length = schedules[col_name].length
min_per_item = 60.0 / (schedule_length / num_hrs_in_year)
equiv_full_load_hrs = 0.0
if not period.nil?
n_steps = schedules[schedules.keys[0]].length
- num_days_in_year = Constants.NumDaysInYear(@year)
+ num_days_in_year = Calendar.num_days_in_year(@year)
steps_in_day = n_steps / num_days_in_year
steps_in_hour = steps_in_day / 24
- begin_day_num = Schedule.get_day_num_from_month_day(@year, period.begin_month, period.begin_day)
- end_day_num = Schedule.get_day_num_from_month_day(@year, period.end_month, period.end_day)
+ begin_day_num = Calendar.get_day_num_from_month_day(@year, period.begin_month, period.begin_day)
+ end_day_num = Calendar.get_day_num_from_month_day(@year, period.end_month, period.end_day)
begin_hour = 0
end_hour = 24
@@ -1609,7 +1470,7 @@ def calc_design_level_from_daily_kwh(col_name:,
full_load_hrs = annual_equivalent_full_load_hrs(col_name: col_name)
return 0 if full_load_hrs == 0
- num_days_in_year = Constants.NumDaysInYear(@year)
+ num_days_in_year = Calendar.num_days_in_year(@year)
daily_full_load_hrs = full_load_hrs / num_days_in_year
design_level = UnitConversions.convert(daily_kwh / daily_full_load_hrs, 'kW', 'W')
@@ -1630,7 +1491,7 @@ def calc_peak_flow_from_daily_gpm(col_name:,
ann_equiv_full_load_hrs = annual_equivalent_full_load_hrs(col_name: col_name)
return 0 if ann_equiv_full_load_hrs == 0
- num_days_in_year = Constants.NumDaysInYear(@year)
+ num_days_in_year = Calendar.num_days_in_year(@year)
daily_full_load_hrs = ann_equiv_full_load_hrs / num_days_in_year
peak_flow = daily_water / daily_full_load_hrs # gallons_per_hour
peak_flow /= 60 # convert to gallons per minute
@@ -1645,7 +1506,7 @@ def calc_peak_flow_from_daily_gpm(col_name:,
# @return [nil]
def create_column_values_from_periods(col_name, periods)
n_steps = @tmp_schedules[@tmp_schedules.keys[0]].length
- num_days_in_year = Constants.NumDaysInYear(@year)
+ num_days_in_year = Calendar.num_days_in_year(@year)
steps_in_day = n_steps / num_days_in_year
steps_in_hour = steps_in_day / 24
@@ -1654,8 +1515,8 @@ def create_column_values_from_periods(col_name, periods)
end
periods.each do |period|
- begin_day_num = Schedule.get_day_num_from_month_day(@year, period.begin_month, period.begin_day)
- end_day_num = Schedule.get_day_num_from_month_day(@year, period.end_month, period.end_day)
+ begin_day_num = Calendar.get_day_num_from_month_day(@year, period.begin_month, period.begin_day)
+ end_day_num = Calendar.get_day_num_from_month_day(@year, period.end_month, period.end_day)
begin_hour = 0
end_hour = 24
diff --git a/HPXMLtoOpenStudio/resources/utility_bills.rb b/HPXMLtoOpenStudio/resources/utility_bills.rb
index 544702fd97..e9fba1f567 100644
--- a/HPXMLtoOpenStudio/resources/utility_bills.rb
+++ b/HPXMLtoOpenStudio/resources/utility_bills.rb
@@ -25,7 +25,7 @@ def self.get_fuel_units(fuel_type)
# @param marginal_rate [Double] the marginal flat rate (USD/kWh or USD/therm, etc.)
# @return [Array] the marginal and average rates (USD/kWh or USD/therm, etc., USD/month)
def self.get_rates_from_eia_data(runner, state_code, fuel_type, fixed_charge, marginal_rate = nil)
- msn_codes = Constants.StateCodesMap.keys
+ msn_codes = Constants::StateCodesMap.keys
msn_codes << 'US'
return unless msn_codes.include? state_code # Check if the state_code is valid
diff --git a/HPXMLtoOpenStudio/resources/waterheater.rb b/HPXMLtoOpenStudio/resources/waterheater.rb
index b36cf25a73..9581ee5d08 100644
--- a/HPXMLtoOpenStudio/resources/waterheater.rb
+++ b/HPXMLtoOpenStudio/resources/waterheater.rb
@@ -24,7 +24,7 @@ def self.apply_tank(model, runner, loc_space, loc_schedule, water_heating_system
act_vol = calc_storage_tank_actual_vol(water_heating_system.tank_volume, water_heating_system.fuel_type)
u, ua, eta_c = calc_tank_UA(act_vol, water_heating_system, solar_fraction, nbeds)
- new_heater = create_new_heater(name: Constants.ObjectNameWaterHeater,
+ new_heater = create_new_heater(name: Constants::ObjectTypeWaterHeater,
water_heating_system: water_heating_system,
act_vol: act_vol,
t_set_c: t_set_c,
@@ -69,7 +69,7 @@ def self.apply_tankless(model, runner, loc_space, loc_schedule, water_heating_sy
act_vol = 1.0 * unit_multiplier
_u, ua, eta_c = calc_tank_UA(act_vol, water_heating_system, solar_fraction, nbeds)
- new_heater = create_new_heater(name: Constants.ObjectNameWaterHeater,
+ new_heater = create_new_heater(name: Constants::ObjectTypeWaterHeater,
water_heating_system: water_heating_system,
act_vol: act_vol,
t_set_c: t_set_c,
@@ -109,7 +109,7 @@ def self.apply_tankless(model, runner, loc_space, loc_schedule, water_heating_sy
# @param nbeds [Integer] Number of bedrooms in the dwelling unit
# @return [TODO] TODO
def self.apply_heatpump(model, runner, loc_space, loc_schedule, elevation, water_heating_system, ec_adj, solar_thermal_system, conditioned_zone, eri_version, schedules_file, unavailable_periods, unit_multiplier, nbeds)
- obj_name_hpwh = Constants.ObjectNameWaterHeater
+ obj_name_hpwh = Constants::ObjectTypeWaterHeater
solar_fraction = get_water_heater_solar_fraction(water_heating_system, solar_thermal_system)
t_set_c = get_t_set_c(water_heating_system.temperature, water_heating_system.water_heater_type)
loop = create_new_loop(model, t_set_c, eri_version, unit_multiplier)
@@ -137,15 +137,15 @@ def self.apply_heatpump(model, runner, loc_space, loc_schedule, elevation, water
# Sensed schedule
setpoint_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:WaterHeaterSetpoint].name)
if not setpoint_schedule.nil?
- Schedule.set_schedule_type_limits(model, setpoint_schedule, Constants.ScheduleTypeLimitsTemperature)
+ Schedule.set_schedule_type_limits(model, setpoint_schedule, EPlus::ScheduleTypeLimitsTemperature)
# Actuated schedule
- control_setpoint_schedule = ScheduleConstant.new(model, "#{obj_name_hpwh} ControlSetpoint", 0.0, Constants.ScheduleTypeLimitsTemperature, unavailable_periods: unavailable_periods)
+ control_setpoint_schedule = ScheduleConstant.new(model, "#{obj_name_hpwh} ControlSetpoint", 0.0, EPlus::ScheduleTypeLimitsTemperature, unavailable_periods: unavailable_periods)
control_setpoint_schedule = control_setpoint_schedule.schedule
end
end
if setpoint_schedule.nil?
- setpoint_schedule = ScheduleConstant.new(model, Constants.ObjectNameWaterHeaterSetpoint, t_set_c, Constants.ScheduleTypeLimitsTemperature, unavailable_periods: unavailable_periods)
+ setpoint_schedule = ScheduleConstant.new(model, Constants::ObjectTypeWaterHeaterSetpoint, t_set_c, EPlus::ScheduleTypeLimitsTemperature, unavailable_periods: unavailable_periods)
setpoint_schedule = setpoint_schedule.schedule
control_setpoint_schedule = setpoint_schedule
@@ -215,7 +215,7 @@ def self.apply_combi(model, runner, loc_space, loc_schedule, water_heating_syste
boiler.additionalProperties.setFeature('HPXML_ID', water_heating_system.id) # Used by reporting measure
boiler.additionalProperties.setFeature('IsCombiBoiler', true) # Used by reporting measure
- obj_name_combi = Constants.ObjectNameWaterHeater
+ obj_name_combi = Constants::ObjectTypeWaterHeater
if water_heating_system.water_heater_type == HPXML::WaterHeaterTypeCombiStorage
if water_heating_system.standby_loss_value <= 0
@@ -441,7 +441,7 @@ def self.apply_solar_thermal(model, loc_space, loc_schedule, solar_thermal_syste
dhw_loop = plantloop_map[solar_thermal_system.water_heating_system.id]
- obj_name = Constants.ObjectNameSolarHotWater
+ obj_name = Constants::ObjectTypeSolarHotWater
if [HPXML::SolarThermalCollectorTypeEvacuatedTube].include? solar_thermal_system.collector_type
iam_coeff2 = 0.3023 # IAM coeff1=1 by definition, values based on a system listed by SRCC with values close to the average
@@ -455,10 +455,10 @@ def self.apply_solar_thermal(model, loc_space, loc_schedule, solar_thermal_syste
end
if [HPXML::SolarThermalLoopTypeIndirect].include? solar_thermal_system.collector_loop_type
- fluid_type = Constants.FluidPropyleneGlycol
+ fluid_type = EPlus::FluidPropyleneGlycol
heat_ex_eff = 0.7
elsif [HPXML::SolarThermalLoopTypeDirect, HPXML::SolarThermalLoopTypeThermosyphon].include? solar_thermal_system.collector_loop_type
- fluid_type = Constants.FluidWater
+ fluid_type = EPlus::FluidWater
heat_ex_eff = 1.0
end
@@ -473,7 +473,7 @@ def self.apply_solar_thermal(model, loc_space, loc_schedule, solar_thermal_syste
test_flow = 55.0 / UnitConversions.convert(1.0, 'lbm/min', 'kg/hr') / Liquid.H2O_l.rho * UnitConversions.convert(1.0, 'ft^2', 'm^2') # cfm/ft^2
coll_flow = test_flow * collector_area # cfm
- if fluid_type == Constants.FluidWater # Direct, make the storage tank a dummy tank with 0 tank losses
+ if fluid_type == EPlus::FluidWater # Direct, make the storage tank a dummy tank with 0 tank losses
u_tank = 0.0
else
r_tank = 10.0 # Btu/(hr-ft2-F)
@@ -505,10 +505,10 @@ def self.apply_solar_thermal(model, loc_space, loc_schedule, solar_thermal_syste
plant_loop = OpenStudio::Model::PlantLoop.new(model)
plant_loop.setName('solar hot water loop')
- if fluid_type == Constants.FluidWater
- plant_loop.setFluidType('Water')
+ if fluid_type == EPlus::FluidWater
+ plant_loop.setFluidType(EPlus::FluidWater)
else
- plant_loop.setFluidType('PropyleneGlycol')
+ plant_loop.setFluidType(EPlus::FluidPropyleneGlycol)
plant_loop.setGlycolConcentration(50)
end
plant_loop.setMaximumLoopTemperature(100)
@@ -536,7 +536,7 @@ def self.apply_solar_thermal(model, loc_space, loc_schedule, solar_thermal_syste
pump.setRatedFlowRate(UnitConversions.convert(coll_flow, 'cfm', 'm^3/s'))
pump.addToNode(plant_loop.supplyInletNode)
pump.additionalProperties.setFeature('HPXML_ID', solar_thermal_system.water_heating_system.id) # Used by reporting measure
- pump.additionalProperties.setFeature('ObjectType', Constants.ObjectNameSolarHotWater) # Used by reporting measure
+ pump.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeSolarHotWater) # Used by reporting measure
panel_length = UnitConversions.convert(collector_area, 'ft^2', 'm^2')**0.5
run = Math::cos(solar_thermal_system.collector_tilt * Math::PI / 180) * panel_length
@@ -595,7 +595,7 @@ def self.apply_solar_thermal(model, loc_space, loc_schedule, solar_thermal_syste
collector_performance = collector_plate.solarCollectorPerformance
collector_performance.setName(obj_name + ' coll perf')
collector_performance.setGrossArea(UnitConversions.convert(collector_area, 'ft^2', 'm^2'))
- collector_performance.setTestFluid('Water')
+ collector_performance.setTestFluid(EPlus::FluidWater)
collector_performance.setTestFlowRate(UnitConversions.convert(coll_flow, 'cfm', 'm^3/s'))
collector_performance.setTestCorrelationType('Inlet')
collector_performance.setCoefficient1ofEfficiencyEquation(solar_thermal_system.collector_rated_optical_efficiency)
@@ -625,7 +625,7 @@ def self.apply_solar_thermal(model, loc_space, loc_schedule, solar_thermal_syste
storage_tank.setName(obj_name + ' storage tank')
storage_tank.setSourceSideEffectiveness(heat_ex_eff)
storage_tank.setTankShape('VerticalCylinder')
- if (solar_thermal_system.collector_type == HPXML::SolarThermalCollectorTypeICS) || (fluid_type == Constants.FluidWater) # Use a 60 gal tank dummy tank for direct systems, storage volume for ICS is assumed to be collector volume
+ if (solar_thermal_system.collector_type == HPXML::SolarThermalCollectorTypeICS) || (fluid_type == EPlus::FluidWater) # Use a 60 gal tank dummy tank for direct systems, storage volume for ICS is assumed to be collector volume
tank_volume = UnitConversions.convert(60 * unit_multiplier, 'gal', 'm^3')
else
tank_volume = UnitConversions.convert(storage_volume, 'gal', 'm^3')
@@ -663,7 +663,7 @@ def self.apply_solar_thermal(model, loc_space, loc_schedule, solar_thermal_syste
storage_tank.setUseSideDesignFlowRate(UnitConversions.convert(storage_volume, 'gal', 'm^3') / 60.1) # Sized to ensure that E+ never autosizes the design flow rate to be larger than the tank volume getting drawn out in a hour (60 minutes)
set_stratified_tank_ua(storage_tank, u_tank, unit_multiplier)
storage_tank.additionalProperties.setFeature('HPXML_ID', solar_thermal_system.water_heating_system.id) # Used by reporting measure
- storage_tank.additionalProperties.setFeature('ObjectType', Constants.ObjectNameSolarHotWater) # Used by reporting measure
+ storage_tank.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeSolarHotWater) # Used by reporting measure
plant_loop.addDemandBranchForComponent(storage_tank)
dhw_loop.addSupplyBranchForComponent(storage_tank)
@@ -943,7 +943,7 @@ def self.setup_hpwh_fan(model, water_heating_system, obj_name_hpwh, airflow_rate
fan.setMotorInAirStreamFraction(1.0)
fan.setDesignMaximumAirFlowRate(UnitConversions.convert(airflow_rate * unit_multiplier, 'ft^3/min', 'm^3/s'))
fan.additionalProperties.setFeature('HPXML_ID', water_heating_system.id) # Used by reporting measure
- fan.additionalProperties.setFeature('ObjectType', Constants.ObjectNameWaterHeater) # Used by reporting measure
+ fan.additionalProperties.setFeature('ObjectType', Constants::ObjectTypeWaterHeater) # Used by reporting measure
return fan
end
@@ -1136,7 +1136,7 @@ def self.add_hpwh_control_program(model, runner, obj_name_hpwh, amb_temp_sensor,
# Sensor on op_mode_schedule
if not op_mode_schedule.nil?
- Schedule.set_schedule_type_limits(model, op_mode_schedule, Constants.ScheduleTypeLimitsFraction)
+ Schedule.set_schedule_type_limits(model, op_mode_schedule, EPlus::ScheduleTypeLimitsFraction)
op_mode_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, 'Schedule Value')
op_mode_sensor.setName("#{obj_name_hpwh} op_mode")
@@ -1609,8 +1609,8 @@ def self.add_ec_adj(model, heater, ec_adj, loc_space, water_heating_system, unit
end
# Add an other equipment object for water heating that will get actuated, has a small initial load but gets overwritten by EMS
- cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants.ObjectNameWaterHeaterAdjustment }.size # Ensure unique meter for each water heater
- ec_adj_object = HotWaterAndAppliances.add_other_equipment(model, "#{Constants.ObjectNameWaterHeaterAdjustment}#{cnt + 1}", loc_space, 0.01, 0, 0, model.alwaysOnDiscreteSchedule, fuel_type)
+ cnt = model.getOtherEquipments.select { |e| e.endUseSubcategory.start_with? Constants::ObjectTypeWaterHeaterAdjustment }.size # Ensure unique meter for each water heater
+ ec_adj_object = HotWaterAndAppliances.add_other_equipment(model, "#{Constants::ObjectTypeWaterHeaterAdjustment}#{cnt + 1}", loc_space, 0.01, 0, 0, model.alwaysOnDiscreteSchedule, fuel_type)
ec_adj_object.additionalProperties.setFeature('HPXML_ID', water_heating_system.id) # Used by reporting measure
# EMS for calculating the EC_adj
@@ -1677,7 +1677,7 @@ def self.add_ec_adj(model, heater, ec_adj, loc_space, water_heating_system, unit
# @return [TODO] TODO
def self.get_default_hot_water_temperature(eri_version)
# Returns hot water temperature in F
- if Constants.ERIVersions.index(eri_version) >= Constants.ERIVersions.index('2014A')
+ if Constants::ERIVersions.index(eri_version) >= Constants::ERIVersions.index('2014A')
# 2014 w/ Addendum A or newer
return 125.0
else
@@ -2094,7 +2094,7 @@ def self.configure_mixed_tank_setpoint_schedule(new_heater, schedules_file, t_se
new_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:WaterHeaterSetpoint].name)
end
if new_schedule.nil? # constant
- new_schedule = ScheduleConstant.new(model, Constants.ObjectNameWaterHeaterSetpoint, t_set_c, Constants.ScheduleTypeLimitsTemperature, unavailable_periods: unavailable_periods)
+ new_schedule = ScheduleConstant.new(model, Constants::ObjectTypeWaterHeaterSetpoint, t_set_c, EPlus::ScheduleTypeLimitsTemperature, unavailable_periods: unavailable_periods)
new_schedule = new_schedule.schedule
else
runner.registerWarning("Both '#{SchedulesFile::Columns[:WaterHeaterSetpoint].name}' schedule file and setpoint temperature provided; the latter will be ignored.") if !t_set_c.nil?
@@ -2120,7 +2120,7 @@ def self.configure_stratified_tank_setpoint_schedules(new_heater, schedules_file
new_schedule = schedules_file.create_schedule_file(model, col_name: SchedulesFile::Columns[:WaterHeaterSetpoint].name)
end
if new_schedule.nil? # constant
- new_schedule = ScheduleConstant.new(model, Constants.ObjectNameWaterHeaterSetpoint, t_set_c, Constants.ScheduleTypeLimitsTemperature, unavailable_periods: unavailable_periods)
+ new_schedule = ScheduleConstant.new(model, Constants::ObjectTypeWaterHeaterSetpoint, t_set_c, EPlus::ScheduleTypeLimitsTemperature, unavailable_periods: unavailable_periods)
new_schedule = new_schedule.schedule
else
runner.registerWarning("Both '#{SchedulesFile::Columns[:WaterHeaterSetpoint].name}' schedule file and setpoint temperature provided; the latter will be ignored.") if !t_set_c.nil?
diff --git a/HPXMLtoOpenStudio/resources/weather.rb b/HPXMLtoOpenStudio/resources/weather.rb
index 35b71fe73f..5c3246a17b 100644
--- a/HPXMLtoOpenStudio/resources/weather.rb
+++ b/HPXMLtoOpenStudio/resources/weather.rb
@@ -157,9 +157,9 @@ def calc_avg_monthly_highs_lows(daily_high_dbs, daily_low_dbs)
data.MonthlyAvgDailyLowDrybulbs = []
if daily_high_dbs.size == 365 # standard year
- month_num_days = Constants.NumDaysInMonths(1999)
+ month_num_days = Calendar.num_days_in_months(1999)
elsif daily_high_dbs.size == 366 # leap year
- month_num_days = Constants.NumDaysInMonths(2000)
+ month_num_days = Calendar.num_days_in_months(2000)
else
fail "Unexpected number of days: #{daily_high_dbs.size}."
end
@@ -376,7 +376,7 @@ def calc_deep_ground_temperatures(hpxml)
# Minimize distance to Station
v1 = Vector[header.Latitude, header.Longitude]
- dist = 1 / Constants.small
+ dist = 1 / Constants::Small
temperatures_amplitudes = nil
CSV.foreach(deep_ground_temperatures) do |row|
v2 = Vector[row[3].to_f, row[4].to_f]
diff --git a/HPXMLtoOpenStudio/tests/test_airflow.rb b/HPXMLtoOpenStudio/tests/test_airflow.rb
index 675e6c5841..2c07fa2107 100644
--- a/HPXMLtoOpenStudio/tests/test_airflow.rb
+++ b/HPXMLtoOpenStudio/tests/test_airflow.rb
@@ -17,6 +17,8 @@ def setup
def teardown
File.delete(@tmp_hpxml_path) if File.exist? @tmp_hpxml_path
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
end
def get_eed_for_ventilation(model, ee_name)
@@ -46,7 +48,7 @@ def test_infiltration_ach50
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0436, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0573, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -58,7 +60,7 @@ def test_infiltration_ach_house_pressure
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0436, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0573, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -70,7 +72,7 @@ def test_infiltration_ach50_flue
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0436, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0661, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1323, program_values['Cw'].sum, 0.01)
@@ -82,7 +84,7 @@ def test_infiltration_cfm50
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0436, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0573, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -94,7 +96,7 @@ def test_infiltration_cfm_house_pressure
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0436, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0573, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -106,7 +108,7 @@ def test_infiltration_natural_ach
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0881, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0573, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -118,7 +120,7 @@ def test_infiltration_natural_cfm
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0881, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0573, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -130,7 +132,7 @@ def test_infiltration_natural_ela
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0904, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0573, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -142,7 +144,7 @@ def test_infiltration_leakiness_description
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.1956, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0573, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -154,7 +156,7 @@ def test_infiltration_multifamily
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0145, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0504, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -166,7 +168,7 @@ def test_infiltration_multifamily_compartmentalization
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0118, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0504, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -178,7 +180,7 @@ def test_infiltration_multifamily_leakiness_description
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0055, program_values['c'].sum, 0.01)
assert_in_epsilon(0.0504, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.1446, program_values['Cw'].sum, 0.01)
@@ -190,14 +192,14 @@ def test_natural_ventilation
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check natural ventilation/whole house fan program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameNaturalVentilation} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeNaturalVentilation} program")
assert_in_epsilon(14.5, UnitConversions.convert(program_values['NVArea'].sum, 'cm^2', 'ft^2'), 0.01)
assert_in_epsilon(0.000109, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.000068, program_values['Cw'].sum, 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['WHF_Flow'].sum, 'm^3/s', 'cfm'), 0.01)
# Check natural ventilation is available 3 days/wk
- nv_sched = model.getScheduleRulesets.find { |s| s.name.to_s.start_with? Constants.ObjectNameNaturalVentilation }
+ nv_sched = model.getScheduleRulesets.find { |s| s.name.to_s.start_with? Constants::ObjectTypeNaturalVentilation }
assert_equal(3768, Schedule.annual_equivalent_full_load_hrs(2007, nv_sched))
end
@@ -207,14 +209,14 @@ def test_natural_ventilation_7_days_per_week
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check natural ventilation/whole house fan program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameNaturalVentilation} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeNaturalVentilation} program")
assert_in_epsilon(14.5, UnitConversions.convert(program_values['NVArea'].sum, 'cm^2', 'ft^2'), 0.01)
assert_in_epsilon(0.000109, program_values['Cs'].sum, 0.01)
assert_in_epsilon(0.000068, program_values['Cw'].sum, 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['WHF_Flow'].sum, 'm^3/s', 'cfm'), 0.01)
# Check natural ventilation is available 7 days/wk
- nv_sched = model.getScheduleRulesets.find { |s| s.name.to_s.start_with? Constants.ObjectNameNaturalVentilation }
+ nv_sched = model.getScheduleRulesets.find { |s| s.name.to_s.start_with? Constants::ObjectTypeNaturalVentilation }
assert_equal(8760, Schedule.annual_equivalent_full_load_hrs(2007, nv_sched))
end
@@ -224,16 +226,16 @@ def test_mechanical_ventilation_none
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(0.0, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(0.0, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_mechanical_ventilation_supply
@@ -247,17 +249,17 @@ def test_mechanical_ventilation_supply
vent_fan_power = vent_fan.fan_power
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
- assert_in_epsilon(0.0, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
+ assert_in_epsilon(0.0, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_mechanical_ventilation_exhaust
@@ -271,17 +273,17 @@ def test_mechanical_ventilation_exhaust
vent_fan_power = vent_fan.fan_power
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
- assert_in_epsilon(1.0, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
+ assert_in_epsilon(1.0, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_mechanical_ventilation_balanced
@@ -295,17 +297,17 @@ def test_mechanical_ventilation_balanced
vent_fan_power = vent_fan.fan_power
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
- assert_in_epsilon(0.5, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
+ assert_in_epsilon(0.5, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_mechanical_ventilation_erv
@@ -319,17 +321,17 @@ def test_mechanical_ventilation_erv
vent_fan_power = vent_fan.fan_power
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
- assert_in_epsilon(0.5, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
+ assert_in_epsilon(0.5, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_mechanical_ventilation_hrv
@@ -343,17 +345,17 @@ def test_mechanical_ventilation_hrv
vent_fan_power = vent_fan.fan_power
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
- assert_in_epsilon(0.5, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(vent_fan_power, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
+ assert_in_epsilon(0.5, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_mechanical_ventilation_cfis
@@ -368,7 +370,7 @@ def test_mechanical_ventilation_cfis
vent_fan_mins = vent_fan.hours_in_operation / 24.0 * 60.0
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['cfis_Q_duct_oa'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
@@ -377,8 +379,8 @@ def test_mechanical_ventilation_cfis
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_mechanical_ventilation_cfis_with_supplemental_fan
@@ -395,7 +397,7 @@ def test_mechanical_ventilation_cfis_with_supplemental_fan
suppl_vent_fan_power = vent_fan.cfis_supplemental_fan.fan_power
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(vent_fan_cfm, UnitConversions.convert(program_values['cfis_Q_duct_oa'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(suppl_vent_fan_cfm, UnitConversions.convert(program_values['cfis_suppl_Q_oa'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
@@ -406,8 +408,8 @@ def test_mechanical_ventilation_cfis_with_supplemental_fan
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_ventilation_bath_kitchen_fans
@@ -424,22 +426,22 @@ def test_ventilation_bath_kitchen_fans
kitchen_fan_power = kitchen_fan.fan_power * (kitchen_fan.count.nil? ? 1 : kitchen_fan.count)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(0.0, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(0.0, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(0.0, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
assert_in_epsilon(kitchen_fan_cfm, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationRangeFan).size)
- assert_in_epsilon(kitchen_fan_power, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationRangeFan)[0].designLevel.get, 0.01)
- assert_in_epsilon(1.0, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationRangeFan)[0].fractionLost, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationRangeFan).size)
+ assert_in_epsilon(kitchen_fan_power, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationRangeFan)[0].designLevel.get, 0.01)
+ assert_in_epsilon(1.0, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationRangeFan)[0].fractionLost, 0.01)
assert_in_epsilon(bath_fan_cfm, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationBathFan).size)
- assert_in_epsilon(bath_fan_power, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationBathFan)[0].designLevel.get, 0.01)
- assert_in_epsilon(1.0, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationBathFan)[0].fractionLost, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationBathFan).size)
+ assert_in_epsilon(bath_fan_power, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationBathFan)[0].designLevel.get, 0.01)
+ assert_in_epsilon(1.0, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationBathFan)[0].fractionLost, 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_clothes_dryer_exhaust
@@ -448,7 +450,7 @@ def test_clothes_dryer_exhaust
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check infiltration/ventilation program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_operator(UnitConversions.convert(program_values['Qdryer'].sum, 'm^3/s', 'cfm'), :>, 0)
end
@@ -496,23 +498,23 @@ def test_multiple_mechvent
# Check infiltration/ventilation program
# CFMs
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon(vent_fan_cfm_sup + vent_fan_cfm_bal + vent_fan_cfm_ervhrv, UnitConversions.convert(program_values['QWHV_sup'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(vent_fan_cfm_exh + vent_fan_cfm_bal + vent_fan_cfm_ervhrv, UnitConversions.convert(program_values['QWHV_exh'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(kitchen_fan_cfm, UnitConversions.convert(program_values['Qrange'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(bath_fan_cfm, UnitConversions.convert(program_values['Qbath'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(vent_fan_cfm_cfis, UnitConversions.convert(program_values['cfis_Q_duct_oa'].sum, 'm^3/s', 'cfm'), 0.01)
# Fan power/load implementation
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(total_mechvent_pow, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
- assert_in_epsilon(fraction_heat_lost, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(total_mechvent_pow, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].designLevel.get, 0.01)
+ assert_in_epsilon(fraction_heat_lost, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan)[0].fractionLost, 0.01)
assert_in_epsilon(vent_fan_power_cfis, program_values['cfis_fan_w'].sum, 0.01)
- range_fan_eeds = get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationRangeFan)
+ range_fan_eeds = get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationRangeFan)
assert_equal(2, range_fan_eeds.size)
assert_in_epsilon(kitchen_fan_power, range_fan_eeds.map { |f| f.designLevel.get }.sum(0.0), 0.01)
assert_in_epsilon(1.0, range_fan_eeds[0].fractionLost, 0.01)
assert_in_epsilon(1.0, range_fan_eeds[1].fractionLost, 0.01)
- bath_fan_eeds = get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationBathFan)
+ bath_fan_eeds = get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationBathFan)
assert_equal(2, bath_fan_eeds.size)
assert_in_epsilon(bath_fan_power, bath_fan_eeds.map { |f| f.designLevel.get }.sum(0.0), 0.01)
assert_in_epsilon(1.0, bath_fan_eeds[0].fractionLost, 0.01)
@@ -520,8 +522,8 @@ def test_multiple_mechvent
# CFIS minutes
assert_in_epsilon(vent_fan_mins_cfis, program_values['cfis_t_min_hr_open'].sum, 0.01)
# Load actuators
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
end
def test_shared_mechvent_multiple
@@ -550,17 +552,17 @@ def test_shared_mechvent_multiple
vent_fans_mins_cfis = hpxml_bldg.ventilation_fans.select { |f| f.fan_type == HPXML::MechVentTypeCFIS }.map { |f| f.hours_in_operation / 24.0 * 60.0 }.sum(0.0)
# Load and energy eed
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} sensible load").size)
- assert_equal(1, get_oed_for_ventilation(model, "#{Constants.ObjectNameMechanicalVentilationHouseFan} latent load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} sensible load").size)
+ assert_equal(1, get_oed_for_ventilation(model, "#{Constants::ObjectTypeMechanicalVentilationHouseFan} latent load").size)
assert_equal(vent_fans_precool.size, get_oed_for_ventilation(model, 'shared mech vent precooling energy').size)
assert_equal(vent_fans_preheat.size, get_oed_for_ventilation(model, 'shared mech vent preheating energy').size)
# Fan power implementation
- assert_equal(1, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).size)
- assert_in_epsilon(vent_fans_tot_pow_noncfis, get_eed_for_ventilation(model, Constants.ObjectNameMechanicalVentilationHouseFan).map { |eed| eed.designLevel.get }.sum, 0.01)
+ assert_equal(1, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).size)
+ assert_in_epsilon(vent_fans_tot_pow_noncfis, get_eed_for_ventilation(model, Constants::ObjectTypeMechanicalVentilationHouseFan).map { |eed| eed.designLevel.get }.sum, 0.01)
# Check preconditioning program
- program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants.ObjectNameInfiltration} program")
+ program_values = get_ems_values(model.getEnergyManagementSystemPrograms, "#{Constants::ObjectTypeInfiltration} program")
assert_in_epsilon((vent_fans_cfm_oa_preheat_sup + vent_fans_cfm_oa_preheat_bal + vent_fans_cfm_oa_preheat_ervhrv), UnitConversions.convert(program_values['Qpreheat'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon((vent_fans_cfm_oa_precool_sup + vent_fans_cfm_oa_precool_bal + vent_fans_cfm_oa_precool_ervhrv), UnitConversions.convert(program_values['Qprecool'].sum, 'm^3/s', 'cfm'), 0.01)
assert_in_epsilon(vent_fans_pow_cfis, program_values['cfis_fan_w'].sum, 0.01)
diff --git a/HPXMLtoOpenStudio/tests/test_battery.rb b/HPXMLtoOpenStudio/tests/test_battery.rb
index 1f91200de8..0b8c52bd7e 100644
--- a/HPXMLtoOpenStudio/tests/test_battery.rb
+++ b/HPXMLtoOpenStudio/tests/test_battery.rb
@@ -8,6 +8,11 @@
require_relative '../resources/util.rb'
class HPXMLtoOpenStudioBatteryTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
diff --git a/HPXMLtoOpenStudio/tests/test_defaults.rb b/HPXMLtoOpenStudio/tests/test_defaults.rb
index 6ea7e7f576..b63f27b245 100644
--- a/HPXMLtoOpenStudio/tests/test_defaults.rb
+++ b/HPXMLtoOpenStudio/tests/test_defaults.rb
@@ -29,6 +29,8 @@ def setup
def teardown
File.delete(@tmp_hpxml_path) if File.exist? @tmp_hpxml_path
FileUtils.rm_rf(@tmp_output_path)
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
end
def test_header
@@ -444,7 +446,7 @@ def test_occupancy
hpxml_bldg.building_occupancy.general_water_use_monthly_multipliers = nil
XMLHelper.write_file(hpxml.to_doc, @tmp_hpxml_path)
_default_hpxml, default_hpxml_bldg = _test_measure()
- _test_default_occupancy_values(default_hpxml_bldg, @default_schedules_csv_data[Constants.ObjectNameOccupants]['WeekdayScheduleFractions'], @default_schedules_csv_data[Constants.ObjectNameOccupants]['WeekendScheduleFractions'], @default_schedules_csv_data[Constants.ObjectNameOccupants]['MonthlyScheduleMultipliers'],
+ _test_default_occupancy_values(default_hpxml_bldg, @default_schedules_csv_data[Constants::ObjectTypeOccupants]['WeekdayScheduleFractions'], @default_schedules_csv_data[Constants::ObjectTypeOccupants]['WeekendScheduleFractions'], @default_schedules_csv_data[Constants::ObjectTypeOccupants]['MonthlyScheduleMultipliers'],
@default_schedules_csv_data[SchedulesFile::Columns[:GeneralWaterUse].name]['GeneralWaterUseWeekdayScheduleFractions'], @default_schedules_csv_data[SchedulesFile::Columns[:GeneralWaterUse].name]['GeneralWaterUseWeekendScheduleFractions'], @default_schedules_csv_data[SchedulesFile::Columns[:GeneralWaterUse].name]['GeneralWaterUseMonthlyScheduleMultipliers'], 1.0)
end
diff --git a/HPXMLtoOpenStudio/tests/test_enclosure.rb b/HPXMLtoOpenStudio/tests/test_enclosure.rb
index 356e91d7de..587dfaac5d 100644
--- a/HPXMLtoOpenStudio/tests/test_enclosure.rb
+++ b/HPXMLtoOpenStudio/tests/test_enclosure.rb
@@ -17,6 +17,8 @@ def setup
def teardown
File.delete(@tmp_hpxml_path) if File.exist? @tmp_hpxml_path
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
end
def test_roofs
@@ -492,21 +494,21 @@ def test_manufactured_home_foundation
model, hpxml, hpxml_bldg = _test_measure(args_hash)
hpxml_floor = hpxml_bldg.floors.find { |x| x.exterior_adjacent_to == HPXML::LocationManufacturedHomeUnderBelly }
os_surface = model.getSurfaces.find { |s| s.name.to_s.start_with? "#{hpxml_floor.id}" }
- assert_equal('NoWind', os_surface.windExposure)
+ assert_equal(EPlus::SurfaceWindExposureNo, os_surface.windExposure)
hpxml_bldg.foundations.clear
XMLHelper.write_file(hpxml.to_doc, @tmp_hpxml_path)
model, _hpxml, hpxml_bldg = _test_measure(args_hash)
hpxml_floor = hpxml_bldg.floors.find { |x| x.exterior_adjacent_to == HPXML::LocationManufacturedHomeUnderBelly }
os_surface = model.getSurfaces.find { |s| s.name.to_s.start_with? "#{hpxml_floor.id}" }
- assert_equal('NoWind', os_surface.windExposure)
+ assert_equal(EPlus::SurfaceWindExposureNo, os_surface.windExposure)
hpxml, _hpxml_bldg = _create_hpxml('base-foundation-belly-wing-no-skirt.xml')
XMLHelper.write_file(hpxml.to_doc, @tmp_hpxml_path)
model, _hpxml, hpxml_bldg = _test_measure(args_hash)
hpxml_floor = hpxml_bldg.floors.find { |x| x.exterior_adjacent_to == HPXML::LocationManufacturedHomeUnderBelly }
os_surface = model.getSurfaces.find { |s| s.name.to_s.start_with? "#{hpxml_floor.id}" }
- assert_equal('WindExposed', os_surface.windExposure)
+ assert_equal(EPlus::SurfaceWindExposureYes, os_surface.windExposure)
end
def test_slabs
@@ -813,12 +815,12 @@ def test_foundation_properties
model.getFoundationKivas.each do |foundation|
osm_exposed_perimeter = 0.0
model.getSurfacePropertyExposedFoundationPerimeters.each do |osm_prop|
- next unless osm_prop.surface.outsideBoundaryCondition == 'Foundation' && osm_prop.surface.adjacentFoundation.get == foundation
+ next unless osm_prop.surface.outsideBoundaryCondition == EPlus::BoundaryConditionFoundation && osm_prop.surface.adjacentFoundation.get == foundation
osm_exposed_perimeter += UnitConversions.convert(osm_prop.totalExposedPerimeter.get, 'm', 'ft')
end
- osm_fwalls = model.getSurfaces.select { |s| s.outsideBoundaryCondition == 'Foundation' && s.adjacentFoundation.get == foundation && s.surfaceType == 'Wall' }
+ osm_fwalls = model.getSurfaces.select { |s| s.outsideBoundaryCondition == EPlus::BoundaryConditionFoundation && s.adjacentFoundation.get == foundation && s.surfaceType == EPlus::SurfaceTypeWall }
if not osm_fwalls.empty?
osm_fwalls_length = osm_fwalls.map { |s| Geometry.get_surface_length(surface: s) }.sum
assert_in_epsilon(osm_exposed_perimeter, osm_fwalls_length, 0.01)
@@ -827,7 +829,7 @@ def test_foundation_properties
# Check slab areas
slab_int_adj_tos.each do |int_adj_to, slabs|
- osm_slabs = model.getSurfaces.select { |s| s.surfaceType == 'Floor' && s.outsideBoundaryCondition == 'Foundation' && s.space.get.name.to_s.start_with?(int_adj_to) }
+ osm_slabs = model.getSurfaces.select { |s| s.surfaceType == EPlus::SurfaceTypeFloor && s.outsideBoundaryCondition == EPlus::BoundaryConditionFoundation && s.space.get.name.to_s.start_with?(int_adj_to) }
osm_area = osm_slabs.map { |s| s.grossArea }.sum
hpxml_area = slabs.map { |s| s.area }.sum
@@ -836,7 +838,7 @@ def test_foundation_properties
# Check exterior foundation wall exposed areas
ext_fwall_int_adj_tos.each do |int_adj_to, fwalls|
- osm_fwalls = model.getSurfaces.select { |s| s.surfaceType == 'Wall' && s.outsideBoundaryCondition == 'Foundation' && s.space.get.name.to_s.start_with?(int_adj_to) }
+ osm_fwalls = model.getSurfaces.select { |s| s.surfaceType == EPlus::SurfaceTypeWall && s.outsideBoundaryCondition == EPlus::BoundaryConditionFoundation && s.space.get.name.to_s.start_with?(int_adj_to) }
osm_area = osm_fwalls.map { |s| s.grossArea }.sum
hpxml_area = fwalls.map { |fw| fw.net_area * fw.exposed_fraction }.sum
@@ -845,7 +847,7 @@ def test_foundation_properties
# Check exterior foundation wall heights & below-grade depths
ext_fwall_int_adj_tos.each do |int_adj_to, fwalls|
- osm_fwalls = model.getSurfaces.select { |s| s.surfaceType == 'Wall' && s.outsideBoundaryCondition == 'Foundation' && s.space.get.name.to_s.start_with?(int_adj_to) }
+ osm_fwalls = model.getSurfaces.select { |s| s.surfaceType == EPlus::SurfaceTypeWall && s.outsideBoundaryCondition == EPlus::BoundaryConditionFoundation && s.space.get.name.to_s.start_with?(int_adj_to) }
osm_heights = osm_fwalls.map { |s| Geometry.get_surface_height(surface: s) }.uniq.sort
hpxml_heights = fwalls.map { |fw| fw.height }.uniq.sort
@@ -866,7 +868,7 @@ def test_foundation_properties
# Check interior foundation wall heights & below-grade depths
int_fwall_int_adj_tos.each do |int_adj_to, fwalls|
- osm_fwalls = model.getSurfaces.select { |s| s.surfaceType == 'Wall' && s.outsideBoundaryCondition != 'Foundation' && Geometry.get_surface_z_values(surfaceArray: [s]).min < 0 && s.space.get.name.to_s.start_with?(int_adj_to) }
+ osm_fwalls = model.getSurfaces.select { |s| s.surfaceType == EPlus::SurfaceTypeWall && s.outsideBoundaryCondition != EPlus::BoundaryConditionFoundation && Geometry.get_surface_z_values(surfaceArray: [s]).min < 0 && s.space.get.name.to_s.start_with?(int_adj_to) }
osm_heights = osm_fwalls.map { |s| Geometry.get_surface_z_values(surfaceArray: [s]).max - Geometry.get_surface_z_values(surfaceArray: [s]).min }.uniq.sort
hpxml_heights = fwalls.map { |fw| fw.height - fw.depth_below_grade }.uniq.sort
diff --git a/HPXMLtoOpenStudio/tests/test_generator.rb b/HPXMLtoOpenStudio/tests/test_generator.rb
index 3c671bd148..fe451d318c 100644
--- a/HPXMLtoOpenStudio/tests/test_generator.rb
+++ b/HPXMLtoOpenStudio/tests/test_generator.rb
@@ -8,6 +8,11 @@
require_relative '../resources/util.rb'
class HPXMLtoOpenStudioGeneratorTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
diff --git a/HPXMLtoOpenStudio/tests/test_hotwater_appliance.rb b/HPXMLtoOpenStudio/tests/test_hotwater_appliance.rb
index d63370ba01..3412e038f9 100644
--- a/HPXMLtoOpenStudio/tests/test_hotwater_appliance.rb
+++ b/HPXMLtoOpenStudio/tests/test_hotwater_appliance.rb
@@ -8,6 +8,11 @@
require_relative '../resources/util.rb'
class HPXMLtoOpenStudioHotWaterApplianceTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
@@ -111,55 +116,55 @@ def test_base
dist_gpd = 10.030
cw_gpd = 3.7116
dw_gpd = 2.7342
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 443.317
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 448.0
cook_sens_frac = 0.72
cook_lat_frac = 0.080
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
# mains temperature
avg_tmains = 57.58
@@ -176,55 +181,55 @@ def test_dhw_multiple
dist_gpd = 3.510
cw_gpd = 1.2991
dw_gpd = 0.9570
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 443.317
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 448.0
cook_sens_frac = 0.72
cook_lat_frac = 0.080
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
end
def test_dhw_shared_water_heater_recirc
@@ -237,60 +242,60 @@ def test_dhw_shared_water_heater_recirc
dist_gpd = 12.103
cw_gpd = 3.7116
dw_gpd = 2.7342
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 443.317
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 448.0
cook_sens_frac = 0.72
cook_lat_frac = 0.080
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
# recirc
hot_water_distribution = hpxml_bldg.hot_water_distributions[0]
pump_kwh_yr = 8.76 * hot_water_distribution.shared_recirculation_pump_power * hpxml_bldg.building_construction.number_of_bedrooms.to_f / hot_water_distribution.shared_recirculation_number_of_bedrooms_served
- assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameHotWaterRecircPump), 0.001)
+ assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeHotWaterRecircPump), 0.001)
# zero bedroom
args_hash = {}
@@ -300,7 +305,7 @@ def test_dhw_shared_water_heater_recirc
# recirc
hot_water_distribution = hpxml_bldg.hot_water_distributions[0]
pump_kwh_yr = 8.76 * hot_water_distribution.shared_recirculation_pump_power * 1.0 / hot_water_distribution.shared_recirculation_number_of_bedrooms_served
- assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameHotWaterRecircPump), 0.001)
+ assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeHotWaterRecircPump), 0.001)
end
def test_dhw_shared_laundry
@@ -313,55 +318,55 @@ def test_dhw_shared_laundry
dist_gpd = 12.103
cw_gpd = 3.7116
dw_gpd = 2.7342
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.0
cw_lat_frac = 0.0
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.0
dw_lat_frac = 0.0
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 443.317
cd_sens_frac = 0.0
cd_lat_frac = 0.0
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 448.0
cook_sens_frac = 0.72
cook_lat_frac = 0.080
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
end
def test_dhw_low_flow_fixtures
@@ -372,8 +377,8 @@ def test_dhw_low_flow_fixtures
# water use equipment peak flows
fixture_gpd = 42.39
dist_gpd = 9.7261
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
end
def test_dhw_dwhr
@@ -384,8 +389,8 @@ def test_dhw_dwhr
# water use equipment peak flows
fixture_gpd = 43.71
dist_gpd = 10.030
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
# mains temperature
avg_tmains = 70.91
@@ -400,7 +405,7 @@ def test_dhw_recirc_demand
# Get HPXML values
hot_water_distribution = hpxml_bldg.hot_water_distributions[0]
pump_kwh_yr = 0.15 * hot_water_distribution.recirculation_pump_power
- assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameHotWaterRecircPump), 0.001)
+ assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeHotWaterRecircPump), 0.001)
end
def test_dhw_recirc_manual
@@ -411,7 +416,7 @@ def test_dhw_recirc_manual
# Get HPXML values
hot_water_distribution = hpxml_bldg.hot_water_distributions[0]
pump_kwh_yr = 0.10 * hot_water_distribution.recirculation_pump_power
- assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameHotWaterRecircPump), 0.001)
+ assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeHotWaterRecircPump), 0.001)
end
def test_dhw_recirc_no_control
@@ -422,7 +427,7 @@ def test_dhw_recirc_no_control
# Get HPXML values
hot_water_distribution = hpxml_bldg.hot_water_distributions[0]
pump_kwh_yr = 8.76 * hot_water_distribution.recirculation_pump_power
- assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameHotWaterRecircPump), 0.001)
+ assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeHotWaterRecircPump), 0.001)
end
def test_dhw_recirc_timer
@@ -433,7 +438,7 @@ def test_dhw_recirc_timer
# Get HPXML values
hot_water_distribution = hpxml_bldg.hot_water_distributions[0]
pump_kwh_yr = 8.76 * hot_water_distribution.recirculation_pump_power
- assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameHotWaterRecircPump), 0.001)
+ assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeHotWaterRecircPump), 0.001)
end
def test_dhw_recirc_temp
@@ -444,7 +449,7 @@ def test_dhw_recirc_temp
# Get HPXML values
hot_water_distribution = hpxml_bldg.hot_water_distributions[0]
pump_kwh_yr = 1.46 * hot_water_distribution.recirculation_pump_power
- assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameHotWaterRecircPump), 0.001)
+ assert_in_epsilon(pump_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeHotWaterRecircPump), 0.001)
end
def test_appliances_none
@@ -453,35 +458,35 @@ def test_appliances_none
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# water use equipment peak flows
- assert_nil(get_wu_gpd(model, Constants.ObjectNameClothesWasher))
- assert_nil(get_wu_gpd(model, Constants.ObjectNameDishwasher))
+ assert_nil(get_wu_gpd(model, Constants::ObjectTypeClothesWasher))
+ assert_nil(get_wu_gpd(model, Constants::ObjectTypeDishwasher))
# electric equipment
- assert_equal(0.0, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher))
- assert(get_ee_fractions(model, Constants.ObjectNameClothesWasher).empty?)
+ assert_equal(0.0, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher))
+ assert(get_ee_fractions(model, Constants::ObjectTypeClothesWasher).empty?)
- assert_equal(0.0, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher))
- assert(get_ee_fractions(model, Constants.ObjectNameDishwasher).empty?)
+ assert_equal(0.0, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher))
+ assert(get_ee_fractions(model, Constants::ObjectTypeDishwasher).empty?)
- assert_equal(0.0, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer))
- assert(get_ee_fractions(model, Constants.ObjectNameClothesDryer).empty?)
+ assert_equal(0.0, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer))
+ assert(get_ee_fractions(model, Constants::ObjectTypeClothesDryer).empty?)
- assert_equal(0.0, get_ee_kwh_per_year(model, Constants.ObjectNameRefrigerator))
- assert(get_ee_fractions(model, Constants.ObjectNameRefrigerator).empty?)
+ assert_equal(0.0, get_ee_kwh_per_year(model, Constants::ObjectTypeRefrigerator))
+ assert(get_ee_fractions(model, Constants::ObjectTypeRefrigerator).empty?)
- assert_equal(0.0, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange))
- assert(get_ee_fractions(model, Constants.ObjectNameCookingRange).empty?)
+ assert_equal(0.0, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange))
+ assert(get_ee_fractions(model, Constants::ObjectTypeCookingRange).empty?)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
end
def test_appliances_modified
@@ -492,53 +497,53 @@ def test_appliances_modified
# water use equipment peak flows
cw_gpd = 3.7116
dw_gpd = 5.475
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 186.6
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 445.1052
cd_sens_frac = 0.9
cd_lat_frac = 0.1
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 448.0
cook_sens_frac = 0.72
cook_lat_frac = 0.080
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
end
def test_appliances_oil
@@ -549,65 +554,65 @@ def test_appliances_oil
# water use equipment peak flows
cw_gpd = 3.7116
dw_gpd = 2.7342
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 39.646
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 30.70
cook_sens_frac = 0.64
cook_lat_frac = 0.16
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
cd_fuel_kwh = UnitConversions.convert(17.972, 'therm', 'kWh')
- assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_equal(EPlus::FuelTypeOil, get_oe_fuel(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_equal(EPlus::FuelTypeOil, get_oe_fuel(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
cook_fuel_kwh = UnitConversions.convert(30.70, 'therm', 'kWh')
- assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameCookingRange), 0.001)
- assert_equal(EPlus::FuelTypeOil, get_oe_fuel(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_equal(EPlus::FuelTypeOil, get_oe_fuel(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
end
def test_appliances_gas
@@ -618,65 +623,65 @@ def test_appliances_gas
# water use equipment peak flows
cw_gpd = 3.7116
dw_gpd = 2.7342
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 39.646
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 30.70
cook_sens_frac = 0.64
cook_lat_frac = 0.16
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
cd_fuel_kwh = UnitConversions.convert(17.972, 'therm', 'kWh')
- assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_equal(EPlus::FuelTypeNaturalGas, get_oe_fuel(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_equal(EPlus::FuelTypeNaturalGas, get_oe_fuel(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
cook_fuel_kwh = UnitConversions.convert(30.70, 'therm', 'kWh')
- assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameCookingRange), 0.001)
- assert_equal(EPlus::FuelTypeNaturalGas, get_oe_fuel(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_equal(EPlus::FuelTypeNaturalGas, get_oe_fuel(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
end
def test_appliances_propane
@@ -687,65 +692,65 @@ def test_appliances_propane
# water use equipment peak flows
cw_gpd = 3.7116
dw_gpd = 2.7342
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 39.646
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 30.70
cook_sens_frac = 0.64
cook_lat_frac = 0.16
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
cd_fuel_kwh = UnitConversions.convert(17.972, 'therm', 'kWh')
- assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_equal(EPlus::FuelTypePropane, get_oe_fuel(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_equal(EPlus::FuelTypePropane, get_oe_fuel(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
cook_fuel_kwh = UnitConversions.convert(30.70, 'therm', 'kWh')
- assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameCookingRange), 0.001)
- assert_equal(EPlus::FuelTypePropane, get_oe_fuel(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_equal(EPlus::FuelTypePropane, get_oe_fuel(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
end
def test_appliances_wood
@@ -756,65 +761,65 @@ def test_appliances_wood
# water use equipment peak flows
cw_gpd = 3.7116
dw_gpd = 2.7342
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 39.646
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 30.70
cook_sens_frac = 0.64
cook_lat_frac = 0.16
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
cd_fuel_kwh = UnitConversions.convert(17.972, 'therm', 'kWh')
- assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_equal(EPlus::FuelTypeWoodCord, get_oe_fuel(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_equal(EPlus::FuelTypeWoodCord, get_oe_fuel(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
cook_fuel_kwh = UnitConversions.convert(30.70, 'therm', 'kWh')
- assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameCookingRange), 0.001)
- assert_equal(EPlus::FuelTypeWoodCord, get_oe_fuel(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_equal(EPlus::FuelTypeWoodCord, get_oe_fuel(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
end
def test_appliances_coal
@@ -825,65 +830,65 @@ def test_appliances_coal
# water use equipment peak flows
cw_gpd = 3.7116
dw_gpd = 2.7342
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 39.646
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 30.70
cook_sens_frac = 0.64
cook_lat_frac = 0.16
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507
water_lat = 266.358
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
cd_fuel_kwh = UnitConversions.convert(17.972, 'therm', 'kWh')
- assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_equal(EPlus::FuelTypeCoal, get_oe_fuel(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_equal(EPlus::FuelTypeCoal, get_oe_fuel(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_oe_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
cook_fuel_kwh = UnitConversions.convert(30.70, 'therm', 'kWh')
- assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants.ObjectNameCookingRange), 0.001)
- assert_equal(EPlus::FuelTypeCoal, get_oe_fuel(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_fuel_kwh, get_oe_kwh(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_equal(EPlus::FuelTypeCoal, get_oe_fuel(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_oe_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
end
def test_usage_multiplier
@@ -896,55 +901,55 @@ def test_usage_multiplier
dist_gpd = 10.030 * 0.9
cw_gpd = 3.7116 * 0.9
dw_gpd = 2.7342 * 0.9
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
# electric equipment
cw_ee_kwh_yr = 107.059 * 0.9
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 93.392 * 0.9
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 443.317 * 0.9
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 448.0 * 0.9
cook_sens_frac = 0.72
cook_lat_frac = 0.080
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -262.507 * 0.9
water_lat = 266.358 * 0.9
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
end
def test_operational_1_occupant
@@ -957,55 +962,55 @@ def test_operational_1_occupant
dist_gpd = 4.569
cw_gpd = 2.25
dw_gpd = 1.713
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
# electric equipment
cw_ee_kwh_yr = 64.906
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 58.521
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 268.766
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 339.4481
cook_sens_frac = 0.72
cook_lat_frac = 0.080
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -140.879
water_lat = 142.945
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
end
def test_operational_5_occupants
@@ -1018,55 +1023,55 @@ def test_operational_5_occupants
dist_gpd = 21.648
cw_gpd = 6.224
dw_gpd = 5.387
- assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants.ObjectNameFixtures), 0.001)
- assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants.ObjectNameDistributionWaste), 0.001)
+ assert_in_epsilon(cw_gpd, get_wu_gpd(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(dw_gpd, get_wu_gpd(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(fixture_gpd, get_wu_gpd(model, Constants::ObjectTypeFixtures), 0.001)
+ assert_in_epsilon(dist_gpd, get_wu_gpd(model, Constants::ObjectTypeDistributionWaste), 0.001)
# electric equipment
cw_ee_kwh_yr = 139.688
cw_sens_frac = 0.27
cw_lat_frac = 0.03
- assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesWasher), 0.001)
- assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[0], 0.001)
- assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesWasher)[1], 0.001)
+ assert_in_epsilon(cw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesWasher), 0.001)
+ assert_in_epsilon(cw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[0], 0.001)
+ assert_in_epsilon(cw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesWasher)[1], 0.001)
dw_ee_kwh_yr = 163.593
dw_sens_frac = 0.3
dw_lat_frac = 0.300
- assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameDishwasher), 0.001)
- assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[0], 0.001)
- assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants.ObjectNameDishwasher)[1], 0.001)
+ assert_in_epsilon(dw_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeDishwasher), 0.001)
+ assert_in_epsilon(dw_sens_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[0], 0.001)
+ assert_in_epsilon(dw_lat_frac, get_ee_fractions(model, Constants::ObjectTypeDishwasher)[1], 0.001)
cd_ee_kwh_yr = 1038.961
cd_sens_frac = 0.135
cd_lat_frac = 0.015
- assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameClothesDryer), 0.001)
- assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[0], 0.001)
- assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants.ObjectNameClothesDryer)[1], 0.001)
+ assert_in_epsilon(cd_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeClothesDryer), 0.001)
+ assert_in_epsilon(cd_sens_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[0], 0.001)
+ assert_in_epsilon(cd_lat_frac, get_ee_fractions(model, Constants::ObjectTypeClothesDryer)[1], 0.001)
rf_sens_frac = 1.0
rf_lat_frac = 0.0
- assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[0], 0.001)
- assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants.ObjectNameRefrigerator)[1], 0.001)
+ assert_in_epsilon(rf_sens_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[0], 0.001)
+ assert_in_epsilon(rf_lat_frac, get_ee_fractions(model, Constants::ObjectTypeRefrigerator)[1], 0.001)
cook_ee_kwh_yr = 603.22
cook_sens_frac = 0.72
cook_lat_frac = 0.080
- assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants.ObjectNameCookingRange), 0.001)
- assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[0], 0.001)
- assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants.ObjectNameCookingRange)[1], 0.001)
+ assert_in_epsilon(cook_ee_kwh_yr, get_ee_kwh_per_year(model, Constants::ObjectTypeCookingRange), 0.001)
+ assert_in_epsilon(cook_sens_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[0], 0.001)
+ assert_in_epsilon(cook_lat_frac, get_ee_fractions(model, Constants::ObjectTypeCookingRange)[1], 0.001)
# other equipment
water_sens = -436.636
water_lat = 443.042
- assert_in_epsilon(water_sens, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseSensible), 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[0], 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseSensible)[1], 0.001)
+ assert_in_epsilon(water_sens, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseSensible), 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[0], 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseSensible)[1], 0.001)
- assert_in_epsilon(water_lat, get_oe_kwh(model, Constants.ObjectNameGeneralWaterUseLatent), 0.001)
- assert_in_epsilon(0.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[0], 0.001)
- assert_in_epsilon(1.0, get_oe_fractions(model, Constants.ObjectNameGeneralWaterUseLatent)[1], 0.001)
+ assert_in_epsilon(water_lat, get_oe_kwh(model, Constants::ObjectTypeGeneralWaterUseLatent), 0.001)
+ assert_in_epsilon(0.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[0], 0.001)
+ assert_in_epsilon(1.0, get_oe_fractions(model, Constants::ObjectTypeGeneralWaterUseLatent)[1], 0.001)
end
def _test_measure(args_hash)
diff --git a/HPXMLtoOpenStudio/tests/test_hvac.rb b/HPXMLtoOpenStudio/tests/test_hvac.rb
index 9a3bb5c4c4..79cd19727c 100644
--- a/HPXMLtoOpenStudio/tests/test_hvac.rb
+++ b/HPXMLtoOpenStudio/tests/test_hvac.rb
@@ -17,6 +17,8 @@ def setup
def teardown
File.delete(@tmp_hpxml_path) if File.exist? @tmp_hpxml_path
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
end
def test_central_air_conditioner_1_speed
@@ -1557,8 +1559,8 @@ def test_custom_seasons
year = model.getYearDescription.assumedYear
# Check heating season
- start_day_num = Schedule.get_day_num_from_month_day(year, seasons_heating_begin_month, seasons_heating_begin_day)
- end_day_num = Schedule.get_day_num_from_month_day(year, seasons_heating_end_month, seasons_heating_end_day)
+ start_day_num = Calendar.get_day_num_from_month_day(year, seasons_heating_begin_month, seasons_heating_begin_day)
+ end_day_num = Calendar.get_day_num_from_month_day(year, seasons_heating_end_month, seasons_heating_end_day)
start_date = OpenStudio::Date::fromDayOfYear(start_day_num, year)
end_date = OpenStudio::Date::fromDayOfYear(end_day_num, year)
heating_days = zone.sequentialHeatingFractionSchedule(zone.airLoopHVACTerminals[0]).get.to_ScheduleRuleset.get
@@ -1575,8 +1577,8 @@ def test_custom_seasons
assert_includes(end_dates, end_date)
# Check cooling season
- start_day_num = Schedule.get_day_num_from_month_day(year, seasons_cooling_begin_month, seasons_cooling_begin_day)
- end_day_num = Schedule.get_day_num_from_month_day(year, seasons_cooling_end_month, seasons_cooling_end_day)
+ start_day_num = Calendar.get_day_num_from_month_day(year, seasons_cooling_begin_month, seasons_cooling_begin_day)
+ end_day_num = Calendar.get_day_num_from_month_day(year, seasons_cooling_end_month, seasons_cooling_end_day)
start_date = OpenStudio::Date::fromDayOfYear(start_day_num, year)
end_date = OpenStudio::Date::fromDayOfYear(end_day_num, year)
cooling_days = zone.sequentialCoolingFractionSchedule(zone.airLoopHVACTerminals[0]).get.to_ScheduleRuleset.get
diff --git a/HPXMLtoOpenStudio/tests/test_lighting.rb b/HPXMLtoOpenStudio/tests/test_lighting.rb
index 26704181e6..9c92c57028 100644
--- a/HPXMLtoOpenStudio/tests/test_lighting.rb
+++ b/HPXMLtoOpenStudio/tests/test_lighting.rb
@@ -8,6 +8,11 @@
require_relative '../resources/util.rb'
class HPXMLtoOpenStudioLightingTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
@@ -43,10 +48,10 @@ def test_lighting
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check interior lighting
- assert_in_delta(1322, get_kwh_per_year(model, Constants.ObjectNameLightingInterior).round, 1.0)
+ assert_in_delta(1322, get_kwh_per_year(model, Constants::ObjectTypeLightingInterior).round, 1.0)
# Check exterior lighting
- assert_in_delta(98, get_kwh_per_year(model, Constants.ObjectNameLightingExterior), 1.0)
+ assert_in_delta(98, get_kwh_per_year(model, Constants::ObjectTypeLightingExterior), 1.0)
end
def test_lighting_garage
@@ -55,13 +60,13 @@ def test_lighting_garage
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check interior lighting
- assert_in_delta(1544, get_kwh_per_year(model, Constants.ObjectNameLightingInterior), 1.0)
+ assert_in_delta(1544, get_kwh_per_year(model, Constants::ObjectTypeLightingInterior), 1.0)
# Check garage lighting
- assert_in_delta(42, get_kwh_per_year(model, Constants.ObjectNameLightingGarage), 1.0)
+ assert_in_delta(42, get_kwh_per_year(model, Constants::ObjectTypeLightingGarage), 1.0)
# Check exterior lighting
- assert_in_delta(109, get_kwh_per_year(model, Constants.ObjectNameLightingExterior), 1.0)
+ assert_in_delta(109, get_kwh_per_year(model, Constants::ObjectTypeLightingExterior), 1.0)
end
def test_exterior_holiday_lighting
@@ -74,7 +79,7 @@ def test_exterior_holiday_lighting
if hpxml_name == 'base-lighting-holiday.xml'
# Check exterior holiday lighting
- assert_in_delta(58.3, get_kwh_per_year(model, Constants.ObjectNameLightingExteriorHoliday), 1.0)
+ assert_in_delta(58.3, get_kwh_per_year(model, Constants::ObjectTypeLightingExteriorHoliday), 1.0)
else
assert_equal(false, hpxml_bldg.lighting.holiday_exists)
end
@@ -89,12 +94,12 @@ def test_lighting_kwh_per_year
# Check interior lighting
int_kwh_yr = hpxml_bldg.lighting_groups.find { |lg| lg.location == HPXML::LocationInterior }.kwh_per_year
int_kwh_yr *= hpxml_bldg.lighting.interior_usage_multiplier unless hpxml_bldg.lighting.interior_usage_multiplier.nil?
- assert_in_delta(int_kwh_yr, get_kwh_per_year(model, Constants.ObjectNameLightingInterior).round, 1.0)
+ assert_in_delta(int_kwh_yr, get_kwh_per_year(model, Constants::ObjectTypeLightingInterior).round, 1.0)
# Check exterior lighting
ext_kwh_yr = hpxml_bldg.lighting_groups.find { |lg| lg.location == HPXML::LocationExterior }.kwh_per_year
ext_kwh_yr *= hpxml_bldg.lighting.exterior_usage_multiplier unless hpxml_bldg.lighting.exterior_usage_multiplier.nil?
- assert_in_delta(ext_kwh_yr, get_kwh_per_year(model, Constants.ObjectNameLightingExterior), 1.0)
+ assert_in_delta(ext_kwh_yr, get_kwh_per_year(model, Constants::ObjectTypeLightingExterior), 1.0)
end
def test_lighting_none
@@ -103,13 +108,13 @@ def test_lighting_none
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check interior lighting
- assert_equal(0.0, get_kwh_per_year(model, Constants.ObjectNameLightingInterior))
+ assert_equal(0.0, get_kwh_per_year(model, Constants::ObjectTypeLightingInterior))
# Check garage lighting
- assert_equal(0.0, get_kwh_per_year(model, Constants.ObjectNameLightingGarage))
+ assert_equal(0.0, get_kwh_per_year(model, Constants::ObjectTypeLightingGarage))
# Check exterior lighting
- assert_equal(0.0, get_kwh_per_year(model, Constants.ObjectNameLightingExterior))
+ assert_equal(0.0, get_kwh_per_year(model, Constants::ObjectTypeLightingExterior))
end
def test_ceiling_fan
@@ -118,14 +123,14 @@ def test_ceiling_fan
args_hash['hpxml_path'] = File.absolute_path(File.join(sample_files_dir, 'base-lighting-ceiling-fans.xml'))
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
- assert_in_delta(154, get_kwh_per_year(model, Constants.ObjectNameCeilingFan), 1.0)
+ assert_in_delta(154, get_kwh_per_year(model, Constants::ObjectTypeCeilingFan), 1.0)
# Label energy use
args_hash = {}
args_hash['hpxml_path'] = File.absolute_path(File.join(sample_files_dir, 'base-lighting-ceiling-fans-label-energy-use.xml'))
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
- assert_in_delta(200, get_kwh_per_year(model, Constants.ObjectNameCeilingFan), 1.0)
+ assert_in_delta(200, get_kwh_per_year(model, Constants::ObjectTypeCeilingFan), 1.0)
end
def _test_measure(args_hash)
diff --git a/HPXMLtoOpenStudio/tests/test_location.rb b/HPXMLtoOpenStudio/tests/test_location.rb
index 8b93ed06de..42df0bb370 100644
--- a/HPXMLtoOpenStudio/tests/test_location.rb
+++ b/HPXMLtoOpenStudio/tests/test_location.rb
@@ -8,6 +8,11 @@
require_relative '../resources/util.rb'
class HPXMLtoOpenStudioLocationTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
diff --git a/HPXMLtoOpenStudio/tests/test_miscloads.rb b/HPXMLtoOpenStudio/tests/test_miscloads.rb
index b70b05e41c..bb6e099214 100644
--- a/HPXMLtoOpenStudio/tests/test_miscloads.rb
+++ b/HPXMLtoOpenStudio/tests/test_miscloads.rb
@@ -8,6 +8,11 @@
require_relative '../resources/util.rb'
class HPXMLtoOpenStudioMiscLoadsTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
@@ -42,25 +47,25 @@ def test_misc_loads
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check misc plug loads
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPlugLoads)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPlugLoads)
assert_in_delta(2457, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check television
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscTelevision)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscTelevision)
assert_in_delta(620, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check others
- objects = [Constants.ObjectNameMiscElectricVehicleCharging,
- Constants.ObjectNameMiscWellPump,
- Constants.ObjectNameMiscPoolPump,
- Constants.ObjectNameMiscPoolHeater,
- Constants.ObjectNameMiscPermanentSpaPump,
- Constants.ObjectNameMiscPermanentSpaHeater,
- Constants.ObjectNameMiscGrill,
- Constants.ObjectNameMiscLighting,
- Constants.ObjectNameMiscFireplace]
+ objects = [Constants::ObjectTypeMiscElectricVehicleCharging,
+ Constants::ObjectTypeMiscWellPump,
+ Constants::ObjectTypeMiscPoolPump,
+ Constants::ObjectTypeMiscPoolHeater,
+ Constants::ObjectTypeMiscPermanentSpaPump,
+ Constants::ObjectTypeMiscPermanentSpaHeater,
+ Constants::ObjectTypeMiscGrill,
+ Constants::ObjectTypeMiscLighting,
+ Constants::ObjectTypeMiscFireplace]
objects.each do |object_name|
kwh_yr, therm_yr = get_kwh_therm_per_year(model, object_name)
assert_equal(0, kwh_yr)
@@ -74,57 +79,57 @@ def test_large_uncommon_loads
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check misc plug loads
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPlugLoads)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPlugLoads)
assert_in_delta(2457, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check television
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscTelevision)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscTelevision)
assert_in_delta(620, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check vehicle
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscElectricVehicleCharging)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscElectricVehicleCharging)
assert_in_epsilon(1500, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check well pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscWellPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscWellPump)
assert_in_epsilon(475, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolPump)
assert_in_epsilon(2700, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolHeater)
assert_equal(0, kwh_yr)
assert_in_epsilon(500, therm_yr, 0.1)
# Check permanent spa pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaPump)
assert_in_epsilon(1000, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check permanent spa heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaHeater)
assert_in_epsilon(1300, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check grill
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscGrill)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscGrill)
assert_equal(0, kwh_yr)
assert_in_epsilon(25, therm_yr, 0.1)
# Check lighting
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscLighting)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscLighting)
assert_equal(0, kwh_yr)
assert_in_epsilon(28, therm_yr, 0.1)
# Check fireplace
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscFireplace)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscFireplace)
assert_equal(0, kwh_yr)
assert_in_epsilon(55, therm_yr, 0.1)
end
@@ -135,57 +140,57 @@ def test_large_uncommon_loads2
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check misc plug loads
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPlugLoads)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPlugLoads)
assert_in_delta(2457, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check television
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscTelevision)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscTelevision)
assert_in_delta(620, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check vehicle
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscElectricVehicleCharging)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscElectricVehicleCharging)
assert_in_epsilon(1500, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check well pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscWellPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscWellPump)
assert_in_epsilon(475, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolPump)
assert_in_epsilon(2700, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolHeater)
assert_equal(0, kwh_yr)
assert_equal(0, therm_yr)
# Check permanent spa pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaPump)
assert_in_epsilon(1000, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check permanent spa heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaHeater)
assert_in_epsilon(260, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check grill
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscGrill)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscGrill)
assert_equal(0, kwh_yr)
assert_in_epsilon(25, therm_yr, 0.1)
# Check lighting
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscLighting)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscLighting)
assert_equal(0, kwh_yr)
assert_in_epsilon(28, therm_yr, 0.1)
# Check fireplace
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscFireplace)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscFireplace)
assert_equal(0, kwh_yr)
assert_in_epsilon(55, therm_yr, 0.1)
end
@@ -196,57 +201,57 @@ def test_operational_defaults
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check misc plug loads
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPlugLoads)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPlugLoads)
assert_in_delta(2457, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check television
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscTelevision)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscTelevision)
assert_in_delta(894, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check vehicle
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscElectricVehicleCharging)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscElectricVehicleCharging)
assert_in_epsilon(0, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check well pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscWellPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscWellPump)
assert_in_epsilon(0, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolPump)
assert_in_epsilon(0, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolHeater)
assert_equal(0, kwh_yr)
assert_in_epsilon(0, therm_yr, 0.1)
# Check permanent spa pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaPump)
assert_in_epsilon(0, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check permanent spa heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaHeater)
assert_in_epsilon(0, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check grill
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscGrill)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscGrill)
assert_equal(0, kwh_yr)
assert_in_epsilon(0, therm_yr, 0.1)
# Check lighting
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscLighting)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscLighting)
assert_equal(0, kwh_yr)
assert_in_epsilon(0, therm_yr, 0.1)
# Check fireplace
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscFireplace)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscFireplace)
assert_equal(0, kwh_yr)
assert_in_epsilon(0, therm_yr, 0.1)
end
@@ -257,57 +262,57 @@ def test_operational_large_uncommon_loads
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check misc plug loads
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPlugLoads)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPlugLoads)
assert_in_delta(2457, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check television
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscTelevision)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscTelevision)
assert_in_delta(428, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check vehicle
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscElectricVehicleCharging)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscElectricVehicleCharging)
assert_in_epsilon(1667, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check well pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscWellPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscWellPump)
assert_in_epsilon(348, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolPump)
assert_in_epsilon(1970, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolHeater)
assert_equal(0, kwh_yr)
assert_in_epsilon(186, therm_yr, 0.1)
# Check permanent spa pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaPump)
assert_in_epsilon(877, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check permanent spa heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaHeater)
assert_in_epsilon(889, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check grill
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscGrill)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscGrill)
assert_equal(0, kwh_yr)
assert_in_epsilon(25, therm_yr, 0.1)
# Check lighting
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscLighting)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscLighting)
assert_equal(0, kwh_yr)
assert_in_epsilon(16, therm_yr, 0.1)
# Check fireplace
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscFireplace)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscFireplace)
assert_equal(0, kwh_yr)
assert_in_epsilon(55, therm_yr, 0.1)
end
@@ -318,57 +323,57 @@ def test_operational_large_uncommon_loads2
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
# Check misc plug loads
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPlugLoads)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPlugLoads)
assert_in_delta(2457, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check television
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscTelevision)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscTelevision)
assert_in_delta(428, kwh_yr, 1.0)
assert_equal(0, therm_yr)
# Check vehicle
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscElectricVehicleCharging)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscElectricVehicleCharging)
assert_in_epsilon(1667, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check well pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscWellPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscWellPump)
assert_in_epsilon(348, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolPump)
assert_in_epsilon(1970, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check pool heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPoolHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPoolHeater)
assert_equal(0, kwh_yr)
assert_equal(0, therm_yr)
# Check permanent spa pump
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaPump)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaPump)
assert_in_epsilon(877, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check permanent spa heater
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscPermanentSpaHeater)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscPermanentSpaHeater)
assert_in_epsilon(178, kwh_yr, 0.1)
assert_equal(0, therm_yr)
# Check grill
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscGrill)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscGrill)
assert_equal(0, kwh_yr)
assert_in_epsilon(25, therm_yr, 0.1)
# Check lighting
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscLighting)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscLighting)
assert_equal(0, kwh_yr)
assert_in_epsilon(16, therm_yr, 0.1)
# Check fireplace
- kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants.ObjectNameMiscFireplace)
+ kwh_yr, therm_yr = get_kwh_therm_per_year(model, Constants::ObjectTypeMiscFireplace)
assert_equal(0, kwh_yr)
assert_in_epsilon(55, therm_yr, 0.1)
end
diff --git a/HPXMLtoOpenStudio/tests/test_pv.rb b/HPXMLtoOpenStudio/tests/test_pv.rb
index f92f0380dd..55b6ac82d3 100644
--- a/HPXMLtoOpenStudio/tests/test_pv.rb
+++ b/HPXMLtoOpenStudio/tests/test_pv.rb
@@ -8,6 +8,11 @@
require_relative '../resources/util.rb'
class HPXMLtoOpenStudioPVTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
diff --git a/HPXMLtoOpenStudio/tests/test_schedules.rb b/HPXMLtoOpenStudio/tests/test_schedules.rb
index 534c9aad69..6da658419c 100644
--- a/HPXMLtoOpenStudio/tests/test_schedules.rb
+++ b/HPXMLtoOpenStudio/tests/test_schedules.rb
@@ -23,6 +23,8 @@ def setup
def teardown
File.delete(@tmp_hpxml_path) if File.exist? @tmp_hpxml_path
File.delete(@tmp_schedule_file_path) if File.exist? @tmp_schedule_file_path
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
end
def sample_files_dir
@@ -45,7 +47,7 @@ def get_available_hrs_ratio(unavailable_month_hrs, mults = '1, 1, 1, 1, 1, 1, 1,
unavailable_month_hrs.each do |unavailable_month, unavailable_hrs|
total_unavailable_hrs += unavailable_hrs * mults[unavailable_month]
end
- return 1.0 - (total_unavailable_hrs / Constants.NumHoursInYear(@year))
+ return 1.0 - (total_unavailable_hrs / Calendar.num_hours_in_year(@year))
end
def test_default_schedules
@@ -64,18 +66,18 @@ def test_default_schedules
assert_equal(schedule_files, model.getScheduleFiles.size)
assert_equal(model.getSchedules.size, schedule_constants + schedule_rulesets + schedule_fixed_intervals + schedule_files)
- assert_in_epsilon(4451, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameOccupants + ' schedule'), @tol)
- assert_in_epsilon(2764, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingInterior + ' schedule'), @tol)
- assert_in_epsilon(4342, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
- assert_in_epsilon(2724, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameCookingRange + ' schedule'), @tol)
- assert_in_epsilon(3288, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameDishwasher + ' schedule'), @tol)
- assert_in_epsilon(4244, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesWasher + ' schedule'), @tol)
- assert_in_epsilon(4502, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesDryer + ' schedule'), @tol)
- assert_in_epsilon(7157, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscPlugLoads + ' schedule'), @tol)
- assert_in_epsilon(2765, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscTelevision + ' schedule'), @tol)
- assert_in_epsilon(4244, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameFixtures + ' schedule'), @tol)
- assert_in_epsilon(5000, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameGeneralWaterUse + ' schedule'), @tol)
- assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(4451, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeOccupants + ' schedule'), @tol)
+ assert_in_epsilon(2764, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingInterior + ' schedule'), @tol)
+ assert_in_epsilon(4342, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(2724, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeCookingRange + ' schedule'), @tol)
+ assert_in_epsilon(3288, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeDishwasher + ' schedule'), @tol)
+ assert_in_epsilon(4244, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesWasher + ' schedule'), @tol)
+ assert_in_epsilon(4502, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesDryer + ' schedule'), @tol)
+ assert_in_epsilon(7157, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscPlugLoads + ' schedule'), @tol)
+ assert_in_epsilon(2765, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscTelevision + ' schedule'), @tol)
+ assert_in_epsilon(4244, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeFixtures + ' schedule'), @tol)
+ assert_in_epsilon(5000, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeGeneralWaterUse + ' schedule'), @tol)
+ assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
end
def test_simple_schedules
@@ -94,20 +96,20 @@ def test_simple_schedules
assert_equal(schedule_files, model.getScheduleFiles.size)
assert_equal(model.getSchedules.size, schedule_constants + schedule_rulesets + schedule_fixed_intervals + schedule_files)
- assert_in_epsilon(6020, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameOccupants + ' schedule'), @tol)
- assert_in_epsilon(3049, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingInterior + ' schedule'), @tol)
- assert_in_epsilon(2895, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
- assert_in_epsilon(6673, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameRefrigerator + ' schedule'), @tol)
- assert_in_epsilon(2441, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameCookingRange + ' schedule'), @tol)
- assert_in_epsilon(3285, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameDishwasher + ' schedule'), @tol)
- assert_in_epsilon(4248, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesWasher + ' schedule'), @tol)
- assert_in_epsilon(4502, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesDryer + ' schedule'), @tol)
- assert_in_epsilon(6880, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscPlugLoads + ' schedule'), @tol)
- assert_in_epsilon(3373, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscTelevision + ' schedule'), @tol)
- assert_in_epsilon(4204, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameFixtures + ' schedule'), @tol)
- assert_in_epsilon(4244, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameHotWaterRecircPump + ' schedule'), @tol)
- assert_in_epsilon(5000, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameGeneralWaterUse + ' schedule'), @tol)
- assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(6020, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeOccupants + ' schedule'), @tol)
+ assert_in_epsilon(3049, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingInterior + ' schedule'), @tol)
+ assert_in_epsilon(2895, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(6673, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeRefrigerator + ' schedule'), @tol)
+ assert_in_epsilon(2441, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeCookingRange + ' schedule'), @tol)
+ assert_in_epsilon(3285, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeDishwasher + ' schedule'), @tol)
+ assert_in_epsilon(4248, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesWasher + ' schedule'), @tol)
+ assert_in_epsilon(4502, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesDryer + ' schedule'), @tol)
+ assert_in_epsilon(6880, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscPlugLoads + ' schedule'), @tol)
+ assert_in_epsilon(3373, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscTelevision + ' schedule'), @tol)
+ assert_in_epsilon(4204, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeFixtures + ' schedule'), @tol)
+ assert_in_epsilon(4244, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeHotWaterRecircPump + ' schedule'), @tol)
+ assert_in_epsilon(5000, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeGeneralWaterUse + ' schedule'), @tol)
+ assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
end
def test_simple_vacancy_schedules
@@ -117,20 +119,20 @@ def test_simple_vacancy_schedules
unavailable_month_hrs = { 0 => 31.0 * 24.0, 11 => 31.0 * 24.0 }
- assert_in_epsilon(6020 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:Occupants].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameOccupants + ' schedule'), @tol)
- assert_in_epsilon(3049 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingInterior + ' schedule'), @tol)
- assert_in_epsilon(2895 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
- assert_in_epsilon(6673, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameRefrigerator + ' schedule'), @tol)
- assert_in_epsilon(2441 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:CookingRange].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameCookingRange + ' schedule'), @tol)
- assert_in_epsilon(3285 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:Dishwasher].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameDishwasher + ' schedule'), @tol)
- assert_in_epsilon(4248 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:ClothesWasher].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesWasher + ' schedule'), @tol)
- assert_in_epsilon(4502 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:ClothesDryer].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesDryer + ' schedule'), @tol)
- assert_in_epsilon(6880 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:PlugLoadsOther].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscPlugLoads + ' schedule'), @tol)
- assert_in_epsilon(3373 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:PlugLoadsTV].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscTelevision + ' schedule'), @tol)
- assert_in_epsilon(4204 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:HotWaterFixtures].name]['WaterFixturesMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameFixtures + ' schedule'), @tol)
- assert_in_epsilon(4244 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:HotWaterRecirculationPump].name]['RecirculationPumpMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameHotWaterRecircPump + ' schedule'), @tol)
- assert_in_epsilon(5000 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:GeneralWaterUse].name]['GeneralWaterUseMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameGeneralWaterUse + ' schedule'), @tol)
- assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(6020 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:Occupants].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeOccupants + ' schedule'), @tol)
+ assert_in_epsilon(3049 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingInterior + ' schedule'), @tol)
+ assert_in_epsilon(2895 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(6673, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeRefrigerator + ' schedule'), @tol)
+ assert_in_epsilon(2441 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:CookingRange].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeCookingRange + ' schedule'), @tol)
+ assert_in_epsilon(3285 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:Dishwasher].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeDishwasher + ' schedule'), @tol)
+ assert_in_epsilon(4248 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:ClothesWasher].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesWasher + ' schedule'), @tol)
+ assert_in_epsilon(4502 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:ClothesDryer].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesDryer + ' schedule'), @tol)
+ assert_in_epsilon(6880 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:PlugLoadsOther].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscPlugLoads + ' schedule'), @tol)
+ assert_in_epsilon(3373 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:PlugLoadsTV].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscTelevision + ' schedule'), @tol)
+ assert_in_epsilon(4204 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:HotWaterFixtures].name]['WaterFixturesMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeFixtures + ' schedule'), @tol)
+ assert_in_epsilon(4244 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:HotWaterRecirculationPump].name]['RecirculationPumpMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeHotWaterRecircPump + ' schedule'), @tol)
+ assert_in_epsilon(5000 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:GeneralWaterUse].name]['GeneralWaterUseMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeGeneralWaterUse + ' schedule'), @tol)
+ assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
end
def test_simple_vacancy_year_round_schedules
@@ -145,20 +147,20 @@ def test_simple_vacancy_year_round_schedules
args_hash['hpxml_path'] = @tmp_hpxml_path
model, _hpxml, _hpxml_bldg = _test_measure(args_hash)
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameOccupants + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingInterior + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'))
- assert_in_epsilon(6673, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameRefrigerator + ' schedule'), @tol)
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameCookingRange + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameDishwasher + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesWasher + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesDryer + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscPlugLoads + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscTelevision + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameFixtures + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameHotWaterRecircPump + ' schedule'))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameGeneralWaterUse + ' schedule'))
- assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeOccupants + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingInterior + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'))
+ assert_in_epsilon(6673, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeRefrigerator + ' schedule'), @tol)
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeCookingRange + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeDishwasher + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesWasher + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesDryer + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscPlugLoads + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscTelevision + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeFixtures + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeHotWaterRecircPump + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeGeneralWaterUse + ' schedule'))
+ assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
end
def test_simple_power_outage_schedules
@@ -168,20 +170,20 @@ def test_simple_power_outage_schedules
unavailable_month_hrs = { 6 => 31.0 * 24.0 - 15.0 }
- assert_in_epsilon(6020, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameOccupants + ' schedule'), @tol)
- assert_in_epsilon(3049 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingInterior + ' schedule'), @tol)
- assert_in_epsilon(2895 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
- assert_in_epsilon(6673 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:Refrigerator].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameRefrigerator + ' schedule'), @tol)
- assert_in_epsilon(2441 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:CookingRange].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameCookingRange + ' schedule'), @tol)
- assert_in_epsilon(3285 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:Dishwasher].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameDishwasher + ' schedule'), @tol)
- assert_in_epsilon(4248 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:ClothesWasher].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesWasher + ' schedule'), @tol)
- assert_in_epsilon(4502 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:ClothesDryer].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameClothesDryer + ' schedule'), @tol)
- assert_in_epsilon(6880 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:PlugLoadsOther].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscPlugLoads + ' schedule'), @tol)
- assert_in_epsilon(3373 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:PlugLoadsTV].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMiscTelevision + ' schedule'), @tol)
- assert_in_epsilon(4204 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:HotWaterFixtures].name]['WaterFixturesMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameFixtures + ' schedule'), @tol)
- assert_in_epsilon(4244 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:HotWaterRecirculationPump].name]['RecirculationPumpMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameHotWaterRecircPump + ' schedule'), @tol)
- assert_in_epsilon(5000, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameGeneralWaterUse + ' schedule'), @tol)
- assert_in_epsilon(8760 * get_available_hrs_ratio(unavailable_month_hrs), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(6020, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeOccupants + ' schedule'), @tol)
+ assert_in_epsilon(3049 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingInterior + ' schedule'), @tol)
+ assert_in_epsilon(2895 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(6673 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:Refrigerator].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeRefrigerator + ' schedule'), @tol)
+ assert_in_epsilon(2441 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:CookingRange].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeCookingRange + ' schedule'), @tol)
+ assert_in_epsilon(3285 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:Dishwasher].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeDishwasher + ' schedule'), @tol)
+ assert_in_epsilon(4248 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:ClothesWasher].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesWasher + ' schedule'), @tol)
+ assert_in_epsilon(4502 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:ClothesDryer].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeClothesDryer + ' schedule'), @tol)
+ assert_in_epsilon(6880 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:PlugLoadsOther].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscPlugLoads + ' schedule'), @tol)
+ assert_in_epsilon(3373 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:PlugLoadsTV].name]['MonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMiscTelevision + ' schedule'), @tol)
+ assert_in_epsilon(4204 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:HotWaterFixtures].name]['WaterFixturesMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeFixtures + ' schedule'), @tol)
+ assert_in_epsilon(4244 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:HotWaterRecirculationPump].name]['RecirculationPumpMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeHotWaterRecircPump + ' schedule'), @tol)
+ assert_in_epsilon(5000, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeGeneralWaterUse + ' schedule'), @tol)
+ assert_in_epsilon(8760 * get_available_hrs_ratio(unavailable_month_hrs), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
end
def test_stochastic_schedules
@@ -213,7 +215,7 @@ def test_stochastic_schedules
assert(!schedule_file_names.include?(SchedulesFile::Columns[:LightingGarage].name))
assert_in_epsilon(2086, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, schedules: sf.tmp_schedules), @tol)
assert(!schedule_file_names.include?(SchedulesFile::Columns[:LightingExterior].name))
- assert_in_epsilon(4342, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(4342, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
assert(!schedule_file_names.include?(SchedulesFile::Columns[:LightingExteriorHoliday].name))
assert(!schedule_file_names.include?(SchedulesFile::Columns[:Refrigerator].name))
assert(schedule_file_names.include?(SchedulesFile::Columns[:CookingRange].name))
@@ -237,7 +239,7 @@ def test_stochastic_schedules
assert(schedule_file_names.include?(SchedulesFile::Columns[:HotWaterFixtures].name))
assert_in_epsilon(887, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, schedules: sf.tmp_schedules), @tol)
assert(!schedule_file_names.include?(SchedulesFile::Columns[:GeneralWaterUse].name))
- assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
assert(!schedule_file_names.include?(SchedulesFile::Columns[:Sleeping].name))
assert(!schedule_file_names.include?('Vacancy'))
assert(!schedule_file_names.include?('Power Outage'))
@@ -267,7 +269,7 @@ def test_stochastic_vacancy_schedules
assert_in_epsilon(6689 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Occupants].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Occupants].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2086 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2086 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, schedules: sf.tmp_schedules), @tol)
- assert_in_epsilon(4342 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(4342 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
assert_in_epsilon(534 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(213 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(134 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, schedules: sf.tmp_schedules), @tol)
@@ -278,7 +280,7 @@ def test_stochastic_vacancy_schedules
assert_in_epsilon(273 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(346 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(887 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, schedules: sf.tmp_schedules), @tol)
- assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
assert(!sf.schedules.keys.include?(SchedulesFile::Columns[:Sleeping].name))
assert_in_epsilon(unavailable_month_hrs.values.sum, sf.annual_equivalent_full_load_hrs(col_name: column_name, schedules: sf.tmp_schedules), 0.001)
end
@@ -325,7 +327,7 @@ def test_stochastic_vacancy_schedules2
assert_in_epsilon(6689 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Occupants].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Occupants].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2086 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2086 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, schedules: sf.tmp_schedules), @tol)
- assert_in_epsilon(4342 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(4342 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
assert_in_epsilon(534 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(213 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(134 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, schedules: sf.tmp_schedules), @tol)
@@ -336,7 +338,7 @@ def test_stochastic_vacancy_schedules2
assert_in_epsilon(273 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(346 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(887 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, schedules: sf.tmp_schedules), @tol)
- assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
assert(!sf.schedules.keys.include?(SchedulesFile::Columns[:Sleeping].name))
assert_in_epsilon(unavailable_month_hrs.values.sum, sf.annual_equivalent_full_load_hrs(col_name: column_name, schedules: sf.tmp_schedules), 0.001)
end
@@ -369,7 +371,7 @@ def test_stochastic_vacancy_year_round_schedules
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Occupants].name, schedules: sf.tmp_schedules))
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, schedules: sf.tmp_schedules))
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, schedules: sf.tmp_schedules))
- assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'))
+ assert_equal(0, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'))
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, schedules: sf.tmp_schedules))
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, schedules: sf.tmp_schedules))
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, schedules: sf.tmp_schedules))
@@ -380,9 +382,9 @@ def test_stochastic_vacancy_year_round_schedules
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, schedules: sf.tmp_schedules))
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, schedules: sf.tmp_schedules))
assert_equal(0, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, schedules: sf.tmp_schedules))
- assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(8760, get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
assert(!sf.schedules.keys.include?(SchedulesFile::Columns[:Sleeping].name))
- assert_in_epsilon(Constants.NumHoursInYear(@year), sf.annual_equivalent_full_load_hrs(col_name: column_name, schedules: sf.tmp_schedules), @tol)
+ assert_in_epsilon(Calendar.num_hours_in_year(@year), sf.annual_equivalent_full_load_hrs(col_name: column_name, schedules: sf.tmp_schedules), @tol)
end
def test_stochastic_power_outage_schedules
@@ -409,7 +411,7 @@ def test_stochastic_power_outage_schedules
assert_in_epsilon(6689, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Occupants].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2086 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2086 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, schedules: sf.tmp_schedules), @tol)
- assert_in_epsilon(4342 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(4342 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
assert_in_epsilon(534 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(213 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(134 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, schedules: sf.tmp_schedules), @tol)
@@ -420,7 +422,7 @@ def test_stochastic_power_outage_schedules
assert_in_epsilon(273 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(346 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(887 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, schedules: sf.tmp_schedules), @tol)
- assert_in_epsilon(8760 * get_available_hrs_ratio(unavailable_month_hrs), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(8760 * get_available_hrs_ratio(unavailable_month_hrs), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
assert(!sf.schedules.keys.include?(SchedulesFile::Columns[:Sleeping].name))
assert_in_epsilon(unavailable_month_hrs.values.sum, sf.annual_equivalent_full_load_hrs(col_name: column_name, schedules: sf.tmp_schedules), 0.001)
end
@@ -469,7 +471,7 @@ def test_stochastic_power_outage_schedules2
assert_in_epsilon(6689, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Occupants].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2086 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingInterior].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(2086 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:LightingGarage].name, schedules: sf.tmp_schedules), @tol)
- assert_in_epsilon(4342 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameLightingExterior + ' schedule'), @tol)
+ assert_in_epsilon(4342 * get_available_hrs_ratio(unavailable_month_hrs, @default_schedules_csv_data[SchedulesFile::Columns[:LightingInterior].name]['InteriorMonthlyScheduleMultipliers']), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeLightingExterior + ' schedule'), @tol)
assert_in_epsilon(534 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:CookingRange].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(213 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:Dishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(134 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:ClothesWasher].name, schedules: sf.tmp_schedules), @tol)
@@ -480,7 +482,7 @@ def test_stochastic_power_outage_schedules2
assert_in_epsilon(273 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterDishwasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(346 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterClothesWasher].name, schedules: sf.tmp_schedules), @tol)
assert_in_epsilon(887 - sf.period_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, period: unavailable_period), sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::Columns[:HotWaterFixtures].name, schedules: sf.tmp_schedules), @tol)
- assert_in_epsilon(8760 * get_available_hrs_ratio(unavailable_month_hrs), get_annual_equivalent_full_load_hrs(model, Constants.ObjectNameMechanicalVentilationHouseFan + ' schedule'), @tol)
+ assert_in_epsilon(8760 * get_available_hrs_ratio(unavailable_month_hrs), get_annual_equivalent_full_load_hrs(model, Constants::ObjectTypeMechanicalVentilationHouseFan + ' schedule'), @tol)
assert(!sf.schedules.keys.include?(SchedulesFile::Columns[:Sleeping].name))
assert_in_epsilon(unavailable_month_hrs.values.sum, sf.annual_equivalent_full_load_hrs(col_name: column_name, schedules: sf.tmp_schedules), 0.001)
end
@@ -496,7 +498,7 @@ def test_set_unavailable_periods_lighting
end_day = 31
end_hour = 24
- sch_name = Constants.ObjectNameLightingInterior + ' schedule'
+ sch_name = Constants::ObjectTypeLightingInterior + ' schedule'
# hours not specified
model, hpxml, _hpxml_bldg = _test_measure(args_hash)
@@ -615,7 +617,7 @@ def test_set_unavailable_periods_natvent
end_hour = 24
natvent_availability = HPXML::ScheduleRegular
- sch_name = "#{Constants.ObjectNameNaturalVentilation} schedule"
+ sch_name = "#{Constants::ObjectTypeNaturalVentilation} schedule"
model, hpxml, _hpxml_bldg = _test_measure(args_hash)
year = model.getYearDescription.assumedYear
@@ -680,7 +682,7 @@ def test_set_unavailable_periods_leap_year
end_day = 30
end_hour = 24
- sch_name = Constants.ObjectNameLightingInterior + ' schedule'
+ sch_name = Constants::ObjectTypeLightingInterior + ' schedule'
model, hpxml, _hpxml_bldg = _test_measure(args_hash)
year = model.getYearDescription.assumedYear
diff --git a/HPXMLtoOpenStudio/tests/test_simcontrols.rb b/HPXMLtoOpenStudio/tests/test_simcontrols.rb
index eeb324bc0a..7713b171a4 100644
--- a/HPXMLtoOpenStudio/tests/test_simcontrols.rb
+++ b/HPXMLtoOpenStudio/tests/test_simcontrols.rb
@@ -8,6 +8,11 @@
require_relative '../resources/util.rb'
class HPXMLtoOpenStudioSimControlsTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
diff --git a/HPXMLtoOpenStudio/tests/test_validation.rb b/HPXMLtoOpenStudio/tests/test_validation.rb
index c76d9ef15a..e27364940f 100644
--- a/HPXMLtoOpenStudio/tests/test_validation.rb
+++ b/HPXMLtoOpenStudio/tests/test_validation.rb
@@ -30,6 +30,8 @@ def teardown
File.delete(@tmp_hpxml_path) if File.exist? @tmp_hpxml_path
File.delete(@tmp_csv_path) if File.exist? @tmp_csv_path
FileUtils.rm_rf(@tmp_output_path)
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
end
def test_validation_of_schematron_doc
diff --git a/HPXMLtoOpenStudio/tests/test_water_heater.rb b/HPXMLtoOpenStudio/tests/test_water_heater.rb
index 3fd2b0a55c..4c458ab66f 100644
--- a/HPXMLtoOpenStudio/tests/test_water_heater.rb
+++ b/HPXMLtoOpenStudio/tests/test_water_heater.rb
@@ -7,6 +7,11 @@
require_relative '../measure.rb'
class HPXMLtoOpenStudioWaterHeaterTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def sample_files_dir
return File.join(File.dirname(__FILE__), '..', '..', 'workflow', 'sample_files')
end
@@ -531,7 +536,7 @@ def test_solar_direct_evacuated_tube
next if plant_loop.demandComponents.select { |comp| comp == preheat_tank }.empty?
collector_attached_to_tank = true
- assert_equal(plant_loop.fluidType, 'Water')
+ assert_equal(plant_loop.fluidType, EPlus::FluidWater)
loop = plant_loop
end
pump = loop.supplyComponents.find { |comp| comp.to_PumpConstantSpeed.is_initialized }
@@ -604,7 +609,7 @@ def test_solar_direct_flat_plate
next if plant_loop.demandComponents.select { |comp| comp == preheat_tank }.empty?
collector_attached_to_tank = true
- assert_equal(plant_loop.fluidType, 'Water')
+ assert_equal(plant_loop.fluidType, EPlus::FluidWater)
loop = plant_loop
end
pump = loop.supplyComponents.find { |comp| comp.to_PumpConstantSpeed.is_initialized }
@@ -677,7 +682,7 @@ def test_solar_indirect_flat_plate
next if plant_loop.demandComponents.select { |comp| comp == preheat_tank }.empty?
collector_attached_to_tank = true
- assert_equal(plant_loop.fluidType, 'PropyleneGlycol')
+ assert_equal(plant_loop.fluidType, EPlus::FluidPropyleneGlycol)
loop = plant_loop
end
pump = loop.supplyComponents.find { |comp| comp.to_PumpConstantSpeed.is_initialized }
@@ -750,7 +755,7 @@ def test_solar_thermosyphon_flat_plate
next if plant_loop.demandComponents.select { |comp| comp == preheat_tank }.empty?
collector_attached_to_tank = true
- assert_equal(plant_loop.fluidType, 'Water')
+ assert_equal(plant_loop.fluidType, EPlus::FluidWater)
loop = plant_loop
end
pump = loop.supplyComponents.find { |comp| comp.to_PumpConstantSpeed.is_initialized }
@@ -818,7 +823,7 @@ def test_solar_direct_ics
next if plant_loop.demandComponents.select { |comp| comp == preheat_tank }.empty?
collector_attached_to_tank = true
- assert_equal(plant_loop.fluidType, 'Water')
+ assert_equal(plant_loop.fluidType, EPlus::FluidWater)
loop = plant_loop
end
pump = loop.supplyComponents.find { |comp| comp.to_PumpConstantSpeed.is_initialized }
diff --git a/HPXMLtoOpenStudio/tests/test_weather.rb b/HPXMLtoOpenStudio/tests/test_weather.rb
index 7c184db05a..842c0fc659 100644
--- a/HPXMLtoOpenStudio/tests/test_weather.rb
+++ b/HPXMLtoOpenStudio/tests/test_weather.rb
@@ -13,6 +13,11 @@
require_relative '../resources/location.rb'
class HPXMLtoOpenStudioWeatherTest < Minitest::Test
+ def teardown
+ File.delete(File.join(File.dirname(__FILE__), 'results_annual.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_annual.csv')
+ File.delete(File.join(File.dirname(__FILE__), 'results_design_load_details.csv')) if File.exist? File.join(File.dirname(__FILE__), 'results_design_load_details.csv')
+ end
+
def weather_dir
return File.join(File.dirname(__FILE__), '..', '..', 'weather')
end
diff --git a/ReportSimulationOutput/measure.rb b/ReportSimulationOutput/measure.rb
index aface8423c..91018688b9 100644
--- a/ReportSimulationOutput/measure.rb
+++ b/ReportSimulationOutput/measure.rb
@@ -352,10 +352,10 @@ def energyPlusOutputRequests(runner, user_arguments)
return result
end
- unmet_hours_program = @model.getEnergyManagementSystemPrograms.find { |p| p.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameUnmetHoursProgram }
- total_loads_program = @model.getEnergyManagementSystemPrograms.find { |p| p.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameTotalLoadsProgram }
- comp_loads_program = @model.getEnergyManagementSystemPrograms.find { |p| p.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameComponentLoadsProgram }
- total_airflows_program = @model.getEnergyManagementSystemPrograms.find { |p| p.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants.ObjectNameTotalAirflowsProgram }
+ unmet_hours_program = @model.getEnergyManagementSystemPrograms.find { |p| p.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeUnmetHoursProgram }
+ total_loads_program = @model.getEnergyManagementSystemPrograms.find { |p| p.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeTotalLoadsProgram }
+ comp_loads_program = @model.getEnergyManagementSystemPrograms.find { |p| p.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeComponentLoadsProgram }
+ total_airflows_program = @model.getEnergyManagementSystemPrograms.find { |p| p.additionalProperties.getFeatureAsString('ObjectType').to_s == Constants::ObjectTypeTotalAirflowsProgram }
heated_zones = eval(@model.getBuilding.additionalProperties.getFeatureAsString('heated_zones').get)
cooled_zones = eval(@model.getBuilding.additionalProperties.getFeatureAsString('cooled_zones').get)
@@ -664,7 +664,7 @@ def get_timestamps(msgpackData, hpxml_header, hpxml_bldgs, args)
elsif args[:timeseries_frequency] == 'daily'
ts_offset = 60 * 60 * 24 # seconds
elsif args[:timeseries_frequency] == 'monthly'
- ts_offset = Constants.NumDaysInMonths(year)[month - 1] * 60 * 60 * 24 # seconds
+ ts_offset = Calendar.num_days_in_months(year)[month - 1] * 60 * 60 * 24 # seconds
else
fail "Unexpected timeseries_frequency: #{args[:timeseries_frequency]}."
end
@@ -704,7 +704,7 @@ def get_n_hours_per_period(timeseries_frequency, sim_start_day, sim_end_day, yea
if timeseries_frequency == 'daily'
n_hours_per_period = [24] * (sim_end_day - sim_start_day + 1)
elsif timeseries_frequency == 'monthly'
- n_days_per_month = Constants.NumDaysInMonths(year)
+ n_days_per_month = Calendar.num_days_in_months(year)
n_days_per_period = n_days_per_month[@hpxml_header.sim_begin_month - 1..@hpxml_header.sim_end_month - 1]
n_days_per_period[0] -= @hpxml_header.sim_begin_day - 1
n_days_per_period[-1] = @hpxml_header.sim_end_day
@@ -1364,8 +1364,8 @@ def sanitize_name(name)
# @param year [Integer] the calendar year
# @return [TODO] TODO
def get_sim_times_of_year(year)
- sim_start_day = Schedule.get_day_num_from_month_day(year, @hpxml_header.sim_begin_month, @hpxml_header.sim_begin_day)
- sim_end_day = Schedule.get_day_num_from_month_day(year, @hpxml_header.sim_end_month, @hpxml_header.sim_end_day)
+ sim_start_day = Calendar.get_day_num_from_month_day(year, @hpxml_header.sim_begin_month, @hpxml_header.sim_begin_day)
+ sim_end_day = Calendar.get_day_num_from_month_day(year, @hpxml_header.sim_end_month, @hpxml_header.sim_end_day)
sim_start_hour = (sim_start_day - 1) * 24
sim_end_hour = sim_end_day * 24 - 1
return sim_start_day, sim_end_day, sim_start_hour, sim_end_hour
@@ -1479,8 +1479,8 @@ def report_runperiod_output_results(runner, outputs, args, annual_output_path)
else
# Note: Make sure to round outputs with sufficient resolution for the worst case -- i.e., 1 day instead of a full year.
n_digits = 3 # Default for annual (or near-annual) data
- sim_n_days = (Schedule.get_day_num_from_month_day(2000, @hpxml_header.sim_end_month, @hpxml_header.sim_end_day) -
- Schedule.get_day_num_from_month_day(2000, @hpxml_header.sim_begin_month, @hpxml_header.sim_begin_day))
+ sim_n_days = (Calendar.get_day_num_from_month_day(2000, @hpxml_header.sim_end_month, @hpxml_header.sim_end_day) -
+ Calendar.get_day_num_from_month_day(2000, @hpxml_header.sim_begin_month, @hpxml_header.sim_begin_day))
if sim_n_days <= 10 # 10 days or less; add two decimal places
n_digits += 2
elsif sim_n_days <= 100 # 100 days or less; add one decimal place
@@ -1834,7 +1834,7 @@ def report_timeseries_output_results(runner, outputs, timeseries_output_path, ar
# Add header per DataFileTemplate.pdf; see https://github.com/NREL/wex/wiki/DView
year = @hpxml_header.sim_calendar_year
- start_day = Schedule.get_day_num_from_month_day(year, @hpxml_header.sim_begin_month, @hpxml_header.sim_begin_day)
+ start_day = Calendar.get_day_num_from_month_day(year, @hpxml_header.sim_begin_month, @hpxml_header.sim_begin_day)
start_hr = (start_day - 1) * 24
if args[:timeseries_frequency] == 'timestep'
interval_hrs = @hpxml_header.timestep / 60.0
@@ -1843,7 +1843,7 @@ def report_timeseries_output_results(runner, outputs, timeseries_output_path, ar
elsif args[:timeseries_frequency] == 'daily'
interval_hrs = 24.0
elsif args[:timeseries_frequency] == 'monthly'
- interval_hrs = Constants.NumDaysInYear(year) * 24.0 / 12
+ interval_hrs = Calendar.num_days_in_year(year) * 24.0 / 12
end
header_data = [['wxDVFileHeaderVer.1'],
data[0].map { |d| d.sub(':', '|') }, # Series name (series can be organized into groups by entering Group Name|Series Name)
@@ -2020,7 +2020,7 @@ def get_report_meter_data_timeseries(meter_names, unit_conv, unit_adder, timeser
rows.each_with_index do |row, row_idx|
row = row[row.keys[0]]
indexes.each_with_index do |i, idx|
- if meter_names[idx].include?(Constants.ObjectNameWaterHeaterAdjustment) && apply_ems_shift(timeseries_frequency)
+ if meter_names[idx].include?(Constants::ObjectTypeWaterHeaterAdjustment) && apply_ems_shift(timeseries_frequency)
# Shift energy use adjustment to allow with hot water energy use
vals[row_idx - 1] += row[i] * unit_conv + unit_adder
else
@@ -2913,12 +2913,12 @@ def get_object_outputs_by_key(model, object, class_name)
return { [FT::Elec, EUT::HotWater] => ["Cooling Coil Water Heating #{EPlus::FuelTypeElectricity} Energy"] }
elsif object.to_FanSystemModel.is_initialized
- if object_type == Constants.ObjectNameWaterHeater
+ if object_type == Constants::ObjectTypeWaterHeater
return { [FT::Elec, EUT::HotWater] => ["Fan #{EPlus::FuelTypeElectricity} Energy"] }
end
elsif object.to_PumpConstantSpeed.is_initialized
- if object_type == Constants.ObjectNameSolarHotWater
+ if object_type == Constants::ObjectTypeSolarHotWater
return { [FT::Elec, EUT::HotWaterSolarThermalPump] => ["Pump #{EPlus::FuelTypeElectricity} Energy"] }
end
@@ -2936,8 +2936,8 @@ def get_object_outputs_by_key(model, object, class_name)
elsif object.to_Lights.is_initialized
subcategory = object.to_Lights.get.endUseSubcategory
- end_use = { Constants.ObjectNameLightingInterior => EUT::LightsInterior,
- Constants.ObjectNameLightingGarage => EUT::LightsGarage }[subcategory]
+ end_use = { Constants::ObjectTypeLightingInterior => EUT::LightsInterior,
+ Constants::ObjectTypeLightingGarage => EUT::LightsGarage }[subcategory]
return { [FT::Elec, end_use] => ["#{subcategory}:InteriorLights:#{EPlus::FuelTypeElectricity}"] }
elsif object.to_ElectricLoadCenterInverterPVWatts.is_initialized
@@ -2958,25 +2958,25 @@ def get_object_outputs_by_key(model, object, class_name)
object = object.to_ElectricEquipment.get
subcategory = object.endUseSubcategory
end_use = nil
- { Constants.ObjectNameHotWaterRecircPump => EUT::HotWaterRecircPump,
- Constants.ObjectNameGSHPSharedPump => 'TempGSHPSharedPump',
- Constants.ObjectNameClothesWasher => EUT::ClothesWasher,
- Constants.ObjectNameClothesDryer => EUT::ClothesDryer,
- Constants.ObjectNameDishwasher => EUT::Dishwasher,
- Constants.ObjectNameRefrigerator => EUT::Refrigerator,
- Constants.ObjectNameFreezer => EUT::Freezer,
- Constants.ObjectNameCookingRange => EUT::RangeOven,
- Constants.ObjectNameCeilingFan => EUT::CeilingFan,
- Constants.ObjectNameWholeHouseFan => EUT::WholeHouseFan,
- Constants.ObjectNameMechanicalVentilation => EUT::MechVent,
- Constants.ObjectNameMiscPlugLoads => EUT::PlugLoads,
- Constants.ObjectNameMiscTelevision => EUT::Television,
- Constants.ObjectNameMiscPoolHeater => EUT::PoolHeater,
- Constants.ObjectNameMiscPoolPump => EUT::PoolPump,
- Constants.ObjectNameMiscPermanentSpaHeater => EUT::PermanentSpaHeater,
- Constants.ObjectNameMiscPermanentSpaPump => EUT::PermanentSpaPump,
- Constants.ObjectNameMiscElectricVehicleCharging => EUT::Vehicle,
- Constants.ObjectNameMiscWellPump => EUT::WellPump }.each do |obj_name, eut|
+ { Constants::ObjectTypeHotWaterRecircPump => EUT::HotWaterRecircPump,
+ Constants::ObjectTypeGSHPSharedPump => 'TempGSHPSharedPump',
+ Constants::ObjectTypeClothesWasher => EUT::ClothesWasher,
+ Constants::ObjectTypeClothesDryer => EUT::ClothesDryer,
+ Constants::ObjectTypeDishwasher => EUT::Dishwasher,
+ Constants::ObjectTypeRefrigerator => EUT::Refrigerator,
+ Constants::ObjectTypeFreezer => EUT::Freezer,
+ Constants::ObjectTypeCookingRange => EUT::RangeOven,
+ Constants::ObjectTypeCeilingFan => EUT::CeilingFan,
+ Constants::ObjectTypeWholeHouseFan => EUT::WholeHouseFan,
+ Constants::ObjectTypeMechanicalVentilation => EUT::MechVent,
+ Constants::ObjectTypeMiscPlugLoads => EUT::PlugLoads,
+ Constants::ObjectTypeMiscTelevision => EUT::Television,
+ Constants::ObjectTypeMiscPoolHeater => EUT::PoolHeater,
+ Constants::ObjectTypeMiscPoolPump => EUT::PoolPump,
+ Constants::ObjectTypeMiscPermanentSpaHeater => EUT::PermanentSpaHeater,
+ Constants::ObjectTypeMiscPermanentSpaPump => EUT::PermanentSpaPump,
+ Constants::ObjectTypeMiscElectricVehicleCharging => EUT::Vehicle,
+ Constants::ObjectTypeMiscWellPump => EUT::WellPump }.each do |obj_name, eut|
next unless subcategory.start_with? obj_name
fail 'Unepected error: multiple matches.' unless end_use.nil?
@@ -2998,18 +2998,18 @@ def get_object_outputs_by_key(model, object, class_name)
subcategory = object.endUseSubcategory
fuel = object.fuelType
end_use = nil
- { Constants.ObjectNameClothesDryer => EUT::ClothesDryer,
- Constants.ObjectNameCookingRange => EUT::RangeOven,
- Constants.ObjectNameMiscGrill => EUT::Grill,
- Constants.ObjectNameMiscLighting => EUT::Lighting,
- Constants.ObjectNameMiscFireplace => EUT::Fireplace,
- Constants.ObjectNameMiscPoolHeater => EUT::PoolHeater,
- Constants.ObjectNameMiscPermanentSpaHeater => EUT::PermanentSpaHeater,
- Constants.ObjectNameMechanicalVentilationPreheating => EUT::MechVentPreheat,
- Constants.ObjectNameMechanicalVentilationPrecooling => EUT::MechVentPrecool,
- Constants.ObjectNameBackupSuppHeat => EUT::HeatingHeatPumpBackup,
- Constants.ObjectNameWaterHeaterAdjustment => EUT::HotWater,
- Constants.ObjectNameBatteryLossesAdjustment => EUT::Battery }.each do |obj_name, eut|
+ { Constants::ObjectTypeClothesDryer => EUT::ClothesDryer,
+ Constants::ObjectTypeCookingRange => EUT::RangeOven,
+ Constants::ObjectTypeMiscGrill => EUT::Grill,
+ Constants::ObjectTypeMiscLighting => EUT::Lighting,
+ Constants::ObjectTypeMiscFireplace => EUT::Fireplace,
+ Constants::ObjectTypeMiscPoolHeater => EUT::PoolHeater,
+ Constants::ObjectTypeMiscPermanentSpaHeater => EUT::PermanentSpaHeater,
+ Constants::ObjectTypeMechanicalVentilationPreheating => EUT::MechVentPreheat,
+ Constants::ObjectTypeMechanicalVentilationPrecooling => EUT::MechVentPrecool,
+ Constants::ObjectTypeBackupSuppHeat => EUT::HeatingHeatPumpBackup,
+ Constants::ObjectTypeWaterHeaterAdjustment => EUT::HotWater,
+ Constants::ObjectTypeBatteryLossesAdjustment => EUT::Battery }.each do |obj_name, eut|
next unless subcategory.start_with? obj_name
fail 'Unepected error: multiple matches.' unless end_use.nil?
@@ -3030,11 +3030,11 @@ def get_object_outputs_by_key(model, object, class_name)
return { [FT::Elec, EUT::Dehumidifier] => ["Zone Dehumidifier #{EPlus::FuelTypeElectricity} Energy"] }
elsif object.to_EnergyManagementSystemOutputVariable.is_initialized
- if object_type == Constants.ObjectNameFanPumpDisaggregatePrimaryHeat
+ if object_type == Constants::ObjectTypeFanPumpDisaggregatePrimaryHeat
return { [FT::Elec, EUT::HeatingFanPump] => [object.name.to_s] }
- elsif object_type == Constants.ObjectNameFanPumpDisaggregateBackupHeat
+ elsif object_type == Constants::ObjectTypeFanPumpDisaggregateBackupHeat
return { [FT::Elec, EUT::HeatingHeatPumpBackupFanPump] => [object.name.to_s] }
- elsif object_type == Constants.ObjectNameFanPumpDisaggregateCool
+ elsif object_type == Constants::ObjectTypeFanPumpDisaggregateCool
return { [FT::Elec, EUT::CoolingFanPump] => [object.name.to_s] }
else
return { ems: [object.name.to_s] }
@@ -3047,10 +3047,10 @@ def get_object_outputs_by_key(model, object, class_name)
# Hot Water Use
if object.to_WaterUseEquipment.is_initialized
- hot_water_use = { Constants.ObjectNameFixtures => HWT::Fixtures,
- Constants.ObjectNameDistributionWaste => HWT::DistributionWaste,
- Constants.ObjectNameClothesWasher => HWT::ClothesWasher,
- Constants.ObjectNameDishwasher => HWT::Dishwasher }[object.to_WaterUseEquipment.get.waterUseEquipmentDefinition.endUseSubcategory]
+ hot_water_use = { Constants::ObjectTypeFixtures => HWT::Fixtures,
+ Constants::ObjectTypeDistributionWaste => HWT::DistributionWaste,
+ Constants::ObjectTypeClothesWasher => HWT::ClothesWasher,
+ Constants::ObjectTypeDishwasher => HWT::Dishwasher }[object.to_WaterUseEquipment.get.waterUseEquipmentDefinition.endUseSubcategory]
return { hot_water_use => ['Water Use Equipment Hot Water Volume'] }
end
@@ -3069,7 +3069,7 @@ def get_object_outputs_by_key(model, object, class_name)
if object.additionalProperties.getFeatureAsBoolean('IsCombiBoiler').is_initialized
is_combi_boiler = object.additionalProperties.getFeatureAsBoolean('IsCombiBoiler').get
end
- if capacity == 0 && object_type == Constants.ObjectNameSolarHotWater
+ if capacity == 0 && object_type == Constants::ObjectTypeSolarHotWater
return { LT::HotWaterSolarThermal => ['Water Heater Use Side Heat Transfer Energy'] }
elsif capacity > 0 || is_combi_boiler # Active water heater only (e.g., exclude desuperheater and solar thermal storage tanks)
return { LT::HotWaterTankLosses => ['Water Heater Heat Loss Energy'] }
@@ -3092,7 +3092,7 @@ def get_object_outputs_by_key(model, object, class_name)
end
elsif object.to_EnergyManagementSystemOutputVariable.is_initialized
- if object_type == Constants.ObjectNameFanPumpDisaggregateBackupHeat
+ if object_type == Constants::ObjectTypeFanPumpDisaggregateBackupHeat
# Fan/pump energy is contributing to the load
return { LT::HeatingHeatPumpBackup => [object.name.to_s] }
end
@@ -3107,7 +3107,7 @@ def get_object_outputs_by_key(model, object, class_name)
return { RT::Battery => ['Electric Storage Charge Fraction'] }
elsif object.to_OtherEquipment.is_initialized
- if object_type == Constants.ObjectNameBatteryLossesAdjustment
+ if object_type == Constants::ObjectTypeBatteryLossesAdjustment
return { RT::Battery => ["Other Equipment #{EPlus::FuelTypeElectricity} Energy"] }
end
diff --git a/ReportSimulationOutput/measure.xml b/ReportSimulationOutput/measure.xml
index 5b39ff2ab6..5b595ae85c 100644
--- a/ReportSimulationOutput/measure.xml
+++ b/ReportSimulationOutput/measure.xml
@@ -3,8 +3,8 @@
3.1
report_simulation_output
df9d170c-c21a-4130-866d-0d46b06073fd
- fa85f147-26c5-4dd8-ae35-9778ba677702
- 2024-08-07T22:28:18Z
+ 22b3e453-eba9-432d-8e44-e0afdb46bb9e
+ 2024-08-21T16:00:15Z
9BF1E6AC
ReportSimulationOutput
HPXML Simulation Output Report
@@ -1929,13 +1929,13 @@
measure.rb
rb
script
- 34E702E6
+ C4D35B1C
test_report_sim_output.rb
rb
test
- E54EAD68
+ ACF6CED9
diff --git a/ReportSimulationOutput/tests/test_report_sim_output.rb b/ReportSimulationOutput/tests/test_report_sim_output.rb
index aef9e66904..e7fcf7a4cc 100644
--- a/ReportSimulationOutput/tests/test_report_sim_output.rb
+++ b/ReportSimulationOutput/tests/test_report_sim_output.rb
@@ -1249,7 +1249,7 @@ def test_timeseries_hourly_AMY_2012
def test_timeseries_timestamp_convention
# Expected values are arrays of time offsets (in seconds) for each reported row of output
expected_values_array = { 'timestep' => [30 * 60] * 17520,
- 'monthly' => Constants.NumDaysInMonths(1999).map { |n_days| n_days * 60 * 60 * 24 } }
+ 'monthly' => Calendar.num_days_in_months(1999).map { |n_days| n_days * 60 * 60 * 24 } }
expected_values_array.each do |timeseries_frequency, expected_values|
args_hash = { 'hpxml_path' => File.join(File.dirname(__FILE__), '../../workflow/sample_files/base-simcontrol-timestep-30-mins.xml'),
diff --git a/ReportUtilityBills/measure.rb b/ReportUtilityBills/measure.rb
index 27c097058b..c564a418a6 100644
--- a/ReportUtilityBills/measure.rb
+++ b/ReportUtilityBills/measure.rb
@@ -390,7 +390,7 @@ def get_timestamps(args)
# Convert from EnergyPlus default (end-of-timestep) to start-of-timestep convention
if args[:monthly_timestamp_convention] == 'start'
- ts_offset = Constants.NumDaysInMonths(year)[month - 1] * 60 * 60 * 24 # seconds
+ ts_offset = Calendar.num_days_in_months(year)[month - 1] * 60 * 60 * 24 # seconds
end
ts = Time.utc(year, month, day, hour, minute)
diff --git a/ReportUtilityBills/measure.xml b/ReportUtilityBills/measure.xml
index 84887d89e2..e69593d447 100644
--- a/ReportUtilityBills/measure.xml
+++ b/ReportUtilityBills/measure.xml
@@ -3,8 +3,8 @@
3.1
report_utility_bills
ca88a425-e59a-4bc4-af51-c7e7d1e960fe
- 35f974c2-6d84-4428-8f81-f5c19a32ff4e
- 2024-08-21T18:55:50Z
+ 3ff55cf2-a36f-498e-ad02-6e405913caa1
+ 2024-08-21T20:29:04Z
15BF4E57
ReportUtilityBills
Utility Bills Report
@@ -180,7 +180,7 @@
measure.rb
rb
script
- F37C6B2F
+ 93B04330
detailed_rates/Sample Flat Rate Min Annual Charge.json
@@ -306,7 +306,7 @@
util.rb
rb
resource
- A6C75E8E
+ 86D22906
Contains Demand Charges.json
@@ -348,7 +348,7 @@
test_report_utility_bills.rb
rb
test
- B05DF20C
+ 83A62469
diff --git a/ReportUtilityBills/resources/util.rb b/ReportUtilityBills/resources/util.rb
index 3c0ced113f..cf6eb3e2df 100644
--- a/ReportUtilityBills/resources/util.rb
+++ b/ReportUtilityBills/resources/util.rb
@@ -310,7 +310,7 @@ def self.detailed_electric(header, fuels, rate, bill)
next unless hour_day == 23 # last hour of the day
- if Schedule.day_end_months(year).include?(today.yday)
+ if Calendar.day_end_months(year).include?(today.yday)
if not rate.fixedmonthlycharge.nil?
# If the run period doesn't span the entire month, prorate the fixed charges
prorate_fraction = calculate_monthly_prorate(header, month + 1)
@@ -483,12 +483,12 @@ def self.calculate_monthly_prorate(header, month)
if month == end_month
day_end = end_day
else
- day_end = Constants.NumDaysInMonths(year)[month - 1]
+ day_end = Calendar.num_days_in_months(year)[month - 1]
end
num_days_in_month = day_end - day_begin + 1
end
- return num_days_in_month.to_f / Constants.NumDaysInMonths(year)[month - 1]
+ return num_days_in_month.to_f / Calendar.num_days_in_months(year)[month - 1]
end
end
diff --git a/ReportUtilityBills/tests/test_report_utility_bills.rb b/ReportUtilityBills/tests/test_report_utility_bills.rb
index 76033b4cd6..a494c6e45e 100644
--- a/ReportUtilityBills/tests/test_report_utility_bills.rb
+++ b/ReportUtilityBills/tests/test_report_utility_bills.rb
@@ -285,7 +285,7 @@ def test_auto_marginal_rate
fuel_types = [HPXML::FuelTypeElectricity, HPXML::FuelTypeNaturalGas, HPXML::FuelTypeOil, HPXML::FuelTypeCoal, HPXML::FuelTypePropane, HPXML::FuelTypeWoodCord, HPXML::FuelTypeWoodPellets]
# Check that we can successfully look up "auto" rates for every state and every fuel type.
- Constants.StateCodesMap.keys.each do |state_code|
+ Constants::StateCodesMap.keys.each do |state_code|
fuel_types.each do |fuel_type|
flatratebuy, average_rate = UtilityBills.get_rates_from_eia_data(nil, state_code, fuel_type, 1) # fixed_charge > 0 ensures marginal_rate != average_rate
refute_nil(flatratebuy)
@@ -319,7 +319,7 @@ def test_specified_marginal_rate
marginal_rate = 0.1
# Check that we can successfully provide rates for every state and every fuel type.
- Constants.StateCodesMap.keys.each do |state_code|
+ Constants::StateCodesMap.keys.each do |state_code|
fuel_types.each do |fuel_type|
flatratebuy, average_rate = UtilityBills.get_rates_from_eia_data(nil, state_code, fuel_type, 1, marginal_rate) # fixed_charge > 0 ensures marginal_rate != average_rate
assert_equal(flatratebuy, marginal_rate)
@@ -1183,7 +1183,7 @@ def _load_timeseries(pv_size_kw, use_hourly_electricity)
end
# Convert hourly data to monthly data as appropriate
- num_days_in_month = Constants.NumDaysInMonths(2002) # Arbitrary non-leap year
+ num_days_in_month = Calendar.num_days_in_months(2002) # Arbitrary non-leap year
fuels.each do |(fuel_type, _is_production), fuel|
next unless fuel_type != FT::Elec || (fuel_type == FT::Elec && !use_hourly_electricity)
diff --git a/workflow/tests/util.rb b/workflow/tests/util.rb
index b59887f11b..20a6f12b1c 100644
--- a/workflow/tests/util.rb
+++ b/workflow/tests/util.rb
@@ -923,11 +923,11 @@ def _verify_outputs(rundir, hpxml_path, results, hpxml, unit_multiplier)
end
# Appliances
- tabular_map = { HPXML::ClothesWasher => Constants.ObjectNameClothesWasher,
- HPXML::ClothesDryer => Constants.ObjectNameClothesDryer,
- HPXML::Refrigerator => Constants.ObjectNameRefrigerator,
- HPXML::Dishwasher => Constants.ObjectNameDishwasher,
- HPXML::CookingRange => Constants.ObjectNameCookingRange }
+ tabular_map = { HPXML::ClothesWasher => Constants::ObjectTypeClothesWasher,
+ HPXML::ClothesDryer => Constants::ObjectTypeClothesDryer,
+ HPXML::Refrigerator => Constants::ObjectTypeRefrigerator,
+ HPXML::Dishwasher => Constants::ObjectTypeDishwasher,
+ HPXML::CookingRange => Constants::ObjectTypeCookingRange }
(hpxml_bldg.clothes_washers + hpxml_bldg.clothes_dryers + hpxml_bldg.refrigerators + hpxml_bldg.dishwashers + hpxml_bldg.cooking_ranges).each do |appliance|
next unless hpxml_bldg.water_heating_systems.size > 0