Skip to content

Economic Dispatch

Definition

The Economic Dispatch (ED) module in KPG Platform is designed to optimize the generation of electricity in a power system while minimizing costs. It considers various constraints, including generation limits, and generation/load balance. This module is essential for understanding how different generation sources can be dispatched to meet demand efficiently.

Mathematical formulation 🧮

Equation explanation

(1a): Objective function
This function minimizes the total generation cost over all generators in set.

(1b): Generation-Load Balance Constraint
This constraint ensures total power generation matches system demand.

(1c): Generation Limit Constraint
This constraint restricts generator output within its physical minimum and maximum limits.

Julia code 🔢

# Data for the problem
D = 100
genset = 1:3
C = [10, 20, 30]
G_min = [0, 0, 0]
G_max = [50, 50, 50]
# Optimization model
using JuMP, Ipopt
m = Model(Ipopt.Optimizer)
@variable(m, g[i in genset])
@objective(m, Min, sum(C[i] * g[i] for i in genset))
@constraint(m, SDbalance, sum(g[i] for i in genset) == D)
@constraint(m, glb[i in genset], g[i] >= G_min[i])
@constraint(m, gub[i in genset], g[i] <= G_max[i])
optimize!(m)
using DataFrames
results = DataFrame(
Generator = genset,
Cost = C,
Dispatch = round.(value.(g).data, digits=2),
Gmax = G_max,
)
@show objective_value(m) # check total cost
@show dual.(SDbalance) # check SMP

Visualization 📊

Below is a visualization that shows how generation is dispatched by cost as demand changes.

Economic Dispatch

Demand: 80 MW

Marginal Generator: Gen 2 | SMP: $20/MWh

Assume linear cost:

KKT Conditions 📐

1. Lagrangian Function

Introduce Lagrange multipliers:

  • for the equality constraint (Supply-demand balance).
  • for lower bound
  • for upper bound

The Lagrangian:

2. KKT Conditions

(a) Stationarity

(b) Primal feasibility

(c) Dual feasibility

(d) Complementary slackness

3. Solving KKT Conditions: Three-Generator Example

Consider the following data:

  • Demand:
  • Cost coefficients:
  • Generation bounds: , for all

Assume the solution is of the form , , . We now solve the KKT system step-by-step.

Step 1: Stationarity

From the stationarity condition:

Substituting known values:

  •  (1)
  •  (2)
  •  (3)
Step 2: Complementary Slackness

Use the primal solution and bounds:

  • ,
  • ,
  • ,

Substitute into (1)-(3):

Step 3: Dual Feasibility

Therefore, the smallest satisfying all is

Plug back:

  • , ,

All other multipliers are 0. These values satisfy all KKT conditions.

Thus, the solution , , with is optimal.

Try it live 🚀

You can directly try running the Julia code in a live environment below.