-
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 simultaneous heating and cooling G36 verification.
- Loading branch information
Showing
3 changed files
with
73 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,42 @@ | ||
""" | ||
G36 2021 | ||
### Description | ||
Section 5.16.2.3 | ||
### Verification logic | ||
```python | ||
if heating_output > 0 and cooling_output > 0 | ||
fail | ||
else | ||
pass | ||
end | ||
``` | ||
""" | ||
import pandas as pd | ||
from checklib import RuleCheckBase | ||
import numpy as np | ||
|
||
|
||
class G36SimultaneousHeatingCooling(RuleCheckBase): | ||
points = ["heating_output", "cooling_output"] | ||
|
||
def simultaneous_heating_and_cooling(self, data): | ||
if data["heating_output"] > 0 and data["cooling_output"]: | ||
return False | ||
else: | ||
return True | ||
|
||
def verify(self): | ||
self.result = self.df.apply( | ||
lambda d: self.simultaneous_heating_and_cooling(d), axis=1 | ||
) | ||
|
||
def check_obool(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
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,29 @@ | ||
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 TestG36SimultaneousHeatingCooling(unittest.TestCase): | ||
def test_heating_cooling(self): | ||
points = ["heating_output", "cooling_output"] | ||
data = [[1000, 0], [1000, 1000], [0, 1000]] | ||
|
||
df = pd.DataFrame(data, columns=points) | ||
|
||
verification_obj = run_test_verification_with_data( | ||
"G36SimultaneousHeatingCooling", df | ||
) | ||
|
||
results = pd.Series(list(verification_obj.result)) | ||
expected_results = pd.Series([True, False, True]) | ||
self.assertTrue(results.equals(expected_results)) | ||
|
||
binary_result = verification_obj.check_bool() | ||
self.assertFalse(binary_result) |