API Reference
- API Reference
Device Models
List of structures and methods for Device models
PowerSimulations.DeviceModel — Type
DeviceModel(
::Type{D},
::Type{B},
feedforwards::Vector{<:AbstractAffectFeedforward}
use_slacks::Bool,
duals::Vector{DataType},
services::Vector{ServiceModel}
attributes::Dict{String, Any}
)Establishes the model for a particular device specified by type. Uses the keyword argument feedforward to enable passing values between operation model at simulation time
Arguments
::Type{D} where D<:PSY.Device: Power System Device Type::Type{B} where B<:AbstractDeviceFormulation: Abstract Device Formulationfeedforward::Array{<:AbstractAffectFeedforward} = Vector{AbstractAffectFeedforward}(): use to pass parameters between modelsuse_slacks::Bool = false: Add slacks to the device model. Implementation is model dependent and not all models feature slacksduals::Vector{DataType} = Vector{DataType}(): use to pass constraint type to calculate the duals. The DataType needs to be a valid ConstraintTypetime_series_names::Dict{Type{<:TimeSeriesParameter}, String} = get_default_time_series_names(D, B): use to specify time series names associated to the device`attributes::Dict{String, Any} = get_default_attributes(D, B): use to specify attributes to the device
Example
thermal_gens = DeviceModel(ThermalStandard, ThermalBasicUnitCommitment)Formulations
Refer to the Formulations Page for each Abstract Device Formulation.
HVDC formulations will be moved to tis own section in future releases
HVDC Formulations
PowerSimulations.TransportHVDCNetworkModel — Type
Transport Lossless HVDC network model. No DC voltage variables are added and DC lines are modeled as lossless power transport elements
PowerSimulations.VoltageDispatchHVDCNetworkModel — Type
DC Voltage HVDC network model, where currents are solved based on DC voltage difference between DC buses
Converter Formulations
PowerSimulations.QuadraticLossConverter — Type
Quadratic Loss InterconnectingConverter Model
DC Lines Formulations
PowerSimulations.DCLossyLine — Type
Lossy Line Abstract Model
Problem Templates
PowerSimulations.ProblemTemplate — Type
ProblemTemplate(::Type{T}) where {T<:PM.AbstractPowerFormulation}Creates a model reference of the PowerSimulations Optimization Problem.
Arguments
model::Type{T<:PM.AbstractPowerFormulation}:
Example
template = ProblemTemplate(CopperPlatePowerModel)
PowerSimulations.set_device_model! — Method
set_device_model!(
template::ProblemTemplate,
model::DeviceModel
)
Sets the device model in a template using a DeviceModel instance
PowerSimulations.set_device_model! — Method
set_device_model!(
template::ProblemTemplate,
component_type::Type{<:Device},
formulation::Type{<:PowerSimulations.AbstractDeviceFormulation}
)
Sets the device model in a template using the component type and formulation. Builds a default DeviceModel
PowerSimulations.set_hvdc_network_model! — Method
set_hvdc_network_model!(
template::ProblemTemplate,
model::Union{Nothing, PowerSimulations.AbstractHVDCNetworkModel}
)
Sets the network model in a template.
PowerSimulations.set_hvdc_network_model! — Method
set_hvdc_network_model!(
template::ProblemTemplate,
model::Type{U<:PowerSimulations.AbstractHVDCNetworkModel}
)
Sets the network model in a template.
PowerSimulations.set_network_model! — Method
set_network_model!(
template::ProblemTemplate,
model::NetworkModel
)
Sets the network model in a template.
PowerSimulations.set_service_model! — Method
set_service_model!(
template::ProblemTemplate,
service_name::String,
service_type::Type{<:Service},
formulation::Type{<:PowerSimulations.AbstractServiceFormulation}
)
Sets the service model in a template using a name and the service type and formulation. Builds a default ServiceModel with useservicename set to true.
PowerSimulations.set_service_model! — Method
set_service_model!(
template::ProblemTemplate,
service_type::Type{<:Service},
formulation::Type{<:PowerSimulations.AbstractServiceFormulation}
)
Sets the service model in a template using a ServiceModel instance.
PowerSimulations.template_economic_dispatch — Method
template_economic_dispatch(; kwargs...) -> ProblemTemplate
template_economic_dispatch(; kwargs...)Creates a ProblemTemplate with default DeviceModels for an Economic Dispatch problem.
Example
template = templateeconomicdispatch()
# Accepted Key Words
- `network::Type{<:PM.AbstractPowerModel}` : override default network model settings
- `devices::Vector{DeviceModel}` : override default `DeviceModel` settings
- `services::Vector{ServiceModel}` : override default `ServiceModel` settingsPowerSimulations.template_unit_commitment — Method
template_unit_commitment(; kwargs...) -> ProblemTemplate
template_unit_commitment(; kwargs...)Creates a ProblemTemplate with default DeviceModels for a Unit Commitment problem.
Example
template = templateunitcommitment()
# Accepted Key Words
- `network::Type{<:PM.AbstractPowerModel}` : override default network model settings
- `devices::Vector{DeviceModel}` : override default `DeviceModel` settings
- `services::Vector{ServiceModel}` : override default `ServiceModel` settingsDecision Models
PowerSimulations.DecisionModel — Method
DecisionModel(
directory::AbstractString,
optimizer::MathOptInterface.OptimizerWithAttributes;
jump_model,
system
) -> Any
Construct an DecisionProblem from a serialized file.
Arguments
directory::AbstractString: Directory containing a serialized modeljump_model::Union{Nothing, JuMP.Model}= nothing: The JuMP model does not get serialized. Callers should pass whatever they passed to the original problem.optimizer::Union{Nothing,MOI.OptimizerWithAttributes}= nothing: The optimizer does not get serialized. Callers should pass whatever they passed to the original problem.system::Union{Nothing, PSY.System}: Optionally, the system used for the model. If nothing and systofile was set to true when the model was created, the system will be deserialized from a file.
PowerSimulations.DecisionModel — Method
DecisionModel{M}(
template::AbstractProblemTemplate,
sys::PSY.System,
jump_model::Union{Nothing, JuMP.Model}=nothing;
kwargs...) where {M<:DecisionProblem}Build the optimization problem of type M with the specific system and template.
Arguments
::Type{M} where M<:DecisionProblem: The abstract operation model typetemplate::AbstractProblemTemplate: The model reference made up of transmission, devices, branches, and services.sys::PSY.System: the system created using Power Systemsjump_model::Union{Nothing, JuMP.Model}: Enables passing a custom JuMP model. Use with carename = nothing: name of model, string or symbol; defaults to the type of template converted to a symbol.optimizer::Union{Nothing,MOI.OptimizerWithAttributes} = nothing: The optimizer does not get serialized. Callers should pass whatever they passed to the original problem.horizon::Dates.Period = UNSET_HORIZON: Manually specify the length of the forecast Horizonresolution::Dates.Period = UNSET_RESOLUTION: Manually specify the model's resolutionwarm_start::Bool = true: True will use the current operation point in the system to initialize variable values. False initializes all variables to zero. Default is truesystem_to_file::Bool = true:: True to create a copy of the system used in the model.initialize_model::Bool = true: Option to decide to initialize the model or not.initialization_file::String = "": This allows to pass pre-existing initialization values to avoid the solution of an optimization problem to find feasible initial conditions.deserialize_initial_conditions::Bool = false: Option to deserialize conditionsexport_pwl_vars::Bool = false: True to export all the pwl intermediate variables. It can slow down significantly the build and solve time.allow_fails::Bool = false: True to allow the simulation to continue even if the optimization step fails. Use with care.optimizer_solve_log_print::Bool = false: Uses JuMP.unset_silent() to print the optimizer's log. By default all solvers are set to MOI.Silent()detailed_optimizer_stats::Bool = false: True to save detailed optimizer stats log.calculate_conflict::Bool = false: True to use solver to calculate conflicts for infeasible problems. Only specific solvers are able to calculate conflicts.direct_mode_optimizer::Bool = false: True to use the solver in direct mode. Creates a JuMP.direct_model.store_variable_names::Bool = false: to store variable names in optimization model. Decreases the build times.rebuild_model::Bool = false: It will force the rebuild of the underlying JuMP model with each call to update the model. It increases solution times, use only if the model can't be updated in memory.initial_time::Dates.DateTime = UNSET_INI_TIME: Initial Time for the model solve.time_series_cache_size::Int = IS.TIME_SERIES_CACHE_SIZE_BYTES: Size in bytes to cache for each time array. Default is 1 MiB. Set to 0 to disable.
Example
template = ProblemTemplate(CopperPlatePowerModel, devices, branches, services)
OpModel = DecisionModel(MockOperationProblem, template, system)PowerSimulations.DecisionModel — Method
DecisionModel(
::Type{M<:PowerSimulations.DecisionProblem},
template::PowerSimulations.AbstractProblemTemplate,
sys::System;
...
) -> DecisionModel
DecisionModel(
::Type{M<:PowerSimulations.DecisionProblem},
template::PowerSimulations.AbstractProblemTemplate,
sys::System,
jump_model::Union{Nothing, JuMP.Model};
kwargs...
) -> DecisionModel
Build the optimization problem of type M with the specific system and template
Arguments
::Type{M} where M<:DecisionProblem: The abstract operation model typetemplate::AbstractProblemTemplate: The model reference made up of transmission, devices, branches, and services.sys::PSY.System: the system created using Power Systemsjump_model::Union{Nothing, JuMP.Model}= nothing: Enables passing a custom JuMP model. Use with care.
Example
template = ProblemTemplate(CopperPlatePowerModel, devices, branches, services)
problem = DecisionModel(MyOpProblemType, template, system, optimizer)PowerSimulations.DecisionModel — Method
Builds an empty decision model. This constructor is used for the implementation of custom decision models that do not require a template.
Arguments
::Type{M} where M<:DecisionProblem: The abstract operation model typesys::PSY.System: the system created using Power Systemsjump_model::Union{Nothing, JuMP.Model}= nothing: Enables passing a custom JuMP model. Use with care.
Example
problem = DecisionModel(system, optimizer)PowerSimulations.GenericOpProblem — Type
Generic PowerSimulations Operation Problem Type for unspecified models
PowerSimulations.build! — Method
build!(
model::DecisionModel;
output_dir,
recorders,
console_level,
file_level,
disable_timer_outputs
)
Build the Decision Model based on the specified DecisionProblem.
Arguments
model::DecisionModel{<:DecisionProblem}: DecisionModel objectoutput_dir::String: Output directory for resultsrecorders::Vector{Symbol} = []: recorder names to registerconsole_level = Logging.Error:file_level = Logging.Info:disable_timer_outputs = false: Enable/Disable timing outputs
PowerSimulations.solve! — Method
solve!(
model::DecisionModel;
export_problem_results,
console_level,
file_level,
disable_timer_outputs,
export_optimization_problem,
kwargs...
) -> InfrastructureSystems.Simulation.RunStatusModule.RunStatus
Default solve method for models that conform to the requirements of DecisionModel{<: DecisionProblem}.
This will call build! on the model if it is not already built. It will forward all keyword arguments to that function.
Arguments
model::OperationModel = model: operation modelexport_problem_results::Bool = false: If true, export OptimizationProblemResults DataFrames to CSV files. Reduces solution times during simulation.console_level = Logging.Error:file_level = Logging.Info:disable_timer_outputs = false: Enable/Disable timing outputsexport_optimization_problem::Bool = true: If true, serialize the model to a file to allow re-execution later.
Examples
results = solve!(OpModel)
results = solve!(OpModel, export_problem_results = true)PowerSimulations.solve! — Method
solve!(
step::Int64,
model::DecisionModel,
start_time::Dates.DateTime,
store::PowerSimulations.SimulationStore;
exports
) -> InfrastructureSystems.Simulation.RunStatusModule.RunStatus
Default solve method for a DecisionModel used inside of a Simulation. Solves problems that conform to the requirements of DecisionModel{<: DecisionProblem}
Arguments
step::Int: Simulation Stepmodel::OperationModel: operation modelstart_time::Dates.DateTime: Initial Time of the simulation step in Simulation time.store::SimulationStore: Simulation output store
Accepted Key Words
exports: realtime export of output. Use wisely, it can have negative impacts in the simulation times
Emulation Models
PowerSimulations.EmulationModel — Type
EmulationModel{M}(
template::AbstractProblemTemplate,
sys::PSY.System,
jump_model::Union{Nothing, JuMP.Model}=nothing;
kwargs...) where {M<:EmulationProblem}Build the optimization problem of type M with the specific system and template.
Arguments
::Type{M} where M<:EmulationProblem: The abstract Emulation model typetemplate::AbstractProblemTemplate: The model reference made up of transmission, devices, branches, and services.sys::PSY.System: the system created using Power Systemsjump_model::Union{Nothing, JuMP.Model}: Enables passing a custom JuMP model. Use with carename = nothing: name of model, string or symbol; defaults to the type of template converted to a symbol.optimizer::Union{Nothing,MOI.OptimizerWithAttributes} = nothing: The optimizer does not get serialized. Callers should pass whatever they passed to the original problem.warm_start::Bool = true: True will use the current operation point in the system to initialize variable values. False initializes all variables to zero. Default is truesystem_to_file::Bool = true:: True to create a copy of the system used in the model.initialize_model::Bool = true: Option to decide to initialize the model or not.initialization_file::String = "": This allows to pass pre-existing initialization values to avoid the solution of an optimization problem to find feasible initial conditions.deserialize_initial_conditions::Bool = false: Option to deserialize conditionsexport_pwl_vars::Bool = false: True to export all the pwl intermediate variables. It can slow down significantly the build and solve time.allow_fails::Bool = false: True to allow the simulation to continue even if the optimization step fails. Use with care.calculate_conflict::Bool = false: True to use solver to calculate conflicts for infeasible problems. Only specific solvers are able to calculate conflicts.optimizer_solve_log_print::Bool = false: Uses JuMP.unset_silent() to print the optimizer's log. By default all solvers are set to MOI.Silent()detailed_optimizer_stats::Bool = false: True to save detailed optimizer stats log.direct_mode_optimizer::Bool = false: True to use the solver in direct mode. Creates a JuMP.direct_model.store_variable_names::Bool = false: True to store variable names in optimization model.rebuild_model::Bool = false: It will force the rebuild of the underlying JuMP model with each call to update the model. It increases solution times, use only if the model can't be updated in memory.initial_time::Dates.DateTime = UNSET_INI_TIME: Initial Time for the model solve.time_series_cache_size::Int = IS.TIME_SERIES_CACHE_SIZE_BYTES: Size in bytes to cache for each time array. Default is 1 MiB. Set to 0 to disable.
Example
template = ProblemTemplate(CopperPlatePowerModel, devices, branches, services)
OpModel = EmulationModel(MockEmulationProblem, template, system)PowerSimulations.EmulationModel — Method
EmulationModel(
::Type{M<:PowerSimulations.EmulationProblem},
template::PowerSimulations.AbstractProblemTemplate,
sys::System;
...
) -> EmulationModel
EmulationModel(
::Type{M<:PowerSimulations.EmulationProblem},
template::PowerSimulations.AbstractProblemTemplate,
sys::System,
jump_model::Union{Nothing, JuMP.Model};
kwargs...
) -> EmulationModel
Build the optimization problem of type M with the specific system and template
Arguments
::Type{M} where M<:EmulationProblem: The abstract Emulation model typetemplate::AbstractProblemTemplate: The model reference made up of transmission, devices, branches, and services.sys::PSY.System: the system created using Power Systemsjump_model::Union{Nothing, JuMP.Model}: Enables passing a custom JuMP model. Use with care
Example
template = ProblemTemplate(CopperPlatePowerModel, devices, branches, services)
problem = EmulationModel(MyEmProblemType, template, system, optimizer)PowerSimulations.EmulationModel — Method
EmulationModel(
directory::AbstractString,
optimizer::MathOptInterface.OptimizerWithAttributes;
jump_model,
system,
kwargs...
) -> Any
Construct an EmulationProblem from a serialized file.
Arguments
directory::AbstractString: Directory containing a serialized model.optimizer::MOI.OptimizerWithAttributes: The optimizer does not get serialized. Callers should pass whatever they passed to the original problem.jump_model::Union{Nothing, JuMP.Model}= nothing: The JuMP model does not get serialized. Callers should pass whatever they passed to the original problem.system::Union{Nothing, PSY.System}: Optionally, the system used for the model. If nothing and systofile was set to true when the model was created, the system will be deserialized from a file.
PowerSimulations.build! — Method
build!(
model::EmulationModel;
executions,
output_dir,
recorders,
console_level,
file_level,
disable_timer_outputs
)
Implementation of build for any EmulationProblem
PowerSimulations.run! — Method
run!(
model::EmulationModel;
export_problem_results,
console_level,
file_level,
disable_timer_outputs,
export_optimization_model,
kwargs...
) -> InfrastructureSystems.Simulation.RunStatusModule.RunStatus
Default run method for problems that conform to the requirements of EmulationModel{<: EmulationProblem}
This will call build! on the model if it is not already built. It will forward all keyword arguments to that function.
Arguments
model::EmulationModel = model: Emulation modeloptimizer::MOI.OptimizerWithAttributes: The optimizer that is used to solve the modelexecutions::Int: Number of executions for the emulator runexport_problem_results::Bool: If true, export OptimizationProblemResults DataFrames to CSV files.output_dir::String: Required if the model is not already built, otherwise ignoredenable_progress_bar::Bool: Enables/Disable progress bar printingexport_optimization_model::Bool: If true, serialize the model to a file to allow re-execution later.
Examples
status = run!(model; optimizer = HiGHS.Optimizer, executions = 10)
status = run!(model; output_dir = ./model_output, optimizer = HiGHS.Optimizer, executions = 10)PowerSimulations.solve! — Method
solve!(
step::Int64,
model::EmulationModel,
start_time::Dates.DateTime,
store::PowerSimulations.SimulationStore;
exports
) -> InfrastructureSystems.Simulation.RunStatusModule.RunStatus
Default solve method for an EmulationModel used inside of a Simulation. Solves problems that conform to the requirements of DecisionModel{<: DecisionProblem}
Arguments
step::Int: Simulation Stepmodel::OperationModel: operation modelstart_time::Dates.DateTime: Initial Time of the simulation step in Simulation time.store::SimulationStore: Simulation output storeexports = nothing: realtime export of output. Use wisely, it can have negative impacts in the simulation times
Service Models
List of structures and methods for Service models
PowerSimulations.ServiceModel — Type
Establishes the model for a particular services specified by type. Uses the keyword argument use_service_name to assign the model to a service with the same name as the name in the template. Uses the keyword argument feedforward to enable passing values between operation model at simulation time
Arguments
-::Type{D}: Power System Service Type -::Type{B}: Abstract Service Formulation
Accepted Key Words
feedforward::Array{<:AbstractAffectFeedforward}: use to pass parameters between modelsuse_service_name::Bool: use the name as the name for the service
Example
reserves = ServiceModel(PSY.VariableReserve{PSY.ReserveUp}, RangeReserve)
Simulation Models
PowerSimulations.InitialCondition — Type
Container for the initial condition data
PowerSimulations.SimulationModels — Type
SimulationModels(
decision_models::Vector{<:DecisionModel},
emulation_models::Union{Nothing, EmulationModel}
)Stores the OperationProblem definitions to be used in the simulation. When creating the SimulationModels, the order in which the models are created determines the order on which the simulation is executed.
Arguments
decision_models::Vector{<:DecisionModel}: Vector of decision models.emulation_models::Union{Nothing, EmulationModel}: Optional argument to include
an EmulationModel in the Simulation
Example
template_uc = template_unit_commitment()
template_ed = template_economic_dispatch()
my_decision_model_uc = DecisionModel(template_1, sys_uc, optimizer, name = "UC")
my_decision_model_ed = DecisionModel(template_ed, sys_ed, optimizer, name = "ED")
models = SimulationModels(
decision_models = [
my_decision_model_uc,
my_decision_model_ed
]
)PowerSimulations.SimulationSequence — Type
SimulationSequence(
models::SimulationModels,
feedforward::Dict{String, Vector{<:AbstractAffectFeedforward}}
ini_cond_chronology::InitialConditionChronology
)Construct the simulation sequence between decision and emulation models.
Arguments
models::SimulationModels: Vector of decisions and emulation models.feedforward = Dict{String, Vector{<:AbstractAffectFeedforward}}(): Optional dictionary to specify how information and variables are exchanged between decision and emulation models.ini_cond_chronology::InitialConditionChronology = InterProblemChronology(): Define information sharing model between stages withInterProblemChronology
Example
template_uc = template_unit_commitment()
template_ed = template_economic_dispatch()
my_decision_model_uc = DecisionModel(template_1, sys_uc, optimizer, name = "UC")
my_decision_model_ed = DecisionModel(template_ed, sys_ed, optimizer, name = "ED")
models = SimulationModels(
decision_models = [
my_decision_model_uc,
my_decision_model_ed
]
)
# The following sequence set the commitment variables (`OnVariable`) for `ThermalStandard` units from UC to ED.
sequence = SimulationSequence(;
models = models,
feedforwards = Dict(
"ED" => [
SemiContinuousFeedforward(;
component_type = ThermalStandard,
source = OnVariable,
affected_values = [ActivePowerVariable],
),
],
),
)PowerSimulations.Simulation — Type
Simulation(
sequence::SimulationSequence,
name::String,
steps::Int
models::SimulationModels,
simulation_folder::String,
initial_time::Union{Nothing, Dates.DateTime}
)Construct the Simulation structure to run the sequence of decision and emulation models specified.
Arguments
sequence::SimulationSequence: Simulation sequence that specify how the decision and emulation models will be executed.name::String: Name of the Simulationsteps::Int: Number of steps on which the sequence of models will be executedmodels::SimulationModels: List of Decision and Emulation Modelssimulation_folder::String: Folder on which results will be storedinitial_time::Union{Nothing, Dates.DateTime} = nothing: Initial time of which the simulation starts. If nothing it will default to the first timestamp of time series of the system.
Example
template_uc = template_unit_commitment()
template_ed = template_economic_dispatch()
my_decision_model_uc = DecisionModel(template_1, sys_uc, optimizer, name = "UC")
my_decision_model_ed = DecisionModel(template_ed, sys_ed, optimizer, name = "ED")
models = SimulationModels(
decision_models = [
my_decision_model_uc,
my_decision_model_ed
]
)
# The following sequence set the commitment variables (`OnVariable`) for `ThermalStandard` units from UC to ED.
sequence = SimulationSequence(;
models = models,
feedforwards = Dict(
"ED" => [
SemiContinuousFeedforward(;
component_type = ThermalStandard,
source = OnVariable,
affected_values = [ActivePowerVariable],
),
],
),
)
sim = Simulation(
sequence = sequence,
name = "Sim",
steps = 5,
models = models,
simulation_folder = mktempdir(cleanup=true),
)PowerSimulations.Simulation — Method
Simulation(directory::AbstractString, model_info::Dict)
Constructs Simulation from a serialized directory. Callers should pass any kwargs here that they passed to the original Simulation.
Arguments
directory::AbstractString: the directory returned from the call to serializemodel_info::Dict: Two-level dictionary containing model parameters that cannot be serialized. The outer dict should be keyed by the problem name. The inner dict must contain 'optimizer' and may contain 'jump_model'. These should be the same values used for the original simulation.
PowerSimulations.build! — Method
build!(
sim::Simulation;
recorders,
console_level,
file_level,
serialize,
partitions,
index
) -> InfrastructureSystems.Simulation.SimulationBuildStatusModule.SimulationBuildStatus
Build the Simulation, problems and the related folder structure.
Arguments
sim::Simulation: simulation objectrecorders::Vector{Symbol} = []: recorder names to registerserialize::Bool = true: serializes the simulation objects in the simulationconsole_level = Logging.Error:file_level = Logging.Info:
PowerSimulations.execute! — Method
execute!(
sim::Simulation;
kwargs...
) -> InfrastructureSystems.Simulation.RunStatusModule.RunStatus
Solves the simulation model for sequential Simulations.
Arguments
sim::Simulation=sim: simulation object created by Simulation()
The optional keyword argument exports controls exporting of results to CSV files as the simulation runs.
Example
sim = Simulation("Test", 7, problems, "/Users/folder")
execute!(sim::Simulation; kwargs...)PowerSimulations.SimulationPartitions — Type
Defines how a simulation can be partition into partitions and run in parallel.
PowerSimulations.get_num_partitions — Method
get_num_partitions(x::SimulationPartitions) -> Int64
Return the number of partitions in the simulation.
PowerSimulations.run_parallel_simulation — Method
run_parallel_simulation(
build_function,
execute_function;
script,
output_dir,
name,
num_steps,
period,
num_overlap_steps,
num_parallel_processes,
exeflags,
force
)
Run a partitioned simulation in parallel on a local computer.
Arguments
build_function: Function reference that returns a built Simulation.execute_function: Function reference that executes a Simulation.script::AbstractString: Path to script that includes $build_function$ and $execute_function$.output_dir::AbstractString: Path for simulation outputsname::AbstractString: Simulation namenum_steps::Integer: Total number of steps in the simulationperiod::Integer: Number of steps in each simulation partitionnum_overlap_steps::Integer: Number of steps that each partition overlaps with the previous partitionnum_parallel_processes: Number of partitions to run in parallel. If nothing, use the number of cores.exeflags: Path to Julia project. Forwarded to Distributed.addprocs.force: Overwrite the output directory if it already exists.
Chronology Models
PowerSimulations.InterProblemChronology — Type
InterProblemChronology()Type struct to select an information sharing model between stages that uses results from the most recent stage executed to calculate the initial conditions. This model takes into account solutions from stages defined with finer temporal resolutions
See also: IntraProblemChronology
PowerSimulations.IntraProblemChronology — Type
IntraProblemChronology()Type struct to select an information sharing model between stages that uses results from the same recent stage to calculate the initial conditions. This model ignores solutions from stages defined with finer temporal resolutions.
See also: InterProblemChronology
Variables
For a list of variables for each device refer to its Formulations page.
Common Variables
PowerSimulations.ActivePowerVariable — Type
Struct to dispatch the creation of Active Power Variables
Docs abbreviation: $p$
PowerSimulations.ReactivePowerVariable — Type
Struct to dispatch the creation of Reactive Power Variables
Docs abbreviation: $q$
PowerSimulations.PiecewiseLinearCostVariable — Type
Struct to dispatch the creation of piecewise linear cost variables for objective function
Docs abbreviation: $\delta$
PowerSimulations.RateofChangeConstraintSlackUp — Type
Struct to dispatch the creation of Slack variables for rate of change constraints up limits
Docs abbreviation: $p^\text{sl,up}$
PowerSimulations.RateofChangeConstraintSlackDown — Type
Struct to dispatch the creation of Slack variables for rate of change constraints down limits
Docs abbreviation: $p^\text{sl,dn}$
PowerSimulations.PostContingencyActivePowerChangeVariable — Type
Struct to dispatch the creation of Post-Contingency Active Power Change Variables.
Docs abbreviation: $\Delta p_{g,c}$
Thermal Unit Variables
PowerSimulations.OnVariable — Type
Struct to dispatch the creation of a binary commitment status variable
Docs abbreviation: $u$
PowerSimulations.StartVariable — Type
Struct to dispatch the creation of Binary Start Variables
Docs abbreviation: $v$
PowerSimulations.StopVariable — Type
Struct to dispatch the creation of Binary Stop Variables
Docs abbreviation: $w$
PowerSimulations.HotStartVariable — Type
Struct to dispatch the creation of Hot Start Variable for Thermal units with temperature considerations
Docs abbreviation: $z^\text{th}$
PowerSimulations.WarmStartVariable — Type
Struct to dispatch the creation of Warm Start Variable for Thermal units with temperature considerations
Docs abbreviation: $y^\text{th}$
PowerSimulations.ColdStartVariable — Type
Struct to dispatch the creation of Cold Start Variable for Thermal units with temperature considerations
Docs abbreviation: $x^\text{th}$
PowerSimulations.PowerAboveMinimumVariable — Type
Struct to dispatch the creation of Active Power Variables above minimum power for Thermal Compact formulations
Docs abbreviation: $\Delta p$
Storage Unit Variables
PowerSimulations.ReservationVariable — Type
Struct to dispatch the creation of binary storage charge reservation variable
Docs abbreviation: $u^\text{st}$
PowerSimulations.EnergyVariable — Type
Struct to dispatch the creation of a variable for energy storage level (state of charge)
Docs abbreviation: $e$
PowerSimulations.ActivePowerOutVariable — Type
Struct to dispatch the creation of Active Power Output Variables for 2-directional devices. For instance storage or pump-hydro
Docs abbreviation: $p^\text{out}$
PowerSimulations.ActivePowerInVariable — Type
Struct to dispatch the creation of Active Power Input Variables for 2-directional devices. For instance storage or pump-hydro
Docs abbreviation: $p^\text{in}$
Branches and Network Variables
PowerSimulations.FlowActivePowerVariable — Type
Struct to dispatch the creation of bidirectional Active Power Flow Variables
Docs abbreviation: $f$
PowerSimulations.FlowActivePowerSlackUpperBound — Type
Struct to dispatch the creation of active power flow upper bound slack variables. Used when there is not enough flow through the branch in the forward direction.
Docs abbreviation: $f^\text{sl,up}$
PowerSimulations.FlowActivePowerSlackLowerBound — Type
Struct to dispatch the creation of active power flow lower bound slack variables. Used when there is not enough flow through the branch in the reverse direction.
Docs abbreviation: $f^\text{sl,lo}$
PowerSimulations.FlowActivePowerFromToVariable — Type
Struct to dispatch the creation of unidirectional Active Power Flow Variables
Docs abbreviation: $f^\text{from-to}$
PowerSimulations.FlowActivePowerToFromVariable — Type
Struct to dispatch the creation of unidirectional Active Power Flow Variables
Docs abbreviation: $f^\text{to-from}$
PowerSimulations.FlowReactivePowerFromToVariable — Type
Struct to dispatch the creation of unidirectional Reactive Power Flow Variables
Docs abbreviation: $f^\text{q,from-to}$
PowerSimulations.FlowReactivePowerToFromVariable — Type
Struct to dispatch the creation of unidirectional Reactive Power Flow Variables
Docs abbreviation: $f^\text{q,to-from}$
PowerSimulations.PhaseShifterAngle — Type
Struct to dispatch the creation of Phase Shifters Variables
Docs abbreviation: $\theta^\text{shift}$
PowerSimulations.HVDCLosses — Type
Struct to dispatch the creation of HVDC Losses Auxiliary Variables
Docs abbreviation: $\ell$
PowerSimulations.HVDCFlowDirectionVariable — Type
Struct to dispatch the creation of HVDC Flow Direction Auxiliary Variables
Docs abbreviation: $u^\text{dir}$
PowerSimulations.VoltageMagnitude — Type
Struct to dispatch the creation of Voltage Magnitude Variables for AC formulations
Docs abbreviation: $v$
PowerSimulations.VoltageAngle — Type
Struct to dispatch the creation of Voltage Angle Variables for AC/DC formulations
Docs abbreviation: $\theta$
Two Terminal and Multi-Terminal HVDC Variables
PowerSimulations.InterpolationBinarySquaredCurrentVariable — Type
Struct to dispatch the creation of Binary Interpolation Variable for Squared Converter Current
Docs abbreviation: $z_c^{i}$
PowerSimulations.SquaredDCVoltage — Type
Struct to dispatch the creation of Squared Voltage Variables for DC formulations Docs abbreviation: $v^{sq,dc}$
PowerSimulations.DCLineCurrent — Type
Struct to dispatch the variable of DC Current Variables for DC Lines formulations Docs abbreviation: $i_l^{dc}$
PowerSimulations.InterpolationSquaredVoltageVariable — Type
Struct to dispatch the creation of Continuous Interpolation Variable for Squared Converter Voltage
Docs abbreviation: $\delta_c^{v}$
PowerSimulations.InterpolationBinarySquaredVoltageVariable — Type
Struct to dispatch the creation of Binary Interpolation Variable for Squared Converter Voltage
Docs abbreviation: $z_c^{v}$
PowerSimulations.AuxBilinearConverterVariable — Type
Struct to dispatch the creation of Auxiliary Variable for Converter Bilinear term: v * i Docs abbreviation: $\gamma_c^{dc}$
PowerSimulations.AuxBilinearSquaredConverterVariable — Type
Struct to dispatch the creation of Auxiliary Variable for Squared Converter Bilinear term: v * i
Docs abbreviation: $\gamma_c^{sq,dc}$
PowerSimulations.InterpolationSquaredBilinearVariable — Type
Struct to dispatch the creation of Continuous Interpolation Variable for Squared Converter AuxVar
Docs abbreviation: $\delta_c^{\gamma}$
PowerSimulations.InterpolationBinarySquaredBilinearVariable — Type
Struct to dispatch the creation of Binary Interpolation Variable for Squared Converter AuxVar
Docs abbreviation: $z_c^{\gamma}$
PowerSimulations.InterpolationSquaredCurrentVariable — Type
Struct to dispatch the creation of Continuous Interpolation Variable for Squared Converter Current
Docs abbreviation: $\delta_c^{i}$
PowerSimulations.DCVoltage — Type
Struct to dispatch the creation of Voltage Variables for DC formulations Docs abbreviation: $v^{dc}$
PowerSimulations.ConverterCurrent — Type
Struct to dispatch the creation of DC Converter Current Variables for DC formulations Docs abbreviation: $i_c^{dc}$
PowerSimulations.SquaredConverterCurrent — Type
Struct to dispatch the creation of Squared DC Converter Current Variables for DC formulations Docs abbreviation: $i_c^{sq,dc}$
PowerSimulations.ConverterPositiveCurrent — Type
Struct to dispatch the creation of DC Converter Positive Term Current Variables for DC formulations Docs abbreviation: $i_c^{+,dc}$
PowerSimulations.ConverterNegativeCurrent — Type
Struct to dispatch the creation of DC Converter Negative Term Current Variables for DC formulations Docs abbreviation: $i_c^{-,dc}$
PowerSimulations.ConverterPowerDirection — Type
Struct to dispatch the creation of Binary Variable for Converter Power Direction Docs abbreviation: $\kappa_c^{dc}$
Services Variables
PowerSimulations.ActivePowerReserveVariable — Type
Struct to dispatch the creation of Active Power Reserve Variables
Docs abbreviation: $r$
PowerSimulations.ServiceRequirementVariable — Type
Struct to dispatch the creation of Service Requirement Variables
Docs abbreviation: $\text{req}$
PowerSimulations.SystemBalanceSlackUp — Type
Struct to dispatch the creation of System-wide slack up variables. Used when there is not enough generation.
Docs abbreviation: $p^\text{sl,up}$
PowerSimulations.SystemBalanceSlackDown — Type
Struct to dispatch the creation of System-wide slack down variables. Used when there is not enough load curtailment.
Docs abbreviation: $p^\text{sl,dn}$
PowerSimulations.ReserveRequirementSlack — Type
Struct to dispatch the creation of Reserve requirement slack variables. Used when there is not reserves in the system to satisfy the requirement.
Docs abbreviation: $r^\text{sl}$
PowerSimulations.InterfaceFlowSlackUp — Type
Struct to dispatch the creation of Interface Flow Slack Up variables
Docs abbreviation: $f^\text{sl,up}$
PowerSimulations.InterfaceFlowSlackDown — Type
Struct to dispatch the creation of Interface Flow Slack Down variables
Docs abbreviation: $f^\text{sl,dn}$
PowerSimulations.PostContingencyActivePowerReserveDeploymentVariable — Type
Struct to dispatch the creation of Post-Contingency Active Power Deployment Variable for mapping reserves deployment under contingencies.
Docs abbreviation: $\Delta rsv_{r,g,c}$
Feedforward Variables
PowerSimulations.UpperBoundFeedForwardSlack — Type
Struct to dispatch the creation of Slack variables for UpperBoundFeedforward
Docs abbreviation: $p^\text{ff,ubsl}$
PowerSimulations.LowerBoundFeedForwardSlack — Type
Struct to dispatch the creation of Slack variables for LowerBoundFeedforward
Docs abbreviation: $p^\text{ff,lbsl}$
Auxiliary Variables
Thermal Unit Auxiliary Variables
PowerSimulations.TimeDurationOn — Type
Auxiliary Variable for Thermal Generation Models to keep track of time elapsed on
PowerSimulations.TimeDurationOff — Type
Auxiliary Variable for Thermal Generation Models to keep track of time elapsed off
PowerSimulations.PowerOutput — Type
Auxiliary Variable for Thermal Generation Models that solve for power above min
Bus Auxiliary Variables
PowerSimulations.PowerFlowVoltageAngle — Type
Auxiliary Variable for the bus angle results from power flow evaluation
PowerSimulations.PowerFlowVoltageMagnitude — Type
Auxiliary Variable for the bus voltage magnitued results from power flow evaluation
PowerSimulations.PowerFlowLossFactors — Type
Auxiliary Variable for the loss factors from AC power flow evaluation that are calculated using the Jacobian matrix
PowerSimulations.PowerFlowVoltageStabilityFactors — Type
Auxiliary Variable for the voltage stability factors from AC power flow evaluation that are calculated using the Jacobian matrix
Branch Auxiliary Variables
PowerSimulations.PowerFlowLineReactivePowerFromTo — Type
Auxiliary Variable for the line reactive flow in the from -> to direction from power flow evaluation
PowerSimulations.PowerFlowLineReactivePowerToFrom — Type
Auxiliary Variable for the line reactive flow in the to -> from direction from power flow evaluation
PowerSimulations.PowerFlowLineActivePowerFromTo — Type
Auxiliary Variable for the line active flow in the from -> to direction from power flow evaluation
PowerSimulations.PowerFlowLineActivePowerToFrom — Type
Auxiliary Variable for the line active flow in the to -> from direction from power flow evaluation
Constraints
Common Constraints
PowerSimulations.PiecewiseLinearCostConstraint — Type
Struct to create the PiecewiseLinearCostConstraint associated with a specified variable.
See Piecewise linear cost functions for more information.
Network Constraints
PowerSimulations.CopperPlateBalanceConstraint — Type
Struct to create the constraint to balance power in the copperplate model. For more information check Network Formulations.
The specified constraint is generally formulated as:
\[\sum_{c \in \text{components}} p_t^c = 0, \quad \forall t \in \{1, \dots, T\}\]
PowerSimulations.NodalBalanceActiveConstraint — Type
Struct to create the constraint to balance active power in nodal formulation. For more information check Network Formulations.
The specified constraint depends on the network model chosen.
PowerSimulations.NodalBalanceReactiveConstraint — Type
Struct to create the constraint to balance reactive power in nodal formulation. For more information check Network Formulations.
The specified constraint depends on the network model chosen.
PowerSimulations.AreaParticipationAssignmentConstraint — Type
Struct to create the constraint to balance power across specified areas. For more information check Network Formulations.
The specified constraint is generally formulated as:
\[\sum_{c \in \text{components}_a} p_t^c = 0, \quad \forall a\in \{1,\dots, A\}, t \in \{1, \dots, T\}\]
Power Variable Limit Constraints
PowerSimulations.ActivePowerVariableLimitsConstraint — Type
Struct to create the constraint to limit active power expressions. For more information check Device Formulations.
The specified constraint depends on the UpperBound and LowerBound expressions, but in its most basic formulation is of the form:
\[P^\text{min} \le p_t \le P^\text{max}, \quad \forall t \in \{1,\dots,T\}\]
PowerSimulations.ReactivePowerVariableLimitsConstraint — Type
Struct to create the constraint to limit reactive power expressions. For more information check Device Formulations.
The specified constraint depends on the UpperBound and LowerBound expressions, but in its most basic formulation is of the form:
\[Q^\text{min} \le q_t \le Q^\text{max}, \quad \forall t \in \{1,\dots,T\}\]
PowerSimulations.ActivePowerVariableTimeSeriesLimitsConstraint — Type
Struct to create the constraint to limit active power expressions by a time series parameter. For more information check Device Formulations.
The specified constraint depends on the UpperBound expressions, but in its most basic formulation is of the form:
\[p_t \le \text{ActivePowerTimeSeriesParameter}_t, \quad \forall t \in \{1,\dots,T\}\]
PowerSimulations.InputActivePowerVariableLimitsConstraint — Type
Struct to create the constraint to limit active power input expressions. For more information check Device Formulations.
The specified constraint depends on the UpperBound and LowerBound expressions, but in its most basic formulation is of the form:
\[P^\text{min} \le p_t^\text{in} \le P^\text{max}, \quad \forall t \in \{1,\dots,T\}\]
PowerSimulations.OutputActivePowerVariableLimitsConstraint — Type
Struct to create the constraint to limit active power output expressions. For more information check Device Formulations.
The specified constraint depends on the UpperBound and LowerBound expressions, but in its most basic formulation is of the form:
\[P^\text{min} \le p_t^\text{out} \le P^\text{max}, \quad \forall t \in \{1,\dots,T\}\]
PowerSimulations.ActivePowerInVariableTimeSeriesLimitsConstraint — Type
Struct to create the constraint to limit active power expressions by a time series parameter. For more information check Device Formulations.
The specified constraint depends on the UpperBound expressions, but in its most basic formulation is of the form:
\[p_t^{in} \le \text{ActivePowerTimeSeriesParameter}_t, \quad \forall t \in \{1,\dots,T\}\]
PowerSimulations.ActivePowerOutVariableTimeSeriesLimitsConstraint — Type
Struct to create the constraint to limit active power expressions by a time series parameter. For more information check Device Formulations.
The specified constraint depends on the UpperBound expressions, but in its most basic formulation is of the form:
\[p_t^{out} \le \text{ActivePowerTimeSeriesParameter}_t, \quad \forall t \in \{1,\dots,T\}\]
Services Constraints
PowerSimulations.RequirementConstraint — Type
Struct to create the constraint for satisfying active power reserve requirements. For more information check Service Formulations.
The constraint is as follows:
\[\sum_{d\in\mathcal{D}_s} r_{d,t} + r_t^\text{sl} \ge \text{Req},\quad \forall t\in \{1,\dots, T\} \quad \text{(for a ConstantReserve)} \\ \sum_{d\in\mathcal{D}_s} r_{d,t} + r_t^\text{sl} \ge \text{RequirementTimeSeriesParameter}_{t},\quad \forall t\in \{1,\dots, T\} \quad \text{(for a VariableReserve)}\]
PowerSimulations.ParticipationFractionConstraint — Type
Struct to create the constraint to participation assignments limits in the active power reserves. For more information check Service Formulations.
The constraint is as follows:
\[r_{d,t} \le \text{Req} \cdot \text{PF} ,\quad \forall d\in \mathcal{D}_s, \forall t\in \{1,\dots, T\} \quad \text{(for a ConstantReserve)} \\ r_{d,t} \le \text{RequirementTimeSeriesParameter}_{t} \cdot \text{PF}\quad \forall d\in \mathcal{D}_s, \forall t\in \{1,\dots, T\}, \quad \text{(for a VariableReserve)}\]
PowerSimulations.ReservePowerConstraint — Type
Struct to create the constraint for ensuring that NonSpinning Reserve can be delivered from turn-off thermal units.
For more information check Service Formulations for NonSpinningReserve.
The constraint is as follows:
\[r_{d,t} \le (1 - u_{d,t}^\text{th}) \cdot R^\text{limit}_d, \quad \forall d \in \mathcal{D}_s, \forall t \in \{1,\dots, T\}\]
Thermal Unit Constraints
PowerSimulations.ActiveRangeICConstraint — Type
Struct to create the constraint for starting up ThermalMultiStart units. For more information check ThermalGen Formulations for ThermalMultiStartUnitCommitment.
The specified constraint is formulated as:
\[\max\{P^\text{th,max} - P^\text{th,shdown}, 0\} \cdot w_1^\text{th} \le u^\text{th,init} (P^\text{th,max} - P^\text{th,min}) - P^\text{th,init}\]
PowerSimulations.CommitmentConstraint — Type
Struct to create the commitment constraint between the on, start, and stop variables. For more information check ThermalGen Formulations.
The specified constraints are formulated as:
\[u_1^\text{th} = u^\text{th,init} + v_1^\text{th} - w_1^\text{th} \\ u_t^\text{th} = u_{t-1}^\text{th} + v_t^\text{th} - w_t^\text{th}, \quad \forall t \in \{2,\dots,T\} \\ v_t^\text{th} + w_t^\text{th} \le 1, \quad \forall t \in \{1,\dots,T\}\]
PowerSimulations.DurationConstraint — Type
Struct to create the duration constraint for commitment formulations, i.e. min-up and min-down.
For more information check ThermalGen Formulations.
PowerSimulations.RampConstraint — Type
Struct to create the RampConstraint associated with a specified thermal device or reserve service.
For thermal units, see more information in Thermal Formulations. The constraint is as follows:
\[-R^\text{th,dn} \le p_t^\text{th} - p_{t-1}^\text{th} \le R^\text{th,up}, \quad \forall t\in \{1, \dots, T\}\]
For Ramp Reserve, see more information in Service Formulations. The constraint is as follows:
\[r_{d,t} \le R^\text{th,up} \cdot \text{TF}\quad \forall d\in \mathcal{D}_s, \forall t\in \{1,\dots, T\}, \quad \text{(for ReserveUp)} \\ r_{d,t} \le R^\text{th,dn} \cdot \text{TF}\quad \forall d\in \mathcal{D}_s, \forall t\in \{1,\dots, T\}, \quad \text{(for ReserveDown)}\]
PowerSimulations.StartupInitialConditionConstraint — Type
Struct to create the start-up initial condition constraints for ThermalMultiStart.
For more information check ThermalGen Formulations for ThermalMultiStartUnitCommitment.
PowerSimulations.StartupTimeLimitTemperatureConstraint — Type
Struct to create the start-up time limit constraints for ThermalMultiStart.
For more information check ThermalGen Formulations for ThermalMultiStartUnitCommitment.
Renewable Unit Constraints
PowerSimulations.EqualityConstraint — Type
Struct to create the constraint that sets the reactive power to the power factor in the RenewableConstantPowerFactor formulation for renewable units.
For more information check RenewableGen Formulations.
The specified constraint is formulated as:
\[q_t^\text{re} = \text{pf} \cdot p_t^\text{re}, \quad \forall t \in \{1,\dots, T\}\]
Source Constraints
PowerSimulations.ImportExportBudgetConstraint — Type
Struct to create the constraint to limit the import and exports in a determined period. For more information check Device Formulations.
Branches Constraints
PowerSimulations.FlowLimitConstraint — Type
Struct to create the constraint that set the flow limits through a PhaseShiftingTransformer.
For more information check Branch Formulations.
The specified constraint is formulated as:
\[-R^\text{max} \le f_t \le R^\text{max}, \quad \forall t \in \{1,\dots,T\}\]
PowerSimulations.FlowRateConstraint — Type
Struct to create the constraint that set the AC flow limits through AC branches and HVDC two-terminal branches.
For more information check Branch Formulations.
The specified constraint is formulated as:
\[\begin{align*} & f_t - f_t^\text{sl,up} \le R^\text{max},\quad \forall t \in \{1,\dots, T\} \\ & f_t + f_t^\text{sl,lo} \ge -R^\text{max},\quad \forall t \in \{1,\dots, T\} \end{align*}\]
PowerSimulations.FlowRateConstraintFromTo — Type
Struct to create the constraint for branch flow rate limits from the 'from' bus to the 'to' bus. For more information check Branch Formulations.
PowerSimulations.FlowRateConstraintToFrom — Type
Struct to create the constraint for branch flow rate limits from the 'to' bus to the 'from' bus. For more information check Branch Formulations.
PowerSimulations.HVDCPowerBalance — Type
Struct to create the constraints that set the power balance across a lossy HVDC two-terminal line.
For more information check Branch Formulations.
The specified constraints are formulated as:
\[\begin{align*} & f_t^\text{to-from} - f_t^\text{from-to} \le L_1 \cdot f_t^\text{to-from} - L_0,\quad \forall t \in \{1,\dots, T\} \\ & f_t^\text{from-to} - f_t^\text{to-from} \ge L_1 \cdot f_t^\text{from-to} + L_0,\quad \forall t \in \{1,\dots, T\} \\ & f_t^\text{from-to} - f_t^\text{to-from} \ge - M^\text{big} (1 - u^\text{dir}_t),\quad \forall t \in \{1,\dots, T\} \\ & f_t^\text{to-from} - f_t^\text{from-to} \ge - M^\text{big} u^\text{dir}_t,\quad \forall t \in \{1,\dots, T\} \\ \end{align*}\]
PowerSimulations.NetworkFlowConstraint — Type
Struct to create the constraint the AC branch flows depending on the network model. For more information check Branch Formulations.
The specified constraint depends on the network model chosen. The most common application is the StaticBranch in a PTDF Network Model:
\[f_t = \sum_{i=1}^N \text{PTDF}_{i,b} \cdot \text{Bal}_{i,t}, \quad \forall t \in \{1,\dots, T\}\]
PowerSimulations.PhaseAngleControlLimit — Type
Struct to create the constraint that set the angle limits through a PhaseShiftingTransformer.
For more information check Branch Formulations.
The specified constraint is formulated as:
\[\Theta^\text{min} \le \theta^\text{shift}_t \le \Theta^\text{max}, \quad \forall t \in \{1,\dots,T\}\]
Two Terminal and Multi-Terminal HVDC Constraints
PowerSimulations.ConverterLossConstraint — Type
Struct to create the constraints that decide the balance of AC and DC power of the converter.
The specified constraints are formulated as:
\[\begin{align*} & p_ac = p_dc - loss_t \quad \forall t \in \{1,\dots, T\} \\ & loss_t = a i_c^2 + b i_c + c \\ \end{align*}\]
PowerSimulations.InterpolationVoltageConstraints — Type
Struct to create the Quadratic PWL interpolation constraints that decide square value of the voltage. In this case x = voltage and y = squared_voltage. The specified constraints are formulated as:
\[\begin{align*} & x = x_0 + \sum_{k=1}^K (x_{k} - x_{k-1}) \delta_k, \quad \forall t \in \{1,\dots, T\} \\ & y = y_0 + \sum_{k=1}^K (x_{k} - x_{k-1}) \delta_k, \quad \forall t \in \{1,\dots, T\} \\ & z_k \le \delta_k, \quad \forall t \in \{1,\dots, T\}, \forall k \in \{1,\dots, K-1\} \\ & z_k \ge \delta_{k+1}, \quad \forall t \in \{1,\dots, T\}, \forall k \in \{1,\dots, K-1\} \\ \end{align*}\]
PowerSimulations.InterpolationCurrentConstraints — Type
Struct to create the Quadratic PWL interpolation constraints that decide square value of the current. In this case x = current and y = squared_current. The specified constraints are formulated as:
\[\begin{align*} & x = x_0 + \sum_{k=1}^K (x_{k} - x_{k-1}) \delta_k, \quad \forall t \in \{1,\dots, T\} \\ & y = y_0 + \sum_{k=1}^K (x_{k} - x_{k-1}) \delta_k, \quad \forall t \in \{1,\dots, T\} \\ & z_k \le \delta_k, \quad \forall t \in \{1,\dots, T\}, \forall k \in \{1,\dots, K-1\} \\ & z_k \ge \delta_{k+1}, \quad \forall t \in \{1,\dots, T\}, \forall k \in \{1,\dots, K-1\} \\ \end{align*}\]
PowerSimulations.InterpolationBilinearConstraints — Type
Struct to create the Quadratic PWL interpolation constraints that decide square value of the bilinear variable γ. In this case x = γ and y = squared_γ. The specified constraints are formulated as:
\[\begin{align*} & x = x_0 + \sum_{k=1}^K (x_{k} - x_{k-1}) \delta_k, \quad \forall t \in \{1,\dots, T\} \\ & y = y_0 + \sum_{k=1}^K (x_{k} - x_{k-1}) \delta_k, \quad \forall t \in \{1,\dots, T\} \\ & z_k \le \delta_k, \quad \forall t \in \{1,\dots, T\}, \forall k \in \{1,\dots, K-1\} \\ & z_k \ge \delta_{k+1}, \quad \forall t \in \{1,\dots, T\}, \forall k \in \{1,\dots, K-1\} \\ \end{align*}\]
PowerSimulations.CurrentAbsoluteValueConstraint — Type
Struct to create the constraints that set the absolute value for the current to use in losses through a lossy Interconnecting Power Converter. The specified constraint is formulated as:
\[\begin{align*} & i_c^{dc} = i_c^+ - i_c^-, \quad \forall t \in \{1,\dots, T\} \\ & i_c^+ \le I_{max} \cdot \nu_c, \quad \forall t \in \{1,\dots, T\} \\ & i_c^+ \le I_{max} \cdot (1 - \nu_c), \quad \forall t \in \{1,\dots, T\} \end{align*}\]
PowerSimulations.ConverterPowerCalculationConstraint — Type
Struct to create the constraints that compute the converter DC power based on current and voltage.
The specified constraints are formulated as:
\[\begin{align*} & p_c = 0.5 * (γ^sq - v^sq - i^sq), \quad \forall t \in \{1,\dots, T\} \\ & γ_c = v_c + i_c, \quad \forall t \in \{1,\dots, T\} \\ \end{align*}\]
PowerSimulations.ConverterMcCormickEnvelopes — Type
Struct to create the McCormick envelopes constraints that decide the bounds on the DC active power.
The specified constraints are formulated as:
\[\begin{align*} & p_c >= V^{min} i_c + v_c I^{min} - I^{min}V^{min}, \quad \forall t \in \{1,\dots, T\} \\ & p_c >= V^{max} i_c + v_c I^{max} - I^{max}V^{max}, \quad \forall t \in \{1,\dots, T\} \\ & p_c <= V^{max} i_c + v_c I^{min} - I^{min}V^{max}, \quad \forall t \in \{1,\dots, T\} \\ & p_c <= V^{min} i_c + v_c I^{max} - I^{max}V^{min}, \quad \forall t \in \{1,\dots, T\} \\ \end{align*}\]
PowerSimulations.DCLineCurrentConstraint — Type
Struct to create the constraints that set the current flowing through a DC line.
\[\begin{align*} & i_l^{dc} = \frac{1}{r_l} (v_{from,l} - v_{to,l}), \quad \forall t \in \{1,\dots, T\} \end{align*}\]
PowerSimulations.DCCurrentBalance — Type
Struct for DC current balance in multi-terminal DC networks
Contingency Constraints
PowerSimulations.PostContingencyGenerationBalanceConstraint — Type
Struct to create the constraint to balance active power. For more information check ThermalGen Formulations.
The specified constraint is generally formulated as:
\[\sum_{g \in \mathcal{G}_c} p_{g,t} &= \sum_{g \in \mathcal{G}} \Delta p_{g, c, t} &\quad \forall c \in \mathcal{C} \ \forall t \in \{1, \dots, T\}\]
PowerSimulations.PostContingencyActivePowerVariableLimitsConstraint — Type
Struct to create the constraint to limit post-contingency active power expressions. For more information check Device Formulations.
The specified constraint depends on the UpperBound and LowerBound expressions, but in its most basic formulation is of the form:
\[P^\text{min} \le p_t + \Delta p_{c, t} \le P^\text{max}, \quad \forall c \in \mathcal{C} \ \forall t \in \{1,\dots,T\}\]
PowerSimulations.PostContingencyActivePowerReserveDeploymentVariableLimitsConstraint — Type
Struct to create the constraint to limit post-contingency active power reserve deploymentexpressions. For more information check Device Formulations.
The specified constraint depends on the UpperBound and LowerBound expressions, but in its most basic formulation is of the form:
\[\Delta rsv_{r, c, t} \le rsv_{r, c, t}, \quad \forall r \in \mathcal{R} \ \forall c \in \mathcal{C} \ \forall t \in \{1,\dots,T\}\]
Market Bid Cost Constraints
PowerSimulations.PiecewiseLinearBlockIncrementalOfferConstraint — Type
Struct to create the PiecewiseLinearBlockIncrementalOfferConstraint associated with a specified variable.
See Piecewise linear cost functions for more information.
PowerSimulations.PiecewiseLinearBlockDecrementalOfferConstraint — Type
Struct to create the PiecewiseLinearBlockDecrementalOfferConstraint associated with a specified variable.
See Piecewise linear cost functions for more information.
Feedforward Constraints
PowerSimulations.FeedforwardSemiContinuousConstraint — Type
Struct to create the constraint for semicontinuous feedforward limits.
For more information check Feedforward Formulations.
The specified constraint is formulated as:
\[\begin{align*} & \text{ActivePowerRangeExpressionUB}_t := p_t^\text{th} - \text{on}_t^\text{th}P^\text{th,max} \le 0, \quad \forall t\in \{1, \dots, T\} \\ & \text{ActivePowerRangeExpressionLB}_t := p_t^\text{th} - \text{on}_t^\text{th}P^\text{th,min} \ge 0, \quad \forall t\in \{1, \dots, T\} \end{align*}\]
PowerSimulations.FeedforwardUpperBoundConstraint — Type
Struct to create the constraint for upper bound feedforward limits.
For more information check Feedforward Formulations.
The specified constraint is formulated as:
\[\begin{align*} & \text{AffectedVariable}_t - p_t^\text{ff,ubsl} \le \text{SourceVariableParameter}_t, \quad \forall t \in \{1,\dots, T\} \end{align*}\]
PowerSimulations.FeedforwardLowerBoundConstraint — Type
Struct to create the constraint for lower bound feedforward limits.
For more information check Feedforward Formulations.
The specified constraint is formulated as:
\[\begin{align*} & \text{AffectedVariable}_t + p_t^\text{ff,lbsl} \ge \text{SourceVariableParameter}_t, \quad \forall t \in \{1,\dots, T\} \end{align*}\]
Parameters
Time Series Parameters
PowerSimulations.ActivePowerTimeSeriesParameter — Type
Parameter to define active power time series
PowerSimulations.ReactivePowerTimeSeriesParameter — Type
Parameter to define reactive power time series
PowerSimulations.RequirementTimeSeriesParameter — Type
Parameter to define requirement time series
PowerSimulations.ReactivePowerOffsetParameter — Type
Parameter to define reactive power offset during an event.
PowerSimulations.ActivePowerOutTimeSeriesParameter — Type
Parameter to define active power out time series
PowerSimulations.ActivePowerInTimeSeriesParameter — Type
Parameter to define active power in time series
PowerSimulations.FuelCostParameter — Type
Parameter to define fuel cost time series
PowerSimulations.FromToFlowLimitParameter — Type
Parameter to define Flow From_To limit time series
PowerSimulations.ToFromFlowLimitParameter — Type
Parameter to define Flow To_From limit time series
Variable Value Parameters
PowerSimulations.UpperBoundValueParameter — Type
Parameter to define variable upper bound
PowerSimulations.LowerBoundValueParameter — Type
Parameter to define variable lower bound
PowerSimulations.OnStatusParameter — Type
Parameter to define unit commitment status updated from the system state
PowerSimulations.FixValueParameter — Type
Parameter to FixValueParameter
Objective Function Parameters
PowerSimulations.CostFunctionParameter — Type
Parameter to define cost function coefficient
Events Parameters
PowerSimulations.AvailableStatusChangeCountdownParameter — Type
Parameter to record that the component changed in the availability status
PowerSimulations.AvailableStatusParameter — Type
Parameter to define component availability status updated from the system state
PowerSimulations.ActivePowerOffsetParameter — Type
Parameter to define active power offset during an event.
PowerSimulations.DynamicBranchRatingTimeSeriesParameter — Type
Parameter to define the dynamic rating time series of a branch
PowerSimulations.PostContingencyDynamicBranchRatingTimeSeriesParameter — Type
Parameter to define the dynamic ratings time series of an AC branch for post-contingency condition
Results
Acessing Optimization Model
PowerSimulations.serialize_optimization_model — Method
serialize_optimization_model(
container::PowerSimulations.OptimizationContainer,
save_path::String
)
Exports the OpModel JuMP object in MathOptFormat
PowerSimulations.get_all_constraint_index — Method
get_all_constraint_index(
model::PowerSimulations.OperationModel
) -> Vector{Tuple{InfrastructureSystems.Optimization.ConstraintKey, Int64, Int64}}
Each Tuple corresponds to (conname, internalindex, moi_index)
PowerSimulations.get_all_variable_index — Method
get_all_variable_index(
model::PowerSimulations.OperationModel
) -> Vector{Tuple{Symbol, Int64, Int64}}
Each Tuple corresponds to (conname, internalindex, moi_index)
Accessing Problem Results
InfrastructureSystems.Optimization.OptimizationProblemResults — Method
OptimizationProblemResults(
model::DecisionModel
) -> OptimizationProblemResults
Construct OptimizationProblemResults from a solved DecisionModel.
InfrastructureSystems.Optimization.OptimizationProblemResults — Method
OptimizationProblemResults(
model::EmulationModel
) -> OptimizationProblemResults
Construct OptimizationProblemResults from a solved EmulationModel.
Accessing Simulation Results
PowerSimulations.SimulationResults — Type
SimulationResults(
path::AbstractString,
name::AbstractString;
...
) -> SimulationResults
SimulationResults(
path::AbstractString,
name::AbstractString,
execution;
ignore_status
) -> SimulationResults
Construct SimulationResults from a simulation output directory.
Arguments
path::AbstractString: Simulation output directoryname::AbstractString: Simulation nameexecution::AbstractString: Execution number. Default is the most recent.ignore_status::Bool: If true, return results even if the simulation failed.
PowerSimulations.SimulationResults — Method
SimulationResults(
sim::Simulation;
ignore_status,
kwargs...
) -> SimulationResults
Construct SimulationResults from a simulation.
InfrastructureSystems.Optimization.export_results — Method
export_results(results::SimulationResults, exports)
Export results to files in the results directory.
Arguments
results::SimulationResults: simulation resultsexports: SimulationResultsExport or anything that can be passed to its constructor. (such as Dict or path to JSON file)
An example JSON file demonstrating possible options is below. Note that start_time, end_time, path, and format are optional.
{
"decision_models": [
{
"name": "ED",
"variables": [
"P__ThermalStandard",
],
"parameters": [
"all"
]
},
{
"name": "UC",
"variables": [
"On__ThermalStandard"
],
"parameters": [
"all"
],
"duals": [
"all"
]
}
],
"start_time": "2020-01-01T04:00:00",
"end_time": null,
"path": null,
"format": "csv"
}
InfrastructureSystems.Optimization.read_aux_variable — Method
read_aux_variable(
res::PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults},
args...;
initial_time,
count,
store,
table_format
) -> SortedDict{_A, _B, Base.Order.ForwardOrdering} where {_A, _B}
Return the values for the requested auxillary variables. It keeps requests when performing multiple retrievals.
Arguments
args: Can be a string returned fromlist_aux_variable_namesor args that can be splatted into a AuxVarKey.initial_time::Dates.DateTime: initial of the requested resultscount::Int: Number of results
InfrastructureSystems.Optimization.read_dual — Method
read_dual(
res::PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults},
args...;
initial_time,
count,
store,
table_format
) -> SortedDict{_A, _B, Base.Order.ForwardOrdering} where {_A, _B}
Return the values for the requested dual. It keeps requests when performing multiple retrievals.
Arguments
args: Can be a string returned fromlist_dual_namesor args that can be splatted into a ConstraintKey.initial_time::Dates.DateTime: initial of the requested resultscount::Int: Number of resultsstore::SimulationStore: a store that has been opened for readingtable_format::TableFormat: Format of the table to be returned. Default isTableFormat.LONGwhere the columns areDateTime,name, andvaluewhen the data has two dimensions andDateTime,name,name2, andvaluewhen the data has three dimensions. Set to itTableFormat.WIDEto pivot the names as columns. Note:TableFormat.WIDEis not supported when the data has three dimensions.
InfrastructureSystems.Optimization.read_expression — Method
read_expression(
res::PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults},
args...;
initial_time,
count,
store,
table_format
) -> SortedDict{_A, _B, Base.Order.ForwardOrdering} where {_A, _B}
Return the values for the requested auxillary variables. It keeps requests when performing multiple retrievals.
Arguments
args: Can be a string returned fromlist_expression_namesor args that can be splatted into a ExpressionKey.initial_time::Dates.DateTime: initial of the requested resultscount::Int: Number of results
InfrastructureSystems.Optimization.read_parameter — Method
read_parameter(
res::PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults},
args...;
initial_time,
count,
store,
table_format
) -> SortedDict{_A, _B, Base.Order.ForwardOrdering} where {_A, _B}
Return the values for the requested parameter. It keeps requests when performing multiple retrievals.
Arguments
args: Can be a string returned fromlist_parameter_namesor args that can be splatted into a ParameterKey.initial_time::Dates.DateTime: initial of the requested resultscount::Int: Number of resultstable_format::TableFormat: Format of the table to be returned. Default isTableFormat.LONGwhere the columns areDateTime,name, andvaluewhen the data has two dimensions andDateTime,name,name2, andvaluewhen the data has three dimensions. Set to itTableFormat.WIDEto pivot the names as columns. Note:TableFormat.WIDEis not supported when the data has three dimensions.
InfrastructureSystems.Optimization.read_variable — Method
read_variable(
res::PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults},
args...;
initial_time,
count,
store,
table_format
) -> SortedDict{_A, _B, Base.Order.ForwardOrdering} where {_A, _B}
Return the values for the requested variable. It keeps requests when performing multiple retrievals.
Arguments
args: Can be a string returned fromlist_variable_namesor args that can be splatted into a VariableKey.initial_time::Dates.DateTime: initial of the requested resultscount::Int: Number of resultsstore::SimulationStore: a store that has been opened for readingtable_format::TableFormat: Format of the table to be returned. Default isTableFormat.LONGwhere the columns areDateTime,name, andvaluewhen the data has two dimensions andDateTime,name,name2, andvaluewhen the data has three dimensions. Set to itTableFormat.WIDEto pivot the names as columns. Note:TableFormat.WIDEis not supported when the data has three dimensions.
Examples
read_variable(results, ActivePowerVariable, ThermalStandard)
read_variable(results, "ActivePowerVariable__ThermalStandard")
read_variable(results, "ActivePowerVariable__ThermalStandard", table_format = TableFormat.WIDE)PowerSimulations.get_decision_problem_results — Method
get_decision_problem_results(
results::SimulationResults,
problem::String;
populate_system,
populate_units
) -> PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults}
Return SimulationProblemResults corresponding to a SimulationResults
Arguments
sim_results::PSI.SimulationResults: the simulation results to read fromproblem::String: the name of the problem (e.g., "UC", "ED")populate_system::Bool = true: whether to set the results' system as if usingget_system!populate_units::Union{IS.UnitSystem, String, Nothing} = IS.UnitSystem.NATURAL_UNITS: the units system with which to populate the results' system, if any (requirespopulate_system=true)
PowerSimulations.get_emulation_problem_results — Method
get_emulation_problem_results(
results::SimulationResults;
populate_system,
populate_units
) -> PowerSimulations.SimulationProblemResults{PowerSimulations.EmulationModelSimulationResults}
Return SimulationProblemResults corresponding to a SimulationResults
Arguments
sim_results::PSI.SimulationResults: the simulation results to read frompopulate_system::Bool = true: whether to set the results' system as if usingget_system!populate_units::Union{IS.UnitSystem, String, Nothing} = IS.UnitSystem.NATURAL_UNITS: the units system with which to populate the results' system, if any (requirespopulate_system=true)
PowerSimulations.list_decision_problems — Method
list_decision_problems(
results::SimulationResults
) -> Vector{String}
Return the problem names in the simulation.
PowerSimulations.load_results! — Method
load_results!(
res::PowerSimulations.SimulationProblemResults{PowerSimulations.DecisionModelSimulationResults},
count::Int64;
initial_time,
variables,
duals,
parameters,
aux_variables,
expressions,
store
)
Load the simulation results into memory for repeated reads. This is useful when loading results from remote locations over network connections, when reading the same data very many times, etc. Multiple calls augment the cache according to these rules, where "variable" means "variable, expression, etc.":
- Requests for an already cached variable at a lesser
countthan already cached do not decrease thecountof the cached variable - Requests for an already cached variable at a greater
countthan already cached do increase thecountof the cached variable - Requests for new variables are fulfilled without evicting existing variables
Note that count is global across all variables, so increasing the count re-reads already cached variables. For each variable, each element must be the name encoded as a string, like "ActivePowerVariable__ThermalStandard" or a Tuple with its constituent types, like (ActivePowerVariable, ThermalStandard). To clear the cache, use Base.empty!.
Arguments
count::Int: Number of windows to load.initial_time::Dates.DateTime: Initial time of first window to load. Defaults to first.aux_variables::Vector{Union{String, Tuple}}: Optional list of aux variables to load.duals::Vector{Union{String, Tuple}}: Optional list of duals to load.expressions::Vector{Union{String, Tuple}}: Optional list of expressions to load.parameters::Vector{Union{String, Tuple}}: Optional list of parameters to load.variables::Vector{Union{String, Tuple}}: Optional list of variables to load.
PowerSimulations.load_results! — Method
load_results!(
res::PowerSimulations.SimulationProblemResults{PowerSimulations.EmulationModelSimulationResults};
aux_variables,
duals,
expressions,
parameters,
variables
)
Load the simulation results into memory for repeated reads. This is useful when loading results from remote locations over network connections.
For each variable/parameter/dual, etc., each element must be the name encoded as a string, like "ActivePowerVariable__ThermalStandard"or a Tuple with its constituent types, like(ActivePowerVariable, ThermalStandard)`.
Arguments
aux_variables::Vector{Union{String, Tuple}}: Optional list of aux variables to load.duals::Vector{Union{String, Tuple}}: Optional list of duals to load.expressions::Vector{Union{String, Tuple}}: Optional list of expressions to load.parameters::Vector{Union{String, Tuple}}: Optional list of parameters to load.variables::Vector{Union{String, Tuple}}: Optional list of variables to load.
InfrastructureSystems.Optimization.get_timestamps — Method
get_timestamps(
result::PowerSimulations.SimulationProblemResults
) -> StepRange{Dates.DateTime, Dates.Millisecond}
Return a reference to a StepRange of available timestamps.
InfrastructureSystems.Optimization.list_aux_variable_names — Method
list_aux_variable_names(
res::PowerSimulations.SimulationProblemResults
) -> Vector{String}
Return an array of auxillary variable names (strings) that are available for reads.
InfrastructureSystems.Optimization.list_dual_names — Method
list_dual_names(
res::PowerSimulations.SimulationProblemResults
) -> Vector{String}
Return an array of dual names (strings) that are available for reads.
InfrastructureSystems.Optimization.list_expression_names — Method
list_expression_names(
res::PowerSimulations.SimulationProblemResults
) -> Vector{String}
Return an array of expression names (strings) that are available for reads.
InfrastructureSystems.Optimization.list_parameter_names — Method
list_parameter_names(
res::PowerSimulations.SimulationProblemResults
) -> Vector{String}
Return an array of parmater names (strings) that are available for reads.
InfrastructureSystems.Optimization.list_variable_names — Method
list_variable_names(
res::PowerSimulations.SimulationProblemResults
) -> Vector{String}
Return an array of variable names (strings) that are available for reads.
InfrastructureSystems.Optimization.read_optimizer_stats — Method
read_optimizer_stats(
res::PowerSimulations.SimulationProblemResults;
store
) -> Any
Return the optimizer stats for the problem as a DataFrame.
Accepted keywords
store::SimulationStore: a store that has been opened for reading
PowerSimulations.get_system! — Method
get_system!(
results::Union{OptimizationProblemResults, PowerSimulations.SimulationProblemResults};
kwargs...
) -> Union{Nothing, InfrastructureSystems.InfrastructureSystemsType}
Return the system used for the problem. If the system hasn't already been deserialized or set with set_system! then deserialize and store it.
If the simulation was configured to serialize all systems to file then the returned system will include all data. If that was not configured then the returned system will include all data except time series data.
PowerSimulations.read_realized_aux_variable — Method
read_realized_aux_variable(
res::PowerSimulations.SimulationProblemResults,
aux_variable::AbstractString;
kwargs...
) -> Any
Return the final values for the requested auxiliary variable for each time step for a problem.
Refer to read_realized_variable for help and examples.
PowerSimulations.read_realized_aux_variables — Method
read_realized_aux_variables(
res::PowerSimulations.SimulationProblemResults;
kwargs...
) -> Dict
Return the final values for the requested auxiliary variables for each time step for a problem.
Refer to read_realized_aux_variables for help and examples.
PowerSimulations.read_realized_dual — Method
read_realized_dual(
res::PowerSimulations.SimulationProblemResults,
dual::AbstractString;
kwargs...
) -> Any
Return the final values for the requested dual for each time step for a problem.
Refer to read_realized_variable for help and examples.
PowerSimulations.read_realized_duals — Method
read_realized_duals(
res::PowerSimulations.SimulationProblemResults;
kwargs...
) -> Dict
Return the final values for the requested duals for each time step for a problem.
Refer to read_realized_duals for help and examples.
PowerSimulations.read_realized_expression — Method
read_realized_expression(
res::PowerSimulations.SimulationProblemResults,
expression::AbstractString;
kwargs...
) -> Any
Return the final values for the requested expression for each time step for a problem.
Refer to read_realized_variable for help and examples.
PowerSimulations.read_realized_expressions — Method
read_realized_expressions(
res::PowerSimulations.SimulationProblemResults;
kwargs...
) -> Dict
Return the final values for the requested expressions for each time step for a problem.
Refer to read_realized_expressions for help and examples.
PowerSimulations.read_realized_parameter — Method
read_realized_parameter(
res::PowerSimulations.SimulationProblemResults,
parameter::AbstractString;
kwargs...
) -> Any
Return the final values for the requested parameter for each time step for a problem.
Refer to read_realized_variable for help and examples.
PowerSimulations.read_realized_parameters — Method
read_realized_parameters(
res::PowerSimulations.SimulationProblemResults;
kwargs...
) -> Dict
Return the final values for the requested parameters for each time step for a problem.
Refer to read_realized_parameters for help and examples.
PowerSimulations.read_realized_variable — Method
read_realized_variable(
res::PowerSimulations.SimulationProblemResults,
variable::AbstractString;
kwargs...
) -> Any
Return the final values for the requested variable for each time step for a problem.
Decision problem results are returned in a Dict{DateTime, DataFrame}.
Emulation problem results are returned in a DataFrame.
Limit the data sizes returned by specifying initial_time and count for decision problems or start_time and len for emulation problems.
See also load_results! to preload data into memory.
Arguments
variable::Union{String, Tuple}: Variable name as a string or a Tuple with variable type and device type.initial_time::Dates.DateTime: Initial time of the requested results. Decision problems only.count::Int: Number of results. Decision problems only.start_time::Dates.DateTime: Start time of the requested results. Emulation problems only.len::Int: Number of rows in each DataFrame. Emulation problems only.table_format::TableFormat: Format of the table to be returned. Default isTableFormat.LONGwhere the columns areDateTime,name, andvaluewhen the data has two dimensions andDateTime,name,name2, andvaluewhen the data has three dimensions. Set to itTableFormat.WIDEto pivot the names as columns. Note:TableFormat.WIDEis not supported when the data has three dimensions.
Examples
julia > read_realized_variable(results, "ActivePowerVariable__ThermalStandard")
julia > read_realized_variable(results, (ActivePowerVariable, ThermalStandard))
julia > read_realized_variable(results, (ActivePowerVariable, ThermalStandard), table_format = TableFormat.WIDE)PowerSimulations.read_realized_variables — Method
read_realized_variables(
res::PowerSimulations.SimulationProblemResults;
kwargs...
) -> Dict
Return the final values for the requested variables for each time step for a problem.
Decision problem results are returned in a Dict{String, Dict{DateTime, DataFrame}}.
Emulation problem results are returned in a Dict{String, DataFrame}.
Limit the data sizes returned by specifying initial_time and count for decision problems or start_time and len for emulation problems.
If the Julia process is started with multiple threads, the code will read the variables in parallel.
See also load_results! to preload data into memory.
Arguments
variables::Vector{Union{String, Tuple}}: Variable name as a string or a Tuple with variable type and device type. If not provided then return all variables.initial_time::Dates.DateTime: Initial time of the requested results. Decision problems only.count::Int: Number of results. Decision problems only.start_time::Dates.DateTime: Start time of the requested results. Emulation problems only.len::Int: Number of rows in each DataFrame. Emulation problems only.table_format::TableFormat: Format of the table to be returned. Default isTableFormat.LONGwhere the columns areDateTime,name, andvaluewhen the data has two dimensions andDateTime,name,name2, andvaluewhen the data has three dimensions. Set to itTableFormat.WIDEto pivot the names as columns, matching earlier versions of PowerSimulations.jl. Note:TableFormat.WIDEis not supported when the data has three dimensions.
Examples
julia> variables_as_strings =
["ActivePowerVariable__ThermalStandard", "ActivePowerVariable__RenewableDispatch"]
julia> variables_as_types =
[(ActivePowerVariable, ThermalStandard), (ActivePowerVariable, RenewableDispatch)]
julia> df_long =read_realized_variables(results, variables_as_strings)
julia> df_long = read_realized_variables(results, variables_as_types)
julia> df_wide = read_realized_variables(results, variables_as_types, table_format = TableFormat.WIDE)
julia> using DataFramesMeta
julia> df_agg_generators = @chain df_long begin
@groupby(:DateTime)
@combine(:value = sum(:value))
endPowerSimulations.set_system! — Method
set_system!(
results::PowerSimulations.SimulationProblemResults,
system::AbstractString
)
Set the system in the results instance.
Throws InvalidValue if the system UUID is incorrect.
Arguments
results::SimulationProblemResults: Results objectsystem::AbstractString: Path to the system json file
Examples
julia > set_system!(res, "my_path/system_data.json")PowerSimulations.SimulationPartitionResults — Type
Handles merging of simulation partitions
InfrastructureSystems.Optimization.read_optimizer_stats — Method
read_optimizer_stats(
store::PowerSimulations.HdfSimulationStore,
model_name
) -> Any
Return the optimizer stats for a problem as a DataFrame.
InfrastructureSystems.Optimization.read_optimizer_stats — Method
read_optimizer_stats(
store::PowerSimulations.HdfSimulationStore,
simulation_step::Int64,
model_name::Symbol,
execution_index::Int64
) -> Any
Read the optimizer stats for a problem execution.
Simulation Recorder
PowerSimulations.list_simulation_events — Method
list_simulation_events(
::Type{T<:InfrastructureSystems.AbstractRecorderEvent},
output_dir::AbstractString;
...
) -> Vector{T} where T<:PowerSimulations.AbstractSimulationStatusEvent
list_simulation_events(
::Type{T<:InfrastructureSystems.AbstractRecorderEvent},
output_dir::AbstractString,
filter_func::Union{Nothing, Function};
step,
model_name
) -> Vector{T} where T<:PowerSimulations.AbstractSimulationStatusEvent
list_simulation_events(
::Type{T},
output_dir::AbstractString,
filter_func::Union{Nothing, Function} = nothing;
step = nothing,
model = nothing,
) where {T <: IS.AbstractRecorderEvent}List simulation events of type T in a simulation output directory.
Arguments
output_dir::AbstractString: Simulation output directoryfilter_func::Union{Nothing, Function} = nothing: Refer toshow_simulation_events.step::Int = nothing: Filter events by step. Required if model is passed.model::Int = nothing: Filter events by model.
PowerSimulations.show_recorder_events — Method
show_recorder_events(
::Type{T<:InfrastructureSystems.AbstractRecorderEvent},
filename::AbstractString;
...
)
show_recorder_events(
::Type{T<:InfrastructureSystems.AbstractRecorderEvent},
filename::AbstractString,
filter_func::Union{Nothing, Function};
wall_time,
kwargs...
)
show_recorder_events(
::Type{T},
filename::AbstractString,
filter_func::Union{Nothing, Function} = nothing;
wall_time = false,
kwargs...,
) where {T <: IS.AbstractRecorderEvent}Show the events of type T in a recorder file.
Arguments
::Type{T}: Recorder event typefilename::AbstractString: recorder filenamefilter_func::Union{Nothing, Function} = nothing: Optional function that accepts an event of type T and returns a Bool. Apply this function to each event and only return events where the result is true.wall_time = false: If true, show the wall_time timestamp.
PowerSimulations.show_simulation_events — Method
show_simulation_events(
::Type{T<:InfrastructureSystems.AbstractRecorderEvent},
output_dir::AbstractString;
...
)
show_simulation_events(
::Type{T<:InfrastructureSystems.AbstractRecorderEvent},
output_dir::AbstractString,
filter_func::Union{Nothing, Function};
step,
model,
wall_time,
kwargs...
)
show_simulation_events(
::Type{T},
output_dir::AbstractString,
filter_func::Union{Nothing,Function} = nothing;
step = nothing,
model = nothing,
wall_time = false,
kwargs...,
) where { T <: IS.AbstractRecorderEvent}Show all simulation events of type T in a simulation output directory.
Arguments
::Type{T}: Recorder event typeoutput_dir::AbstractString: Simulation output directoryfilter_func::Union{Nothing, Function} = nothing: Refer toshow_recorder_events.step::Int = nothing: Filter events by step. Required if model is passed.model::Int = nothing: Filter events by model.wall_time = false: If true, show the wall_time timestamp.