Methods - EnergyModelsBase
Index
EnergyModelsBase.capacityEnergyModelsBase.check_elementsEnergyModelsBase.check_time_structureEnergyModelsBase.constraints_coupleEnergyModelsBase.constraints_elementsEnergyModelsBase.create_nodeEnergyModelsBase.emissions_operationalEnergyModelsBase.has_emissionsEnergyModelsBase.has_opexEnergyModelsBase.inputsEnergyModelsBase.objective_operationalEnergyModelsBase.opex_fixedEnergyModelsBase.opex_varEnergyModelsBase.outputsEnergyModelsBase.variables_capacityEnergyModelsBase.variables_capexEnergyModelsBase.variables_elementEnergyModelsBase.variables_element_ext_dataEnergyModelsBase.variables_elementsEnergyModelsBase.variables_emissionEnergyModelsBase.variables_ext_dataEnergyModelsBase.variables_flowEnergyModelsBase.variables_opex
Extension methods
EnergyModelsBase.create_node — FunctionEMB.create_node(m, n::GeoAvailability, 𝒯, 𝒫, modeltype::EnergyModel)Set all constraints for a GeoAvailability. The energy balance is handled in the function constraints_couple.
Hence, no constraints are added in this function.
EnergyModelsBase.objective_operational — FunctionEMB.objective_operational(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒯ᴵⁿᵛ::TS.AbstractStratPers, modeltype::EnergyModel)
EMB.objective_operational(m, 𝒜::Vector{<:Area}, 𝒯ᴵⁿᵛ::TS.AbstractStratPers, modeltype::EnergyModel)Create JuMP expressions indexed over the investment periods 𝒯ᴵⁿᵛ for different elements. The expressions correspond to the operational expenses of the different elements. The expressions are not discounted and do not take the duration of the investment periods into account.
By default, objective expressions are included for:
𝒳 = ℒᵗʳᵃⁿˢ::Vector{Transmission}. In the case of a vector of transmission corridors, the method returns the sum of the variable and fixed OPEX for all modes whose method of the functionhas_opexreturns true.𝒳 = 𝒜::Vector{<:Area}. In the case of a vector of areas, the method returns a value of 0 for all investment periods.
EnergyModelsBase.emissions_operational — FunctionEMB.emissions_operational(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒫ᵉᵐ, 𝒯, modeltype::EnergyModel)Create JuMP expressions indexed over the operational periods 𝒯 for different elements. The expressions correspond to the total emissions of a given type.
By default, emissions expressions are included for:
𝒳 = ℒᵗʳᵃⁿˢ::Vector{Transmission}. In the case of a vector of transmission coriddors, the function returns the sum of the emissions of all modes whose method of the functionhas_emissionsreturns true.𝒳 = 𝒜::Vector{<:Area}. In the case of a vector of areas, the method returns returns a value of 0 for all operational periods and emission resources.
EnergyModelsBase.constraints_elements — FunctionEMB.constraints_elements(m, 𝒜::Vector{<:Area}, 𝒳ᵛᵉᶜ, 𝒫, 𝒯, modeltype::EnergyModel)
EMB.constraints_elements(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒳ᵛᵉᶜ, 𝒫, 𝒯, modeltype::EnergyModel)Loop through all entries of the elements vector and call a subfunction for creating the internal constraints of the entries of the elements vector.
EnergyModelsGeography provides the user with two element types, Area and [Trasnmission]:
Area- the subfunction iscreate_area.Transmission- the subfunction iscreate_transmission_modeand called for allTransmissionModes withinℒᵗʳᵃⁿˢ.
EnergyModelsBase.constraints_couple — FunctionEMB.constraints_couple(m, 𝒜::Vector{<:Area}, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒫, 𝒯, modeltype::EnergyModel)
EMB.constraints_couple(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒜::Vector{<:Area}, 𝒫, 𝒯, modeltype::EnergyModel)Create the new couple constraints in EnergyModelsGeography.
The couple constraints are utilizing the variables :flow_in and :flow_out in combination with :area_exchange for solving the energy balance on an Area level for the respective GeoAvailability node.
The couple is achieved through the variable :area_exchange which is is calculated through the functions compute_trans_in and compute_trans_out.
As a consequence, each Area can be coupled with multiple Transmission corridors but each Transmission corridor can only be coupled to two Areas.
Variable methods
EnergyModelsBase.variables_capacity — FunctionEMB.variables_capacity(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)
EMB.variables_capacity(m, 𝒜::Vector{<:Area}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)Declaration of different capacity variables for the element type introduced in EnergyModelsGeography. Due to the design of the package, the individual TransmissionModes must be extracted now in each package
The capacity variables are only created for TransmissionModes and not Transmission corridors. The created variable is
trans_cap[tm, t]is the installed capacity of transmission modetmin operational periodt.
EnergyModelsBase.variables_flow — FunctionEMB.variables_flow(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)
EMB.variables_flow(m, 𝒜::Vector{<:Area}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)Declaration of flow OPEX variables for the element types introduced in EnergyModelsGeography. EnergyModelsGeography introduces two elements for an energy system, and hence, provides the user with two individual methods:
The capacity variables are only created for TransmissionModes and not Transmission corridors. The created variables are
trans_in[tm, t]is the flow into modetmin operational periodt. The inflow resources of transmission modemare extracted using the functioninputs.trans_out[tm, t]is the flow from modetmin operational periodt. The outflow resources of transmission modemare extracted using the functionoutputs.
area_exchange[a, t, p]is the exchange of resourcepby areaain operational periodt. The exchange resources are extracted using the functionexchange_resources
EnergyModelsBase.variables_opex — FunctionEMB.variables_opex(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)
EMB.variables_opex(m, 𝒜::Vector{<:Area}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)Declaration of different OPEX variables for the element types introduced in EnergyModelsGeography. Although EnergyModelsGeography introduces two elements, only ℒᵗʳᵃⁿˢ::Vector{Transmission} requires operational expense variables.
The operational expenses variables are only created for TransmissionModes and not Transmission corridors. The OPEX variables are furthermore only created for nodes, if the function has_opex(tm::TransmissionMode) has received an additional method for a given mode m returning the value true. By default, this corresponds to all modes.
trans_opex_var[tm, t_inv]are the variable operating expenses of nodenin investment periodt_inv. The values can be negative to account for revenue streamstrans_opex_fixed[tm, t_inv]are the fixed operating expenses of nodenin investment periodt_inv.
EnergyModelsBase.variables_capex — MethodEMB.variables_capex(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)
EMB.variables_capex(m, 𝒜::Vector{<:Area}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)Create variables for the capital costs for the investments in transmission. Empty function to allow for multiple dispatch in the EnergyModelsInvestment package.
EnergyModelsBase.variables_elements — FunctionEMB.variables_elements(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel)Loop through all TransmissionMode types present in ℒᵗʳᵃⁿˢ::Vector{Transmission} 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.
EnergyModelsBase.variables_element — Functionvariables_element(m, 𝒜ˢᵘᵇ::Vector{<:Area}, 𝒯, modeltype::EnergyModel)Default fallback method for a vector of elements if no other method is defined for a given vector type.
EnergyModelsBase.variables_element_ext_data — FunctionEMB.variables_element_ext_data(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒳ᵛᵉᶜ, 𝒯, 𝒫,modeltype::EnergyModel)Loop through all data subtypes and create variables specific to each subtype. It starts at the top level and subsequently move through the branches until it reaches a leave.
The function subsequently calls the subroutine variables_ext_data for creating the variables for the transmission modes that have the corresponding data types.
EnergyModelsBase.variables_ext_data — MethodEMB.variables_ext_data(m, _::Type{<:ExtensionData}, ℳ::Vector{<:TransmissionMode}, 𝒯, 𝒫, modeltype::EnergyModel)Default fallback method for the variables creation for a data type of a Vector{<:TransmissionMode} ℳ if no other method is defined. The default method does not specify any variables.
EnergyModelsBase.variables_emission — FunctionEMB.variables_emission(m, ℒᵗʳᵃⁿˢ::Vector{Transmission}, 𝒳ᵛᵉᶜ, 𝒫, 𝒯, modeltype::EnergyModel)Declaration of an emission variables for the element types introduced in EnergyModelsGeography. Although EnergyModelsGeography introduces two elements, only ℒᵗʳᵃⁿˢ::Vector{Transmission} requires an emission variable.
Declation of variables for the modeling of transmission 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.
emissions_trans[tm, t, p_em]emissions ofResourceEmitof transmission modetmin operational periodt. The variable is fixed to 0 forResourceEmitthat are not within the vector returned by the functionemit_resources.
Field extraction methods
EnergyModelsBase.capacity — Functioncapacity(tm::TransmissionMode)
capacity(tm::TransmissionMode, t)Returns the capacity of transmission mode tm as TimeProfile or in operational period t.
EnergyModelsBase.inputs — Functioninputs(tm::TransmissionMode)
inputs(tm::PipeMode)Returns the input resources of transmission mode tm.
EnergyModelsBase.outputs — Functionoutputs(tm::TransmissionMode)
outputs(tm::PipeMode)Returns the output resources of transmission mode tm.
EnergyModelsBase.opex_fixed — Functionopex_fixed(tm::TransmissionMode)
opex_fixed(tm::TransmissionMode, t_inv)Returns the variable OPEX of transmission mode tm as TimeProfile or in strategic period t_inv.
EnergyModelsBase.opex_var — Functionopex_var(tm::TransmissionMode)
opex_var(tm::TransmissionMode, t)Returns the variable OPEX of transmission mode tm as TimeProfile or in operational period t.
Identification methods
EnergyModelsBase.has_opex — Functionhas_opex(tm::TransmissionMode)Checks whether transmission mode tm has operational expenses.
By default, all transmission modes have operational expenses.
EnergyModelsBase.has_emissions — Functionhas_emissions(tm::TransmissionMode)Returns whether there are emissions associated with transmission mode tm. The default behaviour is no emissions.
Check methods
EnergyModelsBase.check_elements — FunctionEMB.check_elements(log_by_element, 𝒜::Vector{<:Area}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)
EMB.check_elements(log_by_element, ℒᵗʳᵃⁿˢ::Vector{<:Tranmission}, 𝒳ᵛᵉᶜ, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)All areas are checked through the functions
check_areato identify problematic input,check_time_structureto identify time profiles at the highest level that are not equivalent to the provided timestructure.
In addition, all areas are directly checked
- that the node returned by the function
availability_nodeis within the Node vector, - that the availability node is a
GeoAvailabilitynode, and - the exchange resources are within the resources of the
GeoAvailabilitynode.
All transmission corridors are checked through the functions
check_transmissionto identify problematic input,check_time_structureto identify time profiles at the highest level that are not equivalent to the provided timestructure.
The individual transmission modes of a corridorare checked through the functions
check_modeto identify problematic input andcheck_time_structureto identify time profiles at the highest level that are not equivalent to the provided timestructure.
In addition, all transmission corridors are directly checked to have in the fields :from and :to nodes that are present in the Area vector as extracted through the function get_areas.
EnergyModelsBase.check_time_structure — FunctionEMB.check_time_structure(tm::TransmissionMode, 𝒯)Check that all fields of a TransmissionMode that are of type TimeProfile correspond to the time structure 𝒯.