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$.

Historical note
Lasseter (2002) at the University of Wisconsin coined the modern microgrid concept in a CERTS white paper. Hatziargyriou, Asano, Iravani & Marnay (2007) wrote the first comprehensive IEEE Power & Energy Magazine overview. The Parhizi, Lotfi, Khodaei & Bahramirad (2015) review in IEEE Access is the most-cited modern reference. Fathima & Palanisamy (2015) reviewed sizing and energy management specifically. By 2024, the DoE Microgrid Program tracks 450+ operational microgrids in the US, and the IEA sees microgrids as central to both developing- country electrification and developed-country resilience.

Mathematical formulation

MILP with DER co-dispatch and islanding

Notation

SymbolMeaningUnits
$\mathcal{T}$Dispatch periods
$L_t$Total load (critical + non-critical)kW
$L_t^{\mathrm{cr}}$Critical (non-sheddable) loadkW
$\tilde{P}_t^{\mathrm{PV}}$Available PV outputkW
$\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 outputkW
$c_t^{\mathrm{bat}}, d_t^{\mathrm{bat}}$Battery charge/dischargekW
$p_t^{\mathrm{imp}}, p_t^{\mathrm{exp}}$Grid import/exportkW
$u_t^{\mathrm{shed}}$Non-critical load shedkW
$y_t^{\mathrm{isl}}$Islanded binary{0,1}

Objective

$$\min \sum_{t \in \mathcal{T}} \Big[ c^{\mathrm{fuel}} p_t^{\mathrm{gen}} + \pi_t^{\mathrm{imp}} p_t^{\mathrm{imp}} - \pi_t^{\mathrm{exp}} p_t^{\mathrm{exp}} + \rho \, u_t^{\mathrm{shed}} \Big] \qquad \text{(1)}$$

Fuel cost + grid purchase − grid sale + load-shed penalty at VOLL $\rho$.

Constraints

Power balance:

$$p_t^{\mathrm{gen}} + p_t^{\mathrm{PV}} + d_t^{\mathrm{bat}} + p_t^{\mathrm{imp}} = L_t - u_t^{\mathrm{shed}} + c_t^{\mathrm{bat}} + p_t^{\mathrm{exp}} \qquad \text{(2)}$$

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):

$$p_t^{\mathrm{imp}} \le P^{\mathrm{PCC}} (1 - y_t^{\mathrm{isl}}), \quad p_t^{\mathrm{exp}} \le P^{\mathrm{PCC}} (1 - y_t^{\mathrm{isl}}) \qquad \text{(3)}$$

Critical-load floor (must be served even islanded):

$$u_t^{\mathrm{shed}} \le L_t - L_t^{\mathrm{cr}} \qquad \text{(4)}$$

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

30
50
40
0.15
0
Adjust parameters and press Dispatch.

DER dispatch & battery SOC

PV / battery / genset / grid-import dispatch stacked; white line = load; red shaded = islanding window
Battery SOC trajectory (% of capacity)

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.

Refs: Olivares et al. (2014); Parisio & Glielmo (2011).

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.

Refs: Wang, Wang, Xu & Chen (2018); Fang et al. (2012).

Microgrid sizing (techno-economic)

Upstream investment problem: optimal capacities of PV, battery, genset. MILP with outage scenarios. NREL REopt is the standard open tool.

Refs: Hirsch, Parag & Guerrero (2018); Fathima & Palanisamy (2015).

Resilience-constrained operation

Require ≥ X hours of survival in any contingency. Adds a robust constraint over worst-case outage scenarios.

Refs: Hussain, Bui & Kim (2019); Farzin, Fotuhi-Firuzabad & Moeini-Aghtaie (2016).

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.

Refs: Tushar et al. (2014); Zhou et al. (2015).

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.

Refs: Sousa et al. (2019); Mengelkamp et al. (2018) Brooklyn microgrid.

Key references

[1]
Parhizi, S., Lotfi, H., Khodaei, A., & Bahramirad, S. (2015).
“State of the art in research on microgrids: A review.”
IEEE Access, 3, 890–925. doi:10.1109/ACCESS.2015.2443119
[2]
Hatziargyriou, N., Asano, H., Iravani, R., & Marnay, C. (2007).
“Microgrids: An overview of ongoing research, development, and demonstration projects.”
IEEE Power and Energy Magazine, 5(4), 78–94. doi:10.1109/MPAE.2007.376583
[3]
Fathima, A. H., & Palanisamy, K. (2015).
“Optimization in microgrids with hybrid energy systems — a review.”
Renewable and Sustainable Energy Reviews, 45, 431–446. doi:10.1016/j.rser.2015.01.059
[4]
Olivares, D. E., et al. (2014).
“Trends in microgrid control.”
IEEE Transactions on Smart Grid, 5(4), 1905–1919. doi:10.1109/TSG.2013.2295514
[5]
Parisio, A., & Glielmo, L. (2011).
“A mixed integer linear formulation for microgrid economic scheduling.”
2011 IEEE SmartGridComm, 505–510. doi:10.1109/SmartGridComm.2011.6102375
[6]
Hirsch, A., Parag, Y., & Guerrero, J. (2018).
“Microgrids: A review of technologies, key drivers, and outstanding issues.”
Renewable and Sustainable Energy Reviews, 90, 402–411. doi:10.1016/j.rser.2018.03.040
[7]
Farzin, H., Fotuhi-Firuzabad, M., & Moeini-Aghtaie, M. (2016).
“Stochastic energy management of microgrids during unscheduled islanding period.”
IEEE Transactions on Industrial Informatics, 13(3), 1079–1087. doi:10.1109/TII.2016.2646721
[8]
Sousa, T., et al. (2019).
“Peer-to-peer and community-based markets: A comprehensive review.”
Renewable and Sustainable Energy Reviews, 104, 367–378. doi:10.1016/j.rser.2019.01.036
[9]
Tushar, W., et al. (2014).
“Smart microgrid: Optimal joint scheduling for electric vehicles and home appliances.”
IEEE PES General Meeting. doi:10.1109/PESGM.2014.6939520
[10]
Lasseter, R. H. (2002).
“MicroGrids.”
2002 IEEE Power Engineering Society Winter Meeting, 1, 305–308. doi:10.1109/PESW.2002.985003
In-browser solver runs a simplified MILP with priority-based dispatch. Production microgrid controllers use commercial MILP solvers in rolling-horizon MPC.