Skip to content

Commit

Permalink
Add a couple sample files.
Browse files Browse the repository at this point in the history
  • Loading branch information
shorowit committed Nov 27, 2024
1 parent 7855ab5 commit af6bcbf
Show file tree
Hide file tree
Showing 4 changed files with 5,505 additions and 15 deletions.
66 changes: 51 additions & 15 deletions tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,19 @@ def create_hpxmls
model = OpenStudio::Model::Model.new
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)

num_apply_measures = 1
if hpxml_path.include?('whole-building.xml')
num_apply_measures = 6
elsif hpxml_path.include?('whole-building-common-spaces.xml')
num_apply_measures = 8
num_mf_units = 1
if hpxml_path.include? 'whole-building-common-spaces'
num_mf_units = 8
elsif hpxml_path.include? 'whole-building'
num_mf_units = 6
end

for i in 1..num_apply_measures
for i in 1..num_mf_units
build_residential_hpxml = measures['BuildResidentialHPXML'][0]
build_residential_hpxml['existing_hpxml_path'] = hpxml_path if i > 1
if hpxml_path.include?('base-bldgtype-mf-whole-building.xml')
suffix = "_#{i}" if i > 1
build_residential_hpxml['schedules_filepaths'] = "../../HPXMLtoOpenStudio/resources/schedule_files/occupancy-stochastic#{suffix}.csv"
build_residential_hpxml['geometry_foundation_type'] = (i <= 2 ? 'UnconditionedBasement' : 'AboveApartment')
build_residential_hpxml['geometry_attic_type'] = (i >= 5 ? 'VentedAttic' : 'BelowApartment')
build_residential_hpxml['geometry_unit_height_above_grade'] = { 1 => 0.0, 2 => 0.0, 3 => 10.0, 4 => 10.0, 5 => 20.0, 6 => 20.0 }[i]
elsif hpxml_path.include?('base-bldgtype-mf-whole-building-common-spaces.xml')
suffix = "_#{i}" if i > 1
suffix = "_#{i}" if i > 1

if hpxml_path.include?('whole-building-common-spaces')
build_residential_hpxml['schedules_filepaths'] = (i >= 7 ? nil : "../../HPXMLtoOpenStudio/resources/schedule_files/occupancy-stochastic#{suffix}.csv")
build_residential_hpxml['geometry_foundation_type'] = (i <= 2 ? 'UnconditionedBasement' : 'AboveApartment')
build_residential_hpxml['geometry_attic_type'] = (i >= 7 ? 'VentedAttic' : 'BelowApartment')
Expand All @@ -83,6 +78,11 @@ def create_hpxmls
# Partially conditioned basement + one unconditioned hallway each floor + unconditioned attic
build_residential_hpxml['heating_system_type'] = { 1 => 'ElectricResistance', 2 => 'none', 3 => 'none', 4 => 'ElectricResistance', 5 => 'none', 6 => 'ElectricResistance', 7 => 'none', 8 => 'none' }[i]
build_residential_hpxml['cooling_system_type'] = { 1 => 'room air conditioner', 2 => 'none', 3 => 'none', 4 => 'room air conditioner', 5 => 'none', 6 => 'room air conditioner', 7 => 'none', 8 => 'none' }[i]
elsif hpxml_path.include?('whole-building')
build_residential_hpxml['schedules_filepaths'] = "../../HPXMLtoOpenStudio/resources/schedule_files/occupancy-stochastic#{suffix}.csv"
build_residential_hpxml['geometry_foundation_type'] = (i <= 2 ? 'UnconditionedBasement' : 'AboveApartment')
build_residential_hpxml['geometry_attic_type'] = (i >= 5 ? 'VentedAttic' : 'BelowApartment')
build_residential_hpxml['geometry_unit_height_above_grade'] = { 1 => 0.0, 2 => 0.0, 3 => 10.0, 4 => 10.0, 5 => 20.0, 6 => 20.0 }[i]
end

# Re-generate stochastic schedule CSV?
Expand Down Expand Up @@ -1598,7 +1598,7 @@ def apply_hpxml_modification_sample_files(hpxml_path, hpxml)
hpxml_bldg.heat_pumps[0].number_of_units_served = 6
hpxml_bldg.heat_pumps[0].pump_watts_per_ton = 0.0
end
if !hpxml_file.include? 'eae'
if !hpxml_file.include?('eae') && !hpxml_file.include?('whole-building')
if hpxml_file.include? 'shared-boiler'
hpxml_bldg.heating_systems[0].shared_loop_watts = 600
end
Expand Down Expand Up @@ -2627,6 +2627,42 @@ def apply_hpxml_modification_sample_files(hpxml_path, hpxml)
plug_load.delete
end
end
elsif ['base-bldgtype-mf-whole-building-shared-boilers-sequenced.xml',
'base-bldgtype-mf-whole-building-shared-boilers-simultaneous.xml'].include? hpxml_file
if hpxml_file.include? 'sequenced'
hpxml.header.shared_boiler_operation = HPXML::SharedBoilerOperationSequenced
elsif hpxml_file.include? 'simultaneous'
hpxml.header.shared_boiler_operation = HPXML::SharedBoilerOperationSimultaneous
end
# Add two shared boilers to building1
hpxml.buildings[0].heating_systems.clear
for j in 1..2
hpxml.buildings[0].heating_systems.add(id: "HeatingSystem#{j}",
is_shared_system: true,
distribution_system_idref: 'HVACDistribution1',
heating_system_type: HPXML::HVACTypeBoiler,
heating_system_fuel: HPXML::FuelTypeNaturalGas,
heating_capacity: 30000,
heating_efficiency_afue: 0.8)
end
hpxml.buildings[0].hvac_distributions.clear
hpxml.buildings[0].hvac_distributions.add(id: 'HVACDistribution1',
distribution_system_type: HPXML::HVACDistributionTypeHydronic,
hydronic_type: HPXML::HydronicTypeBaseboard,
hydronic_supply_temp: 160,
hydronic_return_temp: 120)
# Reference the shared boilers from all other buildings
for i in 1..hpxml.buildings.size - 1
hpxml.buildings[i].heating_systems.clear
for j in 1..2
hpxml.buildings[i].heating_systems.add(id: "HeatingSystem#{j}_#{i}",
distribution_system_idref: "HVACDistribution1_#{i}",
sameas_id: "HeatingSystem#{j}")
end
hpxml.buildings[i].hvac_distributions.clear
hpxml.buildings[i].hvac_distributions.add(id: "HVACDistribution1_#{i}",
sameas_id: 'HVACDistribution1')
end
end
end

Expand Down
6 changes: 6 additions & 0 deletions workflow/hpxml_inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3611,6 +3611,12 @@
"parent_hpxml": "sample_files/base-bldgtype-mf-whole-building.xml",
"heating_system_heating_capacity": 24000
},
"sample_files/base-bldgtype-mf-whole-building-shared-boilers-sequenced.xml": {
"parent_hpxml": "sample_files/base-bldgtype-mf-whole-building.xml"
},
"sample_files/base-bldgtype-mf-whole-building-shared-boilers-simultaneous.xml": {
"parent_hpxml": "sample_files/base-bldgtype-mf-whole-building.xml"
},
"sample_files/base-pv.xml": {
"parent_hpxml": "sample_files/base.xml",
"pv_system_present": true,
Expand Down
Loading

0 comments on commit af6bcbf

Please sign in to comment.