Microgrid Economic Optimization: Sizing, Dispatch, and Lifecycle Cost Analysis

Published: June 2026 Technical Level: Advanced Category: Power Systems Design


Abstract

Microgrid economic optimization is a two-level engineering problem: the planning-level problem of sizing the generation and storage assets to minimize the lifecycle cost of meeting the load reliability requirements, and the operational-level problem of dispatching those assets in real time to minimize energy cost while maintaining reserve and reliability constraints. These two problems are coupled — the optimal asset sizing depends on the dispatch strategy that will be used, and the dispatch optimization is constrained by the assets that were installed. This paper develops the mixed-integer linear programming (MILP) formulation for the planning problem, the model predictive control (MPC) formulation for the operational dispatch problem, and the levelized cost of energy (LCOE) and net present value (NPV) framework that translates physical performance into economic metrics. A complete optimization is performed for a 2 MW commercial-industrial microgrid evaluating solar PV, battery storage, and natural gas generation against utility purchase, with sensitivity analysis on the key economic drivers.


1. Introduction

The economic case for a microgrid rests on multiple value streams that must be quantified individually and summed: reduced energy cost through on-site generation and storage arbitrage, reduced demand charges through peak shaving, avoided outage costs through islanding capability, and where applicable, revenue from grid services such as demand response and frequency regulation. The capital and operating costs of the microgrid assets must be weighed against the present value of these benefits over the system's economic life, typically 20 to 25 years.

The complexity of the optimization arises because the value streams interact through shared physical constraints. The battery used for peak shaving is the same battery used for energy arbitrage, islanding backup, and frequency regulation; its capacity must be allocated among these competing uses, and the optimal allocation depends on the relative value of each. A battery that is fully discharged for energy arbitrage in the afternoon is unavailable for an unexpected evening outage. The optimization must therefore co-optimize the asset sizing and the dispatch strategy, accounting for the probabilistic nature of outages and the deterministic nature of the rate structure.


The temporal mismatch that drives storage sizing and dispatch is shown in Figure 1, which overlays the PV generation profile on the building load profile for a representative summer weekday.

Representative summer-weekday PV generation and building load profiles over a 24-hour horizon, illustrating the temporal mismatch between solar output and demand.

Figure 1. Representative summer-weekday PV generation and building load profiles over a 24-hour horizon, illustrating the temporal mismatch between solar output and demand.

The figure exposes the central economic problem the controller must solve: PV output peaks near midday while the building load peaks in the morning and again in the early evening, so the surplus generated between roughly 10:00 and 16:00 has no coincident load to serve. This is the energy that storage captures for the evening peak, and the area between the two curves during the midday window sets the lower bound on usable battery capacity. An operator reading this figure understands immediately why a PV-only system cannot meet the evening demand peak and why dispatch optimization, not raw generation capacity, governs the economics.

2. Planning-Level Sizing Optimization

2.1 MILP Formulation

The asset sizing problem minimizes the total annualized cost — the sum of the annualized capital cost of the installed assets and the annual operating cost under optimal dispatch — subject to the load-serving and reliability constraints. The decision variables are the installed capacities of each asset type (solar PV in kW, battery power in kW and energy in kWh, generator capacity in kW) and the binary commitment and continuous dispatch variables for each hour of a representative annual operating profile.

The objective function is:

min[aACRFaCaxa+t=18760(cgrid(t)Pgrid(t)+cfuelFgen(t))Δt+CdemandPpeak]\min \left[ \sum_{a \in \mathcal{A}} CRF_a \cdot C_a \cdot x_a + \sum_{t=1}^{8760} \left( c_{grid}(t) \cdot P_{grid}(t) + c_{fuel} \cdot F_{gen}(t) \right) \Delta t + C_{demand} \cdot P_{peak} \right]

Where: A\mathcal{A} is the set of asset types being sized (PV, battery power, battery energy, generator).

CRFaCRF_a is the capital recovery factor for asset aa, converting capital cost to annualized cost.

CaC_a is the unit capital cost of asset aa in dollars per unit capacity.

xax_a is the installed capacity of asset aa (the sizing decision variable).

cgrid(t)c_{grid}(t) is the time-of-use energy price at hour tt in dollars per kWh.

Pgrid(t)P_{grid}(t) is the grid import power at hour tt in kW.

cfuelc_{fuel} is the fuel cost in dollars per unit of generator fuel.

Fgen(t)F_{gen}(t) is the generator fuel consumption at hour tt.

CdemandC_{demand} is the demand charge in dollars per kW-month.

PpeakP_{peak} is the maximum grid import demand over the billing period in kW.

The capital recovery factor converts the upfront capital cost to an equivalent annual cost over the asset life:

CRFa=r(1+r)na(1+r)na1CRF_a = \frac{r(1+r)^{n_a}}{(1+r)^{n_a} - 1}

Where: rr is the discount rate (weighted average cost of capital).

nan_a is the economic life of asset aa in years.

2.2 Constraints

The optimization is subject to the power balance constraint at every hour, the asset operating constraints (battery state-of-charge limits, generator minimum loading, solar availability from the resource profile), and the reliability constraint that the microgrid must be able to serve the critical load during the design outage duration without grid import. The power balance constraint is:

PPV(t)+Pgen(t)+Pbatt,dis(t)+Pgrid(t)=Pload(t)+Pbatt,chg(t)P_{PV}(t) + P_{gen}(t) + P_{batt,dis}(t) + P_{grid}(t) = P_{load}(t) + P_{batt,chg}(t)

Where: PPV(t)P_{PV}(t) is the solar generation at hour tt, bounded by the installed PV capacity and the solar resource.

Pgen(t)P_{gen}(t) is the generator output at hour tt.

Pbatt,dis(t)P_{batt,dis}(t), Pbatt,chg(t)P_{batt,chg}(t) are the battery discharge and charge powers at hour tt.

Pload(t)P_{load}(t) is the facility load at hour tt.

Beyond the hourly power balance, the formulation enforces the asset operating constraints that make the dispatch physically realizable. The battery state of charge evolves according to its charge and discharge in each interval and is bounded between its minimum and maximum permissible levels:

SOC(t+1)=SOC(t)+ηcPbatt,chg(t)Pbatt,dis(t)/ηdEbattΔt,SOCminSOC(t)SOCmaxSOC(t+1) = SOC(t) + \frac{\eta_c P_{batt,chg}(t) - P_{batt,dis}(t)/\eta_d}{E_{batt}} \Delta t, \qquad SOC_{min} \leq SOC(t) \leq SOC_{max}

The generator, when committed, must operate between its minimum stable loading and its rated capacity, a condition expressed through the binary commitment variable:

ugen(t)Pgen,minPgen(t)ugen(t)Pgen,ratedu_{gen}(t)\, P_{gen,min} \leq P_{gen}(t) \leq u_{gen}(t)\, P_{gen,rated}

The generator is further constrained by ramp-rate limits between consecutive intervals and by minimum up-time and down-time requirements that prevent rapid cycling:

Pgen(t+1)Pgen(t)RgenΔt|P_{gen}(t+1) - P_{gen}(t)| \leq R_{gen}\, \Delta t

Where:

ηc\eta_c, ηd\eta_d are the battery charge and discharge efficiencies.

EbattE_{batt} is the installed battery energy capacity in kWh.

Δt\Delta t is the dispatch interval length in hours.

SOCminSOC_{min}, SOCmaxSOC_{max} are the permissible state-of-charge bounds.

ugen(t)u_{gen}(t) is the binary generator commitment variable, equal to 1 when the unit is running.

Pgen,minP_{gen,min}, Pgen,ratedP_{gen,rated} are the generator minimum stable and rated outputs in kW.

RgenR_{gen} is the generator ramp-rate limit in kW per hour.

The binary commitment variable ugen(t)u_{gen}(t) is what makes the formulation a mixed-integer rather than a purely linear program: a generator cannot be dispatched at a fractional commitment, and the minimum up-time and down-time constraints that prevent damaging short-cycling can only be expressed through integer logic.


3. Operational Dispatch Optimization

The real-time dispatch problem, solved by the microgrid controller at each control interval (typically every 5 to 15 minutes), determines the asset set-points for the upcoming horizon based on updated load and solar forecasts. The MPC formulation minimizes the operating cost over a receding horizon while respecting the same physical constraints as the planning problem, but with the asset capacities fixed at their installed values.

The dispatch optimization differs from the planning optimization in its treatment of uncertainty: the planning problem uses a representative annual profile, while the dispatch problem must respond to forecast errors in real time. The MPC framework handles this by re-solving the optimization at each interval with updated forecasts, so that forecast errors are corrected as new information arrives. The control action implemented is only the first step of the optimized horizon; the remainder is recomputed at the next interval.

The reserve constraint in the dispatch optimization ensures that sufficient battery capacity remains available for islanding at all times:

SOC(t)SOCreserve=EcriticaltoutageEbatt,capacitySOC(t) \geq SOC_{reserve} = \frac{E_{critical} \cdot t_{outage}}{E_{batt,capacity}}

Where: SOC(t)SOC(t) is the battery state of charge at hour tt.

SOCreserveSOC_{reserve} is the minimum SOC reserved for islanding.

EcriticalE_{critical} is the critical load power in kW.

toutaget_{outage} is the design outage duration the microgrid must support in hours.

Ebatt,capacityE_{batt,capacity} is the battery energy capacity in kWh.

This reserve constraint couples the economic dispatch (which would otherwise fully discharge the battery for arbitrage) with the reliability function (which requires reserve for outages), representing the central trade-off in microgrid economic operation.

The output of the dispatch optimization is an hourly schedule of asset set-points. For the 2 MW design example on a representative summer weekday, the MILP solver produces the dispatch summarized below, in which the battery charges from surplus midday solar and discharges into the evening peak while grid import fills the residual:

Hour Solar (kW) BESS (kW) Grid (kW) Load (kW) SOC (%)
02:00 0 0 305 305 50
08:00 180 0 360 540 50
12:00 590 −150 60 500 78
14:00 560 −150 80 490 90
18:00 120 +180 320 620 70
20:00 0 +180 360 540 52
23:00 0 0 330 330 50

A negative BESS value denotes charging and a positive value discharging. The schedule shows the optimizer exploiting the temporal arbitrage that the load–solar mismatch creates: the battery is driven to a 90 percent state of charge during the midday solar surplus and is then discharged across the evening peak, displacing the most expensive grid import and clipping the demand peak that sets the monthly demand charge. The complete 24-hour result is shown in Figure 2.

MILP-optimized 24-hour dispatch for the 2 MW microgrid, showing the stacked contributions of solar, grid import, and battery discharge against the load profile, with the battery state of charge on the right axis.

Figure 2. MILP-optimized 24-hour dispatch for the 2 MW microgrid, showing the stacked contributions of solar, grid import, and battery discharge against the load profile, with the battery state of charge on the right axis.

The figure renders the dispatch logic in a single view: the green solar band fills the midday hours, the battery state-of-charge trace (right axis) climbs while that surplus is stored and falls as it is released into the evening, and the grid-import band contracts during the hours when on-site resources carry the load. An operator reading this chart confirms at a glance that the reserve floor is respected — the SOC never drops below the 50 percent islanding reserve — while the economic objective is still served, which is exactly the coupled reliability-and-cost behavior the formulation is designed to produce.


4. Lifecycle Cost Metrics

4.1 Levelized Cost of Energy

The LCOE of the microgrid is the constant per-kWh price that would recover all lifecycle costs over the total energy delivered:

LCOE=y=0NCcap,y+CO&M,y+Cfuel,y(1+r)yy=1NEdelivered,y(1+r)yLCOE = \frac{\sum_{y=0}^{N} \frac{C_{cap,y} + C_{O\&M,y} + C_{fuel,y}}{(1+r)^y}}{\sum_{y=1}^{N} \frac{E_{delivered,y}}{(1+r)^y}}

Where: Ccap,yC_{cap,y} is the capital expenditure in year yy (concentrated at year 0 plus mid-life replacements).

CO&M,yC_{O\&M,y} is the operations and maintenance cost in year yy.

Cfuel,yC_{fuel,y} is the fuel cost in year yy.

Edelivered,yE_{delivered,y} is the energy delivered to load in year yy in kWh.

NN is the analysis period in years.

rr is the discount rate.

4.2 Design Example Results

For the 2 MW commercial-industrial microgrid, the optimization selected 1,200 kW of solar PV, a 600 kW / 2,400 kWh battery, and a 1,000 kW natural gas generator. The optimization compared this configuration against the baseline of full grid purchase. The results were: total installed cost of 4.85M;annualenergycostsavingsof4.85M; annual energy cost savings of 385,000 (combined arbitrage, peak shaving, and avoided generation); annual O&M cost of 62,000.Ata7percentdiscountrateovera20yearlife,theNPVwaspositiveatapproximately62,000. At a 7 percent discount rate over a 20-year life, the NPV was positive at approximately 1.2M, with a simple payback of 11.3 years on the gross capital and 7.6 years after the 30 percent investment tax credit on the solar and battery components.

The sensitivity analysis identified the demand charge rate and the natural gas price as the two most influential economic drivers. A 25 percent increase in the demand charge improved the NPV by approximately 480,000,whilea25percentincreaseinthenaturalgaspricereducedtheNPVbyapproximately480,000, while a 25 percent increase in the natural gas price reduced the NPV by approximately 310,000 because it reduced the value of the generator dispatch.


5. Conclusion

The most consequential finding is that microgrid sizing and dispatch cannot be optimized separately, because the value of each asset depends on how it is dispatched among competing revenue streams and the optimal dispatch depends on what assets are installed. The coupled MILP-and-MPC framework produces a defensible asset selection precisely because it solves both problems together; a sizing study that assumes a fixed dispatch, or a dispatch study that takes the asset mix as given, will systematically misvalue the storage in particular.

The most common implementation failure is optimizing against a single representative tariff and load profile, when the economics are dominated by the demand-charge structure and the fuel price — the two sensitivities the design example identifies as controlling — both of which vary over the asset life. A configuration that shows positive NPV at one demand-charge rate can be uneconomic at another, and the sizing decision must be tested across the plausible range rather than at a point estimate.

The engineer should next develop the sensitivity surface explicitly, presenting the optimal PV, storage, and generator capacities as functions of energy price and demand-charge rate, so that the asset selection is robust to the tariff and fuel-price uncertainty that the single-scenario NPV conceals.


Related Work

The analysis in this paper connects to several companion studies in this library. Readers concerned with the upstream and downstream engineering will find Microgrid Design and Control develops a closely related aspect of the same problem, while Microgrid Resilience Quantification extends the treatment into an adjacent domain. For the broader methodological context, Battery Energy Storage Systems Integrated with Solar PV provides complementary depth.


References

[1] IEEE Standard 1547-2018, Standard for Interconnection and Interoperability of Distributed Energy Resources, IEEE, 2018.

[2] NFPA 70, National Electrical Code, Article 706, 2023 edition, NFPA, 2023.

[3] National Renewable Energy Laboratory, REopt: Renewable Energy Integration and Optimization, NREL, 2023.

[4] S. Boyd and L. Vandenberghe, Convex Optimization, Cambridge University Press, 2004.

[5] J. Rawlings, D. Mayne, and M. Diehl, Model Predictive Control: Theory, Computation, and Design, 2nd ed., Nob Hill Publishing, 2017.

[6] R. Billinton and R. Allan, Reliability Evaluation of Power Systems, 2nd ed., Plenum Press, 1996.

[7] Lawrence Berkeley National Laboratory, Distributed Energy Resources Customer Adoption Model (DER-CAM), LBNL, 2022.

[8] H. Farhangi and G. Joos, Microgrid Planning and Design: A Concise Guide, Wiley-IEEE Press, 2019.