You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CurrentLimiter β GetMinMaxCurrent() for vehicle-side current limits
CurrentController β some vehicles (Tesla, Fiat) also implement MaxCurrent() to set charge current from the vehicle side
Charge Modes
Mode
Behavior
OFF
Disabled (unless welcome charge)
NOW
Max current immediately
MINPV
Min current when PV surplus; fast if cheap tariff
PV
Ramp current proportional to available solar
Charge States (IEC 61851)
A β not connected
B β connected, not charging
C β connected, charging
The Control Loop (Site.update β runs every N seconds)
1. Update all meters (grid, PV, battery, aux)
2. For each loadpoint: UpdateChargePowerAndCurrents()
3. Calculate site power balance:
sitePower = gridPower + batteryPower + excessDCPower
+ residualPower - auxPower - flexiblePower
4. Apply battery priority rules (prioritySoc, bufferSoc)
5. Get tariff rates
6. For EACH loadpoint: Update(sitePower, ...)
βββ Read charger status
βββ Detect/identify vehicle
βββ Check plan requirements (minSOC, target time)
βββ Check limits (limitSOC, limitEnergy)
βββ MODE switch -> calculate target current
βββ Cap at maxCurrent, respect circuit limits
βββ Send MaxCurrent() to charger
βββ Record metrics
7. Push updates to WebSocket + metrics
The loop is stateless per cycle: always re-reads actual state, calculates
optimal current, sends single command. Resilient to restarts and missed updates.
PV Surplus Charging (pvMaxCurrent in core/loadpoint.go)
1. Read effective min/max current limits
2. Reduce sitePower by battery boost power
3. Consider phase switching (1p <-> 3p) if supported
4. deltaCurrent = powerToCurrent(-sitePower, activePhases)
targetCurrent = effectiveCurrent + deltaCurrent
5. Below minCurrent -> start disable timer (default 3 min)
6. Surplus returns -> start enable timer (default 1 min)
7. Cap at maxCurrent
Battery Priority Rules
Setting
Effect
prioritySoc
Below this: battery charges first, EV gets 0
bufferSoc
Above this: EV can draw from battery reserves
bufferStartSoc
Above this: EV charging can begin even if importing