TulipaEnergy / TulipaEnergyModel.jl

An energy system optimization model that is flexible, computationally efficient, and academically robust.
Apache License 2.0
22 stars 18 forks source link

Write down and review the formulation including different levels of detail #690

Open gnawin opened 1 week ago

gnawin commented 1 week ago

Two parts of the design based on three sources,

gnawin commented 1 week ago

Different levels of detail

Design  Feature 1 Feature 2
Simplest Total capacity Total flow (not considering vintage efficiencies)
Complicated Vintage capacity Vintage flow (directly considering vintage efficiencies)
Compact Vintage capacity Total flow (indirectly considering vintage efficiencies)

By vintage efficiencies, we mean both production efficiencies (represented by cost parameters in the obj) and conversion efficiencies (used in conversion balances).

The above table serves as a summary and will be elaborated later.

Design 1: simplest formulation

A year index is added to all the existing variables and parameters, and sets for temporal structures. It is needed for the economic representation.

This means, as shown by the below table, we will replace all $k$ with $k_y$, $\mathcal{K}$ with $\mathcal{K_y}$, $bk$ with $b{k_y}$, $\mathcal{Bk}$ with $\mathcal{B{k_y}}$.

For brevity, the rest of the changes in definitions are omitted. We will also update all sets for assets and flows, as they can change per year.

Sets for Temporal Structures

Name Description Elements Superset Notes
$\mathcal{Y}$ Milestone years $y \in \mathcal{Y}$ $\mathcal{Y} \subset \mathbb{N}$
$\mathcal{Yy}$ Vintage years for milestone year $y$ $v \in \{\mathcal{Yy}: y - p^{\text{technical lifetime}}_a(y) + 1 \le v\}$ $\mathcal{Yy} \subseteq \mathcal{Y}$
$\mathcal{K_y}$ Representative periods (rp) within year $y$ $k_y \in \mathcal{K_y}$ $\mathcal{K_y} \subset \mathbb{N}$ $\mathcal{K_y}$ does not have to be a subset of $\mathcal{P}$
$\mathcal{B}_{k_y}$ Timesteps blocks within a representative period $k_y$ within year $y$ $b_{ky} \in \mathcal{B}{k_y}$ $\mathcal{B}_{k_y}$ is a partition of timesteps in a representative period $k_y$

Parameters

omitted for now

Variables

omitted for now

Objective function

\begin{aligned}
\text{{minimize}} \quad & assets\_investment\_cost + assets\_fixed\_cost \\ 
                        & flows\_investment\_cost + flows\_fixed\_cost\\
                        & + flows\_variable\_cost
\end{aligned}

To be added:

\begin{aligned}
assets\_investment\_cost &= \sum_{y \in \mathcal{Y} } \bigg( \sum_{a \in \mathcal{A}_y^{\text{i}} } p^{\text{inv cost}}_{a, y} \cdot p^{\text{capacity}}_{a, y} \cdot v^{\text{inv}}_{a, y} \\ 
&+  \sum_{a \in \mathcal{A}_y^{\text{se}} \cap \mathcal{A}_y^{\text{i}} } p^{\text{inv cost energy}}_{a, y} \cdot p^{\text{energy capacity}}_{a, y} \cdot v^{\text{inv energy}}_{a, y} \bigg)  \\
assets\_fixed\_cost & =  \sum_{y \in \mathcal{Y} }  \sum_{a \in \mathcal{A}_y^{\text{i}} } p^{\text{fixed cost}}_{a, y} \cdot v^{\text{accumulated}}_{a, y} \\
flows\_investment\_cost &= \sum_{y \in \mathcal{Y} } \sum_{f \in \mathcal{F}_y^{\text{ti}}} p^{\text{inv cost}}_{f, y} \cdot p^{\text{capacity}}_{f, y} \cdot v^{\text{inv}}_{f, y} \\
flows\_fixed\_cost & =  \sum_{y \in \mathcal{Y} } \sum_{f \in \mathcal{F}_y^{\text{ti}}} p^{\text{fixed cost}}_{f, y} \cdot v^{\text{accumulated}}_{f, y} \\
flows\_variable\_cost &= \sum_{y \in \mathcal{Y} } \sum_{f \in \mathcal{F}_{y}} \sum_{k_y \in \mathcal{K_y}} \sum_{b_{k_y} \in \mathcal{B_{k_y}}} p^{\text{rp weight}}_{k_y} \cdot p^{\text{variable cost}}_{f, y} \cdot p^{\text{duration}}_{b_{k_y}} \cdot v^{\text{flow}}_{f, k_y, b_{k_y}}
\end{aligned}

We use an expression for $v{a, y}^{\text{accumulated}}$, which will replace all $v{a}^{\text{inv}}$. For now, it is only accumulated investment capacity, but later complications such as decommissioning will be added.

\begin{aligned}
v^{\text{accumulated}}_{a, y} = \sum_{i=\min \{ y \in \mathcal{Y_y} \} }^y v^{\text{inv}}_{a, i} \quad  \forall a \in \mathcal{A}_y^{\text{i}}, \forall y \in \mathcal{Y}\\
v^{\text{accumulated}}_{f, y} = \sum_{i=\min \{ y \in \mathcal{Y_y} \} }^y v^{\text{inv}}_{f, i} \quad  \forall f \in \mathcal{F}_y^{\text{ti}}, \forall y \in \mathcal{Y}
\end{aligned}

Note $v{a, y}^{\text{accumulated}}$ uses the invest tech $a$ at year $y$, but this tech may be not invested in the past, and thus may bring an "undefined" error for $v{a, y}^{\text{accumulated}}$ in the past. Be careful when implementing this.

Constraints

Maximum Output Flows Limit

For conversion, producer, and storage without binary method

\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{out}}_{a, y}} v^{\text{flow}}_{f,k_y,b_{k_y}} \leq p^{\text{availability profile}}_{a,k_y,b_{k_y}} \cdot \left(p^{\text{init capacity}}_{a, y} + p^{\text{capacity}}_{a, y} \cdot v^{\text{accumulated}}_{a, y} \right)  \quad
\\ \forall a \in \mathcal{A}_y^{\text{cv}} \cup \left(\mathcal{A}_y^{\text{s}} \setminus \mathcal{A}_y^{\text{sb}} \right) \cup \mathcal{A}_y^{\text{p}}, \forall k_v \in \mathcal{K_y},\forall b_{k_y} \in \mathcal{B}_{k_y}, \forall y \in \mathcal{Y} 
\end{aligned}

Balance Constraint for Conversion Assets

\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{in}}_{a,y}} p^{\text{eff}}_{f,y} \cdot v^{\text{flow}}_{f,k_y,b_{k_y}} = \sum_{f \in \mathcal{F}^{\text{out}}_{a,y}} \frac{v^{\text{flow}}_{f,k_y,b_{k_y}}}{p^{\text{eff}}_{f,y}} \quad \forall a \in \mathcal{A}_y^{\text{cv}}, \forall k_y \in \mathcal{K_y},\forall b_{k_y} \in \mathcal{B_{k_y}}, \forall y \in \mathcal{Y} 
\end{aligned}

Design 2: complicated formulation

Objective function

To be added:

\begin{aligned}
assets\_fixed\_cost & =  \sum_{y \in \mathcal{Y} }  \sum_{a \in \mathcal{A}_y^{\text{i}} } \sum_{i=\min\{v\in \mathcal{Y_y}\}}^{y}  p^{\text{fixed cost}}_{a, y, i} \cdot v^{\text{accumulated}}_{a, y, i} \\
flows\_fixed\_cost & =  \sum_{y \in \mathcal{Y} } \sum_{f \in \mathcal{F}_y^{\text{ti}}} \sum_{i=\min\{v\in \mathcal{Y_y}\}}^{y} p^{\text{fixed cost}}_{f, y, i} \cdot v^{\text{accumulated}}_{f, y, i} \\
flows\_variable\_cost &= \sum_{y \in \mathcal{Y} } \sum_{f \in \mathcal{F}_{y}} \sum_{i=\min\{v\in \mathcal{Y_y}\}}^{y} \sum_{k_y \in \mathcal{K_y}} \sum_{b_{k_y} \in \mathcal{B_{k_y}}} p^{\text{rp weight}}_{k_y} \cdot p^{\text{variable cost}}_{f, y, i} \cdot p^{\text{duration}}_{b_{k_y}} \cdot v^{\text{flow}}_{f, i, k_y, b_{k_y}}
\end{aligned}
\begin{aligned}
v^{\text{accumulated}}_{a, y, v} = v^{\text{inv}}_{a, v} \quad  \forall a \in \mathcal{A}_y^{\text{i}}, \forall (y,v) \in \{\mathcal{Y}, \mathcal{Y_y} \} \\
v^{\text{accumulated}}_{f, y,v} = v^{\text{inv}}_{f, v} \quad  \forall f \in \mathcal{F}_y^{\text{ti}}, \forall (y,v) \in \{\mathcal{Y}, \mathcal{Y_y} \} 
\end{aligned}

Constraints

Maximum Output Flows Limit

For conversion, producer, and storage without binary method

\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{out}}_{a, y}} v^{\text{flow}}_{f, v, k_y,b_{k_y}} \leq p^{\text{availability profile}}_{a, v, k_y,b_{k_y}} \cdot \left(p^{\text{init capacity}}_{a, y, v} + p^{\text{capacity}}_{a, y, v} \cdot v^{\text{accumulated}}_{a, y, v} \right)  \quad
\\ \forall a \in \mathcal{A}_y^{\text{cv}} \cup \left(\mathcal{A}_y^{\text{s}} \setminus \mathcal{A}_y^{\text{sb}} \right) \cup \mathcal{A}_y^{\text{p}}, \forall k_y \in \mathcal{K_y},\forall b_{k_y} \in \mathcal{B}_{k_y}, \forall (y,v) \in \{\mathcal{Y}, \mathcal{Y_y} \} 
\end{aligned}

Balance Constraint for Conversion Assets

\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{in}}_{a,y}} p^{\text{eff}}_{f,y,v} \cdot v^{\text{flow}}_{f, v, k_y,b_{k_y}} = \sum_{f \in \mathcal{F}^{\text{out}}_{a,y}} \frac{v^{\text{flow}}_{f,v,k_y,b_{k_y}}}{p^{\text{eff}}_{f,y,v}} \quad \forall a \in \mathcal{A}_y^{\text{cv}}, \forall k_y \in \mathcal{K_y},\forall b_{k_y} \in \mathcal{B_{k_y}}, \forall (y,v) \in \{\mathcal{Y}, \mathcal{Y_y} \} 
\end{aligned}

Design 3: compact formulation

Objective function

To be added:

$assets\_fixed\_cost$ and $flows\_fixed\_cost$ are the same with Design 2 (and thus so is accumulated capacity), $flows\_variable\_cost$ is the same with Design 1.

\begin{aligned}
assets\_fixed\_cost & =  \sum_{y \in \mathcal{Y} }  \sum_{a \in \mathcal{A}_y^{\text{i}} } \sum_{i=\min\{v\in \mathcal{Y_y}\}}^{y}  p^{\text{fixed cost}}_{a, y, i} \cdot v^{\text{accumulated}}_{a, y, i} \\
flows\_fixed\_cost & =  \sum_{y \in \mathcal{Y} } \sum_{f \in \mathcal{F}_y^{\text{ti}}} \sum_{i=\min\{v\in \mathcal{Y_y}\}}^{y} p^{\text{fixed cost}}_{f, y, i} \cdot v^{\text{accumulated}}_{f, y, i} \\
flows\_variable\_cost &= \sum_{y \in \mathcal{Y} } \sum_{f \in \mathcal{F}_{y}} \sum_{k_y \in \mathcal{K_y}} \sum_{b_{k_y} \in \mathcal{B_{k_y}}} p^{\text{rp weight}}_{k_y} \cdot p^{\text{variable cost}}_{f, y} \cdot p^{\text{duration}}_{b_{k_y}} \cdot v^{\text{flow}}_{f, k_y, b_{k_y}}
\end{aligned}

Here $p^{\text{variable cost}}_{f, y}$ should be carefully chosen to reflect the efficiencies for vintage years.

\begin{aligned}
v^{\text{accumulated}}_{a, y, v} = v^{\text{inv}}_{a, v} \quad  \forall a \in \mathcal{A}_y^{\text{i}}, \forall (y,v) \in \{\mathcal{Y}, \mathcal{Y_y} \} \\
v^{\text{accumulated}}_{f, y,v} = v^{\text{inv}}_{f, v} \quad  \forall f \in \mathcal{F}_y^{\text{ti}}, \forall (y,v) \in \{\mathcal{Y}, \mathcal{Y_y} \} 
\end{aligned}

Constraints

Maximum Output Flows Limit

For conversion, producer, and storage without binary method

\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{out}}_{a, y}} v^{\text{flow}}_{f, k_y,b_{k_y}} \leq \sum_{i=\min\{v\in \mathcal{Y_y}\}}^{y}  p^{\text{availability profile}}_{a, v, k_y,b_{k_y}} \cdot \left(p^{\text{init capacity}}_{a, y, v} + p^{\text{capacity}}_{a, y, v} \cdot v^{\text{accumulated}}_{a, y, v} \right)  \quad
\\ \forall a \in \mathcal{A}_y^{\text{cv}} \cup \left(\mathcal{A}_y^{\text{s}} \setminus \mathcal{A}_y^{\text{sb}} \right) \cup \mathcal{A}_y^{\text{p}}, \forall k_y \in \mathcal{K_y},\forall b_{k_y} \in \mathcal{B}_{k_y}, \forall y \in \mathcal{Y} 
\end{aligned}

Balance Constraint for Conversion Assets

This constraint is the same as in Design 1. However, since it is a compact formulation from Design 2, we should carefully choose $p{f,y}^{\text{eff}}$, e.g., a conservative choice $p{f,y}^{\text{eff}} = \min p_{f,y,v}^{\text{eff}}$

\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{in}}_{a,y}} p^{\text{eff}}_{f,y} \cdot v^{\text{flow}}_{f,k_y,b_{k_y}} = \sum_{f \in \mathcal{F}^{\text{out}}_{a,y}} \frac{v^{\text{flow}}_{f,k_y,b_{k_y}}}{p^{\text{eff}}_{f,y}} \quad \forall a \in \mathcal{A}_y^{\text{cv}}, \forall k_y \in \mathcal{K_y},\forall b_{k_y} \in \mathcal{B_{k_y}}, \forall y \in \mathcal{Y} 
\end{aligned}