From 8fe19e51d353b6f624ac533b6f3db188e596f68e Mon Sep 17 00:00:00 2001 From: Scott Horowitz Date: Thu, 19 Dec 2024 09:02:05 -0700 Subject: [PATCH] Renames the schematron file extension to .sch. --- .github/pull_request_template.md | 2 +- BuildResidentialHPXML/measure.rb | 2 +- Changelog.md | 1 + HPXMLtoOpenStudio/measure.rb | 2 +- HPXMLtoOpenStudio/resources/battery.rb | 2 +- HPXMLtoOpenStudio/resources/generator.rb | 4 ++-- HPXMLtoOpenStudio/resources/geometry.rb | 2 +- .../hpxml_schematron/{EPvalidator.xml => EPvalidator.sch} | 0 HPXMLtoOpenStudio/resources/pv.rb | 2 +- HPXMLtoOpenStudio/resources/version.rb | 2 +- HPXMLtoOpenStudio/tests/test_validation.rb | 2 +- docs/source/workflow_inputs.rst | 2 +- workflow/tests/util.rb | 4 ++-- 13 files changed, 14 insertions(+), 13 deletions(-) rename HPXMLtoOpenStudio/resources/hpxml_schematron/{EPvalidator.xml => EPvalidator.sch} (100%) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index eabe9153c4..1e7510308d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,7 +6,7 @@ Not all may apply: -- [ ] Schematron validator (`EPvalidator.xml`) has been updated +- [ ] Schematron validator (`EPvalidator.sch`) has been updated - [ ] Sample files have been added/updated (`openstudio tasks.rb update_hpxmls`) - [ ] Tests have been added/updated (e.g., `HPXMLtoOpenStudio/tests/test*.rb` and/or `workflow/tests/test*.rb`) - [ ] Documentation has been updated diff --git a/BuildResidentialHPXML/measure.rb b/BuildResidentialHPXML/measure.rb index b45579f0c6..c77dbfc6da 100644 --- a/BuildResidentialHPXML/measure.rb +++ b/BuildResidentialHPXML/measure.rb @@ -4031,7 +4031,7 @@ def self.validate_hpxml(runner, hpxml, hpxml_doc, hpxml_path) xsd_errors, xsd_warnings = XMLValidator.validate_against_schema(hpxml_path, schema_validator) # Validate input HPXML against schematron docs - schematron_path = File.join(File.dirname(__FILE__), '..', 'HPXMLtoOpenStudio', 'resources', 'hpxml_schematron', 'EPvalidator.xml') + schematron_path = File.join(File.dirname(__FILE__), '..', 'HPXMLtoOpenStudio', 'resources', 'hpxml_schematron', 'EPvalidator.sch') schematron_validator = XMLValidator.get_xml_validator(schematron_path) sct_errors, sct_warnings = XMLValidator.validate_against_schematron(hpxml_path, schematron_validator, hpxml_doc) diff --git a/Changelog.md b/Changelog.md index fe1aa6a5b7..f163123e6c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ __New Features__ __Bugfixes__ +- Fixes EPvalidator schematron file extension (.sch, not .xml). ## OpenStudio-HPXML v1.9.1 diff --git a/HPXMLtoOpenStudio/measure.rb b/HPXMLtoOpenStudio/measure.rb index b22a139b26..f4effbf1dc 100644 --- a/HPXMLtoOpenStudio/measure.rb +++ b/HPXMLtoOpenStudio/measure.rb @@ -214,7 +214,7 @@ def create_hpxml_object(runner, args) else schema_path = File.join(File.dirname(__FILE__), 'resources', 'hpxml_schema', 'HPXML.xsd') schema_validator = XMLValidator.get_xml_validator(schema_path) - schematron_path = File.join(File.dirname(__FILE__), 'resources', 'hpxml_schematron', 'EPvalidator.xml') + schematron_path = File.join(File.dirname(__FILE__), 'resources', 'hpxml_schematron', 'EPvalidator.sch') schematron_validator = XMLValidator.get_xml_validator(schematron_path) end diff --git a/HPXMLtoOpenStudio/resources/battery.rb b/HPXMLtoOpenStudio/resources/battery.rb index 9e52b228a7..3fc86915aa 100644 --- a/HPXMLtoOpenStudio/resources/battery.rb +++ b/HPXMLtoOpenStudio/resources/battery.rb @@ -75,7 +75,7 @@ def self.apply_battery(runner, model, spaces, hpxml_bldg, battery, schedules_fil if battery.is_shared_system # Apportion to single dwelling unit by # bedrooms - fail if battery.number_of_bedrooms_served.to_f <= nbeds.to_f # EPvalidator.xml should prevent this + fail if battery.number_of_bedrooms_served.to_f <= nbeds.to_f # EPvalidator.sch should prevent this nominal_capacity_kwh = nominal_capacity_kwh * nbeds.to_f / battery.number_of_bedrooms_served.to_f usable_capacity_kwh = usable_capacity_kwh * nbeds.to_f / battery.number_of_bedrooms_served.to_f diff --git a/HPXMLtoOpenStudio/resources/generator.rb b/HPXMLtoOpenStudio/resources/generator.rb index 77cf86bc9b..8cdfe57e48 100644 --- a/HPXMLtoOpenStudio/resources/generator.rb +++ b/HPXMLtoOpenStudio/resources/generator.rb @@ -34,7 +34,7 @@ def self.apply_generator(model, hpxml_bldg, generator) if generator.is_shared_system # Apportion to single dwelling unit by # bedrooms - fail if generator.number_of_bedrooms_served.to_f <= nbeds.to_f # EPvalidator.xml should prevent this + fail if generator.number_of_bedrooms_served.to_f <= nbeds.to_f # EPvalidator.sch should prevent this annual_consumption_kbtu = annual_consumption_kbtu * nbeds.to_f / generator.number_of_bedrooms_served.to_f annual_output_kwh = annual_output_kwh * nbeds.to_f / generator.number_of_bedrooms_served.to_f @@ -43,7 +43,7 @@ def self.apply_generator(model, hpxml_bldg, generator) input_w = UnitConversions.convert(annual_consumption_kbtu, 'kBtu', 'Wh') / 8760.0 output_w = UnitConversions.convert(annual_output_kwh, 'kWh', 'Wh') / 8760.0 efficiency = output_w / input_w - fail if efficiency > 1.0 # EPvalidator.xml should prevent this + fail if efficiency > 1.0 # EPvalidator.sch should prevent this curve_biquadratic_constant = Model.add_curve_biquadratic( model, diff --git a/HPXMLtoOpenStudio/resources/geometry.rb b/HPXMLtoOpenStudio/resources/geometry.rb index cc284bbddf..2ccd461103 100644 --- a/HPXMLtoOpenStudio/resources/geometry.rb +++ b/HPXMLtoOpenStudio/resources/geometry.rb @@ -984,7 +984,7 @@ def self.apply_conditioned_floor_area(model, spaces, hpxml_bldg) addtl_cfa = hpxml_bldg.building_construction.conditioned_floor_area - sum_cfa - fail if addtl_cfa < -1.0 # Allow some rounding; EPvalidator.xml should prevent this + fail if addtl_cfa < -1.0 # Allow some rounding; EPvalidator.sch should prevent this return unless addtl_cfa > 1.0 # Allow some rounding diff --git a/HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml b/HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.sch similarity index 100% rename from HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml rename to HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.sch diff --git a/HPXMLtoOpenStudio/resources/pv.rb b/HPXMLtoOpenStudio/resources/pv.rb index 08822275c7..5624d33711 100644 --- a/HPXMLtoOpenStudio/resources/pv.rb +++ b/HPXMLtoOpenStudio/resources/pv.rb @@ -40,7 +40,7 @@ def self.apply_pv_system(model, hpxml_bldg, pv_system) if pv_system.is_shared_system # Apportion to single dwelling unit by # bedrooms - fail if pv_system.number_of_bedrooms_served.to_f <= nbeds.to_f # EPvalidator.xml should prevent this + fail if pv_system.number_of_bedrooms_served.to_f <= nbeds.to_f # EPvalidator.sch should prevent this max_power = max_power * nbeds.to_f / pv_system.number_of_bedrooms_served.to_f end diff --git a/HPXMLtoOpenStudio/resources/version.rb b/HPXMLtoOpenStudio/resources/version.rb index b56875f660..3a6fd612e9 100644 --- a/HPXMLtoOpenStudio/resources/version.rb +++ b/HPXMLtoOpenStudio/resources/version.rb @@ -3,7 +3,7 @@ # Collection of methods related to software versions. module Version OS_HPXML_Version = '1.10.0' # Version of the OS-HPXML workflow - OS_Version = '3.9.0' # Required version of OpenStudio (can be 'X.X' or 'X.X.X') + OS_Version = '3.9.1' # Required version of OpenStudio (can be 'X.X' or 'X.X.X') HPXML_Version = '4.0' # HPXML schemaVersion # Checks whether the version of OpenStudio that is running OpenStudio-HPXML diff --git a/HPXMLtoOpenStudio/tests/test_validation.rb b/HPXMLtoOpenStudio/tests/test_validation.rb index 21f4bf08e0..0a149973ef 100644 --- a/HPXMLtoOpenStudio/tests/test_validation.rb +++ b/HPXMLtoOpenStudio/tests/test_validation.rb @@ -15,7 +15,7 @@ def setup @sample_files_path = File.join(@root_path, 'workflow', 'sample_files') schema_path = File.absolute_path(File.join(@root_path, 'HPXMLtoOpenStudio', 'resources', 'hpxml_schema', 'HPXML.xsd')) @schema_validator = XMLValidator.get_xml_validator(schema_path) - @schematron_path = File.join(@root_path, 'HPXMLtoOpenStudio', 'resources', 'hpxml_schematron', 'EPvalidator.xml') + @schematron_path = File.join(@root_path, 'HPXMLtoOpenStudio', 'resources', 'hpxml_schematron', 'EPvalidator.sch') @schematron_validator = XMLValidator.get_xml_validator(@schematron_path) @tmp_hpxml_path = File.join(@sample_files_path, 'tmp.xml') diff --git a/docs/source/workflow_inputs.rst b/docs/source/workflow_inputs.rst index 4b996f0805..2ce493581f 100644 --- a/docs/source/workflow_inputs.rst +++ b/docs/source/workflow_inputs.rst @@ -22,7 +22,7 @@ HPXML files submitted to OpenStudio-HPXML undergo a two step validation process: 2. Validation using `Schematron `_ - The Schematron document for the EnergyPlus use case can be found at ``HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.xml``. + The Schematron document for the EnergyPlus use case can be found at ``HPXMLtoOpenStudio/resources/hpxml_schematron/EPvalidator.sch``. Schematron is a rule-based validation language, expressed in XML using XPath expressions, for validating the presence or absence of inputs in XML files. As opposed to an XSD Schema, a Schematron document validates constraints and requirements based on conditionals and other logical statements. For example, if an element is specified with a particular value, the applicable enumerations of another element may change. diff --git a/workflow/tests/util.rb b/workflow/tests/util.rb index bd2bacdb97..06223be438 100644 --- a/workflow/tests/util.rb +++ b/workflow/tests/util.rb @@ -100,14 +100,14 @@ def _run_xml(xml, worker_num, apply_unit_multiplier = false, annual_results_1x = # Check outputs hpxml_defaults_path = File.join(rundir, 'in.xml') schema_validator = XMLValidator.get_xml_validator(File.join(File.dirname(__FILE__), '..', '..', 'HPXMLtoOpenStudio', 'resources', 'hpxml_schema', 'HPXML.xsd')) - schematron_validator = XMLValidator.get_xml_validator(File.join(File.dirname(__FILE__), '..', '..', 'HPXMLtoOpenStudio', 'resources', 'hpxml_schematron', 'EPvalidator.xml')) + schematron_validator = XMLValidator.get_xml_validator(File.join(File.dirname(__FILE__), '..', '..', 'HPXMLtoOpenStudio', 'resources', 'hpxml_schematron', 'EPvalidator.sch')) hpxml = HPXML.new(hpxml_path: hpxml_defaults_path, schema_validator: schema_validator, schematron_validator: schematron_validator) # Validate in.xml to ensure it can be run back through OS-HPXML if not hpxml.errors.empty? puts 'ERRORS:' hpxml.errors.each do |error| puts error end - flunk "EPvalidator.xml error in #{hpxml_defaults_path}." + flunk "EPvalidator.sch error in #{hpxml_defaults_path}." end annual_results = _get_simulation_annual_results(annual_csv_path, bills_csv_path) monthly_results = _get_simulation_monthly_results(monthly_csv_path)