Enforce inverter power limits in battery dispatch (charge and discharge) #25
Labels
No labels
bug
decision
docs
enhancement
integration
ops
security
tech-debt
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/BatteryStorageCalculator#25
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
chargeBatteryFromGrid(src/lib/simulation.js:395-404) refills the entire bank in one hour regardless of size, and both discharge paths cap on state/load but never on power. MeanwhilecalculateInverterUtilization(src/lib/quotes.js:309-369) computes continuous-kW limits and the UI warns when peaks exceed them — but the dispatch model ignores the limit, so savings assume energy transfer the hardware cannot deliver.docs/calculation-logic-audit.mdrecords this as a known caveat; nothing tracks fixing it.Fix: thread the modeled system's
inverter.continuousKwintorunHourlySimulationand clamp per-hour charge (gridChargeKwh) and discharge (canDischarge) to it (1-hour steps, so kW ≈ kWh). Charging then spreads across the off-peak window on its own. Apply the same cap inbuildDefaultDemandTargetsso Ultimate demand targets stay consistent. Note the parametric path (src/lib/rates.jsbatteryArbSavings) if it should mirror the cap via a daily-throughput ceiling (continuousKw × window hours).Test: bank of 4+ units with a 5 kW inverter must show charge spread over multiple off-peak hours and discharge clipped at 5 kWh/hour; savings must drop versus the uncapped model for oversized banks.
Acceptance criteria
Relations: relates to #11 (same modeling-depth theme; cycle counting will need the same per-hour flows)
(Audit finding F-04, 2026-07-16 — Severity: Medium, Confidence: High)