Skip to content

Commit

Permalink
replace nan with untested
Browse files Browse the repository at this point in the history
  • Loading branch information
leijerry888 committed Nov 19, 2024
1 parent 08c945e commit c58c290
Show file tree
Hide file tree
Showing 42 changed files with 117 additions and 79 deletions.
4 changes: 2 additions & 2 deletions constrain/library/ExteriorLightingControlDaylightOff.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
ASHRAE 90.1-2022
ASHRAE 90.1-2022
### Description
Section 9.4.1.4.b Daylight OFF control
Expand Down Expand Up @@ -69,7 +69,7 @@ def daylight_off(self, data):
else:
return False
else:
return np.nan
return "Untested"

def verify(self):
self.result = self.df.apply(lambda d: self.daylight_off(d), axis=1)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
ASHRAE 90.1-2022
ASHRAE 90.1-2022
### Description
Section 9.4.1.4.e Occupancy-sensing light reduction control
Expand Down Expand Up @@ -59,7 +59,7 @@ def occupancy_sensing_reduction(self, data):
else:
check = False
else:
check = np.nan # untested
check = "Untested"

if data["o"] >= data["tol_o"]:
self.last_reported_occupancy = data.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class G36CoolingOnlyTerminalBoxCoolingAirflowSetpoint(RuleCheckBase):

def setpoint_in_range(self, operation_mode, zone_state, v_cool_max, v_min, v_spt):
if zone_state.lower().strip() != "cooling":
return np.nan
return "Untested"
match operation_mode.strip().lower():
case "occupied":
cooling_maximum = v_cool_max
Expand All @@ -63,7 +63,7 @@ def setpoint_in_range(self, operation_mode, zone_state, v_cool_max, v_min, v_spt
cooling_minimum = 0
case _:
print("invalid operation mode value")
return np.nan
return "Untested"

if cooling_minimum <= v_spt <= cooling_maximum:
return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class G36CoolingOnlyTerminalBoxDeadbandAirflowSetpoint(RuleCheckBase):

def setpoint_at_minimum(self, operation_mode, zone_state, v_min, v_spt, v_spt_tol):
if zone_state.lower().strip() != "deadband":
return np.nan
return "Untested"
match operation_mode.strip().lower():
case "occupied":
dbmin = v_min
case "cooldown" | "setup" | "warmup" | "setback" | "unoccupied":
dbmin = 0
case _:
print("invalid operation mode value")
return np.nan
return "Untested"

if abs(v_spt - dbmin) <= v_spt_tol:
return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def setpoint_in_range(
self, operation_mode, zone_state, v_cool_max, v_heat_max, v_min, v_spt
):
if zone_state.lower().strip() != "heating":
return np.nan
return "Untested"
match operation_mode.strip().lower():
case "occupied":
heating_max = v_heat_max
Expand All @@ -73,7 +73,7 @@ def setpoint_in_range(
heating_min = 0
case _:
print("invalid operation mode value")
return np.nan
return "Untested"

if heating_min <= v_spt <= heating_max:
return True
Expand Down
2 changes: 1 addition & 1 deletion constrain/library/G36MinOAwEconomizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def ts_verify_logic(self, t):
else:
return False
else:
return np.nan
return "Untested"

def verify(self):
self.result = self.df.apply(lambda t: self.ts_verify_logic(t), axis=1)
4 changes: 2 additions & 2 deletions constrain/library/G36MinOAwoEconomizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ def ts_verify_logic(self, t):
else:
return False
else:
return np.nan
return "Untested"
else:
return np.nan
return "Untested"

def add_timers(self):
low_timer_list = []
Expand Down
4 changes: 2 additions & 2 deletions constrain/library/G36OutputChangeRateLimit.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class G36OutputChangeRateLimit(RuleCheckBase):

def change_rate_check(self, cur, prev, cur_time, prev_time):
if prev is None:
return np.nan
return "Untested"
time_delta = cur_time - prev_time
min_change = time_delta.total_seconds() / 60
allowable_change = min_change * cur["max_rate_of_change_per_min"]
Expand All @@ -53,7 +53,7 @@ def verify(self):
first_flag = True
for cur_time, cur in self.df.iterrows():
if first_flag:
self.result.loc[cur_time] = np.nan
self.result.loc[cur_time] = "Untested"
first_flag = False
else:
self.result.loc[cur_time] = self.change_rate_check(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def setpoint_in_range(
dat_min_spt,
):
if zone_state.lower().strip() != "cooling":
return np.nan
return "Untested"
if dat > dat_min_spt and heating_coil_command > heating_coil_command_tol:
return False
match operation_mode.strip().lower():
Expand All @@ -89,7 +89,7 @@ def setpoint_in_range(
cooling_minimum = 0
case _:
print("invalid operation mode value")
return np.nan
return "Untested"

if cooling_minimum <= v_spt <= cooling_maximum:
return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def setpoint_at_minimum(
dat_min_spt,
):
if zone_state.lower().strip() != "deadband":
return np.nan
return "Untested"
if dat > dat_min_spt and heating_coil_command > heating_coil_command_tol:
return False
match operation_mode.strip().lower():
Expand All @@ -78,7 +78,7 @@ def setpoint_at_minimum(
dbmin = 0
case _:
print("invalid operation mode value")
return np.nan
return "Untested"

if abs(v_spt - dbmin) <= v_spt_tol:
return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def setpoint_in_range(
dat_spt,
):
if zone_state.lower().strip() != "heating":
return np.nan
return "Untested"

match operation_mode.strip().lower():
case "occupied":
Expand All @@ -115,7 +115,7 @@ def setpoint_in_range(
heating_min = v_cool_max
case _:
print("invalid operation mode value")
return np.nan
return "Untested"

if 0 < heating_loop_output <= 50:
if (
Expand All @@ -130,7 +130,7 @@ def setpoint_in_range(
if dat > room_temp + 3 and heating_min <= v_spt <= heating_max:
return True
else:
return np.nan
return "Untested"

def verify(self):
self.result = self.df.apply(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class G36ReheatTerminalBoxHeatingCoilLowerBound(RuleCheckBase):

def heating_coil_working(self, operation_mode, heating_coil_command, dat):
if operation_mode.lower().strip() != "occupied":
return np.nan
return "Untested"
if dat >= 10:
return True
else:
Expand Down
4 changes: 2 additions & 2 deletions constrain/library/G36ReheatTerminalBoxHeatingCoilTracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def verify(self):
self.result = pd.Series(index=self.df.index)
for cur_time, cur in self.df.iterrows():
if cur["operation_mode"].strip().lower() != "heating":
result_flag = np.nan
result_flag = "Untested"
err_start_time = None
err_time = 0
else:
Expand All @@ -80,7 +80,7 @@ def verify(self):
if err_time == 0:
result_flag = True
elif err_time <= 1:
result_flag = np.nan
result_flag = "Untested"
elif err_time > 1:
if (
cur["dat"] - cur["dat_spt"] >= cur["dat_tracking_tol"]
Expand Down
2 changes: 1 addition & 1 deletion constrain/library/G36SupplyAirTemperatureSetpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def supply_air_temperature_setpoint(self, data):
data["t_max"] - data["min_clg_sa_t_sp"]
) / (data["oa_t_min"] - data["oa_t_max"]) + data["t_max"]
if sa_t_sp == -999:
return np.nan
return "Untested"
if abs(sa_t_sp - data["sa_t_sp_ac"]) < data["sa_sp_tol"]:
return True
else:
Expand Down
6 changes: 3 additions & 3 deletions constrain/library/G36TerminalBoxCoolingMinimumAirflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ def setpoint_at_minimum_when_dat_high(
room_temp,
):
if zone_state.lower().strip() != "cooling":
return np.nan
return "Untested"
if ahu_sat_spt <= room_temp:
return np.nan
return "Untested"
match operation_mode.strip().lower():
case "occupied":
airflowmin = v_min
case "cooldown" | "setup" | "warmup" | "setback" | "unoccupied":
airflowmin = 0
case _:
print("invalid operation mode value")
return np.nan
return "Untested"

if v_spt - v_spt_tol > airflowmin:
return False
Expand Down
2 changes: 1 addition & 1 deletion constrain/library/G36TerminalBoxVAVDamperTracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def verify(self):
if err_time == 0:
result_flag = True
elif err_time <= 1:
result_flag = np.nan
result_flag = "Untested"
elif err_time > 1:
if (
cur["v"] - cur["v_spt"] >= cur["v_tracking_tol"]
Expand Down
4 changes: 2 additions & 2 deletions constrain/library/InteriorLightingControlAutomaticFullOff.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
ASHRAE 90.1-2022
ASHRAE 90.1-2022
### Description
Section 9.4.1.1.h Automatic full OFF control
Expand Down Expand Up @@ -73,7 +73,7 @@ def daylight_off(self, data):
else:
check = False
else:
check = np.nan
check = "Untested"

# update last identified occupancy flag if applicable
if data["o"] >= data["tol_o"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def occupied_standby_ventilation_zontrol_control(self, data):
return False
else:
self.last_non_standby_mode_requested_m_oa = data["m_oa_requested_by_system"]
return np.nan
return "Untested"

def verify(self):
self.result = self.df.apply(
Expand Down
4 changes: 2 additions & 2 deletions constrain/library/demand_control_vent.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ def verify(self):
] # filter out data when economizer isn't enabled

if len(df_filtered) == 0:
self.bool_result = np.nan
self.bool_result = "Untested"
self.msg = (
"There is no samples with economizer off and AHU on, result: untested"
)
else:
corr, p_value = pearsonr(df_filtered["no_of_occ"], df_filtered["v_oa"])
if p_value > 0.05:
self.bool_result = np.nan
self.bool_result = "Untested"
self.msg = "correlation p value too large, result: untested"
else:
if corr >= 0.3:
Expand Down
2 changes: 1 addition & 1 deletion constrain/library/heat_pump_supplemental_heat_lockout.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def heating_coil_verification(self, data):

def verify(self):
self.df["C_op"] = self.df["C_ref"] * self.df["C_t_mod"] * self.df["C_ff_mod"]
self.df["result"] = np.nan
self.df["result"] = "Untested"
self.df = self.df.apply(lambda r: self.heating_coil_verification(r), axis=1)
self.result = self.df["result"]
2 changes: 1 addition & 1 deletion tests/api/data/custom_lib/UserProvidedVerificationItem1.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def automatic_oa_damper_check(self, data):
else:
return True
else:
return np.nan
return "Untested"

def verify(self):
self.result = self.df.apply(lambda d: self.automatic_oa_damper_check(d), axis=1)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def automatic_oa_damper_check(self, data):
else:
return True
else:
return np.nan
return "Untested"

def verify(self):
self.result = self.df.apply(lambda d: self.automatic_oa_damper_check(d), axis=1)
4 changes: 2 additions & 2 deletions tests/api/data/custom_lib_aio/custom_lib_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def automatic_oa_damper_check(self, data):
else:
return True
else:
return np.nan
return "Untested"

def verify(self):
self.result = self.df.apply(lambda d: self.automatic_oa_damper_check(d), axis=1)
Expand All @@ -374,7 +374,7 @@ def automatic_oa_damper_check(self, data):
else:
return True
else:
return np.nan
return "Untested"

def verify(self):
self.result = self.df.apply(lambda d: self.automatic_oa_damper_check(d), axis=1)
8 changes: 4 additions & 4 deletions tests/test_demand_control_vent.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_dcv_no_eco_good_time(self):
"DemandControlVentilation", df
)
self.assertTrue(
verification_obj.check_bool() is np.nan,
verification_obj.check_bool() == "Untested",
verification_obj.check_detail()["Message"],
)

Expand All @@ -81,7 +81,7 @@ def test_dcv_no_ahu_good_time(self):
"DemandControlVentilation", df
)
self.assertTrue(
verification_obj.check_bool() is np.nan,
verification_obj.check_bool() == "Untested",
verification_obj.check_detail()["Message"],
)

Expand All @@ -107,7 +107,7 @@ def test_dcv_no_good_time(self):
"DemandControlVentilation", df
)
self.assertTrue(
verification_obj.check_bool() is np.nan,
verification_obj.check_bool() == "Untested",
verification_obj.check_detail()["Message"],
)

Expand All @@ -133,7 +133,7 @@ def test_dcv_high_p(self):
"DemandControlVentilation", df
)
self.assertTrue(
verification_obj.check_bool() is np.nan,
verification_obj.check_bool() == "Untested",
verification_obj.check_detail()["Message"],
)

Expand Down
Loading

0 comments on commit c58c290

Please sign in to comment.