Internal API
PowerSimulations.IGNORABLE_FILES
— ConstantIf the name of an extraneous file that appears in simulation results matches one of these regexes, it is safe to ignore
PowerSimulations.AbstractDeviceFormulation
— TypeAbstract type for Device Formulations (a.k.a Models)
Example
import PowerSimulations const PSI = PowerSimulations struct MyCustomDeviceFormulation <: PSI.AbstractDeviceFormulation
PowerSimulations.AbstractServiceFormulation
— TypeAbstract type for Service Formulations (a.k.a Models)
Example
import PowerSimulations const PSI = PowerSimulations struct MyServiceFormulation <: PSI.AbstractServiceFormulation
PowerSimulations.AbstractSimulationStatusEvent
— TypeAll events subtyped from this need to be recorded under :simulation_status.
PowerSimulations.CacheFlushRules
— TypeInforms the flusher on what data to keep in cache.
PowerSimulations.DecisionModelStore
— TypeStores results data for one DecisionModel
PowerSimulations.DecisionProblem
— TypeAbstract type for Decision Problems
Example
import PowerSimulations const PSI = PowerSimulations struct MyCustomProblem <: PSI.DecisionProblem
PowerSimulations.DefaultDecisionProblem
— TypeAbstract type for models than employ PowerSimulations methods. For custom decision problems use DecisionProblem as the super type.
PowerSimulations.DefaultEmulationProblem
— TypeAbstract type for models than employ PowerSimulations methods. For custom emulation problems use EmulationProblem as the super type.
PowerSimulations.EmulationModelStore
— TypeStores results data for one EmulationModel
PowerSimulations.EmulationProblem
— TypeAbstract type for Emulation Problems
Example
import PowerSimulations const PSI = PowerSimulations struct MyCustomEmulator <: PSI.EmulationProblem
PowerSimulations.FromToFlowLimitParameter
— TypeParameter to define Flow From_To limit time series
PowerSimulations.GenericEmulationProblem
— TypeDefault PowerSimulations Emulation Problem Type for unspecified problems
PowerSimulations.HVDCActivePowerReceivedFromVariable
— TypeStruct to dispatch the creation of HVDC Received Flow at From Bus Variables for PWL formulations
Docs abbreviation: $x$
PowerSimulations.HVDCActivePowerReceivedToVariable
— TypeStruct to dispatch the creation of HVDC Received Flow at To Bus Variables for PWL formulations
Docs abbreviation: $y$
PowerSimulations.HVDCPiecewiseBinaryLossVariable
— TypeStruct to dispatch the creation of HVDC Piecewise Binary Loss Variables
Docs abbreviation: $z$
PowerSimulations.HVDCPiecewiseLossVariable
— TypeStruct to dispatch the creation of HVDC Piecewise Loss Variables
Docs abbreviation: $h$ or $w$
PowerSimulations.HVDCTwoTerminalPiecewiseLoss
— TypeBranch type to represent piecewise lossy power flow on two terminal DC lines
PowerSimulations.HdfSimulationStore
— TypeStores simulation data in an HDF file.
PowerSimulations.InMemorySimulationStore
— TypeStores simulation data in memory
PowerSimulations.InitialConditionChronology
— TypeSupertype for initial condition chronologies
PowerSimulations.InitialConditionsData
— TypeStores data to populate initial conditions before the build call
PowerSimulations.MaxInterfaceFlowLimitParameter
— TypeParameter to define Max Flow limit for interface time series
PowerSimulations.MinInterfaceFlowLimitParameter
— TypeParameter to define Min Flow limit for interface time series
PowerSimulations.OperationModel
— TypeAbstract type for Decision Model and Emulation Model. OperationModel structs are parameterized with DecisionProblem or Emulation Problem structs
PowerSimulations.OptimizationOutputCache
— TypeCache for a single parameter/variable/dual. Stores arrays chronologically by simulation timestamp.
PowerSimulations.OptimizationOutputCaches
— TypeCache for all model results
PowerSimulations.PieceWiseLinearBlockOffer
— TypeStruct to dispatch the creation of piecewise linear block offer variables for objective function
Docs abbreviation: $\delta$
PowerSimulations.PieceWiseLinearBlockOfferConstraint
— TypeStruct to create the PieceWiseLinearBlockOfferConstraint associated with a specified variable.
See Piecewise linear cost functions for more information.
PowerSimulations.PieceWiseLinearUpperBoundConstraint
— TypeStruct to create the PieceWiseLinearUpperBoundConstraint associated with a specified variable.
See Piecewise linear cost functions for more information.
PowerSimulations.SimulationProblemResults
— TypeHolds the results of a simulation problem for plotting or exporting.
PowerSimulations.SimulationStore
— TypeProvides storage of simulation data
PowerSimulations.ToFromFlowLimitParameter
— TypeParameter to define Flow To_From limit time series
Base.empty!
— Methodempty!(store::PowerSimulations.EmulationModelStore)
Base.empty!(store::EmulationModelStore)
Empty the EmulationModelStore
Base.empty!
— Methodempty!(cache::PowerSimulations.OptimizationOutputCaches)
Base.empty!(cache::OptimizationOutputCaches)
Empty the OptimizationOutputCaches
Base.empty!
— Methodempty!(cache::PowerSimulations.OptimizationOutputCache)
Base.empty!(cache::OptimizationOutputCache)
Empty the OptimizationOutputCache
Base.empty!
— MethodInfrastructureSystems.Optimization.read_results_with_keys
— Methodread_results_with_keys(
res::PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults},
result_keys::Vector{<:InfrastructureSystems.Optimization.OptimizationContainerKey};
start_time,
len,
cols
) -> Dict{InfrastructureSystems.Optimization.OptimizationContainerKey, DataFrames.DataFrame}
High-level function to read a DataFrame of results.
Arguments
res
: the results to read.result_keys::Vector{<:OptimizationContainerKey}
: the keys to read. Output will be aDict{OptimizationContainerKey, DataFrame}
with these as the keysstart_time::Union{Nothing, Dates.DateTime} = nothing
: the time at which the resulting time series should begin;nothing
indicates the first time in the resultslen::Union{Int, Nothing} = nothing
: the number of steps in the resulting time series;nothing
indicates up to the end of the resultscols::Union{Colon, Vector{String}} = (:)
: which columns to fetch; defaults to:
, i.e., all the columns
PowerSimulations._add_pwl_constraint!
— Method_add_pwl_constraint!(
container::PowerSimulations.OptimizationContainer,
component::Component,
_::InfrastructureSystems.Optimization.VariableType,
break_points::Vector{Float64},
period::Int64
)
Implement the constraints for PWL Block Offer variables. That is:
\[\sum_{k\in\mathcal{K}} \delta_{k,t} = p_t \\ \sum_{k\in\mathcal{K}} \delta_{k,t} <= P_{k+1,t}^{max} - P_{k,t}^{max}\]
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_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::MarketBidCost,
_::CostCurve{PiecewiseIncrementalCurve},
_::InfrastructureSystems.Optimization.VariableType,
_::PowerSimulations.AbstractDeviceFormulation
) -> Vector{JuMP.AffExpr}
Add PWL cost terms for data coming from the MarketBidCost with a fixed incremental offer curve
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_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{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{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::MarketBidCost,
_::PowerSimulations.AbstractDeviceFormulation
)
Creates piecewise linear market bid function using a sum of variables and expression for market participants. Decremental offers are not accepted for most components, except Storage systems and loads.
Arguments
- container::OptimizationContainer : the optimization_container model built in PowerSimulations
- var_key::VariableKey: The variable name
- componentname::String: The componentname of the variable container
- cost_function::MarketBidCost : container for market bid cost
PowerSimulations._add_variable_cost_to_objective!
— Method_add_variable_cost_to_objective!(
container::PowerSimulations.OptimizationContainer,
_::InfrastructureSystems.Optimization.VariableType,
component::Component,
cost_function::Union{CostCurve{PiecewisePointCurve}, 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::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._create_time_series_multiplier_index
— Method_create_time_series_multiplier_index(
model,
_::Type{T<:InfrastructureSystems.Optimization.TimeSeriesParameter}
) -> Union{Nothing, Int64}
Function to create a unique index of time series names for each device model. For example, if two parameters each reference the same time series name, this function will return a different value for each parameter entry
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,
cost_data::PiecewiseStepData,
multiplier::Float64
) -> JuMP.AffExpr
Get cost expression for StepwiseCostReserve
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.add_constraints!
— Methodadd_constraints!(
container::PowerSimulations.OptimizationContainer,
_::Type{NetworkFlowConstraint},
devices::InfrastructureSystems.FlattenIteratorWrapper{B<:ACBranch},
model::DeviceModel{B<:ACBranch, <:PowerSimulations.AbstractBranchFormulation},
network_model::NetworkModel{<:PowerSimulations.AbstractPTDFModel}
)
Add network flow constraints for ACBranch and NetworkModel with <: AbstractPTDFModel
PowerSimulations.add_constraints!
— Methodadd_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!
— Methodadd_constraints!(
container::PowerSimulations.OptimizationContainer,
cons_type::Type{RateLimitConstraintFromTo},
devices::InfrastructureSystems.FlattenIteratorWrapper{B<:ACBranch},
device_model::DeviceModel{B<:ACBranch, <:PowerSimulations.AbstractBranchFormulation},
network_model::NetworkModel{T<:PowerModels.AbstractPowerModel}
)
Add rate limit from to constraints for ACBranch with AbstractPowerModel
PowerSimulations.add_constraints!
— Methodadd_constraints!(
container::PowerSimulations.OptimizationContainer,
cons_type::Type{RateLimitConstraintToFrom},
devices::InfrastructureSystems.FlattenIteratorWrapper{B<:ACBranch},
_::DeviceModel{B<:ACBranch, <:PowerSimulations.AbstractBranchFormulation},
network_model::NetworkModel{T<:PowerModels.AbstractPowerModel}
)
Add rate limit to from constraints for ACBranch with AbstractPowerModel
PowerSimulations.add_constraints!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_constraints!(
_::PowerSimulations.OptimizationContainer,
_::Type{RateLimitConstraintFromTo},
devices::InfrastructureSystems.FlattenIteratorWrapper{T<:MonitoredLine},
model::DeviceModel{T<:MonitoredLine, U<:StaticBranchUnbounded},
_::NetworkModel{V<:PowerModels.AbstractActivePowerModel}
)
Don't add branch flow constraints for monitored lines if formulation is StaticBranchUnbounded
PowerSimulations.add_constraints!
— Methodadd_constraints!(
container::PowerSimulations.OptimizationContainer,
cons_type::Type{RateLimitConstraint},
devices::InfrastructureSystems.FlattenIteratorWrapper{T<:ACBranch},
device_model::DeviceModel{T<:ACBranch, U<:PowerSimulations.AbstractBranchFormulation},
network_model::NetworkModel{V<:PowerModels.AbstractActivePowerModel}
)
Add branch rate limit constraints for ACBranch with AbstractActivePowerModel
PowerSimulations.add_constraints!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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_range_constraints!
— Methodadd_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!
— Methodadd_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!
— Methodadd_reserve_range_constraints!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:Union{OutputActivePowerVariableLimitsConstraint, ReactivePowerVariableLimitsConstraint}},
_::Type{U<:InfrastructureSystems.Optimization.ExpressionType},
devices::InfrastructureSystems.FlattenIteratorWrapper{W<:Component},
model::DeviceModel{W<:Component, X<:PowerSimulations.AbstractDeviceFormulation},
_::Type{Y<:PowerModels.AbstractPowerModel}
)
Constructs min/max range constraint from device variable and reservation decision variable.
varcts[name, t] <= limits.max * varbin[name, t]
varcts[name, t] >= limits.min * varbin[name, t]
where limits in constraint_infos.
LaTeX
$limits^{min} x^{bin} \leq x^{cts} \leq limits^{max} x^{bin},$
PowerSimulations.add_reserve_range_constraints!
— Methodadd_reserve_range_constraints!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:Union{OutputActivePowerVariableLimitsConstraint, ReactivePowerVariableLimitsConstraint}},
_::Type{U<:InfrastructureSystems.Optimization.VariableType},
devices::InfrastructureSystems.FlattenIteratorWrapper{W<:Component},
model::DeviceModel{W<:Component, X<:PowerSimulations.AbstractDeviceFormulation},
_::Type{Y<:PowerModels.AbstractPowerModel}
)
Constructs min/max range constraint from device variable and reservation decision variable.
varcts[name, t] <= limits.max * varbin[name, t]
varcts[name, t] >= limits.min * varbin[name, t]
where limits in constraint_infos.
LaTeX
$limits^{min} x^{bin} \leq x^{cts} \leq limits^{max} x^{bin},$
PowerSimulations.add_result!
— Methodadd_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!
— Methodadd_semicontinuous_ramp_constraints!(
container::PowerSimulations.OptimizationContainer,
T::Type{<:InfrastructureSystems.Optimization.ConstraintType},
U::Type{S<:Union{ActivePowerVariable, PowerAboveMinimumVariable}},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Component},
_::DeviceModel{V<:Component, W<:PowerSimulations.AbstractDeviceFormulation},
_::Type{<:PowerModels.AbstractPowerModel}
)
Constructs allowed rate-of-change constraints from variables, initial condtions, start/stop status, and rate data
Equations
If t = 1:
variable[name, 1] - initial_conditions[ix].value <= rate_data[1][ix].up + rate_data[2][ix].max*varstart[name, 1]
initial_conditions[ix].value - variable[name, 1] <= rate_data[1][ix].down + rate_data[2][ix].min*varstop[name, 1]
If t > 1:
variable[name, t] - variable[name, t-1] <= rate_data[1][ix].up + rate_data[2][ix].max*varstart[name, t]
variable[name, t-1] - variable[name, t] <= rate_data[1][ix].down + rate_data[2][ix].min*varstop[name, t]
LaTeX
$r^{down} + r^{min} x^{stop}_1 \leq x_1 - x_{init} \leq r^{up} + r^{max} x^{start}_1, \text{ for } t = 1$
$r^{down} + r^{min} x^{stop}_t \leq x_t - x_{t-1} \leq r^{up} + r^{max} x^{start}_t, \forall t \geq 2$
PowerSimulations.add_semicontinuous_range_constraints!
— Methodadd_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_to_expression!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:FlowActivePowerToFromVariable},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
_::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.AbstractTwoTerminalDCLineFormulation},
network_model::NetworkModel{PTDFPowerModel}
)
Default implementation to add branch variables to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:FlowActivePowerVariable},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:ACBranch},
_::DeviceModel{V<:ACBranch, W<:PowerSimulations.AbstractBranchFormulation},
network_model::NetworkModel{PTDFPowerModel}
)
Implementation of addtoexpression! for lossless branch/network models
PowerSimulations.add_to_expression!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:InfrastructureSystems.Optimization.VariableType},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
device_model::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
network_model::NetworkModel{PTDFPowerModel}
)
Default implementation to add variables to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_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!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:FlowActivePowerFromToVariable},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
_::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.AbstractTwoTerminalDCLineFormulation},
network_model::NetworkModel{X<:CopperPlatePowerModel}
)
Default implementation to add branch variables to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:FlowActivePowerFromToVariable},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
_::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.AbstractTwoTerminalDCLineFormulation},
network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)
Default implementation to add branch variables to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_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!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:FlowActivePowerToFromVariable},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
_::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.AbstractTwoTerminalDCLineFormulation},
network_model::NetworkModel{X<:CopperPlatePowerModel}
)
Default implementation to add branch variables to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_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!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:HVDCLosses},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
_::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:HVDCTwoTerminalDispatch},
network_model::NetworkModel{X<:Union{CopperPlatePowerModel, PTDFPowerModel}}
)
Default implementation to add branch variables to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:PowerSimulations.HVDCActivePowerReceivedFromVariable},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
_::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.HVDCTwoTerminalPiecewiseLoss},
network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)
PWL implementation to add FromTo branch variables to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:ActivePowerBalance},
_::Type{U<:PowerSimulations.HVDCActivePowerReceivedToVariable},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}},
_::DeviceModel{V<:Union{TwoTerminalHVDCLine, TwoTerminalVSCDCLine}, W<:PowerSimulations.HVDCTwoTerminalPiecewiseLoss},
network_model::NetworkModel{X<:PowerSimulations.AbstractPTDFModel}
)
PWL implementation to add FromTo branch variables to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_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!
— Methodadd_to_expression!(
container::PowerSimulations.OptimizationContainer,
_::Type{T<:SystemBalanceExpressions},
_::Type{U<:InfrastructureSystems.Optimization.TimeSeriesParameter},
devices::InfrastructureSystems.FlattenIteratorWrapper{V<:StaticInjection},
device_model::DeviceModel{V<:StaticInjection, W<:PowerSimulations.AbstractDeviceFormulation},
network_model::NetworkModel{X<:CopperPlatePowerModel}
)
Default implementation to add parameters to SystemBalanceExpressions
PowerSimulations.add_to_expression!
— Methodadd_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!
— Methodadd_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_variable!
— Methodadd_variable!(
container::PowerSimulations.OptimizationContainer,
variable_type::ServiceRequirementVariable,
service::ReserveDemandCurve,
formulation
)
Add variables for ServiceRequirementVariable for StepWiseCostReserve
PowerSimulations.add_variable!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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!
— Methodadd_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.build_model!
— Methodbuild_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!
— Methodbuild_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
— Methodcheck_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
— Methodcheck_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!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ArgumentConstructStage,
model::DeviceModel{T<:ThermalGen, D<:PowerSimulations.AbstractStandardUnitCommitment},
network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)
This function creates the arguments model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ArgumentConstructStage,
model::DeviceModel{T<:ThermalGen, D<:PowerSimulations.AbstractStandardUnitCommitment},
network_model::NetworkModel
)
This function creates the arguments for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ArgumentConstructStage,
model::DeviceModel{T<:ThermalGen, ThermalBasicUnitCommitment},
network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)
This function creates the arguments for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ArgumentConstructStage,
model::DeviceModel{T<:ThermalGen, ThermalBasicUnitCommitment},
network_model::NetworkModel
)
This function creates the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ArgumentConstructStage,
model::DeviceModel{T<:ThermalGen, ThermalStandardDispatch},
network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)
This function creates the arguments for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ArgumentConstructStage,
model::DeviceModel{T<:ThermalGen, ThermalStandardDispatch},
network_model::NetworkModel
)
This function creates the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ModelConstructStage,
model::DeviceModel{T<:ThermalGen, <:PowerSimulations.AbstractStandardUnitCommitment},
network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)
This function creates the constraints for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ModelConstructStage,
model::DeviceModel{T<:ThermalGen, <:PowerSimulations.AbstractStandardUnitCommitment},
network_model::NetworkModel
)
This function creates the constraints for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ModelConstructStage,
model::DeviceModel{T<:ThermalGen, ThermalBasicUnitCommitment},
network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)
This function creates the constraints for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ModelConstructStage,
model::DeviceModel{T<:ThermalGen, ThermalBasicUnitCommitment},
network_model::NetworkModel
)
This function creates the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ModelConstructStage,
model::DeviceModel{T<:ThermalGen, ThermalStandardDispatch},
network_model::NetworkModel{<:PowerModels.AbstractActivePowerModel}
)
This function creates the constraints for the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_device!
— Methodconstruct_device!(
container::PowerSimulations.OptimizationContainer,
sys::System,
_::InfrastructureSystems.Optimization.ModelConstructStage,
model::DeviceModel{T<:ThermalGen, ThermalStandardDispatch},
network_model::NetworkModel
)
This function creates the model for a full thermal dispatch formulation depending on combination of devices, deviceformulation and systemformulation
PowerSimulations.construct_service!
— Methodconstruct_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
— Methodcontainer_spec(
_::Type{Float64},
axs...
) -> JuMP.Containers.DenseAxisArray
Returns the correct container specification for the selected type of JuMP Model
PowerSimulations.container_spec
— Methodcontainer_spec(
_::Type{T},
axs...
) -> JuMP.Containers.DenseAxisArray
Returns the correct container specification for the selected type of JuMP Model
PowerSimulations.device_duration_compact_retrospective!
— Methoddevice_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!
— Methoddevice_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!
— Methoddevice_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!
— Methoddevice_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
— Methodfind_key_with_value(d, value) -> Any
Return the key for the given value
PowerSimulations.find_timestamp_index
— Methodfind_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
— Functiongenerate_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
— Methodget_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_dirty_data_to_flush!
— Methodget_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
— Methodget_enum_value(enum, value::String) -> Any
Get the enum value for the string. Case insensitive.
PowerSimulations.get_last_updated_timestamp
— Methodget_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
— Methodget_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
— Methodget_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
— Methodget_min_max_limits(
device::ACBranch,
_::Type{<:InfrastructureSystems.Optimization.ConstraintType},
_::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}
Min and max limits for Abstract Branch Formulation
PowerSimulations.get_min_max_limits
— Methodget_min_max_limits(
device,
_::Type{ActivePowerVariableLimitsConstraint},
_::Type{<:PowerSimulations.AbstractCompactUnitCommitment}
) -> Any
Min and Max active power limits for Compact Unit Commitment
PowerSimulations.get_min_max_limits
— Methodget_min_max_limits(
device,
_::Type{ActivePowerVariableLimitsConstraint},
_::Type{<:PowerSimulations.AbstractThermalDispatchFormulation}
) -> Any
Min and max active power limits of generators for thermal dispatch formulations
PowerSimulations.get_min_max_limits
— Methodget_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
— Methodget_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
— Methodget_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
— Methodget_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
— Methodget_min_max_limits(
device,
_::Type{ReactivePowerVariableLimitsConstraint},
_::Type{<:PowerSimulations.AbstractThermalDispatchFormulation}
) -> Any
Reactive power limits of generators for all dispatch formulations
PowerSimulations.get_min_max_limits
— Methodget_min_max_limits(
device,
_::Type{ReactivePowerVariableLimitsConstraint},
_::Type{<:PowerSimulations.AbstractThermalUnitCommitment}
) -> Any
Reactive power limits of generators when there CommitmentVariables
PowerSimulations.get_min_max_limits
— Methodget_min_max_limits(
device::MonitoredLine,
_::Type{<:InfrastructureSystems.Optimization.ConstraintType},
_::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}
Min and max limits for monitored line
PowerSimulations.get_min_max_limits
— Methodget_min_max_limits(
device::MonitoredLine,
_::Type{FlowLimitFromToConstraint},
_::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}
Min and max limits for flow limit from-to constraint
PowerSimulations.get_min_max_limits
— Methodget_min_max_limits(
device::MonitoredLine,
_::Type{FlowLimitToFromConstraint},
_::Type{<:PowerSimulations.AbstractBranchFormulation}
) -> NamedTuple{(:min, :max), <:Tuple{Any, Any}}
Min and max limits for flow limit to-from constraint
PowerSimulations.get_min_max_limits
— Methodget_min_max_limits(
_::PhaseShiftingTransformer,
_::Type{PhaseAngleControlLimit},
_::Type{PhaseAngleControl}
) -> @NamedTuple{min::Float64, max::Float64}
Min and max limits for Abstract Branch Formulation
PowerSimulations.get_piecewise_incrementalcurve_per_system_unit
— Methodget_piecewise_incrementalcurve_per_system_unit(
cost_component::PiecewiseStepData,
unit_system::UnitSystem,
system_base_power::Float64,
device_base_power::Float64
) -> PiecewiseStepData
Obtain the normalized PiecewiseStep cost data in system base per unit depending on the specified power units.
Note that the costs (y-axis) are in /MWh, /(sys pu h) or /(device pu h), so they also require transformation.
PowerSimulations.get_piecewise_pointcurve_per_system_unit
— Methodget_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
— Methodget_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
— Methodget_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
— Methodget_startup_shutdown_limits(
device,
_::Type{ActivePowerVariableLimitsConstraint},
_::Type{<:PowerSimulations.AbstractCompactUnitCommitment}
) -> NamedTuple{(:startup, :shutdown), <:Tuple{Any, Any}}
Startup shutdown limits for Compact Unit Commitment
PowerSimulations.get_startup_shutdown_limits
— Methodget_startup_shutdown_limits(
device::ThermalMultiStart,
_::Type{ActivePowerVariableLimitsConstraint},
_::Type{ThermalMultiStartUnitCommitment}
) -> NamedTuple{(:startup, :shutdown), <:Tuple{Any, Any}}
Startup and shutdown active power limits for Compact Unit Commitment
PowerSimulations.get_update_timestamp
— Methodget_update_timestamp(
s::PowerSimulations.AbstractDataset
) -> Any
Return the timestamp from the data used in the last update
PowerSimulations.get_update_timestamp
— Methodget_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
— Methodget_valid_step_length(
partitions::SimulationPartitions,
index::Int64
) -> Int64
Return the length of valid data at the given index.
PowerSimulations.get_valid_step_offset
— Methodget_valid_step_offset(
partitions::SimulationPartitions,
index::Int64
) -> Int64
Return the step offset for valid data at the given index.
PowerSimulations.has_dirty
— Methodhas_dirty(
cache::PowerSimulations.OptimizationOutputCaches
) -> Bool
Return true if the cache has data that has not been flushed to storage.
PowerSimulations.is_cached
— Methodis_cached(
cache::PowerSimulations.OptimizationOutputCaches,
model_name,
key,
index
) -> Bool
Return true if the data for timestamp
is stored in cache.
PowerSimulations.join_simulation
— Methodjoin_simulation(path::AbstractString)
Combine all partition simulation files.
PowerSimulations.list_decision_model_keys
— Methodlist_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
— Methodlist_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
— Methodlog_cache_hit_percentages(
cache::PowerSimulations.OptimizationOutputCaches
)
Log the cache hit percentages for all caches.
PowerSimulations.onvar_cost
— Methodonvar_cost(
cost::ThermalGenerationCost,
S::OnVariable,
d::ThermalGen,
U::PowerSimulations.AbstractThermalFormulation
) -> Any
Theoretical Cost at power output zero. Mathematically is the intercept with the y-axis
PowerSimulations.open_store
— Functionopen_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.read_dataframe
— Methodread_dataframe(
filename::AbstractString
) -> DataFrames.DataFrame
Return a DataFrame from a CSV file.
PowerSimulations.read_json
— Methodread_json(
filename::AbstractString
) -> Union{Nothing, Bool, Float64, Int64, String, JSON3.Array, JSON3.Object}
Return a decoded JSON file.
PowerSimulations.read_result
— Methodread_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
— Methodread_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
— Functionserialize_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
— Methodserialize_jump_optimization_model(
jump_model::JuMP.Model,
save_path::String
)
Exports the JuMP object in MathOptFormat
PowerSimulations.serialize_simulation
— Methodserialize_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!
— Methodset_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!
— Methodset_ic_quantity!(
ic::InitialCondition{T<:InfrastructureSystems.Optimization.InitialConditionType, Float64},
var_value::Float64
)
Default implementation of setinitialcondition_value
PowerSimulations.set_ic_quantity!
— Methodset_ic_quantity!(
ic::InitialCondition{T<:InfrastructureSystems.Optimization.InitialConditionType, JuMP.VariableRef},
var_value::Float64
)
Default implementation of setinitialcondition_value
PowerSimulations.solve_impl!
— Methodsolve_impl!(
container::PowerSimulations.OptimizationContainer,
system::System
) -> Any
Default solve method for OptimizationContainer
PowerSimulations.sparse_container_spec
— Methodsparse_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
— Methodto_dataframe(
array::JuMP.Containers.DenseAxisArray{T<:Number, 2, Ax, L} where {Ax, L<:Tuple{JuMP.Containers._AxisLookup, JuMP.Containers._AxisLookup}},
key::InfrastructureSystems.Optimization.OptimizationContainerKey
) -> DataFrames.DataFrame
Creates a DataFrame from a JuMP DenseAxisArray or SparseAxisArray.
Arguments
array
: JuMP DenseAxisArray or SparseAxisArray to convertkey::OptimizationContainerKey
:
PowerSimulations.update_container_parameter_values!
— Methodupdate_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!
— Methodupdate_model!(
model::PowerSimulations.OperationModel,
sim::Simulation
)
Default problem update function for most problems with no customization
PowerSimulations.update_parameter_values!
— Methodupdate_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!
— Methodupdate_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.variable_reactive_net_injection
— Methodvariable_reactive_net_injection(
pm::PowerModels.AbstractActivePowerModel;
kwargs...
)
active power only models ignore reactive power variables
PowerSimulations.write_formulation_combinations
— Functionwrite_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!
— Methodwrite_result!(
store::PowerSimulations.HdfSimulationStore,
model_name::Symbol,
key::InfrastructureSystems.Optimization.OptimizationContainerKey,
index::Dates.DateTime,
_::Dates.DateTime,
data::JuMP.Containers.DenseAxisArray{Float64, 3, var"#s547", L} where {var"#s547"<: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!
— Methodwrite_result!(
store::PowerSimulations.HdfSimulationStore,
_::Symbol,
key::InfrastructureSystems.Optimization.OptimizationContainerKey,
index::Int64,
simulation_time::Dates.DateTime,
data::JuMP.Containers.DenseAxisArray
)
Write an emulation model result for an execution index value and the timestamp of the update
PowerSimulations.write_result!
— Methodwrite_result!(
store::PowerSimulations.HdfSimulationStore,
model_name::Symbol,
key::InfrastructureSystems.Optimization.OptimizationContainerKey,
index::Dates.DateTime,
_::Dates.DateTime,
data::JuMP.Containers.DenseAxisArray{Float64, N, var"#s547", L} where {var"#s547"<:NTuple{N, Any}, L<:NTuple{N, JuMP.Containers._AxisLookup}}
)
Write a decision model result for a timestamp to the store.