Energy System Optimization with Julia
Hamburg University of Applied Science - Summer 2025
Tip
Use meaningful variable names and comments to make your model easier to understand.
Tip
Conditional constraints allow flexible and dynamic model formulations reflecting conditions and dependencies in the constraint application.
Model()
optimize!()
to solve the modelTip
Always check the solution status before using the results to ensure the model solved successfully.
Tip
You can ask questions anytime in class or via email!
How does the mathematical model look like?
Question: What are sets again?
Sets are collections of objects.
Question: What could be the sets here?
Question: What are possible parameters?
We have the following sets:
Our objective is to:
Minimize the electricity supply cost while satisfying the demand and adhering to the production capacity.
Question: What could be our decision variable/s?
Our objective is to:
Minimize the electricity supply cost while satisfying the demand and adhering to the production capacity.
Question: What could be our objective function?
We need the following variables:
We need the following parameters:
\(\text{Minimize} \quad \sum_{g=1}^{\mathcal{G}} (c^{var}_g p_g) + \sum_{w=1}^{\mathcal{W}} (c^{var}_w p_w)\)
The goal of these constraints is to:
Minimum and maximum power limits the power output of generators.
We need the following variables and parameters:
Question: What could the constraint look like?
\(p^{\min}_g \leq p_g \leq p^{\max}_g \quad \forall g\in\mathcal{G}\)
Remember, these are the variables and parameters:
Question: What does \(\forall g\in\mathcal{G}\) mean?
The goal of these constraints is to:
Renewable power injection into the grid or power balance is limited by the renewable power forecast, e.g. wind power.
We need the following variables and parameters:
Question: What could the second constraint be?
:::
\(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.
The goal of these constraints is to:
Maintain that produced and consumed power in the system is equal.
We need the following variables and parameters:
\[\sum_{g=1}^{\mathcal{G}} p_g + \sum_{w=1}^{\mathcal{W}} p_w = d^f\]
And that’s basically it!
\(\text{Minimize} \quad \sum_{g=1}^{\mathcal{G}} (c^{var}_g p_g) + \sum_{w=1}^{\mathcal{W}} (c^{var}_w p_w)\)
The goal of the objective function and model is to:
Minimize the electricity supply cost while satisfying the demand and adhering to the production capacity.
\(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\)$
Our constraints ensure:
Generator limits are respected, wind power is bounded by forecast, and power balance is maintained.
\(p_g \geq 0 \quad \forall g\in\mathcal{G}\)
\(p_w \geq 0 \quad \forall w\in\mathcal{W}\)
The variable domains make sure that:
All power outputs are non-negative.
Question: Are these necessary?
\(\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}\)
There exist several types of optimization problems:
Questions: On model characteristics
Questions: On model assumptions
Can this be applied?
The ED problem is the smallest and simplest form of operational planning every utility company has to perform.
Any idea how to
adapt the ED to UC?
We will cover the unit commitment problem in the next lecture.
And that’s it for todays lecture!
We now have covered the basics of the ED and are ready to start solving some tasks in the upcoming tutorial.
Questions?
For more interesting literature to learn more about Julia, take a look at the literature list of this course.
Lecture V - Economic Dispatch Problem | Dr. Tobias Cors | Home