Update your model to the latest versions
EnergyModelsBase
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.6.x
Key changes for nodal descriptions
Version 0.7 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.
The legacy constructors for calls of the composite type of version 0.6 will be included at least until version 0.8.
RefStorage
RefStorage
was significantly reworked since version 0.6. The total rework is provided below.
If you are previously using the functions capacity
, opex_var
, and opex_fixed
directly on the nodal type, you have to adjust as well your call of the function as they now require the call on the StorageParameter
type.
RefStorage{<:ResourceCarrier}
translates to RefStorage{CyclicStrategic}
# The previous nodal description for a storage node storing a `ResourceCarrier` was given by:
RefStorage(
id,
rate_cap::TimeProfile,
stor_cap::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
stor_res::ResourceCarrier,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
data::Array,
)
# This translates to the following new version
RefStorage{CyclicStrategic}(
id,
StorCapOpexVar(rate_cap, opex_var),
StorCapOpexFixed(stor_cap, opex_fixed),
stor_res,
input,
output,
data,
)
RefStorage{<:ResourceEmit}
translates to RefStorage{AccumulatingEmissions}
# The previous nodal description for a storage node storing a `ResourceEmit` was given by:
RefStorageEmissions(
id,
rate_cap::TimeProfile,
stor_cap::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
stor_res::ResourceEmit,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
data::Array,
)
# This translates to the following new version
RefStorage{AccumulatingEmissions}(
id,
StorCapOpex(rate_cap, opex_var, opex_fixed),
StorCap(stor_cap),
stor_res,
input,
output,
data,
)
Adjustments from 0.5.x to 0.7.x
Key changes for nodal descriptions
Version 0.6 introduced EmissionsData
for providing the user with more flexibility (and less input demand) for incorporating different types of emissions to the model. Hence, the Node
types were adjusted. In addition, version 0.6 simplified the GenAvailability
node and added emissions prices to the OperationalModel
.
Version 0.7 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.
The legacy constructors for calls of the composite type of version 0.5 were removed in version 0.7. In addition, the adjustments will not be updated in release 0.8 as the models will be at that time most likely more than 1 year old.
RefSource
# The previous nodal description was given by:
RefSource(
id,
cap::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
output::Dict{<:Resource,<:Real},
data::Array,
emissions::Dict{<:ResourceEmit,<:Real},
)
# This translates to the following new version
em_data = EmissionsProcess(emissions)
append!(data, [em_data])
RefSource(id, cap, opex_var, opex_fixed, output, data)
RefNetwork
and RefNetworkEmissions
to RefNetworkNode
The introduction of EmissionsData
allowed to condense both previous types into a single new type. This new type was renamed to RefNetworkNode
.
# The previous nodal description for a network node without emissions was given by:
RefNetwork(
id,
cap::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
data::Array,
)
# This translates to the following new version
RefNetworkNode(id, cap, opex_var, opex_fixed, input, output, data)
# The previous nodal description for a network node without emissions was given by:
RefNetworkEmissions(
id,
cap::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
emissions::Dict{<:ResourceEmit,<:Real},
co2_capture::Real,
data::Array,
)
# This translates to the following new version
em_data = CaptureEnergyEmissions(emissions, co2_capture)
append!(data, [em_data])
RefNetworkNode(id, cap, opex_var, opex_fixed, input, output, data)
RefStorage
RefStorage
was significantly reworked since version 0.5. The total rework is provided below.
If you are previously using the functions capacity
, opex_var
, and opex_fixed
directly on the nodal type, you have to adjust as well your call of the function as they now require the call on the StorageParameter
type.
RefStorage
translated to RefStorage{CyclicStrategic}
# The previous nodal description for a storage node storing a `ResourceCarrier` was given by:
RefStorage(
id,
rate_cap::TimeProfile,
stor_cap::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
stor_res::ResourceCarrier,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
data::Array,
)
# This translates to the following new version
RefStorage{CyclicStrategic}(
id,
StorCapOpexVar(rate_cap, opex_var),
StorCapOpexFixed(stor_cap, opex_fixed),
stor_res,
input,
output,
data,
)
RefStorageEmissions
translated to RefStorage{AccumulatingEmissions}
# The previous nodal description for a storage node storing a `ResourceEmit` was given by:
RefStorageEmissions(
id,
rate_cap::TimeProfile,
stor_cap::TimeProfile,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
stor_res::ResourceEmit,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
data::Array,
)
# This translates to the following new version
RefStorage{AccumulatingEmissions}(
id,
StorCapOpex(rate_cap, opex_var, opex_fixed),
StorCap(stor_cap),
stor_res,
input,
output,
data,
)
RefSink
RefSink
has now as well the potential for investments although this would require a new type as the current operational cost calculated would incentivize retiring the demand directly.
# The previous nodal description was given by:
RefSink(
id,
cap::TimeProfile,
penalty::Dict{<:Any,<:TimeProfile},
input::Dict{<:Resource,<:Real},
emissions::Dict{<:ResourceEmit,<:Real},
)
# This translates to the following new version
em_data = EmissionsProcess(emissions)
RefSink(id, cap, penalty, input, [em_data])
GenAvailability
GenAvailability
nodes do not require any longer the data for input
and output
, as they utilize a constructor, if only a single array is given.
# The previous nodal description was given by:
GenAvailability(
id,
input::Dict{<:Resource,<:Real},
output::Dict{<:Resource,<:Real},
)
# This translates to the following new version
GenAvailability(id, collect(keys(input)), collect(keys(output)))
OperationalModel
OperationalModel
incorporated the concept of emission prices as initially introduced in EnergyModelsInvestments
.
# The previous model description was given by:
OperationalModel(
emission_limit::Dict{<:ResourceEmit, <:TimeProfile},
co2_instance::ResourceEmit,
)
# This translates to the following new version
emission_price = Dict(k => FixedProfile(0) for k ∈ keys(emission_limit))
OperationalModel(emission_limit, emission_price, co2_instance)