Skip to content

Commit c15a7be

Browse files
Merge branch 'master' into geothermal_loop
2 parents d9d8e74 + 8db786f commit c15a7be

File tree

8 files changed

+27
-67
lines changed

8 files changed

+27
-67
lines changed

.github/workflows/config.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
run-unit-tests:
1212
runs-on: ubuntu-latest
1313
container:
14-
image: docker://nrel/openstudio:3.7.0-rc1
14+
image: docker://nrel/openstudio:3.7.0-rc3
1515
steps:
1616
- uses: actions/checkout@v3
1717
with:
@@ -63,7 +63,7 @@ jobs:
6363
run-workflow1-tests:
6464
runs-on: ubuntu-latest
6565
container:
66-
image: docker://nrel/openstudio:3.7.0-rc1
66+
image: docker://nrel/openstudio:3.7.0-rc3
6767
steps:
6868
- uses: actions/checkout@v3
6969
with:
@@ -86,7 +86,7 @@ jobs:
8686
run-workflow2-tests:
8787
runs-on: ubuntu-latest
8888
container:
89-
image: docker://nrel/openstudio:3.7.0-rc1
89+
image: docker://nrel/openstudio:3.7.0-rc3
9090
steps:
9191
- uses: actions/checkout@v3
9292
with:
@@ -115,8 +115,8 @@ jobs:
115115
- name: Install software and run test
116116
shell: pwsh
117117
run: |
118-
$env:OS_VERSION="3.7.0-rc1"
119-
$env:OS_SHA="211bb633b0"
118+
$env:OS_VERSION="3.7.0-rc3"
119+
$env:OS_SHA="37087fd612"
120120
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"
121121
tar -xzf Windows.tar.gz
122122
& .\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

HPXMLtoOpenStudio/measure.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<schema_version>3.1</schema_version>
44
<name>hpxm_lto_openstudio</name>
55
<uid>b1543b30-9465-45ff-ba04-1d1f85e763bc</uid>
6-
<version_id>a578fb13-ffeb-49bf-9e8f-92d8b0d69514</version_id>
7-
<version_modified>2023-11-14T23:26:45Z</version_modified>
6+
<version_id>439b78e6-5517-4d64-94bc-b54dfd43184f</version_id>
7+
<version_modified>2023-11-21T14:12:38Z</version_modified>
88
<xml_checksum>D8922A73</xml_checksum>
99
<class_name>HPXMLtoOpenStudio</class_name>
1010
<display_name>HPXML to OpenStudio Translator</display_name>

ReportSimulationOutput/measure.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,8 @@ def run(runner, user_arguments)
561561
args[:use_dview_format] = false
562562
end
563563

564-
output_dir = File.dirname(runner.lastEpwFilePath.get.to_s)
565-
566564
hpxml_defaults_path = @model.getBuilding.additionalProperties.getFeatureAsString('hpxml_defaults_path').get
565+
output_dir = File.dirname(hpxml_defaults_path)
567566
building_id = @model.getBuilding.additionalProperties.getFeatureAsString('building_id').get
568567
hpxml = HPXML.new(hpxml_path: hpxml_defaults_path, building_id: building_id)
569568

ReportSimulationOutput/measure.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<schema_version>3.1</schema_version>
44
<name>report_simulation_output</name>
55
<uid>df9d170c-c21a-4130-866d-0d46b06073fd</uid>
6-
<version_id>24baa8d8-1e28-4b9b-a3fc-bea5adb1f3e7</version_id>
7-
<version_modified>2023-11-13T18:56:05Z</version_modified>
6+
<version_id>be0a8583-ee3d-4ba1-b96a-5670a43777ae</version_id>
7+
<version_modified>2023-11-17T15:16:05Z</version_modified>
88
<xml_checksum>9BF1E6AC</xml_checksum>
99
<class_name>ReportSimulationOutput</class_name>
1010
<display_name>HPXML Simulation Output Report</display_name>
@@ -1929,7 +1929,7 @@
19291929
<filename>measure.rb</filename>
19301930
<filetype>rb</filetype>
19311931
<usage_type>script</usage_type>
1932-
<checksum>9820E474</checksum>
1932+
<checksum>86EC8E47</checksum>
19331933
</file>
19341934
<file>
19351935
<filename>test_report_sim_output.rb</filename>

ReportUtilityBills/measure.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,9 @@ def run(runner, user_arguments)
237237

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

240-
output_dir = File.dirname(runner.lastEpwFilePath.get.to_s)
241-
242240
hpxml_path = @model.getBuilding.additionalProperties.getFeatureAsString('hpxml_path').get
243241
hpxml_defaults_path = @model.getBuilding.additionalProperties.getFeatureAsString('hpxml_defaults_path').get
242+
output_dir = File.dirname(hpxml_defaults_path)
244243
building_id = @model.getBuilding.additionalProperties.getFeatureAsString('building_id').get
245244
hpxml = HPXML.new(hpxml_path: hpxml_defaults_path, building_id: building_id)
246245

ReportUtilityBills/measure.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<schema_version>3.1</schema_version>
44
<name>report_utility_bills</name>
55
<uid>ca88a425-e59a-4bc4-af51-c7e7d1e960fe</uid>
6-
<version_id>35c428ae-4beb-465f-ba07-e521f7bf46a7</version_id>
7-
<version_modified>2023-11-13T18:23:41Z</version_modified>
6+
<version_id>00195856-fc00-4476-b601-ab53286b33cf</version_id>
7+
<version_modified>2023-11-17T15:16:06Z</version_modified>
88
<xml_checksum>15BF4E57</xml_checksum>
99
<class_name>ReportUtilityBills</class_name>
1010
<display_name>Utility Bills Report</display_name>
@@ -142,7 +142,7 @@
142142
<filename>measure.rb</filename>
143143
<filetype>rb</filetype>
144144
<usage_type>script</usage_type>
145-
<checksum>9F95708E</checksum>
145+
<checksum>4A038500</checksum>
146146
</file>
147147
<file>
148148
<filename>detailed_rates/Sample Flat Rate Min Annual Charge.json</filename>
@@ -322,7 +322,7 @@
322322
<filename>test_report_utility_bills.rb</filename>
323323
<filetype>rb</filetype>
324324
<usage_type>test</usage_type>
325-
<checksum>C1365144</checksum>
325+
<checksum>07F2D0DB</checksum>
326326
</file>
327327
</files>
328328
</measure>

ReportUtilityBills/tests/test_report_utility_bills.rb

+7-9
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,8 @@ def _test_measure(hpxml: nil, expected_errors: [], expected_warnings: [])
12111211

12121212
# Run OSW
12131213
command = "#{OpenStudio.getOpenStudioCLI} run -w #{osw_path}"
1214-
cli_output = `#{command}`
1214+
success = system(command)
1215+
assert(success)
12151216

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

12221223
# Check warnings/errors
1223-
if not expected_errors.empty?
1224-
expected_errors.each do |expected_error|
1225-
assert(cli_output.include?("ERROR] #{expected_error}"))
1226-
end
1224+
log_lines = File.readlines(File.join(File.dirname(template_osw), 'run', 'run.log')).map(&:strip)
1225+
expected_errors.each do |expected_error|
1226+
assert(log_lines.any? { |line| line.include?(' ERROR]') && line.include?(expected_error) })
12271227
end
1228-
if not expected_warnings.empty?
1229-
expected_warnings.each do |expected_warning|
1230-
assert(cli_output.include?("WARN] #{expected_warning}"))
1231-
end
1228+
expected_warnings.each do |expected_warning|
1229+
assert(log_lines.any? { |line| line.include?(' WARN]') && line.include?(expected_warning) })
12321230
end
12331231

12341232
if !hpxml.nil?

tasks.rb

+4-40
Original file line numberDiff line numberDiff line change
@@ -2569,47 +2569,11 @@ def display_usage(command_list)
25692569

25702570
# Update measures XMLs
25712571
puts 'Updating measure.xmls...'
2572-
require 'oga'
25732572
Dir['**/measure.xml'].each do |measure_xml|
2574-
for n_attempt in 1..5 # For some reason CLI randomly generates errors, so try multiple times
2575-
measure_dir = File.dirname(measure_xml)
2576-
command = "#{OpenStudio.getOpenStudioCLI} measure -u '#{measure_dir}'"
2577-
system(command, [:out, :err] => File::NULL)
2578-
2579-
# Check for error
2580-
xml_doc = XMLHelper.parse_file(measure_xml)
2581-
err_val = XMLHelper.get_value(xml_doc, '/measure/error', :string)
2582-
if err_val.nil?
2583-
err_val = XMLHelper.get_value(xml_doc, '/error', :string)
2584-
end
2585-
if err_val.nil?
2586-
break # Successfully updated
2587-
else
2588-
if n_attempt == 5
2589-
fail "#{measure_xml}: #{err_val}" # Error generated all 5 times, fail
2590-
else
2591-
# Remove error from measure XML, try again
2592-
orig_lines = File.readlines(measure_xml)
2593-
new_lines = []
2594-
inside_error = false
2595-
orig_lines.each do |l|
2596-
if l.include? '<error>'
2597-
inside_error = true
2598-
end
2599-
if l.include? '</error>'
2600-
inside_error = false
2601-
next
2602-
end
2603-
next if inside_error
2604-
2605-
new_lines << l
2606-
end
2607-
File.open(measure_xml, 'w') do |file|
2608-
file.puts new_lines
2609-
end
2610-
end
2611-
end
2612-
end
2573+
measure_dir = File.dirname(measure_xml)
2574+
# Using classic to work around https://github.com/NREL/OpenStudio/issues/5045
2575+
command = "#{OpenStudio.getOpenStudioCLI} classic measure -u '#{measure_dir}'"
2576+
system(command, [:out, :err] => File::NULL)
26132577
end
26142578

26152579
puts 'Done.'

0 commit comments

Comments
 (0)