EnergyModelsGeography.EnergyModelsGeography
— ModuleMain module for EnergyModelsGeography.jl
.
Exports:
Area
,RefArea
,GeoAvailability
,Transmission
,RefStatic
,RefDynamic
,PipeMode
,PipeSimple
,PipeLinepackSimple
.
EnergyModelsGeography.Area
— TypeDeclaration of the general type for areas.
EnergyModelsGeography.GeoAvailability
— TypeGeoAvailability <: EMB.Availability
A geography Availability
node for substituion of the general Availability
node. A GeoAvailability
is required if transmission should be included between individual Area
s due to a changed mass balance.
Fields
id
is the name/identifier of the node.input::Array{<:Resource}
are the inputResource
s with conversion valueReal
. The latter are not relevant but included for consistency with other formulations.output::Array{<:Resource}
are the generatedResource
s with conversion valueReal
. The latter are not relevant but included for consistency with other formulations.
EnergyModelsGeography.GeoAvailability
— MethodLegacy constructor for a GeoAvailability
. This version will be discontinued in the near future and replaced with the application of Arrays instead of Dictionaries.
EnergyModelsGeography.LimitedExchangeArea
— TypeLimitedExchangeArea <: Area
A LimitedExchangeArea
is an area in which the export is limited in each individual operational period for the provided resources. This can be necessary when an area is coupled with multiple other areas and the total export capacity should be restricted.
Fields
id
is the name/identifier of the area.name
is the name of the area.lon::Real
is the longitudinal position of the area.lat::Real
is the latitudinal position of the area.node::Availability
is theAvailability
node routing different resources within an area.limit::Dict{<:EMB.Resource, <:TimeProfile}
is the amount of a resource that can be exchanged with other areas
EnergyModelsGeography.PipeLinepackSimple
— TypePipeLinepackSimple <: TransmissionMode
Pipeline model with linepacking implemented as simple storage function.
Fields (additional to PipeSimple
)
energy_share::Float64
- is the storage energy capacity relative to pipeline capacity.Level_share_init::Float64
- is the initial storage level.data::Vector{Data}
is the additional data (e.g. for investments).
EnergyModelsGeography.PipeMode
— TypeTransmissionMode
mode for additional variable potential.
EnergyModelsGeography.PipeSimple
— TypeThis TransmissionMode
allows for altering the transported Resource
.
A usage of this could e.g. be by defining a subtype struct of Resource with the field 'pressure'. This PipelineMode can then take SomeSubtype<:Resource
with pressure p₁ at the inlet, and pressure p₂ at the outlet.
This type also supports consuming resources proportionally to the volume of transported Resource
(at the inlet). This could be used for modeling the power needed for operating the pipeline.
Fields
id::String
is the identifier used in printed output.inlet::Resource
is theResource
going into transmission.outlet::Resource
is theResource
going out of the outlet of the transmission.consuming::Resource
is theResource
the transmission consumes by operating.consumption_rate::Real
the rate of which the resourcePipeline.consuming
is consumed, as a ratio of the volume of the resource going into the inlet. I.e.:`consumption_rate` = consumed volume / inlet volume (per operational period)
trans_cap::Real
is the capacity of the transmission mode.trans_loss::Real
is the loss of the transported resource during transmission, modelled as a ratio.opex_var::TimeProfile
is the variable operating expense per energy unit transported.opex_fixed::TimeProfile
is the fixed operating expense per installed capacity.directions
specifies that the pipeline is Unidirectional (1) by default.data::Vector{Data}
is the additional data (e.g. for investments).
EnergyModelsGeography.RefArea
— TypeRefArea <: Area
A RefArea
is an area representation with no additional constraints on energy/mass exchange.
Fields
id
is the name/identifier of the area.name
is the name of the area.lon::Real
is the longitudinal position of the area.lat::Real
is the latitudinal position of the area.node::Availability
is theAvailability
node routing different resources within an area.
EnergyModelsGeography.RefDynamic
— TypeA reference dynamic TransmissionMode
.
Generic representation of dynamic transmission modes, using for example truck, ship or railway transport.
Fields
id::String
is the name/identifyer of the transmission mode.resource::Resource
is the resource that is transported.trans_cap::TimeProfile
is the capacity of the transmission mode.trans_loss::TimeProfile
is the loss of the transported resource during transmission, modelled as a ratio.opex_var::TimeProfile
is the variable operating expense per energy unit transported.opex_fixed::TimeProfile
is the fixed operating expense per installed capacity.directions
is the number of directions the resource can be transported, 1 is unidirectional (A->B) or 2 is bidirectional (A<->B).data::Vector{Data}
is the additional data (e.g. for investments). The fielddata
is conditional through usage of a constructor.
EnergyModelsGeography.RefStatic
— TypeA reference static TransmissionMode
.
Generic representation of static transmission modes, such as overhead power lines or pipelines.
Fields
id::String
is the name/identifyer of the transmission mode.resource::Resource
is the resource that is transported.trans_cap::Real
is the capacity of the transmission mode.trans_loss::Real
is the loss of the transported resource during transmission, modelled as a ratio.opex_var::TimeProfile
is the variable operating expense per energy unit transported.opex_fixed::TimeProfile
is the fixed operating expense per installed capacity.directions
is the number of directions the resource can be transported, 1 is unidirectional (A->B) or 2 is bidirectional (A<->B).data::Vector{Data}
is the additional data (e.g. for investments). The fielddata
is conditional through usage of a constructor.
EnergyModelsGeography.Transmission
— TypeA Transmission
corridor.
A geographic corridor where TransmissionModes
are used to transport resources.
Fields
from::Area
is the area resources are transported from.to::Area
is the area resources are transported to.modes::Vector{<:Transmission}
are the transmission modes that are available.
EnergyModelsGeography.TransmissionMode
— TypeDeclaration of the general type for transmission mode transporting resources between areas.
EnergyModelsBase.capacity
— Methodcapacity(tm::TransmissionMode, t)
Returns the capacity of transmission mode tm
at time period t
.
EnergyModelsBase.capacity
— Methodcapacity(tm::TransmissionMode)
Returns the capacity of transmission mode tm
as TimeProfile
.
EnergyModelsBase.create_node
— MethodEMB.create_node(m, n::GeoAvailability, 𝒯, 𝒫, modeltype::EnergyModel)
Repaces constraints for availability nodes of type GeoAvailability. The resource balances are set by the area constraints instead.
EnergyModelsBase.inputs
— Methodinput(tm::TransmissionMode)
Returns the input resources of transmission mode tm
.
EnergyModelsBase.opex_fixed
— Methodopex_fixed(tm::TransmissionMode, t_inv)
Returns the variable OPEX of transmission mode tm
at strategic period t_inv
.
EnergyModelsBase.opex_fixed
— Methodopex_fixed(tm::TransmissionMode)
Returns the variable OPEX of transmission mode tm
as TimeProfile
.
EnergyModelsBase.opex_var
— Methodopex_var(tm::TransmissionMode, t)
Returns the variable OPEX of transmission mode tm
at time period t
.
EnergyModelsBase.opex_var
— Methodopex_var(tm::TransmissionMode)
Returns the variable OPEX of transmission mode tm
as TimeProfile
.
EnergyModelsBase.outputs
— Methodoutput(tm::TransmissionMode)
Returns the output resources of transmission mode tm
.
EnergyModelsGeography.availability_node
— Methodavailability_node(a::Area)
Returns the availability node of an Area
a
.
EnergyModelsGeography.check_area
— Methodcheck_area(a::Area, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)
Check that the fields of an Area
corresponds to required structure.
EnergyModelsGeography.check_case_data
— Methodcheck_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
— Methodcheck_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
— Methodcheck_mode(m::TransmissionMode, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)
Check that the fields of a TransmissionMode
corresponds to required structure.
EnergyModelsGeography.check_time_structure
— Methodcheck_time_structure(m::TransmissionMode, 𝒯)
Check that all fields of a TransmissionMode
that are of type TimeProfile
correspond to the time structure 𝒯
.
EnergyModelsGeography.check_transmission
— Methodcheck_transmission(l::Transmission, 𝒯, 𝒫, modeltype::EnergyModel, check_timeprofiles::Bool)
Check that the fields of a Transmission
corridor corresponds to required structure.
EnergyModelsGeography.compute_trans_in
— Methodcompute_trans_in(m, t, p, tm::PipeMode)
Return the amount of resources going into transmission corridor l
by a PipeMode
.
EnergyModelsGeography.compute_trans_in
— Methodcompute_trans_in(m, t, p, tm::TransmissionMode)
Return the amount of resources going into transmission corridor l
by a generic TransmissionMode
EnergyModelsGeography.compute_trans_out
— Methodcompute_trans_out(m, t, p, tm::PipeMode)
Return the amount of resources going out of transmission corridor l
by a PipeMode
.
EnergyModelsGeography.compute_trans_out
— Methodcompute_trans_out(m, t, p, tm::TransmissionMode)
Return the amount of resources going out of transmission corridor l
by a generic TransmissionMode
EnergyModelsGeography.constraints_area
— Methodconstraints_area(m, 𝒜, 𝒯, ℒᵗʳᵃⁿˢ, 𝒫, modeltype::EnergyModel)
Create constraints for the energy balances within an area for each resource using the GeoAvailability node. Keep track of the exchange with other areas in a seperate variable :area_exchange
.
EnergyModelsGeography.constraints_capacity
— Methodconstraints_capacity(m, tm::PipeLinepackSimple, 𝒯::TimeStructure, modeltype::EnergyModel)
Function for creating the constraint on the maximum capacity of a PipeLinepackSimple
.
EnergyModelsGeography.constraints_capacity
— Methodconstraints_capacity(m, tm::PipeMode, 𝒯::TimeStructure, modeltype::EnergyModel)
Function for creating the constraint on the maximum capacity of a generic PipeMode
.
EnergyModelsGeography.constraints_capacity
— Methodconstraints_capacity(m, tm::TransmissionMode, 𝒯::TimeStructure, modeltype::EnergyModel)
Function for creating the constraint on the maximum capacity of a generic TransmissionMode
. This function serves as fallback option if no other function is specified for a TransmissionMode
.
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
.
EnergyModelsGeography.constraints_opex_fixed
— Methodconstraints_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
— Methodconstraints_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
— Methodconstraints_trans_balance(m, tm::PipeLinepackSimple, 𝒯::TimeStructure, modeltype::EnergyModel)
Function for creating the transmission balance for aPipeLinepackSimple
.
EnergyModelsGeography.constraints_trans_balance
— Methodconstraints_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
.
EnergyModelsGeography.constraints_trans_loss
— Methodconstraints_trans_loss(m, tm::PipeMode, 𝒯::TimeStructure, modeltype::EnergyModel)
Function for creating the constraint on the transmission loss of a generic PipeMode
.
EnergyModelsGeography.constraints_trans_loss
— Methodconstraints_trans_loss(m, tm::TransmissionMode, 𝒯::TimeStructure, modeltype::EnergyModel)
Function for creating the constraint on the transmission loss of a generic TransmissionMode
. This function serves as fallback option if no other function is specified for a TransmissionMode
.
EnergyModelsGeography.constraints_transmission
— Methodconstraints_transmission(m, 𝒯, ℳ, modeltype::EnergyModel)
Create transmission constraints on all transmission corridors.
EnergyModelsGeography.consumption_rate
— Methodconsumption_rate(tm::PipeMode, t)
Returns the consumption rate of pipe mode tm
at time period t
.
EnergyModelsGeography.consumption_rate
— Methodconsumption_rate(tm::PipeMode)
Returns the consumption rate of pipe mode tm
as TimeProfile
.
EnergyModelsGeography.corr_from
— Methodcorr_from(from::Area, ℒᵗʳᵃⁿˢ)
Returns all transmission corridors that orginate in Area
from
.
EnergyModelsGeography.corr_from
— Methodcorr_from(from::String, ℒᵗʳᵃⁿˢ)
Returns all transmission corridors that orginate in the Area
with the name from
.
EnergyModelsGeography.corr_from_to
— Methodcorr_from_to(from::Area, to::Area, ℒᵗʳᵃⁿˢ)
Returns the transmission corridor that orginate in the Area
with the id from
and end in the Area
with the id to
.
EnergyModelsGeography.corr_from_to
— Methodcorr_from_to(from::String, to::String, ℒᵗʳᵃⁿˢ)
Returns the transmission corridor that orginate in the Area
with the id from
and end in the Area
with the id to
.
EnergyModelsGeography.corr_to
— Methodcorr_to(to::Area, ℒᵗʳᵃⁿˢ)
Returns all transmission corridors that end in Area
to
.
EnergyModelsGeography.corr_to
— Methodcorr_to(to::String, ℒᵗʳᵃⁿˢ)
Returns all transmission corridors that end in the Area
with the name to
.
EnergyModelsGeography.create_area
— Methodcreate_area(m, a::Area, 𝒯, ℒᵗʳᵃⁿˢ, modeltype)
Default fallback method when no function is defined for a node type.
EnergyModelsGeography.create_area
— Methodcreate_area(m, a::LimitedExchangeArea, 𝒯, ℒᵗʳᵃⁿˢ, modeltype)
Constraint that limit exchange with other areas based on the specified exchange_limit.
EnergyModelsGeography.create_model
— Methodcreate_model(case, modeltype::EnergyModel; 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. In the case of amodeltype::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.
EnergyModelsGeography.create_transmission_mode
— Methodcreate_transmission_mode(m, tm::TransmissionMode, 𝒯, modeltype::EnergyModel)
Set all constraints for transmission mode. Serves as a fallback option for unspecified subtypes of TransmissionMode
.
EnergyModelsGeography.directions
— Methoddirections(tm::TransmissionMode)
Returns the directions of transmission mode tm
.
EnergyModelsGeography.energy_share
— Methodenergy_share(tm::PipeLinepackSimple)
Returns the energy share of PipeLinepackSimple tm
.
EnergyModelsGeography.exchange_limit
— Methodexchange_limit(a::LimitedExchangeArea, p::Resource, t)
Returns the limit of exchange resource p
in area a
at time period t
.
EnergyModelsGeography.exchange_limit
— Methodexchange_limit(a::LimitedExchangeArea, p::Resource)
Returns the limit of exchange resource p
in area a
a TimeProfile
.
EnergyModelsGeography.exchange_limit
— Methodexchange_limit(a::LimitedExchangeArea)
Returns the limits of the exchange resources in area a
.
EnergyModelsGeography.exchange_resources
— Methodexchange_resources(ℒ, a::Area)
Return the resources exchanged (import and export) from area a on the transmission corridors in ℒ.
EnergyModelsGeography.export_resources
— Methodexport_resources(ℒ, a::Area)
Return the resources exported from area a
on the transmission corridors in ℒ
.
EnergyModelsGeography.extract_resources
— Methodextract_resources(ℒ, resource_method)
Return the resources transported/consumed by the transmission corridors in ℒ.
EnergyModelsGeography.getnodesinarea
— Methodgetnodesinarea(a::Area, links)
Return a vector with all the nodes connected to the central availability node of an area.
Fields
a::Area
.links
is a vector of all links in the model.
EnergyModelsGeography.import_resources
— Methodimport_resources(ℒ, a::Area)
Return the resources imported into area a
on the transmission corridors in ℒ
.
EnergyModelsGeography.is_bidirectional
— Methodis_bidirectional(tm::TransmissionMode)
Checks whether TransmissionMode tm
is bidirectional.
EnergyModelsGeography.limit_resources
— Methodlimit_resources(a::LimitedExchangeArea)
Returns the limited resources of a LimitedExchangeArea
a
. All other resources are considered unlimited.
EnergyModelsGeography.loss
— Methodloss(tm::TransmissionMode, t)
Returns the loss of transmission mode tm
at time period t
.
EnergyModelsGeography.loss
— Methodloss(tm::TransmissionMode)
Returns the loss of transmission mode tm
as TimeProfile
.
EnergyModelsGeography.map_trans_resource
— Methodmap_trans_resource(tm)
Returns the transported resource for a given TransmissionMode.
EnergyModelsGeography.modes
— Methodmodes(l::Transmission)
Return an array of the transmission modes for a transmission corridor l.
EnergyModelsGeography.modes
— Methodmodes(ℒ::Vector{::Transmission})
Return an array of all transmission modes present in the different transmission corridors.
EnergyModelsGeography.modes_of_dir
— Methodmodes_of_dir(l, dir::Int)
Return the transmission modes of dir directions
for transmission corridor l
`.
EnergyModelsGeography.modes_of_dir
— Methodmodes_of_dir(ℒ, dir::Int)
Return the transmission modes of dir directions
for transmission modes ℳ
.
EnergyModelsGeography.modes_sub
— Methodmodes_sub(l::Transmission, p::Resource)
Return an array containing all TransmissionMode
s that transport the resource p
in Transmission
corridor l
.
EnergyModelsGeography.modes_sub
— Methodmodes_sub(l::Transmission, mode_type::TransmissionMode)
Return an array containing all TransmissionMode
s of type type
in Transmission
corridor l
.
EnergyModelsGeography.modes_sub
— Methodmodes_sub(ℳ::Vector{<:TransmissionMode}, string_array::Array{String})
Returns all transmission modes that include in the name all entries of the array string_array
.
EnergyModelsGeography.modes_sub
— Methodmodes_sub(ℳ::Vector{<:TransmissionMode}, string::String)
Returns all transmission modes that include in the name the string
.
EnergyModelsGeography.modes_sub
— Methodmodes_sub(ℒᵗʳᵃⁿˢ::Vector{<:Transmission}, p::Resource)
Return an array containing all TransmissionMode
s that transport the resource p
in Transmission
s ℒ
.
EnergyModelsGeography.modes_sub
— Methodmodes_sub(ℒᵗʳᵃⁿˢ::Vector{<:Transmission}, mode_type::TransmissionMode)
Return an array containing all TransmissionMode
s of type type
in Transmission
s ℒ
.
EnergyModelsGeography.name
— Methodname(a::Area)
Returns the name of area a
.
EnergyModelsGeography.trans_sub
— Methodtrans_sub(ℒ, a::Area)
Return connected transmission corridors for a given area.
EnergyModelsGeography.update_objective
— Methodupdate_objective(m, 𝒩, 𝒯, 𝒫, ℒᵗʳᵃⁿˢ, modeltype::EnergyModel)
Update the objective function with costs related to geography (areas and energy transmission).
EnergyModelsGeography.variables_area
— Methodvariables_area(m, 𝒜, 𝒯, ℒᵗʳᵃⁿˢ, modeltype::EnergyModel)
Create variables to track how much energy is exchanged from an area for all time periods t ∈ 𝒯
.
EnergyModelsGeography.variables_trans_capacity
— Methodvariables_trans_capacity(m, 𝒯, ℳ, modeltype::EnergyModel)
Declaration of variables for tracking how much of installed transmision capacity is used f or all time periods t ∈ 𝒯
of the tranmission modes.
EnergyModelsGeography.variables_trans_capex
— Methodvariables_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_mode
— Methodvariables_trans_mode(m, 𝒯, ℳᴸᴾ::Vector{<:PipeLinepackSimple}, modeltype::EnergyModel)
Adds the following special variables for linepacking:
:linepack_stor_level
- storage level in linepack
EnergyModelsGeography.variables_trans_mode
— Methodvariables_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
EnergyModelsGeography.variables_trans_modes
— Methodvariables_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
-nodes.
EnergyModelsGeography.variables_trans_opex
— Methodvariables_trans_opex(m, 𝒯, ℳ, modeltype::EnergyModel)
Declaration of variables for the operational costs of the tranmission modes.