Skip to content
Merged
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 energyplus_regressions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NAME = 'energyplus_regressions'
VERSION = '2.1.5'
VERSION = '2.1.6'
2 changes: 2 additions & 0 deletions energyplus_regressions/diffs/table_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def thresh_abs_rel_diff(abs_thresh: float, rel_thresh: float, x: str, y: str) ->
try:
fx = float(x)
fy = float(y)
if fx == fy:
return 0, 0, 'equal'
Comment on lines +103 to +104
Copy link
Collaborator Author

@mitchute mitchute Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely will only ever hit this on 0.0 == 0.0 cases, which is fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Are there cases where this can still fall through and be a divide by zero? I guess maybe not because if one was non-zero then the IF/ELSE a couple lines below would catch the right direction? Yeah, it looks good.

abs_diff = abs(fx - fy)
rel_diff = abs((fx - fy) / fx) if abs(fx) > abs(fy) else abs((fy - fx) / fy)
diff = 'equal'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Bldg DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB **
2018-11-20
17:26:37
- EnergyPlus</title>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body>
<p><a href="#toc" style="float: right">Table of Contents</a></p>
<a name=top></a>
<p>Program Version:<b>EnergyPlus, Version 9.0.1-a7c9cc14ce, YMD=2018.11.20 17:26</b></p>
<p>Tabular Output Report in Format: <b>HTML</b></p>
<p>Building: <b>Bldg</b></p>
<p>Environment: <b>DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB ** </b></p>
<p>Simulation Timestamp: <b>2018-11-20
17:26:37</b></p>
<hr>
<p><a href="#toc" style="float: right">Table of Contents</a></p>
<a name=AnnualBuildingUtilityPerformanceSummary::EntireFacility></a>
<p>Report:<b> Annual Building Utility Performance Summary</b></p>
<p>For:<b> Entire Facility</b></p>
<p>Timestamp: <b>2018-11-20
17:26:37</b></p>
<b>Values gathered over 0.00 hours</b><br><br>
<b>WARNING: THE REPORT DOES NOT REPRESENT A FULL ANNUAL SIMULATION.</b><br><br>
<b></b><br><br>
<b>Site and Source Energy</b><br><br>
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Site and Source Energy-->
<table border="1" cellpadding="4" cellspacing="0">
<tr><td></td>
<td align="right">Total Energy [GJ]</td>
<td align="right">Energy Per Total Building Area [MJ/m2]</td>
<td align="right">Energy Per Conditioned Building Area [MJ/m2]</td>
</tr>
<tr>
<td align="right">Total Site Energy</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
</tr>
<tr>
<td align="right">Net Site Energy</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
</tr>
<tr>
<td align="right">Total Source Energy</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
</tr>
<tr>
<td align="right">Net Source Energy</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
</tr>
</table>
<br><br>
<b>Site to Source Energy Conversion Factors</b><br><br>
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Site to Source Energy Conversion Factors-->
<table border="1" cellpadding="4" cellspacing="0">
<tr><td></td>
<td align="right">Site=>Source Conversion Factor</td>
</tr>
<tr>
<td align="right">Electricity</td>
<td align="right"> 3.167</td>
</tr>
<tr>
<td align="right">Natural Gas</td>
<td align="right"> 1.084</td>
</tr>
</table>
<br><br>
<b>Building Area</b><br><br>
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Building Area-->
<table border="1" cellpadding="4" cellspacing="0">
<tr><td></td>
<td align="right">Area [m2]</td>
</tr>
<tr>
<td align="right">Total Building Area</td>
<td align="right"> 232.26</td>
</tr>
<tr>
<td align="right">Net Conditioned Building Area</td>
<td align="right"> 232.26</td>
</tr>
<tr>
<td align="right">Unconditioned Building Area</td>
<td align="right"> 0.00</td>
</tr>
</table>
<br><br>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Bldg DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB **
2018-11-20
17:26:37
- EnergyPlus</title>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body>
<p><a href="#toc" style="float: right">Table of Contents</a></p>
<a name=top></a>
<p>Program Version:<b>EnergyPlus, Version 9.0.1-a7c9cc14ce, YMD=2018.11.20 17:26</b></p>
<p>Tabular Output Report in Format: <b>HTML</b></p>
<p>Building: <b>Bldg</b></p>
<p>Environment: <b>DENVER CENTENNIAL ANN CLG 1% CONDNS DB=>MWB ** </b></p>
<p>Simulation Timestamp: <b>2018-11-20
17:26:37</b></p>
<hr>
<p><a href="#toc" style="float: right">Table of Contents</a></p>
<a name=AnnualBuildingUtilityPerformanceSummary::EntireFacility></a>
<p>Report:<b> Annual Building Utility Performance Summary</b></p>
<p>For:<b> Entire Facility</b></p>
<p>Timestamp: <b>2018-11-20
17:26:37</b></p>
<b>Values gathered over 0.00 hours</b><br><br>
<b>WARNING: THE REPORT DOES NOT REPRESENT A FULL ANNUAL SIMULATION.</b><br><br>
<b></b><br><br>
<b>Site and Source Energy</b><br><br>
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Site and Source Energy-->
<table border="1" cellpadding="4" cellspacing="0">
<tr><td></td>
<td align="right">Total Energy [GJ]</td>
<td align="right">Energy Per Total Building Area [MJ/m2]</td>
<td align="right">Energy Per Conditioned Building Area [MJ/m2]</td>
</tr>
<tr>
<td align="right">Total Site Energy</td>
<td align="right"> 0.00</td>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These entries have an extra leading space.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
</tr>
<tr>
<td align="right">Net Site Energy</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
</tr>
<tr>
<td align="right">Total Source Energy</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
</tr>
<tr>
<td align="right">Net Source Energy</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
<td align="right"> 0.00</td>
</tr>
</table>
<br><br>
<b>Site to Source Energy Conversion Factors</b><br><br>
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Site to Source Energy Conversion Factors-->
<table border="1" cellpadding="4" cellspacing="0">
<tr><td></td>
<td align="right">Site=>Source Conversion Factor</td>
</tr>
<tr>
<td align="right">Electricity</td>
<td align="right"> 3.167</td>
</tr>
<tr>
<td align="right">Natural Gas</td>
<td align="right"> 1.084</td>
</tr>
</table>
<br><br>
<b>Building Area</b><br><br>
<!-- FullName:Annual Building Utility Performance Summary_Entire Facility_Building Area-->
<table border="1" cellpadding="4" cellspacing="0">
<tr><td></td>
<td align="right">Area [m2]</td>
</tr>
<tr>
<td align="right">Total Building Area</td>
<td align="right"> 232.26</td>
</tr>
<tr>
<td align="right">Net Conditioned Building Area</td>
<td align="right"> 232.26</td>
</tr>
<tr>
<td align="right">Unconditioned Building Area</td>
<td align="right"> 0.00</td>
</tr>
</table>
<br><br>
</body>
</html>
20 changes: 20 additions & 0 deletions energyplus_regressions/tests/diffs/test_table_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ def test_identical_files(self):
self.assertEqual(0, response[7]) # in file 2 but not in file 1
self.assertEqual(0, response[8]) # in file 1 but not in file 2

def test_files_with_different_spaces(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy/paste from test above.

response = table_diff(
self.thresh_dict,
os.path.join(self.diff_files_dir, 'eplustbl_no_diff_different_spaces_base.htm'),
os.path.join(self.diff_files_dir, 'eplustbl_no_diff_different_spaces_mod.htm'),
os.path.join(self.temp_output_dir, 'abs_diff.htm'),
os.path.join(self.temp_output_dir, 'rel_diff.htm'),
os.path.join(self.temp_output_dir, 'math_diff.log'),
os.path.join(self.temp_output_dir, 'summary.htm'),
)
self.assertEqual('', response[0]) # diff status
self.assertEqual(3, response[1]) # count_of_tables
self.assertEqual(0, response[2]) # big diffs
self.assertEqual(0, response[3]) # small diffs
self.assertEqual(17, response[4]) # equals
self.assertEqual(0, response[5]) # string diffs
self.assertEqual(0, response[6]) # size errors
self.assertEqual(0, response[7]) # in file 2 but not in file 1
self.assertEqual(0, response[8]) # in file 1 but not in file 2
Comment on lines +48 to +55
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A completed run and no diffs, excellent.


def test_skips_some_tables(self):
response = table_diff(
self.thresh_dict,
Expand Down
Loading