Methods - EnergyModelsBase

Index

Extension methods

EnergyModelsBase.create_linkFunction
create_link(m, l::DHPipe, 𝒯, 𝒫, modeltype::EnergyModel)

When the link is a DHPipe, the constraints for a link include a loss based on the difference in the temperature of the district heating resource and the ground.

In addition, a DHPipe includes a capacity with the potential for investments.

source

Constraint methods

EnergyModelsBase.constraints_level_iterateFunction
constraints_level_iterate(
    m,
    n::ThermalEnergyStorage,
    prev_pers::PreviousPeriods,
    cyclic_pers::CyclicPeriods,
    per,
    _::SimpleTimes,
    modeltype::EnergyModel,
)

In the case of a ThermalEnergyStorage, the lowest level iterator is adjusted as the loss is dependent on the level at the beginning of the operational period.

source
EnergyModelsBase.constraints_flow_inFunction
constraints_flow_in(m, n::HeatPump, 𝒯::TimeStructure, modeltype::EnergyModel)

Function for creating the constraint on the heat and electricity input of a HeatPump.

source
constraints_flow_in(m, n::DirectHeatUpgrade, 𝒯::TimeStructure, modeltype::EnergyModel)

Create the constraints for flow in to DirectHeatUpgrade. The constraint is only for power as the proportion of the inputs depends on the need for upgrade computed from the temperatures of the input/output ResourceHeat and the ΔT_min, and the capacity is linked to the power consumption.

source
EnergyModelsBase.constraints_flow_outFunction
EMB.constraints_flow_out(m, n::HeatExchanger{A,T}, 𝒯::TimeStructure, modeltype::EnergyModel)

Create the constraints for the flow out from a HeatExchanger. The flow of available heat energy is calculated from the temperatures in the heat flows using the function dh_fraction.

source
constraints_flow_out(m, n::DirectHeatUpgrade{A,T}, 𝒯::TimeStructure, modeltype::EnergyModel) where {A,T}

Create the constraints for flow out from a DirectHeatUpgrade. The flow of available heat energy is calculated from the temperatures in the heat flows using the function upgradeable_fraction, and the heat needed to upgrade to the required temperature is calculated by the function dh_upgrade. Note that the node may dump some of the ingoing heat energy, and the power needed for the upgrade is calculated from the resulting energy outflow.

source

Check methods

EnergyModelsBase.check_nodeFunction
check_node(
    n::DirectHeatUpgrade{A, T},
    𝒯,
    modeltype::EnergyModel,
    check_timeprofiles::Bool,
) where {A, T}

Check if a DirectHeatUpgrade node has reasonable values for the return/supply temperatures and error if the upgrade is ≥ 1 (should only happen with data errors).

source
EMB.check_node(n::HeatPump, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)

This method checks that the HeatPump node is valid.

It reuses the standard checks of a NetworkNode node through calling the function EMB.check_node_default, but adds an additional check on the data.

Checks

  • The field cap is required to be non-negative (similar to the NetworkNode check).
  • The value of the field fixed_opex is required to be non-negative and accessible through a StrategicPeriod as outlined in the function check_fixed_opex(n, 𝒯ᴵⁿᵛ, check_timeprofiles).
  • The values of the dictionary input and output are required to be non-negative (similar to the NetworkNode check).
  • The field cap_lower_bound is required to be in the range $[0, 1]$ for all time steps $t ∈ \mathcal{T}$.
  • The field eff_carnot is required to be in the range $[0, 1]$ for all time steps $t ∈ \mathcal{T}$.
  • The field t_sink is required to be greater than or equal to the field t_source for all time steps $t ∈ \mathcal{T}$.
source
EMB.check_node(n::ThermalEnergyStorage, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool)

This method checks that the ThermalEnergyStorage node is valid.

It reuses the standard checks of a Storage node through calling the function EMB.check_node_default, but adds an additional check on the data.

Checks

  • The TimeProfile of the field capacity in the type in the field charge is required to be non-negative if the chosen composite type has the field capacity.
  • The TimeProfile of the field capacity in the type in the field level is required to be non-negative`.
  • The TimeProfile of the field capacity in the type in the field discharge is required to be non-negative if the chosen composite type has the field capacity.
  • The TimeProfile of the field fixed_opex is required to be non-negative and accessible through a StrategicPeriod as outlined in the function [check_fixed_opex(n, 𝒯ᴵⁿᵛ, check_timeprofiles)] for the chosen composite type .
  • The values of the dictionary input are required to be non-negative.
  • The values of the dictionary output are required to be non-negative.
  • The value of the field heat_loss_factor is required to be in the range $[0, 1]$.
source
EnergyModelsBase.check_linkFunction
EMB.check_link(l::DHPipe, 𝒯,  modeltype::EnergyModel, check_timeprofiles::Bool)

This method checks that the DHPipe link is valid.

Checks

  • The field cap is required to be non-negative.
  • The field pipe_length is required to be non-negative.
  • The field pipe_loss_factor is required to be non-negative.
source

Field extraction methods

EnergyModelsBase.capacityFunction
capacity(l::DHPipe)
capacity(l::DHPipe, t)

Returns the capacity of a DHPipe l as TimeProfile or in operational period t.

source
EnergyModelsBase.inputsFunction
inputs(n::HeatPump)
inputs(n::HeatPump, p::Resource)

Returns the input resources of a HeatPump n, specified via the fields heat_in_resource and driving_force_resource.

If the resource p is specified, it returns a value of 1. This behaviour should in theory not occur.

source
EMB.inputs(l::DHPipe)

Return the resources transported into a given DHPipe l. This resource is in a standard DHPipe given by the function resource_heat.

source

Identification methods