Internals - EnergyModelsGeography extension
Index
EMGExt.AreaSubEMGExt.TransInitDataEMGExt.TransInitDataPathEMGExt.TransmissionSubEnergyModelsGeography.constraints_capacity_installedEnergyModelsGeography.constraints_trans_balanceEnergyModelsGeography.get_areasEnergyModelsGeography.get_transmissionsEnergyModelsRecedingHorizon._find_update_pathsEnergyModelsRecedingHorizon.data_initEnergyModelsRecedingHorizon.has_initEnergyModelsRecedingHorizon.model_keyEnergyModelsRecedingHorizon.update_init_data!POIExt._update_parameter!
EnergyModelsRecedingHorizon
Types
The following types are introduced for providing initial data for TransmissionModes. Only PipeLinepackSimple supports at the moment initial data.
EMGExt.TransInitData — TypeTransInitData{T} <: AbstractInitDataInitialization data type for TransmissionMode. It follows the same structure as the standard InitData, that is it is using a single value for a given variable. Multiple variables can be initialized simultaneously.
It is required as the indexing is different for TransmissionModes compared to Nodes, Links, or Areas.
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.
EMGExt.TransInitDataPath — Typestruct TransInitDataPath <: AbstractInitDataPathInternal type for paths pointing towards TransInitData.
Fields
idx::Intis the index of the mode within the associatedTransmissioncorridor.key::Symbolis the key in theTransInitData(and correspondingly in the JuMP model).
The following functions are included for extracting the values from a TransmissionMode and initial data type:
EnergyModelsRecedingHorizon.data_init — MethodEMRH.data_init(a::Area)
EMRH.data_init(l::Transmission)
EMRH.data_init(tm::TransmissionMode)Returns initialization data for Transmission corridor l or TransmissionMode tm. In the case of a Transmission corridor, it returns all initialization data as Vector.
In the case of an Area a, it returns nothing.
EnergyModelsRecedingHorizon.model_key — Methodmodel_key(idp::TransInitDataPath)Returns the model key (field key) of TransInitDataPath idp.
In addition, we provide a new method for the identification of initial data:
EnergyModelsRecedingHorizon.has_init — MethodEMRH.has_init(a::Area)
EMRH.has_init(l::Transmission)
EMRH.has_init(tm::TransmissionMode)Checks whether the Transmission corridor l or TransmissionMode tm has initialization data.
In the case of an Area a, it returns false.
The following types are introduced for the resetting of the fields
EMGExt.AreaSub — Typemutable struct AreaSub{T<:Area} <: AbstractSubAbstractSub for Areas.
Fields
new::Tis the new instance after resetting its values.org::Tis the original instance before resetting its values.resets::Vector{<:AbstractReset}areAbstractResettypes for the givenArea.
EMGExt.TransmissionSub — Typemutable struct TransmissionSub{T<:Transmission} <: AbstractSubAbstractSub for Transmission corridor.
Fields
new::Tis the new instance after resetting its values.org::Tis the original instance before resetting its values.resets::Vector{<:AbstractReset}areAbstractResettypes for the givenTransmissioncorridor.
Internal methods
EnergyModelsRecedingHorizon._find_update_paths — MethodEMRH._find_update_paths(field::Vector{T}, current_path::Vector{Any}, all_paths::Vector{Any}) where {T<:TransmissionMode}
EMRH._find_update_paths(field::T, current_path::Vector{Any}, all_paths::Vector{Any}) where {T<:TransmissionMode}
EMRH._find_update_paths(field::TransInitData, current_path::Vector{Any}, all_paths::Vector{Any})The function _find_update_paths requires new methods for the geography extension as
TransmissionModes are not included in the default methods andTransInitDatarequires a separate method for the given path.
EnergyModelsRecedingHorizon.update_init_data! — MethodEMRH.update_init_data!(m, ri::AbstractReset, l::Transmission, idp::TransInitDataPath, opers_implᵣₕ)Updates the initial values of Transmission corridor l for the AbstractReset ri with the value specified by the key of the TransInitDataPath idp.
The mode for the variable is identified through the field idx of TransInitDataPath.
EnergyModelsGeography
Constraint functions
EnergyModelsGeography.constraints_trans_balance — FunctionEMG.constraints_trans_balance(m, tm::PipeLinepackSimple, 𝒯::TimeStructure, modeltype::RecHorEnergyModel)The calculation of the transmission balance differs for PipeLinepackSimple in the receding horizon implementation as we do not utilize cyclic constraints. Instead, it extracts the value from the TransInitData.
EnergyModelsGeography.constraints_capacity_installed — FunctionEMG.constraints_capacity_installed(m, tm::TransmissionMode, 𝒯::TimeStructure, modeltype::RecHorEnergyModel)When modeltype is a receding horizon model, the function utilizes constraints instead of the function JuMP.fix for constraining the capacity as it is not possible to fix to a POI parameter.
Fixing variables is not possible if the parameter is a POI parameter. It is instead necessary to utilize constraints. Improved speed can be achieved by calling
# before the constraint
MOI.set(m, POI.ConstraintsInterpretation(), POI.ONLY_BOUNDS)
# and
MOI.set(m, POI.ConstraintsInterpretation(), POI.ONLY_CONSTRAINTS)
# after the constraint.constraints_capacity_installed only receives a new method if ParametricOptInterface is loaded.
Functions for accessing fields
The following functions are introduced for UpdateCase types. They extract the updated value.
EnergyModelsGeography.get_areas — Functionget_areas(𝒰::UpdateCase)Method for the equivalent EnergyModelsGeography function to extract the new Areas of the individual AreaSub types of UpdateCase 𝒰.
This element vector can be directly utilized for the field elements of a Case.
EnergyModelsGeography.get_transmissions — Functionget_transmissions(𝒰::UpdateCase)Method for the equivalent EnergyModelsGeography function to extract the new Transmission corridors of the individual TransmissionSub types of UpdateCase 𝒰.
This element vector can be directly utilized for the field elements of a Case.
ParametricOptInterface
POIExt._update_parameter! — MethodPOIExt._update_parameter!(m, res_type::InitReset{EMGExt.TransInitDataPath}, opers::Vector)Update the parameter value for a given InitReset{EMGExt.TransInitDataPath} to the provided value of the InitReset type.