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

Adjust/Changed in EMI and EMB #30

Merged
merged 8 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 5 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Release notes

## Unversioned
## Version 0.10.1 (2024-10-16)

### Minor updates

* Reworked the tests and included the tests for investments.
* Included an option to deactive the checks entirely with printing a warning, similarly to `EnergyModelsBase`.
* Adjusted to [`EnergyModelsBase` v0.8.1](https://github.com/EnergyModelsX/EnergyModelsBase.jl/releases/tag/v0.8.1) and [`EnergyModelsInvestments` v0.8.0](https://github.com/EnergyModelsX/EnergyModelsInvestments.jl/releases/tag/v0.8.0).

### Rework of documentation

Expand Down
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ EnergyModelsInvestments = "fca3f8eb-b383-437d-8e7b-aac76bb2004f"
EMIExt = "EnergyModelsInvestments"

[compat]
EnergyModelsBase = "^0.8"
EnergyModelsInvestments = "0.7"
EnergyModelsBase = "0.8.1"
EnergyModelsInvestments = "0.8"
SparseVariables = "0.7.3"
JuMP = "1.5"
TimeStruct = "^0.8"
julia = "1.9"
TimeStruct = "0.9"
julia = "1.10"
2 changes: 1 addition & 1 deletion docs/src/area_mode/area.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ This constraint is given by

The [`GeoAvailability`](@ref) node is introduced to allow the energy balance of an area being handled on the [`Area`](@ref) level.
It is in itself equivalent to the to [`GenAvailability`](@extref EnergyModelsBase.GenAvailability) node with respect to introduced fields and variables.
*[Availability node]* provides a detailed description of availability nodes.
*[Availability node](@extref EnergyModelsBase nodes-availability)* provides a detailed description of availability nodes.

!!! warning "Energy exchange"
All energy exchange between different areas is routed through a [`GeoAvailability`](@ref) node.
Expand Down
8 changes: 4 additions & 4 deletions docs/src/area_mode/mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ The following standard constraints are implemented for a [`TransmissionMode`](@r
\begin{aligned}
\texttt{trans\_opex\_var}[tm, t_{inv}] = \sum_{t \in t_{inv}} & opex\_var(tm, t) \times \\ &
\texttt{trans\_out}[tm, t] \times \\ &
EMB.multiple(t_{inv}, t)
scale\_op\_sp(t_{inv}, t)
\end{aligned}
```

Expand All @@ -236,12 +236,12 @@ The following standard constraints are implemented for a [`TransmissionMode`](@r
\begin{aligned}
\texttt{trans\_opex\_var}[tm, t_{inv}] = \sum_{t \in t_{inv}} & opex\_var(tm, t) \times \\ &
\left(\texttt{trans\_pos}[tm, t] + \texttt{trans\_neg}[tm, t]\right) \times \\ &
EMB.multiple(t_{inv}, t)
scale\_op\_sp(t_{inv}, t)
\end{aligned}
```

!!! tip "The function `EMB.multiple`"
The function [``EMB.multiple(t_{inv}, t)``](@ref EnergyModelsBase.multiple) calculates the scaling factor between operational and strategic periods.
!!! tip "The function `scale_op_sp`"
The function [``scale\_op\_sp(t_{inv}, t)``](@ref 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_emissions`:
Expand Down
10 changes: 5 additions & 5 deletions examples/investments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,28 @@ function generate_example_data_geo()
inv_data_12 = SingleInvData(
FixedProfile(500),
FixedProfile(50),
0,
FixedProfile(0),
BinaryInvestment(FixedProfile(50.0)),
)

inv_data_13 = SingleInvData(
FixedProfile(10),
FixedProfile(100),
0,
FixedProfile(0),
SemiContinuousInvestment(FixedProfile(10), FixedProfile(100)),
)

inv_data_23 = SingleInvData(
FixedProfile(10),
FixedProfile(50),
20,
FixedProfile(20),
DiscreteInvestment(FixedProfile(6)),
)

inv_data_34 = SingleInvData(
FixedProfile(10),
FixedProfile(50),
0,
FixedProfile(0),
ContinuousInvestment(FixedProfile(1), FixedProfile(100)),
)

Expand Down Expand Up @@ -349,7 +349,7 @@ function get_sub_system_data_inv(
SingleInvData(
FixedProfile(1000), # capex [€/kW]
FixedProfile(200), # max installed capacity [kW]
0,
FixedProfile(0),
ContinuousInvestment(FixedProfile(10), FixedProfile(200)), # investment mode
),
],
Expand Down
4 changes: 2 additions & 2 deletions src/constraint_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ function constraints_opex_var(m, tm::TransmissionMode, 𝒯ᴵⁿᵛ, modeltype:
m[:trans_opex_var][tm, t_inv] ==
sum(
(m[:trans_pos][tm, t] + m[:trans_neg][tm, t]) *
opex_var(tm, t_inv) * EMB.multiple(t_inv, t)
opex_var(tm, t_inv) * scale_op_sp(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)
m[:trans_out][tm, t] * opex_var(tm, t) * scale_op_sp(t_inv, t)
for t ∈ t_inv)
)
end
Expand Down
2 changes: 1 addition & 1 deletion src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function create_model(
)
@debug "Construct model"
# Call of the basic model
m = EMB.create_model(case, modeltype, m; check_timeprofiles)
m = EMB.create_model(case, modeltype, m; check_timeprofiles, check_any_data)
if check_any_data
check_data(case, modeltype, check_timeprofiles)
end
Expand Down
17 changes: 8 additions & 9 deletions test/test_investments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function small_graph_geo(; source = nothing, sink = nothing, inv_data = nothing)
transmission_line = RefStatic(
"transline",
Power,
FixedProfile(10),
FixedProfile(0),
FixedProfile(0.1),
FixedProfile(0.0),
FixedProfile(0.0),
Expand Down Expand Up @@ -124,7 +124,7 @@ end
inv_data = SingleInvData(
FixedProfile(10), # capex [€/kW]
FixedProfile(250), # max installed capacity [kW]
0, # initial capacity [kW]
FixedProfile(0), # initial capacity [kW]
ContinuousInvestment(FixedProfile(0), FixedProfile(30)),
)

Expand All @@ -151,7 +151,7 @@ end
for t ∈ t_inv
@test (
value.(m[:trans_cap_add][tm, t_inv]) ≈
capacity(sink, t) - inv_data.initial
capacity(sink, t) - EMI.start_cap(tm, t_inv, inv_data, nothing)
) atol = TEST_ATOL
end
end
Expand All @@ -176,7 +176,7 @@ end
inv_data = SingleInvData(
FixedProfile(10), # capex [€/kW]
FixedProfile(250), # max installed capacity [kW]
0, # initial capacity [kW]
FixedProfile(0), # initial capacity [kW]
SemiContinuousInvestment(FixedProfile(10), FixedProfile(30)),
)

Expand Down Expand Up @@ -204,7 +204,7 @@ end
for t ∈ t_inv
@test (
value.(m[:trans_cap_add][tm, t_inv]) >= max(
capacity(sink, t) - inv_data.initial,
capacity(sink, t) - EMI.start_cap(tm, t_inv, inv_data, nothing),
EMI.min_add(inv_data, t) *
value.(m[:trans_cap_invest_b][tm, t_inv]),
)
Expand Down Expand Up @@ -247,7 +247,6 @@ end
inv_data = SingleInvData(
FixedProfile(10), # capex [€/kW]
FixedProfile(250), # max installed capacity [kW]
0, # initial capacity [kW]
SemiContinuousOffsetInvestment(
FixedProfile(10),
FixedProfile(30),
Expand Down Expand Up @@ -279,8 +278,8 @@ end
if isnothing(t_inv_prev)
for t ∈ t_inv
@test (
value.(m[:trans_cap_add][tm, t_inv]) >= max(
capacity(sink, t) - inv_data.initial,
value.(m[:trans_cap_add][tm, t_inv]) max(
capacity(sink, t) - EMI.start_cap(tm, t_inv, inv_data, nothing),
EMI.min_add(inv_data, t) *
value.(m[:trans_cap_invest_b][tm, t_inv]),
)
Expand Down Expand Up @@ -329,7 +328,7 @@ end
inv_data = SingleInvData(
FixedProfile(10), # capex [€/kW]
FixedProfile(250), # max installed capacity [kW]
0, # initial capacity [kW]
FixedProfile(0), # initial capacity [kW]
DiscreteInvestment(FixedProfile(5)),
)

Expand Down
Loading