Methods - EnergyModelsBase

Index

Extension methods

EnergyModelsBase.create_link — Function
EMB.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
EnergyModelsBase.variables_link — Function
EMB.variables_link(m, ℒˢᵘᵇ::Vector{<:DHPipe}, 𝒯, modeltype::EnergyModel)

Creates the following additional variable for ALL district heating pipe links:

  • dh_loss[l, t] is a continuous variable describing the heat los of DHPipe l operational period t.
source

Constraint methods

EnergyModelsBase.constraints_level_aux — Function
EMB.constraints_level_aux(m, n::AbstractTES, 𝒯, 𝒫, modeltype::EnergyModel)

Method for creating the Δ constraint for the level of a generic AbstractTES node. The default method returns nothing as the Δ constraint is implemented in constraints_level_iterate.

source
EnergyModelsBase.constraints_level_iterate — Function
EMB.constraints_level_iterate(
    m,
    n::AbstractTES,
    prev_pers::PreviousPeriods,
    cyclic_pers::CyclicPeriods,
    per,
    _::SimpleTimes,
    modeltype::EnergyModel,
)

In the case of an AbstractTES, the lowest level iterator is adjusted as the loss is dependent on the level at the beginning of the operational period. This also implies that the variable stor_level_Δ_op is calculated in this function, not constraints_level_aux.

source
EnergyModelsBase.constraints_capacity — Function
EMB.constraints_capacity(m, n::HeatPump, 𝒯::TimeStructure, modeltype::EnergyModel)

Method for creating the constraints on the maximum capacity of a HeatPump.

It adds in the addition to the constraints of the standard method the lower bound constraints.

source
EMB.constraints_capacity(
    m,
    n::BoundRateTES,
    𝒯::TimeStructure,
    modeltype::EnergyModel,
)

Method for creating the constraints on the maximum capacity of a BoundRateTES

It adjusts the constraints on the capacity of a BoundRateTES to account for the maximum charge and discharge rates in relation to the installed storage level.

source
EnergyModelsBase.constraints_flow_in — Function
EMB.constraints_flow_in(m, n::HeatPump, 𝒯::TimeStructure, modeltype::EnergyModel)

Method for creating the constraint on the inlet flow to a HeatPump.

It is utlizing the specified temperature levels, heat_in_resource and driving_force_resource for calculating the values.

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

Method for creating the constraint on the inlet flow to a 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. The capacity is linked to the power consumption.

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

Method for creating the constraint on the outlet flow from a HeatExchanger.

The flow of available heat energy is calculated from the temperatures in the heat flows using the function dh_fraction.

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

Method for creating the constraint on the outlet flow 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

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_node — Function
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::AbstractTES{T}, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool) where {T<:StorageBehavior}

This method checks that nodes of the type AbstractTES are 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]$.

Warnings

  • The StorageBehavior should not be CyclicStrategic when using RepresentativePeriods.
source
EMB.check_node(n::BoundRateTES{T}, 𝒯, modeltype::EnergyModel, check_timeprofiles::Bool) where {T<:EMB.StorageBehavior}

This method checks that the BoundRateTES 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]$.
  • The value of the field level_discharge is required to be non-negative.
  • The value of the field level_charge is required to be non-negative.

Warnings

  • The StorageBehavior should not be CyclicStrategic when using RepresentativePeriods.
source
EnergyModelsBase.check_link — Function
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.capacity — Function
capacity(l::DHPipe)
capacity(l::DHPipe, t)

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

source
EnergyModelsBase.inputs — Function
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