-
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.
Add return air damper verification for configuration with direct buil…
…ding pressure.
- Loading branch information
Showing
5 changed files
with
117 additions
and
2 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
on: | ||
push: | ||
branches: [ develop ] | ||
branches: [ '*' ] | ||
pull_request: | ||
branches: [ '*' ] | ||
|
||
|
69 changes: 69 additions & 0 deletions
69
src/library/G36ReturnAirDamperPositionForReturnFanDirectBuildingPressure.py
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,69 @@ | ||
""" | ||
G36 2021 | ||
### Description | ||
Section 5.16.2.3 | ||
### Verification Logic | ||
``` | ||
if heating_output > 0 | ||
if abs(ra_p - max_ra_p) < ra_p_tol | ||
pass | ||
else | ||
fail | ||
end | ||
else if cooling_output > 0 | ||
if abs(ra_p - 0) < ra_p_tol | ||
pass | ||
else | ||
fail | ||
end | ||
else 0 < ra_p < max_ra_p | ||
pass | ||
else | ||
fail | ||
end | ||
``` | ||
""" | ||
|
||
import pandas as pd | ||
from checklib import RuleCheckBase | ||
import numpy as np | ||
|
||
|
||
class G36ReturnAirDamperPositionForReturnFanAirflowTracking(RuleCheckBase): | ||
points = [ | ||
"heating_output", | ||
"cooling_output", | ||
"ra_p", | ||
"max_ra_p", | ||
"ra_p_tol", | ||
] | ||
|
||
def return_air_damper(self, data): | ||
if data["heating_output"] > 0: | ||
if abs(data["ra_p"] - data["max_ra_p"]) < data["ra_p_tol"]: | ||
return True | ||
else: | ||
return False | ||
elif data["cooling_output"] > 0: | ||
if data["ra_p"] < data["ra_p_tol"]: | ||
return True | ||
else: | ||
return False | ||
elif 0 < data["ra_p"] < data["max_ra_p"]: | ||
return True | ||
else: | ||
return False | ||
|
||
def verify(self): | ||
self.result = self.df.apply(lambda d: self.return_air_damper(d), axis=1) | ||
|
||
def check_bool(self): | ||
if len(self.result[self.result == False] > 0): | ||
return False | ||
else: | ||
return True |
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
40 changes: 40 additions & 0 deletions
40
tests/TestG36ReturnAirDamperPositionForReturnFanDirectBuildingPressure.py
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,40 @@ | ||
import unittest, sys | ||
|
||
sys.path.append("./src") | ||
from lib_unit_test_runner import * | ||
|
||
import pandas as pd | ||
import numpy as np | ||
|
||
|
||
class TestG36ReturnAirDamperPositionForReturnFanAirflowTracking(unittest.TestCase): | ||
def test_return_air_damper_position(self): | ||
points = [ | ||
"heating_output", | ||
"cooling_output", | ||
"ra_p", | ||
"max_ra_p", | ||
"ra_p_tol", | ||
] | ||
data = [ | ||
[1000, 0, 0.5, 1.0, 0.05], # False | ||
[1000, 0, 0.99, 1.0, 0.05], # True | ||
[0, 1000, 0.5, 1.0, 0.05], # False | ||
[0, 1000, 0.02, 1.0, 0.05], # True | ||
[0, 0, 1.0, 1.0, 0.05], # False | ||
[0, 0, 0, 1.0, 0.05], # False | ||
[0, 0, 0.5, 1.0, 0.05], # True | ||
] | ||
|
||
df = pd.DataFrame(data, columns=points) | ||
|
||
verification_obj = run_test_verification_with_data( | ||
"G36ReturnAirDamperPositionForReturnFanAirflowTracking", df | ||
) | ||
|
||
results = pd.Series(list(verification_obj.result)) | ||
expected_results = pd.Series([False, True, False, True, False, False, True]) | ||
self.assertTrue(results.equals(expected_results)) | ||
|
||
binary_result = verification_obj.check_bool() | ||
self.assertFalse(binary_result) |