Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug on variable OPEX #24

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EnergyModelsGeography"
uuid = "3f775d88-a4da-46c4-a2cc-aa9f16db6708"
authors = ["Espen Flo Bødal <[email protected]>"]
version = "0.9.0"
version = "0.9.1"

[deps]
EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50"
Expand Down
14 changes: 8 additions & 6 deletions src/constraint_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -220,15 +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]) *
duration(t) * multiple_strat(t_inv, t) * probability(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) * 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
Loading