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

Create CI tests for catching warnings thrown by run_analysis.rb #1102

Merged
merged 30 commits into from
Jul 25, 2023
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
22f622f
Check lines of run_analysis output log.
joseph-robertson Jul 14, 2023
3dc9c12
Catch different warnings between projects.
joseph-robertson Jul 14, 2023
8bff94d
Fix strings.
joseph-robertson Jul 14, 2023
cb5c534
Permit more warnings.
joseph-robertson Jul 14, 2023
f0cf4e0
Handle more warnings.
joseph-robertson Jul 14, 2023
f0f2798
Even more warnings.
joseph-robertson Jul 14, 2023
8d4ae88
Typo.
joseph-robertson Jul 15, 2023
85997bb
Catch WH and emissions warnings.
joseph-robertson Jul 16, 2023
06e0592
Merge branch 'develop' into catch-warnings
joseph-robertson Jul 17, 2023
11f797a
Update measure xml.
joseph-robertson Jul 17, 2023
4b42322
Another measure xml update.
joseph-robertson Jul 17, 2023
fe88bda
One more time.
joseph-robertson Jul 17, 2023
11d325d
Latest results.
Jul 17, 2023
e065642
Catch more expected warnings.
joseph-robertson Jul 17, 2023
3a01c72
Catch more expected warnings.
joseph-robertson Jul 18, 2023
a7cc7c1
Latest results.
Jul 18, 2023
edcf090
Catch more expected warnings.
joseph-robertson Jul 18, 2023
a6d42a2
Catch more expected warnings.
joseph-robertson Jul 18, 2023
d8fa21e
Latest results.
Jul 18, 2023
647866a
Catch more warnings.
joseph-robertson Jul 18, 2023
083d259
Merge branch 'catch-warnings' of github.com:NREL/resstock into catch-…
joseph-robertson Jul 18, 2023
ce5c420
Merge branch 'develop' into catch-warnings
joseph-robertson Jul 18, 2023
1f27d5d
Latest results.
Jul 18, 2023
f7e4252
Add more warnings.
joseph-robertson Jul 18, 2023
e67ba2d
Catch and reorganize more warnings.
joseph-robertson Jul 19, 2023
63d05f4
Reorganize warnings.
joseph-robertson Jul 24, 2023
730ffb5
Merge branch 'develop' into catch-warnings
joseph-robertson Jul 24, 2023
bd07e30
Another warning.
joseph-robertson Jul 24, 2023
9bfe850
Move warning messages.
joseph-robertson Jul 24, 2023
5d8685f
Temporarily catch the no emissions factor warning.
joseph-robertson Jul 25, 2023
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
86 changes: 86 additions & 0 deletions test/test_run_analysis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,88 @@ def _assert_and_puts(output, msg, expect_error = true)
end
end

def _verify_outputs(cli_output_log, testing = false)
# Check cli_output.log warnings
File.readlines(cli_output_log).each do |message|
next if message.strip.empty?
next if message.include?('Building ID:')
next if message.include?('[openstudio.measure.OSRunner] <1> Cannot find current Workflow Step')
next if message.include?('[openstudio.model.Surface] <1> Initial area of other surface')
next if _expected_warning_message(message, 'No valid weather file defined in either the osm or osw.')
next if _expected_warning_message(message, 'The model contains existing objects and is being reset.')
next if _expected_warning_message(message, 'HVAC setpoints have been automatically adjusted to prevent periods where the heating setpoint is greater than the cooling setpoint.')
next if _expected_warning_message(message, 'It is not possible to eliminate all HVAC energy use (e.g. crankcase/defrost energy) in EnergyPlus during an unavailable period.')
next if _expected_warning_message(message, 'It is not possible to eliminate all water heater energy use (e.g. parasitics) in EnergyPlus during an unavailable period.')
next if _expected_warning_message(message, 'No space heating specified, the model will not include space heating energy use. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'No space cooling specified, the model will not include space cooling energy use. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'No clothes washer specified, the model will not include clothes washer energy use. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'No clothes dryer specified, the model will not include clothes dryer energy use. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'No dishwasher specified, the model will not include dishwasher energy use. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'No refrigerator specified, the model will not include refrigerator energy use. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'No cooking range specified, the model will not include cooking range/oven energy use. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'Home with unconditioned basement/crawlspace foundation type has both foundation wall insulation and floor insulation.')
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved
next if _expected_warning_message(message, "Foundation type of 'AboveApartment' cannot have a non-zero height. Assuming height is zero.")
next if _expected_warning_message(message, "Both 'occupants' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'occupants' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'occupants' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'ceiling_fan' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'ceiling_fan' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'ceiling_fan' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'clothes_washer' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'clothes_washer' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'clothes_washer' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'clothes_dryer' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'clothes_dryer' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'clothes_dryer' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'dishwasher' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'dishwasher' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'dishwasher' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'cooking_range' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'cooking_range' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'cooking_range' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'hot_water_fixtures' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'hot_water_fixtures' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'hot_water_fixtures' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'plug_loads_other' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'plug_loads_other' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'plug_loads_other' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'lighting_garage' schedule file and weekday fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'lighting_garage' schedule file and weekend fractions provided; the latter will be ignored.")
next if _expected_warning_message(message, "Both 'lighting_garage' schedule file and monthly multipliers provided; the latter will be ignored.")
next if _expected_warning_message(message, 'Could not find state average propane rate based on')
next if _expected_warning_message(message, 'Could not find state average fuel oil rate based on')
next if _expected_warning_message(message, "Specified incompatible corridor; setting corridor position to 'Single Exterior (Front)'.")
next if _expected_warning_message(message, 'DistanceToTopOfWindow is greater than 12 feet; this may indicate incorrect units. [context: /HPXML/Building/BuildingDetails/Enclosure/Windows/Window/Overhangs[number(Depth) > 0]')
next if _expected_warning_message(message, 'Home with conditioned basement has floor insulation.')
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved
next if _expected_warning_message(message, 'Ducts are entirely within conditioned space but there is moderate leakage to the outside. Leakage to the outside is typically zero or near-zero in these situations, consider revising leakage values. Leakage will be modeled as heat lost to the ambient environment.') # FIXME: remove once duct TSVs are refactored
next if _expected_warning_message(message, 'No emissions factor found for Scenario=LRMER_MidCase_15, Type=CO2e, Fuel=Natural Gas.') # FIXME: remove once OS-HPXML has_fuel method is fixed

if !testing
next if _expected_warning_message(message, 'Unable to find sql file at')
shorowit marked this conversation as resolved.
Show resolved Hide resolved
next if _expected_warning_message(message, 'No design condition info found; calculating design conditions from EPW weather data.')
next if _expected_warning_message(message, 'Not calculating emissions because an electricity filepath for at least one emissions scenario could not be located.')
shorowit marked this conversation as resolved.
Show resolved Hide resolved
next if _expected_warning_message(message, 'The garage pitch was changed to accommodate garage ridge >= house ridge')
end
if testing
next if _expected_warning_message(message, 'Could not find County=')
shorowit marked this conversation as resolved.
Show resolved Hide resolved
next if _expected_warning_message(message, 'Battery without PV specified, and no charging/discharging schedule provided; battery is assumed to operate as backup and will not be modeled.')
next if _expected_warning_message(message, "Request for output variable 'Zone People Occupant Count' returned no key values.")
next if _expected_warning_message(message, 'The fraction of heat load served by the second heating system is greater than or equal to 50%.')
joseph-robertson marked this conversation as resolved.
Show resolved Hide resolved
next if _expected_warning_message(message, 'No windows specified, the model will not include window heat transfer. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'No interior lighting specified, the model will not include interior lighting energy use. [context: /HPXML/Building/BuildingDetails]')
next if _expected_warning_message(message, 'No exterior lighting specified, the model will not include exterior lighting energy use. [context: /HPXML/Building/BuildingDetails]')
end

flunk "Unexpected cli_output.log message found: #{message}"
end
end

def _expected_warning_message(message, txt)
return true if message.include?('WARN') && message.include?(txt)

return false
end

def test_version
@command += ' -v'

Expand Down Expand Up @@ -264,6 +346,7 @@ def test_testing_baseline
assert(File.exist?(cli_output_log))
cli_output = File.read(cli_output_log)
_assert_and_puts(cli_output, 'ERROR', false)
_verify_outputs(cli_output_log, true)

_test_measure_order(File.join(@testing_baseline, 'testing_baseline-Baseline.osw'))
results_baseline = File.join(@testing_baseline, 'results-Baseline.csv')
Expand Down Expand Up @@ -297,6 +380,7 @@ def test_national_baseline
assert(File.exist?(cli_output_log))
cli_output = File.read(cli_output_log)
_assert_and_puts(cli_output, 'ERROR', false)
_verify_outputs(cli_output_log)

_test_measure_order(File.join(@national_baseline, 'national_baseline-Baseline.osw'))
results_baseline = File.join(@national_baseline, 'results-Baseline.csv')
Expand Down Expand Up @@ -331,6 +415,7 @@ def test_testing_upgrades
assert(File.exist?(cli_output_log))
cli_output = File.read(cli_output_log)
_assert_and_puts(cli_output, 'ERROR', false)
_verify_outputs(cli_output_log, true)

_test_measure_order(File.join(@testing_upgrades, 'testing_upgrades-Baseline.osw'))
results_baseline = File.join(@testing_upgrades, 'results-Baseline.csv')
Expand Down Expand Up @@ -384,6 +469,7 @@ def test_national_upgrades
assert(File.exist?(cli_output_log))
cli_output = File.read(cli_output_log)
_assert_and_puts(cli_output, 'ERROR', false)
_verify_outputs(cli_output_log)

_test_measure_order(File.join(@national_upgrades, 'national_upgrades-Baseline.osw'))
results_baseline = File.join(@national_upgrades, 'results-Baseline.csv')
Expand Down