Internal API

PowerSimulations.OperationModelType

Abstract type for Decision Model and Emulation Model. OperationModel structs are parameterized with DecisionProblem or Emulation Problem structs

source
InfrastructureSystems.Optimization.read_results_with_keysMethod
read_results_with_keys(
    res::PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults},
    result_keys::Vector{<:InfrastructureSystems.Optimization.OptimizationContainerKey};
    start_time,
    len,
    cols
) -> Dict{InfrastructureSystems.Optimization.OptimizationContainerKey, DataFrames.DataFrame}

High-level function to read a DataFrame of results.

Arguments

  • res: the results to read.
  • result_keys::Vector{<:OptimizationContainerKey}: the keys to read. Output will be a Dict{OptimizationContainerKey, DataFrame} with these as the keys
  • start_time::Union{Nothing, Dates.DateTime} = nothing: the time at which the resulting time series should begin; nothing indicates the first time in the results
  • len::Union{Int, Nothing} = nothing: the number of steps in the resulting time series; nothing indicates up to the end of the results
  • cols::Union{Colon, Vector{String}} = (:): which columns to fetch; defaults to :, i.e., all the columns
source
PowerSimulations._add_pwl_constraint!Method
_add_pwl_constraint!(
    container::PowerSimulations.OptimizationContainer,
    component::Component,
    _::InfrastructureSystems.Optimization.VariableType,
    break_points::Vector{Float64},
    period::Int64
)

Implement the constraints for PWL Block Offer variables. That is:

\[\sum_{k\in\mathcal{K}} \delta_{k,t} = p_t \\ \sum_{k\in\mathcal{K}} \delta_{k,t} <= P_{k+1,t}^{max} - P_{k,t}^{max}\]

source
PowerSimulations._add_pwl_constraint!Method
_add_pwl_constraint!(
    container::PowerSimulations.OptimizationContainer,
    component::Component,
    _::InfrastructureSystems.Optimization.VariableType,
    break_points::Vector{Float64},
    sos_status::PowerSimulations.SOSStatusVariableModule.SOSStatusVariable,
    period::Int64
)

Implement the constraints for PWL variables. That is:

\[\sum_{k\in\mathcal{K}} P_k^{max} \delta_{k,t} = p_t \\ \sum_{k\in\mathcal{K}} \delta_{k,t} = on_t\]

source
PowerSimulations._add_pwl_constraint!Method
_add_pwl_constraint!(
    container::PowerSimulations.OptimizationContainer,
    component::Component,
    _::PowerAboveMinimumVariable,
    break_points::Vector{Float64},
    sos_status::PowerSimulations.SOSStatusVariableModule.SOSStatusVariable,
    period::Int64
)

Implement the constraints for PWL variables for Compact form. That is:

\[\sum_{k\in\mathcal{K}} P_k^{max} \delta_{k,t} = p_t + P_min * u_t \\ \sum_{k\in\mathcal{K}} \delta_{k,t} = on_t\]

source
PowerSimulations._add_pwl_constraint!Method
_add_pwl_constraint!(
    container::PowerSimulations.OptimizationContainer,
    component::ReserveDemandCurve,
    _::ServiceRequirementVariable,
    break_points::Vector{Float64},
    sos_status::PowerSimulations.SOSStatusVariableModule.SOSStatusVariable,
    period::Int64
)

Implement the constraints for PWL Block Offer variables for ORDC. That is:

\[\sum_{k\in\mathcal{K}} \delta_{k,t} = p_t \\ \sum_{k\in\mathcal{K}} \delta_{k,t} <= P_{k+1,t}^{max} - P_{k,t}^{max}\]

source
PowerSimulations._add_pwl_sos_constraint!Method
_add_pwl_sos_constraint!(
    container::PowerSimulations.OptimizationContainer,
    component::Component,
    _::InfrastructureSystems.Optimization.VariableType,
    break_points::Vector{Float64},
    sos_status::PowerSimulations.SOSStatusVariableModule.SOSStatusVariable,
    period::Int64
)

Implement the SOS for PWL variables. That is:

\[\{\delta_{i,t}, ..., \delta_{k,t}\} \in \text{SOS}_2\]

source
PowerSimulations._add_pwl_term!Method
_add_pwl_term!(
    container::PowerSimulations.OptimizationContainer,
    component::Component,
    cost_function::MarketBidCost,
    _::CostCurve{PiecewiseIncrementalCurve},
    _::InfrastructureSystems.Optimization.VariableType,
    _::PowerSimulations.AbstractDeviceFormulation
) -> Vector{JuMP.AffExpr}

Add PWL cost terms for data coming from the MarketBidCost with a fixed incremental offer curve

source
PowerSimulations._add_pwl_term!Method
_add_pwl_term!(
    container::PowerSimulations.OptimizationContainer,
    component::Component,
    cost_function::Union{CostCurve{PiecewisePointCurve}, FuelCurve{PiecewisePointCurve}},
    _::InfrastructureSystems.Optimization.VariableType,
    _::PowerSimulations.AbstractDeviceFormulation
) -> Vector{JuMP.AffExpr}

Add PWL cost terms for data coming from a PiecewisePointCurve

source
PowerSimulations._add_pwl_term!Method
_add_pwl_term!(
    container::PowerSimulations.OptimizationContainer,
    component::ThermalGen,
    cost_function::Union{CostCurve{PiecewisePointCurve}, FuelCurve{PiecewisePointCurve}},
    _::InfrastructureSystems.Optimization.VariableType,
    _::ThermalDispatchNoMin
) -> Vector{JuMP.AffExpr}

Add PWL cost terms for data coming from a PiecewisePointCurve for ThermalDispatchNoMin formulation

source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::CostCurve{LinearCurve},
    _::PowerSimulations.AbstractDeviceFormulation
)

Adds to the cost function cost terms for sum of variables with common factor to be used for cost expression for optimization_container model.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_component::PSY.CostCurve{PSY.LinearCurve} : container for cost to be associated with variable
source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::CostCurve{PiecewisePointCurve},
    _::PowerSimulations.AbstractDeviceFormulation
)

Creates piecewise linear cost function using a sum of variables and expression with sign and time step included.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_function::PSY.CostCurve{PSY.PiecewisePointCurve}: container for piecewise linear cost
source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::CostCurve{QuadraticCurve},
    _::PowerSimulations.AbstractDeviceFormulation
)

Adds to the cost function cost terms for sum of variables with common factor to be used for cost expression for optimization_container model.

Equation

gen_cost = dt*sign*(sum(variable.^2)*cost_data[1] + sum(variable)*cost_data[2])

LaTeX

$cost = dt\times sign (sum_{i\in I} c_1 v_i^2 + sum_{i\in I} c_2 v_i )$

for quadratic factor large enough. If the first term of the quadratic objective is 0.0, adds a linear cost term sum(variable)*cost_data[2]

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_component::PSY.CostCurve{PSY.QuadraticCurve} : container for quadratic factors
source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::FuelCurve{LinearCurve},
    _::PowerSimulations.AbstractDeviceFormulation
)

Adds to the cost function cost terms for sum of variables with common factor to be used for cost expression for optimization_container model.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_component::PSY.FuelCurve{PSY.LinearCurve} : container for cost to be associated with variable
source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::FuelCurve{PiecewisePointCurve},
    _::PowerSimulations.AbstractDeviceFormulation
)

Creates piecewise linear cost function using a sum of variables and expression with sign and time step included.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_function::PSY.CostCurve{PSY.PiecewisePointCurve}: container for piecewise linear cost
source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::FuelCurve{QuadraticCurve},
    _::PowerSimulations.AbstractDeviceFormulation
)

Adds to the cost function cost terms for sum of variables with common factor to be used for cost expression for optimization_container model.

Equation

gen_cost = dt*(sum(variable.^2)*cost_data[1]*fuel_cost + sum(variable)*cost_data[2]*fuel_cost)

LaTeX

$cost = dt\times (sum_{i\in I} c_f c_1 v_i^2 + sum_{i\in I} c_f c_2 v_i )$

for quadratic factor large enough. If the first term of the quadratic objective is 0.0, adds a linear cost term sum(variable)*cost_data[2]

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_component::PSY.FuelCurve{PSY.QuadraticCurve} : container for quadratic factors
source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::MarketBidCost,
    _::PowerSimulations.AbstractDeviceFormulation
)

Creates piecewise linear market bid function using a sum of variables and expression for market participants. Decremental offers are not accepted for most components, except Storage systems and loads.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_function::MarketBidCost : container for market bid cost
source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::Union{CostCurve{PiecewiseAverageCurve}, CostCurve{PiecewiseIncrementalCurve}},
    _::PowerSimulations.AbstractDeviceFormulation
)

Creates piecewise linear cost function using a sum of variables and expression with sign and time step included.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_function::PSY.Union{PSY.CostCurve{PSY.PiecewiseIncrementalCurve}, PSY.CostCurve{PSY.PiecewiseAverageCurve}}: container for piecewise linear cost
source
PowerSimulations._add_variable_cost_to_objective!Method
_add_variable_cost_to_objective!(
    container::PowerSimulations.OptimizationContainer,
    _::InfrastructureSystems.Optimization.VariableType,
    component::Component,
    cost_function::Union{FuelCurve{PiecewiseAverageCurve}, FuelCurve{PiecewiseIncrementalCurve}},
    _::PowerSimulations.AbstractDeviceFormulation
)

Creates piecewise linear fuel cost function using a sum of variables and expression with sign and time step included.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • var_key::VariableKey: The variable name
  • componentname::String: The componentname of the variable container
  • cost_function::PSY.Union{PSY.FuelCurve{PSY.PiecewiseIncrementalCurve}, PSY.FuelCurve{PSY.PiecewiseAverageCurve}}: container for piecewise linear cost
source
PowerSimulations._allocate_execution_orderMethod
_allocate_execution_order(
    interval_run_counts::Vector{Int64}
) -> Vector{Int64}

Function calculates the total number of problem executions in the simulation and allocates the appropiate vector

source
PowerSimulations._calculate_interval_inner_countsMethod
_calculate_interval_inner_counts(
    intervals::OrderedDict{Symbol, Dates.Millisecond}
) -> Vector{Int64}

calculateintervalinnercounts(intervals::OrderedDict{String,<:Dates.TimePeriod})

Calculates how many times a problem is executed for every interval of the previous problem

source
PowerSimulations._create_time_series_multiplier_indexMethod
_create_time_series_multiplier_index(
    model,
    _::Type{T<:InfrastructureSystems.Optimization.TimeSeriesParameter}
) -> Union{Nothing, Int64}

Function to create a unique index of time series names for each device model. For example, if two parameters each reference the same time series name, this function will return a different value for each parameter entry

source
PowerSimulations._get_data_for_tdcMethod
_get_data_for_tdc(
    initial_conditions_on::Array{T<:InitialCondition, 1},
    initial_conditions_off::Array{U<:InitialCondition, 1},
    resolution::Dates.TimePeriod
) -> Tuple{Matrix{InitialCondition}, Vector{@NamedTuple{up::Float64, down::Float64}}}

If the fraction of hours that a generator has a duration constraint is less than the fraction of hours that a single time_step represents then it is not binding.

source
PowerSimulations._get_initial_condition_typeMethod
_get_initial_condition_type(
    _::Type{RampConstraint},
    _::Type{<:ThermalGen},
    _::Type{<:PowerSimulations.AbstractThermalFormulation}
) -> Type{PowerSimulations.DeviceAboveMinPower}

This function gets the data for the generators for ramping constraints of thermal generators

source
PowerSimulations._get_pwl_cost_expressionMethod
_get_pwl_cost_expression(
    container::PowerSimulations.OptimizationContainer,
    component::ReserveDemandCurve,
    time_period::Int64,
    cost_data::PiecewiseStepData,
    multiplier::Float64
) -> JuMP.AffExpr

Get cost expression for StepwiseCostReserve

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{NetworkFlowConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{B<:ACBranch},
    model::DeviceModel{B<:ACBranch, <:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{<:PowerSimulations.AbstractPTDFModel}
)

Add network flow constraints for ACBranch and NetworkModel with <: AbstractPTDFModel

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{RequirementConstraint},
    service::ConstantReserveGroup,
    contributing_services::Vector{<:Service},
    model::ServiceModel{SR<:ConstantReserveGroup, GroupReserve}
)

This function creates the requirement constraint that will be attained by the appropriate services

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    cons_type::Type{RateLimitConstraintFromTo},
    devices::InfrastructureSystems.FlattenIteratorWrapper{B<:ACBranch},
    device_model::DeviceModel{B<:ACBranch, <:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{T<:PowerModels.AbstractPowerModel}
)

Add rate limit from to constraints for ACBranch with AbstractPowerModel

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    cons_type::Type{RateLimitConstraintToFrom},
    devices::InfrastructureSystems.FlattenIteratorWrapper{B<:ACBranch},
    _::DeviceModel{B<:ACBranch, <:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{T<:PowerModels.AbstractPowerModel}
)

Add rate limit to from constraints for ACBranch with AbstractPowerModel

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{FlowLimitConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{AreaInterchange},
    model::DeviceModel{AreaInterchange, StaticBranch},
    _::NetworkModel{T<:PowerModels.AbstractActivePowerModel}
)

Add flow constraints for area interchanges

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{NetworkFlowConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:PhaseShiftingTransformer},
    model::DeviceModel{T<:PhaseShiftingTransformer, PhaseAngleControl},
    network_model::NetworkModel{<:PowerSimulations.AbstractPTDFModel}
)

Add network flow constraints for PhaseShiftingTransformer and NetworkModel with <: AbstractPTDFModel

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{NetworkFlowConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:PhaseShiftingTransformer},
    model::DeviceModel{T<:PhaseShiftingTransformer, PhaseAngleControl},
    _::NetworkModel{DCPPowerModel}
)

Add network flow constraints for PhaseShiftingTransformer and NetworkModel with PM.DCPPowerModel

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{StartTypeConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:ThermalMultiStart},
    model::DeviceModel{T<:ThermalMultiStart, ThermalMultiStartUnitCommitment},
    _::NetworkModel
)

Constructs contraints that restricts devices to one type of start at a time

Equations

sum(var_starts[name, s, t] for s in starts) = var_start[name, t]

LaTeX

$\sum^{S_g}_{s=1} δ^{s}(t) \eq x^{start}(t)$

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{StartupInitialConditionConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:ThermalMultiStart},
    model::DeviceModel{T<:ThermalMultiStart, ThermalMultiStartUnitCommitment},
    _::NetworkModel
)

Constructs contraints that restricts devices to one type of start at a time

Equations

ub: (time_limits[st+1]-1)*δ^{s}(t) + (1 - δ^{s}(t)) * M_VALUE >= sum(1-varbin[name, i]) for i in 1:t) + initial_condition_offtime lb: (time_limits[st]-1)*δ^{s}(t) =< sum(1-varbin[name, i]) for i in 1:t) + initial_condition_offtime

LaTeX

$TS^{s+1}_{g} δ^{s}(t) + (1-δ^{s}(t)) M_VALUE \geq \sum^{t}_{i=1} x^{status}(i) + DT_{g}^{0} \forall t in \{1, \ldots, TS^{s+1}_{g}$

$TS^{s}_{g} δ^{s}(t) \leq \sum^{t}_{i=1} x^{status}(i) + DT_{g}^{0} \forall t in \{1, \ldots, TS^{s+1}_{g}$

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{StartupTimeLimitTemperatureConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:ThermalMultiStart},
    model::DeviceModel{T<:ThermalMultiStart, ThermalMultiStartUnitCommitment},
    _::NetworkModel
)

Constructs contraints for different types of starts based on generator down-time

Equations

for t in time_limits[s+1]:T

var_starts[name, s, t] <= sum( var_stop[name, t-i] for i in time_limits[s]:(time_limits[s+1]-1)

LaTeX

$δ^{s}(t) \leq \sum_{i=TS^{s}_{g}}^{TS^{s+1}_{g}} x^{stop}(t-i)$

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{PhaseAngleControlLimit},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:PhaseShiftingTransformer},
    model::DeviceModel{T<:PhaseShiftingTransformer, PhaseAngleControl},
    _::NetworkModel{U<:PowerModels.AbstractActivePowerModel}
)

Add phase angle limits for phase shifters

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{FlowLimitConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:Union{MonitoredLine, PhaseShiftingTransformer}},
    model::DeviceModel{T<:Union{MonitoredLine, PhaseShiftingTransformer}, U<:PowerSimulations.AbstractBranchFormulation},
    _::NetworkModel{V<:PowerModels.AbstractDCPModel}
)

Add branch flow constraints for monitored lines with DC Power Model

source
PowerSimulations.add_constraints!Method
add_constraints!(
    _::PowerSimulations.OptimizationContainer,
    _::Type{FlowLimitToFromConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:MonitoredLine},
    model::DeviceModel{T<:MonitoredLine, U<:StaticBranchUnbounded},
    _::NetworkModel{V<:PowerModels.AbstractActivePowerModel}
)

Don't add branch flow constraints for monitored lines if formulation is StaticBranchUnbounded

source
PowerSimulations.add_constraints!Method
add_constraints!(
    _::PowerSimulations.OptimizationContainer,
    _::Type{RateLimitConstraintFromTo},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:MonitoredLine},
    model::DeviceModel{T<:MonitoredLine, U<:StaticBranchUnbounded},
    _::NetworkModel{V<:PowerModels.AbstractActivePowerModel}
)

Don't add branch flow constraints for monitored lines if formulation is StaticBranchUnbounded

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    cons_type::Type{RateLimitConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:ACBranch},
    device_model::DeviceModel{T<:ACBranch, U<:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{V<:PowerModels.AbstractActivePowerModel}
)

Add branch rate limit constraints for ACBranch with AbstractActivePowerModel

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    T::Type{RampConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{U<:ThermalGen},
    model::DeviceModel{U<:ThermalGen, V<:PowerSimulations.AbstractThermalUnitCommitment},
    _::NetworkModel{W<:PowerModels.AbstractPowerModel}
)

This function adds the ramping limits of generators when there are CommitmentVariables

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    T::Type{<:ActivePowerVariableLimitsConstraint},
    U::Type{<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ThermalMultiStart},
    _::DeviceModel{V<:ThermalMultiStart, W<:ThermalMultiStartUnitCommitment},
    _::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

This function adds range constraint for the first time period. Constraint (10) from PGLIB formulation

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    T::Type{<:PowerSimulations.PowerVariableLimitsConstraint},
    U::Type{<:Union{InfrastructureSystems.Optimization.ExpressionType, InfrastructureSystems.Optimization.VariableType}},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ThermalGen},
    model::DeviceModel{V<:ThermalGen, W<:PowerSimulations.AbstractThermalDispatchFormulation},
    _::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Semicontinuous range constraints for thermal dispatch formulations

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    T::Type{<:PowerSimulations.PowerVariableLimitsConstraint},
    U::Type{<:Union{InfrastructureSystems.Optimization.ExpressionType, InfrastructureSystems.Optimization.VariableType}},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ThermalGen},
    model::DeviceModel{V<:ThermalGen, W<:PowerSimulations.AbstractThermalUnitCommitment},
    _::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Semicontinuous range constraints for unit commitment formulations

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    T::Type{<:PowerSimulations.PowerVariableLimitsConstraint},
    U::Type{<:Union{PowerAboveMinimumVariable, InfrastructureSystems.Optimization.ExpressionType}},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ThermalGen},
    model::DeviceModel{V<:ThermalGen, W<:ThermalCompactDispatch},
    network_model::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Range constraints for thermal compact dispatch

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    T::Type{<:ReactivePowerVariableLimitsConstraint},
    U::Type{<:ReactivePowerVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ElectricLoad},
    _::DeviceModel{V<:ElectricLoad, W<:PowerSimulations.AbstractControllablePowerLoadFormulation},
    network_model::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Reactive Power Constraints on Controllable Loads Assume Constant power_factor

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{<:ReactivePowerVariableLimitsConstraint},
    _::Type{<:ReactivePowerVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:RenewableGen},
    _::DeviceModel{V<:RenewableGen, W<:RenewableConstantPowerFactor},
    _::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Reactive Power Constraints on Renewable Gen Constant power_factor

source
PowerSimulations.add_feedforward_constraints!Method
add_feedforward_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::DeviceModel,
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:Component},
    ff::UpperBoundFeedforward
)
    ub_ff(container::OptimizationContainer,
          cons_name::Symbol,
          constraint_infos,
          param_reference,
          var_key::VariableKey)

Constructs a parameterized upper bound constraint to implement feedforward from other models. The Parameters are initialized using the uppper boundary values of the provided variables.

variable[var_name, t] <= param_reference[var_name]

LaTeX

$x \leq param^{max}$

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • cons_name::Symbol : name of the constraint
  • param_reference : Reference to the JuMP.VariableRef used to determine the upperbound
  • var_key::VariableKey : the name of the continuous variable
source
PowerSimulations.add_feedforward_constraints!Method
add_feedforward_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::DeviceModel,
    devices::Union{Array{T<:Component, 1}, InfrastructureSystems.FlattenIteratorWrapper{T<:Component}},
    ff::FixValueFeedforward
)
    add_feedforward_constraints(
        container::OptimizationContainer,
        ::DeviceModel,
        devices::IS.FlattenIteratorWrapper{T},
        ff::FixValueFeedforward,
    ) where {T <: PSY.Component}

Constructs a equality constraint to a fix a variable in one model using the variable value from other model results.

variable[var_name, t] == param[var_name, t]

LaTeX

$x == param$

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • model::DeviceModel : the device model
  • devices::IS.FlattenIteratorWrapper{T} : list of devices
  • ff::FixValueFeedforward : a instance of the FixValue Feedforward
source
PowerSimulations.add_feedforward_constraints!Method
add_feedforward_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::DeviceModel{T<:Component, U<:PowerSimulations.AbstractDeviceFormulation},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:Component},
    ff::LowerBoundFeedforward
)
    lb_ff(container::OptimizationContainer,
          cons_name::Symbol,
          constraint_infos,
          param_reference,
          var_key::VariableKey)

Constructs a parameterized upper bound constraint to implement feedforward from other models. The Parameters are initialized using the uppper boundary values of the provided variables.

variable[var_name, t] <= param_reference[var_name]

LaTeX

$x \leq param^{max}$

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • cons_name::Symbol : name of the constraint
  • param_reference : Reference to the JuMP.VariableRef used to determine the upperbound
  • var_key::VariableKey : the name of the continuous variable
source
PowerSimulations.add_linear_ramp_constraints!Method
add_linear_ramp_constraints!(
    container::PowerSimulations.OptimizationContainer,
    T::Type{<:InfrastructureSystems.Optimization.ConstraintType},
    U::Type{S<:Union{ActivePowerVariable, PowerAboveMinimumVariable}},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Component},
    model::DeviceModel{V<:Component, W<:PowerSimulations.AbstractDeviceFormulation},
    _::Type{<:PowerModels.AbstractPowerModel}
)

Constructs allowed rate-of-change constraints from variables, initial condtions, and rate data.

If t = 1:

variable[name, 1] - initial_conditions[ix].value <= rate_data[1][ix].up

initial_conditions[ix].value - variable[name, 1] <= rate_data[1][ix].down

If t > 1:

variable[name, t] - variable[name, t-1] <= rate_data[1][ix].up

variable[name, t-1] - variable[name, t] <= rate_data[1][ix].down

LaTeX

$r^{down} \leq x_1 - x_{init} \leq r^{up}, \text{ for } t = 1$

$r^{down} \leq x_t - x_{t-1} \leq r^{up}, \forall t \geq 2$

source
PowerSimulations.add_range_constraints!Method
add_range_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:InfrastructureSystems.Optimization.ConstraintType},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Component},
    model::DeviceModel{V<:Component, W<:PowerSimulations.AbstractDeviceFormulation},
    _::Type{X<:PowerModels.AbstractPowerModel}
)

Constructs min/max range constraint from device variable.

If min and max within an epsilon width:

variable[name, t] == limits.max

Otherwise:

limits.min <= variable[name, t] <= limits.max

where limits in constraint_infos.

LaTeX

$x = limits^{max}, \text{ for } |limits^{max} - limits^{min}| < \varepsilon$

$limits^{min} \leq x \leq limits^{max}, \text{ otherwise }$

source
PowerSimulations.add_reserve_range_constraints!Method
add_reserve_range_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:InputActivePowerVariableLimitsConstraint},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Component},
    model::DeviceModel{V<:Component, W<:PowerSimulations.AbstractDeviceFormulation},
    _::Type{X<:PowerModels.AbstractPowerModel}
)

Constructs min/max range constraint from device variable and reservation decision variable.

varcts[name, t] <= limits.max * (1 - varbin[name, t])

varcts[name, t] >= limits.min * (1 - varbin[name, t])

where limits in constraint_infos.

LaTeX

$0 \leq x^{cts} \leq limits^{max} (1 - x^{bin}), \text{ for } limits^{min} = 0$

$limits^{min} (1 - x^{bin}) \leq x^{cts} \leq limits^{max} (1 - x^{bin}), \text{ otherwise }$

source
PowerSimulations.add_reserve_range_constraints!Method
add_reserve_range_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:Union{OutputActivePowerVariableLimitsConstraint, ReactivePowerVariableLimitsConstraint}},
    _::Type{U<:InfrastructureSystems.Optimization.ExpressionType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{W<:Component},
    model::DeviceModel{W<:Component, X<:PowerSimulations.AbstractDeviceFormulation},
    _::Type{Y<:PowerModels.AbstractPowerModel}
)

Constructs min/max range constraint from device variable and reservation decision variable.

varcts[name, t] <= limits.max * varbin[name, t]

varcts[name, t] >= limits.min * varbin[name, t]

where limits in constraint_infos.

LaTeX

$limits^{min} x^{bin} \leq x^{cts} \leq limits^{max} x^{bin},$

source
PowerSimulations.add_reserve_range_constraints!Method
add_reserve_range_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:Union{OutputActivePowerVariableLimitsConstraint, ReactivePowerVariableLimitsConstraint}},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{W<:Component},
    model::DeviceModel{W<:Component, X<:PowerSimulations.AbstractDeviceFormulation},
    _::Type{Y<:PowerModels.AbstractPowerModel}
)

Constructs min/max range constraint from device variable and reservation decision variable.

varcts[name, t] <= limits.max * varbin[name, t]

varcts[name, t] >= limits.min * varbin[name, t]

where limits in constraint_infos.

LaTeX

$limits^{min} x^{bin} \leq x^{cts} \leq limits^{max} x^{bin},$

source
PowerSimulations.add_result!Method
add_result!(
    cache::PowerSimulations.OptimizationOutputCache,
    timestamp::Dates.DateTime,
    array::Array{Float64},
    system_cache_is_full::Bool
) -> Int64

Add result to the cache.

source
PowerSimulations.add_semicontinuous_ramp_constraints!Method
add_semicontinuous_ramp_constraints!(
    container::PowerSimulations.OptimizationContainer,
    T::Type{<:InfrastructureSystems.Optimization.ConstraintType},
    U::Type{S<:Union{ActivePowerVariable, PowerAboveMinimumVariable}},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Component},
    _::DeviceModel{V<:Component, W<:PowerSimulations.AbstractDeviceFormulation},
    _::Type{<:PowerModels.AbstractPowerModel}
)

Constructs allowed rate-of-change constraints from variables, initial condtions, start/stop status, and rate data

Equations

If t = 1:

variable[name, 1] - initial_conditions[ix].value <= rate_data[1][ix].up + rate_data[2][ix].max*varstart[name, 1]

initial_conditions[ix].value - variable[name, 1] <= rate_data[1][ix].down + rate_data[2][ix].min*varstop[name, 1]

If t > 1:

variable[name, t] - variable[name, t-1] <= rate_data[1][ix].up + rate_data[2][ix].max*varstart[name, t]

variable[name, t-1] - variable[name, t] <= rate_data[1][ix].down + rate_data[2][ix].min*varstop[name, t]

LaTeX

$r^{down} + r^{min} x^{stop}_1 \leq x_1 - x_{init} \leq r^{up} + r^{max} x^{start}_1, \text{ for } t = 1$

$r^{down} + r^{min} x^{stop}_t \leq x_t - x_{t-1} \leq r^{up} + r^{max} x^{start}_t, \forall t \geq 2$

source
PowerSimulations.add_semicontinuous_range_constraints!Method
add_semicontinuous_range_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:InfrastructureSystems.Optimization.ConstraintType},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Component},
    model::DeviceModel{V<:Component, W<:PowerSimulations.AbstractDeviceFormulation},
    _::Type{X<:PowerModels.AbstractPowerModel}
)

Constructs min/max range constraint from device variable and on/off decision variable.

If device min = 0:

varcts[name, t] <= limits.max*varbin[name, t])

varcts[name, t] >= 0.0

Otherwise:

varcts[name, t] <= limits.max*varbin[name, t]

varcts[name, t] >= limits.min*varbin[name, t]

where limits in constraint_infos.

LaTeX

$0 \leq x^{cts} \leq limits^{max} x^{bin}, \text{ for } limits^{min} = 0$

$limits^{min} x^{bin} \leq x^{cts} \leq limits^{max} x^{bin}, \text{ otherwise }$

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:PhaseShifterAngle},
    devices::InfrastructureSystems.FlattenIteratorWrapper{PhaseShiftingTransformer},
    _::DeviceModel{PhaseShiftingTransformer, V<:PhaseAngleControl},
    network_model::NetworkModel{<:PowerSimulations.AbstractPTDFModel}
)

Implementation of addtoexpression! for lossless branch/network models

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ACBranch},
    _::DeviceModel{V<:ACBranch, W<:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{CopperPlatePowerModel}
)

Implementation of addtoexpression! for lossless branch/network models

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
    device_model::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{CopperPlatePowerModel}
)

Default implementation to add variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerToFromVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
    _::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.AbstractTwoTerminalDCLineFormulation},
    network_model::NetworkModel{PTDFPowerModel}
)

Default implementation to add branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ACBranch},
    _::DeviceModel{V<:ACBranch, W<:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{PTDFPowerModel}
)

Implementation of addtoexpression! for lossless branch/network models

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
    device_model::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{PTDFPowerModel}
)

Default implementation to add variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerFromToVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Branch},
    _::DeviceModel{V<:Branch, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Default implementation to add branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerFromToVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
    _::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.AbstractTwoTerminalDCLineFormulation},
    network_model::NetworkModel{X<:CopperPlatePowerModel}
)

Default implementation to add branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerFromToVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
    _::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.AbstractTwoTerminalDCLineFormulation},
    network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)

Default implementation to add branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerToFromVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ACBranch},
    _::DeviceModel{V<:ACBranch, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Default implementation to add branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerToFromVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
    _::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.AbstractTwoTerminalDCLineFormulation},
    network_model::NetworkModel{X<:CopperPlatePowerModel}
)

Default implementation to add branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:FlowActivePowerVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ACBranch},
    _::DeviceModel{V<:ACBranch, W<:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{X<:PowerModels.AbstractActivePowerModel}
)

Implementation of addtoexpression! for lossless branch/network models

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:HVDCLosses},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
    _::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:HVDCTwoTerminalDispatch},
    network_model::NetworkModel{X<:Union{CopperPlatePowerModel, PTDFPowerModel}}
)

Default implementation to add branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:PowerSimulations.HVDCActivePowerReceivedFromVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
    _::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.HVDCTwoTerminalPiecewiseLoss},
    network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)

PWL implementation to add FromTo branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:PowerSimulations.HVDCActivePowerReceivedToVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
    _::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.HVDCTwoTerminalPiecewiseLoss},
    network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)

PWL implementation to add FromTo branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:SystemBalanceExpressions},
    _::Type{U<:InfrastructureSystems.Optimization.TimeSeriesParameter},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Device},
    model::DeviceModel{V<:Device, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Default implementation to add parameters to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:SystemBalanceExpressions},
    _::Type{U<:InfrastructureSystems.Optimization.TimeSeriesParameter},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
    device_model::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{X<:CopperPlatePowerModel}
)

Default implementation to add parameters to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:SystemBalanceExpressions},
    _::Type{U<:InfrastructureSystems.Optimization.TimeSeriesParameter},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
    device_model::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)

Default implementation to add parameters to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:SystemBalanceExpressions},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
    _::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{X<:PowerModels.AbstractPowerModel}
)

Default implementation to add device variables to SystemBalanceExpressions

source
PowerSimulations.add_variable!Method
add_variable!(
    container::PowerSimulations.OptimizationContainer,
    variable_type::ServiceRequirementVariable,
    service::ReserveDemandCurve,
    formulation
)

Add variables for ServiceRequirementVariable for StepWiseCostReserve

source
PowerSimulations.add_variable!Method
add_variable!(
    container::PowerSimulations.OptimizationContainer,
    var_type::InfrastructureSystems.Optimization.AuxVariableType,
    devices::Union{Array{D<:Component, 1}, InfrastructureSystems.FlattenIteratorWrapper{D<:Component}},
    formulation
)

Default implementation of adding auxiliary variable to the model.

source
PowerSimulations.add_variable!Method
add_variable!(
    container::PowerSimulations.OptimizationContainer,
    variable_type::InfrastructureSystems.Optimization.VariableType,
    devices::Union{Array{D<:Component, 1}, InfrastructureSystems.FlattenIteratorWrapper{D<:Component}},
    formulation
)

Adds a variable to the optimization model and to the affine expressions contained in the optimization_container model according to the specified sign. Based on the inputs, the variable can be specified as binary.

Bounds

lb_value_function <= varstart[name, t] <= ub_value_function

If binary = true:

varstart[name, t] in {0,1}

LaTeX

$lb \ge x^{device}_t \le ub \forall t$

$x^{device}_t \in {0,1} \forall t iff \text{binary = true}$

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • devices : Vector or Iterator with the devices
  • var_key::VariableKey : Base Name for the variable
  • binary::Bool : Select if the variable is binary
  • expressionname::Symbol : Expressionname name stored in container.expressions to add the variable
  • sign::Float64 : sign of the addition of the variable to the expression_name. Default Value is 1.0

Accepted Keyword Arguments

  • ubvalue : Provides the function over device to obtain the value for a upperbound
  • lbvalue : Provides the function over device to obtain the value for a lowerbound. If the variable is meant to be positive define lb = x -> 0.0
  • initial_value : Provides the function over device to obtain the warm start value
source
PowerSimulations.add_variable!Method
add_variable!(
    container::PowerSimulations.OptimizationContainer,
    variable_type::Union{OnVariable, StartVariable, StopVariable},
    devices::Union{Array{D<:ThermalGen, 1}, InfrastructureSystems.FlattenIteratorWrapper{D<:ThermalGen}},
    formulation::PowerSimulations.AbstractThermalFormulation
)

Adds a variable to the optimization model for the OnVariable of Thermal Units

source
PowerSimulations.add_variables!Method
add_variables!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:InfrastructureSystems.Optimization.AuxVariableType},
    devices::Union{Array{U<:Component, 1}, InfrastructureSystems.FlattenIteratorWrapper{U<:Component}},
    formulation::Union{PowerSimulations.AbstractDeviceFormulation, PowerSimulations.AbstractServiceFormulation}
)

Add variables to the OptimizationContainer for any component.

source
PowerSimulations.add_variables!Method
add_variables!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:InfrastructureSystems.Optimization.VariableType},
    devices::Union{Array{U<:Component, 1}, InfrastructureSystems.FlattenIteratorWrapper{U<:Component}},
    formulation::Union{PowerSimulations.AbstractDeviceFormulation, PowerSimulations.AbstractServiceFormulation}
)

Add variables to the OptimizationContainer for any component.

source
PowerSimulations.add_variables!Method
add_variables!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:InfrastructureSystems.Optimization.VariableType},
    service::AbstractReserve,
    contributing_devices::Union{Array{V<:Component, 1}, InfrastructureSystems.FlattenIteratorWrapper{V<:Component}},
    formulation::PowerSimulations.AbstractReservesFormulation
)

Add variables to the OptimizationContainer for a service.

source
PowerSimulations.build_model!Method
build_model!(
    model::DecisionModel{<:PowerSimulations.DefaultDecisionProblem}
)

Default implementation of build method for Operational Problems for models conforming with DecisionProblem specification. Overload this function to implement a custom build method

source
PowerSimulations.build_model!Method
build_model!(model::EmulationModel)

Default implementation of build method for Emulation Problems for models conforming with DecisionProblem specification. Overload this function to implement a custom build method

source
PowerSimulations.check_file_integrityMethod
check_file_integrity(path::String)
check_file_integrity(path::String)

Checks the hash value for each file made with the file is written with the new hash_value to verify the file hasn't been tampered with since written

Arguments

  • path::String: this is the folder path that contains the results and the check.sha256 file
source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    model::DeviceModel{T<:ThermalGen, D<:PowerSimulations.AbstractStandardUnitCommitment},
    network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)

This function creates the arguments model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    model::DeviceModel{T<:ThermalGen, D<:PowerSimulations.AbstractStandardUnitCommitment},
    network_model::NetworkModel
)

This function creates the arguments for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    model::DeviceModel{T<:ThermalGen, ThermalBasicUnitCommitment},
    network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)

This function creates the arguments for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    model::DeviceModel{T<:ThermalGen, ThermalBasicUnitCommitment},
    network_model::NetworkModel
)

This function creates the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    model::DeviceModel{T<:ThermalGen, ThermalStandardDispatch},
    network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)

This function creates the arguments for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    model::DeviceModel{T<:ThermalGen, ThermalStandardDispatch},
    network_model::NetworkModel
)

This function creates the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ModelConstructStage,
    model::DeviceModel{T<:ThermalGen, <:PowerSimulations.AbstractStandardUnitCommitment},
    network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)

This function creates the constraints for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ModelConstructStage,
    model::DeviceModel{T<:ThermalGen, <:PowerSimulations.AbstractStandardUnitCommitment},
    network_model::NetworkModel
)

This function creates the constraints for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ModelConstructStage,
    model::DeviceModel{T<:ThermalGen, ThermalBasicUnitCommitment},
    network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)

This function creates the constraints for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ModelConstructStage,
    model::DeviceModel{T<:ThermalGen, ThermalBasicUnitCommitment},
    network_model::NetworkModel
)

This function creates the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ModelConstructStage,
    model::DeviceModel{T<:ThermalGen, ThermalStandardDispatch},
    network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)

This function creates the constraints for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ModelConstructStage,
    model::DeviceModel{T<:ThermalGen, ThermalStandardDispatch},
    network_model::NetworkModel
)

This function creates the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation

source
PowerSimulations.construct_service!Method
construct_service!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    model::ServiceModel{SR<:ConstantReserveGroup, GroupReserve},
    _::Dict{Symbol, DeviceModel},
    _::Set{<:DataType},
    _::NetworkModel
)
Constructs a service for ConstantReserveGroup.
source
PowerSimulations.container_specMethod
container_spec(
    _::Type{Float64},
    axs...
) -> JuMP.Containers.DenseAxisArray

Returns the correct container specification for the selected type of JuMP Model

source
PowerSimulations.container_specMethod
container_spec(
    _::Type{T},
    axs...
) -> JuMP.Containers.DenseAxisArray

Returns the correct container specification for the selected type of JuMP Model

source
PowerSimulations.device_duration_compact_retrospective!Method
device_duration_compact_retrospective!(
    container::PowerSimulations.OptimizationContainer,
    duration_data::Vector{@NamedTuple{up::Float64, down::Float64}},
    initial_duration::Matrix{InitialCondition},
    cons_type::InfrastructureSystems.Optimization.ConstraintType,
    var_types::Tuple{InfrastructureSystems.Optimization.VariableType, InfrastructureSystems.Optimization.VariableType, InfrastructureSystems.Optimization.VariableType},
    _::Type{T<:Component}
)

This formulation of the duration constraints adds over the start times looking backwards.

LaTeX

  • Minimum up-time constraint:

$\sum_{i=t-min(d_{min}^{up}, T)+ 1}^t x_i^{start} - x_t^{on} \leq 0$

for i in the set of time steps.

  • Minimum down-time constraint:

$\sum_{i=t-min(d_{min}^{down}, T) + 1}^t x_i^{stop} + x_t^{on} \leq 1$

for i in the set of time steps.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • duration_data::Vector{UpDown} : gives how many time steps variable needs to be up or down
  • initial_duration::Matrix{InitialCondition} : gives initial conditions for up (column 1) and down (column 2)
  • cons_name::Symbol : name of the constraint
  • var_keys::Tuple{VariableKey, VariableKey, VariableKey}) : names of the variables
  • : var_keys[1] : varon
  • : var_keys[2] : varstart
  • : var_keys[3] : varstop
source
PowerSimulations.device_duration_look_ahead!Method
device_duration_look_ahead!(
    container::PowerSimulations.OptimizationContainer,
    duration_data::Vector{@NamedTuple{up::Float64, down::Float64}},
    initial_duration::Matrix{InitialCondition},
    cons_type_up::InfrastructureSystems.Optimization.ConstraintType,
    cons_type_down::InfrastructureSystems.Optimization.ConstraintType,
    var_types::Tuple{InfrastructureSystems.Optimization.VariableType, InfrastructureSystems.Optimization.VariableType, InfrastructureSystems.Optimization.VariableType},
    _::Type{T<:Component}
)

This formulation of the duration constraints looks ahead in the time frame of the model.

LaTeX

  • Minimum up-time constraint:

If $t \leq d_{min}^{up}$

$d_{min}^{down}x_t^{stop} - \sum_{i=t-d_{min}^{up} + 1}^t x_i^{on} - x_{init}^{up} \leq 0$

for i in the set of time steps. Otherwise:

$d_{min}^{down}x_t^{stop} - \sum_{i=t-d_{min}^{up} + 1}^t x_i^{on} \leq 0$

for i in the set of time steps.

  • Minimum down-time constraint:

If $t \leq d_{min}^{down}$

$d_{min}^{up}x_t^{start} - \sum_{i=t-d_{min^{down} + 1}^t (1 - x_i^{on}) - x_{init}^{down} \leq 0$

for i in the set of time steps. Otherwise:

$d_{min}^{up}x_t^{start} - \sum_{i=t-d_{min^{down} + 1}^t (1 - x_i^{on}) \leq 0$

for i in the set of time steps.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • duration_data::Vector{UpDown} : gives how many time steps variable needs to be up or down
  • initial_duration::Matrix{InitialCondition} : gives initial conditions for up (column 1) and down (column 2)
  • cons_name::Symbol : name of the constraint
  • var_keys::Tuple{VariableKey, VariableKey, VariableKey}) : names of the variables
  • : var_keys[1] : varon
  • : var_keys[2] : varstart
  • : var_keys[3] : varstop
source
PowerSimulations.device_duration_parameters!Method
device_duration_parameters!(
    container::PowerSimulations.OptimizationContainer,
    duration_data::Vector{@NamedTuple{up::Float64, down::Float64}},
    initial_duration::Matrix{InitialCondition},
    cons_type::InfrastructureSystems.Optimization.ConstraintType,
    var_types::Tuple{InfrastructureSystems.Optimization.VariableType, InfrastructureSystems.Optimization.VariableType, InfrastructureSystems.Optimization.VariableType},
    _::Type{T<:Component}
)

This formulation of the duration constraints considers parameters.

LaTeX

  • Minimum up-time constraint:

If $t \leq d_{min}^{up}$

$d_{min}^{down}x_t^{stop} - \sum_{i=t-d_{min}^{up} + 1}^t x_i^{on} - x_{init}^{up} \leq 0$

for i in the set of time steps. Otherwise:

$\sum_{i=t-d_{min}^{up} + 1}^t x_i^{start} - x_t^{on} \leq 0$

for i in the set of time steps.

  • Minimum down-time constraint:

If $t \leq d_{min}^{down}$

$d_{min}^{up}x_t^{start} - \sum_{i=t-d_{min^{down} + 1}^t (1 - x_i^{on}) - x_{init}^{down} \leq 0$

for i in the set of time steps. Otherwise:

$\sum_{i=t-d_{min}^{down} + 1}^t x_i^{stop} + x_t^{on} \leq 1$

for i in the set of time steps.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • duration_data::Vector{UpDown} : gives how many time steps variable needs to be up or down
  • initialdurationon::Vector{InitialCondition} : gives initial number of time steps variable is up
  • initialdurationoff::Vector{InitialCondition} : gives initial number of time steps variable is down
  • cons_name::Symbol : name of the constraint
  • var_keys::Tuple{VariableKey, VariableKey, VariableKey}) : names of the variables
  • : var_keys[1] : varon
  • : var_keys[2] : varstart
  • : var_keys[3] : varstop
source
PowerSimulations.device_duration_retrospective!Method
device_duration_retrospective!(
    container::PowerSimulations.OptimizationContainer,
    duration_data::Vector{@NamedTuple{up::Float64, down::Float64}},
    initial_duration::Matrix{InitialCondition},
    cons_type::InfrastructureSystems.Optimization.ConstraintType,
    var_types::Tuple{InfrastructureSystems.Optimization.VariableType, InfrastructureSystems.Optimization.VariableType, InfrastructureSystems.Optimization.VariableType},
    _::Type{T<:Component}
)

This formulation of the duration constraints adds over the start times looking backwards.

LaTeX

  • Minimum up-time constraint:

If $t \leq d_{min}^{up} - d_{init}^{up}$ and $d_{init}^{up} > 0$

$1 + \sum_{i=t-d_{min}^{up} + 1}^t x_i^{start} - x_t^{on} \leq 0$

for i in the set of time steps. Otherwise:

$\sum_{i=t-d_{min}^{up} + 1}^t x_i^{start} - x_t^{on} \leq 0$

for i in the set of time steps.

  • Minimum down-time constraint:

If $t \leq d_{min}^{down} - d_{init}^{down}$ and $d_{init}^{down} > 0$

$1 + \sum_{i=t-d_{min}^{down} + 1}^t x_i^{stop} + x_t^{on} \leq 1$

for i in the set of time steps. Otherwise:

$\sum_{i=t-d_{min}^{down} + 1}^t x_i^{stop} + x_t^{on} \leq 1$

for i in the set of time steps.

Arguments

  • container::OptimizationContainer : the optimization_container model built in PowerSimulations
  • duration_data::Vector{UpDown} : gives how many time steps variable needs to be up or down
  • initial_duration::Matrix{InitialCondition} : gives initial conditions for up (column 1) and down (column 2)
  • cons_name::Symbol : name of the constraint
  • var_keys::Tuple{VariableKey, VariableKey, VariableKey}) : names of the variables
  • : var_keys[1] : varon
  • : var_keys[2] : varstart
  • : var_keys[3] : varstop
source
PowerSimulations.find_timestamp_indexMethod
find_timestamp_index(
    dates::Union{StepRange{Dates.DateTime, Dates.Millisecond}, Vector{Dates.DateTime}},
    date::Dates.DateTime
) -> Int64

calculates the index in the time series corresponding to the data. Assumes that the dates vector is sorted.

source
PowerSimulations.generate_formulation_combinationsFunction
generate_formulation_combinations(

) -> Dict{String, Vector{Any}}
generate_formulation_combinations(
    sys
) -> Dict{String, Vector{Any}}

Generate valid combinations of devicetype/formulation and servicetype/formulation. Return vectors of dictionaries with Julia types.

Arguments

  • sys::Union{Nothing, System}: If set, only include component types present in the system.
source
PowerSimulations.get_absolute_step_rangeMethod
get_absolute_step_range(
    partitions::SimulationPartitions,
    index::Int64
) -> UnitRange{Int64}

Return a UnitRange for the steps in the partition with the given index. Includes overlap.

source
PowerSimulations.get_dirty_data_to_flush!Method
get_dirty_data_to_flush!(
    cache::PowerSimulations.OptimizationOutputCache
) -> Tuple{Vector{Dates.DateTime}, Any}

Return all dirty data from the cache. Mark the timestamps as clean.

source
PowerSimulations.get_last_updated_timestampMethod
get_last_updated_timestamp(
    container::PowerSimulations.DatasetContainer,
    key::InfrastructureSystems.Optimization.OptimizationContainerKey
) -> Dates.DateTime

Return the timestamp from most recent data row updated in the dataset. This value may not be the same as the result from get_update_timestamp

source
PowerSimulations.get_last_updated_timestampMethod
get_last_updated_timestamp(
    s::PowerSimulations.HDF5Dataset
) -> Dates.DateTime

Return the timestamp from most recent data row updated in the dataset. This value may not be the same as the result from get_update_timestamp

source
PowerSimulations.get_last_updated_timestampMethod
get_last_updated_timestamp(
    s::PowerSimulations.InMemoryDataset
) -> Dates.DateTime

Return the timestamp from most recent data row updated in the dataset. This value may not be the same as the result from get_update_timestamp

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device::ACBranch,
    _::Type{<:InfrastructureSystems.Optimization.ConstraintType},
    _::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> @NamedTuple{min::Float64, max::Float64}

Min and max limits for Abstract Branch Formulation

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{<:PowerSimulations.AbstractCompactUnitCommitment}
) -> Any

Min and Max active power limits for Compact Unit Commitment

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{<:PowerSimulations.AbstractThermalDispatchFormulation}
) -> Any

Min and max active power limits of generators for thermal dispatch formulations

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{<:PowerSimulations.AbstractThermalUnitCommitment}
) -> NamedTuple{(:min, :max), <:Tuple{Float64, Any}}

Min and max active power limits of generators for thermal unit commitment formulations

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{ThermalCompactDispatch}
) -> NamedTuple{(:min, :max), <:Tuple{Float64, Any}}

Min and max active power limits of generators for thermal dispatch compact formulations

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{ThermalDispatchNoMin}
) -> NamedTuple{(:min, :max), <:Tuple{Float64, Any}}

Min and max active power limits of generators for thermal dispatch no minimum formulations

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{ThermalMultiStartUnitCommitment}
) -> NamedTuple{(:min, :max), <:Tuple{Float64, Any}}

Min and max active power limits for multi-start unit commitment formulations

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ReactivePowerVariableLimitsConstraint},
    _::Type{<:PowerSimulations.AbstractThermalDispatchFormulation}
) -> Any

Reactive power limits of generators for all dispatch formulations

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ReactivePowerVariableLimitsConstraint},
    _::Type{<:PowerSimulations.AbstractThermalUnitCommitment}
) -> Any

Reactive power limits of generators when there CommitmentVariables

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device::MonitoredLine,
    _::Type{<:InfrastructureSystems.Optimization.ConstraintType},
    _::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}

Min and max limits for monitored line

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device::MonitoredLine,
    _::Type{FlowLimitFromToConstraint},
    _::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}

Min and max limits for flow limit from-to constraint

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device::MonitoredLine,
    _::Type{FlowLimitToFromConstraint},
    _::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}

Min and max limits for flow limit to-from constraint

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    _::PhaseShiftingTransformer,
    _::Type{PhaseAngleControlLimit},
    _::Type{PhaseAngleControl}
) -> @NamedTuple{min::Float64, max::Float64}

Min and max limits for Abstract Branch Formulation

source
PowerSimulations.get_piecewise_incrementalcurve_per_system_unitMethod
get_piecewise_incrementalcurve_per_system_unit(
    cost_component::PiecewiseStepData,
    unit_system::UnitSystem,
    system_base_power::Float64,
    device_base_power::Float64
) -> PiecewiseStepData

Obtain the normalized PiecewiseStep cost data in system base per unit depending on the specified power units.

Note that the costs (y-axis) are in /MWh, /(sys pu h) or /(device pu h), so they also require transformation.

source
PowerSimulations.get_piecewise_pointcurve_per_system_unitMethod
get_piecewise_pointcurve_per_system_unit(
    cost_component::PiecewiseLinearData,
    unit_system::UnitSystem,
    system_base_power::Float64,
    device_base_power::Float64
) -> PiecewiseLinearData

Obtain the normalized PiecewiseLinear cost data in system base per unit depending on the specified power units.

Note that the costs (y-axis) are always in /h so they do not require transformation

source
PowerSimulations.get_proportional_cost_per_system_unitMethod
get_proportional_cost_per_system_unit(
    cost_term::Float64,
    unit_system::UnitSystem,
    system_base_power::Float64,
    device_base_power::Float64
) -> Float64

Obtain proportional (marginal or slope) cost data in system base per unit depending on the specified power units

source
PowerSimulations.get_quadratic_cost_per_system_unitMethod
get_quadratic_cost_per_system_unit(
    cost_term::Float64,
    unit_system::UnitSystem,
    system_base_power::Float64,
    device_base_power::Float64
) -> Float64

Obtain quadratic cost data in system base per unit depending on the specified power units

source
PowerSimulations.get_startup_shutdown_limitsMethod
get_startup_shutdown_limits(
    device,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{<:PowerSimulations.AbstractCompactUnitCommitment}
) -> NamedTuple{(:startup, :shutdown), <:Tuple{Any, Any}}

Startup shutdown limits for Compact Unit Commitment

source
PowerSimulations.get_startup_shutdown_limitsMethod
get_startup_shutdown_limits(
    device::ThermalMultiStart,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{ThermalMultiStartUnitCommitment}
) -> NamedTuple{(:startup, :shutdown), <:Tuple{Any, Any}}

Startup and shutdown active power limits for Compact Unit Commitment

source
PowerSimulations.get_update_timestampMethod
get_update_timestamp(
    container::PowerSimulations.DatasetContainer,
    key::InfrastructureSystems.Optimization.OptimizationContainerKey
) -> Any

Return the timestamp from the data used in the last update

source
PowerSimulations.has_dirtyMethod
has_dirty(
    cache::PowerSimulations.OptimizationOutputCaches
) -> Bool

Return true if the cache has data that has not been flushed to storage.

source
PowerSimulations.is_cachedMethod
is_cached(
    cache::PowerSimulations.OptimizationOutputCaches,
    model_name,
    key,
    index
) -> Bool

Return true if the data for timestamp is stored in cache.

source
PowerSimulations.list_decision_model_keysMethod
list_decision_model_keys(
    store::PowerSimulations.HdfSimulationStore,
    model::Symbol,
    container_type::Symbol
) -> Vector

Return the fields stored for the problem and container_type (duals/parameters/variables).

source
PowerSimulations.list_decision_modelsMethod
list_decision_models(
    store::PowerSimulations.HdfSimulationStore
) -> Base.KeySet{Symbol, OrderedDict{Symbol, PowerSimulations.DatasetContainer{PowerSimulations.HDF5Dataset}}}

Return the problem names in order of execution.

source
PowerSimulations.onvar_costMethod
onvar_cost(
    container::PowerSimulations.OptimizationContainer,
    cost::ThermalGenerationCost,
    S::OnVariable,
    d::ThermalGen,
    U::PowerSimulations.AbstractThermalFormulation,
    t::Int64
) -> Any

Theoretical Cost at power output zero. Mathematically is the intercept with the y-axis

source
PowerSimulations.open_storeFunction
open_store(
    ::Type{PowerSimulations.HdfSimulationStore},
    directory::AbstractString;
    ...
) -> PowerSimulations.HdfSimulationStore
open_store(
    ::Type{PowerSimulations.HdfSimulationStore},
    directory::AbstractString,
    mode;
    filename
) -> PowerSimulations.HdfSimulationStore

Construct and open an HdfSimulationStore.

When reading or writing results in a program you should use the method that accepts a function in order to guarantee that the file handle gets closed.

Arguments

  • directory::AbstractString: Directory containing the store file
  • mode::AbstractString: Mode to use to open the store file
  • filename::AbstractString: Base name of the store file

Examples

# Assumes a simulation has been executed in the './rts' directory with these parameters.
path = "./rts"
problem = :ED
var_name = :P__ThermalStandard
timestamp = DateTime("2020-01-01T05:00:00")
store = open_store(HdfSimulationStore, path)
df = PowerSimulations.read_result(DataFrame, store, model, :variables, var_name, timestamp)
source
PowerSimulations.read_jsonMethod
read_json(
    filename::AbstractString
) -> Union{Nothing, Bool, Float64, Int64, String, JSON3.Array, JSON3.Object}

Return a decoded JSON file.

source
PowerSimulations.read_resultMethod
read_result(
    cache::PowerSimulations.OptimizationOutputCaches,
    model_name,
    key,
    timestamp
) -> Array

Read the result from cache. Callers must first call is_cached to check if the timestamp is present.

source
PowerSimulations.read_resultMethod
read_result(
    _::Type{DataFrames.DataFrame},
    store::PowerSimulations.HdfSimulationStore,
    model_name::Symbol,
    key::InfrastructureSystems.Optimization.OptimizationContainerKey,
    index::Union{Int64, Dates.DateTime}
) -> DataFrames.DataFrame

Return DataFrame, DenseAxisArray, or Array for a model result at a timestamp.

source
PowerSimulations.serialize_formulation_combinationsFunction
serialize_formulation_combinations(

) -> Dict{String, Vector{Any}}
serialize_formulation_combinations(
    sys
) -> Dict{String, Vector{Any}}

Generate valid combinations of devicetype/formulation and servicetype/formulation. Return vectors of dictionaries with Julia types encoded as strings.

Arguments

  • sys::Union{Nothing, System}: If set, only include component types present in the system.
source
PowerSimulations.serialize_simulationMethod
serialize_simulation(sim::Simulation; path, force) -> String
serialize_simulation(sim::Simulation, path = ".")

Serialize the simulation to a directory in path.

Return the serialized simulation directory name that is created.

Arguments

  • sim::Simulation: simulation to serialize
  • path = ".": path in which to create the serialzed directory
  • force = false: If true, delete the directory if it already exists. Otherwise, it will throw an exception.
source
PowerSimulations.set_expression!Method
set_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{S<:CostExpressions},
    cost_expression::JuMP.AbstractJuMPScalar,
    component::Component,
    time_period::Int64
)

Replaces an expression value in the expression container if the key exists

source
PowerSimulations.set_ic_quantity!Method
set_ic_quantity!(
    ic::InitialCondition{T<:InfrastructureSystems.Optimization.InitialConditionType, Float64},
    var_value::Float64
)

Default implementation of setinitialcondition_value

source
PowerSimulations.set_ic_quantity!Method
set_ic_quantity!(
    ic::InitialCondition{T<:InfrastructureSystems.Optimization.InitialConditionType, JuMP.VariableRef},
    var_value::Float64
)

Default implementation of setinitialcondition_value

source
PowerSimulations.solve_impl!Method
solve_impl!(
    container::PowerSimulations.OptimizationContainer,
    system::System
) -> Any

Default solve method for OptimizationContainer

source
PowerSimulations.sparse_container_specMethod
sparse_container_spec(
    _::Type{T<:JuMP.AbstractJuMPScalar},
    axs...
) -> JuMP.Containers.SparseAxisArray

Returns the correct container specification for the selected type of JuMP Model

source
PowerSimulations.to_dataframeMethod
to_dataframe(
    array::JuMP.Containers.DenseAxisArray{T<:Number, 2, Ax, L} where {Ax, L<:Tuple{JuMP.Containers._AxisLookup, JuMP.Containers._AxisLookup}},
    key::InfrastructureSystems.Optimization.OptimizationContainerKey
) -> DataFrames.DataFrame

Creates a DataFrame from a JuMP DenseAxisArray or SparseAxisArray.

Arguments

  • array: JuMP DenseAxisArray or SparseAxisArray to convert
  • key::OptimizationContainerKey:
source
PowerSimulations.update_container_parameter_values!Method
update_container_parameter_values!(
    optimization_container::PowerSimulations.OptimizationContainer,
    model::PowerSimulations.OperationModel,
    key::InfrastructureSystems.Optimization.ParameterKey{T<:InfrastructureSystems.Optimization.ParameterType, U<:Component},
    input::PowerSimulations.DatasetContainer{PowerSimulations.InMemoryDataset}
)

Update parameter function an OperationModel

source
PowerSimulations.update_model!Method
update_model!(
    model::PowerSimulations.OperationModel,
    sim::Simulation
)

Default problem update function for most problems with no customization

source
PowerSimulations.update_parameter_values!Method
update_parameter_values!(
    model::EmulationModel,
    key::InfrastructureSystems.Optimization.ParameterKey{T<:InfrastructureSystems.Optimization.ParameterType, U<:Component},
    input::PowerSimulations.DatasetContainer{PowerSimulations.InMemoryDataset}
)

Update parameter function an OperationModel

source
PowerSimulations.update_parameter_values!Method
update_parameter_values!(
    model::PowerSimulations.OperationModel,
    key::InfrastructureSystems.Optimization.ParameterKey{T<:InfrastructureSystems.Optimization.ParameterType, U<:Component},
    simulation_state::PowerSimulations.SimulationState
)

Update parameter function an OperationModel

source
PowerSimulations.write_formulation_combinationsFunction
write_formulation_combinations(filename::AbstractString)
write_formulation_combinations(
    filename::AbstractString,
    sys
)

Generate valid combinations of devicetype/formulation and servicetype/formulation and write the result to a JSON file.

Arguments

  • sys::Union{Nothing, System}: If set, only include component types present in the system.
source
PowerSimulations.write_result!Method
write_result!(
    store::PowerSimulations.HdfSimulationStore,
    model_name::Symbol,
    key::InfrastructureSystems.Optimization.OptimizationContainerKey,
    index::Dates.DateTime,
    _::Dates.DateTime,
    data::JuMP.Containers.DenseAxisArray{Float64, 3, var"#s549", L} where {var"#s549"<:Tuple{Any, Any, Any}, L<:Tuple{JuMP.Containers._AxisLookup, JuMP.Containers._AxisLookup, JuMP.Containers._AxisLookup}}
)

Write a decision model result for a timestamp to the store.

source
PowerSimulations.write_result!Method
write_result!(
    store::PowerSimulations.HdfSimulationStore,
    _::Symbol,
    key::InfrastructureSystems.Optimization.OptimizationContainerKey,
    index::Int64,
    simulation_time::Dates.DateTime,
    data::JuMP.Containers.DenseAxisArray
)

Write an emulation model result for an execution index value and the timestamp of the update

source
PowerSimulations.write_result!Method
write_result!(
    store::PowerSimulations.HdfSimulationStore,
    model_name::Symbol,
    key::InfrastructureSystems.Optimization.OptimizationContainerKey,
    index::Dates.DateTime,
    _::Dates.DateTime,
    data::JuMP.Containers.DenseAxisArray{Float64, N, var"#s549", L} where {var"#s549"<:NTuple{N, Any}, L<:NTuple{N, JuMP.Containers._AxisLookup}}
)

Write a decision model result for a timestamp to the store.

source