Skip to content

Commit

Permalink
updates include ERV example and revised fc16 logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bbartling committed Sep 3, 2024
1 parent ad84349 commit 8f8905d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
26 changes: 18 additions & 8 deletions open_fdd/air_handling_unit/faults/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ def __init__(self, dict_):
("erv_efficiency_max_cooling", self.erv_efficiency_max_cooling),
("oat_low_threshold", self.oat_low_threshold),
("oat_high_threshold", self.oat_high_threshold),
("oat_rat_delta_min", self.oat_rat_delta_min)
("oat_rat_delta_min", self.oat_rat_delta_min),
]:
if not isinstance(value, float):
raise InvalidParameterError(
Expand Down Expand Up @@ -2195,7 +2195,7 @@ def calculate_erv_efficiency(self, df: pd.DataFrame) -> pd.DataFrame:
print(f"Warning: Zero values found in columns: {cols_to_check}")
print(f"This may cause division by zero errors.")
sys.stdout.flush()

# Calculate the temperature differences
delta_temp_oa = df[self.erv_oat_leaving_col] - df[self.erv_oat_enter_col]
delta_temp_ea = df[self.erv_eat_enter_col] - df[self.erv_oat_enter_col]
Expand Down Expand Up @@ -2226,15 +2226,25 @@ def apply(self, df: pd.DataFrame) -> pd.DataFrame:

# Apply heating fault logic
heating_fault = (
(df["erv_efficiency_oa"] < self.erv_efficiency_min_heating) |
(df["erv_efficiency_oa"] > self.erv_efficiency_max_heating)
) & cold_outside & good_delta_check & fan_on
(
(df["erv_efficiency_oa"] < self.erv_efficiency_min_heating)
| (df["erv_efficiency_oa"] > self.erv_efficiency_max_heating)
)
& cold_outside
& good_delta_check
& fan_on
)

# Apply cooling fault logic
cooling_fault = (
(df["erv_efficiency_oa"] < self.erv_efficiency_min_cooling) |
(df["erv_efficiency_oa"] > self.erv_efficiency_max_cooling)
) & hot_outside & good_delta_check & fan_on
(
(df["erv_efficiency_oa"] < self.erv_efficiency_min_cooling)
| (df["erv_efficiency_oa"] > self.erv_efficiency_max_cooling)
)
& hot_outside
& good_delta_check
& fan_on
)

# Combine the faults
df["combined_checks"] = heating_fault | cooling_fault
Expand Down
1 change: 0 additions & 1 deletion open_fdd/air_handling_unit/faults/shared_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,3 @@ def clean_nan_values(df: pd.DataFrame) -> pd.DataFrame:
print("and has also been forward and backfilled.")
sys.stdout.flush()
return df

1 change: 0 additions & 1 deletion open_fdd/air_handling_unit/reports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ def summarize_fault_times(self, df: pd.DataFrame) -> dict:
return summary



class FaultCodeSixteenReport(BaseFaultReport):
def __init__(self, config):
super().__init__(config, "fc16_flag")
Expand Down
4 changes: 1 addition & 3 deletions open_fdd/tests/ahu/test_ahu_fc16.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ def test_fault_with_insufficient_oat_rat_delta(self):
results = fc16.apply(df)
actual = results["fc16_flag"].sum()
expected = 0 # No fault should be triggered due to insufficient delta
message = (
f"FC16 fault_with_insufficient_oat_rat_delta actual is {actual} and expected is {expected}"
)
message = f"FC16 fault_with_insufficient_oat_rat_delta actual is {actual} and expected is {expected}"
assert actual == expected, message


Expand Down

0 comments on commit 8f8905d

Please sign in to comment.