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

Rename the schematron file extension to .sch #1900

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion BuildResidentialHPXML/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
__New Features__

__Bugfixes__
- Fixes EPvalidator schematron file extension (.sch, not .xml).

## OpenStudio-HPXML v1.9.1

Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/resources/battery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions HPXMLtoOpenStudio/resources/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/resources/geometry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/resources/pv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/resources/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion HPXMLtoOpenStudio/tests/test_validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion docs/source/workflow_inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ HPXML files submitted to OpenStudio-HPXML undergo a two step validation process:

2. Validation using `Schematron <http://schematron.com/>`_

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.
Expand Down
4 changes: 2 additions & 2 deletions workflow/tests/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading