-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from pnnl/VAV_turndown_using_average
(2nd) VAV turndown lib item development
- Loading branch information
Showing
4 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
""" | ||
### Description | ||
When a VAV box is in reheat mode, the ratio of V_dot_VAV to V_dot_VAV_max should be higher than when it isn't in reheat mode | ||
### Code requirement | ||
- Code Name: ASHRAE 90.1 | ||
- Code Year: 2016 | ||
- Code Section: 6.5.2 Simultaneous Heating and Cooling Limitation | ||
- Code Subsection: 6.5.2.1 Zone Controls | ||
### Verification Approach | ||
- We aim to identify how VAV airflow rate varies when the VAV box is and isn't in reheat mode. | ||
### Verification logic | ||
``` | ||
if (reheat_coil_flag == False).all(): | ||
Untested | ||
else: | ||
V_dot_VAV_ratio = V_dot_VAV/V_dot_VAV_max | ||
mean_reheat_ratio = df.loc[self.df[`reheat_coil_flag`], `V_dot_VAV_ratio`].mean() | ||
mean_no_reheat_ratio = df.loc[~self.df[`reheat_coil_flag`], `V_dot_VAV_ratio`].mean() | ||
if mean_reheat_ratio < mean_no_reheat_ratio: | ||
pass | ||
else: | ||
fail | ||
``` | ||
### Data requirements | ||
- reheat_coil_flag: VAV box reheat coil operation status | ||
- V_dot_VAV: actual VAV volume flow | ||
- V_dot_VAV_max: max VAV volume flow | ||
""" | ||
|
||
from constrain.checklib import RuleCheckBase | ||
|
||
|
||
class VAVTurndownDuringReheat(RuleCheckBase): | ||
points = [ | ||
"reheat_coil_flag", | ||
"V_dot_VAV", | ||
"V_dot_VAV_max", | ||
] | ||
|
||
def verify(self): | ||
# Make sure every value in `V_dot_VAV_max` is greater than 0 | ||
assert ( | ||
self.df["V_dot_VAV_max"] > 0 | ||
).all(), "Not all `V_dot_VAV_max` values are greater than 0" | ||
|
||
# Check if the `reheat_coil_flag` column has only False values | ||
if (self.df["reheat_coil_flag"] == False).all(): | ||
self.df["result"] = "Untested" | ||
else: | ||
self.df["V_dot_VAV_ratio"] = self.df["V_dot_VAV"] / self.df["V_dot_VAV_max"] | ||
|
||
# Calculate the mean ratios for reheat and no reheat conditions | ||
mean_reheat_ratio = self.df.loc[ | ||
self.df["reheat_coil_flag"], "V_dot_VAV_ratio" | ||
].mean() | ||
mean_no_reheat_ratio = self.df.loc[ | ||
~self.df["reheat_coil_flag"], "V_dot_VAV_ratio" | ||
].mean() | ||
self.df["result"] = mean_reheat_ratio < mean_no_reheat_ratio | ||
|
||
self.result = self.df["result"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import sys | ||
import unittest | ||
|
||
sys.path.append("./constrain") | ||
import datetime | ||
|
||
import pandas as pd | ||
from lib_unit_test_runner import * | ||
|
||
|
||
class TestVAVTurndown(unittest.TestCase): | ||
def test_vav_turndown_during_reheat_pass(self): | ||
points = [ | ||
"reheat_coil_flag", | ||
"V_dot_VAV", | ||
"V_dot_VAV_max", | ||
] | ||
|
||
timestamp = [ | ||
datetime(2024, 8, 1, 12, 0, 0), | ||
datetime(2024, 8, 1, 13, 0, 0), | ||
datetime(2024, 8, 1, 14, 0, 0), | ||
datetime(2024, 8, 1, 15, 0, 0), | ||
] | ||
|
||
data = [ | ||
[True, 350, 620], | ||
[True, 370, 620], | ||
[False, 360, 620], | ||
[False, 380, 620], | ||
] | ||
|
||
df = pd.DataFrame(data, columns=points, index=timestamp) | ||
|
||
verification_obj = run_test_verification_with_data( | ||
"VAVTurndownDuringReheat", df | ||
) | ||
|
||
results = pd.Series(list(verification_obj.result)) | ||
expected_results = pd.Series( | ||
[ | ||
True, | ||
True, | ||
True, | ||
True, | ||
] | ||
) | ||
self.assertTrue(results.equals(expected_results)) | ||
|
||
binary_result = verification_obj.check_bool() | ||
self.assertTrue(binary_result) | ||
|
||
def test_vav_turndown_during_reheat_fail(self): | ||
points = [ | ||
"reheat_coil_flag", | ||
"V_dot_VAV", | ||
"V_dot_VAV_max", | ||
] | ||
|
||
timestamp = [ | ||
datetime(2024, 8, 1, 12, 0, 0), | ||
datetime(2024, 8, 1, 13, 0, 0), | ||
datetime(2024, 8, 1, 14, 0, 0), | ||
datetime(2024, 8, 1, 15, 0, 0), | ||
] | ||
|
||
data = [ | ||
[False, 350, 620], | ||
[False, 370, 620], | ||
[True, 360, 620], | ||
[True, 380, 620], | ||
] | ||
|
||
df = pd.DataFrame(data, columns=points, index=timestamp) | ||
|
||
verification_obj = run_test_verification_with_data( | ||
"VAVTurndownDuringReheat", df | ||
) | ||
|
||
results = pd.Series(list(verification_obj.result)) | ||
expected_results = pd.Series( | ||
[ | ||
False, | ||
False, | ||
False, | ||
False, | ||
] | ||
) | ||
self.assertTrue(results.equals(expected_results)) | ||
|
||
binary_result = verification_obj.check_bool() | ||
self.assertFalse(binary_result) | ||
|
||
def test_vav_turndown_during_reheat_untested(self): | ||
points = [ | ||
"reheat_coil_flag", | ||
"V_dot_VAV", | ||
"V_dot_VAV_max", | ||
] | ||
|
||
timestamp = [ | ||
datetime(2024, 8, 1, 12, 0, 0), | ||
datetime(2024, 8, 1, 13, 0, 0), | ||
datetime(2024, 8, 1, 14, 0, 0), | ||
datetime(2024, 8, 1, 15, 0, 0), | ||
] | ||
|
||
data = [ | ||
[False, 350, 620], | ||
[False, 370, 620], | ||
[False, 360, 620], | ||
[False, 380, 620], | ||
] | ||
|
||
df = pd.DataFrame(data, columns=points, index=timestamp) | ||
|
||
verification_obj = run_test_verification_with_data( | ||
"VAVTurndownDuringReheat", df | ||
) | ||
results = list(verification_obj.result) | ||
expected_results = [ | ||
"Untested", | ||
"Untested", | ||
"Untested", | ||
"Untested", | ||
] | ||
|
||
self.assertEqual(results, expected_results) | ||
self.assertEqual(verification_obj.check_bool(), "Untested") |