diff --git a/goodwe_controller/test_safety83.py b/goodwe_controller/test_safety83.py index 25ce45a..10c77f1 100644 --- a/goodwe_controller/test_safety83.py +++ b/goodwe_controller/test_safety83.py @@ -35,7 +35,8 @@ logging.disable(logging.WARNING) import opt11_identity as rig # noqa: E402 import safety78_identity as s78 # noqa: E402 import safety79_identity as s79 # noqa: E402 -from app.arbiter import Claim, P_MAINTENANCE, P_PEAK # noqa: E402 +from app.arbiter import (Claim, P_MAINTENANCE, P_PEAK, P_SAFETY, # noqa + resolve) from app.main import Controller # noqa: E402 from app.maintenance import CHARGE, DRAIN, MaintResult # noqa: E402 @@ -229,6 +230,15 @@ check("at the boundary: a floor at or below the 2000 W drain stays at P_PEAK, " "a floor 0.5 W above it is refiled at P_MAINTENANCE", _edge == {1999.5: P_PEAK, 2000.0: P_PEAK, 2000.5: P_MAINTENANCE}) +_stop = [Claim.set("maintenance", P_MAINTENANCE, 2000.0, DRAIN), + Claim.limit("peak", P_PEAK, lo=4000.0, reason="quarter peak"), + Claim.set("safety", P_SAFETY, 0.0, "inputs missing")] +Controller._peak_over_drain(_one, _stop, [MaintResult(DRAIN, True, 2000.0, + False, [])]) +check("⭐ and a refiled floor stays under a safety SET: the site resolves " + "to 0 W", _stop[1].priority == P_MAINTENANCE + and resolve(_stop).target_w == 0.0) + def store_hold(): st = rig._Store()