Skip to content

Fuse stack follow-ups after stable: restart credit (#1926) #1938

Open

Description

@frahlg

Follow-ups from the final review of #1926 (head b82e44d) on 28 Oct 2026. None of them makes the PR worse than master or breaks the owner's fuse rule, so they wait until after stable.

  • Restart credit: no test pins evClockAllowance at 5 s
  • Restart credit: a car that drops between the charger's sample and the meter reading
  • Restart credit gives nothing where the fuse allows more than draw plus the latest offer

Restart credit: no test pins evClockAllowance at 5 s

Mutation check at b82e44d: with evClockAllowance at 2 s, every EVBaseAfterRestart, EVFoundDrawW, SiteSimRestart and SiteConsumption test still passes. Only 1 s fails (ChargerClockBehind/3s and the Bounds case 'only a sample older than one control interval'). The PR says the 5 s margin covers a charger clock lag plus meter delay of up to about 5 s, but no test lags more than 3 s. Test idea: add TestSiteSimRestartChargerClockBehind cases at 4 s and 4.5 s lag, which must fail with an allowance of 2-4 s. If the blocking fix replaces the stamp check with Core receipt time, use a 15 s lag case instead, which passes on the prototype.

Restart credit: a car that drops between the charger's sample and the meter reading

Root-cause class behind the blocking finding. evFoundDrawW takes the lowest sample since the counted one, but a drop after the newest sample is not visible until the next sample (10 s for OCPP MeterValues). Even with a one-interval window, a 2 s drop window remains. Sweep evidence at b82e44d (restartSim, PV 0/-3 kW, L2 6/9/12 A, 2 s or 40 s charger, car pause 3-10 s, 10 sample phases, 5,760 cases): 145 cases peak higher with the credit than without. 25 of those reach at least 1.2 x In, and in 15 of them the case without the credit stays below 1.2 x In (in the other 10 it already exceeds 1.2 x In and fails the sim). The rest stay under 1.2 x In, mostly 0.5-2 A higher. Test idea: keep the pause sweep as a table-driven sim test that compares peakA with the credit off and asserts no case passes 1.2 x In where the no-credit run did not. Possible extra guard: when the site's measured consumption has fallen since the sample by about the car's draw, give no credit.

Restart credit gives nothing where the fuse allows more than draw plus the latest offer

PR body, Left open: the rise cap max(max_charge_w, siteFuseMaxW) means a 25 A or 35 A site with a car at 8 kW and a 6 kW latest offer gets zero credit, so seed 207532's discharge to the floor still happens there. This is the owner's trade: trusting max_charge_w gives more credit but reopens the offer-in-force overload from the second review. Test idea: restartSim at 25 A with the seed's numbers. Assert the battery reaches max(5 %, soc_min) no sooner than on the base branch, and record the SoC at 2 min.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions