diff --git a/constrain/library/vav_turndown_during_reheat.py b/constrain/library/vav_turndown_during_reheat.py index 9673d21b..28a920a9 100644 --- a/constrain/library/vav_turndown_during_reheat.py +++ b/constrain/library/vav_turndown_during_reheat.py @@ -33,6 +33,8 @@ """ +import logging + from constrain.checklib import RuleCheckBase @@ -44,13 +46,11 @@ class VAVTurndownDuringReheat(RuleCheckBase): ] 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(): + # Check if the `reheat_coil_flag` column has only True/False value + if self.df["reheat_coil_flag"].nunique() == 1: + self.df["result"] = "Untested" + elif (self.df["V_dot_VAV_max"] == 0).any(): + logging.error("Any `V_dot_VAV_max` value shouldn't be zero.") self.df["result"] = "Untested" else: self.df["V_dot_VAV_ratio"] = self.df["V_dot_VAV"] / self.df["V_dot_VAV_max"] diff --git a/constrain/schema/library.json b/constrain/schema/library.json index c4b061dc..f87c1423 100644 --- a/constrain/schema/library.json +++ b/constrain/schema/library.json @@ -1602,7 +1602,7 @@ "description_verification_type": "procedure-based", "assertions_type": "pass", "description_assertions": [ - "if (reheat_coil_flag == False).all():", + "if reheat_coil_flag.nunique() == 1:", " Untested", "else: ", " V_dot_VAV_ratio = V_dot_VAV/V_dot_VAV_max", diff --git a/tests/test_vav_turndown_during_reheat.py b/tests/test_vav_turndown_during_reheat.py index 80e32a31..b97b8523 100644 --- a/tests/test_vav_turndown_during_reheat.py +++ b/tests/test_vav_turndown_during_reheat.py @@ -91,7 +91,7 @@ def test_vav_turndown_during_reheat_fail(self): binary_result = verification_obj.check_bool() self.assertFalse(binary_result) - def test_vav_turndown_during_reheat_untested(self): + def test_vav_turndown_during_reheat_no_reheat_untested(self): points = [ "reheat_coil_flag", "V_dot_VAV", @@ -127,3 +127,77 @@ def test_vav_turndown_during_reheat_untested(self): self.assertEqual(results, expected_results) self.assertEqual(verification_obj.check_bool(), "Untested") + + def test_vav_turndown_during_reheat_all_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 = [ + [True, 350, 620], + [True, 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 = list(verification_obj.result) + expected_results = [ + "Untested", + "Untested", + "Untested", + "Untested", + ] + + self.assertEqual(results, expected_results) + self.assertEqual(verification_obj.check_bool(), "Untested") + + def test_vav_turndown_during_reheat_zero_V_dot_VAV_max_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 = [ + [True, 350, 0], + [True, 370, 0], + [True, 360, 620], + [True, 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")