Internal API
PowerSimulations.IGNORABLE_FILES — Constant
If the name of an extraneous file that appears in simulation results matches one of these regexes, it is safe to ignore
PowerSimulations.AbstractCostAtMinParameter — Type
Parameters to define the cost at the minimum available power
PowerSimulations.AbstractDeviceFormulation — Type
Abstract type for Device Formulations (a.k.a Models)
Example
import PowerSimulations const PSI = PowerSimulations struct MyCustomDeviceFormulation <: PSI.AbstractDeviceFormulation
PowerSimulations.AbstractDynamicBranchRatingTimeSeriesParameter — Type
Abstract type for dynamic ratings of AC branches
PowerSimulations.AbstractPiecewiseLinearBreakpointParameter — Type
Parameters to define the breakpoints of a piecewise linear function
PowerSimulations.AbstractPiecewiseLinearSlopeParameter — Type
Parameters to define the slopes of a piecewise linear cost function
PowerSimulations.AbstractSecurityConstrainedPTDFModel — Type
Linear active power approximation using the power transfer distribution factor PTDF matrix and line outage distribution factors LODF for branches outages.
PowerSimulations.AbstractServiceFormulation — Type
Abstract type for Service Formulations (a.k.a Models)
Example
import PowerSimulations const PSI = PowerSimulations struct MyServiceFormulation <: PSI.AbstractServiceFormulation
PowerSimulations.AbstractSimulationStatusEvent — Type
All events subtyped from this need to be recorded under :simulation_status.
PowerSimulations.CacheFlushRules — Type
Informs the flusher on what data to keep in cache.
PowerSimulations.ContinuousCondition — Type
ContinuousCondition()Establishes an event condition that is triggered at all timesteps.
PowerSimulations.ConverterCurrentDirection — Type
Struct to dispatch the creation of DC Converter Binary for Absolute Value Current Variables for DC formulations Docs abbreviation: \nu_c`
PowerSimulations.ConverterDCPower — Type
Struct to dispatch the creation of DC Converter Power Variables for DC formulations Docs abbreviation: $p_c^{dc}$
PowerSimulations.DCLineCurrentFlowVariable — Type
Struct to define the creation of HVDC DC Line Current Flow
Docs abbreviation: $\i_{d}$
PowerSimulations.DCLineLosses — Type
Auxiliary Variable of DC Current Variables for DC Lines formulations Docs abbreviation: $p_l^{loss}$
PowerSimulations.DCLosslessLine — Type
Lossless Line Abstract Model
PowerSimulations.DecisionModelStore — Type
Stores results data for one DecisionModel
PowerSimulations.DecisionProblem — Type
Abstract type for Decision Problems
Example
import PowerSimulations const PSI = PowerSimulations struct MyCustomProblem <: PSI.DecisionProblem
PowerSimulations.DecrementalCostAtMinParameter — Type
AbstractCostAtMinParameter for the decremental case (power sink)
PowerSimulations.DecrementalPiecewiseLinearBreakpointParameter — Type
AbstractPiecewiseLinearBreakpointParameter for the decremental case (power sink)
PowerSimulations.DecrementalPiecewiseLinearSlopeParameter — Type
AbstractPiecewiseLinearSlopeParameter for the decremental case (power sink)
PowerSimulations.DefaultDecisionProblem — Type
Abstract type for models than employ PowerSimulations methods. For custom decision problems use DecisionProblem as the super type.
PowerSimulations.DefaultEmulationProblem — Type
Abstract type for models than employ PowerSimulations methods. For custom emulation problems use EmulationProblem as the super type.
PowerSimulations.DiscreteEventCondition — Type
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 functionf(::SimulationState)to determine if event is triggered.
PowerSimulations.EmulationModelStore — Type
Stores results data for one EmulationModel
PowerSimulations.EmulationProblem — Type
Abstract type for Emulation Problems
Example
import PowerSimulations const PSI = PowerSimulations struct MyCustomEmulator <: PSI.EmulationProblem
PowerSimulations.GenericEmulationProblem — Type
Default PowerSimulations Emulation Problem Type for unspecified problems
PowerSimulations.HVDCActivePowerReceivedFromVariable — Type
Struct to dispatch the creation of HVDC Received Flow at From Bus Variables for PWL formulations
Docs abbreviation: $x$
PowerSimulations.HVDCActivePowerReceivedToVariable — Type
Struct to dispatch the creation of HVDC Received Flow at To Bus Variables for PWL formulations
Docs abbreviation: $y$
PowerSimulations.HVDCInverterACCurrentFlowConstraint — Type
Struct to create the constraint that calculates the AC Current flowing into the AC side of the inverter.
\[i_ ext{ac}^i = \sqrt{6} \frac{N^i}{\pi}I_d\]
PowerSimulations.HVDCInverterACCurrentVariable — Type
Struct to define the creation of HVDC AC Line Current flowing into the AC side of Inverter
Docs abbreviation: $\i_{ac}^i$
PowerSimulations.HVDCInverterDCLineVoltageConstraint — Type
Struct to create the constraint that calculates the Inverter DC line voltage.
\[v_d^i = \frac{3}{\pi}N^i \left( \sqrt{2}rac{a^i v_\text{ac}^i}{t^i}\cos{\gamma^i}-X^i I_d \right)\]
PowerSimulations.HVDCInverterDCVoltageVariable — Type
Struct to define the creation of HVDC DC Line Voltage at Inverter Side
Docs abbreviation: $\v_{d}^i$
PowerSimulations.HVDCInverterExtinctionAngleVariable — Type
Struct to define the creation of HVDC Inverter Extinction Angle Variable
Docs abbreviation: $\gamma^i$
PowerSimulations.HVDCInverterOverlapAngleConstraint — Type
Struct to create the constraint that calculates the Inverter Overlap Angle.
\[\mu^i = \arccos \left( \cos\gamma^i - \frac{\sqrt{2} I_d X^i t^r}{a^i v_\text{ac}^i} \right) - \gamma^i\]
PowerSimulations.HVDCInverterOverlapAngleVariable — Type
Struct to define the creation of HVDC Inverter Overlap Angle Variable
Docs abbreviation: $\mu^i$
PowerSimulations.HVDCInverterPowerCalculationConstraint — Type
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*}\]
PowerSimulations.HVDCInverterPowerFactorAngleConstraint — Type
Struct to create the constraint that calculates the Inverter Power Factor Angle.
\[\phi^i = \arctan \left( \frac{2\mu^i + \sin(2\gamma^i) - \sin(2(\mu^i + \gamma^i))}{\cos(2\gamma^i) - \cos(2(\mu^i + \gamma^i))} \right)\]
PowerSimulations.HVDCInverterPowerFactorAngleVariable — Type
Struct to define the creation of HVDC Inverter Power Factor Angle Variable
Docs abbreviation: $\phi^i$
PowerSimulations.HVDCInverterTapSettingVariable — Type
Struct to define the creation of HVDC Tap Setting at Inverter Transformer
Docs abbreviation: $\t^i$
PowerSimulations.HVDCPiecewiseBinaryLossVariable — Type
Struct to dispatch the creation of HVDC Piecewise Binary Loss Variables
Docs abbreviation: $z$
PowerSimulations.HVDCPiecewiseLossVariable — Type
Struct to dispatch the creation of HVDC Piecewise Loss Variables
Docs abbreviation: $h$ or $w$
PowerSimulations.HVDCReactivePowerReceivedFromVariable — Type
Struct to dispatch the creation of HVDC Received Reactive Flow From Bus Variables
Docs abbreviation: $x^r$
PowerSimulations.HVDCReactivePowerReceivedToVariable — Type
Struct to dispatch the creation of HVDC Received Reactive Flow To Bus Variables
Docs abbreviation: $y^i$
PowerSimulations.HVDCRectifierACCurrentFlowConstraint — Type
Struct to create the constraint that calculates the AC Current flowing into the AC side of the rectifier.
\[i_ ext{ac}^r = \sqrt{6} \frac{N^r}{\pi}I_d\]
PowerSimulations.HVDCRectifierACCurrentVariable — Type
Struct to define the creation of HVDC AC Line Current flowing into the AC side of Rectifier
Docs abbreviation: $\i_{ac}^r$
PowerSimulations.HVDCRectifierDCLineVoltageConstraint — Type
Struct to create the constraint that calculates the Rectifier DC line voltage.
\[v_d^r = \frac{3}{\pi}N^r \left( \sqrt{2}rac{a^r v_\text{ac}^r}{t^r}\cos{\alpha^r}-X^r I_d \right)\]
PowerSimulations.HVDCRectifierDCVoltageVariable — Type
Struct to define the creation of HVDC DC Line Voltage at Rectifier Side
Docs abbreviation: $\v_{d}^r$
PowerSimulations.HVDCRectifierDelayAngleVariable — Type
Struct to define the creation of HVDC Rectifier Delay Angle Variable
Docs abbreviation: $\alpha^r$
PowerSimulations.HVDCRectifierOverlapAngleConstraint — Type
Struct to create the constraint that calculates the Rectifier Overlap Angle.
\[\mu^r = \arccos \left( \cos\alpha^r - \frac{\sqrt{2} I_d X^r t^r}{a^r v_\text{ac}^r} \right) - \alpha^r\]
PowerSimulations.HVDCRectifierOverlapAngleVariable — Type
Struct to define the creation of HVDC Rectifier Overlap Angle Variable
Docs abbreviation: $\mu^r$
PowerSimulations.HVDCRectifierPowerCalculationConstraint — Type
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*}\]
PowerSimulations.HVDCRectifierPowerFactorAngleConstraint — Type
Struct to create the constraint that calculates the Rectifier Power Factor Angle.
\[\phi^r = \arctan \left( \frac{2\mu^r + \sin(2\alpha^r) - \sin(2(\mu^r + \alpha^r))}{\cos(2lpha^r) - \cos(2(\mu^r + \alpha^r))} \right)\]
PowerSimulations.HVDCRectifierPowerFactorAngleVariable — Type
Struct to define the creation of HVDC Rectifier Power Factor Angle Variable
Docs abbreviation: $\phi^r$
PowerSimulations.HVDCRectifierTapSettingVariable — Type
Struct to define the creation of HVDC Tap Setting at Rectifier Transformer
Docs abbreviation: $\t^r$
PowerSimulations.HVDCTransmissionDCLineConstraint — Type
Struct to create the constraint that links the AC and DC side of the network.
\[v_d^i = v_d^r - R_d I_d\]
PowerSimulations.HVDCTwoTerminalLCC — Type
Branch type to represent non-linear LCC (line commutated converter) model on two-terminal DC lines
PowerSimulations.HVDCTwoTerminalPiecewiseLoss — Type
Branch type to represent piecewise lossy power flow on two terminal DC lines
PowerSimulations.HdfSimulationStore — Type
Stores simulation data in an HDF file.
PowerSimulations.InMemorySimulationStore — Type
Stores simulation data in memory
PowerSimulations.IncrementalCostAtMinParameter — Type
AbstractCostAtMinParameter for the incremental case (power source)
PowerSimulations.IncrementalPiecewiseLinearBreakpointParameter — Type
AbstractPiecewiseLinearBreakpointParameter for the incremental case (power source)
PowerSimulations.IncrementalPiecewiseLinearSlopeParameter — Type
AbstractPiecewiseLinearSlopeParameter for the incremental case (power source)
PowerSimulations.InitialConditionChronology — Type
Supertype for initial condition chronologies
PowerSimulations.InitialConditionsData — Type
Stores data to populate initial conditions before the build call
PowerSimulations.LineFlowAuxVariableType — Type
Auxiliary Variable for line power flow results from power flow evaluation
PowerSimulations.LinearLossConverter — Type
Linear Loss InterconnectingConverter Model
PowerSimulations.MaxInterfaceFlowLimitParameter — Type
Parameter to define Max Flow limit for interface time series
PowerSimulations.MinInterfaceFlowLimitParameter — Type
Parameter to define Min Flow limit for interface time series
PowerSimulations.MultiStartVariable — Type
Multi-start startup variables
PowerSimulations.OperationModel — Type
Abstract type for Decision Model and Emulation Model. OperationModel structs are parameterized with DecisionProblem or Emulation Problem structs
PowerSimulations.OptimizationOutputCache — Type
Cache for a single parameter/variable/dual. Stores arrays chronologically by simulation timestamp.
PowerSimulations.OptimizationOutputCaches — Type
Cache for all model results
PowerSimulations.PiecewiseLinearBlockDecrementalOffer — Type
Struct to dispatch the creation of piecewise linear block decremental offer variables for objective function
Docs abbreviation: $\delta_d$
PowerSimulations.PiecewiseLinearBlockIncrementalOffer — Type
Struct to dispatch the creation of piecewise linear block incremental offer variables for objective function
Docs abbreviation: $\delta$
PowerSimulations.PiecewiseLinearUpperBoundConstraint — Type
Struct to create the PiecewiseLinearUpperBoundConstraint associated with a specified variable.
See Piecewise linear cost functions for more information.
PowerSimulations.PowerFlowAuxVariableType — Type
Auxiliary Variables that are calculated using a PowerFlowEvaluationModel
PowerSimulations.PresetTimeCondition — Type
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
PowerSimulations.ShutdownCostParameter — Type
Parameter to define shutdown cost time series
PowerSimulations.SimulationProblemResults — Type
Holds the results of a simulation problem for plotting or exporting.
PowerSimulations.SimulationStore — Type
Provides storage of simulation data
PowerSimulations.StartupCostParameter — Type
Parameter to define startup cost time series
PowerSimulations.StateVariableValueCondition — Type
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 monitoreddevice_type::Type{<:PSY.Device}: device type to be monitoreddevice_name::String: name of monitored devicevalue::Float64: value to compare to in p.u.
Base.empty! — Method
empty!(store::PowerSimulations.EmulationModelStore)
Base.empty!(store::EmulationModelStore)Empty the EmulationModelStore
Base.empty! — Method
empty!(cache::PowerSimulations.OptimizationOutputCaches)
Base.empty!(cache::OptimizationOutputCaches)Empty the OptimizationOutputCaches
Base.empty! — Method
empty!(cache::PowerSimulations.OptimizationOutputCache)
Base.empty!(cache::OptimizationOutputCache)Empty the OptimizationOutputCache
Base.empty! — Method
InfrastructureSystems.Optimization.read_results_with_keys — Method
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 aDict{OptimizationContainerKey, DataFrame}with these as the keysstart_time::Union{Nothing, Dates.DateTime} = nothing: the time at which the resulting time series should begin;nothingindicates the first time in the resultslen::Union{Int, Nothing} = nothing: the number of steps in the resulting time series;nothingindicates up to the end of the resultscols::Union{Colon, Vector{String}} = (:): which columns to fetch; defaults to:, i.e., all the columns
InfrastructureSystems.Optimization.to_matrix — Method
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.
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 ofDataTypeobjects that defines the order of precedence for the variables that correspond to the category of variables (e.g.:active_power- first look forActivePowerVariablefor the component type, if not available thenPowerOutput, and finallyActivePowerTimeSeriesParameter).available_keys::Vector{Pair{OptimizationContainerKey, Any}}: A vector of key-value pairs where the key is anOptimizationContainerKeyand 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.
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 typedevices::IS.FlattenIteratorWrapper{W}: Collection of devices to apply constraints todic_var_bkpts::Dict{String, Vector{Float64}}: Breakpoints in the domain (x-coordinates) for each devicedic_function_bkpts::Dict{String, Vector{Float64}}: Function values at breakpoints (y-coordinates) for each devicemeta: Metadata for constraint naming (default: empty)
Type Parameters
R <: VariableType: Original variable typeS <: VariableType: Approximated variable typeT <: VariableType: Interpolation variable typeU <: VariableType: Binary interpolation variable typeV <: ConstraintType: Constraint typeW <: 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
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\]
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\]
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}\]
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}\]
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\]
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
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
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:Systeminstance 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 thePowerFlowDatainstance.
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
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
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
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
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
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
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
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
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
PowerSimulations._allocate_execution_order — Method
_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
PowerSimulations._calculate_interval_inner_counts — Method
_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
PowerSimulations._get_breakpoints_for_pwl_function — Method
_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 approximationmax_val::Float64: Maximum value of the domain for the PWL approximationf: 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 domainy_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_valand the last atmax_val
PowerSimulations._get_data_for_tdc — Method
_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.
PowerSimulations._get_initial_condition_type — Method
_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
PowerSimulations._get_pwl_cost_expression — Method
_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
PowerSimulations._lookup_maybe_time_variant_param — Method
_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
PowerSimulations._summary_to_dict! — Method
_summary_to_dict!(
optimizer_stats::OptimizerStats,
jump_model::JuMP.Model
)
Run this function only when getting detailed solver stats
PowerSimulations._validate_eltype — Method
_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
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)
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
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
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
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
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
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
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
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
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
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)$
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}$
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)$
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
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
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
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
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
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
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
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)
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
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
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
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
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
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
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
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
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
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
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$
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$
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
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 }$
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 }$
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},$
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},$
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.
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$
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 }$
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 todevices: 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 boundsnum_segments::Int: Number of linear segments in the PWL approximation (default: DEFAULTINTERPOLATIONLENGTH)
Type Parameters
T <: Union{InterpolationVariableType, BinaryInterpolationVariableType}: Variable type to createU <: PSY.Component: Component type for devicesV <: AbstractDeviceFormulation: Device formulation type for bounds
Notes
- Binary variables have
num_segments - 1variables (control transitions between segments) - Continuous variables have
num_segmentsvariables (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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
PowerSimulations.add_variable! — Method
add_variable!(
container::PowerSimulations.OptimizationContainer,
variable_type::ServiceRequirementVariable,
service::ReserveDemandCurve,
formulation
)
Add variables for ServiceRequirementVariable for StepWiseCostReserve
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.
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
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
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.
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.
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.
PowerSimulations.apply_maybe_across_time_series — Method
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
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
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
PowerSimulations.check_activeservice_variables — Method
check_activeservice_variables(
container::PowerSimulations.OptimizationContainer,
contributing_services::Array{T<:Service, 1}
)
This function checks if the variables for reserves were created
PowerSimulations.check_file_integrity — Method
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.PowerSimulations.container_spec — Method
container_spec(
_::Type{Float64},
axs...
) -> JuMP.Containers.DenseAxisArray
Returns the correct container specification for the selected type of JuMP Model
PowerSimulations.container_spec — Method
container_spec(
_::Type{T},
axs...
) -> JuMP.Containers.DenseAxisArray
Returns the correct container specification for the selected type of JuMP Model
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
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
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
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
PowerSimulations.find_key_with_value — Method
find_key_with_value(d, value) -> Any
Return the key for the given value
PowerSimulations.find_timestamp_index — Method
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.
PowerSimulations.generate_formulation_combinations — Function
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.
PowerSimulations.get_absolute_step_range — Method
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.
PowerSimulations.get_column_names — Method
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}.
PowerSimulations.get_column_names_from_key — Method
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.
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.
PowerSimulations.get_enum_value — Method
get_enum_value(enum, value::String) -> Any
Get the enum value for the string. Case insensitive.
PowerSimulations.get_last_updated_timestamp — Method
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
PowerSimulations.get_last_updated_timestamp — Method
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
PowerSimulations.get_last_updated_timestamp — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
get_min_max_limits(
device,
_::Type{ReactivePowerVariableLimitsConstraint},
_::Type{<:PowerSimulations.AbstractThermalDispatchFormulation}
) -> Any
Reactive power limits of generators for all dispatch formulations
PowerSimulations.get_min_max_limits — Method
get_min_max_limits(
device,
_::Type{ReactivePowerVariableLimitsConstraint},
_::Type{<:PowerSimulations.AbstractThermalUnitCommitment}
) -> Any
Reactive power limits of generators when there CommitmentVariables
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
get_min_max_limits(
_::PhaseShiftingTransformer,
_::Type{PhaseAngleControlLimit},
_::Type{PhaseAngleControl}
) -> @NamedTuple{min::Float64, max::Float64}
Min and max limits for Abstract Branch Formulation
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_min_max_limits — Method
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
PowerSimulations.get_piecewise_curve_per_system_unit — Method
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.
PowerSimulations.get_piecewise_pointcurve_per_system_unit — Method
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
PowerSimulations.get_proportional_cost_per_system_unit — Method
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
PowerSimulations.get_quadratic_cost_per_system_unit — Method
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
PowerSimulations.get_startup_shutdown_limits — Method
get_startup_shutdown_limits(
device,
_::Type{ActivePowerVariableLimitsConstraint},
_::Type{<:PowerSimulations.AbstractCompactUnitCommitment}
) -> @NamedTuple{startup::Float64, shutdown::Float64}
Startup shutdown limits for Compact Unit Commitment
PowerSimulations.get_startup_shutdown_limits — Method
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
PowerSimulations.get_update_timestamp — Method
get_update_timestamp(
s::PowerSimulations.AbstractDataset
) -> Any
Return the timestamp from the data used in the last update
PowerSimulations.get_update_timestamp — Method
get_update_timestamp(
container::PowerSimulations.DatasetContainer,
key::InfrastructureSystems.Optimization.OptimizationContainerKey
) -> Any
Return the timestamp from the data used in the last update
PowerSimulations.get_valid_step_length — Method
get_valid_step_length(
partitions::SimulationPartitions,
index::Int64
) -> Int64
Return the length of valid data at the given index.
PowerSimulations.get_valid_step_offset — Method
get_valid_step_offset(
partitions::SimulationPartitions,
index::Int64
) -> Int64
Return the step offset for valid data at the given index.
PowerSimulations.has_dirty — Method
has_dirty(
cache::PowerSimulations.OptimizationOutputCaches
) -> Bool
Return true if the cache has data that has not been flushed to storage.
PowerSimulations.is_cached — Method
is_cached(
cache::PowerSimulations.OptimizationOutputCaches,
model_name,
key,
index
) -> Bool
Return true if the data for timestamp is stored in cache.
PowerSimulations.is_from_power_flow — Method
is_from_power_flow(
_::Type{<:InfrastructureSystems.Optimization.AuxVariableType}
) -> Bool
Whether the auxiliary variable is calculated using a PowerFlowEvaluationModel
PowerSimulations.join_simulation — Method
join_simulation(path::AbstractString)
Combine all partition simulation files.
PowerSimulations.latest_solved_power_flow_evaluation_data — Method
latest_solved_power_flow_evaluation_data(
container::PowerSimulations.OptimizationContainer
) -> PowerSimulations.PowerFlowEvaluationData
Fetch the most recently solved PowerFlowEvaluationData
PowerSimulations.list_decision_model_keys — Method
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).
PowerSimulations.list_decision_models — Method
list_decision_models(
store::PowerSimulations.HdfSimulationStore
) -> Base.KeySet{Symbol, OrderedDict{Symbol, PowerSimulations.DatasetContainer{PowerSimulations.HDF5Dataset}}}
Return the problem names in order of execution.
PowerSimulations.log_cache_hit_percentages — Method
log_cache_hit_percentages(
cache::PowerSimulations.OptimizationOutputCaches
)
Log the cache hit percentages for all caches.
PowerSimulations.lookup_additional_axes — Method
lookup_additional_axes(parameter_array) -> Any
Given a parameter array, get any additional axes, i.e., those that aren't the first (component) or the last (time)
PowerSimulations.onvar_cost — Method
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
PowerSimulations.open_store — Function
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 filemode::AbstractString: Mode to use to open the store filefilename::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)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
PowerSimulations.read_dataframe — Method
read_dataframe(
filename::AbstractString
) -> DataFrames.DataFrame
Return a DataFrame from a CSV file.
PowerSimulations.read_json — Method
read_json(
filename::AbstractString
) -> Union{Nothing, Bool, Float64, Int64, String, JSON3.Array, JSON3.Object}
Return a decoded JSON file.
PowerSimulations.read_result — Method
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.
PowerSimulations.read_result — Method
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.
PowerSimulations.serialize_formulation_combinations — Function
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.
PowerSimulations.serialize_jump_optimization_model — Method
serialize_jump_optimization_model(
jump_model::JuMP.Model,
save_path::String
)
Exports the JuMP object in MathOptFormat
PowerSimulations.serialize_simulation — Method
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 serializepath = ".": path in which to create the serialzed directoryforce = false: If true, delete the directory if it already exists. Otherwise, it will throw an exception.
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
PowerSimulations.set_ic_quantity! — Method
set_ic_quantity!(
ic::InitialCondition{T<:InfrastructureSystems.Optimization.InitialConditionType, Float64},
var_value::Float64
)
Default implementation of setinitialcondition_value
PowerSimulations.set_ic_quantity! — Method
set_ic_quantity!(
ic::InitialCondition{T<:InfrastructureSystems.Optimization.InitialConditionType, JuMP.VariableRef},
var_value::Float64
)
Default implementation of setinitialcondition_value
PowerSimulations.solve_impl! — Method
solve_impl!(
container::PowerSimulations.OptimizationContainer,
system::System
) -> Any
Default solve method for OptimizationContainer
PowerSimulations.sparse_container_spec — Method
sparse_container_spec(
_::Type{T<:JuMP.AbstractJuMPScalar},
axs...
) -> JuMP.Containers.SparseAxisArray
Returns the correct container specification for the selected type of JuMP Model
PowerSimulations.to_dataframe — Method
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 convertkey::OptimizationContainerKey:
PowerSimulations.to_results_dataframe — Method
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 converttimestamps: 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.
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
PowerSimulations.update_model! — Method
update_model!(
model::PowerSimulations.OperationModel,
sim::Simulation
)
Default problem update function for most problems with no customization
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
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
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.
PowerSimulations.variable_reactive_net_injection — Method
variable_reactive_net_injection(
pm::PowerModels.AbstractActivePowerModel;
kwargs...
)
active power only models ignore reactive power variables
PowerSimulations.write_formulation_combinations — Function
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.
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.
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
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.
PowerSystems.get_component — Method
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.
PowerSystems.get_components — Method
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.
PowerSystems.get_groups — Method
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.