For a small settlement, campus, industrial estate or tourism facility: PV + battery + diesel generator + flexible-load mix; every 5-15 minutes which source produces how much, the battery charges or discharges by how much, which loads are deferred. Classical microgrid OR problem: Microgrid Energy Management — the modern dominant approach is MPC.
In plain words
Sound familiar?
- We have rooftop PV (200-1500 kW), a battery energy storage system (100-500 kWh) and a backup diesel generator (50-200 kW) on site; which source runs when is decided intuitively by the site engineer.
- PV peaks around midday and the surplus is pushed back to the grid; but the export contract is missing or the price is low — we have a battery but it is not charged at the right hours.
- Time-of-use tariff (day/peak/night windows) is well known, but the battery charge/discharge schedule does not track that curve; at night we buy from the grid at peak tariff.
- The diesel generator runs 50-200 hours a month; we want to cut fuel and maintenance cost but the trigger rule (at what load, at what hour) is unclear.
- For grid disconnection (islanded mode) we have no strategy to keep the most critical loads (cold room, server room, lift) alive; in a transformer failure there is no plan B.
- We have flexible loads (air conditioning 15-minute deferral, laundry, heat-pump pre-cooling); but there is no system that coordinates them with the energy price signal.
- We are considering a PV expansion or a battery investment; but the payback analysis on existing load + generation profile is intuitive, not numerical.
Why it matters
How it's solved
Technical depth
How it's solved
Technical depthIn one sentence: Take the next 24 hours of weather forecast, every 15 minutes solve “how much will PV produce, where will the battery charge from, should the generator run, which load can shift” for minimum cost, apply only the first 15 minutes — then re-solve when the forecast updates.
The problem appears in Operations Research (the discipline that uses math and computers to solve business decisions) literature as Microgrid Energy Management; the modern dominant approach is a MILP solved under an MPC (Model Predictive Control — rolling-horizon predict-and-control) framework, with a canonical formulation established in the academic literature. Solution in three stages:
1. Modelling. Input data: renewable sources (per PV array: installed capacity kW, instantaneous generation forecast curve — including cloud movement; if wind, the turbine power curve), battery energy storage system (BESS — Battery Energy Storage System; capacity kWh, current SoC — State-of-Charge, charge/discharge maximum kW, round-trip efficiency 85-95%, minimum SoC floor, cycle-aging curve), diesel generator (installed kW, minimum-load level, fuel consumption curve L/kWh, minimum-up/minimum-down time — minimum on/off durations, cold-warm start cost), load profile (controllable/fixed vs flexible loads — each with its hourly demand and flexibility window), main grid (time-of-use buy/sell tariff, instantaneous draw limit, islanded-mode probability). Constraints: instantaneous power balance (generation = consumption + battery charge/discharge + grid import/export), per time step SoC lower-upper limits, generator minimum-load + minimum-up/down time, battery cycle-aging cost, critical load continuity in islanded mode, frequency and voltage stability (tertiary level in hierarchical control). Objective: minimum total operating cost (fuel + grid import - grid export + battery aging); multi-objective variant: cost + emissions + reliability.
2. Solver-driven decision. Deterministic MPC: small-mid microgrid (3-10 source/load components) by MILP (Mixed-Integer Linear Programming — optimisation with some 0/1 variables and some continuous) — 24-48 hour horizon, 5-15 minute time step; per step, binary decisions (generator on/off, flexible load on/off) and continuous decisions (battery charge/discharge kW, grid import/export kW). Solves in minutes on a single machine with open-source or commercial MIP solvers. Stochastic MPC (scenario-based MPC): under PV (cloud movement) and load (15-minute fluctuation) uncertainty, sample-average approximation — 10-50 scenarios, deterministic MILP per scenario, expected cost minimised. Robust MPC (worst-case MPC): guaranteed operation under the worst-case PV and load scenario, for islanded-mode safety. Rolling horizon (receding horizon): every 5-15 minutes the MPC is re-solved with refreshed PV/load forecast and current SoC; only the first step is applied, the horizon rolls forward. Multi-microgrid setting: distributed/decomposed — each microgrid solves its own MILP, coordination on the shared grid constraint (total import/export). Hierarchical control: MPC sits at the tertiary level (hourly-minute economic decision), secondary level handles voltage/frequency (seconds), primary level is droop control (milliseconds) — these two lower layers are control engineering rather than OR and operate on top of the MPC output.
3. Field integration. Three-layer output: 15-minute dispatch schedule (per component MW set-point — Gantt panel in operations centre), battery management system (BMS) command (charge/discharge current set-point), generator start/stop signal. The Energy Management System (EMS) feeds the MPC module: PV inverter telemetry, BMS SoC data, generator-side engine state, smart-meter total consumption, weather forecast API (for PV generation forecast), main-grid price signal. Quarterly committee: actual vs planned operating cost, PV self-consumption ratio, battery cycle count, generator running hours, islanded-mode test (2-4 planned disconnection simulations per year).
Alternatives
Manual + heuristic rule
FreeZero license
Who it fits: Small facility (<100 kW PV, <50 kWh battery, no backup generator)
- + Zero software cost
- + Site engineer experience leads
- + Simple rule (charge battery at night tariff, discharge at peak tariff) yields 5-10% savings
- − Adding multiple sources (PV + battery + generator) mentally saturates the planner
- − Not adaptive to uncertain PV generation (cloud movement)
- − No islanded-mode strategy
- − Payback analysis is not numerical
Local energy management system (EMS) — basic rule-based
Enterprise150K-600K TRY license + 60K-200K TRY/year maintenance (TR market observation)
Who it fits: Mid facility (200-800 kW PV, 100-300 kWh battery, backup generator; tourism site or SME)
- + Local-language UI, local support
- + Smart meter + BMS + inverter integration standard
- + Time-of-use tariff optimisation at basic rule level
- + Short SCADA integration
- − MPC module typically absent — only rule-based (if-then)
- − Stochastic PV/load uncertainty not modelled
- − Islanded-mode transition scenarios limited
- − Battery cycle-aging cost not in the objective
International microgrid EMS + MPC module
Enterprise400K-1.5M EUR license + 80K-300K EUR/year maintenance
Who it fits: Large facility (1+ MW PV, 500+ kWh battery, multiple generators; university campus, island settlement, industrial estate)
- + Mature exact-programming-based predictive-control module
- + Uncertainty-aware (scenario-based or worst-case) predictive-control variants available
- + Automatic islanded ↔ grid-connected transition
- + Hierarchical control (primary/secondary/tertiary) integrated
- + V2G (vehicle-grid) module available in advanced markets
- − High license + 9-18 month deployment
- − Customisation to TR regulation (unlicensed-generation 2024 directive, islanded-mode permits) extends project
- − Wide training programme for the operations team
Open-source solver + custom MPC module
Open SourceFree license; in-house build 20-36 weeks or 600K-1.8M TRY consultancy
Who it fits: Operator with a tech team, integration with existing EMS / SCADA
- + No license fee
- + Predictive-control approaches are well defined for open-source solvers
- + Scenario-based and worst-case predictive-control variants exist in the open literature
- + Hierarchical control is detailed in open sources
- − Needs in-house OR specialist + power engineer + control engineer
- − Moving from academic prototype to field system 9-18 months
- − Maintenance burden stays with the operator
- − Stochastic MPC requires a separate PV/load forecasting model
Recommendation
Ask in the meeting
- Does the energy management module use forward-planning predictive control or only rule-based (if-then) logic? If predictive control, what horizon length and what time step (5-15-30 minutes)?
- Is a scenario-based or worst-case variant available? How is solar generation and load forecast uncertainty modelled (sample-average, scenario tree, worst-case)?
- Is battery cycle-aging cost part of the objective function? Which modelling approach (calendar aging + cycle aging, depth-of-discharge based) is used?
- Is the transition between islanded (grid-disconnected) and grid-connected operation automatic? In an unexpected grid disconnection how is the protection of critical loads prioritised?
- Are diesel generator minimum on-time / off-time, cold/warm start cost and fuel curve configurable through parameter tables, or hard-coded?
- Are flexible loads (demand response) integrated into the objective? Can per-load flexibility windows (e.g. air conditioning deferrable 15 min, laundry 2 hours) be defined?
- Is the layered control architecture (sub-second stability, second-scale voltage/frequency recovery, minute-scale economic decision) integrated, or only the minute-scale economic decision level?
- If we end the contract, in which standard format can we export 15-minute dispatch history, battery state-of-charge profile, generator running logs and solar generation data?
Technical details
Editor’s note
In plain speech this problem is called “microgrid management”, “PV + battery management” or “islanded-mode system”. In the academic literature its name is Microgrid Energy Management; the modern dominant solution approach is MPC for Microgrids — the canonical MILP-MPC formulation is the industry reference. The microgrid concept itself is defined IEEE-formally as a small-scale, multi-source (renewable + storage + dispatchable generation + flexible load) subsystem capable of operating connected to the main grid or islanded, taking responsibility for its own control.
Distinguish this problem from other energy OR problems: Unit Commitment + Economic Dispatch (#029) is at the national/regional grid scale — hourly on/off decisions for tens or hundreds of plants. Demand Response + peak shaving (#020) is consumption smoothing on the main grid — coordination of flexible loads. Hydropower Reservoir Operation via SDDP (#037) is a single-asset (dam/HPP) multi-month stochastic policy decision. EV Charging Scheduling (#052) is fleet-vehicle focused. The microgrid (#053) is not a miniature of the national grid; it has multi-renewable + storage + flexible load + sometimes islanded-mode character. Decisions are refreshed at 5-15 minute intervals (MPC, rolling horizon). UC is minute-hourly unit on/off; microgrid MPC is continuous receding horizon.
Most-skipped point in the sector: uncertainty handling — deterministic MPC vs stochastic MPC vs robust MPC. In practice most microgrid EMS systems run deterministic forecast (a fixed PV generation forecast + a fixed load forecast); in reality both PV generation (cloud movements, 30-70% intra-day fluctuation) and load (±15-25% within 15 minutes) fluctuate by the minute. Stochastic MPC (sample-average approximation — expected-value optimisation over 10-50 PV/load scenarios) or robust MPC (guaranteed operation under the worst-case scenario) is the literature standard; practical field implementations under the deterministic assumption look artificially over-optimistic — the plan collapses on the first major cloud event and the backup generator is panic-triggered. Second skipped point: hierarchical control. MPC sits at the tertiary (economic, minute-level) layer; primary droop control (millisecond) and secondary control (second) that keep voltage and frequency stable are separate layers — without them the MPC output cannot be applied in the field. Third skipped point: battery cycle-aging cost. Every charge-discharge cycle drops battery capacity by 0.01-0.05%; pure cost minimisation runs the battery aggressively and halves usable capacity in 3-4 years instead of 5-7. If this cost is not in the objective the so-called optimal schedule turns into a long-term loss.
Step-by-step path — for the SMB
Stage 1 — Measure first, plan after. At least 6-12 months of generation and consumption data: 15-minute resolution PV generation (per array), battery SoC curve, generator running hours and fuel consumption, grid kWh imported/exported, time-of-use tariff curve, load profile (separated into critical vs flexible where possible). Weather data (sunshine duration, cloud density) from a local meteorological station or a weather forecast API. Equipment inventory: PV inverter capacity and efficiency curve, BMS capacity and charge/discharge limits, generator power curve and fuel consumption chart, smart-meter instantaneous power measurement.
Stage 2 — Extract the knowledge capital. PV generation forecast model (15-minute - 24-hour horizon, weather-forecast data + historical calibration). Load forecast model (hourly + day-type + seasonal). Battery cycle-aging curve (manufacturer data + depth-of-discharge table). Generator fuel consumption curve (kW load level vs L/hour). Time-of-use tariff windows and seasonal variation. Flexible-load inventory: which load can be deferred how long (minutes, hours), which loads are critical (never interrupted), which can be controllably switched off.
Stage 3 — Pilot. 8-12 weeks. For a subset (e.g. PV + battery combination, excluding generator) run the deterministic MPC output in parallel with the current rule-based allocation. The decision stays with the operations centre; MPC gives a recommendation. Success criterion set in advance: monthly electricity bill -10% minimum, PV self-consumption +15% minimum, battery cycle count tracking included.
Stage 4 — Rollout. 9-18 months to all components (including generator) + islanded-mode tests + stochastic MPC + flexible-load integration. Every 5-15 minutes rolling-horizon MPC re-solves. Quarterly committee: dispatch performance, battery cycle trend, generator running hours, islanded-mode test results (2-4 planned disconnection simulations per year), investment decisions (PV expansion, battery replacement, V2G addition), regulatory updates (TR unlicensed-generation directive, islanded-mode permit).
Risks — what can go wrong
- PV forecast error at peak. Deterministic MPC assumes cloudless days; in reality intra-day PV generation can drop 50-80% within 5-15 minutes during cloud transit. A stochastic MPC, or at minimum a scenario-based sensitivity analysis, is essential; otherwise the generator is panic-triggered and burns fuel wastefully.
- Diesel fuel availability. In islanded mode the running hours must be a hard MPC constraint against tank capacity; running out of fuel collapses the system. Tank-level telemetry must feed the MPC.
- Regulatory permission for islanded mode. In TR the unlicensed-generation directive (2024 update) ties grid export and islanded operation to specific rules; unauthorised islanded operation is both illegal and a technical risk (frequency/voltage mismatch damages equipment when the grid reconnects). Annual regulatory tracking is essential.
- Single-supplier EMS lock-in. Without a contract clause for annual standard-format export of dispatch history, battery SoC profile, MPC parameter calibration and PV/load forecast model, leaving the system means losing the microgrid’s operational memory — battery cycle-aging tracking in particular is data accumulated over years.
- Battery cycle-aging cost not included. If the objective covers only electricity tariff optimisation, the battery is cycled 3-5 times a day; instead of a 10-15 year life, capacity halves in 5-7 years and OPEX reaches half the investment cost.
Solution method — a technical view
| Approach | Typical scale | Solve time | Guaranteed optimum? |
|---|---|---|---|
| Rule-based (if-then, night-charge/day-discharge) | Small facility, <100 kW PV | instant | No, 50-70% optimum |
| Deterministic MPC — MILP | Mid facility, 200-1500 kW PV, 24-48h horizon | seconds-minutes | Yes (within bound, under deterministic assumption) |
| Stochastic MPC (sample-average) | PV/load uncertainty critical | minutes-hours | Yes (expected value) |
| Robust MPC (worst-case) | Islanded-mode safety critical | minutes-hours | Yes, worst-case optimum |
| Distributed/decomposed MPC (ADMM) | Multi-microgrid (campus network) | minutes-hours | Good convergence |
| Receding horizon (re-solve every 5-15 min) | Standard in all approaches | per minute | Adaptive quality |
| Hierarchical (primary droop + secondary V/f + tertiary MPC) | Full field microgrid system | continuous | Field-deployable |
Objective function choices:
- Objective 1 — Minimum total operating cost: Fuel + grid import - grid export; simplest, no aging.
- Objective 2 — Operating cost + battery cycle-aging cost minimum: True TCO; battery OPEX included.
- Objective 3 — Maximum renewable utilisation + minimum cost: Environmentally driven, with GHG accounting.
- Objective 4 — Islanded-mode reliability maximum (worst-case): Robust MPC; for island settlements and critical facilities.
- Objective 5 — Net V2G arbitrage revenue + battery aging cost: When EV is connected.
Multi-objective: weighted sum (cost + emissions + reliability) or hierarchical (first critical-load continuity, then cost, then environment).
Academic sources
Listed in the page frontmatter under sources.
Sources
- Parisio, A., Rikos, E. and Glielmo, L. (2014). A model predictive control approach to microgrid operation optimization. IEEE Transactions on Control Systems Technology, 22(5), 1813-1827. Canonical MILP formulation for microgrid MPC.
- Olivares, D. E., Mehrizi-Sani, A., Etemadi, A. H., Cañizares, C. A. et al. (2014). Trends in microgrid control. IEEE Transactions on Smart Grid, 5(4), 1905-1919. Modern survey of microgrid control.
- Hatziargyriou, N., Asano, H., Iravani, R. and Marnay, C. (2007). Microgrids. IEEE Power and Energy Magazine, 5(4), 78-94. Foundational definition and taxonomy of the microgrid concept.
- Lasseter, R. H. (2002). MicroGrids. IEEE PES Winter Meeting. First paper proposing the microgrid concept.
- Mariam, L., Basu, M. and Conlon, M. F. (2016). Microgrid: architecture, policy and future trends. Renewable and Sustainable Energy Reviews, 64, 477-489. Architecture, policy and trends.
- YÖK Thesis Center — keywords: ‘mikro şebeke’, ‘model öngörülü kontrol’ or ‘ada modu enerji’ — 20+ theses. tez.yok.gov.tr
Glossary
- Microgrid Management
- OR and control problem of dispatching a small-scale, multi-source energy system over a rolling time horizon under power-balance, storage and generator constraints.
- Model Predictive Control
- Receding-horizon optimisation framework where, at each control instant, a finite-horizon problem is solved with current state and forecasts, the first action is applied, then the horizon rolls forward.
- MIP
- An optimization model where some decision variables are forced to be whole numbers (e.g. number of trucks, number of shifts).
- Demand Response
- An energy-management approach that optimizes when loads run on the consumer side, based on the tariff, system conditions, or incentives.