Lecture VIII - Energy System Design Problem
Energy System Optimization with Julia
Quick Recap from last Week
Unit Commitment Problem with Storage Overview
Objective: Minimize total generation and storage costs over multiple time periods
Decision Variables:
- Power output of thermal generators (\(p_{g,t}\))
- Power output of wind turbines (\(p_{w,t}\))
- Binary variables for generator status (\(u_{g,t}\))
- Binary variables for startup events (\(v_{g,t}\))
- Storage energy level (\(e_{s,t}\))
- Storage charging power (\(p^{ch}_{s,t}\))
- Storage discharging power (\(p^{dis}_{s,t}\))
- Binary variables for storage charging status (\(u^{ch}_{s,t}\))
- Binary variables for storage discharging status (\(u^{dis}_{s,t}\))
Key Constraints:
- Power balance (including storage)
- Generator limits
- Wind limits
- Minimum up/down times
- Ramp rate limits
- Startup variable definition
- Storage energy balance
- Storage energy limits
- Storage power limits and mutual exclusion
- Storage ramp rate limits
The Unit Commitment problem with storage extends the basic UC problem by adding storage system modeling and operation constraints.
Mathematical Formulation
Objective Function
\(\text{Minimize} \quad \sum_{t \in \mathcal{T}} \left( \sum_{g \in \mathcal{G}} (c^{var}_g p_{g,t} + c^{fix}_g u_{g,t} + c^{start}_g v_{g,t}) + \sum_{w \in \mathcal{W}} c^{var}_w p_{w,t} \right)\)
Key Constraints
- Power Balance:
\(\sum_{g \in \mathcal{G}} p_{g,t} + \sum_{w \in \mathcal{W}} p_{w,t} + \sum_{s \in \mathcal{S}} (p^{dis}_{s,t} - p^{ch}_{s,t}) = d^f_t \quad \forall t \in \mathcal{T}\)
- Generator Limits:
\(p^{\min}_g u_{g,t} \leq p_{g,t} \leq p^{\max}_g u_{g,t} \quad \forall g \in \mathcal{G}, t \in \mathcal{T}\)
- Wind Power:
\(0 \leq p_{w,t} \leq p^f_{w,t} \quad \forall w \in \mathcal{W}, t \in \mathcal{T}\)
- Storage Energy Balance:
\(e_{s,t} = (1-sdr_s)e_{s,t-1} + \eta^{ch}_s p^{ch}_{s,t} - \frac{p^{dis}_{s,t}}{\eta^{dis}_s} \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\)
- Storage Energy Limits:
\(E^{min}_s \leq e_{s,t} \leq E^{max}_s \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\)
- Storage Power Limits and Mutual Exclusion:
\(0 \leq p^{ch}_{s,t} \leq P^{ch,max}_s u^{ch}_{s,t} \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\) \(0 \leq p^{dis}_{s,t} \leq P^{dis,max}_s u^{dis}_{s,t} \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\) \(u^{ch}_{s,t} + u^{dis}_{s,t} \leq 1 \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\)
- Storage Ramp Rate Limits:
\(p^{ch}_{s,t} - p^{ch}_{s,t-1} \leq R^{ch}_s \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\) \(p^{dis}_{s,t} - p^{dis}_{s,t-1} \leq R^{dis}_s \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\)
Model Characteristics
- Mixed-Integer Linear Programming (MILP) problem
- Binary variables for generator status, startup events, and storage operation
- Time-dependent decisions for both generation and storage
- Computationally challenging due to:
- Large number of binary variables
- Large number of time steps
- Large number of constraints
The Unit Commitment problem with storage provides a comprehensive model for power system operation, including both generation and storage resources.
Implementation Insights
- Data structures use NamedTuples for efficient parameter storage
- Results are stored in DataFrames for easy analysis
- Key metrics tracked:
- Total system cost
- Wind curtailment
- Thermal and wind generation
- Generator status and startup events
- Storage energy levels
- Storage charging/discharging power
The tutorial demonstrated how to implement and solve the UC problem with storage using Julia and JuMP, including visualization of generation and storage operation over time.
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!
Excursion: Tight and Compact Formulations
What are Tight and Compact Formulations?
In mathematical optimization, particularly for Mixed-Integer Linear Programming (MILP) problems like the Unit Commitment problem, the concepts of “tight” and “compact” formulations are crucial for efficient problem solving.
Tight Formulations
A formulation is considered “tight” when there is a small gap between the optimal solution of the linear programming (LP) relaxation and the integer solution. This is important because:
- It helps solvers find optimal solutions faster
- It provides better lower bounds for branch-and-bound algorithms
- It reduces the search space for integer solutions
Compact Formulations
A formulation is considered “compact” when it uses fewer variables and constraints while maintaining accuracy. This is important because:
- It reduces computational complexity
- It decreases memory requirements
- It can speed up solution times
- It makes the model easier to understand and maintain
Examples in UC with Storage
1. Tight Formulations
Example 1 - Generator Commitment:
# Less tight formulation
p_{g,t} ≤ P^{max}_g u_{g,t} # Only upper bound
# Tighter formulation
P^{min}_g u_{g,t} ≤ p_{g,t} ≤ P^{max}_g u_{g,t} # Both bounds
- The second formulation is tighter because it includes both minimum and maximum power constraints
- This reduces the feasible region of the LP relaxation
- Makes it easier for the solver to find integer solutions
Example 2 - Storage Operation:
# Less tight formulation
e_{s,t} = e_{s,t-1} + p^{ch}_{s,t} - p^{dis}_{s,t} # Without efficiency
# Tighter formulation
e_{s,t} = (1-sdr_s)e_{s,t-1} + η^{ch}_s p^{ch}_{s,t} - p^{dis}_{s,t}/η^{dis}_s # With efficiency
- The second formulation is tighter because it accounts for efficiency losses
- This better represents the physical reality of storage operation
- Helps the solver find more realistic solutions
2. Compact Formulations
Example 1 - Minimum Up/Down Times:
# Less compact formulation
u_{g,t} - u_{g,t-1} ≤ u_{g,τ} ∀τ ∈ [t+1, t+T^{up}_g-1]
u_{g,t-1} - u_{g,t} ≤ 1 - u_{g,τ} ∀τ ∈ [t+1, t+T^{down}_g-1]
# More compact formulation
∑_{τ=t}^{t+T^{up}_g-1} u_{g,τ} ≥ T^{up}_g (u_{g,t} - u_{g,t-1})
∑_{τ=t}^{t+T^{down}_g-1} (1-u_{g,τ}) ≥ T^{down}_g (u_{g,t-1} - u_{g,t})
- The second formulation uses fewer constraints
- Achieves the same result with less computational overhead
- Makes the model more efficient to solve
Example 2 - Storage Mutual Exclusion:
# Less compact formulation
p^{ch}_{s,t} ≤ P^{ch,max}_s u^{ch}_{s,t}
p^{dis}_{s,t} ≤ P^{dis,max}_s u^{dis}_{s,t}
u^{ch}_{s,t} + u^{dis}_{s,t} ≤ 1
# More compact formulation
p^{ch}_{s,t}/P^{ch,max}_s + p^{dis}_{s,t}/P^{dis,max}_s ≤ 1
- The second formulation combines three constraints into one
- Reduces the number of binary variables needed
- Simplifies the model while maintaining accuracy
Why These Concepts Matter
Computational Efficiency
- Tighter formulations reduce the search space
- Compact formulations reduce the problem size
- Both lead to faster solution times
Solution Quality
- Tighter formulations provide better bounds
- Help find optimal solutions more reliably
- Reduce the gap between LP relaxation and integer solution
Practical Implementation
- More efficient use of computational resources
- Better handling of large-scale problems
- More reliable results for real-world applications
Trade-offs to Consider
Tightness vs. Compactness
- Sometimes making a formulation tighter makes it less compact
- Need to balance between tightness and problem size
- Choose based on specific problem characteristics
Model Complexity
- More complex formulations might be tighter but harder to understand
- Simpler formulations might be more compact but less accurate
- Need to find the right balance for your specific use case
These concepts are particularly important in the Unit Commitment problem with storage and approximations of part-load efficiencies because:
- The problem is already complex with many variables and constraints
- Storage adds additional complexity with its operational constraints
- Real-world applications need efficient solutions
- The problem size can grow quickly with more time periods or storage units
Introduction
Energy System Design Problem
In this lecture, we extend the Unit Commitment problem to include investment decisions for energy system components. This allows us to:
- Optimize technology selection
- Determine optimal component sizes
- Balance investment and operational costs
- Plan local energy systems holistically
The design problem combines investment planning (sizing) with operational optimization, enabling comprehensive energy system design.
Key Components
We will focus on optimizing:
- Storage systems
- Wind parks
- PV parks
- Electric market participation
… while fullfilling a fixed electric demand. Additionally, we consider a maximum investment budget.
All nominal sizes will be decision variables in our optimization model.
Mathematical Formulation of the Deterministic Design Problem
Sets
- \(\mathcal{T}\) - Set of time periods indexed by \(t \in \{1,2,...,|\mathcal{T}|\}\)
- \(\mathcal{S}\) - Set of storage systems indexed by \(s \in \{1,2,...,|\mathcal{S}|\}\)
- \(\mathcal{W}\) - Set of wind parks indexed by \(w \in \{1,2,...,|\mathcal{W}|\}\)
- \(\mathcal{V}\) - Set of PV parks indexed by \(v \in \{1,2,...,|\mathcal{V}|\}\)
Decision Variables
Investment Variables
- \(e^{nom}_s\) - Nominal energy capacity of storage \(s\) [MWh]
- \(p^{ch,nom}_s\) - Nominal charging power of storage \(s\) [MW]
- \(p^{dis,nom}_s\) - Nominal discharging power of storage \(s\) [MW]
- \(p^{nom}_w\) - Nominal power of wind park \(w\) [MW]
- \(p^{nom}_v\) - Nominal power of PV park \(v\) [MW]
Operational Variables
- \(p_{w,t}\) - Power output of wind park \(w\) at time \(t\) [MW]
- \(p_{v,t}\) - Power output of PV park \(v\) at time \(t\) [MW]
- \(p^{in}_t\) - Power inflow through market at time \(t\) [MW]
- \(p^{out}_t\) - Power outflow through market at time \(t\) [MW]
- \(p^{ch}_{s,t}\) - Charging power of storage \(s\) at time \(t\) [MW]
- \(p^{dis}_{s,t}\) - Discharging power of storage \(s\) at time \(t\) [MW]
- \(e_{s,t}\) - Energy level of storage \(s\) at time \(t\) [MWh]
Annual Cost Variables
- \(AC^{inv}_s\) - Annual investment cost for storage \(s\) [EUR/year]
- \(AC^{inv}_w\) - Annual investment cost for wind park \(w\) [EUR/year]
- \(AC^{inv}_v\) - Annual investment cost for PV park \(v\) [EUR/year]
- \(AC^{grid,imp}\) - Annual grid electricity import cost [EUR/year]
- \(AR^{grid,exp}\) - Annual grid electricity export revenue [EUR/year]
Parameters
Investment Costs
- \(C^{E}_s\) - Cost per MWh of energy capacity for storage \(s\) [EUR/MWh]
- \(C^{P,ch}_s\) - Cost per MW of charging power capacity for storage \(s\) [EUR/MW]
- \(C^{P,dis}_s\) - Cost per MW of discharging power capacity for storage \(s\) [EUR/MW]
- \(C^{W}_w\) - Cost per MW of wind park \(w\) [EUR/MW]
- \(C^{PV}_v\) - Cost per MW of PV park \(v\) [EUR/MW]
- \(F^{PVAF}\) - Present value annuity factor for investment costs
- \(B^{max}\) - Maximum investment budget [EUR]
Operational Parameters
- \(\eta^{ch}_s\) - Charging efficiency of storage \(s\)
- \(\eta^{dis}_s\) - Discharging efficiency of storage \(s\)
- \(sdr_s\) - Self-discharge rate of storage \(s\) per time step
- \(DoD_s\) - Depth of discharge limit for storage \(s\) [%]
- \(f_{w,t}\) - Wind capacity factor at time \(t\) for wind park \(w\)
- \(f_{v,t}\) - Solar capacity factor at time \(t\) for PV park \(v\)
- \(d_t\) - Electric demand at time \(t\) [MW]
- \(c^{MP}_t\) - Grid electricity market price at time \(t\) [EUR/MWh]
- \(c^{TaL}\) - Grid electricity taxes and levies (including Netzentgelt) [EUR/MWh]
Present Value Annuity Factor (PVAF)
The Present Value Annuity Factor (PVAF) is used to convert investment costs into equivalent annual costs. It is calculated as:
\(F^{PVAF} = \frac{(1 + r)^n - 1}{r(1 + r)^n}\)
where: - \(r\) is the discount rate (e.g., 0.05 for 5%) - \(n\) is the component lifetime in years (we assume the same lifetime for all components in the following)
This factor allows us to:
- Convert one-time investment costs into equivalent annual costs
- Account for the time value of money
- Compare investments with different lifetimes
- Make investment decisions based on annual costs
Objective Function
\(\text{Minimize} \quad \sum_{s \in \mathcal{S}} AC^{inv}_s + \sum_{w \in \mathcal{W}} AC^{inv}_w + \sum_{v \in \mathcal{V}} AC^{inv}_v + AC^{grid,imp} - AR^{grid,exp}\)
The objective function minimizes the total annual costs of the energy system:
Investment costs for all components:
- Storage systems (energy and power capacity)
- Wind parks
- PV parks
Grid electricity costs/revenues:
- Import costs (market price + taxes/levies including Netzentgelt)
- Export revenue (market price only)
Annual Cost Constraints
Investment Costs
\(AC^{inv}_s = \frac{C^{E}_s}{F^{PVAF}} e^{nom}_s + \frac{C^{P,ch}_s}{F^{PVAF}} p^{ch,nom}_s + \frac{C^{P,dis}_s}{F^{PVAF}} p^{dis,nom}_s \quad \forall s \in \mathcal{S}\) \(AC^{inv}_w = \frac{C^{W}_w}{F^{PVAF}} p^{nom}_w \quad \forall w \in \mathcal{W}\) \(AC^{inv}_v = \frac{C^{PV}_v}{F^{PVAF}} p^{nom}_v \quad \forall v \in \mathcal{V}\)
The investment costs are annualized using the Present Value Annuity Factor (PVAF):
Storage investment includes:
- Energy capacity costs
- Charging power capacity costs
- Discharging power capacity costs
Wind and PV investment include:
- Power capacity costs only
Investment Budget
\(\sum_{s \in \mathcal{S}} (C^{E}_s e^{nom}_s + C^{P,ch}_s p^{ch,nom}_s + C^{P,dis}_s p^{dis,nom}_s) + \sum_{w \in \mathcal{W}} C^{W}_w p^{nom}_w + \sum_{v \in \mathcal{V}} C^{PV}_v p^{nom}_v \leq B^{max}\)
The investment budget constraint ensures that:
Total investment costs do not exceed the maximum budget
Includes all component investments:
- Storage systems (energy and power capacity)
- Wind parks
- PV parks
Grid Electricity Costs
\(AC^{grid,imp} = \sum_{t \in \mathcal{T}} (c^{MP}_t + c^{TaL}) p^{in}_t\) \(AR^{grid,exp} = \sum_{t \in \mathcal{T}} c^{MP}_t p^{out}_t\)
The grid electricity costs and revenues are calculated as:
Import costs include:
- Time-dependent market price
- Fixed taxes and levies (including Netzentgelt)
Export revenue includes:
- Time-dependent market price only
Constraints
Power Balance
\(\sum_{w \in \mathcal{W}} p_{w,t} + \sum_{v \in \mathcal{V}} p_{v,t} + (p^{in}_t - p^{out}_t) + \sum_{s \in \mathcal{S}} (p^{dis}_{s,t} - p^{ch}_{s,t}) = d_t \quad \forall t \in \mathcal{T}\)
The power balance ensures that at each time step:
Total generation equals total demand:
- Wind generation
- PV generation
- Grid import/export
- Storage charging/discharging
Net grid power flow is:
- Positive for import
- Negative for export
Component Limits
Wind Parks
\(0 \leq p_{w,t} \leq f_{w,t} p^{nom}_w \quad \forall w \in \mathcal{W}, t \in \mathcal{T}\)
Wind power output is constrained by:
Non-negativity (no negative generation)
Maximum available power:
- Time-dependent capacity factor
- Nominal power capacity
PV Parks
\(0 \leq p_{v,t} \leq f_{v,t} p^{nom}_v \quad \forall v \in \mathcal{V}, t \in \mathcal{T}\)
PV power output is constrained by:
Non-negativity (no negative generation)
Maximum available power:
- Time-dependent capacity factor
- Nominal power capacity
Storage Systems
\(0 \leq p^{ch}_{s,t} \leq p^{ch,nom}_s \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\) \(0 \leq p^{dis}_{s,t} \leq p^{dis,nom}_s \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\) \(DoD_s e^{nom}_s \leq e_{s,t} \leq e^{nom}_s \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\)
Storage operation is constrained by:
Charging power limits:
- Non-negativity
- Nominal charging power capacity
Discharging power limits:
- Non-negativity
- Nominal discharging power capacity
Energy level limits:
- Minimum level based on depth of discharge
- Maximum level based on nominal capacity
Storage Energy Balance
\(e_{s,t} = (1-sdr_s)e_{s,t-1} + \eta^{ch}_s p^{ch}_{s,t} - \frac{p^{dis}_{s,t}}{\eta^{dis}_s} \quad \forall s \in \mathcal{S}, t \in \mathcal{T}\)
The storage energy balance accounts for:
Previous energy level:
- Reduced by self-discharge
Charging:
- Increased by charging power
- Reduced by charging efficiency losses
Discharging:
- Decreased by discharging power
- Decreased by discharging efficiency losses
Implementation Insights
Model Characteristics
- Mixed-Integer Linear Programming (MILP) problem
- Combines investment and operational decisions
- Large-scale optimization problem
- Requires efficient solution methods
The model can be adapted to the specific use case, i.e. if a windpark already has a fixed capacity, the corresponding variable can be coverted to a parameter.
Key Considerations
- Time Resolution:
- Balance between accuracy and computational effort
- Consider representative periods
- Account for seasonal variations
- Investment Costs:
- Annualize investment costs using PVAF
- Consider component lifetimes
- Include maintenance costs
- Operational Constraints:
- Storage cycling limits
- Grid connection capacity
- Renewable generation profiles
- Solution Methods:
- Decomposition approaches
- Heuristic methods
- Commercial solvers
Applications
Real-World Use Cases
- Local Energy Systems:
- Microgrids
- Industrial parks
- Residential communities
- Grid Integration:
- Renewable energy integration
- Grid capacity planning
- Ancillary services
- Energy Markets:
- Multi-market participation
- Price arbitrage
- Capacity markets
Extensions
- Multi-Criteria Optimization:
- Economic objectives
- Environmental impact
- System reliability
- Uncertainty Handling:
- Weather forecasts
- Price forecasts
- Demand forecasts
- Advanced Features:
- Battery degradation
- Multi-market participation
- Grid services
The sizing problem provides a foundation for comprehensive energy system planning and optimization.