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 problemD = 100genset = 1:3C = [10, 20, 30]G_min = [0, 0, 0]G_max = [50, 50, 50]
# Optimization modelusing JuMP, Ipoptm = 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 DataFramesresults = 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 SMPVisualization 📊
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
Step 1: Stationarity
From the stationarity condition:
Substituting known
(1) (2) (3)
Step 2: Complementary Slackness
Use the primal solution and bounds:
, , ,
Substitute into (1)-(3):
Step 3: Dual Feasibility
Therefore, the smallest
Plug back:
, ,
All other multipliers are 0. These values satisfy all KKT conditions.
Thus, the solution
Try it live 🚀
You can directly try running the Julia code in a live environment below.