Public

Index

Module

EnergyModelsRecedingHorizonModule

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.

source

Model

EnergyModelsRecedingHorizon.RecHorOperationalModelType
struct RecHorOperationalModel <: RecHorEnergyModel

Operational energy model without investments, receding horizon implementation.

Fields

  • emission_limit::Dict{<:ResourceEmit, <:TimeProfile} is a dictionary with individual emission limits as TimeProfile for each emission resource ResourceEmit.

  • emission_price::Dict{<:ResourceEmit, <:TimeProfile} are the prices for the different emissions types considered.

  • co2_instance is a ResourceEmit and corresponds to the type used for CO₂.

source
EnergyModelsRecedingHorizon.run_model_rhMethod
run_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.

Required input

While the Case type is flexible, we have to follow certain structures.

  • The case type requires as additional input in the dictionary field misc the entry :horizons corresponding to an AbstractHorizons type.

  • The order of the individual elements vector in the field elements cannot be arbitrary at the moment due to the structure of the code. You must use the following order:

    1. Vector{<:EMB.Node}
    2. Vector{<:Link}
    3. Vector{<:Area}
    4. Vector{<:Transmission}

    If you do not use this structure, the model will not run.

Returns results as a dataframe indexed by the model variables.

source

Horizon

Types

EnergyModelsRecedingHorizon.DurationHorizonsType
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::Int64 is 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::Int64 is the sum of the duration of the operational periods that are used in the optimization horizon.
  • impl::Int64 is the sum of the duration of the operational periods that are used in the implementation horizon.
Optimization and 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.

source
EnergyModelsRecedingHorizon.PeriodHorizonsType
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::Int64 is 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::Int64 is the number of operational periods that are used in the optimization horizon.
  • impl::Int64 is the number of operational periods that are used in the implementation horizon.
Optimization and 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.

source

Functions

EnergyModelsRecedingHorizon.durationsFunction
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.

source

Initialization

Types

EnergyModelsRecedingHorizon.InitDataType
struct InitData{T} <: AbstractInitData

Initialization 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.
source

Functions

Future value

Types

EnergyModelsRecedingHorizon.ElementValueType
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::N is the instance of the element.
  • value::T is the used value.
source
EnergyModelsRecedingHorizon.StorageValueCutsType
struct StorageValueCuts <: FutureValue

A collection of multiple StorageValueCut that constructs a piecewise linear upper bound on the future value of the stored resource.

Fields

  • id::Any is the name/identifier of the StorageValueCuts.
  • time::Int is the time where the cut is valid relative to the start of the operational period.
  • weight::Real is the weighting of the StorageValueCuts in the objective function. For example used if the end time of the optimization arrives between two different StorageValueCuts.
  • time_weight::Real is the weighting of the StorageValueCuts in 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.
source
EnergyModelsRecedingHorizon.StorageValueCutType
struct StorageValueCut

A 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::Any is the name/identifier of the StorageValueCut.
  • coeffs::Vector{<:ElementValue} are the cut coefficients associated with the level of the given Storage nodes. They can also be provided as Dict{<:Storage{<:Accumulating}, <:Real}.
  • rhs::Real is the cut right hand side constant.
source
EnergyModelsRecedingHorizon.TypeFutureValueType
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.
Single variable

The field val_dict can also be provided as key and value input, if only a single variable should be restricted

Application of TypeFutureValue

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.

source

Functions

EnergyModelsRecedingHorizon.get_future_valueFunction
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 𝒰.

source

Miscellaneous