`EnergyModelsBase.EnergyModelsBase`

— ModuleMain module for `EnergyModelsBase`

a framework for building flexible energy system models.

It exports several types and associated functions for accessing fields. In addition, all required functions for creaeting and running the model are exported.

You can find the exported types and functions below or on the pages *Constraint functions* and *Data functions*.

`EnergyModelsBase.Availability`

— Type`Availability`

node as routing node.

`EnergyModelsBase.CaptureData`

— Type`CaptureData`

as supertype for all `EmissionsData`

that include CO₂ capture.

`EnergyModelsBase.CaptureEnergyEmissions`

— TypeCapture the energy usage related emissions, but not the process emissions. Does not require `emissions`

as input, but can be supplied.

**Fields**

: emissions per unit produced.`emissions::Dict{ResourceEmit, T}`

is the CO₂ capture rate.`co2_capture::Float64`

`EnergyModelsBase.CaptureProcessEmissions`

— TypeCapture the process emissions, but not the energy usage related emissions.

**Fields**

: emissions per unit produced.`emissions::Dict{ResourceEmit, T}`

is the CO₂ capture rate.`co2_capture::Float64`

`EnergyModelsBase.CaptureProcessEnergyEmissions`

— TypeCapture both the process emissions and the energy usage related emissions.

**Fields**

: emissions per unit produced.`emissions::Dict{ResourceEmit, T}`

is the CO₂ capture rate.`co2_capture::Float64`

`EnergyModelsBase.Data`

— TypeAbstract type used to define concrete struct containing the package specific elements to add to the composite type defined in this package.

`EnergyModelsBase.Direct`

— Type`Direct <: Link`

A direct link between two nodes.

**Fields**

is the name/identifier of the link.`id`

is node from which there is flow into the link.`from::Node`

is node to which there is flow out of the link.`to::Node`

is the used formulation of links. If not specified, a`formulation::Formulation`

`Linear`

link is assumed.

`EnergyModelsBase.EmissionsData`

— Type`EmissionsData`

as supertype for all `Data`

types for emissions.

`EnergyModelsBase.EmissionsEnergy`

— TypeNo capture, no process emissions are present. Does not require `co2_capture`

or `emissions`

as input, but accepts it and will ignore it, if provided.

`EnergyModelsBase.EmissionsProcess`

— TypeNo capture, but process emissions are present. Does not require `co2_capture`

as input, but accepts it and will ignore it, if provided.

**Fields**

: emissions per unit produced.`emissions::Dict{ResourceEmit, T}`

`EnergyModelsBase.EmptyData`

— TypeEmpty composite type for `Data`

`EnergyModelsBase.EnergyModel`

— TypeAbstract type for differentation between types of models (investment, operational, ...).

`EnergyModelsBase.Formulation`

— TypeDeclaration of the general type for formulation of links.

`EnergyModelsBase.GenAvailability`

— TypeA reference `Availability`

node.

**Fields**

is the name/identifier of the node.`id`

are the input`inputs::Vector{<:Resource}`

`Resource`

s.are the output`output::Vector{<:Resource}`

`Resource`

s.

A constructor is provided so that only a single array can be provided with the fields:

is the name/identifier of the node.`id`

are the`𝒫::Vector{<:Resource}`

`Resource`

s.

`EnergyModelsBase.GenAvailability`

— MethodLegacy constructor for a `GenAvailability`

. This version will be discontinued in the near future and replaced with the new implementation of `data`

.

See the documentation for further information.

`EnergyModelsBase.Linear`

— TypeLinear `Formulation`

, that is input equals output.

`EnergyModelsBase.Link`

— TypeDeclaration of the general type for links connecting nodes.

`EnergyModelsBase.NetworkNode`

— Type`NetworkNode`

node with both input and output.

`EnergyModelsBase.Node`

— Type`Node`

as supertype for all technologies.

`EnergyModelsBase.OperationalModel`

— TypeOperational Energy Model without investments.

**Fields**

is a dictionary with individual emission limits as`emission_limit::Dict{<:ResourceEmit, <:TimeProfile}`

`TimeProfile`

for each emission resource`ResourceEmit`

.are the prices for the different emissions types considered.`emission_price::Dict{<:ResourceEmit, <:TimeProfile}`

is a`co2_instance`

`ResourceEmit`

and corresponds to the type used for CO₂.

`EnergyModelsBase.OperationalModel`

— MethodLegacy constructor for an `OperationalModel`

without emission prices. This version will be discontinued in the near future and replaced with the new implementation with an emission price.

See the documentation for further information regarding the introduction of an emission price.

`EnergyModelsBase.RefNetworkNode`

— TypeA reference `NetworkNode`

node.

**Fields**

is the name/identifier of the node.`id`

is the installed capacity.`cap::TimeProfile`

is the variational operational costs per energy unit produced.`opex_var::TimeProfile`

is the fixed operational costs.`opex_fixed::TimeProfile`

are the input`input::Dict{<:Resource, <:Real}`

`Resource`

s with conversion value`Real`

.are the generated`output::Dict{<:Resource, <:Real}`

`Resource`

s with conversion value`Real`

.is the additional data (e.g. for investments). The field`data::Vector{Data}`

`data`

is conditional through usage of a constructor.

`EnergyModelsBase.RefSink`

— TypeA reference `Sink`

node.

This node corresponds to a demand given by the field `cap`

.

**Fields**

is the name/identifier of the node.`id`

is the Demand.`cap::TimeProfile`

are penalties for surplus or deficits. Requires the fields`penalty::Dict{Any, TimeProfile}`

`:surplus`

and`:deficit`

.are the input`input::Dict{<:Resource, <:Real}`

`Resource`

s with conversion value`Real`

.is the additional data (e.g. for investments). The field`data::Vector{Data}`

`data`

is conditional through usage of a constructor.

`EnergyModelsBase.RefSink`

— MethodLegacy constructor for a `RefSink`

node with [process] emissions. This version will be discontinued in the near future and replaced with the new implementation of `data`

.

See the documentation for further information. In this case, the emission data can be implemented by the new `EmissionsData`

type `EmissionsProcess`

`EnergyModelsBase.RefSource`

— TypeA reference `Source`

node.

**Fields**

is the name/identifier of the node.`id`

is the installed capacity.`cap::TimeProfile`

is the variational operational costs per energy unit produced.`opex_var::TimeProfile`

is the fixed operational costs.`opex_fixed::TimeProfile`

are the generated`output::Dict{<:Resource, <:Real}`

`Resource`

s with conversion value`Real`

.is the additional data (e.g. for investments). The field`data::Vector{Data}`

`data`

is conditional through usage of a constructor.

`EnergyModelsBase.RefSource`

— MethodLegacy constructor for a `RefSource`

node with emissions. This version will be discontinued in the near future and replaced with the new implementation of `data`

.

See the documentation for further information. In this case, the emission data can be implemented by the new `EmissionsData`

type `EmissionsProcess`

`EnergyModelsBase.RefStorage`

— TypeA reference `Storage`

node.

This node is designed to store either a `ResourceCarrier`

or a `ResourceEmit`

. It is designed as a composite type to automatically distinguish between these two.

**Fields**

is the name/identifier of the node.`id`

is the installed rate capacity, that is e.g. power or mass flow.`rate_cap::TimeProfile`

is the installed storage capacity, that is e.g. energy or mass.`stor_cap::TimeProfile`

is the variational operational costs per energy unit stored.`opex_var::TimeProfile`

is the fixed operational costs.`opex_fixed::TimeProfile`

is the stored`stor_res::T`

`Resource`

.are the input`input::Dict{<:Resource, <:Real}`

`Resource`

s with conversion value`Real`

.are the generated`output::Dict{<:Resource, <:Real}`

`Resource`

s with conversion value`Real`

. Only relevant for linking and the stored`Resource`

.is the additional data (e.g. for investments). The field`data::Vector{<:Data}`

`data`

is conditional through usage of a constructor.

`EnergyModelsBase.Resource`

— TypeGeneral resource supertype to be used for the declaration of subtypes.

`EnergyModelsBase.ResourceCarrier`

— TypeResources that can be transported and converted. These resources cannot be included as resources that are emitted, *e.g*, in the variable $\texttt{emissions\_strategic}$.

**Fields**

is the name/identifyer of the resource.`id`

is the the CO₂ intensity,`co2_int::T`

*e.g.*, t/MWh.

`EnergyModelsBase.ResourceEmit`

— TypeResources that can can be emitted (e.g., CO₂, CH₄, NOₓ).

These resources can be included as resources that are emitted, *e.g*, in the variable $\texttt{emissions\_strategic}$.

**Fields**

is the name/identifyer of the resource.`id`

is the the CO₂ intensity,`co2_int::T`

*e.g.*, t/MWh.

`EnergyModelsBase.Sink`

— Type`Sink`

node with only input.

`EnergyModelsBase.Source`

— Type`Source`

node with only output.

`EnergyModelsBase.Storage`

— Type`Storage`

node with level.

`EnergyModelsBase.RefNetwork`

— MethodLegacy constructor for a `RefNetwork`

node. This version will be discontinued in the near future. its new name is given by RefNetworkNode.

`EnergyModelsBase.RefNetworkEmissions`

— MethodLegacy constructor for a `RefNetworkEmissions`

node. This version will be discontinued in the near future and replaced with the new implementation of `data`

and the application of `RefNetworkNode`

.

See the documentation for further information. In this case, the emission data can be implemented by the new `EmissionsData`

type `CaptureEnergyEmissions`

.

`EnergyModelsBase.RefStorageEmissions`

— MethodLegacy constructor for a `RefStorageEmissions`

. This version will be discontinued in the near future and replaced with the new version of `RefStorage`

.

See the documentation for further information. In this case, the key difference is that it uses now a parametric type instead of a standard composite type to differentiate between the storage of `ResourceCarrier`

or `ResourceEmit`

`EnergyModelsBase.capacity`

— Method`capacity(n::Node, t)`

Returns the capacity of a node `n`

at operational period `t`

. In the case of a `Storage`

node, the capacity is returned as `NamedTuple`

with the fields `level`

and `rate`

.

`EnergyModelsBase.capacity`

— Method`capacity(n::Node)`

Returns the capacity of a node `n`

as `TimeProfile`

. In the case of a `Storage`

node, the capacity is returned as `NamedTuple`

with the fields `level`

and `rate`

.

`EnergyModelsBase.check_data`

— Method`check_data(case, modeltype)`

Check if the case data is consistent. Use the `@assert_or_log`

macro when testing. Currently only checking node data.

`EnergyModelsBase.check_node`

— Method`check_node(n, 𝒯, modeltype::EnergyModel)`

Check that the fields of a `Node`

corresponds to required structure.

`EnergyModelsBase.check_profile_field`

— Method`check_profile_field(fieldname, value::TimeProfile, 𝒯)`

Check that an individual `TimeProfile`

corresponds to the time structure `𝒯`

.

`EnergyModelsBase.check_time_structure`

— Method`check_time_structure(n::Node, 𝒯)`

Check that all fields of a `Node`

that are of type `TimeProfile`

correspond to the time structure `𝒯`

.

`EnergyModelsBase.co2_capture`

— Method`co2_capture(data::CaptureData)`

Returns the CO₂ capture rate of the `data`

.

`EnergyModelsBase.co2_instance`

— Method`co2_instance(model::EnergyModel)`

Returns the CO₂ instance used in modelling.

`EnergyModelsBase.co2_int`

— Method`co2_int(p::Resource)`

Returns the CO₂ intensity of resource `p`

`EnergyModelsBase.collect_types`

— Method`collect_types(types_list)`

Return a Dict of all the give types_list and their supertypes. The keys in the dictionary are the types, and their corresponding value is the number in the type hierarchy.

E.g., `Node`

is at the top and will thus have the value 1. Types just below `Node`

will have value 2, and so on.

`EnergyModelsBase.compile_logs`

— Method`compile_logs(case, log_by_element)`

Simple method for showing all log messages.

`EnergyModelsBase.constraints_capacity`

— Method`constraints_capacity(m, n::Node, 𝒯::TimeStructure, modeltype::EnergyModel)`

Function for creating the constraint on the maximum capacity of a generic `Node`

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

.

`EnergyModelsBase.constraints_capacity`

— Method`constraints_capacity(m, n::Sink, 𝒯::TimeStructure, modeltype::EnergyModel)`

Function for creating the constraint on the maximum capacity of a generic `Sink`

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

.

`EnergyModelsBase.constraints_capacity`

— Method`constraints_capacity(m, n::Storage, 𝒯::TimeStructure, modeltype::EnergyModel)`

Function for creating the constraint on the maximum level of a generic `Storage`

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

.

`EnergyModelsBase.constraints_capacity_installed`

— Method`constraints_capacity_installed(m, n, 𝒯::TimeStructure, modeltype::EnergyModel)`

In general, it is prefered to have the capacity as a function of a variable given with a value of 1 in the field `n.Cap`

.

`EnergyModelsBase.constraints_data`

— Method`constraints_data(m, n::Node, 𝒯, 𝒫, modeltype, data::Data)`

Fallback option when data is specified, but it is not desired to add the constraints through this function. This is, e.g., the case for `EnergyModelsInvestments`

as the capacity constraint has to be replaced

`EnergyModelsBase.constraints_data`

— Method`constraints_data(m, n::Node, 𝒯, 𝒫, modeltype, data::DataEmissions)`

Constraints functions for calculating both the emissions and amount of CO₂ captured in the process.

There exist several configurations:

: Only energy usage related emissions.`EmissionsEnergy`

: Both process and energy usage related emissions.`EmissionsProcess`

: Capture of energy usage related emissions, can include process emissions.`CaptureEnergyEmissions`

: Capture of process emissions.`CaptureProcessEmissions`

: Capture of both process and energy usage related`CaptureProcessEnergyEmissions`

emissions.

`EnergyModelsBase.constraints_emissions`

— Method`constraints_emissions(m, 𝒩, 𝒯, 𝒫, modeltype::EnergyModel)`

Create constraints for the emissions accounting for both operational and strategic periods.

`EnergyModelsBase.constraints_flow_in`

— Method`constraints_flow_in(m, n, 𝒯::TimeStructure, modeltype::EnergyModel)`

Function for creating the constraint on the inlet flow to a generic `Node`

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

.

`EnergyModelsBase.constraints_flow_in`

— Method`constraints_flow_in(m, n::Storage, 𝒯::TimeStructure, modeltype::EnergyModel)`

Function for creating the constraint on the inlet flow to a generic `Storage`

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

.

`EnergyModelsBase.constraints_flow_out`

— Method`constraints_flow_out(m, n, 𝒯::TimeStructure, modeltype::EnergyModel)`

Function for creating the constraint on the outlet flow from a generic `Node`

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

.

`EnergyModelsBase.constraints_level`

— Method`constraints_level(m, n::Storage, 𝒯, 𝒫, modeltype::EnergyModel)`

Function for creating the level constraint for a reference storage node with a `ResourceCarrier`

resource.

`EnergyModelsBase.constraints_level_aux`

— Method`constraints_level_aux(m, n::RefStorage{S}, 𝒯, 𝒫, modeltype::EnergyModel) where {S<:ResourceCarrier}`

Function for creating the Δ constraint for the level of a reference storage node with a `ResourceCarrier`

resource.

`EnergyModelsBase.constraints_level_aux`

— Method`constraints_level_aux(m, n::RefStorage{S}, 𝒯, 𝒫, modeltype::EnergyModel) where {S<:ResourceEmit}`

Function for creating the Δ constraint for the level of a reference storage node with a `ResourceEmit`

resource.

`EnergyModelsBase.constraints_level_sp`

— Method```
constraints_level_sp(
m,
n::RefStorage{S},
t_inv::TS.StrategicPeriod{T, RepresentativePeriods{U, T, SimpleTimes{T}}},
𝒫,
modeltype::EnergyModel
) where {S<:ResourceCarrier, T, U}
```

Function for creating the level constraint for a reference storage node with a `ResourceCarrier`

resource when the operational `TimeStructure`

is given as `RepresentativePeriods`

.

`EnergyModelsBase.constraints_level_sp`

— Method```
constraints_level_sp(
m,
n::RefStorage{S},
t_inv::TS.StrategicPeriod{T, RepresentativePeriods{U, T, SimpleTimes{T}}},
𝒫,
modeltype::EnergyModel
) where {S<:ResourceEmit, T, U}
```

Function for creating the level constraint for a reference storage node with a `ResourceEmit`

resource when the operational TimeStructure is given as `RepresentativePeriods`

.

`EnergyModelsBase.constraints_level_sp`

— Method```
constraints_level_sp(
m,
n::RefStorage{S},
t_inv::TS.StrategicPeriod{T, U},
𝒫,
modeltype::EnergyModel
) where {S<:ResourceCarrier, T, U<:SimpleTimes}
```

Function for creating the level constraint for a reference storage node with a `ResourceCarrier`

resource when the operational `TimeStructure`

is given as `SimpleTimes`

.

`EnergyModelsBase.constraints_level_sp`

— Method```
constraints_level_sp(
m,
n::RefStorage{S},
t_inv::TS.StrategicPeriod{T, U},
𝒫,
modeltype::EnergyModel
) where {S<:ResourceEmit, T, U<:SimpleTimes}
```

Function for creating the level constraint for a reference storage node with a `ResourceEmit`

resource when the operational TimeStructure is given as `SimpleTimes`

.

`EnergyModelsBase.constraints_links`

— Method`constraints_links(m, 𝒩, 𝒯, 𝒫, ℒ, modeltype::EnergyModel)`

Call the function `create_link`

for link formulation

`EnergyModelsBase.constraints_node`

— Method`constraints_node(m, 𝒩, 𝒯, 𝒫, ℒ, modeltype::EnergyModel)`

Create link constraints for each `n ∈ 𝒩`

depending on its type and calling the function `create_node(m, n, 𝒯, 𝒫)`

for the individual node constraints.

Create constraints for fixed OPEX.

`EnergyModelsBase.constraints_opex_fixed`

— Method`constraints_opex_fixed(m, n::Node, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)`

Function for creating the constraint on the fixed OPEX of a generic `Node`

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

.

`EnergyModelsBase.constraints_opex_fixed`

— Method`constraints_opex_fixed(m, n::Sink, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)`

Function for creating the constraint on the fixed OPEX of a generic `Sink`

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

.

`EnergyModelsBase.constraints_opex_fixed`

— Method`constraints_opex_fixed(m, n::Storage, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)`

Function for creating the constraint on the fixed OPEX of a generic `Storage`

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

.

`EnergyModelsBase.constraints_opex_fixed`

— Method`constraints_opex_fixed(m, n::Storage, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)`

Function for creating the constraint on the fixed OPEX of a generic `Storage`

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

.

`EnergyModelsBase.constraints_opex_var`

— Method`constraints_opex_var(m, n::Node, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)`

Function for creating the constraint on the variable OPEX of a generic `Node`

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

.

`EnergyModelsBase.constraints_opex_var`

— Method`constraints_opex_var(m, n::Sink, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)`

Function for creating the constraint on the variable OPEX of a generic `Sink`

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

.

`EnergyModelsBase.constraints_opex_var`

— Method`constraints_opex_var(m, n::Storage, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)`

Function for creating the constraint on the variable OPEX of a generic `Storage`

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

.

`EnergyModelsBase.constraints_opex_var`

— Method`constraints_opex_var(m, n::RefStorage{T}, 𝒯ᴵⁿᵛ, modeltype::EnergyModel) where {T<:ResourceEmit}`

Function for creating the constraint on the variable OPEX of a `RefStorage{ResourceEmit}`

.

`EnergyModelsBase.create_link`

— Method`create_link(m, 𝒯, 𝒫, l, formulation::Formulation)`

Set the constraints for a simple `Link`

(input = output). Can serve as fallback option for all unspecified subtypes of `Link`

.

`EnergyModelsBase.create_model`

— Method`create_model(case, modeltype::EnergyModel)`

Create the model and call all required functions based on provided `modeltype`

and case data.

`EnergyModelsBase.create_node`

— Method`create_node(m, n::Availability, 𝒯, 𝒫, modeltype::EnergyModel)`

Set all constraints for a `Availability`

. Can serve as fallback option for all unspecified subtypes of `Availability`

.

Availability nodes can be seen as routing nodes. It is not necessary to have more than one available node except if one wants to include as well transport between different `Availability`

nodes with associated costs (not implemented at the moment).

`EnergyModelsBase.create_node`

— Method`create_node(m, n::NetworkNode, 𝒯, 𝒫, modeltype::EnergyModel)`

Set all constraints for a `NetworkNode`

. Can serve as fallback option for all unspecified subtypes of `NetworkNode`

.

`EnergyModelsBase.create_node`

— Method`create_node(m, n::Sink, 𝒯, 𝒫, modeltype::EnergyModel)`

Set all constraints for a `Sink`

. Can serve as fallback option for all unspecified subtypes of `Sink`

.

`EnergyModelsBase.create_node`

— Method`create_node(m, n::Source, 𝒯, 𝒫, modeltype::EnergyModel)`

Set all constraints for a `Source`

. Can serve as fallback option for all unspecified subtypes of `Source`

.

`EnergyModelsBase.create_node`

— Method`create_node(m, n::Storage, 𝒯, 𝒫, modeltype::EnergyModel)`

Set all constraints for a `Storage`

. Can serve as fallback option for all unspecified subtypes of `Storage`

.

`EnergyModelsBase.deficit_penalty`

— Method`deficit_penalty(n::Sink, t)`

Returns the deficit penalty of sink `n`

at operational period `t`

`EnergyModelsBase.deficit_penalty`

— Method`deficit_penalty(n::Sink)`

Returns the deficit penalty of sink `n`

as `TimeProfile`

.

`EnergyModelsBase.emission_limit`

— Method`emission_limit(model::EnergyModel, p::ResourceEmit, t_inv::TS.StrategicPeriod)`

Returns the emission limit of EnergyModel `model`

and ResourceEmit `p`

in strategic period period `t_inv`

.

`EnergyModelsBase.emission_limit`

— Method`emission_limit(model::EnergyModel, p::ResourceEmit)`

Returns the emission limit of EnergyModel `model`

and ResourceEmit `p`

as `TimeProfile`

.

`EnergyModelsBase.emission_limit`

— Method`emission_limit(model::EnergyModel)`

Returns the emission limit of EnergyModel `model`

as dictionary with `TimeProfile`

s for each `ResourceEmit`

.

`EnergyModelsBase.emission_price`

— Method`emission_price(model::EnergyModel, p::ResourceEmit, t_inv::TS.StrategicPeriod)`

Returns the emission price of EnergyModel `model`

and ResourceEmit `p`

in strategic period `t_inv`

. If no emission price is specified for the ResourceEmit `p`

, the function returns 0

`EnergyModelsBase.emission_price`

— Method`emission_price(model::EnergyModel, p::ResourceEmit)`

Returns the emission price of EnergyModel `model`

and ResourceEmit `p`

as `TimeProfile`

. If no emission price is specified for the ResourceEmit `p`

, the function returns 0

`EnergyModelsBase.emission_price`

— Method`emission_price(model::EnergyModel)`

Returns the emission price of EnergyModel `model`

as dictionary with `TimeProfile`

s for each `ResourceEmit`

.

`EnergyModelsBase.formulation`

— Method`formulation(l::Link)`

Return the formulation of a Link ´l´.

`EnergyModelsBase.has_emissions`

— Method`has_emissions(n::Node)`

Checks whether the Node `n`

has emissions.

`EnergyModelsBase.has_input`

— Method`has_input(n::Node)`

Return logic whether the node is an input node, i.e., `Sink`

and `NetworkNode`

nodes.

`EnergyModelsBase.has_output`

— Method`has_output(n::Node)`

Return logic whether the node is an output node, i.e., `Source`

and `NetworkNode`

nodes.

`EnergyModelsBase.inputs`

— Method`inputs(n::Node, p::Resource)`

Returns the value of an input resource `p`

of a node `n`

.

`EnergyModelsBase.inputs`

— Method`inputs(n::Node)`

Returns the input resources of a node `n`

. These resources are specified via the field `input`

.

`EnergyModelsBase.is_network_node`

— Method`is_network_node(n::Node)`

Checks, whether node `n`

is a `NetworkNode`

node

`EnergyModelsBase.is_resource_emit`

— Method`is_resource_emit(p::Resource)`

Checks whether the Resource `p`

is of type `ResourceEmit`

.

`EnergyModelsBase.is_sink`

— Method`is_sink(n::Node)`

Checks, whether node `n`

is a `Sink`

node

`EnergyModelsBase.is_source`

— Method`is_source(n::Node)`

Checks, whether node `n`

is a `Source`

node

`EnergyModelsBase.is_storage`

— Method`is_storage(n::Node)`

Checks, whether node `n`

is a `Storage`

node

`EnergyModelsBase.link_res`

— Method`link_res(l::Link)`

Return the resources transported for a given link `l`

.

`EnergyModelsBase.link_sub`

— Method`link_sub(ℒ::Vector{<:Link}, n::Node)`

Return connected links for a given node `n`

.

`EnergyModelsBase.multiple`

— Method`multiple(t_inv, t)`

Provide a simplified function for returning the combination of the functions duration(t) * multiple*strat(t*inv, t) * probability(t)

`EnergyModelsBase.node_data`

— Method`node_data(n::Node)`

Returns the `Data`

array of node `n`

.

`EnergyModelsBase.node_sub`

— Function`nodes_sub(𝒩::Array{<:Node}, sub/subs)`

Return nodes that are of type sub/subs for a given Array `::Array{<:Node}`

.

`EnergyModelsBase.nodes_emissions`

— Method`has_emissions(𝒩::Array{<:Node})`

Return nodes that have emission data for a given Array `::Array{<:Node}`

.

`EnergyModelsBase.nodes_input`

— Method`nodes_input(𝒩::Array{<:Node}, sub)`

Return nodes that have an input, i.e., `Sink`

and `NetworkNode`

nodes.

`EnergyModelsBase.nodes_not_av`

— Method`nodes_not_av(𝒩::Array{<:Node})`

Return nodes that are not `Availability`

nodes for a given Array `::Array{<:Node}`

.

`EnergyModelsBase.nodes_not_sub`

— Function`nodes_not_sub(𝒩::Array{<:Node}, sub)`

Return nodes that are not of type `sub`

for a given Array `::Array{<:Node}`

.

`EnergyModelsBase.nodes_output`

— Method`nodes_output(𝒩::Array{<:Node})`

Return nodes that have an output, i.e., `Source`

and `NetworkNode`

nodes.

`EnergyModelsBase.objective`

— Method`objective(m, 𝒩, 𝒯, 𝒫, modeltype::EnergyModel)`

Create the objective for the optimization problem for a given modeltype.

`EnergyModelsBase.opex_fixed`

— Method`opex_fixed(n::Node, t_inv)`

Returns the fixed OPEX of a node `n`

at strategic period `t_inv`

`EnergyModelsBase.opex_fixed`

— Method`opex_fixed(n::Node)`

Returns the fixed OPEX of a node `n`

as `TimeProfile`

.

`EnergyModelsBase.opex_var`

— Method`opex_var(n::Node, t)`

Returns the variable OPEX of a node `n`

in operational period `t`

`EnergyModelsBase.opex_var`

— Method`opex_var(n::Node)`

Returns the variable OPEX of a node `n`

as `TimeProfile`

.

`EnergyModelsBase.outputs`

— Method`outputs(n::Node, p::Resource)`

Returns the value of an output resource `p`

of a node `n`

.

`EnergyModelsBase.outputs`

— Method`outputs(n::Node)`

Returns the output resources of a node `n`

. These resources are specified via the field `output`

.

`EnergyModelsBase.process_emissions`

— Method`process_emissions(data::EmissionsData)`

Returns the `ResourceEmit`

s that have process emissions in the `data`

.

`EnergyModelsBase.process_emissions`

— Method`process_emissions(data::EmissionsData{T}, p:ResourceEmit, t)`

Returns the the process emissions of resource `p`

in the `data`

at operational period t. If there are no process emissions, it returns a value of 0.

`EnergyModelsBase.process_emissions`

— Method`process_emissions(data::EmissionsData{T}, p::ResourceEmit)`

Returns the the process emissions of resource `p`

in the `data`

as `TimeProfile`

. If the process emissions are provided as `Float64`

, it returns a FixedProfile(x). If there are no process emissions, it returns a FixedProfile(0).

`EnergyModelsBase.res_em`

— Method`res_em(𝒫::Array{<:Resource})`

Returns all emission resources for a

- a given array
`::Array{<:Resource}`

.The output is in this case an`Array{<:Resource}`

- a given dictionary
`::Dict`

.The output is in this case a dictionary`Dict`

with the correct fields

`EnergyModelsBase.res_not`

— Method`res_not(𝒩::Array{<:Resource}, res_inst)`

Return all resources that are not `res_inst`

for

- a given array
`::Array{<:Resource}`

.The output is in this case an`Array{<:Resource}`

- a given dictionary
`::Dict`

.The output is in this case a dictionary`Dict`

with the correct fields

`EnergyModelsBase.res_sub`

— Function`res_sub(𝒫::Array{<:Resource}, sub = ResourceEmit)`

Return resources that are of type `sub`

for a given Array `::Array{Resource}`

.

`EnergyModelsBase.run_model`

— Method`run_model(case::Dict, model::EnergyModel, optimizer)`

Take the `case`

data as a dictionary and the `model`

and build and optimize the model. Returns the solved JuMP model.

The dictionary requires the keys:

`:nodes::Vector{Node}`

`:links::Vector{Link}`

`:products::Vector{Resource}`

`:T::TimeStructure`

`EnergyModelsBase.sort_types`

— Method`sort_types(types_list::Dict)`

Sort the result of `collect_types`

and return a vector where a supertype comes before all its subtypes.

`EnergyModelsBase.storage_resource`

— Method`storage_resource(n::Storage)`

Returns the storage resource of `Storage`

node `n`

.

`EnergyModelsBase.surplus_penalty`

— Method`surplus_penalty(n::Sink, t)`

Returns the surplus penalty of sink `n`

at operational period `t`

`EnergyModelsBase.surplus_penalty`

— Method`surplus_penalty(n::Sink)`

Returns the surplus penalty of sink `n`

as `TimeProfile`

.

`EnergyModelsBase.variables_capacity`

— Method`variables_capacity(m, 𝒩, 𝒯, modeltype::EnergyModel)`

Creation of different capacity variables for nodes `𝒩ⁿᵒᵗ`

that are neither `Storage`

nor `Availability`

nodes. These variables are:

`:cap_use`

- use of a technology node in each operational period`:cap_inst`

- installed capacity in each operational period in terms of either`:flow_in`

or `:flow_out`

(depending on node `n ∈ 𝒩`

)

Creation of different storage variables for `Storage`

nodes `𝒩ˢᵗᵒʳ`

. These variables are:

`:stor_level`

- storage level at the end of each operational period`:stor_level_Δ_op`

- storage level change in each operational period`:stor_level_Δ_rp`

- storage level change in each representative period`:stor_rate_use`

- storage rate use in each operational period`:stor_cap_inst`

- installed capacity for storage in each operational period, constrained

in the operational case to `n.stor_cap`

`:stor_rate_inst`

- installed rate for storage, e.g. power in each operational period,

constrained in the operational case to `n.rate_cap`

`EnergyModelsBase.variables_capex`

— Method`variables_capex(m, 𝒩, 𝒯, 𝒫, modeltype::EnergyModel)`

Declaration of the CAPEX variables of the model for each investment period `𝒯ᴵⁿᵛ ∈ 𝒯`

. Empty for operational models but required for multiple dispatch in investment model.

`EnergyModelsBase.variables_emission`

— Method`variables_emission(m, 𝒩, 𝒯, 𝒫, modeltype::EnergyModel)`

Declaration of emission variables per technology node with emissions `n ∈ 𝒩ᵉᵐ`

and emission resource `𝒫ᵉᵐ ∈ 𝒫`

.

The emission variables are differentiated in:

`:emissions_node`

- emissions of a node in an operational period,`:emissions_total`

- total emissions in an operational period, and`:emissions_strategic`

- total strategic emissions, constrained to an upper limit based on the field`emission_limit`

of the`EnergyModel`

.

`EnergyModelsBase.variables_flow`

— Method`variables_flow(m, 𝒩, 𝒯, 𝒫, ℒ, modeltype::EnergyModel)`

Declaration of the individual input (`:flow_in`

) and output (`:flow_out`

) flowrates for each technological node `n ∈ 𝒩`

and link `l ∈ ℒ`

(`:link_in`

and `:link_out`

).

`EnergyModelsBase.variables_node`

— Method" variables_node(m, 𝒩ˢᵘᵇ::Vector{<:Node}, 𝒯, modeltype::EnergyModel)

Default fallback method when no function is defined for a node type.

`EnergyModelsBase.variables_node`

— Method`variables_node(m, 𝒩ˢⁱⁿᵏ::Vector{<:Sink}, 𝒯, modeltype::EnergyModel)`

Declaration of both surplus (`:sink_surplus`

) and deficit (`:sink_deficit`

) variables for `Sink`

nodes `𝒩ˢⁱⁿᵏ`

to quantify when there is too much or too little energy for satisfying the demand.

`EnergyModelsBase.variables_nodes`

— Method`variables_nodes(m, 𝒩, 𝒯, modeltype::EnergyModel)`

Loop through all node types and create variables specific to each type. This is done by calling the method `variables_node`

on all nodes of each type.

The node type representing the widest cathegory will be called first. That is, `variables_node`

will be called on a `Node`

before it is called on `NetworkNode`

-nodes.

`EnergyModelsBase.variables_opex`

— Method`variables_opex(m, 𝒩, 𝒯, 𝒫, modeltype::EnergyModel)`

Declaration of the OPEX variables (`:opex_var`

and `:opex_fixed`

) of the model for each period `𝒯ᴵⁿᵛ ∈ 𝒯`

. Variable OPEX can be non negative to account for revenue streams.

`EnergyModelsBase.@assert_or_log`

— Macro`assert_or_log(ex, msg)`

Macro that extends the behaviour of the `@assert`

macro. The switch `ASSERTS_AS_LOG`

, controls if the macro should act as a logger or a normal `@assert`

. This macro is designed to be used to check whether the data provided is consistent.