Internal API

PowerSimulations.DiscreteEventConditionType
DiscreteEventCondition(condition_function::Function)

Establishes an event condition that is triggered if when a user defined function evaluates to true. The function should take SimulationState as its only arguement and return true when the event should be triggered and false otherwise.

Arguments

  • condition_function::Function: user defined function f(::SimulationState)to determine if event is triggered.
source
PowerSimulations.HVDCInverterPowerCalculationConstraintType

Struct to create the constraint that calculates the AC Power injection at the AC side of the inverter.

\[\begin{align*} p_\text{ac}^i = \sqrt{3} i_\text{ac}^i \frac{a^i v_\text{ac}^i}{t^i}\cos{\phi^i} \\ q_\text{ac}^i = \sqrt{3} i_\text{ac}^i \frac{a^i v_\text{ac}^i}{t^i}\sin{\phi^i} \\ \end{align*}\]

source
PowerSimulations.HVDCRectifierPowerCalculationConstraintType

Struct to create the constraint that calculates the AC Power injection at the AC side of the rectifier.

\[\begin{align*} p_\text{ac}^r = \sqrt{3} i_\text{ac}^r \frac{a^r v_\text{ac}^r}{t^r}\cos{\phi^r} \\ q_\text{ac}^r = \sqrt{3} i_\text{ac}^r \frac{a^r v_\text{ac}^r}{t^r}\sin{\phi^r} \\ \end{align*}\]

source
PowerSimulations.OperationModelType

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

source
PowerSimulations.PresetTimeConditionType
PresetTimeCondition(time_stamps::Vector{Dates.DateTime})

Establishes an event condition that is triggered at pre-determined times.

Arguments

  • time_stamps::Vector{Dates.DateTime}: times when event is triggered
source
PowerSimulations.StateVariableValueConditionType
StateVariableValueCondition(
    variable_type::Type{<:VariableType}
    device_type::Type{<:PSY.Device}
    device_name::String
    value::Float64
)

Establishes an event condition that is triggered if a variable of type variable_type for a device of type device_type and name device_name is equal to value. and name

Arguments

  • variable_type::Type{<:VariableType}: variable to be monitored
  • device_type::Type{<:PSY.Device}: device type to be monitored
  • device_name::String: name of monitored device
  • value::Float64: value to compare to in p.u.
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,
    table_format
) -> 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
InfrastructureSystems.Optimization.to_matrixMethod
to_matrix(vec::Vector) -> Matrix

Convert Vectors, DenseAxisArrays, and SparkAxisArrays to a matrix.

  • If the input is a 1d array or DenseAxisArray, the returned matrix will have a number of rows equal to the length of the input and one column.
  • If the input is a 2d DenseAxisArray, the dimensions are transposed, due to the way we store outputs in JuMP.
source
PowerSimulations._add_category_to_map!Method
_add_category_to_map!(
    precedence::Vector{DataType},
    available_keys::Vector{Pair{InfrastructureSystems.Optimization.OptimizationContainerKey, Any}},
    temp_component_map::Dict{DataType, <:Dict},
    pf_data_opt_container_map::Dict{InfrastructureSystems.Optimization.OptimizationContainerKey, <:Dict}
)
_add_category_to_map!(
    precedence::Vector{DataType},
    available_keys::Vector{Pair{OptimizationContainerKey, Any}},
    temp_component_map::Union{
        Dict{DataType, Dict{String, Int}},
        Dict{DataType, Dict{Union{Int64, String}, String}},
    },
    pf_data_opt_container_map::Union{
        Dict{OptimizationContainerKey, Dict{String, Int}},
        Dict{OptimizationContainerKey, Dict{Union{Int64, String}, String}},
    },
)

Helper function that is used in makepfinputmap! and addtwoterminalelementsmap! to configure which variables from the optimization results get written to the PowerFlowData. For every results variable from the optimization, it finds the corresponding mapping between the optimization variable and the PowerFlowData variable. The mappings are added to the `pfdataoptcontainer_map` Dict. This step is executed during the build stage of the optimization. The results are written to the PowerFlowData in the solve stage, before the power flow is solved.

Arguments

  • precedence::Vector{DataType}: A vector of DataType objects that defines the order of precedence for the variables that correspond to the category of variables (e.g. :active_power - first look for ActivePowerVariable for the component type, if not available then PowerOutput, and finally ActivePowerTimeSeriesParameter).
  • available_keys::Vector{Pair{OptimizationContainerKey, Any}}: A vector of key-value pairs where the key is an OptimizationContainerKey and the value contains data associated with the key.
  • temp_component_map::Union{Dict{DataType, Dict{String, Int}}, Dict{DataType, Dict{Union{Int64, String}, String}}}: A mapping for component types to point the component-level results (e.g. as voltage value for bus "A") to the appropriate variable in PowerFlowData (e.g. row 27 in the bus-related matrices).
  • pf_data_opt_container_map::Union{Dict{OptimizationContainerKey, Dict{String, Int}}, Dict{OptimizationContainerKey, Dict{Union{Int64, String}, String}}}: The target Dict that contains mappings for all relevant component types.
source
PowerSimulations._add_generic_incremental_interpolation_constraint!Method
_add_generic_incremental_interpolation_constraint!(
    container::PowerSimulations.OptimizationContainer,
    ::InfrastructureSystems.Optimization.VariableType,
    ::InfrastructureSystems.Optimization.VariableType,
    ::InfrastructureSystems.Optimization.VariableType,
    ::InfrastructureSystems.Optimization.VariableType,
    ::InfrastructureSystems.Optimization.ConstraintType,
    devices::InfrastructureSystems.FlattenIteratorWrapper{W<:Component},
    dic_var_bkpts::Dict{String, Vector{Float64}},
    dic_function_bkpts::Dict{String, Vector{Float64}};
    meta
)
_add_generic_incremental_interpolation_constraint!(container, ::R, ::S, ::T, ::U, ::V, devices, dic_var_bkpts, dic_function_bkpts; meta)

Add incremental piecewise linear interpolation constraints to an optimization container.

This function implements the incremental method for piecewise linear approximation in optimization models. It creates constraints that relate the original variable (x) to its piecewise linear approximation (y = f(x)) using interpolation variables (δ) and binary variables (z) to ensure proper ordering.

The incremental method represents each segment of the PWL function as:

  • x = x₁ + Σᵢ δᵢ(xᵢ₊₁ - xᵢ) where δᵢ ∈ [0,1]
  • y = y₁ + Σᵢ δᵢ(yᵢ₊₁ - yᵢ) where yᵢ = f(xᵢ)

Binary variables z ensure the incremental property: δᵢ₊₁ ≤ zᵢ ≤ δᵢ for adjacent segments.

Arguments

  • container::OptimizationContainer: The optimization container to add constraints to
  • ::R: Type parameter for the original variable (x)
  • ::S: Type parameter for the approximated variable (y = f(x))
  • ::T: Type parameter for the interpolation variables (δ)
  • ::U: Type parameter for the binary interpolation variables (z)
  • ::V: Type parameter for the constraint type
  • devices::IS.FlattenIteratorWrapper{W}: Collection of devices to apply constraints to
  • dic_var_bkpts::Dict{String, Vector{Float64}}: Breakpoints in the domain (x-coordinates) for each device
  • dic_function_bkpts::Dict{String, Vector{Float64}}: Function values at breakpoints (y-coordinates) for each device
  • meta: Metadata for constraint naming (default: empty)

Type Parameters

  • R <: VariableType: Original variable type
  • S <: VariableType: Approximated variable type
  • T <: VariableType: Interpolation variable type
  • U <: VariableType: Binary interpolation variable type
  • V <: ConstraintType: Constraint type
  • W <: PSY.Component: Component type for devices

Notes

  • Creates two types of constraints: variable interpolation and function interpolation
  • Adds ordering constraints for binary variables to ensure incremental property
  • All constraints are applied for each device and time step
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_constraint!Method
_add_pwl_constraint!(
    container::PowerSimulations.OptimizationContainer,
    component::Component,
    _::InfrastructureSystems.Optimization.VariableType,
    _::PowerSimulations.AbstractDeviceFormulation,
    break_points::Vector{<:Union{Float64, JuMP.AbstractJuMPScalar}},
    period::Int64,
    _::Type{V<:PowerSimulations.AbstractPiecewiseLinearBlockOffer},
    _::Type{W<:PowerSimulations.AbstractPiecewiseLinearBlockOfferConstraint}
)

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_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::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_two_terminal_elements_map!Method
_add_two_terminal_elements_map!(
    sys::System,
    pf_data::PowerFlows.PowerFlowData,
    available_keys::Vector{Pair{InfrastructureSystems.Optimization.OptimizationContainerKey, Any}},
    input_key_map::Dict{Symbol, <:Dict{InfrastructureSystems.Optimization.OptimizationContainerKey, <:Dict}}
)
_add_two_terminal_elements_map!(
    sys::PSY.System,
    pf_data::PFS.PowerFlowData,
    available_keys::Vector{Pair{OptimizationContainerKey, Any}},
    input_key_map::Dict{Symbol, Dict{OptimizationContainerKey, Dict{String, Int64}}}
)

Adds mappings for two-terminal elements (HVDC components) that connect the power flow results (from -> to, to -> from) to be added to the mappings for all component types. The results for these elements are added as bus injections in the PowerFlowData as a simplified representation of these components.

Arguments

  • sys::PSY.System: System instance representing the power system model.
  • pf_data::PFS.PowerFlowData: The power flow data used internally for power flow calculations.
  • available_keys::Vector{Pair{OptimizationContainerKey, Any}}: A vector of available optimization container keys and their associated values.
  • input_key_map::Dict{Symbol, Dict{OptimizationContainerKey, Dict{String, Int64}}}: A dictionary mapping categories to optimization container keys and their associated mappings. To be extended in this function by the mappings for the two-terminal elements to the respective buses in the PowerFlowData instance.
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::OfferCurveCost,
    _::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._get_breakpoints_for_pwl_functionMethod
_get_breakpoints_for_pwl_function(
    min_val::Float64,
    max_val::Float64,
    f;
    num_segments
) -> Tuple{Vector{Float64}, Vector{Float64}}
_get_breakpoints_for_pwl_function(min_val, max_val, f; num_segments = DEFAULT_INTERPOLATION_LENGTH)

Generate breakpoints for piecewise linear (PWL) approximation of a nonlinear function.

This function creates equally-spaced breakpoints over the specified domain [minval, maxval] and evaluates the given function at each breakpoint to construct a piecewise linear approximation. The breakpoints are used in optimization problems to linearize nonlinear constraints or objectives.

Arguments

  • min_val::Float64: Minimum value of the domain for the PWL approximation
  • max_val::Float64: Maximum value of the domain for the PWL approximation
  • f: Function to be approximated (must be callable with Float64 input)
  • num_segments::Int: Number of linear segments in the PWL approximation (default: DEFAULTINTERPOLATIONLENGTH)

Returns

  • Tuple{Vector{Float64}, Vector{Float64}}: A tuple containing:
    • x_bkpts: Vector of x-coordinates (breakpoints) in the domain
    • y_bkpts: Vector of y-coordinates (function values at breakpoints)

Notes

  • The number of breakpoints is num_segments + 1
  • Breakpoints are equally spaced across the domain
  • The first breakpoint is always at min_val and the last at max_val
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,
    slopes_normalized::Vector{Float64},
    multiplier::Float64
) -> JuMP.AffExpr

Get cost expression for StepwiseCostReserve

source
PowerSimulations._lookup_maybe_time_variant_paramMethod
_lookup_maybe_time_variant_param(
    _::PowerSimulations.OptimizationContainer,
    component::Component,
    _::Int64,
    _::Val{false},
    getter_func::Function,
    _::InfrastructureSystems.Optimization.ParameterType
) -> Any

Either looks up a value in the component using getter_func or fetches the value from the parameter U(), depending on whether we are in the time-variant case or not

source
PowerSimulations._validate_eltypeMethod
_validate_eltype(
    ::Type{T},
    component::Component,
    ts_key::TimeSeriesKey
) -> Any
_validate_eltype(
    ::Type{T},
    component::Component,
    ts_key::TimeSeriesKey,
    msg
) -> Any

Validate that the eltype of the time series, or the field itself if it's not a time series, is of the type given

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:PostContingencyGenerationBalanceConstraint},
    _::Type{U<:PostContingencyActivePowerBalance},
    contributing_devices::Union{Array{V<:Generator, 1}, InfrastructureSystems.FlattenIteratorWrapper{V<:Generator}},
    service::Union{Reserve{ReserveDown}, Reserve{ReserveUp}},
    model::ServiceModel{R<:Union{Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:PowerSimulations.AbstractSecurityConstrainedReservesFormulation},
    _::NetworkModel{<:PowerSimulations.AbstractPTDFModel}
)

Add post-contingency Generation Balance Constraints for Generators for G-1 formulation and G-1 with reserves (SecurityConstrainedReservesFormulation)

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    cons_type::Type{T<:PostContingencyEmergencyRateLimitConstrain},
    _::Type{U<:PostContingencyBranchFlow},
    branches::Union{Array{V<:ACTransmission, 1}, InfrastructureSystems.FlattenIteratorWrapper{V<:ACTransmission}},
    service::Union{Generator, Reserve{ReserveDown}, Reserve{ReserveUp}},
    device_model::Union{DeviceModel{R<:Union{Generator, Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:Union{PowerSimulations.AbstractSecurityConstrainedReservesFormulation, PowerSimulations.AbstractSecurityConstrainedUnitCommitment}}, ServiceModel{R<:Union{Generator, Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:Union{PowerSimulations.AbstractSecurityConstrainedReservesFormulation, PowerSimulations.AbstractSecurityConstrainedUnitCommitment}}},
    network_model::NetworkModel{<:PowerSimulations.AbstractPTDFModel}
)

Add branch post-contingency rate limit constraints for ACBranch after a G-k outage

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    ::Type{T<:PostContingencyRampConstraint},
    ::Type{U<:PowerSimulations.AbstractContingencyVariableType},
    devices::Union{Array{V<:Generator, 1}, InfrastructureSystems.FlattenIteratorWrapper{V<:Generator}},
    model::Union{DeviceModel{R<:Union{Nothing, Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:Union{PowerSimulations.AbstractSecurityConstrainedReservesFormulation, PowerSimulations.AbstractSecurityConstrainedUnitCommitment}}, ServiceModel{R<:Union{Nothing, Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:Union{PowerSimulations.AbstractSecurityConstrainedReservesFormulation, PowerSimulations.AbstractSecurityConstrainedUnitCommitment}}},
    ::NetworkModel{N<:PowerSimulations.AbstractPTDFModel};
    service
)

This function adds the post-contingency ramping limits

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{FlowRateConstraintFromTo},
    devices::InfrastructureSystems.FlattenIteratorWrapper{B<:ACTransmission},
    device_model::DeviceModel{B<:ACTransmission, <: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{FlowRateConstraintToFrom},
    devices::InfrastructureSystems.FlattenIteratorWrapper{B<:ACTransmission},
    device_model::DeviceModel{B<:ACTransmission, <: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,
    cons_type::Type{NetworkFlowConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:ACTransmission},
    device_model::DeviceModel{T<:ACTransmission, StaticBranchBounds},
    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{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{FlowRateConstraintFromTo},
    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{FlowRateConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{T<:ACTransmission},
    device_model::DeviceModel{T<:ACTransmission, 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,
    cons_type::Type{PostContingencyEmergencyRateLimitConstrain},
    branches::InfrastructureSystems.FlattenIteratorWrapper{ACTransmission},
    branches_outages::Array{T<:ACTransmission, 1},
    device_model::DeviceModel{T<:ACTransmission, U<:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{V<:PowerSimulations.AbstractSecurityConstrainedPTDFModel}
)

Add branch post-contingency rate limit constraints for ACBranch considering LODF and Security Constraints

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    cons_type::Type{PostContingencyActivePowerVariableLimitsConstraint},
    devices::InfrastructureSystems.FlattenIteratorWrapper{S<:Generator},
    generator_outages::Array{T<:Generator, 1},
    device_model::DeviceModel{T<:Generator, U<:PowerSimulations.AbstractSecurityConstrainedUnitCommitment},
    network_model::NetworkModel{V<:PowerSimulations.AbstractPTDFModel}
)

Add post-contingency rate limit constraints for Generators for G-1 formulation

source
PowerSimulations.add_constraints!Method
add_constraints!(
    container::PowerSimulations.OptimizationContainer,
    cons_type::Type{R<:PostContingencyGenerationBalanceConstraint},
    devices::Union{Array{S<:Generator, 1}, InfrastructureSystems.FlattenIteratorWrapper{S<:Generator}},
    generator_outages::Union{Array{T<:Generator, 1}, InfrastructureSystems.FlattenIteratorWrapper{T<:Generator}},
    _::DeviceModel{X<:Generator, U<:PowerSimulations.AbstractSecurityConstrainedUnitCommitment},
    network_model::NetworkModel{V<:PowerSimulations.AbstractPTDFModel}
)

Add post-contingency Generation Balance Constraints for Generators for G-1 formulation and G-1 with reserves (SecurityConstrainedReservesFormulation)

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,
    sys::System,
    ::Type{T<:PowerSimulations.PostContingencyConstraintType},
    ::Type{U<:PowerSimulations.AbstractContingencyVariableType},
    devices::Union{Array{V<:Generator, 1}, InfrastructureSystems.FlattenIteratorWrapper{V<:Generator}},
    model::Union{DeviceModel{R<:Union{Generator, Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:Union{PowerSimulations.AbstractSecurityConstrainedReservesFormulation, PowerSimulations.AbstractSecurityConstrainedUnitCommitment}}, ServiceModel{R<:Union{Generator, Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:Union{PowerSimulations.AbstractSecurityConstrainedReservesFormulation, PowerSimulations.AbstractSecurityConstrainedUnitCommitment}}},
    ::Type{<:PowerSimulations.AbstractPTDFModel};
    service
)

Constructs allowed rate-of-change constraints for G-1 formulations from change_variables, and rate data.

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

change_variable[name, t-1] >= rate_data[1][ix].down

LaTeX

$r^{down} \leq \Delta x_t \leq r^{up}, \forall t \geq$

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_pwl_term!Method
add_pwl_term!(
    is_decremental::Bool,
    container::PowerSimulations.OptimizationContainer,
    component::Component,
    _::OfferCurveCost,
    _::InfrastructureSystems.Optimization.VariableType,
    _::PowerSimulations.AbstractDeviceFormulation
)

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

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{ActivePowerVariableLimitsConstraint, 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{ActivePowerVariableLimitsConstraint, 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},
    model::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_sparse_pwl_interpolation_variables!Method
add_sparse_pwl_interpolation_variables!(
    container::PowerSimulations.OptimizationContainer,
    ::Union{PowerSimulations.BinaryInterpolationVariableType, PowerSimulations.InterpolationVariableType},
    devices,
    model::DeviceModel{U<:Component, V<:PowerSimulations.AbstractDeviceFormulation}
)
add_sparse_pwl_interpolation_variables!(
    container::PowerSimulations.OptimizationContainer,
    ::Union{PowerSimulations.BinaryInterpolationVariableType, PowerSimulations.InterpolationVariableType},
    devices,
    model::DeviceModel{U<:Component, V<:PowerSimulations.AbstractDeviceFormulation},
    num_segments
)
add_sparse_pwl_interpolation_variables!(container, devices, ::T, model, num_segments = DEFAULT_INTERPOLATION_LENGTH)

Add piecewise linear interpolation variables to an optimization container.

This function creates the necessary variables for piecewise linear (PWL) approximation in optimization models. It adds either continuous interpolation variables (δ) or binary interpolation variables (z) depending on the variable type T. These variables are used in the incremental method for PWL approximation where:

  • Interpolation variables (δ): Continuous variables ∈ [0,1] that represent weights for each segment
  • Binary interpolation variables (z): Binary variables that enforce ordering constraints in incremental method

The function creates a 3-dimensional variable structure indexed by (devicename, segmentindex, time_step). For binary variables, the number of variables is one less than for continuous variables since they control transitions between segments.

Arguments

  • container::OptimizationContainer: The optimization container to add variables to
  • devices: Collection of devices for which to create PWL variables
  • ::T: Type parameter specifying the variable type (InterpolationVariableType or BinaryInterpolationVariableType)
  • model::DeviceModel{U, V}: Device model containing formulation information for bounds
  • num_segments::Int: Number of linear segments in the PWL approximation (default: DEFAULTINTERPOLATIONLENGTH)

Type Parameters

  • T <: Union{InterpolationVariableType, BinaryInterpolationVariableType}: Variable type to create
  • U <: PSY.Component: Component type for devices
  • V <: AbstractDeviceFormulation: Device formulation type for bounds

Notes

  • Binary variables have num_segments - 1 variables (control transitions between segments)
  • Continuous variables have num_segments variables (one per segment)
  • Variable bounds are set based on the device formulation if available
  • Variables are created for all devices and time steps in the optimization horizon

See Also

  • _add_generic_incremental_interpolation_constraint!: Function that uses these variables in constraints
source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::Type{T<:PostContingencyActivePowerBalance},
    _::Type{U<:PowerSimulations.AbstractContingencyVariableType},
    contributing_devices::Union{Array{V<:Generator, 1}, InfrastructureSystems.FlattenIteratorWrapper{V<:Generator}},
    service::Union{Reserve{ReserveDown}, Reserve{ReserveUp}},
    reserves_model::ServiceModel{R<:Union{Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:PowerSimulations.AbstractSecurityConstrainedReservesFormulation},
    network_model::NetworkModel{N<:PowerSimulations.AbstractPTDFModel}
)

Default implementation to add Reserve deployment variables to PostContingencySystemBalanceExpressions for G-1 formulation with reserves

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:PostContingencyActivePowerBalance},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    attribute_device_map::Array{@NamedTuple{component::V<:Generator, supplemental_attribute::PowerSystems.UnplannedOutage}, 1},
    service::Union{Reserve{ReserveDown}, Reserve{ReserveUp}},
    reserves_model::ServiceModel{R<:Union{Reserve{ReserveDown}, Reserve{ReserveUp}}, F<:PowerSimulations.AbstractSecurityConstrainedReservesFormulation},
    network_model::NetworkModel{N<:PowerSimulations.AbstractPTDFModel}
)

Default implementation to add active power variables variables to PostContingencySystemBalanceExpressions for G-1 formulation with reserves

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:PostContingencyActivePowerBalance},
    _::Type{U<:InfrastructureSystems.Optimization.VariableType},
    _::Type{Y<:PowerSimulations.AbstractContingencyVariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Generator},
    devices_outages::Array{X<:Generator, 1},
    device_model::DeviceModel{X<:Generator, W<:PowerSimulations.AbstractSecurityConstrainedUnitCommitment},
    network_model::NetworkModel{N<:PowerSimulations.AbstractPTDFModel}
)

Default implementation to add variables to PostContingencySystemBalanceExpressions for G-1 formulation

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<:ActivePowerTimeSeriesParameter},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:MotorLoad},
    model::DeviceModel{V<:MotorLoad, W<:StaticPowerLoad},
    network_model::NetworkModel{AreaBalancePowerModel}
)

Motor load implementation to add constant power to ActivePowerBalance expression for AreaBalancePowerModel

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

Motor load implementation to add parameters to SystemBalanceExpressions CopperPlate

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<:SystemBalanceExpressions},
    _::Type{U<:InfrastructureSystems.Optimization.TimeSeriesParameter},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
    device_model::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{CopperPlatePowerModel}
)

Default implementation to add parameters to SystemBalanceExpressions

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

Default implementation to add branch variables to SystemBalanceExpressions

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:PostContingencyActivePowerGeneration},
    _::Type{U<:ActivePowerVariable},
    _::Type{D<:PostContingencyActivePowerChangeVariable},
    generators::InfrastructureSystems.FlattenIteratorWrapper{V<:Generator},
    generator_outages::Array{V<:Generator, 1},
    _::DeviceModel{V<:Generator, W<:PowerSimulations.AbstractSecurityConstrainedUnitCommitment},
    network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)

Default implementation to add generators Expressions for Post-Contingency Generation

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:PostContingencyBranchFlow},
    _::Type{U<:FlowActivePowerVariable},
    branches::InfrastructureSystems.FlattenIteratorWrapper{ACTransmission},
    branches_outages::Array{V<:ACTransmission, 1},
    _::DeviceModel{V<:ACTransmission, W<:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{X<:PowerSimulations.AbstractSecurityConstrainedPTDFModel}
)

Default implementation to add branch Expressions for Post-Contingency Flows

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

Motor load implementation to add constant power to ActivePowerBalance expression

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:ActivePowerTimeSeriesParameter},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:MotorLoad},
    device_model::DeviceModel{V<:MotorLoad, W<:StaticPowerLoad},
    network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)

Motor Load implementation to add constant motor power to PTDF 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<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, 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<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, 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<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, 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<:FlowActivePowerVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, W<:PowerSimulations.AbstractBranchFormulation},
    network_model::NetworkModel{X<:Union{PTDFPowerModel, SecurityConstrainedPTDFPowerModel}}
)

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<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, W<:HVDCTwoTerminalDispatch},
    network_model::NetworkModel{X<:Union{CopperPlatePowerModel, PTDFPowerModel, SecurityConstrainedPTDFPowerModel}}
)

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<:InfrastructureSystems.Optimization.VariableType},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
    device_model::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
    network_model::NetworkModel{X<: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<:PowerSimulations.HVDCActivePowerReceivedFromVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, W<:PowerSimulations.HVDCTwoTerminalLCC},
    network_model::NetworkModel{X<:ACPPowerModel}
)

HVDC LCC implementation to add ActivePowerBalance expression for HVDCActivePowerReceivedFromVariable variable

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:PowerSimulations.HVDCActivePowerReceivedFromVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, 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<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, W<:PowerSimulations.HVDCTwoTerminalLCC},
    network_model::NetworkModel{X<:ACPPowerModel}
)

HVDC LCC implementation to add ActivePowerBalance expression for HVDCActivePowerReceivedToVariable variable

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ActivePowerBalance},
    _::Type{U<:PowerSimulations.HVDCActivePowerReceivedToVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, 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<:ReactivePowerBalance},
    _::Type{U<:PowerSimulations.HVDCReactivePowerReceivedFromVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, W<:PowerSimulations.HVDCTwoTerminalLCC},
    network_model::NetworkModel{X<:ACPPowerModel}
)

HVDC LCC implementation to add ReactivePowerBalance expression for HVDCReactivePowerReceivedFromVariable variable

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ReactivePowerBalance},
    _::Type{U<:PowerSimulations.HVDCReactivePowerReceivedToVariable},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:TwoTerminalHVDC},
    _::DeviceModel{V<:TwoTerminalHVDC, W<:PowerSimulations.HVDCTwoTerminalLCC},
    network_model::NetworkModel{X<:ACPPowerModel}
)

HVDC LCC implementation to add ReactivePowerBalance expression for HVDCReactivePowerReceivedToVariable variable

source
PowerSimulations.add_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:ReactivePowerBalance},
    _::Type{U<:ReactivePowerTimeSeriesParameter},
    devices::InfrastructureSystems.FlattenIteratorWrapper{V<:MotorLoad},
    model::DeviceModel{V<:MotorLoad, W<:StaticPowerLoad},
    network_model::NetworkModel{X<:ACPPowerModel}
)

Motor load implementation to add constant power to ActivePowerBalance expression

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<: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_to_expression!Method
add_to_expression!(
    container::PowerSimulations.OptimizationContainer,
    _::Type{T<:SystemBalanceExpressions},
    _::Type{U<:PowerSimulations.EventParameter},
    devices::Union{Array{V<:Device, 1}, 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<:PowerSimulations.EventParameter},
    devices::Union{Array{V<:StaticInjection, 1}, 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<:PowerSimulations.EventParameter},
    devices::Union{Array{V<:StaticInjection, 1}, 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_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.apply_maybe_across_time_seriesMethod
apply_maybe_across_time_series(
    fn::Function,
    component::Component,
    ts_key::TimeSeriesKey
) -> Any

Helper function to look up a time series if necessary then apply a function (typically a validation routine in a do block) to every element in it

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<:Source, D<:ImportExportSourceModel},
    network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)

This function creates the arguments for the model for an import/export formulation for Source devices

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

This function creates the arguments model for a full thermal Security-Constrained 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,
    device_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<:Source, D<:ImportExportSourceModel},
    network_model::NetworkModel
)

This function creates the arguments for the model for an import/export formulation for Source devices

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    device_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.ModelConstructStage,
    model::DeviceModel{T<:Source, D<:ImportExportSourceModel},
    network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)

This function creates the constraints for the model for an import/export formulation for Source devices

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

This function creates the constraints for the model for a full thermal Security-Constrained 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<:Source, D<:ImportExportSourceModel},
    network_model::NetworkModel
)

This function creates the constraints for the model for an import/export formulation for Source devices

source
PowerSimulations.construct_device!Method
construct_device!(
    container::PowerSimulations.OptimizationContainer,
    sys::System,
    _::InfrastructureSystems.Optimization.ArgumentConstructStage,
    device_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,
    device_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,
    device_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,
    device_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,
    device_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,
    device_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,
    device_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,
    device_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,
    device_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,
    device_model::DeviceModel{T<:ThermalGen, U<:Union{PowerSimulations.AbstractSecurityConstrainedUnitCommitment, 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_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_column_namesMethod
get_column_names(
    _::PowerSimulations.OptimizationContainer,
    field::Symbol,
    subcontainer,
    key::InfrastructureSystems.Optimization.OptimizationContainerKey
) -> Any

Get the column names for the specified container in the OptimizationContainer.

Arguments

  • container::OptimizationContainer: The optimization container.
  • field::Symbol: The field for which to retrieve the column names.
  • key::OptimizationContainerKey: The key for which to retrieve the column names.

Returns

  • Tuple: Tuple of Vector{String}.
source
PowerSimulations.get_column_names_from_keyMethod
get_column_names_from_key(
    key::InfrastructureSystems.Optimization.OptimizationContainerKey
) -> Tuple{Vector{String}}

Return the column names from a key as a tuple of vector of strings. Only useful for 1d DenseAxisArrays.

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::ACTransmission,
    _::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(
    branch::ACTransmission,
    _::Type{<:PostContingencyEmergencyRateLimitConstrain},
    _::Type{<:PowerSimulations.AbstractBranchFormulation},
    _::NetworkModel{<:PowerSimulations.AbstractPTDFModel}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}

Min and max limits for post-contingency branch flows for Abstract Branch Formulation and SecurityConstrainedPTDF Network formulation

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    device,
    _::Type{ActivePowerVariableLimitsConstraint},
    _::Type{<:PowerSimulations.AbstractCompactUnitCommitment}
) -> NamedTuple{(:min, :max), <:Tuple{Float64, 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}
) -> NamedTuple{(:min, :max), <:Tuple{Float64, 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::Float64, max::Float64}

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::Float64, max::Float64}

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::Float64, max::Float64}

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_min_max_limitsMethod
get_min_max_limits(
    double_circuit::PowerNetworkMatrices.BranchesParallel,
    constraint_type::Type{<:InfrastructureSystems.Optimization.ConstraintType},
    branch_formulation::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}

Min and max limits for Abstract Branch Formulation

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    series_chain::PowerNetworkMatrices.BranchesSeries,
    constraint_type::Type{<:InfrastructureSystems.Optimization.ConstraintType},
    branch_formulation::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}

Min and max limits for Abstract Branch Formulation

source
PowerSimulations.get_min_max_limitsMethod
get_min_max_limits(
    transformer_entry::PowerNetworkMatrices.ThreeWindingTransformerWinding,
    constraint_type::Type{<:InfrastructureSystems.Optimization.ConstraintType},
    branch_formulation::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> @NamedTuple{min::Float64, max::Float64}

Min and max limits for Abstract Branch Formulation

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

Obtain the normalized PiecewiseStepData 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::Float64, shutdown::Float64}

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::Float64, shutdown::Float64}

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.is_from_power_flowMethod
is_from_power_flow(
    _::Type{<:InfrastructureSystems.Optimization.AuxVariableType}
) -> Bool

Whether the auxiliary variable is calculated using a PowerFlowEvaluationModel

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,
    _::OnVariable,
    d::ThermalGen,
    _::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.process_market_bid_parameters!Function
process_market_bid_parameters!(
    container::PowerSimulations.OptimizationContainer,
    devices_in,
    model::DeviceModel
)
process_market_bid_parameters!(
    container::PowerSimulations.OptimizationContainer,
    devices_in,
    model::DeviceModel,
    incremental::Bool
)
process_market_bid_parameters!(
    container::PowerSimulations.OptimizationContainer,
    devices_in,
    model::DeviceModel,
    incremental::Bool,
    decremental::Bool
)

Validate MarketBidCosts and add the appropriate parameters

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<:Union{Number, Tuple{Vararg{Number}}, Vector{<:Tuple{Number, Number}}}, 2, Ax, L} where {Ax, L<:Tuple{JuMP.Containers._AxisLookup, JuMP.Containers._AxisLookup}},
    key::InfrastructureSystems.Optimization.OptimizationContainerKey
) -> DataFrames.DataFrame

Create a DataFrame from a JuMP DenseAxisArray or SparseAxisArray.

Arguments

  • array: JuMP DenseAxisArray or SparseAxisArray to convert
  • key::OptimizationContainerKey:
source
PowerSimulations.to_results_dataframeMethod
to_results_dataframe(
    array::JuMP.Containers.DenseAxisArray,
    timestamps
) -> Any

Convert a DenseAxisArray containing components to a results DataFrame consumable by users.

Arguments

  • array: DenseAxisArray: JuMP DenseAxisArray to convert
  • timestamps: Iterable of timestamps for each component or nothing if time is not known. The resulting DataFrame will have the column "DateTime" if timestamps is not nothing. Otherwise, it will have the column "time_index", representing the index of the time dimension.
  • ::Val{TableFormat}: Format of the table to create. If it is TableFormat.LONG, the DataFrame will have the column "name", and, if the data has three dimensions, "name2." If it is TableFormat.WIDE, the DataFrame will have columns for each component. Wide format does not support arrays with more than two dimensions.
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.update_pf_data!Method
update_pf_data!(
    pf_e_data::PowerSimulations.PowerFlowEvaluationData{PowerFlows.PSSEExporter},
    container::PowerSimulations.OptimizationContainer,
    time_step::Int64
)

Update a PowerFlowEvaluationData containing a PowerFlowContainer that does not supports_multi_period using a single time_step of the OptimizationContainer. To properly keep track of outer step number, time steps must be passed in sequentially, starting with 1.

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"#s250", L} where {var"#s250"<: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,
    array::JuMP.Containers.DenseAxisArray{Float64, 2, Ax, L} where {Ax, L<:Tuple{JuMP.Containers._AxisLookup, JuMP.Containers._AxisLookup}}
)

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"#s250", L} where {var"#s250"<:NTuple{N, Any}, L<:NTuple{N, JuMP.Containers._AxisLookup}}
)

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

source
PowerSystems.get_componentMethod
get_component(
    res::InfrastructureSystems.Results,
    uuid::Base.UUID
) -> Union{Nothing, InfrastructureSystems.InfrastructureSystemsComponent}

Calling get_component on a Results is the same as calling [get_available_component] on the system attached to the results.

source
PowerSystems.get_componentsMethod
get_components(
    ::Type{T<:InfrastructureSystems.InfrastructureSystemsComponent},
    res::InfrastructureSystems.Results;
    subsystem_name
) -> InfrastructureSystems.FlattenIteratorWrapper{T, I} where {T<:InfrastructureSystems.InfrastructureSystemsComponent, I<:(Vector)}

Calling get_components on a Results is the same as calling [get_available_components] on the system attached to the results.

source
PowerSystems.get_groupsMethod
get_groups(
    scope_limiter::Union{Nothing, Function},
    selector::ComponentSelector,
    res::InfrastructureSystems.Results
) -> Any

Calling get_groups on a Results is the same as calling [get_available_groups] on the system attached to the results.

source