Data functions

The package provides the wildcard Data type as outlined in the Extensions to the model section of the philosophy page. Data can be utilized to extend the functionality of the model through dispatching on its type. The following function is included in all reference create_node functions, except for Storage types

# Iterate through all data and set up the constraints corresponding to the data
for data ∈ node_data(n)
    constraints_data(m, n, 𝒯, 𝒫, modeltype, data)
end

There is always a fallback option if a Data is specified, but no functions are provided:

constraints_data(m, n::Node, 𝒯, 𝒫, modeltype::EnergyModel, data::Data) = nothing

Its application is best explained by the implemented functionality for emissions.

Emissions data

Emissions data is an application of extensions via the application of the wildcard data field in the nodes. It allows to consider:

  1. no emissions of a node (no EmissionsData type has to be provided),
  2. energy usage related emissions of a node, that is emissions through the utilization of an energy carrier (EmissionsEnergy) given as input,
  3. the combination of process emissions and energy usage related emissions (EmissionsProcess),
  4. CO₂ capture of energy usage related emissions (CaptureEnergyEmissions),
  5. CO₂ capture of process emissions (CaptureProcessEmissions), and
  6. CO₂ capture of both process and energy usage related emissions (CaptureProcessEnergyEmissions).

The individual fields of the different types are described in the Public interface.

The extension is then implemented through the functions

function constraints_data(m, n::Node, 𝒯, 𝒫, modeltype, data::EmissionsEnergy)
function constraints_data(m, n::Node, 𝒯, 𝒫, modeltype, data::EmissionsProcess)
function constraints_data(m, n::Node, 𝒯, 𝒫, modeltype, data::CaptureEnergyEmissions)
function constraints_data(m, n::Node, 𝒯, 𝒫, modeltype::EnergyModel, data::CaptureProcessEmissions)
function constraints_data(m, n::Node, 𝒯, 𝒫, modeltype::EnergyModel, data::CaptureProcessEnergyEmissions)

in the file data_functions.jl. Correspondingly, we require only a single implementation of a Node to investigate multiple different emission scenarios, depending on the chosen EmissionsData. Both EmissionsEnergy and EmissionsProcess can handle input similar to the other EmissionsData types, allowing for a fast switch between individual emission configurations.