Internal API

PRASCore.Simulations.DispatchProblemType
DispatchProblem(sys::SystemModel)

Create a min-cost flow problem for the multi-region max power delivery problem with generation and storage discharging in decreasing order of priority, and storage charging with excess capacity. Storage and GeneratorStorage devices within a region are represented individually on the network.

This involves injections/withdrawals at one node (regional capacity surplus/shortfall) for each modelled region, as well as two/three nodes associated with each Storage/GeneratorStorage device, and a supplementary "slack" node in the network that can absorb undispatched power or pass unserved energy or unused charging capability through to satisfy power balance constraints.

Flows from the generation nodes are free, while flows to charging and from discharging nodes are costed or rewarded according to the time-to-discharge of the storage device, ensuring efficient coordination across units, while enforcing that storage is only discharged once generation capacity is exhausted (implying an operational strategy that prioritizes resource adequacy over economic arbitrage). This is based on the storage dispatch strategy of Evans, Tindemans, and Angeli, as outlined in "Minimizing Unserved Energy Using Heterogenous Storage Units" (IEEE Transactions on Power Systems, 2019).

Flows to the charging node have an attenuated negative cost (reward), incentivizing immediate storage charging if generation and transmission allows it, while avoiding charging by discharging other storage (since that would incur an overall positive cost).

Flows to the slack node (representing unused generation or storage discharge capacity) are free, but flows from the slack node to serve load incur the lost load penalty of 9999. Flows from the slack node in lieu of storage charging or discharging are free.

Flows on transmission interfaces assume a hurdle rate of 1 to keep unserved energy close to the source of the shortage and eliminate loop flows. This has the side-effect of disincentivising wheeling power across multiple regions for charging purposes, however.

Nodes in the problem are ordered as:

  1. Regions generation surplus/shortfall (Regions order)
  2. Storage discharge capacity (Storage order)
  3. Storage charge capacity (Storage order)
  4. GenerationStorage inflow capacity (GeneratorStorage order)
  5. GenerationStorage discharge capacity (GeneratorStorage order)
  6. GenerationStorage grid injection (GeneratorStorage order)
  7. GenerationStorage charge capacity (GeneratorStorage order)
  8. Slack node

Edges are ordered as:

  1. Regions demand unserved (Regions order)
  2. Regions generation unused (Regions order)
  3. Interfaces forward flow (Interfaces order)
  4. Interfaces reverse flow (Interfaces order)
  5. Storage discharge to grid (Storage order)
  6. Storage discharge unused (Storage order)
  7. Storage charge from grid (Storage order)
  8. Storage charge unused (Storage order)
  9. GenerationStorage discharge to grid (GeneratorStorage order)
  10. GenerationStorage discharge unused (GeneratorStorage order)
  11. GenerationStorage inflow to grid (GenerationStorage order)
  12. GenerationStorage total to grid (GeneratorStorage order)
  13. GenerationStorage charge from grid (GeneratorStorage order)
  14. GenerationStorage charge from inflow (GeneratorStorage order)
  15. GenerationStorage charge unused (GeneratorStorage order)
  16. GenerationStorage inflow unused (GeneratorStorage order)
source
PRASCore.Results.StorageAvailabilityType
StorageAvailability

The StorageAvailability result specification reports the sample-level discrete availability of Storages, producing a StorageAvailabilityResult.

A StorageAvailabilityResult can be indexed by storage device name and a timestamp to retrieve a vector of sample-level availability states for the unit in the given timestep. States are provided as a boolean with true indicating that the unit is available and false indicating that it's unavailable.

Example:

storavail, =
    assess(sys, SequentialMonteCarlo(samples=10), StorageAvailability())

samples = storavail["MyStorage123", ZonedDateTime(2020, 1, 1, 0, tz"UTC")]

@assert samples isa Vector{Bool}
@assert length(samples) == 10
source
SiennaPRASInterface.SPIOutageResultType
SPIOutageResult(; shortfall_samples, gen_availability, stor_availability, gen_stor_availability)

Arguments

  • shortfall_samples::PRASCore.Results.ShortfallSamplesResult: Shortfall Sample Result

  • gen_availability::PRASCore.Results.GeneratorAvailabilityResult: Generator Availability Result

  • stor_availability::PRASCore.Results.StorageAvailabilityResult: Storage Availability Result

  • gen_stor_availability::PRASCore.Results.GeneratorStorageAvailabilityResult: GeneratorStorage Availability Result

SPIOutageResult is used to parse Tuple{Vararg{PRAS.PRASCore.Results.Result}} and add structure to it.

source
SiennaPRASInterface.add_asset_status!Method
add_asset_status!(
    sys::PowerSystems.System,
    results::SiennaPRASInterface.SPIOutageResult,
    template::RATemplate
)

Add the asset status from the worst sample to PSY.TimeSeriesForcedOutage of the component.

Arguments

  • sys::PSY.System: PowerSystems.jl system model
  • results::T: SPIOutageResult
  • template::RATemplate: PRAS problem template

Returns

- PSY System with PSY.TimeSeriesForcedOutage for all components for which asset status is available
source
SiennaPRASInterface.add_to_interface!Method
add_to_interface!(
    _::AreaInterchangeLimit,
    interface,
    s2p_meta,
    forward_row,
    backward_row
) -> Any

Add flow limits of an Sienna interface to an existing PRAS interface

source
SiennaPRASInterface.assign_to_gen_stor_matrices!Method
assign_to_gen_stor_matrices!(
    formulation::HybridSystemPRAS,
    g_s::PowerSystems.Device,
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    charge_cap_array,
    discharge_cap_array,
    inflow_array,
    energy_cap_array,
    gridinj_cap_array
) -> Any

Apply HybridSystem Formulation to fill in a row of a PRAS Matrix. Views should be passed in for all arrays.

source
SiennaPRASInterface.assign_to_gen_stor_matrices!Method
assign_to_gen_stor_matrices!(
    formulation::HydroEnergyReservoirPRAS,
    g_s::PowerSystems.Device,
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    charge_cap_array,
    discharge_cap_array,
    inflow_array,
    energy_cap_array,
    gridinj_cap_array
) -> Any

Apply HydroEnergyReservoir Formulation to fill in a row of a PRAS Matrix. Views should be passed in for all arrays.

source
SiennaPRASInterface.assign_to_line_matrices!Method
assign_to_line_matrices!(
    _::LinePRAS,
    line::PowerSystems.Branch,
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    forward_cap,
    backward_cap
) -> Any

Apply LinePRAS to create PRAS matrices for lines. Views should be passed in.

source
SiennaPRASInterface.build_interfaces_from_linesMethod
build_interfaces_from_lines(
    line_forward_cap::Matrix{Int64},
    line_backward_cap::Matrix{Int64},
    interface_reg_idxs::Vector{Tuple{Int64, Int64}},
    interface_line_idxs::Vector{UnitRange{Int64}},
    s2p_meta::SiennaPRASInterface.S2P_metadata
) -> Interfaces{_A, MW} where _A

Create PRAS interfaces from PRAS Lines

source
SiennaPRASInterface.get_gen_storage_region_indicesMethod
get_gen_storage_region_indices(
    sys::PowerSystems.System,
    regions,
    component_to_formulation::Dict{PowerSystems.Device, GeneratorStoragePRAS}
) -> Tuple{Any, Any}

Extract components with a generator storage formulation.

source
SiennaPRASInterface.get_generator_region_indicesMethod
get_generator_region_indices(
    sys::PowerSystems.System,
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    regions,
    component_to_formulation::Dict{PowerSystems.Device, GeneratorPRAS}
) -> Tuple{Any, Any, Dict{String, Vector{PowerSystems.Device}}}

Extraction of generators using formulation dictionary to create a list of generators and appropriate indices for PRAS. Note that objects with 0 max active power are excluded.

source
SiennaPRASInterface.get_region_loadsMethod
get_region_loads(
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    regions,
    loads_to_formulations::Dict{PowerSystems.Device, SiennaPRASInterface.LoadPRAS}
) -> Matrix{Int64}

Extract region load as a matrix of Int64 values.

source
SiennaPRASInterface.get_sorted_linesMethod
get_sorted_lines(lines::Vector{PSY.Branch}, region_names::Vector{String})

Get sorted lines, interface region indices, and interface line indices.

Arguments

  • lines::Vector{PSY.Branch}: Lines
  • region_names::Vector{String}: Region names

Returns

  • sorted_lines::Vector{PSY.Branch}: Sorted lines
  • interface_reg_idxs::Vector{Tuple{Int, Int}}: Interface region indices
  • interface_line_idxs::Vector{UnitRange{Int}}: Interface line indices
source
SiennaPRASInterface.get_storage_region_indicesMethod
get_storage_region_indices(
    sys::PowerSystems.System,
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    regions,
    component_to_formulation::Dict{PowerSystems.Device, StoragePRAS}
) -> Tuple{Any, Any}

Extraction of storage devices using formulation dictionary to create a list of storage devices and appropriate indices for PRAS.

source
SiennaPRASInterface.get_timestampsMethod
get_timestamps(initial_time, resolution, steps, horizon)

Return a vector of timestamps starting from initial_time with resolution and steps for horizon steps

source
SiennaPRASInterface.initialize_availability!Method

initializeavailability!(rng, availability, nexttransition, devices, tlast)

Arguments

  • rng::Random.AbstractRNG: Random number generator
  • availability::Vector{Bool}: Vector of availability status
  • nexttransition::Vector{Int}: Vector of next transition time
  • devices::Vector{PSY.Generator}: Vector of devices with outage SupplementalAttributes
  • t_last::Int: Last time step

Returns

Modifies input arguments and rereturns

  • availability::Vector{Bool}: Vector of availability status
  • nexttransition::Vector{Int}: Vector of next transition time
source
SiennaPRASInterface.line_ratingMethod
line_rating(line::Branch)

Get the line rating.

Arguments

  • line::Branch: Line

Returns

  • Tuple{forward_capacity::Float64, backward_capacity::Float64}: Line rating
source
SiennaPRASInterface.process_generatorsMethod
process_generators(
    gen::Array{PowerSystems.Device},
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    component_to_formulation::Dict{PowerSystems.Device, GeneratorPRAS},
    lumped_mapping::Dict{String, Vector{PowerSystems.Device}}
) -> Generators{_A, _B, T, MW} where {_A, _B, T<:Period}

Apply GeneratorPRAS to process all generators objects into rows in PRAS matrices:

  • Capacity, λ, μ

Negative max active power will translate into zeros for time series data.

source
SiennaPRASInterface.process_genstorageMethod
process_genstorage(
    gen_stor::Array{PowerSystems.Device},
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    component_to_formulation::Dict{PowerSystems.Device, GeneratorStoragePRAS}
) -> GeneratorStorages{_A, _B, T, MW, MWh} where {_A, _B, T<:Period}

Apply GeneratorStoragePRAS to create PRAS matrices for generator storage

source
SiennaPRASInterface.process_interfacesMethod
process_interfaces(
    interface_reg_idxs::Vector{Tuple{Int64, Int64}},
    regions,
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    interfaces_to_formulation::Dict{PowerSystems.Device, SiennaPRASInterface.InterfacePRAS}
) -> Interfaces{_A, MW} where _A

Process interfaces using a formulation dictionary to create PRAS matrices.

source
SiennaPRASInterface.process_linesMethod
process_lines(
    sorted_lines::Vector{PowerSystems.Branch},
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    lines_to_formulation::Dict{PowerSystems.Device, LinePRAS}
) -> Lines{_A, _B, T, MW} where {_A, _B, T<:Period}

Create PRAS from sorted lines and formulations.

source
SiennaPRASInterface.process_storageMethod
process_storage(
    stor::Array{PowerSystems.Device},
    s2p_meta::SiennaPRASInterface.S2P_metadata,
    component_to_formulation::Dict{PowerSystems.Device, StoragePRAS}
) -> Storages{_A, _B, T, MW, MWh} where {_A, _B, T<:Period}

Apply StoragePRAS to process all storage objects

source
SiennaPRASInterface.rate_to_probabilityMethod
rate_to_probability(for_gen::Float64, mttr::Int64)

Converts the forced outage rate and mean time to repair to the λ and μ parameters

Arguments

  • for_gen::Float64: Forced outage rate [1/T]
  • mttr::Int64: Mean time to repair [T]

Returns

  • λ::Float64: Transition probability from online to offline [1/T]
  • μ::Float64: Transition rate from offline to online [1/T]

Reference

https://core.ac.uk/download/pdf/13643059.pdf

source