Skip to content

Commit

Permalink
Adjust/Changes in EMB (#6)
Browse files Browse the repository at this point in the history
* Minor updates to structuring
* Updated dependencies (including Julia LTS)
* Adjusted to changed in EMB v0.8.1
* Minor update in documentation
  • Loading branch information
JulStraus authored Oct 16, 2024
1 parent 30946df commit fdb45ec
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 70 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# Since EnergyModelsBase doesn't have binary dependencies,
# Since EnergyModelsCO2 doesn't have binary dependencies,
# only test on a subset of possible platforms.
include:
- version: '1' # The latest point-release (Linux)
Expand All @@ -22,18 +22,18 @@ jobs:
- version: '1' # The latest point-release (Windows)
os: windows-latest
arch: x64
- version: '1.9' # 1.9
- version: 'lts' # lts
os: ubuntu-latest
arch: x64
- version: '1.9' # 1.9
- version: 'lts' # lts
os: ubuntu-latest
arch: x86
# - version: 'nightly'
# os: ubuntu-latest
# arch: x64
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
Expand All @@ -50,8 +50,4 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
depwarn: error
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info
depwarn: error
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes

## Version 0.7.3 (2024-10-16)

* Minor changes to the documentation and docstrings.
* Minor rewriting of constraints and fixing variables.
* Adjusted to [`EnergyModelsBase` v0.8.1](https://github.com/EnergyModelsX/EnergyModelsBase.jl/releases/tag/v0.8.1):
* Use of the function `scale_op_sp`.
* Rework based on the introduction of `:stor_level_Δ_sp` in `EnergyModelsBase` as sparse variable.

## Version 0.7.2 (2024-09-03)

* Dependency increase for `EnergyModelsBase` as the changes do not directly affect `EnergyModelsCO2`.
Expand Down
9 changes: 5 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name = "EnergyModelsCO2"
uuid = "84b3f4d7-d799-4a5d-b06c-25c90dcfcad7"
authors = ["Sigmund Eggen Holm <[email protected]> and contributors"]
version = "0.7.2"
version = "0.7.3"

[deps]
EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
SparseVariables = "2749762c-80ed-4b14-8f33-f0736679b02b"
TimeStruct = "f9ed5ce0-9f41-4eaa-96da-f38ab8df101c"

[compat]
EnergyModelsBase = "0.8"
EnergyModelsBase = "0.8.1"
JuMP = "1.5"
TimeStruct = "0.8"
julia = "1.6"
TimeStruct = "0.9"
julia = "1.10"
23 changes: 14 additions & 9 deletions docs/src/nodes/retrofit.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Both introduced nodes use the same fields, although their meaning may potentiall
The standard fields are given as:

- **`id`**:\
The field **`id`** is only used for providing a name to the node.
The field `id` is only used for providing a name to the node.
This is similar to the approach utilized in `EnergyModelsBase`.
- **`cap::TimeProfile`**:\
The installed capacity corresponds to the potential usage of the node.\
If the node should contain investments through the application of [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/), it is important to note that you can only use `FixedProfile` or `StrategicProfile` for the capacity, but not `RepresentativeProfile` or `OperationalProfile`.
If the node should contain investments through the application of [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/), it is important to note that you can only use `FixedProfile` or `StrategicProfile` for the capacity, but not `RepresentativeProfile` or `OperationalProfile`.
In addition, all values have to be non-negative.
!!! info "Meaning in boths nodes"
- [`RefNetworkNodeRetrofit`](@ref):\
Expand Down Expand Up @@ -67,7 +67,7 @@ The standard fields are given as:
- **`data::Vector{Data}`**:\
An entry for providing additional data to the model.
The `data` vector must include [`CaptureData`](@extref EnergyModelsBase.CaptureData) for both [`RefNetworkNodeRetrofit`](@ref) and [`CCSRetroFit`](@ref).
It can include additional investment data when [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/) is used.
It can include additional investment data when [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/) is used.
!!! info "Meaning of the capture rate in both nodes"
- [`RefNetworkNodeRetrofit`](@ref):\
The capture rate corresponds to the fraction of the flue gas which is sent to the `CCSRetroFit` node.
Expand Down Expand Up @@ -113,6 +113,7 @@ The variables include:
- [``\texttt{cap\_inst}``](@extref EnergyModelsBase man-opt_var-cap)
- [``\texttt{flow\_in}``](@extref EnergyModelsBase man-opt_var-flow)
- [``\texttt{flow\_out}``](@extref EnergyModelsBase man-opt_var-flow)
- [``\texttt{emissions\_node}``](@ref EnergyModelsBase man-opt_var-emissions)

#### [Additional variables](@id nodes-CCS_retrofit-math-add)

Expand All @@ -135,16 +136,16 @@ These standard constraints are:
\texttt{cap\_use}[n, t] \leq \texttt{cap\_inst}[n, t]
```

!!! tip "Using investments"
The function `constraints_capacity_installed` is also used in [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/) to incorporate the potential for investment.
Nodes with investments are then no longer constrained by the parameter capacity.

- `constraints_capacity_installed`:

```math
\texttt{cap\_inst}[n, t] = capacity(n, t)
```

!!! tip "Using investments"
The function `constraints_capacity_installed` is also used in [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/) to incorporate the potential for investment.
Nodes with investments are then no longer constrained by the parameter capacity.

- `constraints_flow_in`:

```math
Expand All @@ -171,15 +172,19 @@ These standard constraints are:
```

!!! tip "Why do we use `first()`"
The variable ``\texttt{cap\_inst}`` ise declared over all operational periods (see the section on *[Capacity variables](@extref EnergyModelsBase man-opt_var-cap)* for further explanations).
The variable ``\texttt{cap\_inst}`` is declared over all operational periods (see the section on *[Capacity variables](@extref EnergyModelsBase man-opt_var-cap)* for further explanations).
Hence, we use the function ``first(t_{inv})`` to retrieve the installed capacity in the first operational period of a given strategic period ``t_{inv}`` in the function `constraints_opex_fixed`.

- `constraints_opex_var`:

```math
\texttt{opex\_var}[n, t_{inv}] = \sum_{t \in t_{inv}} opex_var(n, t) \times \texttt{cap\_use}[n, t] \times EMB.multiple(t_{inv}, t)
\texttt{opex\_var}[n, t_{inv}] = \sum_{t \in t_{inv}} opex_var(n, t) \times \texttt{cap\_use}[n, t] \times scale\_op\_sp(t_{inv}, t)
```

!!! tip "The function `scale_op_sp`"
The function [``scale\_op\_sp(t_{inv}, t)``](@extref EnergyModelsBase.scale_op_sp) calculates the scaling factor between operational and strategic periods.
It also takes into account potential operational scenarios and their probability as well as representative periods.

- `constraints_data`:\
This function is only called for specified data of the nodes, see above.
This function is extended with multiple methods for both `CCSRetroFit` and `RefNetworkNodeRetrofit`.
Expand Down
34 changes: 21 additions & 13 deletions docs/src/nodes/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Hence, it utilizes the same functions declared in `EnergyModelsBase`.
The standard fields are given as:

- **`id`**:\
The field **`id`** is only used for providing a name to the node.
The field `id` is only used for providing a name to the node.
This is similar to the approach utilized in `EnergyModelsBase`.
- **`cap::TimeProfile`**:\
The installed capacity corresponds to the potential usage of the node.\
If the node should contain investments through the application of [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/), it is important to note that you can only use `FixedProfile` or `StrategicProfile` for the capacity, but not `RepresentativeProfile` or `OperationalProfile`.
If the node should contain investments through the application of [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/), it is important to note that you can only use `FixedProfile` or `StrategicProfile` for the capacity, but not `RepresentativeProfile` or `OperationalProfile`.
In addition, all values have to be non-negative.
- **`opex_var::TimeProfile`**:\
The variable operational expenses are based on the capacity utilization through the variable [`:cap_use`](@extref EnergyModelsBase man-opt_var-cap).
Expand All @@ -36,7 +36,7 @@ The standard fields are given as:
All values have to be non-negative.
- **`data::Vector{Data}`**:\
An entry for providing additional data to the model.
In the current version, it is only relevant for additional investment data when [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/) is used or for additional emission data through [`EmissionsProcess`](@extref EnergyModelsBase.EmissionsProcess).
In the current version, it is only relevant for additional investment data when [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/) is used or for additional emission data through [`EmissionsProcess`](@extref EnergyModelsBase.EmissionsProcess).
The latter would correspond to uncaptured CO₂ that should be included in the analyses.
!!! note
The field `data` is not required as we include a constructor when the value is excluded.
Expand Down Expand Up @@ -76,9 +76,11 @@ The variables include:
- [``\texttt{cap\_use}``](@extref EnergyModelsBase man-opt_var-cap)
- [``\texttt{cap\_inst}``](@extref EnergyModelsBase man-opt_var-cap)
- [``\texttt{flow\_out}``](@extref EnergyModelsBase man-opt_var-flow)
- [``\texttt{emissions\_node}``](@extref EnergyModelsBase man-opt_var-emissions) if `EmissionsData` is added to the field `data`.
Note that CO₂ source nodes are not compatible with `CaptureData`.
Hence, you can only provide [`EmissionsProcess`](@extref EnergyModelsBase.EmissionsProcess) to the node.
- [``\texttt{emissions\_node}``](@extref EnergyModelsBase man-opt_var-emissions) if `EmissionsData` is added to the field `data`

!!! note
CO₂ source nodes are not compatible with `CaptureData`.
Hence, you can only provide [`EmissionsProcess`](@extref EnergyModelsBase.EmissionsProcess) to the node.

#### [Additional variables](@id nodes-co2_source-math-add)

Expand Down Expand Up @@ -107,27 +109,33 @@ These standard constraints are:
\texttt{cap\_inst}[n, t] = capacity(n, t)
```

!!! tip "Using investments"
The function `constraints_capacity_installed` is also used in [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/) to incorporate the potential for investment.
Nodes with investments are then no longer constrained by the parameter capacity.

- `constraints_opex_fixed`:

```math
\texttt{opex\_fixed}[n, t_{inv}] = opex\_fixed(n, t_{inv}) \times \texttt{cap\_inst}[n, first(t_{inv})]
```

!!! tip "Why do we use `first()`"
The variable ``\texttt{cap\_inst}`` is declared over all operational periods (see the section on *[Capacity variables](@ref man-opt_var-cap)* for further explanations).
Hence, we use the function ``first(t_{inv})`` to retrieve the installed capacity in the first operational period of a given strategic period ``t_{inv}`` in the function `constraints_opex_fixed`.

- `constraints_opex_var`:

```math
\texttt{opex\_var}[n, t_{inv}] = \sum_{t \in t_{inv}} opex_var(n, t) \times \texttt{cap\_use}[n, t] \times EMB.multiple(t_{inv}, t)
\texttt{opex\_var}[n, t_{inv}] = \sum_{t \in t_{inv}} opex_var(n, t) \times \texttt{cap\_use}[n, t] \times scale\_op\_sp(t_{inv}, t)
```

!!! tip "The function `scale_op_sp`"
The function [``scale\_op\_sp(t_{inv}, t)``](@extref EnergyModelsBase.scale_op_sp) calculates the scaling factor between operational and strategic periods.
It also takes into account potential operational scenarios and their probability as well as representative periods.

- `constraints_data`:\
This function is only called for specified data of the CO₂ source, see above.

The function `constraints_capacity_installed` is also used in [`EnergyModelsInvestments`](https://energymodelsx.github.io/EnergyModelsInvestments.jl/stable/) to incorporate the potential for investment.
Nodes with investments are then no longer constrained by the parameter capacity.

The variable ``\texttt{cap\_inst}`` is declared over all operational periods (see the section on *[Capacity variables](@extref EnergyModelsBase man-opt_var-cap)* for further explanations).
Hence, we use the function ``first(t_{inv})`` to retrieve the installed capacity in the first operational period of a given strategic period ``t_{inv}`` in the function `constraints_opex_fixed`.

The function `constraints_flow_out` is extended with a new method for CO₂ source nodes to allow the inclusion of CO₂:

```math
Expand Down
Loading

2 comments on commit fdb45ec

@JulStraus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/117401

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.3 -m "<description of version>" fdb45ec5bb30e5db252360b2655cc4ac5bffc48f
git push origin v0.7.3

Please sign in to comment.