-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adaptation to changes introduced in EMB v0.7 (#19)
* Adjustment to all changes from EMB v0.7 - Use StorageBehavior for representing the storage behavior - Use AbstractStorageParameter for the capacities in charge, level, and discharge
- Loading branch information
Showing
19 changed files
with
1,153 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "EnergyModelsRenewableProducers" | ||
uuid = "b007c34f-ba52-4995-ba37-fffe79fbde35" | ||
authors = ["Sigmund Eggen Holm <[email protected]>, Julian Straus <[email protected]>"] | ||
version = "0.5.6" | ||
version = "0.6.0" | ||
|
||
[deps] | ||
EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50" | ||
|
@@ -10,7 +10,7 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | |
TimeStruct = "f9ed5ce0-9f41-4eaa-96da-f38ab8df101c" | ||
|
||
[compat] | ||
EnergyModelsBase = "^0.6.7" | ||
EnergyModelsBase = "^0.7.0" | ||
JuMP = "1.5" | ||
TimeStruct = "^0.7.0" | ||
TimeStruct = "^0.8.0" | ||
julia = "^1.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
# [Update your model to the latest versions](@id update-models) | ||
|
||
`EnergyModelsRenewableProducers` is still in a pre-release version. | ||
Hence, there are frequently breaking changes occuring, although we plan to keep backwards compatibility. | ||
This document is designed to provide users with information regarding how they have to adjust their models to keep compatibility to the latest changes. | ||
We will as well implement information regarding the adjustment of extension packages, although this is more difficult due to the vast majority of potential changes. | ||
|
||
## Adjustments from 0.4.2 | ||
|
||
### Key changes for nodal descriptions | ||
|
||
Version 0.7 of `EnergyModelsBase` introduced both *storage behaviours* resulting in a rework of the individual approach for calculating the level balance as well as the potential to have charge and discharge capacities through *storage parameters*. | ||
|
||
!!! note | ||
The legacy constructors for calls of the composite type of version 0.5 will be included at least until version 0.7. | ||
|
||
### [`HydroStor`](@ref) | ||
|
||
`HydroStor` was significantly reworked due to the changes in `EnergyModelsBase` | ||
The total rework is provided below. | ||
|
||
```julia | ||
# The previous nodal description for a `HydroStor` node was given by: | ||
HydroStor( | ||
id, | ||
rate_cap::TimeProfile, | ||
stor_cap::TimeProfile, | ||
|
||
level_init::TimeProfile, | ||
level_inflow::TimeProfile, | ||
level_min::TimeProfile, | ||
|
||
opex_var::TimeProfile, | ||
opex_fixed::TimeProfile, | ||
stor_res::ResourceCarrier, | ||
input::Dict{<:Resource, <:Real}, | ||
output::Dict{<:Resource, <:Real}, | ||
data::Vector{Data}, | ||
) | ||
|
||
# This translates to the following new version | ||
HydroStor{CyclicStrategic}( | ||
id, | ||
StorCapOpexFixed(stor_cap, opex_fixed), | ||
StorCapOpexVar(rate_cap, opex_var), | ||
level_init, | ||
level_inflow, | ||
level_min, | ||
stor_res, | ||
input, | ||
output, | ||
data, | ||
) | ||
``` | ||
|
||
### [`PumpedHydroStor`](@ref) | ||
|
||
`PumpedHydroStor` was significantly reworked due to the changers in `EnergyModelsBase` | ||
The total rework is provided below. | ||
|
||
```julia | ||
# The previous nodal description for a `PumpedHydroStor` node was given by: | ||
PumpedHydroStor( | ||
id, | ||
rate_cap::TimeProfile, | ||
stor_cap::TimeProfile, | ||
|
||
level_init::TimeProfile, | ||
level_inflow::TimeProfile, | ||
level_min::TimeProfile, | ||
|
||
opex_var::TimeProfile, | ||
opex_var_pump::TimeProfile, | ||
opex_fixed::TimeProfile, | ||
stor_res::ResourceCarrier, | ||
input::Dict{<:Resource, <:Real}, | ||
output::Dict{<:Resource, <:Real}, | ||
data::Vector{Data}, | ||
) | ||
|
||
# This translates to the following new version | ||
PumpedHydroStor{CyclicStrategic}( | ||
id, | ||
StorCapOpexVar(rate_cap, opex_var_pump), | ||
StorCapOpexFixed(stor_cap, opex_fixed), | ||
StorCapOpexVar(rate_cap, opex_var), | ||
level_init, | ||
level_inflow, | ||
level_min, | ||
stor_res, | ||
input, | ||
output, | ||
data, | ||
) | ||
``` | ||
|
||
## Adjustments from 0.4.0 to 0.6.x | ||
|
||
### Key changes for nodal descriptions | ||
|
||
Version 0.4.1 introduced two new types that replaced the original `RegHydroStor` node with two types called [`PumpedHydroStor`](@ref) and [`HydroStor`](@ref). | ||
The changes allowed for the introduction of a variable OPEX for pumping. | ||
In the translation below, it is assumed that the variable OPEX for pumping is 0. | ||
|
||
```julia | ||
# The previous nodal description was given by: | ||
RegHydroStor( | ||
id::Any, | ||
rate_cap::TimeProfile, | ||
stor_cap::TimeProfile, | ||
has_pump::Bool, | ||
level_init::TimeProfile, | ||
level_inflow::TimeProfile, | ||
level_min::TimeProfile, | ||
opex_var::TimeProfile, | ||
opex_fixed::TimeProfile, | ||
stor_res::ResourceCarrier, | ||
input, | ||
output, | ||
Data, | ||
) | ||
|
||
# This translates to the following new version if has_pump == true | ||
PumpedHydroStor( | ||
id, | ||
StorCapOpexVar(rate_cap, FixedProfile(0)), | ||
StorCapOpexFixed(stor_cap, opex_fixed), | ||
StorCapOpexVar(rate_cap, opex_var), | ||
level_init, | ||
level_inflow, | ||
level_min, | ||
stor_res, | ||
input, | ||
output, | ||
Data, | ||
) | ||
# and the following version if has_pump == false | ||
HydroStor( | ||
id, | ||
StorCapOpexFixed(stor_cap, opex_fixed), | ||
StorCapOpexVar(rate_cap, opex_var), | ||
level_init, | ||
level_inflow, | ||
level_min, | ||
stor_res, | ||
input, | ||
output, | ||
Data, | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,44 @@ | ||
# [Constraint functions](@id constraint_functions) | ||
|
||
The [`HydroStorage`](@ref) types dispatch on individual functions from within `EnergyModelsBase` ti extend the functionality | ||
## `NonDisRES` (non-dispatchable renewable energy source) | ||
|
||
## Storage level constraints | ||
The introduction of the type [`NonDisRES`](@ref NonDisRES_public) does not require a new `create_node` function. | ||
Instead, it is sufficient to dispatch on the function | ||
|
||
All [`HydroStorage`](@ref) subtypes utilize the same function, `constraints_level(m, n::Storage, 𝒯, 𝒫, modeltype::EnergyModel)`, for calling the two relevant subfunctions. | ||
```julia | ||
EMB.constraints_capacity(m, n::NonDisRES, 𝒯::TimeStructure, modeltype::EnergyModel) | ||
``` | ||
|
||
The function | ||
to introduce the new energy balance using the field `profile` and the variable ``\texttt{curtailment}``. | ||
In this case, we also have to call the function | ||
|
||
```julia | ||
EMB.constraints_level_aux(m, n::HydroStorage, 𝒯, 𝒫, modeltype::EnergyModel) | ||
constraints_capacity_installed(m, n, 𝒯, modeltype) | ||
``` | ||
|
||
is extended to account for both the provision of an initial level at the start of each strategic period as well as modifying the constraint for the variable ``\texttt{stor\_level\_}\Delta\texttt{\_op}`` to account for the introduction of the new variable ``\texttt{hydro\_spill}``. | ||
The former is required for [`HydroStorage`](@ref) subtypes asthe initial level is frequently a function of the season (excluding small scale pumped hydro storage) while the latter is required to include spillage. | ||
to allow for investments when coupled with `EnergyModelsInvestments`. | ||
We do however not need to create new methods for said function. | ||
|
||
## `HydroStorage` (regulated hydro storage with or without pump) | ||
|
||
The [`HydroStorage`](@ref HydroStorage_public) types utilize the same `create_node` function for introducing new concepts. | ||
In addition, they dispatch on individual functions from within `EnergyModelsBase` to extend the functionality. | ||
|
||
The functions | ||
|
||
```julia | ||
EMB.constraints_level_sp(m, n::HydroStorage, t_inv, 𝒫, modeltype::EnergyModel) | ||
EMB.constraints_flow_in(m, n::HydroStor, 𝒯::TimeStructure, modeltype::EnergyModel) | ||
EMB.constraints_flow_in(m, n::PumpedHydroStor, 𝒯::TimeStructure, modeltype::EnergyModel) | ||
``` | ||
|
||
are similar to the function used for `RefStorage{T} where {T<:ResourceCarrier}`. | ||
It is however necessary to reintroduce it due to the declaration for `RefStorage` in `EnergyModelsBase`. | ||
This will most likely be adjusted in later versions, although it will not impact the user directly. | ||
|
||
## Operational expenditure constraints | ||
allow for a different behavior of the `HydroStorage` node through fixing the variable ``\texttt{flow\\_in}`` in the case of a [`HydroStor`](@ref) node to 0 and limiting it in the case of a [`PumpedHydroStor`](@ref) to installed charge capacity through the variable ``\texttt{stor\\_charge\\_use}``. | ||
|
||
Variable operational expenditure (OPEX) constraints are slightly different defined in the case of [`HydroStor`](@ref) and [`PumpedHydroStor`](@ref) nodes. | ||
Hence, dispatch is required on the individual constraints: | ||
All `HydroStorage` subtypes utilize the introduced level balances from `EnergyModelsBase`. | ||
MOdification to the level balance is achieved through overloading | ||
|
||
```julia | ||
EMB.constraints_opex_var(m, n::HydroStor, 𝒯::TimeStructure, modeltype::EnergyModel) | ||
EMB.constraints_opex_var(m, n::PumpedHydroStor, 𝒯::TimeStructure, modeltype::EnergyModel) | ||
EMB.constraints_level_aux(m, n::HydroStorage, 𝒯, 𝒫, modeltype::EnergyModel) | ||
``` | ||
|
||
Within a [`HydroStor`](@ref) node, the variable OPEX is defined *via* the outflow from the hydropower plant, contrary to the definition of a `RefStorage` node in which the variable OPEX is defined *via* the inflow. | ||
A [`PumpedHydroStor`](@ref) has contributions by both the inflow (through the field `opex_var_pump`) and the outflow (through the field `opex_var`). | ||
to account for both the provision of an initial level at the start of each strategic period as well as modifying the constraint for the variable ``\texttt{stor\_level\_}\Delta\texttt{\_op}`` to account for the introduction of the new variable ``\texttt{hydro\_spill}``. | ||
The former is required for [`HydroStorage`](@ref) subtypes as the initial level is frequently a function of the season (excluding small scale pumped hydro storage) while the latter is required to include spillage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
86cbc7c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
86cbc7c
There was a problem hiding this comment.
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/107781
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.
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: