Skip to content

Commit

Permalink
Update documentation with formulation to avoid storage charging and d…
Browse files Browse the repository at this point in the history
…ischarging simultaneously (#644)
  • Loading branch information
datejada committed May 14, 2024
1 parent 292dbdd commit a4008dc
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 11 deletions.
49 changes: 41 additions & 8 deletions docs/src/formulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ The complete mathematical formulation, including variable temporal resolutions,

In addition, the following asset sets represent methods for incorporating additional variables and constraints in the model.

| Name | Description | Elements | Superset | Notes |
| ------------------------- | ------------------------------------------ | -------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| $\mathcal{A}^{\text{i}}$ | Energy assets with investment method | | $\mathcal{A}^{\text{i}} \subseteq \mathcal{A}$ | |
| $\mathcal{A}^{\text{ss}}$ | Storage energy assets with seasonal method | | $\mathcal{A}^{\text{ss}} \subseteq \mathcal{A}^{\text{s}}$ | |
| $\mathcal{A}^{\text{se}}$ | Storage energy assets with energy method | | $\mathcal{A}^{\text{se}} \subseteq \mathcal{A}^{\text{s}}$ | This set contains storage assets that use investment energy method (`storage_method_energy = true` in the file [`assets-data.csv`](@ref schemas)). Otherwise fixed energy-to-power ratio method is used. |
| Name | Description | Elements | Superset | Notes |
| ------------------------- | ------------------------------------------ | -------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| $\mathcal{A}^{\text{i}}$ | Energy assets with investment method | | $\mathcal{A}^{\text{i}} \subseteq \mathcal{A}$ | |
| $\mathcal{A}^{\text{ss}}$ | Storage energy assets with seasonal method | | $\mathcal{A}^{\text{ss}} \subseteq \mathcal{A}^{\text{s}}$ | |
| $\mathcal{A}^{\text{se}}$ | Storage energy assets with energy method | | $\mathcal{A}^{\text{se}} \subseteq \mathcal{A}^{\text{s}}$ | This set contains storage assets that use investment energy method (`storage_method_energy = true` in the file [`assets-data.csv`](@ref schemas)). Otherwise fixed energy-to-power ratio method is used. |
| $\mathcal{A}^{\text{sb}}$ | Storage energy assets with binary method | | $\mathcal{A}^{\text{sb}} \subseteq \mathcal{A}^{\text{s}} \setminus \mathcal{A}^{\text{ss}}$ | This set contains storage assets that use an extra binary variable to avoid charging and discharging simultaneously (`use_binary_storage_method` set to `binary` or `relaxed_binary` in the file [`assets-data.csv`](@ref schemas)). |

### Sets for Flows

Expand Down Expand Up @@ -115,6 +116,7 @@ In addition, the following flow sets represent methods for incorporating additio
| $v^{\text{inv}}_{f}$ | $\mathbb{Z}_{+}$ | $f \in \mathcal{F}^{\text{ti}}$ | Number of invested units of capacity increment of transport flow $f$ | [units] |
| $v^{\text{intra-storage}}_{a,k,b_k}$ | $\mathbb{R}_{+}$ | $a \in \mathcal{A}^{\text{s}} \setminus \mathcal{A}^{\text{ss}}$, $k \in \mathcal{K}$, $b_k \in \mathcal{B_k}$ | Intra storage level (within a representative period) for storage asset $a$, representative period $k$, and timestep block $b_k$ | [MWh] |
| $v^{\text{inter-storage}}_{a,p}$ | $\mathbb{R}_{+}$ | $a \in \mathcal{A^{\text{ss}}}$, $p \in \mathcal{P}$ | Inter storage level (between representative periods) for storage asset $a$ and period $p$ | [MWh] |
| $v^{\text{is charging}}_{a,k,b_k}$ | $\{0, 1\}$ | $a \in \mathcal{A}^{\text{sb}}$, $k \in \mathcal{K}$, $b_k \in \mathcal{B_k}$ | If an storage asset $a$ is charging or not in representative period $k$ and timestep block $b_k$ | [-] |

## [Objective Function](@id math-objective-function)

Expand All @@ -139,22 +141,53 @@ flows\_variable\_cost &= \sum_{f \in \mathcal{F}} \sum_{k \in \mathcal{K}} \sum_

## [Constraints](@id math-constraints)

### Capacity Constraints
### [Capacity Constraints](@id cap-constraints)

#### Maximum Output Flows Limit

```math
\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{out}}_a} v^{\text{flow}}_{f,k,b_k} \leq p^{\text{availability profile}}_{a,k,b_k} \cdot \left(p^{\text{init capacity}}_{a} + p^{\text{capacity}}_{a} \cdot v^{\text{inv}}_{a} \right) \quad
\\ \\ \forall a \in \mathcal{A}^{\text{cv}} \cup \mathcal{A}^{\text{s}} \cup \mathcal{A}^{\text{p}}, \forall k \in \mathcal{K},\forall b_k \in \mathcal{B_k}
\\ \\ \forall a \in \mathcal{A}^{\text{cv}} \cup \left(\mathcal{A}^{\text{s}} \setminus \mathcal{A}^{\text{sb}} \right) \cup \mathcal{A}^{\text{p}}, \forall k \in \mathcal{K},\forall b_k \in \mathcal{B_k}
\end{aligned}
```

Storage assets using the method to avoid charging and discharging simultaneously, i.e., $a \in \mathcal{A}^{\text{sb}}$, use the following constraints instead of the previous one:

```math
\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{out}}_a} v^{\text{flow}}_{f,k,b_k} \leq p^{\text{availability profile}}_{a,k,b_k} \cdot \left(p^{\text{init capacity}}_{a} + p^{\text{inv limit}}_{a} \right) \cdot \left(1 - v^{\text{is charging}}_{a,k,b_k} \right) \quad
\\ \\ \forall a \in \mathcal{A}^{\text{sb}}, \forall k \in \mathcal{K},\forall b_k \in \mathcal{B_k}
\end{aligned}
```

```math
\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{out}}_a} v^{\text{flow}}_{f,k,b_k} \leq p^{\text{availability profile}}_{a,k,b_k} \cdot \left(p^{\text{init capacity}}_{a} \cdot \left(1 - v^{\text{is charging}}_{a,k,b_k} \right) + p^{\text{capacity}}_{a} \cdot v^{\text{inv}}_{a} \right) \quad
\\ \\ \forall a \in \mathcal{A}^{\text{sb}}, \forall k \in \mathcal{K},\forall b_k \in \mathcal{B_k}
\end{aligned}
```

#### Maximum Input Flows Limit

```math
\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{in}}_a} v^{\text{flow}}_{f,k,b_k} \leq p^{\text{availability profile}}_{a,k,b_k} \cdot \left(p^{\text{init capacity}}_{a} + p^{\text{capacity}}_{a} \cdot v^{\text{inv}}_{a} \right) \quad \forall a \in \mathcal{A}^{\text{s}}, \forall k \in \mathcal{K},\forall b_k \in \mathcal{B_k}
\sum_{f \in \mathcal{F}^{\text{in}}_a} v^{\text{flow}}_{f,k,b_k} \leq p^{\text{availability profile}}_{a,k,b_k} \cdot \left(p^{\text{init capacity}}_{a} + p^{\text{capacity}}_{a} \cdot v^{\text{inv}}_{a} \right) \quad
\\ \\ \forall a \in \mathcal{A}^{\text{s}} \setminus \mathcal{A}^{\text{sb}}, \forall k \in \mathcal{K},\forall b_k \in \mathcal{B_k}
\end{aligned}
```

Storage assets using the method to avoid charging and discharging simultaneously, i.e., $a \in \mathcal{A}^{\text{sb}}$, use the following constraints instead of the previous one:

```math
\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{in}}_a} v^{\text{flow}}_{f,k,b_k} \leq p^{\text{availability profile}}_{a,k,b_k} \cdot \left(p^{\text{init capacity}}_{a} + p^{\text{inv limit}}_{a} \right) \cdot v^{\text{is charging}}_{a,k,b_k} \quad \forall a \in \mathcal{A}^{\text{sb}}, \forall k \in \mathcal{K},\forall b_k \in \mathcal{B_k}
\end{aligned}
```

```math
\begin{aligned}
\sum_{f \in \mathcal{F}^{\text{in}}_a} v^{\text{flow}}_{f,k,b_k} \leq p^{\text{availability profile}}_{a,k,b_k} \cdot \left(p^{\text{init capacity}}_{a} \cdot v^{\text{is charging}}_{a,k,b_k} + p^{\text{capacity}}_{a} \cdot v^{\text{inv}}_{a} \right) \quad \forall a \in \mathcal{A}^{\text{sb}}, \forall k \in \mathcal{K},\forall b_k \in \mathcal{B_k}
\end{aligned}
```

Expand Down
17 changes: 14 additions & 3 deletions docs/src/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ if energy_problem.termination_status == INFEASIBLE
end
```

## [Seasonal and non-seasonal storage setup](@id seasonal-setup)
## [Setup seasonal and non-seasonal storage](@id seasonal-setup)

Section [Storage Modeling](@ref storage-modeling) explains the main concepts for modeling seasonal and non-seasonal storage in _TulipaEnergyModel.jl_. To define if an asset is one type or the other then consider the following:

Expand All @@ -299,7 +299,7 @@ Section [Storage Modeling](@ref storage-modeling) explains the main concepts for
> **Note:**
> If the input data covers only one representative period for the entire year, for example, with 8760-hour timesteps, and you have a monthly hydropower plant, then you should set the `is_seasonal` parameter for that asset to `false`. This is because the length of the representative period is greater than the storage capacity of the storage asset.
## [Storage investment method setup](@id storage-investment-setup)
## [Setup the energy storage investment method](@id storage-investment-setup)

Energy storage assets have a unique characteristic wherein the investment is not solely based on the capacity to charge and discharge, but also on the energy capacity. Some storage asset types have a fixed duration for a given capacity, which means that there is a predefined ratio between energy and power. For instance, a battery of 10MW/unit and 4h duration implies that the energy capacity is 40MWh. Conversely, other storage asset types don't have a fixed ratio between the investment of capacity and storage capacity. Therefore, the energy capacity can be optimized independently of the capacity investment, such as hydrogen storage in salt caverns. To define if an energy asset is one type or the other then consider the following parameter setting in the file [`assets-data.csv`](@ref schemas):

Expand All @@ -312,4 +312,15 @@ Energy storage assets have a unique characteristic wherein the investment is not

- _Fixed energy-to-power ratio method_: To use this method, set the parameter `storage_method_energy` to `false`. In addition, it is necessary to define the parameter `energy_to_power_ratio` to establish the predefined duration of the storage asset or ratio between energy and power. Note that all the investment costs should be allocated in the parameter `investment_cost`.

For more details of the constraints that apply when selecting one method or the other, please visit the [`mathematical formulation`](@ref formulation) section.
For more details on the constraints that apply when selecting one method or the other, please visit the [`mathematical formulation`](@ref formulation) section.

## [Setup the energy storage asset to avoid charging and discharging simultaneously](@id storage-binary-method-setup)

Depending on the configuration of the energy storage assets, it may or may not be possible to charge and discharge them simultaneously. For instance, a single battery cannot charge and discharge at the same time, but some pumped hydro storage technologies have separate components for charging (pump) and discharging (turbine) that can function independently, allowing them to charge and discharge simultaneously. To account for these differences, the model provides users with three options for the `use_binary_storage_method` parameter in the [`assets-data.csv`](@ref schemas) file:

- `binary`: the model adds a binary variable to prevent charging and discharging simultaneously.
- `relaxed_binary`: the model adds a binary variable that allows values between 0 and 1, reducing the likelihood of charging and discharging simultaneously. This option uses a tighter set of constraints close to the convex hull of the full formulation, resulting in fewer instances of simultaneous charging and discharging in the results.

If no value is set in the parameter `use_binary_storage_method`, i.e., `missing` value, the storage asset can charge and discharge simultaneously.

For more details on the constraints that apply when selecting this method, please visit the [`mathematical formulation`](@ref formulation) section.

0 comments on commit a4008dc

Please sign in to comment.