From 88b24714069f107f0e30ef12b331aa39e27120a1 Mon Sep 17 00:00:00 2001 From: Julian Straus Date: Mon, 19 Aug 2024 13:54:55 +0200 Subject: [PATCH 1/3] Fix bug on var OPEX --- NEWS.md | 8 +++++++- Project.toml | 2 +- src/constraint_functions.jl | 7 +++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index c9eeedf..d34e308 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,12 @@ # Release notes -## Unversioned +## Version 0.9.1 (2024-05-24) + +### Bugfix + +* The variable OPEX for unidirectional transmission modes was wrongly calculated as it did not take into account the scaling provided through the optional keyword argument `op_per_strat` of `TimeStruct`. + +### Other * Use dev version of EMG for examples when running as part of tests, similar to [PR #33 of EMB](https://github.com/EnergyModelsX/EnergyModelsBase.jl/pull/33). diff --git a/Project.toml b/Project.toml index 827e47d..1f261a5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "EnergyModelsGeography" uuid = "3f775d88-a4da-46c4-a2cc-aa9f16db6708" authors = ["Espen Flo Bødal "] -version = "0.9.0" +version = "0.9.1" [deps] EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50" diff --git a/src/constraint_functions.jl b/src/constraint_functions.jl index 3cd669e..87eb7c8 100644 --- a/src/constraint_functions.jl +++ b/src/constraint_functions.jl @@ -204,7 +204,7 @@ function constraints_opex_fixed(m, tm::TransmissionMode, 𝒯ᴵⁿᵛ, modeltyp @constraint(m, [t_inv ∈ 𝒯ᴵⁿᵛ], m[:trans_opex_fixed][tm, t_inv] == - opex_fixed(tm, t_inv) * m[:trans_cap][tm, first(t_inv)] + opex_fixed(tm, t_inv) * m[:trans_cap][tm, first(t_inv)] ) end @@ -221,14 +221,13 @@ function constraints_opex_var(m, tm::TransmissionMode, 𝒯ᴵⁿᵛ, modeltype: @constraint(m, [t_inv ∈ 𝒯ᴵⁿᵛ], m[:trans_opex_var][tm, t_inv] == opex_var(tm, t_inv) * - sum((m[:trans_pos][tm, t] + m[:trans_neg][tm, t]) * - duration(t) * multiple_strat(t_inv, t) * probability(t) + sum((m[:trans_pos][tm, t] + m[:trans_neg][tm, t]) * EMB.multiple(t_inv, t) for t ∈ t_inv) ) else @constraint(m, [t_inv ∈ 𝒯ᴵⁿᵛ], m[:trans_opex_var][tm, t_inv] == - sum(m[:trans_out][tm, t] * opex_var(tm, t) * duration(t) for t ∈ t_inv) + sum(m[:trans_out][tm, t] * opex_var(tm, t) * EMB.multiple(t_inv, t) for t ∈ t_inv) ) end end From 892fcaddeb209250a15484b4cf90f3f9caedbda1 Mon Sep 17 00:00:00 2001 From: Julian Straus Date: Mon, 19 Aug 2024 13:57:06 +0200 Subject: [PATCH 2/3] Allow var_opex index of t --- src/constraint_functions.jl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/constraint_functions.jl b/src/constraint_functions.jl index 87eb7c8..bcb232b 100644 --- a/src/constraint_functions.jl +++ b/src/constraint_functions.jl @@ -220,14 +220,17 @@ function constraints_opex_var(m, tm::TransmissionMode, 𝒯ᴵⁿᵛ, modeltype: if is_bidirectional(tm) @constraint(m, [t_inv ∈ 𝒯ᴵⁿᵛ], m[:trans_opex_var][tm, t_inv] == - opex_var(tm, t_inv) * - sum((m[:trans_pos][tm, t] + m[:trans_neg][tm, t]) * EMB.multiple(t_inv, t) - for t ∈ t_inv) + sum( + (m[:trans_pos][tm, t] + m[:trans_neg][tm, t]) * + opex_var(tm, t_inv) * EMB.multiple(t_inv, t) + for t ∈ t_inv) ) else @constraint(m, [t_inv ∈ 𝒯ᴵⁿᵛ], m[:trans_opex_var][tm, t_inv] == - sum(m[:trans_out][tm, t] * opex_var(tm, t) * EMB.multiple(t_inv, t) for t ∈ t_inv) + sum( + m[:trans_out][tm, t] * opex_var(tm, t) * EMB.multiple(t_inv, t) + for t ∈ t_inv) ) end end From 6687079a17d342836f6430efc2609fcb33d8ec70 Mon Sep 17 00:00:00 2001 From: Julian Straus Date: Mon, 19 Aug 2024 14:04:59 +0200 Subject: [PATCH 3/3] Removed nightly due to issues in Mocking.jl --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9be9062..47035fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,9 +28,9 @@ jobs: - version: '1.9' # 1.9 os: ubuntu-latest arch: x86 - - version: 'nightly' - os: ubuntu-latest - arch: x64 + # - version: 'nightly' + # os: ubuntu-latest + # arch: x64 steps: - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v1