Skip to content

Commit 31f4d4f

Browse files
fix: Address code review feedback - add assert_clipped=0 to no-clip tests, remove duplicate if-failed check
Agent-Logs-Url: https://github.com/springfall2008/batpred/sessions/c2b66364-9d11-4c05-8b9f-88095c31c6dd Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com>
1 parent 1e6f573 commit 31f4d4f

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎apps/predbat/tests/test_model.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,7 @@ def run_model_tests(my_predbat):
18741874
reset_rates(my_predbat, import_rate, export_rate)
18751875
reset_inverter(my_predbat)
18761876
# No clipping when pv_ac_limit is above the actual PV output
1877-
failed |= simple_scenario("pv_ac_limit_no_clip", my_predbat, 0, 1.0, assert_final_metric=-export_rate * 24, assert_final_soc=0, with_battery=False, pv_ac_limit=2.0)
1877+
failed |= simple_scenario("pv_ac_limit_no_clip", my_predbat, 0, 1.0, assert_final_metric=-export_rate * 24, assert_final_soc=0, with_battery=False, pv_ac_limit=2.0, assert_clipped=0)
18781878
# Clipping when pv_ac_limit is below the actual PV output (non-hybrid AC-coupled)
18791879
failed |= simple_scenario("pv_ac_limit_ac_clip", my_predbat, 0, 2.0, assert_final_metric=-export_rate * 24 * 1.5, assert_final_soc=0, with_battery=False, pv_ac_limit=1.5, assert_clipped=24 * 0.5)
18801880
# With a load, clipping still applies; load is met from grid when pv is capped
@@ -1890,9 +1890,7 @@ def run_model_tests(my_predbat):
18901890
assert_clipped=24 * 0.5,
18911891
)
18921892
# pv_ac_limit must NOT apply to hybrid inverters (PV is DC-coupled, clipping handled by inverter_limit)
1893-
failed |= simple_scenario("pv_ac_limit_hybrid_ignored", my_predbat, 0, 2.0, assert_final_metric=-export_rate * 24, assert_final_soc=24, with_battery=True, hybrid=True, pv_ac_limit=1.5)
1894-
if failed:
1895-
return failed
1893+
failed |= simple_scenario("pv_ac_limit_hybrid_ignored", my_predbat, 0, 2.0, assert_final_metric=-export_rate * 24, assert_final_soc=24, with_battery=True, hybrid=True, pv_ac_limit=1.5, assert_clipped=0)
18961894

18971895
if failed:
18981896
print("**** ERROR: Some Model tests failed ****")

0 commit comments

Comments
 (0)