Skip to content
Opt Dir

Energy · Microgrid Energy Management

PV, Battery, Generator, Load — Every 15 Minutes, How Much of Which Source Should I Run?

Energy & Utilities 6 min read
Also applies in: Emerging Tech Manufacturing
#microgrid #energy management #model predictive control #battery storage #PV #islanded mode #renewable integration

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

You operate a tourism site, university campus, small industrial estate, or a 100-500 household island/rural microgrid with 200-1500 kW of rooftop solar, a 100-500 kWh battery, and a 50-200 kW backup diesel generator. Every 5-15 minutes you must make four coupled calls at once: how much energy to import from the grid and whether to send surplus solar back to the grid or into the battery, whether to charge, discharge or hold the battery, whether to fire up the generator, and which flexible loads run now versus later. Get the order wrong and surplus solar is pushed back to the grid without a contract, peak-tariff electricity is bought at night, the generator burns fuel at the wrong hour, and when the grid drops it is unclear whether critical loads (cold chain, server room, lift) stay powered. Rule-of-thumb dispatch on a 1 MW PV + 500 kWh battery + 200 kW generator site burns 0.8-3M TRY of operating margin per year.

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

Losses from intuitive microgrid management: (1) solar export loss — without an export contract the buy-back price is 0-2 TRY/kWh (3-5x below import); if 200-800 kWh of daily solar surplus is misdirected, annual revenue lost is 80-400K TRY; (2) peak-tariff purchase — night tariff is 40-60% below day/peak tariff; smart battery management can cut the monthly electricity bill by 15-30%; (3) diesel fuel waste — low-load operation drops fuel efficiency by 15-25%; correct timing (peak shaving or islanded only) cuts annual fuel cost by 20-40%; (4) islanded power cut — failure to protect critical loads in an unexpected grid disconnection causes 5-50K TRY/hour of production/operation loss (vacated rooms in a tourism facility, cold-chain breakdown, server crash). Field evidence shows numerical microgrid management cutting total operating cost by 15-30% and raising renewable utilisation by 20-40%. For a mid-size microgrid with 1 MW installed solar + 500 kWh battery + 200 kW generator this represents 0.8-3M TRY additional annual operating margin.

How it's solved

Technical depth

In 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

Free

Zero 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

Enterprise

150K-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

Enterprise

400K-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 Source

Free 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

Small
Small facility (<100 kW PV, <50 kWh battery, no backup generator): manual + three core rules (a) charge battery at night tariff, (b) discharge at peak tariff + push PV surplus into battery, (c) if no export contract, keep PV surplus in battery — 5-10% improvement. MPC investment will not pay back.
Medium
Mid facility (200-800 kW PV, 100-300 kWh battery, backup generator): local EMS + custom MPC module, or the optimisation module of a compact international package. 6-12 month pilot. Expected operating cost -15-25%, PV self-consumption +20-30%, generator running hours -30-50%. Payback 18-36 months.
Large
Large facility (1+ MW PV, 500+ kWh battery, multiple generators; university campus, island settlement, industrial estate): full international EMS + MPC + islanded-mode + V2G integration. 1-3M EUR/year total investment. Payback 24-48 months. Operating cost -20-35%, renewable utilisation +25-40%, islanded-mode reliability around 99% is typical.

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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

ApproachTypical scaleSolve timeGuaranteed optimum?
Rule-based (if-then, night-charge/day-discharge)Small facility, <100 kW PVinstantNo, 50-70% optimum
Deterministic MPC — MILPMid facility, 200-1500 kW PV, 24-48h horizonseconds-minutesYes (within bound, under deterministic assumption)
Stochastic MPC (sample-average)PV/load uncertainty criticalminutes-hoursYes (expected value)
Robust MPC (worst-case)Islanded-mode safety criticalminutes-hoursYes, worst-case optimum
Distributed/decomposed MPC (ADMM)Multi-microgrid (campus network)minutes-hoursGood convergence
Receding horizon (re-solve every 5-15 min)Standard in all approachesper minuteAdaptive quality
Hierarchical (primary droop + secondary V/f + tertiary MPC)Full field microgrid systemcontinuousField-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.
Was this helpful?
Suggest correction

Related problems

Esc Close