Lecture V - Economic Dispatch Problem
Energy System Optimization with Julia
Quick Recap from last Week
JuMP
- JuMP is a package for modeling optimization problems in Julia
- It allows you to describe optimization problems in a way that is easy to understand and solve
- It is a powerful tool for modeling and solving optimization problems
. . .
Use meaningful variable names and comments to make your model easier to understand.
Bounds
- Variables in optimization models often need upper and lower bounds
- Bounds can be set when declaring variables or added later as constraints
- Common bounds include non-negativity (\(\leq 0\)) and capacity limits
Constraints
- Constraints define the feasible region of the optimization problem
- Can be equality (\(=\)) or inequality (\(\geq, \leq\)) constraints
- Multiple constraints can be added using loops or array comprehensions
. . .
Conditional constraints allow flexible and dynamic model formulations reflecting conditions and dependencies in the constraint application.
Solver
- JuMP supports many different solvers like HiGHS, GLPK, Gurobi
- Solvers are specialized for different problem types (LP, MIP, NLP)
- Can set solver parameters to control solution process
Model Setup
- Start by creating a model with
Model()
- Add variables, objective function, and constraints
- Call
optimize!()
to solve the model - Access results through solution queries
. . .
Always check the solution status before using the results to ensure the model solved successfully.
Solutions from last Week
- The tutorials from last week will again be available on Friday
- You can access them in the project folder on Github
- Click on the little cat icon on the bottom right
. . .
You can ask questions anytime in class or via email!
Introduction
Power System Basic Models: Economic Dispatch
Economic Dispatch Problem
- Objective: Minimize the cost of producing electricity
- Constraints in the simplest case:
- Demand must be met
- Generators have limits on their power output
- Renewable power injection
- Decision variables:
- Power output of thermal generators
- Power output of renewables, e.g. wind
Problem Structure
Objective
Available Sets
Question: What are sets again?
. . .
Sets are collections of objects.
. . .
Question: What could be the sets here?
. . .
- \(\mathcal{G}\) - Set of thermal generators indexed by \(g \in \{1,2,...,|\mathcal{G}|\}\)
- \(\mathcal{W}\) - Set of wind turbines indexed by \(w \in \{1,2,...,|\mathcal{W}|\}\)
Available Parameters
Question: What are possible parameters?
. . .
- \(c^{var}_g\) - Cost of thermal generator \(g\in\mathcal{G}\) in [\(EUR/\text{MWh}\)]
- \(c^{var}_w\) - Cost of wind turbine \(w\in\mathcal{W}\) in [\(EUR/\text{MWh}\)]
- \(p^{\min}_g\) - Minimum power output of thermal generator \(g\in\mathcal{G}\) in [MW]
- \(p^{\max}_g\) - Maximum power output of thermal generator \(g\in\mathcal{G}\) in [MW]
- \(p^{f}_w\) - Forecasted power output of wind turbine \(w\in\mathcal{W}\) in [MW]
- \(d^f\) - Forecasted demand in [MW]
Decision Variables?
- Thermal generators indexed by \(g \in \{1,2,...,|\mathcal{G}|\}\)
- Wind turbines indexed by \(w \in \{1,2,...,|\mathcal{W}|\}\)
. . .
Minimize the electricity supply cost while satisfying the demand and adhering to the production capacity.
. . .
Question: What could be our decision variable/s?
Decision Variables
- \(p_g\) - Power output of thermal generator \(g\in\mathcal{G}\)
- \(p_w\) - Power injection of wind turbine \(w\in\mathcal{W}\)
Model Formulation
Objective Function?
Minimize the electricity supply cost while satisfying the demand and adhering to the production capacity.
. . .
Question: What could be our objective function?
. . .
- \(p_g\) - Power output of thermal generator \(g\in\mathcal{G}\)
- \(p_w\) - Power injection of wind turbine \(w\in\mathcal{W}\)
Objective Function
- \(c^{var}_g\) - Cost of thermal generator \(g\in\mathcal{G}\) in [€/]
- \(c^{var}_w\) - Cost of wind turbine \(w\in\mathcal{W}\) in [€/]
. . .
\(\text{Minimize} \quad \sum_{g=1}^{\mathcal{G}} (c^{var}_g p_g) + \sum_{w=1}^{\mathcal{W}} (c^{var}_w p_w)\)
Constraints
Generator Limits Constraints?
Minimum and maximum power limits the power output of generators.
. . .
- \(p_g\) - Power output of thermal generator \(g\in\mathcal{G}\)
- \(p^{\min}_g\) - Minimum power output of thermal generator \(g\in\mathcal{G}\) in [MW]
- \(p^{\max}_g\) - Maximum power output of thermal generator \(g\in\mathcal{G}\) in [MW]
. . .
Question: What could the constraint look like?
Generator Limits Constraints
\(p^{\min}_g \leq p_g \leq p^{\max}_g \quad \forall g\in\mathcal{G}\)
. . .
- \(p_g\) - Power output of thermal generator \(g\in\mathcal{G}\)
- \(p^{\min}_g\) - Minimum power output of thermal generator \(g\in\mathcal{G}\) in [MW]
- \(p^{\max}_g\) - Maximum power output of thermal generator \(g\in\mathcal{G}\) in [MW]
. . .
Question: What does \(\forall g\in\mathcal{G}\) mean?
Renewable Power Injection Constraints?
Renewable power injection into the grid or power balance is limited by the renewable power forecast, e.g. wind power.
. . .
- \(p_w\) - Power injection of wind turbine \(w\in\mathcal{W}\)
- \(p^{f}_w\) - Forecasted power output of wind turbine \(w\in\mathcal{W}\) in [MW]
. . .
Question: What could the second constraint be?
Wind Power Injection Constraints
:::
\(0 \leq p_w \leq p^f_w \quad \forall w\in\mathcal{W}\)
:::
. . .
Question: What kind of constraint is this? Think about what is limited.
Power Balance Constraints?
Maintain that produced and consumed power in the system is equal.
. . .
- \(p_g\) - Power output of thermal generator \(g\in\mathcal{G}\)
- \(p_w\) - Power injection of wind turbine \(w\in\mathcal{W}\)
- \(d^f\) - Forecasted demand in [MW]
Power Balance Constraints
\[\sum_{g=1}^{\mathcal{G}} p_g + \sum_{w=1}^{\mathcal{W}} p_w = d^f\]
. . .
And that’s basically it!
Economic Dispatch: Objective Function
\(\text{Minimize} \quad \sum_{g=1}^{\mathcal{G}} (c^{var}_g p_g) + \sum_{w=1}^{\mathcal{W}} (c^{var}_w p_w)\)
Minimize the electricity supply cost while satisfying the demand and adhering to the production capacity.
Economic Dispatch: Constraints
\(p^{\min}_g \leq p_g \leq p^{\max}_g \quad \forall g\in\mathcal{G}\)$
\(0 \leq p_w \leq p^f_w \quad \forall w\in\mathcal{W}\)$
\(\sum_{g=1}^{\mathcal{G}} p_g + \sum_{w=1}^{\mathcal{W}} p_w = d^f\)$
Generator limits are respected, wind power is bounded by forecast, and power balance is maintained.
Economic Dispatch: Variable Domains
\(p_g \geq 0 \quad \forall g\in\mathcal{G}\)
\(p_w \geq 0 \quad \forall w\in\mathcal{W}\)
All power outputs are non-negative.
. . .
Question: Are these necessary?
Economic Dispatch: Complete Model
\(\text{Minimize} \quad \sum_{g=1}^{\mathcal{G}} (c^{var}_g p_g) + \sum_{w=1}^{\mathcal{W}} (c^{var}_w p_w)\)
subject to
\(\sum_{g=1}^{\mathcal{G}} p_g + \sum_{w=1}^{\mathcal{W}} p_w = d^f\)
\(p^{\min}_g \leq p_g \leq p^{\max}_g \quad \forall g\in\mathcal{G}\)
\(0 \leq p_w \leq p^f_w \quad \forall w\in\mathcal{W}\)
Model Characteristics
Some Basics
There exist several types of optimization problems:
- Linear (LP): Linear constraints and objective function
- Mixed-integer (MIP): Linear constraints and objective function, but discrete variable domains
- Quadratic (QP): Quadratic constraints and/or objective
- Non-linear (NLP): Non-linear constraints and/or objective
- And more!
Solution Algorithms
- Simplex algorithm to solve LPs
- Branch & Bound to solve MIPs
- Outer-Approximation for mixed-integer NLPs
- Math-Heuristics (e.g., Fix-and-Optimize, Tabu-Search, …)
- Decomposition methods (Lagrange, Benders, …)
- Heuristics (greedy, construction method, n-opt, …)
- Graph theoretical methods (network flow, shortest path)
Model Characteristics
Questions: On model characteristics
- Is the model formulation linear/ non-linear?
- What kind of variable domains do we have?
- What kind of solution algorithm could we use?
Model Assumptions
Questions: On model assumptions
- What assumptions have we made?
- What is the problem with the generator production and power balance?
- Any idea how to solve it?
Impact
Utility companies
The ED problem is the smallest and simplest form of operational planning every utility company has to perform.
What are further considerations to make?
- on/off status of system components -> unit commitment (UC) problem
- efficiency losses
- ramp rates
- minimum up- and downtimes
- storages -> multiple timesteps
- uncertainty in forecasts
Power System Basic Models: Unit Commitment
- considers binary decisions if a unit, e.g., thermal generator, in the power system is switched on or off
- decision are made over a time horizon, which means that variables are also indexed by timesteps.
We will cover the unit commitment problem in the next lecture.
. . .
We now have covered the basics of the ED and are ready to start solving some tasks in the upcoming tutorial.
Literature
Literature I
For more interesting literature to learn more about Julia, take a look at the literature list of this course.