Skip to content

Commit

Permalink
Add return air damper verification for configuration with direct buil…
Browse files Browse the repository at this point in the history
…ding pressure.
  • Loading branch information
lymereJ committed Jun 21, 2023
1 parent 2d548ce commit bc62021
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Docs
on: [push, pull_request, workflow_dispatch]
on:
push:
branches: [ develop ]
pull_request:
branches: [ '*' ]
jobs:
docs:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ develop ]
branches: [ '*' ]
pull_request:
branches: [ '*' ]

Expand Down
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
2 changes: 2 additions & 0 deletions src/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .G36SimultaneousHeatingCooling import *
from .G36ReturnAirDamperPositionForReliefDamperOrFan import *
from .G36ReturnAirDamperPositionForReturnFanAirflowTracking import *
from .G36ReturnAirDamperPositionForReturnFanDirectBuildingPressure import *
from .G36ReliefAirDamperPositionForReturnFanAirflowTracking import *
from .G36OutdoorAirDamperPositionForReliefDamperOrFan import *
from .G36OutdoorAirDamperPositionForReturnFanAirflowTracking import *
Expand All @@ -39,6 +40,7 @@
"G36SimultaneousHeatingCooling",
"G36ReturnAirDamperPositionForReliefDamperOrFan",
"G36ReturnAirDamperPositionForReturnFanAirflowTracking",
"G36ReturnAirDamperPositionForReturnFanDirectBuildingPressure",
"G36ReliefAirDamperPositionForReturnFanAirflowTracking",
"G36OutdoorAirDamperPositionForReliefDamperOrFan",
"G36OutdoorAirDamperPositionForReturnFanAirflowTracking",
Expand Down
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)

0 comments on commit bc62021

Please sign in to comment.