Skip to content

Commit

Permalink
Merge pull request #1545 from NREL/os370rc2
Browse files Browse the repository at this point in the history
Test OS 3.7.0-rc3
  • Loading branch information
shorowit authored Nov 17, 2023
2 parents e9a227e + b5f15f7 commit 8db786f
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 79 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
run-unit-tests:
runs-on: ubuntu-latest
container:
image: docker://nrel/openstudio:3.7.0-rc1
image: docker://nrel/openstudio:3.7.0-rc3
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
run-workflow1-tests:
runs-on: ubuntu-latest
container:
image: docker://nrel/openstudio:3.7.0-rc1
image: docker://nrel/openstudio:3.7.0-rc3
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -86,7 +86,7 @@ jobs:
run-workflow2-tests:
runs-on: ubuntu-latest
container:
image: docker://nrel/openstudio:3.7.0-rc1
image: docker://nrel/openstudio:3.7.0-rc3
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -115,8 +115,8 @@ jobs:
- name: Install software and run test
shell: pwsh
run: |
$env:OS_VERSION="3.7.0-rc1"
$env:OS_SHA="211bb633b0"
$env:OS_VERSION="3.7.0-rc3"
$env:OS_SHA="37087fd612"
Invoke-WebRequest -OutFile Windows.tar.gz -URI "https://github.com/NREL/OpenStudio/releases/download/v${env:OS_VERSION}/OpenStudio-${env:OS_VERSION}+${env:OS_SHA}-Windows.tar.gz"
tar -xzf Windows.tar.gz
& .\OpenStudio-${env:OS_VERSION}+${env:OS_SHA}-Windows\bin\openstudio.exe workflow\run_simulation.rb -x workflow\sample_files\base.xml --hourly ALL --add-component-loads --add-stochastic-schedules
Expand Down
16 changes: 2 additions & 14 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>0b0fdd93-375d-48a7-94c7-141c1253acfc</version_id>
<version_modified>2023-11-14T04:26:24Z</version_modified>
<version_id>ff727cab-96e5-480f-a9a7-78c64755662f</version_id>
<version_modified>2023-11-15T00:52:51Z</version_modified>
<xml_checksum>D8922A73</xml_checksum>
<class_name>HPXMLtoOpenStudio</class_name>
<display_name>HPXML to OpenStudio Translator</display_name>
Expand Down Expand Up @@ -222,18 +222,6 @@
<usage_type>resource</usage_type>
<checksum>63C6A1E2</checksum>
</file>
<file>
<filename>data/g_functions/README.md</filename>
<filetype>md</filetype>
<usage_type>resource</usage_type>
<checksum>3A6546AB</checksum>
</file>
<file>
<filename>data/g_functions/rectangle_5m_v1.0.json</filename>
<filetype>json</filetype>
<usage_type>resource</usage_type>
<checksum>25FFB6A8</checksum>
</file>
<file>
<filename>data/unavailable_periods.csv</filename>
<filetype>csv</filetype>
Expand Down
3 changes: 1 addition & 2 deletions ReportSimulationOutput/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,8 @@ def run(runner, user_arguments)
args[:use_dview_format] = false
end

output_dir = File.dirname(runner.lastEpwFilePath.get.to_s)

hpxml_defaults_path = @model.getBuilding.additionalProperties.getFeatureAsString('hpxml_defaults_path').get
output_dir = File.dirname(hpxml_defaults_path)
building_id = @model.getBuilding.additionalProperties.getFeatureAsString('building_id').get
hpxml = HPXML.new(hpxml_path: hpxml_defaults_path, building_id: building_id)

Expand Down
6 changes: 3 additions & 3 deletions ReportSimulationOutput/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>report_simulation_output</name>
<uid>df9d170c-c21a-4130-866d-0d46b06073fd</uid>
<version_id>24baa8d8-1e28-4b9b-a3fc-bea5adb1f3e7</version_id>
<version_modified>2023-11-13T18:56:05Z</version_modified>
<version_id>be0a8583-ee3d-4ba1-b96a-5670a43777ae</version_id>
<version_modified>2023-11-17T15:16:05Z</version_modified>
<xml_checksum>9BF1E6AC</xml_checksum>
<class_name>ReportSimulationOutput</class_name>
<display_name>HPXML Simulation Output Report</display_name>
Expand Down Expand Up @@ -1929,7 +1929,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>9820E474</checksum>
<checksum>86EC8E47</checksum>
</file>
<file>
<filename>test_report_sim_output.rb</filename>
Expand Down
3 changes: 1 addition & 2 deletions ReportUtilityBills/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,9 @@ def run(runner, user_arguments)

args = get_arguments(runner, arguments(model), user_arguments)

output_dir = File.dirname(runner.lastEpwFilePath.get.to_s)

hpxml_path = @model.getBuilding.additionalProperties.getFeatureAsString('hpxml_path').get
hpxml_defaults_path = @model.getBuilding.additionalProperties.getFeatureAsString('hpxml_defaults_path').get
output_dir = File.dirname(hpxml_defaults_path)
building_id = @model.getBuilding.additionalProperties.getFeatureAsString('building_id').get
hpxml = HPXML.new(hpxml_path: hpxml_defaults_path, building_id: building_id)

Expand Down
8 changes: 4 additions & 4 deletions ReportUtilityBills/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>report_utility_bills</name>
<uid>ca88a425-e59a-4bc4-af51-c7e7d1e960fe</uid>
<version_id>35c428ae-4beb-465f-ba07-e521f7bf46a7</version_id>
<version_modified>2023-11-13T18:23:41Z</version_modified>
<version_id>00195856-fc00-4476-b601-ab53286b33cf</version_id>
<version_modified>2023-11-17T15:16:06Z</version_modified>
<xml_checksum>15BF4E57</xml_checksum>
<class_name>ReportUtilityBills</class_name>
<display_name>Utility Bills Report</display_name>
Expand Down Expand Up @@ -142,7 +142,7 @@
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>9F95708E</checksum>
<checksum>4A038500</checksum>
</file>
<file>
<filename>detailed_rates/Sample Flat Rate Min Annual Charge.json</filename>
Expand Down Expand Up @@ -322,7 +322,7 @@
<filename>test_report_utility_bills.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>C1365144</checksum>
<checksum>07F2D0DB</checksum>
</file>
</files>
</measure>
16 changes: 7 additions & 9 deletions ReportUtilityBills/tests/test_report_utility_bills.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,8 @@ def _test_measure(hpxml: nil, expected_errors: [], expected_warnings: [])

# Run OSW
command = "#{OpenStudio.getOpenStudioCLI} run -w #{osw_path}"
cli_output = `#{command}`
success = system(command)
assert(success)

# Cleanup
File.delete(osw_path)
Expand All @@ -1220,15 +1221,12 @@ def _test_measure(hpxml: nil, expected_errors: [], expected_warnings: [])
bills_monthly_csv = File.join(File.dirname(template_osw), 'run', 'results_bills_monthly.csv')

# Check warnings/errors
if not expected_errors.empty?
expected_errors.each do |expected_error|
assert(cli_output.include?("ERROR] #{expected_error}"))
end
log_lines = File.readlines(File.join(File.dirname(template_osw), 'run', 'run.log')).map(&:strip)
expected_errors.each do |expected_error|
assert(log_lines.any? { |line| line.include?(' ERROR]') && line.include?(expected_error) })
end
if not expected_warnings.empty?
expected_warnings.each do |expected_warning|
assert(cli_output.include?("WARN] #{expected_warning}"))
end
expected_warnings.each do |expected_warning|
assert(log_lines.any? { |line| line.include?(' WARN]') && line.include?(expected_warning) })
end

if !hpxml.nil?
Expand Down
44 changes: 4 additions & 40 deletions tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2559,47 +2559,11 @@ def display_usage(command_list)

# Update measures XMLs
puts 'Updating measure.xmls...'
require 'oga'
Dir['**/measure.xml'].each do |measure_xml|
for n_attempt in 1..5 # For some reason CLI randomly generates errors, so try multiple times
measure_dir = File.dirname(measure_xml)
command = "#{OpenStudio.getOpenStudioCLI} measure -u '#{measure_dir}'"
system(command, [:out, :err] => File::NULL)

# Check for error
xml_doc = XMLHelper.parse_file(measure_xml)
err_val = XMLHelper.get_value(xml_doc, '/measure/error', :string)
if err_val.nil?
err_val = XMLHelper.get_value(xml_doc, '/error', :string)
end
if err_val.nil?
break # Successfully updated
else
if n_attempt == 5
fail "#{measure_xml}: #{err_val}" # Error generated all 5 times, fail
else
# Remove error from measure XML, try again
orig_lines = File.readlines(measure_xml)
new_lines = []
inside_error = false
orig_lines.each do |l|
if l.include? '<error>'
inside_error = true
end
if l.include? '</error>'
inside_error = false
next
end
next if inside_error

new_lines << l
end
File.open(measure_xml, 'w') do |file|
file.puts new_lines
end
end
end
end
measure_dir = File.dirname(measure_xml)
# Using classic to work around https://github.com/NREL/OpenStudio/issues/5045
command = "#{OpenStudio.getOpenStudioCLI} classic measure -u '#{measure_dir}'"
system(command, [:out, :err] => File::NULL)
end

puts 'Done.'
Expand Down

0 comments on commit 8db786f

Please sign in to comment.