Internal functions

Index

Extension functions

EnergyModelsGeography.create_area — Function
create_area(m, a::Area, 𝒯, ℒᵗʳᵃⁿˢ, modeltype)

Set all constraints for an Area. Can serve as fallback option for all unspecified subtypes of Area.

The default method does not add any constraints.

source
create_area(m, a::LimitedExchangeArea, 𝒯, ℒᵗʳᵃⁿˢ, modeltype)

When the area is a LimitedExchangeArea, we limit the export of the specified limit resources p to the providewd value.

source
EnergyModelsGeography.create_model — Function
create_model(case::Dict, modeltype::EnergyModel, m::JuMP.Model; check_timeprofiles::Bool=true)

Create the model and call all required functions. This method is a deprecated method and should no longer be called.

source

Constraint functions

EnergyModelsGeography.constraints_capacity — Function
constraints_capacity(m, tm::TransmissionMode, 𝒯::TimeStructure, modeltype::EnergyModel)
constraints_capacity(m, tm::PipeMode, 𝒯::TimeStructure, modeltype::EnergyModel)

Function for creating the constraint on the maximum capacity of a generic TransmissionMode and PipeMode.

These functions serve as fallback option if no other method is specified for a specific TransmissionMode.

Dispatching on this function

If you create a new method for this function, it is crucial to call within said function the function constraints_capacity_installed(m, tm, 𝒯, modeltype) if you want to include investment options.

source
constraints_capacity(m, tm::PipeLinepackSimple, 𝒯::TimeStructure, modeltype::EnergyModel)

Method for creating the constraint on the maximum capacity of a PipeLinepackSimple.

The function introduces in addition an upper bound on the linepack storage level.

source
EnergyModelsGeography.constraints_capacity_installed — Method
constraints_capacity_installed(m, tm::TransmissionMode, 𝒯::TimeStructure, modeltype::EnergyModel)

Function for creating the constraint on the installed capacity of a TransmissionMode.

This function serves as fallback option if no other method is specified for a specific TransmissionMode.

Dispatching on this function

This function should only be used to dispatch on the modeltype for providing investments. If you create new capacity variables, it is beneficial to include as well a method for this function and the corresponding transmission mode types.

source
EnergyModelsGeography.constraints_emission — Function
constraints_emission(m, tm::TransmissionMode, 𝒯, modeltype::EnergyModel)

Function for creating the constraints on the emissions of a generic TransmissionMode tm.

This function serves as fallback option if no other function is specified for a TransmissionMode.

source
EnergyModelsGeography.constraints_opex_fixed — Function
constraints_opex_fixed(m, tm::TransmissionMode, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)

Function for creating the constraint on the fixed OPEX of a generic TransmissionMode.

This function serves as fallback option if no other function is specified for a TransmissionMode.

source
EnergyModelsGeography.constraints_opex_var — Function
constraints_opex_var(m, tm::TransmissionMode, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)

Function for creating the constraint on the variable OPEX of a generic TransmissionMode.

This function serves as fallback option if no other function is specified for a TransmissionMode.

source
EnergyModelsGeography.constraints_trans_balance — Function
constraints_trans_balance(m, tm::TransmissionMode, 𝒯::TimeStructure, modeltype::EnergyModel)

Function for creating the transmission balance for a generic TransmissionMode.

This function serves as fallback option if no other function is specified for a TransmissionMode.

source
constraints_trans_balance(m, tm::PipeLinepackSimple, 𝒯::TimeStructure, modeltype::EnergyModel)

Method for creating the transmission balance for a PipeLinepackSimple.

It adds the linepack level balance.

source
EnergyModelsGeography.constraints_trans_loss — Function
constraints_trans_loss(m, tm::TransmissionMode, 𝒯::TimeStructure, modeltype::EnergyModel)
constraints_trans_loss(m, tm::PipeMode, 𝒯::TimeStructure, modeltype::EnergyModel)

Function for creating the constraint on the transmission loss of a generic TransmissionMode and PipeMode

These functions serve as fallback option if no other function is specified for a TransmissionMode. If you plan to use the methods, it is necessary that the function loss is either declared for your TransmissionMode or you provide alternatively a new method.

source

Compute functions

Variable creation functions

EnergyModelsGeography.variables_trans_mode — Function
variables_trans_mode(m, 𝒯, ℳˢᵘᵇ::Vector{<:TransmissionMode}, modeltype::EnergyModel)

Default fallback method when no function is defined for a TransmissionMode type. It introduces the variables that are required in all TransmissionModes.

These variables are:

  • :trans_loss - loss during transmission
  • :trans_loss_neg - negative loss during transmission, helper variable if bidirectional transport is possible
  • :trans_loss_pos - positive loss during transmission, helper variable if bidirectional transport is possible
source
variables_trans_mode(m, 𝒯, ℳᴸᴾ::Vector{<:PipeLinepackSimple}, modeltype::EnergyModel)

When the node vector is a Vector{<:PipeLinepackSimple}, we declare the variable :linepack_stor_level to account for the energy stored through line packing.

source

Check functions

EnergyModelsGeography.check_area — Function
check_area(a::Area, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)

Check that the fields of an Area corresponds to required structure.

source
EnergyModelsGeography.check_transmission — Function
check_transmission(l::Transmission, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)

Check that the fields of a Transmission corridor corresponds to required structure.

source
EnergyModelsGeography.check_mode — Function
check_mode(tm::TransmissionMode, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)
check_mode(tm::Union{RefDynamic, RefStatic}, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)
check_mode(tm::PipeSimple, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)
check_mode(tm::PipeLinepackSimple, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)

Check that the fields of a TransmissionMode corresponds to required structure.

Checks RefDynamic and RefStatic

  • The field trans_cap is required to be non-negative.
  • The field trans_loss is required to be in the range $[0, 1]$.
  • The field fixed_opex is required to be non-negative and accessible through a StrategicPeriod as outlined in the function check_fixed_opex.
  • The field directions must be 1 or 2.

Checks PipeSimple

Checks PipeLinepackSimple

  • All checks included in the subroutine check_mode_default.
  • The field energy_share is required to be non-negative.
source
EnergyModelsGeography.check_mode_default — Function
check_mode_default(tm::PipeMode, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)

Subroutine that can be utilized in other packages for incorporating the standard tests for a PipeMode node.

Checks

  • The field consumption_rate is required to be non-negative.
  • The field trans_cap is required to be non-negative.
  • The field trans_loss is required to be in the range $[0, 1]$.
  • The field fixed_opex is required to be non-negative and accessible through a StrategicPeriod as outlined in the function check_fixed_opex.
source

Identification functions

EnergyModelsGeography.emissions — Function
emissions(tm::TransmissionMode, p::ResourceEmit)
emissions(tm::TransmissionMode, p::ResourceEmit, t)

Returns the emission of transmission mode tm of a specific resource p as TimeProfile or in operational period t.

Transmission emissions

None of the provided TransmissionModes include emissions. If you plan to include emissions, you have to both create a new TransmissionMode and dispatch on this function.

source

Utility functions

EnergyModelsGeography.connected_nodes — Function
connected_nodes(n::EMB.Node, ℒ::Vector{<:Link}, nodes::Vector{EMB.Node})

Returns a vector of all unique nodes connected to node n through links ℒ. The corresponding links are also returned.

Arguments

  • n::EMB.Node is the node from which the connections are evaluated.
  • ℒ::Vector{<:Link} is a vector of links that should be evaluated.
  • nodes::Vector{EMB.Node} is a vector of nodes that should not be included.
source