Microgrid Operation
MILP · Islanded / Grid-Connected
DER Dispatch · Storage · Grid Exchange
A microgrid is a local cluster of distributed energy resources (DERs) — rooftop solar, a diesel genset, a battery, flexible loads — that can operate either connected to the main grid or islanded when the main grid fails. The operator solves a MILP every 15 minutes: how much to generate locally, how much to draw from or export to the grid, when to charge/discharge the battery, and whether to shed any non-critical load. Islanded mode adds a hard self-sufficiency constraint. Parhizi et al. (2015) give the authoritative review; Hatziargyriou et al. (2007) wrote the seminal IEEE primer.
The problem
Local DER coordination with grid fallback
Microgrids sit at the distribution level: a university campus, a military base, an industrial park, a remote Alaskan village. They range from 100 kW (small commercial) to 50+ MW (university or naval base). The defining feature is islanding capability: the microgrid controller can disconnect from the main grid at a point of common coupling (PCC) and operate autonomously, keeping critical loads served even when the main grid is down. This is why hospitals, data centers, and military sites invest in microgrids — resilience against macro-grid outages.
The operational problem is a mixed-integer linear program. Decision variables: power output of each generator, charge/discharge of each battery, grid import/export, load curtailment. Binary variables: generator on/off status, islanding mode (connected vs disconnected). Objective: minimize total operating cost (fuel + grid import − grid export revenue + load-shed penalty). Constraints: DER capacities, storage SOC dynamics, power balance, PCC flow limits, and — in islanded mode — zero grid exchange forced by $x^{\mathrm{isl}} = 1$.
Mathematical formulation
MILP with DER co-dispatch and islanding
Notation
| Symbol | Meaning | Units |
|---|---|---|
| $\mathcal{T}$ | Dispatch periods | — |
| $L_t$ | Total load (critical + non-critical) | kW |
| $L_t^{\mathrm{cr}}$ | Critical (non-sheddable) load | kW |
| $\tilde{P}_t^{\mathrm{PV}}$ | Available PV output | kW |
| $\pi_t^{\mathrm{imp}}, \pi_t^{\mathrm{exp}}$ | Grid import/export tariff | $/kWh |
| $c^{\mathrm{fuel}}$ | Genset fuel cost | $/kWh |
| $p_t^{\mathrm{gen}}$ | Genset output | kW |
| $c_t^{\mathrm{bat}}, d_t^{\mathrm{bat}}$ | Battery charge/discharge | kW |
| $p_t^{\mathrm{imp}}, p_t^{\mathrm{exp}}$ | Grid import/export | kW |
| $u_t^{\mathrm{shed}}$ | Non-critical load shed | kW |
| $y_t^{\mathrm{isl}}$ | Islanded binary | {0,1} |
Objective
Fuel cost + grid purchase − grid sale + load-shed penalty at VOLL $\rho$.
Constraints
Power balance:
PV availability: $p_t^{\mathrm{PV}} \le \tilde{P}_t^{\mathrm{PV}}$ (curtailment allowed). Battery SOC: $e_{t+1} = e_t + \eta^c c_t^{\mathrm{bat}} - d_t^{\mathrm{bat}}/\eta^d$, $E^{\min} \le e_t \le E^{\max}$.
Islanding constraint (the key binary coupling):
Critical-load floor (must be served even islanded):
Complexity
Small, fast MILP: 24 periods $\times$ 4 DERs $\approx$ 100 continuous + 24 binary variables. Solves in <1 s on commodity solvers. Deployed as rolling-horizon MPC on real microgrid controllers.
Real-world data
US DoE Microgrid Program
DoE Microgrid tracks 450+ operational US microgrids with open documentation on design, deployment, and operation.
NREL REopt tool + example cases
NREL REopt provides free techno-economic optimization for microgrids, including reference data for PV, battery, genset costs and operations.
Illustrative case (this page)
100-kW peak campus microgrid with 30-kW rooftop PV, 50-kWh battery, 40-kW diesel genset, grid connection, and 5% critical load. 24-hour MILP rolling dispatch.
Interactive solver
24-hour microgrid MILP with optional islanding window
Microgrid parameters
DER dispatch & battery SOC
Solution interpretation
The dispatch stack shows where each kW comes from. On a sunny day without islanding: PV fills midday, battery absorbs excess midday and releases evening, genset runs only if grid import is expensive enough. During an islanding window (shaded red), grid-import is forced to zero; the microgrid must self-sufficiency with PV + battery + genset — the genset often becomes the marginal resource, raising cost dramatically.
Battery SOC trajectory tells the storage strategy: if the operator expects an islanding event, the policy pre-charges the battery in the hours leading up to the outage. A properly-sized microgrid can ride through 4–8 hours of outage without any load shed; larger batteries + more genset capacity extend this.
Key trade-offs revealed: oversized PV is cheap but has zero value at night; oversized battery is costly per kWh of resilience; genset is cheap in capex but expensive to run. Optimal sizing balances all three against probability-weighted outage exposure. This is the core of the techno-economic microgrid design problem solved by NREL REopt and similar tools.
Extensions & variants
Stochastic microgrid MPC
Uncertain PV output and outage timing. Two-stage stochastic MILP with scenario-based load/generation forecasts. Solves every 15 minutes in rolling-horizon mode.
Networked microgrids
Multiple microgrids that can exchange power at a distribution-feeder level. Hierarchical optimization: each microgrid local MPC, upper-level distribution system operator coordinates exchanges.
Microgrid sizing (techno-economic)
Upstream investment problem: optimal capacities of PV, battery, genset. MILP with outage scenarios. NREL REopt is the standard open tool.
Resilience-constrained operation
Require ≥ X hours of survival in any contingency. Adds a robust constraint over worst-case outage scenarios.
EV-integrated microgrids
Campus microgrid where EV charging stations are dispatchable loads. Smart charging schedules coordinate with PV output. Vehicle-to-grid (V2G) adds bidirectional power flow.
Transactive / peer-to-peer microgrids
Neighbors in a residential microgrid trade PV surplus via smart contracts. Double-auction or negotiation-based mechanisms. Active research in blockchain + power systems.