Methods - Internal
Index
- EnergyModelsRenewableProducers.build_pq_constaints
- EnergyModelsRenewableProducers.capacity_max
- EnergyModelsRenewableProducers.capacity_reduction
- EnergyModelsRenewableProducers.check_battery_life
- EnergyModelsRenewableProducers.constraints_reserve
- EnergyModelsRenewableProducers.constraints_usage
- EnergyModelsRenewableProducers.constraints_usage_iterate
- EnergyModelsRenewableProducers.constraints_usage_sp
- EnergyModelsRenewableProducers.get_opex_pen_down
- EnergyModelsRenewableProducers.get_opex_pen_up
- EnergyModelsRenewableProducers.get_var_inst
- EnergyModelsRenewableProducers.get_var_pen_down
- EnergyModelsRenewableProducers.get_var_pen_up
- EnergyModelsRenewableProducers.get_var_schedule
- EnergyModelsRenewableProducers.has_degradation
- EnergyModelsRenewableProducers.has_penalty
- EnergyModelsRenewableProducers.has_penalty_down
- EnergyModelsRenewableProducers.has_penalty_up
- EnergyModelsRenewableProducers.is_active
- EnergyModelsRenewableProducers.is_constraint_data
- EnergyModelsRenewableProducers.is_constraint_resource
- EnergyModelsRenewableProducers.linear_reformulation
- EnergyModelsRenewableProducers.multiplication_variables
- EnergyModelsRenewableProducers.previous_usage
- EnergyModelsRenewableProducers.replace_disjunct
Constraint functions
EnergyModelsRenewableProducers.build_pq_constaints — Functionbuild_pq_constaints(m, n::HydroUnit, c::PqPoints, 𝒯::TimeStructure)Function for creating the constraints on the variables flow_out, cap_use, and discharge_segments as declared in the PqPoints pq of a HydroUnit node.
EnergyModelsRenewableProducers.constraints_usage — Functionconstraints_usage(m, n::AbstractBattery, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)Function for creating the usage constraints for an AbstractBattery. These constraints calculate the usage of the battery up to each time step for the lifetime calculations.
EnergyModelsRenewableProducers.constraints_usage_iterate — Functionconstraints_usage_iterate(
    m,
    n::AbstractBattery,
    prev_pers::PreviousPeriods,
    cyclic_pers::CyclicPeriods,
    t_inv::TS.AbstractStrategicPeriod,
    per,
    ts::RepresentativePeriods,
    modeltype::EnergyModel,
)Iterate through the individual time structures of an AbstractBattery node.
In the case of RepresentativePeriods, additional constraints are calculated for the usage of the battery in representative periods through introducing the variable bat_use_rp[𝒩, 𝒯ʳᵖ].
In the case of OperationalScenarios, we purely iterate through the individual time structures.
In the case of SimpleTimes, the iterator function is at its lowest level. In this situation,the previous usage is calculated using the function previous_usage. The approach for calculating the constraints is depending on the types in the parameteric type EMB.PreviousPeriods.
EnergyModelsRenewableProducers.constraints_usage_sp — Functionconstraints_usage_sp(
    m,
    n::AbstractBattery,
    prev_pers::PreviousPeriods,
    t_inv::TS.AbstractStrategicPeriod,
    modeltype::EnergyModel,
)Function for creating the constraints on the previous usage of an AbstractBattery before the beginning of a strategic period.
In the case of the first strategic period, it fixes the variable bat_prev_use_sp to 0. In all subsequent strategic periods, the previous usage is calculated.
EnergyModelsRenewableProducers.constraints_reserve — Functionconstraints_reserve(m, n::AbstractBattery, 𝒯::TimeStructure, modeltype::EnergyModel)
constraints_reserve(m, n::ReserveBattery, 𝒯::TimeStructure, modeltype::EnergyModel)Function for creating the additional constraints on the capacity utilization to account for providing reserve capacity to the system.
Identification functions
EnergyModelsRenewableProducers.is_constraint_data — Functionis_constraint_data(data::Data)
is_constraint_data(data::ScheduleConstraint)Returns true if Data input is of type ScheduleConstraint, otherwise false.
EnergyModelsRenewableProducers.is_constraint_resource — Functionis_constraint_resource(data::ScheduleConstraint, p::Resource)Returns true if Data is of type ScheduleConstraint and ScheduleConstraint resource type is p.
EnergyModelsRenewableProducers.is_active — Functionis_active(data::ScheduleConstraint, t)Returns true if given constraint data is active at operational period t.
EnergyModelsRenewableProducers.has_penalty — Functionhas_penalty(data::ScheduleConstraint, t)Returns true if a constraint needs a penalty variable at operational period t.
EnergyModelsRenewableProducers.has_penalty_up — Functionhas_penalty_up(data::ScheduleConstraint)
has_penalty_up(data::ScheduleConstraint, t)
has_penalty_up(data::ScheduleConstraint, t, p::Resource)Returns true if a constraint data is of a type that may require a penalty up variable, which is true for MinSchedule and EqualSchedule.
When the operational period t is provided in addition, it is furthermore necessary that the penalty is finite.
When the operational period t and the resource p is provided in addition, it is furthermore necessary that the penalty is finite and that p corresponds to the ScheduleConstraint resource.
EnergyModelsRenewableProducers.has_penalty_down — Functionhas_penalty_down(data::ScheduleConstraint)
has_penalty_down(data::ScheduleConstraint, t)
has_penalty_down(data::ScheduleConstraint, t, resource::Resource)Returns true if a constraint data is of a type that may require a penalty up down, which is true for MaxSchedule and EqualSchedule.
When the operational period t is provided in addition, it is furthermore necessary that the penalty is finite.
When the operational period t and the resource p is provided in addition, it is furthermore necessary that the penalty is finite and that p corresponds to the ScheduleConstraint resource.
EnergyModelsRenewableProducers.has_degradation — Functionhas_degradation(n::AbstractBattery)Returns logic whether the AbstractBattery includes degradation of the battery and replacement options for the battery.
Check functions
EnergyModelsRenewableProducers.check_battery_life — Functioncheckbatterylife(n::AbstractBattery, batlife::AbstractBatteryLife, 𝒯, modeltype::EnergyModel, checktimeprofiles::Bool) checkbatterylife(n::AbstractBattery, batlife::CycleLife, 𝒯, modeltype::EnergyModel, checktimeprofiles::Bool)
Check that the included AbstractBatteryLife types of an AbstractBattery follows to the
Checks AbstractBatteryLife
- None.
Checks CycleLife
- All fields must be positive.
- The value of the field degradationmust be smaller than 1.
- The value of the field stack_costis required to be accessible through aStrategicPeriodas outlined in the functionEMB.check_fixed_opex.
Utility functions
EnergyModelsRenewableProducers.capacity_max — Functioncapacity_max(n::AbstractBattery, t_inv, modeltype::EnergyModel)Function for calculating the maximum capacity, including the number of cycles.
modeltype::EnergyModelWhen the modeltype is an EnergyModel, it returns the muliplication of the installed storage level capacity and the number of cycles before the stack must be replaced.
modeltype::AbstractInvestmentModelWhen the modeltype is an AbstractInvestmentModel, it returns the muliplication of the maximum installed storage level capacity and the number of cycles before the stack must be replaced.
If the AbstractBattery node does not have investments, it reuses the default function.
EnergyModelsRenewableProducers.linear_reformulation — Functionlinear_reformulation(
    m,
    𝒯,
    var_binary,
    var_continuous,
    lb::TimeProfile,
    ub::TimeProfile,
)Linear reformulation of the element-wise multiplication of the binary variable var_binary[𝒯] and the continuous variable var_continuous[𝒯] ∈ [ub, lb].
It returns the product var_aux[𝒯] with
$var\_aux[t] = var\_binary[t] \times var\_continuous[t]$.
EnergyModelsRenewableProducers.multiplication_variables — Functionmultiplication_variables(
    m,
    n::AbstractBattery,
    𝒯ᴵⁿᵛ,
    modeltype::EnergyModel
)Function for calculating the muliplication of the capacity of an AbstractBattery and the binary variable :bat_stack_replace_b.
modeltype::EnergyModelMultiplication of the installed capacity (expressed through capacity(level(n), t_inv)) and the binary variable bat_stack_replace_b in a strategic period t_inv.
Returns
- prod[t]: Multiplication of- capacity(level(n), t_inv)and- bat_stack_replace_b[n, t_inv].
modeltype::AbstractInvestmentModelWhen the modeltype is an AbstractInvestmentModel, then the function applies a linear reformulation of the binary-continuous multiplication based on the McCormick relaxation and the function linear_reformulation.
If the AbstractBattery node does not have investments, it reuses the default function to avoid increasing the number of variables in the model.
Returns
- prod[t]: Multiplication of- cap_inst[n, t]and- var_b[t]or alternatively- cap_current[n, t]and- var_b[t], if the TimeStructure is a- StrategicPeriodsand the node- nhas investments.
EnergyModelsRenewableProducers.previous_usage — Functionprevious_usage(
    m,
    n::AbstractBattery,
    t_inv::TS.AbstractStrategicPeriod,
    prev_pers::PreviousPeriods,
    modeltype::EnergyModel,
)Returns the previous usage of an AbstractBattery node depending on the type of PreviousPeriods.
The basic functionality is used in the case when the previous operational period is a TimePeriod, in which case it just returns the previous operational period.
When the previous operational and representative periods are Nothing, the variable bat_prev_use_sp is used for the initial usage in a strategic period
When the previous operational period is Nothing and the previous representative period an AbstractRepresentativePeriod then the time structure does include RepresentativePeriods.
The constraint then sums up the values from the previous representative period.
EnergyModelsRenewableProducers.capacity_reduction — Functioncapacity_reduction(
    m,
    n::AbstractBattery,
    bat_life::AbstractBatteryLife,
    𝒯::TimeStructure,
    modeltype::EnergyModel,
)Returns the reduction in the storage capacity of an AbstractBattery depending once on the chosen AbstractBatteryLife.
Returns the reduction in storage level capacity as linear multiplier of the charge usage of the Battery through the fields cycles and degradation of the CycleLife.
EnergyModelsRenewableProducers.replace_disjunct — Functionreplace_disjunct(
    m,
    n::AbstractBattery,
    bat_life::AbstractBatteryLife,
    prev_pers::PreviousPeriods,
    t_inv::TS.AbstractStrategicPeriod,
    modeltype::EnergyModel,
)Function for dispatching no the different type of battery lifes for incorporation of the preivous usage constraints in the first operational period (of the first representative period) of a strategic period.
EnergyModelsRenewableProducers.get_opex_pen_up — Functionget_opex_pen_up(m, n::HydroNode, sched_data::Vector{<:ScheduleConstraint}, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)
get_opex_pen_up(m, n::HydroNode, sched_data::Vector{<:ExtensionData}, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)Returns the contribution of HydroNode n for the minimum or equality penalty violation to the variable OPEX.
EnergyModelsRenewableProducers.get_opex_pen_down — Functionget_opex_pen_down(m, n::HydroNode, sched_data::Vector{<:ScheduleConstraint}, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)
get_opex_pen_down(m, n::HydroNode, sched_data::Vector{<:ExtensionData}, 𝒯ᴵⁿᵛ, modeltype::EnergyModel)Returns the contribution of HydroNode n for the maximum or equality penalty violation to the variable OPEX for each investment period t_inv.
Variable extraction functions
EnergyModelsRenewableProducers.get_var_inst — Functionget_var_inst(m, n::HydroReservoir, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_inst(m, n::HydroGate, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_inst(m, n::HydroUnit, 𝒯::TimeStructure, data::ScheduleConstraint)Extracts the installed capacity variable used in scheduling constraints. The variables are
- n::HydroReservoir-- :stor_level_inst[n, :],
- n::HydroGate-- :cap_inst[n, :], and
- n::HydroUnit-- :cap_inst[n, :]multiplied by the value for the node of the function- max_normalized_flowor- max_normalized_power.
EnergyModelsRenewableProducers.get_var_schedule — Functionget_var_schedule(m, n::HydroReservoir, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_schedule(m, n::HydroGate, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_schedule(m, n::HydroPump, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_schedule(m, n::HydroGenerator, 𝒯::TimeStructure, data::ScheduleConstraint)Extracts the variable for which scheduling constraints are included. The variables are
- n::HydroReservoir-- :stor_level[n, :],
- n::HydroGate-- :flow_out[n, :, n.resource],
- n::HydroPump-- :flow_in[n, :, resource(data)], and
- n::HydroGenerator-- :flow_out[n, :, resource(data)].
EnergyModelsRenewableProducers.get_var_pen_up — Functionget_var_pen_up(m, n::HydroReservoir, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_pen_up(m, n::HydroGate, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_pen_up(m, n::HydroUnit, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_pen_up(m, n::HydroReservoir, t::TS.TimePeriod, data::ScheduleConstraint)
get_var_pen_up(m, n::HydroGate, t::TS.TimePeriod, data::ScheduleConstraint)
get_var_pen_up(m, n::HydroUnit, t::TS.TimePeriod, data::ScheduleConstraint)Extracts the variable for which scheduling constraints are included indexed over the TimeStructure or in operational period t. The variables are
- n::HydroReservoir-- :rsv_penalty_up[n, :, storage_resource(n)],
- n::HydroGate-- :gate_penalty_up[n, :, n.resource], and
- n::HydroUnit-- :gen_penalty_up[n, :, resource(data)].
EnergyModelsRenewableProducers.get_var_pen_down — Functionget_var_pen_down(m, n::HydroReservoir, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_pen_down(m, n::HydroGate, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_pen_down(m, n::HydroUnit, 𝒯::TimeStructure, data::ScheduleConstraint)
get_var_pen_down(m, n::HydroReservoir, t::TS.TimePeriod, data::ScheduleConstraint)
get_var_pen_down(m, n::HydroGate, t::TS.TimePeriod, data::ScheduleConstraint)
get_var_pen_down(m, n::HydroUnit, t::TS.TimePeriod, data::ScheduleConstraint)Extracts the variable for which scheduling constraints are included indexed over the TimeStructure or in operational period t. The variables are
- n::HydroReservoir-- :rsv_penalty_down[n, :, storage_resource(n)],
- n::HydroGate-- :gate_penalty_down[n, :, n.resource], and
- n::HydroUnit-- :gen_penalty_down[n, :, resource(data)].