From 11c321e7afe73142dab0a78fec8104147725f0d6 Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Tue, 31 Oct 2023 17:27:35 -0600 Subject: [PATCH] Don't write Building/Site element when not needed. --- HPXMLtoOpenStudio/measure.xml | 6 +++--- HPXMLtoOpenStudio/resources/hpxml.rb | 14 +++++++------- .../sample_files/base-location-capetown-zaf.xml | 3 --- workflow/sample_files/base-misc-defaults.xml | 3 --- workflow/sample_files/base-residents-5.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L100AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L100AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L110AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L110AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L120AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L120AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L130AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L130AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L140AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L140AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L150AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L150AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L155AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L155AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L160AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L160AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L170AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L170AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L200AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L200AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L202AC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L202AL.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L302XC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L304XC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L322XC.xml | 3 --- workflow/tests/ASHRAE_Standard_140/L324XC.xml | 3 --- 31 files changed, 10 insertions(+), 97 deletions(-) diff --git a/HPXMLtoOpenStudio/measure.xml b/HPXMLtoOpenStudio/measure.xml index 820251f327..067e89d1b0 100644 --- a/HPXMLtoOpenStudio/measure.xml +++ b/HPXMLtoOpenStudio/measure.xml @@ -3,8 +3,8 @@ 3.1 hpxm_lto_openstudio b1543b30-9465-45ff-ba04-1d1f85e763bc - e3c3d6b8-7931-4e31-a544-f4b168b10038 - 2023-10-31T23:17:38Z + 3393081e-a5f6-41fd-931a-a676f65fd3db + 2023-10-31T23:27:23Z D8922A73 HPXMLtoOpenStudio HPXML to OpenStudio Translator @@ -250,7 +250,7 @@ hpxml.rb rb resource - B24BC928 + C8079DF3 hpxml_defaults.rb diff --git a/HPXMLtoOpenStudio/resources/hpxml.rb b/HPXMLtoOpenStudio/resources/hpxml.rb index f756ffe1dc..cabf58b577 100644 --- a/HPXMLtoOpenStudio/resources/hpxml.rb +++ b/HPXMLtoOpenStudio/resources/hpxml.rb @@ -1074,14 +1074,14 @@ def to_doc(doc) building = XMLHelper.add_element(hpxml, 'Building') building_building_id = XMLHelper.add_element(building, 'BuildingID') XMLHelper.add_attribute(building_building_id, 'id', @building_id) - building_site = XMLHelper.add_element(building, 'Site') - building_site_id = XMLHelper.add_element(building_site, 'SiteID') - if @site_id.nil? - XMLHelper.add_attribute(building_site_id, 'id', 'SiteID') - else - XMLHelper.add_attribute(building_site_id, 'id', @site_id) - end if (not @state_code.nil?) || (not @zip_code.nil?) || (not @time_zone_utc_offset.nil?) || (not @egrid_region.nil?) || (not @egrid_subregion.nil?) || (not @cambium_region_gea.nil?) || (not @dst_enabled.nil?) || (not @dst_begin_month.nil?) || (not @dst_begin_day.nil?) || (not @dst_end_month.nil?) || (not @dst_end_day.nil?) + building_site = XMLHelper.add_element(building, 'Site') + building_site_id = XMLHelper.add_element(building_site, 'SiteID') + if @site_id.nil? + XMLHelper.add_attribute(building_site_id, 'id', 'SiteID') + else + XMLHelper.add_attribute(building_site_id, 'id', @site_id) + end if (not @state_code.nil?) || (not @zip_code.nil?) address = XMLHelper.add_element(building_site, 'Address') XMLHelper.add_element(address, 'StateCode', @state_code, :string, @state_code_isdefaulted) unless @state_code.nil? diff --git a/workflow/sample_files/base-location-capetown-zaf.xml b/workflow/sample_files/base-location-capetown-zaf.xml index ddf4f268ce..bb4e9ee571 100644 --- a/workflow/sample_files/base-location-capetown-zaf.xml +++ b/workflow/sample_files/base-location-capetown-zaf.xml @@ -20,9 +20,6 @@ - - - proposed workscope diff --git a/workflow/sample_files/base-misc-defaults.xml b/workflow/sample_files/base-misc-defaults.xml index 04b97541ad..260aac12bf 100644 --- a/workflow/sample_files/base-misc-defaults.xml +++ b/workflow/sample_files/base-misc-defaults.xml @@ -17,9 +17,6 @@ - - - proposed workscope diff --git a/workflow/sample_files/base-residents-5.xml b/workflow/sample_files/base-residents-5.xml index f2d495679b..522d439917 100644 --- a/workflow/sample_files/base-residents-5.xml +++ b/workflow/sample_files/base-residents-5.xml @@ -17,9 +17,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L100AC.xml b/workflow/tests/ASHRAE_Standard_140/L100AC.xml index 4a6ac05316..fe13b262b2 100644 --- a/workflow/tests/ASHRAE_Standard_140/L100AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L100AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L100AL.xml b/workflow/tests/ASHRAE_Standard_140/L100AL.xml index cd14212fed..df88842c60 100644 --- a/workflow/tests/ASHRAE_Standard_140/L100AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L100AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L110AC.xml b/workflow/tests/ASHRAE_Standard_140/L110AC.xml index 8ab1008303..0783aee1f7 100644 --- a/workflow/tests/ASHRAE_Standard_140/L110AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L110AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L110AL.xml b/workflow/tests/ASHRAE_Standard_140/L110AL.xml index 7a519f56b9..3658ee0c79 100644 --- a/workflow/tests/ASHRAE_Standard_140/L110AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L110AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L120AC.xml b/workflow/tests/ASHRAE_Standard_140/L120AC.xml index 5de4625c51..af0324eef7 100644 --- a/workflow/tests/ASHRAE_Standard_140/L120AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L120AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L120AL.xml b/workflow/tests/ASHRAE_Standard_140/L120AL.xml index 1c03285a98..e45085f4fb 100644 --- a/workflow/tests/ASHRAE_Standard_140/L120AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L120AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L130AC.xml b/workflow/tests/ASHRAE_Standard_140/L130AC.xml index 303a89316c..82c19b144e 100644 --- a/workflow/tests/ASHRAE_Standard_140/L130AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L130AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L130AL.xml b/workflow/tests/ASHRAE_Standard_140/L130AL.xml index a601ba4e00..b8d23d9e1f 100644 --- a/workflow/tests/ASHRAE_Standard_140/L130AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L130AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L140AC.xml b/workflow/tests/ASHRAE_Standard_140/L140AC.xml index 6f12a6f532..3f056d0ce4 100644 --- a/workflow/tests/ASHRAE_Standard_140/L140AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L140AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L140AL.xml b/workflow/tests/ASHRAE_Standard_140/L140AL.xml index fb7887675a..cf39667cf1 100644 --- a/workflow/tests/ASHRAE_Standard_140/L140AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L140AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L150AC.xml b/workflow/tests/ASHRAE_Standard_140/L150AC.xml index 50df6284e4..1fc68f917a 100644 --- a/workflow/tests/ASHRAE_Standard_140/L150AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L150AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L150AL.xml b/workflow/tests/ASHRAE_Standard_140/L150AL.xml index 81e441c928..fa34a96b90 100644 --- a/workflow/tests/ASHRAE_Standard_140/L150AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L150AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L155AC.xml b/workflow/tests/ASHRAE_Standard_140/L155AC.xml index 63f1e46d86..1634399357 100644 --- a/workflow/tests/ASHRAE_Standard_140/L155AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L155AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L155AL.xml b/workflow/tests/ASHRAE_Standard_140/L155AL.xml index a4e5cec788..16546dc94c 100644 --- a/workflow/tests/ASHRAE_Standard_140/L155AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L155AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L160AC.xml b/workflow/tests/ASHRAE_Standard_140/L160AC.xml index 7761bc80c2..5f46c9998f 100644 --- a/workflow/tests/ASHRAE_Standard_140/L160AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L160AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L160AL.xml b/workflow/tests/ASHRAE_Standard_140/L160AL.xml index 7ea1ccb8ad..9840358135 100644 --- a/workflow/tests/ASHRAE_Standard_140/L160AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L160AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L170AC.xml b/workflow/tests/ASHRAE_Standard_140/L170AC.xml index feb4908c05..be4511c241 100644 --- a/workflow/tests/ASHRAE_Standard_140/L170AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L170AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L170AL.xml b/workflow/tests/ASHRAE_Standard_140/L170AL.xml index 3f20539e59..05f243f0b2 100644 --- a/workflow/tests/ASHRAE_Standard_140/L170AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L170AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L200AC.xml b/workflow/tests/ASHRAE_Standard_140/L200AC.xml index cddaf8a798..52fc94f1ef 100644 --- a/workflow/tests/ASHRAE_Standard_140/L200AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L200AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L200AL.xml b/workflow/tests/ASHRAE_Standard_140/L200AL.xml index ac9b8bb239..f04f87ae8c 100644 --- a/workflow/tests/ASHRAE_Standard_140/L200AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L200AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L202AC.xml b/workflow/tests/ASHRAE_Standard_140/L202AC.xml index 5ddcf62cb4..b25cb8b0e4 100644 --- a/workflow/tests/ASHRAE_Standard_140/L202AC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L202AC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L202AL.xml b/workflow/tests/ASHRAE_Standard_140/L202AL.xml index b154ccb21a..a23588596b 100644 --- a/workflow/tests/ASHRAE_Standard_140/L202AL.xml +++ b/workflow/tests/ASHRAE_Standard_140/L202AL.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L302XC.xml b/workflow/tests/ASHRAE_Standard_140/L302XC.xml index 809fe85785..1f51226c44 100644 --- a/workflow/tests/ASHRAE_Standard_140/L302XC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L302XC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L304XC.xml b/workflow/tests/ASHRAE_Standard_140/L304XC.xml index 5f0f54145a..177bb94f0a 100644 --- a/workflow/tests/ASHRAE_Standard_140/L304XC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L304XC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L322XC.xml b/workflow/tests/ASHRAE_Standard_140/L322XC.xml index 74493b1801..d9e0dbc38b 100644 --- a/workflow/tests/ASHRAE_Standard_140/L322XC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L322XC.xml @@ -13,9 +13,6 @@ - - - proposed workscope diff --git a/workflow/tests/ASHRAE_Standard_140/L324XC.xml b/workflow/tests/ASHRAE_Standard_140/L324XC.xml index 4a66d88d2f..0a9c5a6eb6 100644 --- a/workflow/tests/ASHRAE_Standard_140/L324XC.xml +++ b/workflow/tests/ASHRAE_Standard_140/L324XC.xml @@ -13,9 +13,6 @@ - - - proposed workscope