Skip to content

Commit

Permalink
Merge pull request #79 from NREL/FixPerflogDiff
Browse files Browse the repository at this point in the history
Fix perflog diffs due to runtime
  • Loading branch information
Myoldmopar committed Nov 8, 2021
2 parents d847321 + c110fcd commit 933c3cd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
22 changes: 9 additions & 13 deletions epregressions/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,28 +405,24 @@ def both_files_exist(base_path_a, base_path_b, common_relative_path):
@staticmethod
def diff_perf_log(file_a, file_b, diff_file):
# will do a pretty simple CSV text token comparison, no numeric comparison, and omit some certain patterns
filters = [' Version ', 'YMD=', 'hr ']
tokens_to_skip = [1, 2, 29, 30]
with io.open(file_a, encoding='utf-8') as f_txt_1:
txt1 = f_txt_1.readlines()
with io.open(file_b, encoding='utf-8') as f_txt_2:
txt2 = f_txt_2.readlines()
txt1_cleaned = []
for line in txt1:
tokens = []
for token in line.split(','):
if any([x in token for x in filters]):
tokens.append("***")
else:
tokens.append(token)
tokens = line.split(',')
for i in tokens_to_skip:
if i < len(tokens):
tokens[i] = '***'
txt1_cleaned.append(','.join(tokens))
txt2_cleaned = []
for line in txt2:
tokens = []
for token in line.split(','):
if any([x in token for x in filters]):
tokens.append("***")
else:
tokens.append(token)
tokens = line.split(',')
for i in tokens_to_skip:
if i < len(tokens):
tokens[i] = '***'
txt2_cleaned.append(','.join(tokens))
if txt1_cleaned == txt2_cleaned:
return TextDifferences.EQUAL
Expand Down
2 changes: 1 addition & 1 deletion epregressions/tests/diffs/test_ci_compare_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_main_function(self):
self._write_files_to_both_folders('in.idf', 'base idf content', 'mod idf content')
self._write_files_to_both_folders('eplusout.stdout', 'base standard output', 'mod standard output')
self._write_files_to_both_folders('eplusout.stderr', 'base standard error', 'mod standard error')
self._write_files_to_both_folders('eplusout_perflog.csv', 'a,b,c\nd,e,f', 'a,b,c\nd,e,g')
self._write_files_to_both_folders('eplusout_perflog.csv', 'a,b,c,4\nd,e,f,4', 'a,b,c,4\nq,e,g,3')
with captured_output() as (out, err):
# should fail if we don't have any .end files
main_function(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Program, Version, TimeStamp,Use Coil Direct Solution,Zone Radiant Exchange Algorithm,Override Mode,Number of Timesteps per Hour,Minimum Number of Warmup Days,SuppressAllBeginEnvironmentResets,Minimum System Timestep,MaxZoneTempDiff,MaxAllowedDelTemp,Electricity ABUPS Total [J],Natural Gas ABUPS Total [J],Gasoline ABUPS Total [J],Diesel ABUPS Total [J],Coal ABUPS Total [J],Fuel Oil No 1 ABUPS Total [J],Fuel Oil No 2 ABUPS Total [J],Propane ABUPS Total [J],Other Fuel 1 ABUPS Total [J],Other Fuel 2 ABUPS Total [J],District Cooling ABUPS Total [J],District Heating ABUPS Total [J],Water ABUPS Total [m3],Values Gathered Over [hours],Facility Any Zone Oscillating Temperatures Time [hours],Facility Any Zone Oscillating Temperatures During Occupancy Time [hours],Facility Any Zone Oscillating Temperatures in Deadband Time [hours],Run Time [seconds],Run Time [string],Number of Warnings,Number of Severe,
EnergyPlus, Version 9.4.0-1234567890, YMD=2021.12.02 13:45,False,CarrollMRT,Normal,6,1,False,2.0,0.30,2.0000E-003,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.00,16.32,7.58,0.00,17.66,00hr 00min 18.66sec,6,0,
EnergyPlus, Version 9.4.0-1234567890, YMD=2021.12.02 13:45,False,CarrollMRT,Normal,6,1,False,2.0,0.30,2.0000E-003,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.00,16.32,7.58,0.00,15.66,00hr 00min 18.66sec,6,0,

0 comments on commit 933c3cd

Please sign in to comment.