Complete rule-based energy management logic -- how every minute of the simulation is decided
The Reactive BMS is a rule-based energy management system that runs at 1-minute resolution (1440 steps per day). It is purely reactive -- it makes each decision based only on the current state, with no forward knowledge of future sessions, prices, or PV output.
Every minute, the algorithm asks one question: Is an EV connected right now? This branches into two completely different operating modes with different priorities and constraints.
Resolution
1 min
1440 steps / day
Strategy
Reactive
No lookahead or optimization
Inputs
5 signals
EV, SOC, PV, grid, budget
YES -- EV Connected
Primary goal: deliver maximum power to the EV. The charger does not know how long the driver will stay, so it pushes energy as fast as possible using all available sources.
Step 1: Calculate EV power request
EV requests min(maxAcceptRate, remaining energy x 60) capped by hardware output (230 kW)
Step 2: Fill the request (priority cascade)
Step 3: Battery discharge constraints
Max discharge rate: 150 kW x derating factor
SOC derating: 100% power above 30% SOC, linear ramp to 0% at 20% SOC
Cycle budget: max 300 kWh discharge per day
SOC floor: never below 20% (29 kWh)
Step 4: Trickle recharge (if enabled)
If gridToEV < gridLimit, the spare grid capacity plus any leftover PV recharges the battery while the EV charges.
Capped by: maxChargeRate (80 kW) SOC ceiling (90%)
Status: Enabled
Step 5: PV surplus
Any remaining PV after EV + battery trickle is exported to grid
NO -- Idle (no EV)
Primary goal: recharge battery to target SOC so it is ready for the next session. Secondary: export PV surplus to grid for feed-in revenue.
Grid capped at 50 kW
Total capped at 80 kW
PV surplus after battery --> grid export
Battery is full enough.
All PV output --> grid export
Grid draw = 0 kW
State Update (every minute)
batterySocKwh += chargeKwh - dischargeKwh
totalDischarged += dischargeKwh
gridCost = gridKwh x (EPEX[slot] + fees)
evRevenue = evKwh x 0.59 EUR
wearCost = dischargeKwh x 0.071 EUR
SOC clamped to [20%, 90%]
Real battery management systems reduce discharge power as SOC drops to protect cell voltage. Our model uses a simple two-zone linear derating curve:
Example: SOC at 25%
Derating factor = (25 - 20) / (30 - 20) = 0.50
Effective discharge = 150 x 0.50 = 75 kW
Example: SOC at 80%
Above 30% threshold -- no derating
Effective discharge = 150 x 1.00 = 150 kW
Grid connection limit
80 kWTotal grid import (to EV + to battery) never exceeds this. Physical fuse / DSO contractual limit.
Max discharge rate
150 kWBattery power output to EV. Subject to SOC derating (reduced linearly below derating threshold).
Max charge rate
80 kWTotal power into battery (PV + grid) never exceeds this. BMS / inverter limit. Applies in both idle and trickle modes.
Max hardware output
230 kWCharger hardware limit per connector. Total EV delivery never exceeds this even if sources can provide more.
SOC floor
20% (29 kWh)Battery never discharged below this. Protects LFP cell voltage and longevity.
SOC ceiling
90% (129 kWh)Battery never charged above this. Reduces calendar aging at high SOC.
Daily cycle budget
300 kWh/dayLimits total discharge per day to protect cycle life. At 143 kWh capacity, this is ~2.1 full equivalent cycles/day.
No price awareness
Recharges battery at the same rate regardless of whether EPEX price is 2 ct or 14 ct. An optimizer would buy cheap and discharge during expensive slots.
No session forecasting
Does not anticipate upcoming sessions. Cannot pre-charge battery before a known busy period. Treats every idle minute the same.
No PV forecast
Does not know that solar will be available later. Cannot defer grid recharging to wait for free PV energy.
No grid export optimization
Exports PV surplus passively. Does not strategically store PV for later self-consumption or time grid export to high-price slots.
The EMS Optimizer (coming soon) will address all of these by using lookahead optimization (e.g. rolling horizon MPC or MILP) to minimize total cost while respecting the same physical constraints. The Reactive BMS serves as the baseline to measure how much value the optimizer adds.