Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildResidentialHPXML: create multiple Building elements #1457

Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9cd85ce
Update build measure to add buildings to existing hpxml file.
joseph-robertson Aug 4, 2023
ec313d7
Update sample files.
joseph-robertson Aug 4, 2023
d05086b
Make SiteID variable to avoid overwriting it.
joseph-robertson Aug 4, 2023
9892558
Avoid duplicating bill scenarios.
joseph-robertson Aug 4, 2023
2590ba7
Try multiple buildings with detailed schedules.
joseph-robertson Aug 4, 2023
50b4970
Remove clothes dryer from first building in sample file.
joseph-robertson Aug 4, 2023
692f9ae
Avoid hardset of site id and shading ids.
joseph-robertson Aug 4, 2023
8ceda70
Set unit_model on schedules_file instance.
joseph-robertson Aug 4, 2023
8c95d15
Handle all buildings from workflow tests.
joseph-robertson Aug 4, 2023
b0430c9
Validate files created in build measure tests.
joseph-robertson Aug 7, 2023
ff3aed8
Remove debug line.
joseph-robertson Aug 7, 2023
129f367
Need to ignore shading_id attrs.
joseph-robertson Aug 8, 2023
ecdfd3b
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Aug 10, 2023
a4072e7
Add extra build measure tests.
joseph-robertson Aug 15, 2023
6ed0c43
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Aug 23, 2023
97b09ec
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Aug 24, 2023
22ed937
Avoid setting unique ids on the first building element.
joseph-robertson Aug 24, 2023
d64bf86
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Aug 30, 2023
4d28cc0
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Sep 19, 2023
d9d57f6
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Sep 21, 2023
7a95206
Create a new sample file of two buildings having separate detailed sc…
joseph-robertson Sep 21, 2023
becc012
Actually add two buildings sample file with different detailed schedu…
joseph-robertson Sep 22, 2023
10170eb
Regenerate both schedule files from new sample file.
joseph-robertson Sep 22, 2023
ec6519a
Add comment about deleting extra SchedulesFilePath. [ci skip]
joseph-robertson Sep 22, 2023
c407654
Clean up.
joseph-robertson Sep 25, 2023
0b604eb
Revert comment. [ci skip]
joseph-robertson Sep 26, 2023
e8c49e0
Remove need for base-two-buildings files and call BuildResidentialSch…
shorowit Sep 26, 2023
4fb3faf
Merge branch 'build_whole_sfa_mf_models_unit_multiplier' of https://g…
shorowit Sep 26, 2023
27c8a79
Clarify test.
shorowit Sep 26, 2023
a287772
Clarify new argument and add more description.
shorowit Sep 26, 2023
2d79faf
First cut at errors for conflicting header or building inputs.
joseph-robertson Sep 26, 2023
7e85203
Fix CI failure.
shorowit Sep 26, 2023
777c469
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Sep 27, 2023
17ce997
Refactor error checking on hpxml header inputs.
joseph-robertson Sep 27, 2023
6bee34e
Possible merge conflict in tasks.rb.
joseph-robertson Sep 27, 2023
7f6a43b
Update logic for catching header issues.
joseph-robertson Sep 27, 2023
4902b28
Update same emissions scenario name in sample file.
joseph-robertson Sep 28, 2023
0c7f595
Allow emissions same name but different type.
joseph-robertson Sep 29, 2023
7233283
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Sep 29, 2023
b97017b
Change a value for bad emissions scenario file.
joseph-robertson Sep 29, 2023
da13ed3
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Sep 30, 2023
4ee7943
Latest results.
Sep 30, 2023
fe46a5e
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Oct 2, 2023
3a8d55b
Merge branch 'whole_sfa_mf_models_unit_multiplier' into build_whole_s…
joseph-robertson Oct 3, 2023
807e746
Few review items.
joseph-robertson Oct 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions BuildResidentialHPXML/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def arguments(model) # rubocop:disable Lint/UnusedMethodArgument
arg.setDescription('Absolute/relative path of the HPXML file.')
args << arg

arg = OpenStudio::Measure::OSArgument.makeStringArgument('hpxml_path_in', false)
arg.setDisplayName('HPXML File Path In')
arg.setDescription('Absolute/relative path of the existing HPXML file.')
args << arg

arg = OpenStudio::Measure::OSArgument.makeStringArgument('software_info_program_used', false)
arg.setDisplayName('Software Info: Program Used')
arg.setDescription('The name of the software program used.')
Expand Down Expand Up @@ -3169,7 +3174,15 @@ def run(model, runner, user_arguments)
hpxml_path = File.expand_path(hpxml_path)
end

hpxml_doc = HPXMLFile.create(runner, model, args, epw_path, hpxml_path)
# Existing HPXML File
if args[:hpxml_path_in].is_initialized
hpxml_path_in = args[:hpxml_path_in].get
unless (Pathname.new hpxml_path_in).absolute?
hpxml_path_in = File.expand_path(hpxml_path_in)
end
end

hpxml_doc = HPXMLFile.create(runner, model, args, epw_path, hpxml_path, hpxml_path_in)
if not hpxml_doc
runner.registerError('Unsuccessful creation of HPXML file.')
return false
Expand Down Expand Up @@ -3366,7 +3379,7 @@ def argument_errors(args)
end

class HPXMLFile
def self.create(runner, model, args, epw_path, hpxml_path)
def self.create(runner, model, args, epw_path, hpxml_path, hpxml_path_in)
epw_file = OpenStudio::EpwFile.new(epw_path)
if (args[:hvac_control_heating_season_period].to_s == HPXML::BuildingAmerica) || (args[:hvac_control_cooling_season_period].to_s == HPXML::BuildingAmerica) || (args[:apply_defaults])
weather = WeatherProcess.new(epw_path: epw_path, runner: nil)
Expand All @@ -3381,7 +3394,7 @@ def self.create(runner, model, args, epw_path, hpxml_path)
sorted_surfaces = model.getSurfaces.sort_by { |s| s.additionalProperties.getFeatureAsInteger('Index').get }
sorted_subsurfaces = model.getSubSurfaces.sort_by { |ss| ss.additionalProperties.getFeatureAsInteger('Index').get }

hpxml = HPXML.new
hpxml = HPXML.new(hpxml_path: hpxml_path_in, building_id: 'ALL')

set_header(hpxml, args)
hpxml_bldg = add_building(hpxml, args)
Expand Down Expand Up @@ -3439,6 +3452,7 @@ def self.create(runner, model, args, epw_path, hpxml_path)
renumber_hpxml_ids(hpxml_bldg)

hpxml_doc = hpxml.to_doc()
hpxml.set_unique_hpxml_ids(hpxml_doc, true) if hpxml.buildings.size > 1
XMLHelper.write_file(hpxml_doc, hpxml_path)

if args[:apply_defaults]
Expand All @@ -3448,9 +3462,9 @@ def self.create(runner, model, args, epw_path, hpxml_path)
end

eri_version = Constants.ERIVersions[-1]
# FIXME: Address this when multiple buildings
HPXMLDefaults.apply(runner, hpxml, hpxml.buildings[0], eri_version, weather, epw_file: epw_file)
HPXMLDefaults.apply(runner, hpxml, hpxml_bldg, eri_version, weather, epw_file: epw_file)
hpxml_doc = hpxml.to_doc()
hpxml.set_unique_hpxml_ids(hpxml_doc, true) if hpxml.buildings.size > 1
shorowit marked this conversation as resolved.
Show resolved Hide resolved
XMLHelper.write_file(hpxml_doc, hpxml_path)
end

Expand Down
16 changes: 12 additions & 4 deletions BuildResidentialHPXML/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>build_residential_hpxml</name>
<uid>a13a8983-2b01-4930-8af2-42030b6e4233</uid>
<version_id>2c911ab5-ec9c-4b15-a9eb-810fbdb35b71</version_id>
<version_modified>2023-09-21T19:52:28Z</version_modified>
<version_id>a2eae01b-4c40-495b-8b84-721e33d1e6ab</version_id>
<version_modified>2023-09-26T16:04:10Z</version_modified>
<xml_checksum>2C38F48B</xml_checksum>
<class_name>BuildResidentialHPXML</class_name>
<display_name>HPXML Builder</display_name>
Expand All @@ -19,6 +19,14 @@
<required>true</required>
<model_dependent>false</model_dependent>
</argument>
<argument>
<name>hpxml_path_in</name>
<display_name>HPXML File Path In</display_name>
<description>Absolute/relative path of the existing HPXML file.</description>
<type>String</type>
<required>false</required>
<model_dependent>false</model_dependent>
</argument>
<argument>
<name>software_info_program_used</name>
<display_name>Software Info: Program Used</display_name>
Expand Down Expand Up @@ -6748,7 +6756,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>4CC7B948</checksum>
<checksum>ED79C6D7</checksum>
</file>
<file>
<filename>geometry.rb</filename>
Expand All @@ -6760,7 +6768,7 @@
<filename>build_residential_hpxml_test.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>46CDD184</checksum>
<checksum>A7CDB8B5</checksum>
</file>
<file>
<filename>extra_files/base-sfa.xml</filename>
Expand Down
36 changes: 33 additions & 3 deletions BuildResidentialHPXML/tests/build_residential_hpxml_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ def test_workflows
hpxmls_files = {
# Base files to derive from
'base-sfd.xml' => nil,
'base-sfd2.xml' => 'base-sfd.xml',

'base-sfa.xml' => 'base-sfd.xml',
'base-sfa2.xml' => 'base-sfa.xml',
'base-sfa3.xml' => 'base-sfa.xml',

'base-mf.xml' => 'base-sfd.xml',
'base-mf2.xml' => 'base-mf.xml',
'base-mf3.xml' => 'base-mf.xml',
'base-mf4.xml' => 'base-mf.xml',

# Extra files to test
'extra-auto.xml' => 'base-sfd.xml',
Expand Down Expand Up @@ -261,6 +269,9 @@ def test_workflows
'warning-conditioned-attic-with-floor-insulation.xml' => 'Home with conditioned attic has ceiling insulation.',
}

schema_path = File.join(File.dirname(__FILE__), '../..', 'HPXMLtoOpenStudio', 'resources', 'hpxml_schema', 'HPXML.xsd')
schema_validator = XMLValidator.get_schema_validator(schema_path)

puts "Generating #{hpxmls_files.size} HPXML files..."

hpxmls_files.each_with_index do |(hpxml_file, parent), i|
Expand Down Expand Up @@ -307,14 +318,21 @@ def test_workflows
end

hpxml_path = File.absolute_path(File.join(@output_path, hpxml_file))
hpxml = HPXML.new(hpxml_path: hpxml_path)
hpxml = HPXML.new(hpxml_path: hpxml_path, building_id: 'ALL')
hpxml.header.xml_generated_by = 'build_residential_hpxml_test.rb'
hpxml.header.created_date_and_time = Time.new(2000, 1, 1).strftime('%Y-%m-%dT%H:%M:%S%:z') # Hard-code to prevent diffs

hpxml_doc = hpxml.to_doc()
XMLHelper.write_file(hpxml_doc, hpxml_path)
rescue Exception => e
flunk "Error: Did not successfully generate #{hpxml_file}.\n#{e}\n#{e.backtrace.join('\n')}"

errors, _warnings = XMLValidator.validate_against_schema(hpxml_path, schema_validator)
next unless errors.size > 0

puts errors.to_s
puts "\nError: Did not successfully validate #{hpxml_file}."
exit!
rescue Exception
flunk "Error: Did not successfully generate #{hpxml_file}"
end
end

Expand Down Expand Up @@ -610,6 +628,8 @@ def _set_measure_argument_values(hpxml_file, args)
args['pool_heater_type'] = HPXML::HeaterTypeElectricResistance
args['hot_tub_present'] = false
args['hot_tub_heater_type'] = HPXML::HeaterTypeElectricResistance
elsif ['base-sfd2.xml'].include? hpxml_file
args['hpxml_path_in'] = File.join(File.dirname(__FILE__), 'extra_files/base-sfd.xml')
elsif ['base-sfa.xml'].include? hpxml_file
args['geometry_unit_type'] = HPXML::ResidentialTypeSFA
args['geometry_unit_cfa'] = 1800.0
Expand All @@ -624,6 +644,10 @@ def _set_measure_argument_values(hpxml_file, args)
args['window_area_left'] = 0
args['window_area_right'] = 0
args['air_leakage_type'] = HPXML::InfiltrationTypeUnitTotal
elsif ['base-sfa2.xml'].include? hpxml_file
args['hpxml_path_in'] = File.join(File.dirname(__FILE__), 'extra_files/base-sfa.xml')
elsif ['base-sfa3.xml'].include? hpxml_file
args['hpxml_path_in'] = File.join(File.dirname(__FILE__), 'extra_files/base-sfa2.xml')
elsif ['base-mf.xml'].include? hpxml_file
args['geometry_unit_type'] = HPXML::ResidentialTypeApartment
args['geometry_unit_cfa'] = 900.0
Expand All @@ -649,6 +673,12 @@ def _set_measure_argument_values(hpxml_file, args)
args['ducts_number_of_return_registers'] = 1
args['door_area'] = 20.0
args['air_leakage_type'] = HPXML::InfiltrationTypeUnitTotal
elsif ['base-mf2.xml'].include? hpxml_file
args['hpxml_path_in'] = File.join(File.dirname(__FILE__), 'extra_files/base-mf.xml')
elsif ['base-mf3.xml'].include? hpxml_file
args['hpxml_path_in'] = File.join(File.dirname(__FILE__), 'extra_files/base-mf2.xml')
elsif ['base-mf4.xml'].include? hpxml_file
args['hpxml_path_in'] = File.join(File.dirname(__FILE__), 'extra_files/base-mf3.xml')
end

# Extras
Expand Down
2 changes: 1 addition & 1 deletion BuildResidentialScheduleFile/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def run(model, runner, user_arguments)

# output csv path
args[:output_csv_path] = "#{filename}.csv"
args[:output_csv_path] = "#{filename}_#{i + 1}.csv" if i > 0
args[:output_csv_path] = "#{filename}_#{i + 1}.csv" if i > 0 && args[:building_id].get == 'ALL'
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved

# create the schedules
success = create_schedules(runner, hpxml, hpxml_bldg, epw_file, args)
Expand Down
8 changes: 4 additions & 4 deletions BuildResidentialScheduleFile/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>build_residential_schedule_file</name>
<uid>f770b2db-1a9f-4e99-99a7-7f3161a594b1</uid>
<version_id>32b707ca-3229-4912-b64f-f7d0163bc552</version_id>
<version_modified>2023-09-20T21:59:04Z</version_modified>
<version_id>d6a9eedd-3661-499a-8e45-0fe9716cd4cb</version_id>
<version_modified>2023-09-26T16:12:25Z</version_modified>
<xml_checksum>03F02484</xml_checksum>
<class_name>BuildResidentialScheduleFile</class_name>
<display_name>Schedule File Builder</display_name>
Expand Down Expand Up @@ -102,7 +102,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>A2133951</checksum>
<checksum>DA57F7ED</checksum>
</file>
<file>
<filename>README.md</filename>
Expand Down Expand Up @@ -900,7 +900,7 @@
<filename>build_residential_schedule_file_test.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>32332B7A</checksum>
<checksum>13DDEF22</checksum>
</file>
</files>
</measure>
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ def test_multiple_buildings
output_path: @tmp_schedule_file_path)

if hpxml_bldg.building_id == 'MyBuilding'
assert_equal(1, hpxml_bldg.header.schedules_filepaths.size)
assert(hpxml_bldg.header.schedules_filepaths[0].include? 'occupancy-stochastic.csv')
assert_in_epsilon(6689, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnOccupants, schedules: sf.tmp_schedules), 0.1)
assert_in_epsilon(2086, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnLightingInterior, schedules: sf.tmp_schedules), 0.1)
assert_in_epsilon(2086, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnLightingGarage, schedules: sf.tmp_schedules), 0.1)
Expand All @@ -313,6 +315,8 @@ def test_multiple_buildings
assert_in_epsilon(887, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnHotWaterFixtures, schedules: sf.tmp_schedules), 0.1)
assert(!sf.schedules.keys.include?(SchedulesFile::ColumnSleeping))
elsif hpxml_bldg.building_id == 'MyBuilding_2'
assert_equal(1, hpxml_bldg.header.schedules_filepaths.size)
assert(hpxml_bldg.header.schedules_filepaths[0].include? 'occupancy-stochastic_2.csv')
assert_in_epsilon(6072, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnOccupants, schedules: sf.tmp_schedules), 0.1)
assert_in_epsilon(1765, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnLightingInterior, schedules: sf.tmp_schedules), 0.1)
assert_in_epsilon(1765, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnLightingGarage, schedules: sf.tmp_schedules), 0.1)
Expand All @@ -328,6 +332,8 @@ def test_multiple_buildings
assert_in_epsilon(887, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnHotWaterFixtures, schedules: sf.tmp_schedules), 0.1)
assert(!sf.schedules.keys.include?(SchedulesFile::ColumnSleeping))
elsif hpxml_bldg.building_id == 'MyBuilding_3'
assert_equal(1, hpxml_bldg.header.schedules_filepaths.size)
assert(hpxml_bldg.header.schedules_filepaths[0].include? 'occupancy-stochastic_3.csv')
assert_in_epsilon(6045, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnOccupants, schedules: sf.tmp_schedules), 0.1)
assert_in_epsilon(1745, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnLightingInterior, schedules: sf.tmp_schedules), 0.1)
assert_in_epsilon(1745, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnLightingGarage, schedules: sf.tmp_schedules), 0.1)
Expand All @@ -350,7 +356,7 @@ def test_multiple_buildings_id
hpxml = _create_hpxml('base-multiple-buildings.xml')
XMLHelper.write_file(hpxml.to_doc, @tmp_hpxml_path)

@args_hash['output_csv_path'] = File.absolute_path(File.join(@tmp_output_path, 'occupancy-stochastic.csv'))
@args_hash['output_csv_path'] = File.absolute_path(File.join(@tmp_output_path, 'occupancy-stochastic_2.csv'))
@args_hash['building_id'] = 'MyBuilding_2'
hpxml, result = _test_measure()

Expand All @@ -370,6 +376,8 @@ def test_multiple_buildings_id
year: 2007,
output_path: @tmp_schedule_file_path)

assert_equal(1, hpxml_bldg.header.schedules_filepaths.size)
assert(hpxml_bldg.header.schedules_filepaths[0].include? 'occupancy-stochastic_2.csv')
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved
assert_in_epsilon(6072, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnOccupants, schedules: sf.tmp_schedules), 0.1)
assert_in_epsilon(1765, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnLightingInterior, schedules: sf.tmp_schedules), 0.1)
assert_in_epsilon(1765, sf.annual_equivalent_full_load_hrs(col_name: SchedulesFile::ColumnLightingGarage, schedules: sf.tmp_schedules), 0.1)
Expand Down
18 changes: 15 additions & 3 deletions HPXMLtoOpenStudio/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.1</schema_version>
<name>hpxm_lto_openstudio</name>
<uid>b1543b30-9465-45ff-ba04-1d1f85e763bc</uid>
<version_id>bf7233b2-f084-4ea0-b89f-f6f98887cd65</version_id>
<version_modified>2023-09-21T19:52:32Z</version_modified>
<version_id>f3074b49-5f0d-4ec6-8c4c-99b22e56f860</version_id>
<version_modified>2023-09-26T15:57:29Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -238,7 +238,7 @@
<filename>hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>41E73F5E</checksum>
<checksum>EA2A1FA4</checksum>
</file>
<file>
<filename>hpxml_defaults.rb</filename>
Expand Down Expand Up @@ -366,6 +366,18 @@
<usage_type>resource</usage_type>
<checksum>DEED74EA</checksum>
</file>
<file>
<filename>schedule_files/occupancy-stochastic_2.csv</filename>
<filetype>csv</filetype>
<usage_type>resource</usage_type>
<checksum>7E648862</checksum>
</file>
<file>
<filename>schedule_files/occupancy-stochastic_3.csv</filename>
<filetype>csv</filetype>
<usage_type>resource</usage_type>
<checksum>4DCFB9A0</checksum>
</file>
<file>
<filename>schedule_files/setpoints-10-mins.csv</filename>
<filetype>csv</filetype>
Expand Down
22 changes: 17 additions & 5 deletions HPXMLtoOpenStudio/resources/hpxml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,9 @@ def collapse_enclosure_surfaces(surf_types_of_interest = nil)
:under_slab_insulation_id,
:area,
:length,
:exposed_perimeter]
:exposed_perimeter,
:interior_shading_id,
:exterior_shading_id]

# Look for pairs of surfaces that can be collapsed
like_foundation_walls = {}
Expand Down Expand Up @@ -3507,8 +3509,8 @@ def from_doc(building)
class Window < BaseElement
ATTRS = [:id, :area, :azimuth, :orientation, :frame_type, :thermal_break, :glass_layers,
:glass_type, :gas_fill, :ufactor, :shgc, :interior_shading_factor_summer,
:interior_shading_factor_winter, :interior_shading_type, :exterior_shading_factor_summer,
:exterior_shading_factor_winter, :exterior_shading_type, :storm_type, :overhangs_depth,
:interior_shading_id, :interior_shading_factor_winter, :interior_shading_type, :exterior_shading_factor_summer,
:exterior_shading_id, :exterior_shading_factor_winter, :exterior_shading_type, :storm_type, :overhangs_depth,
:overhangs_distance_to_top_of_window, :overhangs_distance_to_bottom_of_window,
:fraction_operable, :performance_class, :wall_idref]
attr_accessor(*ATTRS)
Expand Down Expand Up @@ -3579,15 +3581,23 @@ def to_doc(building)
if (not @exterior_shading_type.nil?) || (not @exterior_shading_factor_summer.nil?) || (not @exterior_shading_factor_winter.nil?)
exterior_shading = XMLHelper.add_element(window, 'ExteriorShading')
sys_id = XMLHelper.add_element(exterior_shading, 'SystemIdentifier')
XMLHelper.add_attribute(sys_id, 'id', "#{id}ExteriorShading")
if @exterior_shading_id.nil?
XMLHelper.add_attribute(sys_id, 'id', "#{id}ExteriorShading")
else
XMLHelper.add_attribute(sys_id, 'id', @exterior_shading_id)
shorowit marked this conversation as resolved.
Show resolved Hide resolved
end
XMLHelper.add_element(exterior_shading, 'Type', @exterior_shading_type, :string) unless @exterior_shading_type.nil?
XMLHelper.add_element(exterior_shading, 'SummerShadingCoefficient', @exterior_shading_factor_summer, :float, @exterior_shading_factor_summer_isdefaulted) unless @exterior_shading_factor_summer.nil?
XMLHelper.add_element(exterior_shading, 'WinterShadingCoefficient', @exterior_shading_factor_winter, :float, @exterior_shading_factor_winter_isdefaulted) unless @exterior_shading_factor_winter.nil?
end
if (not @interior_shading_type.nil?) || (not @interior_shading_factor_summer.nil?) || (not @interior_shading_factor_winter.nil?)
interior_shading = XMLHelper.add_element(window, 'InteriorShading')
sys_id = XMLHelper.add_element(interior_shading, 'SystemIdentifier')
XMLHelper.add_attribute(sys_id, 'id', "#{id}InteriorShading")
if @interior_shading_id.nil?
XMLHelper.add_attribute(sys_id, 'id', "#{id}InteriorShading")
else
XMLHelper.add_attribute(sys_id, 'id', @interior_shading_id)
end
XMLHelper.add_element(interior_shading, 'Type', @interior_shading_type, :string) unless @interior_shading_type.nil?
XMLHelper.add_element(interior_shading, 'SummerShadingCoefficient', @interior_shading_factor_summer, :float, @interior_shading_factor_summer_isdefaulted) unless @interior_shading_factor_summer.nil?
XMLHelper.add_element(interior_shading, 'WinterShadingCoefficient', @interior_shading_factor_winter, :float, @interior_shading_factor_winter_isdefaulted) unless @interior_shading_factor_winter.nil?
Expand Down Expand Up @@ -3630,9 +3640,11 @@ def from_doc(window)
@gas_fill = XMLHelper.get_value(window, 'GasFill', :string)
@ufactor = XMLHelper.get_value(window, 'UFactor', :float)
@shgc = XMLHelper.get_value(window, 'SHGC', :float)
@exterior_shading_id = HPXML::get_id(window, 'ExteriorShading/SystemIdentifier')
@exterior_shading_type = XMLHelper.get_value(window, 'ExteriorShading/Type', :string)
@exterior_shading_factor_summer = XMLHelper.get_value(window, 'ExteriorShading/SummerShadingCoefficient', :float)
@exterior_shading_factor_winter = XMLHelper.get_value(window, 'ExteriorShading/WinterShadingCoefficient', :float)
@interior_shading_id = HPXML::get_id(window, 'InteriorShading/SystemIdentifier')
@interior_shading_type = XMLHelper.get_value(window, 'InteriorShading/Type', :string)
@interior_shading_factor_summer = XMLHelper.get_value(window, 'InteriorShading/SummerShadingCoefficient', :float)
@interior_shading_factor_winter = XMLHelper.get_value(window, 'InteriorShading/WinterShadingCoefficient', :float)
Expand Down
Loading
Loading