-
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.
- Loading branch information
1 parent
cb640e7
commit 99ec069
Showing
3 changed files
with
137 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
""" | ||
G36 2021 | ||
### Description | ||
Section 5.16.1.1, | ||
- a. Supply fan shall run when system is in the Cooldown Mode, Setup Mode, or Occupied Mode. | ||
- b. If there are any VAV-reheat boxes on perimeter zones, supply fan shall also run when system is in Setback Mode or Warmup Mode (i.e., all modes except unoccupied). | ||
### Verification logic | ||
```python | ||
if has_reheat_box_on_perimeter_zones == True: | ||
if sys_mode != 'unoccupied' and supply_fan_status == 'off': | ||
fail | ||
else: | ||
if sys_mode in ['occupied', 'setup', 'cooldown'] and supply_fan_staus == 'off': | ||
fail | ||
if ['occupied', 'unoccupied'] in sys_mode: | ||
pass | ||
else: | ||
untested | ||
``` | ||
""" | ||
import pandas as pd | ||
from checklib import RuleCheckBase | ||
import numpy as np | ||
|
||
|
||
class G36SupplyFanStatus(RuleCheckBase): | ||
points = ["sys_mode", "supply_fan_status", "has_reheat_box_on_perimeter_zones"] | ||
|
||
def ts_verify_logic(self, t): | ||
if bool(t["has_reheat_box_on_perimeter_zones"]): | ||
if (t["sys_mode"].strip().lower() != "unoccupied") and ( | ||
not bool(t["supply_fan_status"]) | ||
): | ||
return False | ||
return True | ||
else: | ||
if ( | ||
t["sys_mode"].strip().lower() in ["occupied", "setup", "cooldown"] | ||
) and (not bool(t["supply_fan_status"])): | ||
return False | ||
return True | ||
|
||
def verify(self): | ||
self.result = self.df.apply(lambda t: self.ts_verify_logic(t), axis=1) | ||
|
||
def check_bool(self): | ||
if len(self.result[self.result == False] > 0): | ||
return False | ||
else: | ||
obs_modes = [s.lower().strip() for s in list(self.df["sys_mode"].unique())] | ||
if ("occupied" in obs_modes) and ("unoccupied" in obs_modes): | ||
return True | ||
else: | ||
return "Untested" |
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,73 @@ | ||
import unittest, sys | ||
import datetime | ||
|
||
sys.path.append("./src") | ||
from lib_unit_test_runner import * | ||
from library import * | ||
|
||
import json | ||
import pandas as pd | ||
import numpy as np | ||
|
||
|
||
class TestG36SupplyFanStatus(unittest.TestCase): | ||
def test_supply_fan_pass(self): | ||
points = ["sys_mode", "supply_fan_status", "has_reheat_box_on_perimeter_zones"] | ||
data = [ | ||
["occupied", True, True], | ||
["unoccupied", False, True], | ||
["setup", True, True], | ||
] | ||
|
||
df = pd.DataFrame(data, columns=points) | ||
|
||
verification_obj = run_test_verification_with_data("G36SupplyFanStatus", df) | ||
|
||
results = pd.Series(list(verification_obj.result)) | ||
expected_results = pd.Series([True, True, True]) | ||
self.assertTrue(results.equals(expected_results)) | ||
|
||
binary_result = verification_obj.check_bool() | ||
self.assertTrue(binary_result) | ||
|
||
def test_supply_fan_fail(self): | ||
points = ["sys_mode", "supply_fan_status", "has_reheat_box_on_perimeter_zones"] | ||
data = [ | ||
["occupied", False, False], | ||
["unoccupied", True, False], | ||
["setup", False, False], | ||
] | ||
|
||
df = pd.DataFrame(data, columns=points) | ||
|
||
verification_obj = run_test_verification_with_data("G36SupplyFanStatus", df) | ||
|
||
results = pd.Series(list(verification_obj.result)) | ||
expected_results = pd.Series([False, True, False]) | ||
self.assertTrue(results.equals(expected_results)) | ||
|
||
binary_result = verification_obj.check_bool() | ||
self.assertFalse(binary_result) | ||
|
||
def test_supply_fan_untest(self): | ||
points = ["sys_mode", "supply_fan_status", "has_reheat_box_on_perimeter_zones"] | ||
data = [ | ||
["occupied", True, False], | ||
["occupied", True, False], | ||
["setup", True, False], | ||
] | ||
|
||
df = pd.DataFrame(data, columns=points) | ||
|
||
verification_obj = run_test_verification_with_data("G36SupplyFanStatus", df) | ||
|
||
results = pd.Series(list(verification_obj.result)) | ||
expected_results = pd.Series([True, True, True]) | ||
self.assertTrue(results.equals(expected_results)) | ||
|
||
binary_result = verification_obj.check_bool() | ||
self.assertTrue(binary_result == "Untested") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |