Internal functions

Index

Extension methods

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

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

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_modelFunction
create_model(case, modeltype::EnergyModel, m::JuMP.Model; check_timeprofiles::Bool=true)

Create the model and call all required functions.

Input

  • case - The case dictionary requiring the keys :T, :nodes, :links, products as it is the case for standard EnergyModelsBase models. In addition, the keys :areas and :transmission are required for extending the existing model. If the input is not provided in the correct form, the checks will identify the problem.
  • modeltype::EnergyModel - Used modeltype, that is a subtype of the type EnergyModel.
  • m - the empty JuMP.Model instance. If it is not provided, then it is assumed that the input is a standard JuMP.Model.

Conditional input

  • check_timeprofiles::Bool=true - A boolean indicator whether the time profiles of the individual nodes 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.
  • check_any_data::Bool=true - A boolean indicator whether the input data is checked or not. It is advised to not deactivate the check, except if you are testing new features. It may lead to unexpected behaviour and even infeasible models.
source
EnergyModelsGeography.update_total_emissionsFunction
update_total_emissions(m, 𝒯, ℳ, 𝒫, modeltype::EnergyModel)

Update the constraints aggregating total emissions in each operational period with contributions from transmission emissions.

source

Constraint methods

EnergyModelsGeography.constraints_capacityFunction
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)

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

The difference is given by the inclusion of the linepack storage level constraint.

source
EnergyModelsGeography.constraints_capacity_installedMethod
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_emissionFunction
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_fixedFunction
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_varFunction
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_balanceFunction
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)

Function for creating the transmission balance for a PipeLinepackSimple.

source
EnergyModelsGeography.constraints_trans_lossFunction
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 methods

Variable creation methods

EnergyModelsGeography.variables_areaFunction
variables_area(m, 𝒜, 𝒯, ℒᵗʳᵃⁿˢ, modeltype::EnergyModel)

Declaration of a variable :area_exchange to track how much energy is exchanged from an area for all operational periods t ∈ 𝒯. The variable is only declared for resources that are exchanged from a given area.

source
EnergyModelsGeography.variables_trans_capacityFunction
variables_trans_capacity(m, 𝒯, ℳ, modeltype::EnergyModel)

Declaration of variables for tracking how much of installed transmision capacity is used in all operational periods t ∈ 𝒯 of the tranmission modes.

source
EnergyModelsGeography.variables_trans_capexFunction
EMG.variables_trans_capex(m, 𝒯, ℳ,, modeltype::EMB.AbstractInvestmentModel)

Create variables for the capital costs for the investments in transmission.

Additional variables for investment in capacity:

  • :trans_cap_capex - CAPEX costs for increases in the capacity of a transmission mode
  • :trans_cap_current - installed capacity for storage in each strategic period
  • :trans_cap_add - added capacity
  • :trans_cap_rem - removed capacity
  • :trans_cap_invest_b - binary variable whether investments in capacity are happening
  • :trans_cap_remove_b - binary variable whether investments in capacity are removed
source
variables_trans_capex(m, 𝒯, ℳ, modeltype::EnergyModel)

Create variables for the capital costs for the investments in transmission. Empty function to allow for multiple dispatch in the EnergyModelsInvestment package.

source
EnergyModelsGeography.variables_trans_emissionFunction
variables_trans_emission(m, 𝒯, ℳ, 𝒫, modeltype)

Declation of variables for the modeling of tranmission emissions. These variables are only created for transmission modes where emissions are included. All emission resources that are not included for a type are fixed to a value of 0.

The emission variables are differentiated in:

  • :emissions_trans - emissions of a transmission mode tm in operational period t.
source
EnergyModelsGeography.variables_trans_modesFunction
variables_trans_modes(m, 𝒯, ℳ, modeltype::EnergyModel)

Loop through all TransmissionMode types and create variables specific to each type. This is done by calling the method variables_trans_mode on all modes of each type.

The TransmissionMode type representing the widest category will be called first. That is, variables_trans_mode will be called on a TransmissionMode before it is called on PipeMode.

source
EnergyModelsGeography.variables_trans_modeFunction
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_in - inlet flow to transmission mode
  • :trans_out - outlet flow from a transmission mode
  • :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 methods

EnergyModelsGeography.check_areaFunction
check_area(a::Area, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)

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

source
EnergyModelsGeography.check_case_dataFunction
check_case_data(case)

Checks the case dictionary is in the correct format. The function is only checking the new, additional data as we do not yet consider dispatch on the case data.

Checks

  • The dictionary requires the keys :areas and :transmission.
  • The individual keys are of the correct type, that is
    • :areas::Area and
    • :transmission::Vector{<:Transmission}.
source
EnergyModelsGeography.check_dataFunction
check_data(case, modeltype, check_timeprofiles::Bool)

Check if the case data is consistent. Use the @assert_or_log macro when testing. Currently, not checking data except that the case dictionary follows the required structure.

source
EnergyModelsGeography.check_modeFunction
check_mode(m::TransmissionMode, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)

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

source
EnergyModelsGeography.check_transmissionFunction
check_transmission(l::Transmission, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)

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

source

Identification methods

EnergyModelsGeography.emissionFunction
emission(tm::TransmissionMode, p::EMB.ResourceEmit)
emission(tm::TransmissionMode, p::EMB.ResourceEmit, t)

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

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