Level 5 Distributed energy resources and smart grids

When generation becomes distributed and controlled by power electronics: voltage profiles, inertia, low fault currents and optimised operation.
Tutorial Version 2.0.0 November 2026 EN / FR Click for the French version
Level 5 — Distributed energy resources and smart grids
NRJXpert 2.0.0 · November 2026

📘Introduction

Objectives

  • Calculate a radial distribution feeder by backward/forward sweep and know its limits.
  • Choose an inverter control law (cos φ, Q(V), P(V)) and determine the hosting capacity of a feeder.
  • Interpret a dynamic simulation: nadir, RoCoF, grid-forming and grid-following inverters.
  • Explain the limited contribution of inverters to short circuits and its consequences for protection.
  • Formulate and read an economic dispatch optimisation (MILP), an OPF and a hybrid sizing.

Prerequisites: levels 2 to 4; notions of linear optimisation. Calculations made by the remote server (with SciPy): Internet connection required. Duration: 20 h and a project.

↑ Back to top

🔌5.1 Load flow of distribution networks

MV and LV feeders are radial, with high R/X, often unbalanced (single-phase loads). Fast decoupled converges poorly on them (level 2); the backward/forward sweep (Kersting) is used:

  1. Injections: current of each load and each DER at the current voltage (ZIP loads, inverters according to their control law).
  2. Backward sweep: current of each branch = sum of the downstream currents.
  3. Forward sweep: voltage of each node = voltage of the upstream node − Z·I of the branch.
  4. Repeat until the voltages no longer move (10⁻⁶ pu).

Example 5.1 — IEEE 33-bus test network (Baran and Wu)

Results (NRJXpert server, file exemples/ieee33_distribution.xml)

12.66 kV, total load 3.715 MW + 2.300 Mvar. Losses 202.68 kW (published reference: 202.67 kW); minimum voltage 0.9131 pu at node 18; the substation supplies 3.918 MW and 2.435 Mvar; 8 iterations. The server's Newton-Raphson gives the same voltages to within 10⁻⁶ pu.

↑ Back to top

🔸5.2 Controlled inverters and hosting capacity

Generation at the end of a feeder raises the voltage (ΔU ≈ (R·P + X·Q)/U² changes sign) and may reduce then increase the losses. Inverters have standardised control laws (IEEE 1547-2018):

ControlPrincipleEffect
Imposed P, Q / fixed cos φQ = P·tan φsimple; does not react to voltage
Q(V) (volt-var)absorbs reactive power when V > 1.02 pu, supplies it when V < 0.98 puclips overvoltages, increases losses
P(V) (volt-watt)reduces P above 1.06 pulast resort: loss of production

The hosting capacity of a node is the maximum power that can be connected without violating the constraints (V ≤ Vmax, current ratings), at the worst moment: high production and low load.

Example 5.2 — PV at node 18 of the IEEE 33 network

Server results
PV at node 18Losses (kW)Vmin (pu)Vmax (pu)
none202.70.913 (18)1.000
0.5 MW, cos φ = 1153.40.925 (33)1.000
1.0 MW, cos φ = 1145.80.932 (33)1.000
2.0 MW, cos φ = 1226.70.9441.045 (18)
2.0 MW, Q(V)249.80.9411.033 (18)

Losses go through a minimum around 1 MW then rise again: beyond that, the PV « exports » to the substation through the whole feeder. At 2 MW, Q(V) absorbs 0.21 Mvar and brings the overvoltage from 1.045 down to 1.033 pu, at the cost of 23 kW of additional losses. Hosting capacity at node 18 at 30 % load, V ≤ 1.05 pu: 1.14 MW.

Lab 10 — Hosting capacity in NRJXpert

  1. Draw a feeder, or open exemples/hostingCapacity_ieee33.xml (Help › Open a tutorial example) and calculate it in the « Calculate a network file (XML) » window.
  2. Place a photovoltaic generator (Distributed resources palette) at the end of the feeder; Q(V) control.
  3. Simulation › DER study settings, Hosting capacity tab: bus, Vmax = 1.05, load during the test 30 %.
  4. Calculation PV hosting capacity; then Distribution load flow with this power: check that Vmax = 1.05 pu.
  5. Repeat in the middle of the feeder: is the hosting capacity larger? Why?
↑ Back to top

📗5.3 Time series

A single operating point is not enough: PV production peaks at noon, consumption in the evening. The Time series calculation chains one load flow per time step (24 h, one week…) with the load and generation profiles, and counts the hours out of range, the energy lost and the energy curtailed. On the example exemples/timeSeries_ieee33.xml, the minimum voltage drops to 0.918 pu at 19:00 (evening peak), 8 hours are below 0.95 pu and the losses amount to 1.78 MWh/day for 55.5 MWh supplied (3.2 %).

↑ Back to top

🔋5.4 Microgrid dynamics

A network supplied by rotating machines has inertia: after a loss of generation, the frequency falls slowly, which gives the governors time to react. Swing equation: 2H·dω/dt = Pm − Pe − D(ω − 1). Inverters have no inertia of their own; two families:

  • Grid-following (most PV inverters): current sources synchronised by a PLL; they need a voltage reference.
  • Grid-forming (microgrid batteries): voltage sources with P-f and Q-V droop or « virtual synchronous machine » (VSM); they can hold an island alone and provide synthetic inertia.
Indicators: frequency nadir (minimum), RoCoF (derivative, Hz/s, over 100 ms), final frequency (droop: Δf = −R·ΔP)

Example 5.3 — Islanded microgrid

File exemples/dynamics_microreseau.xml: 2 MVA genset DG (synchronous machine), 1 MVA battery BESS (grid-forming), 0.5 MVA PV (grid-following), loads 0.6 and 0.5 MW. At 0.5 s, a cloud reduces the available PV power to 20 %; at 2.0 s, 100 ms three-phase fault at node Ch2.

Server results (RMS simulation, 4 s)

Genset frequency: nadir 49.79 Hz, RoCoF 1.76 Hz/s, final frequency 49.83 Hz (droop: the battery and the genset share the lost power). The PLL of the PV inverter sees larger excursions during the fault (49.42 to 50.50 Hz): it is the local measurement disturbed by the voltage dip, not the network frequency.

↑ Back to top

⚡5.5 Short circuit of inverter-based generators

An inverter limits its current (1.1 to 1.5 times rated): IEC 60909-0:2016 represents it as a current source IskPF in the positive-sequence network, absent from the negative- and zero-sequence networks:

I"k3 = (c·Un/√3 + Σ|Z1(f,j)|·IskPF,j) / |Z₁|    ip: no DC component for the inverter share

Consequences: in an island supplied only by inverters, the fault current is barely higher than the load current; overcurrent protections no longer see the fault. Undervoltage or differential protections, or batteries oversized in current, are needed. NRJXpert illustrates it: 11 kV feeder with PV, wind, battery and genset, three-phase fault → I"k = 1.656 kA of which only 76 A come from the three inverters.

↑ Back to top

💰5.6 Economic dispatch and OPF

Economic dispatch decides, hour by hour, who produces: start-up of the gensets, charging and discharging of the batteries, purchases and sales to the grid, load curtailment. It is a mixed-integer linear programme (MILP): continuous variables (powers, states of charge) and binary ones (genset on or off, charging or discharging).

min Σt [ fuel cost + start-ups + purchases − sales + battery wear + load shedding ]
subject to: power balance at each hour; Pmin·u ≤ P ≤ Pn·u; SOCt = SOCt−1 + (ηcPc − Pd/ηd)Δt; spinning reserve

Example 5.4 — Islanded microgrid over 24 h

File exemples/dispatch_microreseau_ilote.xml: 1.5 MVA genset (diesel 800 F/l), 0.8 MW PV, 0.9 MWh / 0.3 MW battery.

Server results

Energy served 16.6 MWh; fuel 4 664 l; renewable share 36.6 %; no curtailment or load shedding; cost 3.75 MF/day, i.e. 226 F/kWh, 99.5 % of which is fuel. The battery does 0.24 cycle: with this PV size, it mainly serves to avoid genset start-ups.

The OPF (optimal power flow) adds the network constraints: voltages between Vmin and Vmax, currents, losses (DistFlow model of Baran and Wu, linearised by tangent planes), and also controls the reactive power of the inverters. NRJXpert recalculates each hour with an AC load flow to check: on exemples/opf_microreseau.xml, the difference between the OPF losses and those of the AC load flow is below 0.1 %.

↑ Back to top

🔹5.7 Optimal sizing of a hybrid system

Optimal sizing chooses both the sizes (kWp of PV, number of wind turbines, kWh of batteries, number of gensets, grid connection) and the operation over typical days, minimising the annual cost (investments annualised by the CRF + operation), with reliability (energy not supplied) and renewable-share constraints. Demonstration of the server calculation package (run by the administrator): 100 kW peak site in Dakar — genset alone 317 F/kWh; hybrid optimum 360 kWp of PV + 933 kWh of batteries + one back-up genset, 105 F/kWh, 97 % renewable. The prices of the demonstration are indicative: redo the study with current prices.

↑ Back to top

🎯Projects

The projects start from the example XML files: Help › Open a tutorial example, then change the values in the « Calculate a network file (XML) » window (tags <Pgen>, <derControl>, <H>, <Emax>…) and Calculate on the server; « Save as… » keeps each variant.

Project A — Voltage profile of a rural feeder

From ieee33_distribution.xml, place 3 PV plants of 0.5 MW at nodes 18, 25 and 33. Compare cos φ = 1, Q(V) and P(V) in 24 h time series: hours of overvoltage, losses, energy curtailed. Propose a connection rule.

Project B — Stability of an island

In dynamics_microreseau.xml, reduce the inertia of the genset (H) then switch the battery from « droop » to « VSM »: plot the nadir and the RoCoF. What grid-forming battery power is needed to keep a RoCoF below 1 Hz/s?

Project C — Hybridisation of a diesel plant

With dispatch_microreseau_ilote.xml, vary the PV power (0.4; 0.8; 1.2; 1.6 MW) and the battery capacity. Plot the cost of the kWh and the renewable share; identify when curtailment appears. Complete with the economic analysis of level 4 (investments).

↑ Back to top

📋Level 5 quiz

1. Why the backward/forward sweep rather than fast decoupled in distribution?

  1. it is more accurate in transmission
  2. it handles meshed networks better
  3. it converges on radial, high-R/X and unbalanced networks
  4. it needs no slack node
It does not assume R ≪ X and handles the three phases; on the other hand, it requires a radial network.

2. A large PV production at the end of a feeder, at cos φ = 1:

  1. lowers the voltage
  2. raises the voltage
  3. does not change the voltage
  4. changes the frequency
The flow reverses: ΔU ≈ (R·P + X·Q)/U² with P negative towards the substation.

3. The Q(V) law reduces overvoltages by:

  1. absorbing reactive power when the voltage is high
  2. supplying reactive power when the voltage is high
  3. reducing the frequency
  4. disconnecting the PV
Q < 0 lowers the voltage through X; limited effect on very resistive networks.

4. The hosting capacity is calculated at:

  1. full load, without generation
  2. full load and full generation
  3. night time
  4. low load and high generation
This is the situation that maximises the overvoltage and the reverse flow.

5. A « grid-forming » inverter:

  1. needs a PLL to synchronise on an existing network in order to operate
  2. is a current source
  3. imposes a voltage and can hold an island alone
  4. does not take part in frequency control
It is a voltage source with droop or VSM.

6. The RoCoF is higher when:

  1. the inertia is large
  2. the inertia is low and the power loss large
  3. the droop is small
  4. the network is in overvoltage
dω/dt = ΔP/(2H) at the first instant.

7. In IEC 60909-0:2016, an inverter-based generator is represented in short circuit by:

  1. a current source in the positive-sequence network only
  2. an emf behind its subtransient reactance
  3. an infinite impedance
  4. an ideal voltage source
IskPF limited by the electronics; nothing in the negative or zero sequence.

8. The economic dispatch of a microgrid uses binary variables for:

  1. the voltages
  2. the prices
  3. the losses
  4. on/off of the gensets and the charge/discharge exclusion
Hence a MILP problem, solved by HiGHS (SciPy).
↑ Back to top

👤Author

LT
Prof. Lamine THIAW
Department of Electrical Engineering
École Supérieure Polytechnique
Cheikh Anta Diop University, Dakar
lamine.thiaw@ucad.edu.sn
lamine.thiaw@esp.sn

November 2026