EV-20 review round 1: no 1-phase current on 3 phases after a select; rows for mE, mF, mC
After its own phase select (taken, or with a late read-back), Solar ends the sequence with the lower of the currents for the new phases and the phases the charger reports, and keeps the plan on them; the old phases' current comes back only when no select went out (EV-28's cap). Rows: T19/T33 settle write refused or ignored once and select confirmed late; an exit after a given-up write; shutdown in Off with the 0 A owed; Stop with a refused 0 A and another writer. NoCharger.write_current takes took_s; ev_mode_start text names C1; NL solar_hold wording. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
This commit is contained in:
@@ -895,14 +895,23 @@ class SolarWriter(ManualWriter):
|
||||
and sun is not None
|
||||
and now - before[3] >= sun.pause_s)
|
||||
|
||||
def _seq_want(self, clamp):
|
||||
"""The current that ends a phase change: for the new phases, or for
|
||||
the old ones when the select did not happen."""
|
||||
def _seq_want(self, clamp, n_reported):
|
||||
"""The current that ends a phase change. No select went out (EV-28's
|
||||
cap): the old current, on the old phases. A select went out, taken
|
||||
or not (its read-back may be late): the lower of the current for the
|
||||
new phases and for the phases the charger reports, so nothing meant
|
||||
for 1 phase is ever written on 3 (review round 1, Major 1)."""
|
||||
def want(q):
|
||||
before = self.plan._before
|
||||
if q.get("failed") and before is not None:
|
||||
if q.get("failed") and not q.get("sel") and before is not None:
|
||||
return before[0] if before[0] >= CH.MIN_A else CH.MIN_A
|
||||
return self.amps_out(clamp) or CH.MIN_A
|
||||
a = self.amps_out(clamp) or CH.MIN_A
|
||||
tgt = self.plan.target_w
|
||||
for n in (q.get("n"), n_reported):
|
||||
b = amps_for(tgt, n, clamp) if n in (1, 3) else None
|
||||
if b is not None:
|
||||
a = min(a, max(b, CH.MIN_A))
|
||||
return a
|
||||
return want
|
||||
|
||||
async def _begin_solar(self, drv, r, cur, n, now, tracker) -> None:
|
||||
@@ -1059,12 +1068,21 @@ class SolarWriter(ManualWriter):
|
||||
self.plan.end_switch(False)
|
||||
self.plan.pause()
|
||||
return
|
||||
n_log = len(self.log)
|
||||
await self._advance(drv, r, cur, now, tracker,
|
||||
self._seq_want(clamp), clamp, None)
|
||||
self._seq_want(clamp, r.phases_allowed),
|
||||
clamp, None)
|
||||
if any(x[0] == "phases" for x in self.log[n_log:]):
|
||||
q["sel"] = True # a select went out, taken or not
|
||||
if self.seq is None:
|
||||
# Done when the phases were selected and the current is back;
|
||||
# otherwise the plan returns to its old phases.
|
||||
self.plan.end_switch(not q.get("failed"))
|
||||
# Back on the old phases only when no select went out; after
|
||||
# one the plan keeps the current it wrote (the lower one) and
|
||||
# takes the phases the charger reports from the next cycle.
|
||||
done = not q.get("failed") or bool(q.get("sel"))
|
||||
if done and q.get("sel") and self.sent_a is not None \
|
||||
and self.sent_a >= CH.MIN_A:
|
||||
self.plan.a = min(self.plan.a, self.sent_a)
|
||||
self.plan.end_switch(done)
|
||||
return
|
||||
self._plan_step(sun, now, clamp, n_now, gap)
|
||||
want = self.amps_out(clamp)
|
||||
|
||||
Reference in New Issue
Block a user