Internal functions
Index
EnergyModelsGeography.check_area
EnergyModelsGeography.check_case_data
EnergyModelsGeography.check_data
EnergyModelsGeography.check_mode
EnergyModelsGeography.check_time_structure
EnergyModelsGeography.check_transmission
EnergyModelsGeography.compute_trans_in
EnergyModelsGeography.compute_trans_out
EnergyModelsGeography.constraints_area
EnergyModelsGeography.constraints_capacity
EnergyModelsGeography.constraints_capacity_installed
EnergyModelsGeography.constraints_emission
EnergyModelsGeography.constraints_opex_fixed
EnergyModelsGeography.constraints_opex_var
EnergyModelsGeography.constraints_trans_balance
EnergyModelsGeography.constraints_trans_loss
EnergyModelsGeography.constraints_transmission
EnergyModelsGeography.create_area
EnergyModelsGeography.create_model
EnergyModelsGeography.create_transmission_mode
EnergyModelsGeography.emission
EnergyModelsGeography.emit_resources
EnergyModelsGeography.export_resources
EnergyModelsGeography.extract_resources
EnergyModelsGeography.has_emissions
EnergyModelsGeography.import_resources
EnergyModelsGeography.is_bidirectional
EnergyModelsGeography.trans_sub
EnergyModelsGeography.update_objective
EnergyModelsGeography.update_total_emissions
EnergyModelsGeography.variables_area
EnergyModelsGeography.variables_trans_capacity
EnergyModelsGeography.variables_trans_capex
EnergyModelsGeography.variables_trans_emission
EnergyModelsGeography.variables_trans_mode
EnergyModelsGeography.variables_trans_modes
EnergyModelsGeography.variables_trans_opex
Extension methods
EnergyModelsGeography.create_area
— Functioncreate_area(m, a::Area, 𝒯, ℒᵗʳᵃⁿˢ, modeltype)
Set all constraints for an Area
. Can serve as fallback option for all unspecified subtypes of Area
.
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.
EnergyModelsGeography.create_model
— Functioncreate_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 standardEnergyModelsBase
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 typeEnergyModel
.m
- the emptyJuMP.Model
instance. If it is not provided, then it is assumed that the input is a standardJuMP.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.
EnergyModelsGeography.create_transmission_mode
— Functioncreate_transmission_mode(m, tm::TransmissionMode, 𝒯, modeltype::EnergyModel)
Set all constraints for a TransmissionMode
.
Serves as a fallback option for unspecified subtypes of TransmissionMode
.
Called constraint functions
EnergyModelsGeography.update_objective
— Methodupdate_objective(m, 𝒯, ℳ, modeltype::EnergyModel)
Update the objective function with costs related to geography (areas and energy transmission).
EnergyModelsGeography.update_total_emissions
— Functionupdate_total_emissions(m, 𝒯, ℳ, 𝒫, modeltype::EnergyModel)
Update the constraints aggregating total emissions in each operational period with contributions from transmission emissions.
Constraint methods
EnergyModelsGeography.constraints_area
— Functionconstraints_area(m, 𝒜, 𝒯, ℒᵗʳᵃⁿˢ, 𝒫, modeltype::EnergyModel)
Function for creating constraints for the energy balances within an area for each resource using the GeoAvailability
node. It keeps track of the exchange with other areas through the variable :area_exchange
and the functions compute_trans_in
and compute_trans_out
.
EnergyModelsGeography.constraints_capacity
— Functionconstraints_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
.
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.
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.
EnergyModelsGeography.constraints_capacity_installed
— Methodconstraints_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
.
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.
EnergyModelsGeography.constraints_emission
— Functionconstraints_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
.
EnergyModelsGeography.constraints_opex_fixed
— Functionconstraints_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
.
EnergyModelsGeography.constraints_opex_var
— Functionconstraints_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
.
EnergyModelsGeography.constraints_trans_balance
— Functionconstraints_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
.
constraints_trans_balance(m, tm::PipeLinepackSimple, 𝒯::TimeStructure, modeltype::EnergyModel)
Function for creating the transmission balance for a PipeLinepackSimple
.
EnergyModelsGeography.constraints_trans_loss
— Functionconstraints_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.
EnergyModelsGeography.constraints_transmission
— Functionconstraints_transmission(m, 𝒯, ℳ, modeltype::EnergyModel)
Create transmission constraints on all transmission corridors.
Compute methods
EnergyModelsGeography.compute_trans_in
— Functioncompute_trans_in(m, t, p, tm::TransmissionMode)
compute_trans_in(m, t, p, tm::PipeMode)
Return the amount of resource p
going into transmission mode tm
in operational period t
.
The function is declared for both a generic TransmissionMode
and for a PipeMode
.
EnergyModelsGeography.compute_trans_out
— Functioncompute_trans_out(m, t, p, tm::TransmissionMode)
compute_trans_out(m, t, p, tm::PipeMode)
Return the amount of resource p
going out of transmission mode tm
in operational period t
.
The function is declared for both a generic TransmissionMode
and for a PipeMode
.
Variable creation methods
EnergyModelsGeography.variables_area
— Functionvariables_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.
EnergyModelsGeography.variables_trans_capacity
— Functionvariables_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.
EnergyModelsGeography.variables_trans_capex
— FunctionEMG.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
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.
EnergyModelsGeography.variables_trans_emission
— Functionvariables_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 modetm
in operational periodt
.
EnergyModelsGeography.variables_trans_modes
— Functionvariables_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
.
EnergyModelsGeography.variables_trans_mode
— Functionvariables_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 TransmissionMode
s.
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
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.
EnergyModelsGeography.variables_trans_opex
— Functionvariables_trans_opex(m, 𝒯, ℳ, modeltype::EnergyModel)
Declaration of variables for the operational costs (:trans_opex_var
and :trans_opex_fixed
) of the tranmission modes.
Check methods
EnergyModelsGeography.check_area
— Functioncheck_area(a::Area, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)
Check that the fields of an Area
corresponds to required structure.
EnergyModelsGeography.check_case_data
— Functioncheck_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}
.
EnergyModelsGeography.check_data
— Functioncheck_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.
EnergyModelsGeography.check_mode
— Functioncheck_mode(m::TransmissionMode, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)
Check that the fields of a TransmissionMode
corresponds to required structure.
EnergyModelsGeography.check_time_structure
— Functioncheck_time_structure(m::TransmissionMode, 𝒯)
Check that all fields of a TransmissionMode
that are of type TimeProfile
correspond to the time structure 𝒯
.
EnergyModelsGeography.check_transmission
— Functioncheck_transmission(l::Transmission, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)
Check that the fields of a Transmission
corridor corresponds to required structure.
Identification methods
EnergyModelsGeography.extract_resources
— Functionextract_resources(ℒᵗʳᵃⁿˢ, resource_method)
Return the resources transported/consumed by the transmission corridors in ℒᵗʳᵃⁿˢ
.
EnergyModelsGeography.export_resources
— Functionexport_resources(ℒᵗʳᵃⁿˢ, a::Area)
Return the resources exported from area a
on the transmission corridors in ℒᵗʳᵃⁿˢ
.
EnergyModelsGeography.import_resources
— Functionimport_resources(ℒᵗʳᵃⁿˢ, a::Area)
Return the resources imported into area a
on the transmission corridors in ℒᵗʳᵃⁿˢ
.
EnergyModelsGeography.has_emissions
— Functionhas_emissions(tm::TransmissionMode)
Returns whether there are emissions associated with transmission mode tm
. Default behaviour is no emissions.
EnergyModelsGeography.emission
— Functionemission(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
.
None of the provided TransmissionMode
s include emissions. If you plan to include emissions, you have to both create a new TransmissionMode
and dispatch on this function.
EnergyModelsGeography.emit_resources
— Functionemit_resources(m::TransmissionMode)
Returns the types of emissions associated with transmission mode tm
.
EnergyModelsGeography.is_bidirectional
— Functionis_bidirectional(tm::TransmissionMode)
Checks whether transmission mode tm
is bidirectional.
EnergyModelsGeography.trans_sub
— Functiontrans_sub(ℒᵗʳᵃⁿˢ, a::Area)
Return connected transmission corridors for a given area a
.