Public
Index
EnergyModelsRecedingHorizonEnergyModelsRecedingHorizon.AbstractInitDataEnergyModelsRecedingHorizon.DurationHorizonsEnergyModelsRecedingHorizon.ElementValueEnergyModelsRecedingHorizon.FutureValueEnergyModelsRecedingHorizon.InitDataEnergyModelsRecedingHorizon.PeriodHorizonsEnergyModelsRecedingHorizon.RecHorOperationalModelEnergyModelsRecedingHorizon.RecedingAccumulatingEnergyModelsRecedingHorizon.StorageValueCutEnergyModelsRecedingHorizon.StorageValueCutsEnergyModelsRecedingHorizon.TypeFutureValueEnergyModelsRecedingHorizon.StorageInitDataEnergyModelsRecedingHorizon.data_initEnergyModelsRecedingHorizon.durationsEnergyModelsRecedingHorizon.get_future_valueEnergyModelsRecedingHorizon.has_cutsEnergyModelsRecedingHorizon.has_initEnergyModelsRecedingHorizon.indices_implementationEnergyModelsRecedingHorizon.indices_optimizationEnergyModelsRecedingHorizon.is_init_dataEnergyModelsRecedingHorizon.run_model_rh
Module
EnergyModelsRecedingHorizon — Module
Main module for EnergyModelsRecedingHorizon, a package that extends EnergyModelsX with the implementation of a receding horizon framework for stress testing the invested energy system in an operational framework.
Model
EnergyModelsRecedingHorizon.RecHorOperationalModel — Type
struct RecHorOperationalModel <: RecHorEnergyModelOperational energy model without investments, receding horizon implementation.
Fields
emission_limit::Dict{<:ResourceEmit, <:TimeProfile}is a dictionary with individual emission limits asTimeProfilefor each emission resourceResourceEmit.emission_price::Dict{<:ResourceEmit, <:TimeProfile}are the prices for the different emissions types considered.co2_instanceis aResourceEmitand corresponds to the type used for CO₂.
EnergyModelsRecedingHorizon.run_model_rh — Method
run_model_rh(case::AbstractCase, modeltype::RecHorEnergyModel, optimizer; check_timeprofiles::Bool=true, use_op_per_strat::Bool=false, optimizer_param::Dict=Dict(MOI.Silent() => true))Create and run the model utilizing a receding horizon framework. The results are returned as a dataframe indexed by the model variables.
Arguments
case::Case- The case type represents the chosen time structure, the includedResources and the 𝒳 and potential coupling between the 𝒳. It is explained in more detail in its docstring.Required input While the
Casetype is flexible, we have to follow certain structures:- The
casetype requires as additional input in the dictionary fieldmiscthe entry
:horizonscorresponding to anAbstractHorizonstype.The order of the individual elements vector in the field
elementscannot be arbitrary at the moment due to the structure of the code. You must use the following order:Vector{<:EMB.Node}Vector{<:Link}Vector{<:Area}Vector{<:Transmission}
If you do not use this structure, the model will not run.
- The
modeltype::RecHorEnergyModel- Used modeltype, that is a subtype of the typeEnergyModel.optimizer- AMathOptIntefaceoptimizer.
Keyword arguments
check_timeprofiles::Bool = true- A boolean indicator whether the time profiles should be checked or not. It is advised to not deactivate the check, except if you are testing new components. It may lead to unexpected behaviour and potential inconsistencies in the input data, if the time profiles are not checked.use_op_per_strat::Bool = false- A boolean indicator whether the provided parameters indexed over strategic periods should be based on the parameterop_per_stratof the time structure or not. The former could correspond to utilizing, e.g., providing annual values for the fixed operating expenses and the CO₂ limit. The parameters are otherwise relative to a duration of 1 of an operational period If the value is specified asfalse,optimizer_param::Dict = Dict(MOI.Silent() => true)- A dictionary in which the key represents the parameter and the value the chosen value for the parameter.
Horizon
Types
EnergyModelsRecedingHorizon.DurationHorizons — Type
DurationHorizons{T} <: AbstractHorizons{T}Type used for specifiying the optimization and implementation horizon of a receding horizon model as the duration of the horizons. This implies that the number of operational periods in the different iterations can vary.
Iterating a DurationHorizons results in SingleHorizon which includes all information required for a single run.
Fields
len::Int64is the total length of the investigated timeframe as a multiple of the duration of 1 of an operational period.dur::Vector{T}is a vector of the duration of each individual operational period.optim::Int64is the sum of the duration of the operational periods that are used in the optimization horizon.impl::Int64is the sum of the duration of the operational periods that are used in the implementation horizon.
The optimization horizon corresponds to the horizon used in each individual optimization run while the implementation horizon must be shorter than the optimization horizon. This is enforced through an inner constructor. It corresponds to the operational periods extracted from the model run.
EnergyModelsRecedingHorizon.PeriodHorizons — Type
PeriodHorizons{T} <: AbstractHorizons{T}Type used for specifiying the optimization and implementation horizon of a receding horizon model as multiples of the number of periods.
Iterating a PeriodHorizons results in SingleHorizon which includes all information required for a single run.
Fields
len::Int64is the total length of the investigated timeframe as a multiple of the duration of 1 of an operational period.dur::Vector{T}is a vector of the duration of each individual operational period.optim::Int64is the number of operational periods that are used in the optimization horizon.impl::Int64is the number of operational periods that are used in the implementation horizon.
The optimization horizon corresponds to the horizon used in each individual optimization run while the implementation horizon must be shorter than the optimization horizon. This is enforced through an inner constructor. It corresponds to the operational periods extracted from the model run.
Functions
EnergyModelsRecedingHorizon.durations — Function
durations(single_hor::SingleHorizon)Extracts the fiels dur from the SingleHorizon single_hor corresponding to a vector of the durations of the individual time periods.
EnergyModelsRecedingHorizon.indices_optimization — Function
indices_optimization(single_hor::SingleHorizon)Extracts the fiels idx_optim from the SingleHorizon single_hor corresponding to a vector of the indices of the optimization horizon.
EnergyModelsRecedingHorizon.indices_implementation — Function
indices_implementation(single_hor::SingleHorizon)Extracts the fiels idx_impl from the SingleHorizon single_hor corresponding to a vector of the indices of the implementation horizon.
Initialization
Types
EnergyModelsRecedingHorizon.AbstractInitData — Type
abstract type AbstractInitData <: EMB.DataAbstract type for initialization data.
EnergyModelsRecedingHorizon.InitData — Type
struct InitData{T} <: AbstractInitDataInitialization data type for the inclusion of initial data before the first horizon. The standard initialization data is using a single value for a given variable. Multiple variables can be initialized simultaneously.
Fields
init_val_dict::Dict{Symbol,T}is a dictionary with the variable symbol as key and the value in the beginning of the analysis as value.
EnergyModelsRecedingHorizon.StorageInitData — Function
StorageInitData(val::Real)Constructor for providing initialization for Storage nodes. A StorageInitData must be provided for each Storage node.
Arguments
val::Real: initial value for storage level.
Functions
EnergyModelsRecedingHorizon.has_init — Method
has_init(n::EMB.Node)
has_init(l::Link)Checks whether the node n or link l has initialization data.
EnergyModelsRecedingHorizon.is_init_data — Function
is_init_data(data)Checks whether the argument data has initialization settings.
EnergyModelsRecedingHorizon.data_init — Method
data_init(n::EMB.Node)
data_init(l::Link)Returns initialization data for node n or link l.
Future value
Types
EnergyModelsRecedingHorizon.FutureValue — Type
abstract type FutureValue <: AbstractElementDeclaration of the abstract type for future value descriptions in the optimization.
EnergyModelsRecedingHorizon.ElementValue — Type
struct ElementValue{T<:Union{TimeProfile, Real}}An ElementValue represents an instance of a given AbstractElement with an assigned value. It replaces dictionaries in which an AbstractElement is used as key value so that it is possible to reset the AbstractElement
Fields
element::Nis the instance of the element.value::Tis the used value.
EnergyModelsRecedingHorizon.StorageValueCuts — Type
struct StorageValueCuts <: FutureValueA collection of multiple StorageValueCut that constructs a piecewise linear upper bound on the future value of the stored resource.
Fields
id::Anyis the name/identifier of theStorageValueCuts.time::Intis the time where the cut is valid relative to the start of the operational period.weight::Realis the weighting of theStorageValueCutsin the objective function. For example used if the end time of the optimization arrives between two differentStorageValueCuts.time_weight::Realis the weighting of theStorageValueCutsin the objective function due to the elapsed time.cuts::Vector{StorageValueCut}is a vector of all the cuts that are included in the future value description.
EnergyModelsRecedingHorizon.StorageValueCut — Type
struct StorageValueCutA StorageValueCut represents a cutting hyperplane that puts an upper bound on the value of the stored resource at the end of the optimization horizon.
Fields
id::Anyis the name/identifier of theStorageValueCut.coeffs::Vector{<:ElementValue}are the cut coefficients associated with the level of the givenStoragenodes. They can also be provided asDict{<:Storage{<:Accumulating}, <:Real}.rhs::Realis the cut right hand side constant.
EnergyModelsRecedingHorizon.TypeFutureValue — Type
struct TypeFutureValue <: FutureValue
TypeFutureValue(element_type::Type{<:AbstractElement}, key::Symbol, val::Real)A future value for a given nodal type and model key. It utilizes only the final value and directly adds it to the cost function for all instances of the given type.
Fields
element::Type{<:AbstractElement}is the nodal type for which the future value applies.val_dict::Dict{Symbol, Real}is a dictionary for including the variables provided as keys with a given value for calculating the future value. It is important to consider the unit of the value.
Functions
EnergyModelsRecedingHorizon.get_future_value — Function
get_future_value(𝒳ᵛᵉᶜ::Vector{Vector})
get_future_value(case::Case)
get_future_value(𝒰::UpdateCase)Returns the vector of FutureValue of the Case case or the vector of elements vectors 𝒳ᵛᵉᶜ.
If the input is an UpdateCase, it returns the new FutureValuess of the individual FutureValueSub types of UpdateCase 𝒰.
EnergyModelsRecedingHorizon.has_cuts — Function
has_cuts(v::FutureValue)
has_cuts(v::StorageValueCuts)Returns true if the FutureValue is of type StorageValueCuts.
Miscellaneous
EnergyModelsRecedingHorizon.RecedingAccumulating — Type
struct RecedingAccumulating <: AccumulatingStorageBehavior which accumulates all inflow witin a strategic period. RecedingAccumulating allows for initializing level values for the storages.