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 43 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
158 changes: 149 additions & 9 deletions BuildResidentialHPXML/measure.rb

Large diffs are not rendered by default.

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>281ad8f6-3e19-4e32-bb0d-b52e399aae3b</version_id>
<version_modified>2023-09-28T16:21:23Z</version_modified>
<version_id>fe5831cf-3c2e-4ebc-83a6-4ba4905947f6</version_id>
<version_modified>2023-09-29T18:23:36Z</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>existing_hpxml_path</name>
<display_name>Existing HPXML File Path</display_name>
<description>Absolute/relative path of the existing HPXML file. If not provided, a new HPXML file with one Building element is created. If provided, a new Building element will be appended to this HPXML file (e.g., to create a multifamily HPXML file describing multiple dwelling units).</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>91835523</checksum>
<checksum>7CA2AE71</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>EE3ADA7A</checksum>
<checksum>9D0DB037</checksum>
</file>
</files>
</measure>
215 changes: 150 additions & 65 deletions BuildResidentialHPXML/tests/build_residential_hpxml_test.rb

Large diffs are not rendered by default.

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
20 changes: 16 additions & 4 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>c9fb3647-7ee2-48ed-809a-87178d163168</version_id>
<version_modified>2023-09-30T00:09:22Z</version_modified>
<version_id>c07fe49a-6051-421e-8919-899cd3a0ff0f</version_id>
<version_modified>2023-09-30T21:03: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,13 +238,13 @@
<filename>hpxml.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>9E0F82C7</checksum>
<checksum>40E63FB6</checksum>
</file>
<file>
<filename>hpxml_defaults.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>BFB8A264</checksum>
<checksum>3C7ED956</checksum>
</file>
<file>
<filename>hpxml_schema/HPXML.xsd</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 @@ -1607,7 +1607,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 @@ -3517,8 +3519,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 @@ -3589,15 +3591,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 @@ -3640,9 +3650,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