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 — ModuleMain 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 — Typestruct 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 — Methodrun_model_rh(case::AbstractCase, model::RecHorEnergyModel, optimizer; check_timeprofiles::Bool=true)Take the variables case and model and optimize the problem in a receding horizon fashion as a series of optimization problems.
While the Case type 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.
Returns results as a dataframe indexed by the model variables.
Horizon
Types
EnergyModelsRecedingHorizon.DurationHorizons — TypeDurationHorizons{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 — TypePeriodHorizons{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 — Functiondurations(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 — Functionindices_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 — Functionindices_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 — Typeabstract type AbstractInitData <: EMB.DataAbstract type for initialization data.
EnergyModelsRecedingHorizon.InitData — Typestruct 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 — FunctionStorageInitData(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 — Methodhas_init(n::EMB.Node)
has_init(l::Link)Checks whether the node n or link l has initialization data.
EnergyModelsRecedingHorizon.is_init_data — Functionis_init_data(data)Checks whether the argument data has initialization settings.
EnergyModelsRecedingHorizon.data_init — Methoddata_init(n::EMB.Node)
data_init(l::Link)Returns initialization data for node n or link l.
Future value
Types
EnergyModelsRecedingHorizon.FutureValue — Typeabstract type FutureValue <: AbstractElementDeclaration of the abstract type for future value descriptions in the optimization.
EnergyModelsRecedingHorizon.ElementValue — Typestruct 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 — Typestruct 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 — Typestruct 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 — Typestruct 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.
The field val_dict can also be provided as key and value input, if only a single variable should be restricted
TypeFutureValue assigns a future value to all instances of a given type. It should never be used on reference nodes. It should only be used on dynamic variables for other node types.
Functions
EnergyModelsRecedingHorizon.get_future_value — Functionget_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 — Functionhas_cuts(v::FutureValue)
has_cuts(v::StorageValueCuts)Returns true if the FutureValue is of type StorageValueCuts.
Miscellaneous
EnergyModelsRecedingHorizon.RecedingAccumulating — Typestruct RecedingAccumulating <: AccumulatingStorageBehavior which accumulates all inflow witin a strategic period. RecedingAccumulating allows for initializing level values for the storages.