Dispatch Algorithms: Rule-Based vs. AI
🚀 Module 5: Dispatch & Optimization
Dispatch Algorithms: Rule-Based vs. AI
A dispatch algorithm determines when and how much each controllable resource (battery, generator, curtailable load) should produce or consume at each time step. The choice of algorithm significantly impacts revenue, reliability, and asset lifetime.
Rule-Based Dispatch
Rule-based systems use explicit if-then-else logic defined by engineers. They are transparent, predictable, and easy to audit.
Example: Time-of-Use Arbitrage
// Simple TOU dispatch
if (hour >= 22 || hour < 6) {
// Off-peak: charge battery
setpoint = -maxChargePower;
} else if (hour >= 14 && hour <= 19) {
// Peak: discharge battery
setpoint = maxDischargePower;
} else {
// Mid-peak: hold
setpoint = 0;
}Example: Price-Threshold Dispatch
if (price > discharge_threshold && soc > min_soc) {
dispatch = min(maxDischargePower, (soc - min_soc) * capacity / remaining_peak_hours);
} else if (price < charge_threshold && soc < max_soc) {
dispatch = -min(maxChargePower, (max_soc - soc) * capacity / remaining_offpeak_hours);
} else {
dispatch = 0;
}Advantages: Transparent, deterministic, easy to explain to regulators, no training data required, fast execution.
Disadvantages: Cannot capture complex interactions, requires manual tuning, brittle when conditions change, suboptimal in many scenarios.
Linear Programming (LP) / Mixed-Integer Programming (MIP)
Mathematical optimization formulates dispatch as a constrained optimization problem:
Maximize: Sum over t of (Price_t × Dispatch_t - DegradationCost × |Dispatch_t|)
Subject to:
SOC_min <= SOC_t <= SOC_max (SOC limits)
-P_charge_max <= Dispatch_t <= P_discharge_max (power limits)
SOC_t+1 = SOC_t - Dispatch_t × dt / Capacity × eta (SOC dynamics)
|dDispatch/dt| <= RampRate (ramp rate limits)This produces the globally optimal dispatch schedule given perfect price forecasts. In practice, a rolling horizon approach re-solves every 15-60 minutes with updated forecasts.
Advantages: Provably optimal (given forecasts), handles constraints naturally, well-understood mathematics.
Disadvantages: Requires good forecasts, computational cost increases with problem size, nonlinear degradation models must be linearized.
Model Predictive Control (MPC)
MPC combines optimization with feedback:
- Predict future states over a horizon (e.g., 4 hours ahead) using current state + forecast
- Optimize the control sequence over the prediction horizon
- Apply only the first time step's control action
- Repeat at the next time step with updated measurements
MPC naturally handles forecast uncertainty by re-optimizing frequently. It is the most common advanced dispatch approach in commercial BESS control systems.
Reinforcement Learning (RL)
RL agents learn dispatch policies through trial and error in simulated environments:
- State: Current SOC, time of day, price, solar forecast, load forecast
- Action: Charge rate, discharge rate, or hold
- Reward: Revenue minus degradation cost minus penalty for constraint violations
Popular algorithms: Deep Q-Network (DQN), Proximal Policy Optimization (PPO), Soft Actor-Critic (SAC).
Advantages: Can learn complex nonlinear relationships, adapts to changing conditions, no explicit model required.
Disadvantages: Requires extensive training data/simulation, difficult to explain decisions, may violate constraints during exploration, regulatory acceptance is limited.
Hybrid Approaches
The most practical systems combine methods:
- RL or MPC for the main dispatch schedule
- Rule-based guardrails to enforce hard constraints (SOC limits, ramp rates, warranty limits)
- LP for day-ahead scheduling, with MPC for real-time adjustment
EnergyAtIt supports all three approaches through its dispatch engine, with configurable strategy selection per asset.
Log in to track your progress and earn certifications.