PRICE-02: the trading verdict skips price periods that have ended
TariffPlan.arbitrage(now=...) drops the points whose period has ended (end <= now), so the cheapest and dearest point can still be traded. decide() (modes off), the modes-on allowed() gate and the Home verdict all pass their own now. Hourly feeds and the static tariff are unchanged. The off-peak sentence and the charge/discharge sentences say "price period". Tests: test_price02.py; test_arbitrage.py rolls its whole-day plans to start at now; test_modes_p3.py part 1 digests leave the trade sentence out (commands unchanged on7a00f12,90bc901and this tree). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
90bc9017b2
commit
4297f7f3f1
@@ -66,21 +66,35 @@ A, B = "inverter-a", "inverter-b"
|
||||
|
||||
# ============================================================================ #
|
||||
print("1. modes off: byte-identical to 7a00f12 on the trade path")
|
||||
# Printed by tools/opt11p3_identity.py on release/1.0 7a00f12 (2026-09-29),
|
||||
# goodwe-addon-checks:1. 1080 cycles each; the trade CHARGEs and DISCHARGEs.
|
||||
# Printed on release/1.0 7a00f12 (2026-09-29), goodwe-addon-checks:1, 1080
|
||||
# cycles each; the trade CHARGEs and DISCHARGEs. PRICE-02 (2026-10-22): the
|
||||
# digest is over every row with the trade's SENTENCE left out (action and
|
||||
# watts stay). The plan now drops price periods that have ended, so the
|
||||
# sentence of a sale quotes a smaller "above the cheapest" figure once the
|
||||
# first cheap period is over, and the idle sentence says "price period".
|
||||
# Re-measured on 7a00f12, on release/1.0 90bc901 and on this tree: the same
|
||||
# four digests, so no command, integrator or allocation moved.
|
||||
AT_7A00F12 = {
|
||||
"n1": "71245b227ca40bada4f71f57ea6154475f4b0bd60239c9ad4f80bffb0094514c",
|
||||
"n2": "56cf28010b06765c29e5479abb815d7503d570b39240d82dfc818efa90c93722",
|
||||
"n1_off": "71245b227ca40bada4f71f57ea6154475f4b0bd60239c9ad4f80bffb0094514c",
|
||||
"n2_off": "56cf28010b06765c29e5479abb815d7503d570b39240d82dfc818efa90c93722",
|
||||
"n1": "2f3cf03655f19a172e83ccae1e1308a8eef9d1023ab632a68b943920b032800d",
|
||||
"n2": "59ba1cbfe33aeca74d96b50dbcfde5337a8f82de0fde598a048afeef46fe64de",
|
||||
"n1_off": "2f3cf03655f19a172e83ccae1e1308a8eef9d1023ab632a68b943920b032800d",
|
||||
"n2_off": "59ba1cbfe33aeca74d96b50dbcfde5337a8f82de0fde598a048afeef46fe64de",
|
||||
}
|
||||
|
||||
|
||||
def _cmd_digest(rows):
|
||||
"""`ident.digest()` over rows whose trade is (action, watts) only."""
|
||||
return ident.digest([r[:-1] + (None if r[-1] is None else r[-1][:2],)
|
||||
for r in rows])
|
||||
|
||||
|
||||
_rows = {k: ident.run(**ident.SCENARIOS[k])[0] for k in AT_7A00F12}
|
||||
_got = {k: ident.digest(v) for k, v in _rows.items()}
|
||||
_got = {k: _cmd_digest(v) for k, v in _rows.items()}
|
||||
for k in AT_7A00F12:
|
||||
print(f" {k} {'same' if _got[k] == AT_7A00F12[k] else 'DIFFERS'} "
|
||||
f"{_got[k][:16]}")
|
||||
check("with battery modes off (option absent or false), every command, "
|
||||
"integrator, allocation and trade sentence equals 7a00f12's, at one "
|
||||
"integrator, allocation and trade action equals 7a00f12's, at one "
|
||||
"inverter and at two", _got == AT_7A00F12)
|
||||
_acts = {r[-1][0] for r in _rows["n2"] if r[-1]}
|
||||
check("...and the runs reach the trade P3 now skips with modes on: a charge "
|
||||
@@ -96,7 +110,7 @@ def _moved(scn, patch):
|
||||
real(c, t)
|
||||
ident._feed = feed
|
||||
try:
|
||||
return ident.digest(ident.run(**ident.SCENARIOS[scn])[0]) \
|
||||
return _cmd_digest(ident.run(**ident.SCENARIOS[scn])[0]) \
|
||||
!= AT_7A00F12[scn]
|
||||
finally:
|
||||
ident._feed = real
|
||||
@@ -112,7 +126,7 @@ def _moved_headroom(scn):
|
||||
real = peakguard.charge_headroom_w
|
||||
peakguard.charge_headroom_w = lambda g: None
|
||||
try:
|
||||
return ident.digest(ident.run(**ident.SCENARIOS[scn])[0]) \
|
||||
return _cmd_digest(ident.run(**ident.SCENARIOS[scn])[0]) \
|
||||
!= AT_7A00F12[scn]
|
||||
finally:
|
||||
peakguard.charge_headroom_w = real
|
||||
|
||||
Reference in New Issue
Block a user