Internal API

PowerSystems._pti_dtypesConstant

lookup array of data types for PTI file sections given by field_name, as enumerated by PSS/E Program Operation Manual.

source
PowerSystems.EX4VSAType
mutable struct EX4VSA <: AVR
    Iflim::Float64
    d::Float64
    f::Float64
    Spar::Float64
    K1::Float64
    K2::Float64
    Oel_lim::MinMax
    G::Float64
    Ta::Float64
    Tb::Float64
    Te::Float64
    E_lim::MinMax
    V_ref::Float64
    ext::Dict{String, Any}
    states::Vector{Symbol}
    n_states::Int
    internal::InfrastructureSystemsInternal
end

IEEE Excitation System for Voltage Security Assesment

Arguments

  • Iflim::Float64: OEL Field current limit, validation range: (0, nothing)
  • d::Float64: OEL parameter d, validation range: (0, nothing)
  • f::Float64: OEL parameter f, validation range: (0, nothing)
  • Spar::Float64: OEL parameter Spar, validation range: (0, nothing)
  • K1::Float64: OEL delay time constant, validation range: (0, nothing)
  • K2::Float64: OEL parameter K2, validation range: (0, nothing)
  • Oel_lim::MinMax: Oel integrator limits (Oelmin, Oelmax)
  • G::Float64: AVR Exciter Gain, validation range: (0, nothing)
  • Ta::Float64: Numerator lead-lag (lag) time constant in s, validation range: (0, nothing)
  • Tb::Float64: Denominator lead-lag (lag) time constant in s, validation range: (0, nothing)
  • Te::Float64: Exciter Time Constant in s, validation range: (0, nothing)
  • E_lim::MinMax: Voltage regulator limits (regulator output) (Emin, Emax)
  • V_ref::Float64: (default: 1.0) Reference Voltage Set-point (pu), validation range: (0, nothing)
  • ext::Dict{String, Any}: (default: Dict{String, Any}()) An extra dictionary for users to add metadata that are not used in simulation.
  • states::Vector{Symbol}: (Do not modify.) The states are:
Vll: Lead-lag internal state,
Vex: Exciter Output, 
oel: OEL integrator state
  • n_states::Int: (Do not modify.) The EX4VSA has 3 states
  • internal::InfrastructureSystemsInternal: (Do not modify.) PowerSystems.jl internal reference
source
PowerSystems.EXST1Type
mutable struct EXST1 <: AVR
    Tr::Float64
    Vi_lim::MinMax
    Tc::Float64
    Tb::Float64
    Ka::Float64
    Ta::Float64
    Vr_lim::MinMax
    Kc::Float64
    Kf::Float64
    Tf::Float64
    V_ref::Float64
    ext::Dict{String, Any}
    states::Vector{Symbol}
    n_states::Int
    internal::InfrastructureSystemsInternal
end

IEEE Type ST1 Excitation System (PTI version)

Arguments

  • Tr::Float64: Voltage Measurement Time Constant in s, validation range: (0, nothing)
  • Vi_lim::MinMax: Voltage input limits (Vimin, Vimax)
  • Tc::Float64: Numerator lead-lag (lead) time constant in s, validation range: (0, nothing)
  • Tb::Float64: Denominator lead-lag (lag) time constant in s, validation range: (0, nothing)
  • Ka::Float64: Amplifier Gain, validation range: (0, nothing)
  • Ta::Float64: Amplifier Time Constant in s, validation range: (0, nothing)
  • Vr_lim::MinMax: Voltage regulator limits (regulator output) (Vrmin, Vrmax)
  • Kc::Float64: Current field constant limiter multiplier, validation range: (0, nothing)
  • Kf::Float64: Excitation control system stabilizer gain, validation range: (eps(), 0.3)
  • Tf::Float64: Excitation control system stabilizer time constant, validation range: (eps(), nothing)
  • V_ref::Float64: (default: 1.0) Reference Voltage Set-point (pu), validation range: (0, nothing)
  • ext::Dict{String, Any}: (default: Dict{String, Any}()) An extra dictionary for users to add metadata that are not used in simulation.
  • states::Vector{Symbol}: (Do not modify.) The states are:
Vm: Sensed Terminal Voltage,
Vrll: Lead-Lag state,
Vr: Regulator Output, 
Vfb: Feedback state
  • n_states::Int: (Do not modify.) The EXST1 has 4 states
  • internal::InfrastructureSystemsInternal: (Do not modify.) PowerSystems.jl internal reference
source
PowerSystems.PowerFlowDataNetworkMethod
PowerFlowDataNetwork(
    file::Union{IO, String};
    kwargs...
) -> PowerSystems.PowerFlowDataNetwork

Constructs PowerFlowDataNetwork from a raw file. Currently Supports PSSE data files v30, v32 and v33

source
PowerSystems.PumpHydroStatusModule.PumpHydroStatusType

PumpHydroStatus

Operating status of a pumped‑storage hydro unit.

ValueDescription
OFFUnit is idle — neither generating nor pumping
GENGenerating mode (turbine operation), producing active power
PUMPPumping mode, consuming active power to store energy

Notes

  • Integer values are 0, 1, and -1 respectively; the sign reflects net active power direction (positive = generation, negative = pumping).
  • Intended for use in scheduling, dispatch, and state-tracking of pumped‑storage units.
source
PowerSystems.StartUpStagesType

NamedTuple{(:hot, :warm, :cold), NTuple{3, Float64}} representing the start-up costs ($) for a multi-start thermal generator at each temperature stage:

  • hot: cost when the unit is hot (shortest off-time)
  • warm: cost when the unit is warm (medium off-time)
  • cold: cost when the unit is cold (longest off-time)

For single-stage generators, only the hot field is meaningful. See also single_start_up_to_stages.

source
Base.convertMethod
convert(
    _::Type{@NamedTuple{min::Float64, max::Float64}},
    input::Tuple{Float64, Float64}
) -> @NamedTuple{min::Float64, max::Float64}

Convert Tuple to Min Max Named Tuple

source
Base.convertMethod
convert(
    _::Type{@NamedTuple{up::Float64, down::Float64}},
    input::Tuple{Float64, Float64}
) -> @NamedTuple{up::Float64, down::Float64}

Convert Tuple to Up Down Named Tuple

source
InfrastructureSystems.fast_deepcopy_systemMethod
fast_deepcopy_system(
    sys::System;
    skip_time_series,
    skip_supplemental_attributes
) -> System

Make a deepcopy of a System more quickly by skipping the copying of time series and/or supplemental attributes.

Arguments

  • sys::System: the System to copy
  • skip_time_series::Bool = true: whether to skip copying time series
  • skip_supplemental_attributes::Bool = true: whether to skip copying supplemental attributes

Note that setting both skip_time_series and skip_supplemental_attributes to false results in the same behavior as deepcopy with no performance improvement.

source
PowerSystems._attach_impedance_correction_tables!Method
_attach_impedance_correction_tables!(
    sys::System,
    transformer::ThreeWindingTransformer,
    name::String,
    d::Dict,
    ict_instances::Dict{Tuple{Int64, WindingCategory}, ImpedanceCorrectionData}
)

Attaches the corresponding ICT data to a Transformer3W component.

source
PowerSystems._attach_impedance_correction_tables!Method
_attach_impedance_correction_tables!(
    sys::System,
    transformer::TwoWindingTransformer,
    name::String,
    d::Dict,
    ict_instances::Dict{Tuple{Int64, WindingCategory}, ImpedanceCorrectionData}
)

Attaches the corresponding ICT data to a Transformer2W component.

source
PowerSystems._attach_single_ict!Method
_attach_single_ict!(
    sys::System,
    transformer::Union{ThreeWindingTransformer, TwoWindingTransformer},
    name::String,
    d::Dict,
    table_key::String,
    winding_idx::WindingCategory,
    ict_instances::Dict{Tuple{Int64, WindingCategory}, ImpedanceCorrectionData}
)

Function to attach ICTs to a single Transformer component.

source
PowerSystems._convert_argument_types!Method
_convert_argument_types!(
    str::AbstractString,
    struct_args::Vector
) -> Any

Convert specific parameters to types that are not Float64 for specific inverter components

source
PowerSystems._create_starbus_from_transformerMethod
_create_starbus_from_transformer(
    pm_data::Dict,
    transformer::Dict,
    starbus_id::Int64
) -> Dict{String, Any}
create_starbus(pm_data, transformer)

Creates a starbus from a given three-winding transformer. "sourceid" is given by `["busi", "name", "I", "J", "K", "CKT"]` where "bus_i" and "name" are the modified names for the starbus, and "I", "J", "K" and "CKT" come from the originating transformer, in the PSS(R)E transformer specification.

source
PowerSystems._deserialize_facts_compatMethod
_deserialize_facts_compat(dict::Dict) -> Dict

Data fixup for a FACTSControlDevice dict serialized before the shunt-control fields were added: leaves max_shunt_current untouched (it already held SHMX under the old schema) and fills in any of max_reactive_power, shunt_control_type, regulated_bus_number that are absent with their struct defaults. No-op if all three are already present.

source
PowerSystems._float2stringMethod
_float2string(
    v::AbstractFloat,
    float_precision::Int64
) -> Any

converts a float value into a string of fixed precision

sprintf would do the job but this work around is needed because sprintf cannot take format strings during runtime

source
PowerSystems._get_bus_valueMethod
_get_bus_value(
    bus_i::Int64,
    field::String,
    pm_data::Dict{String, Any}
) -> Any
_get_bus_value(bus_i, field, pm_data)

Returns the value of field of bus_i from the PowerModels data. Requires "bus" Dict to already be populated.

source
PowerSystems._get_line_elementsMethod
_get_line_elements(
    line::AbstractString
) -> Tuple{Array{SubString{T}, 1} where T<:AbstractString, Union{String, SubString}}
_get_line_elements(line)

Internal function. Uses regular expressions to extract all separate data elements from a line of a PTI file and populate them into an Array{String}. Comments, typically indicated at the end of a line with a '/' character, are also extracted separately, and Array{Array{String}, String} is returned.

source
PowerSystems._get_pm_3w_nameMethod
_get_pm_3w_name(
    device_dict,
    bus_primary::ACBus,
    bus_secondary::ACBus,
    bus_tertiary::ACBus
) -> String

Internal 3WT name retrieval from pm2ps_dict

source
PowerSystems._greyMethod
_grey(s::String) -> String

Makes a string grey in the terminal, does not seem to work well on Windows terminals more info can be found at https://en.wikipedia.org/wiki/ANSIescapecode

source
PowerSystems._impedance_correction_table_lookupMethod
_impedance_correction_table_lookup(
    data::Dict
) -> Dict{Tuple{Int64, WindingCategory}, ImpedanceCorrectionData}

Parses ITC data from a dictionary and constructs a lookup table of piecewise linear scaling functions.

source
PowerSystems._import_remaining_comps!Method
_import_remaining_comps!(
    data_out::Dict,
    data_in::Dict;
    exclude
)

Imports remaining top level component lists from data_in into data_out, excluding keys in exclude

source
PowerSystems._import_remaining_keys!Method
_import_remaining_keys!(
    comp_dest::Dict,
    comp_src::Dict;
    exclude
)

Imports remaining keys from a source component into detestation component, excluding keys in exclude

source
PowerSystems._init_bus!Method
_init_bus!(bus::Dict{String, Any}, id::Int64)
_init_bus!(bus, id)

Initializes a bus of id id with default values given in the PSS(R)E specification.

source
PowerSystems._is_synch_condenserMethod
_is_synch_condenser(
    sub_data::Dict{String, Any},
    pm_data::Dict{String, Any}
) -> Bool
_is_synch_condenser(sub_data, pm_data)

Returns true if the generator described by sub_data and pm_data meets the criteria for a synchronous condenser.

source
PowerSystems._make_market_bid_curveMethod
_make_market_bid_curve(
    data::PiecewiseStepData;
    initial_input,
    power_units,
    input_at_zero
) -> CostCurve{PiecewiseIncrementalCurve}

Auxiliary make market bid curve for timeseries with nothing inputs.

source
PowerSystems._merge_cost_data!Method
_merge_cost_data!(
    data::Dict{String, Any}
) -> Union{Nothing, Dict{String, Any}}

merges generator cost functions into generator data, if costs exist

source
PowerSystems._parse_dera1!Method
_parse_dera1!(
    bus_dict,
    componentID,
    componentValues,
    param_map::Dict,
    bus_num::Int64
)

Parse dictionary of data (from _parse_dyr_file) into a dictionary of DERA1. The function receives the parsed dictionary and constructs a dictionary indexed by bus, that contains a dictionary with each DERA1 indexed by its id.

source
PowerSystems._parse_dyr_componentsMethod
_parse_dyr_components(
    dyr_file::AbstractString
) -> Dict{Int64, Any}

Parse a .dyr file directly from its name by constructing its dictionary of dictionaries.

source
PowerSystems._parse_dyr_componentsMethod
_parse_dyr_components(data::Dict) -> Dict{Int64, Any}

Parse dictionary of dictionaries of data (from _parse_dyr_file) into a dictionary of struct components. The function receives the parsed dictionary and constructs a dictionary indexed by bus, that contains a dictionary with each dynamic generator and dynamic inverter components (indexed via its id).

For Generators, each dictionary indexed by id contains a vector with 5 of its components:

  • Machine
  • Shaft
  • AVR
  • TurbineGov
  • PSS

For Inverters, each dictionary indexed by id contains a vector with 7 of its components:

  • Converter
  • ActivePowerControl
  • ReactivePowerControl
  • InnerControl
  • DCSource
  • FrequencyEstimator
  • Filter
source
PowerSystems._parse_dyr_fileMethod
_parse_dyr_file(file::AbstractString) -> Dict{Int64, Dict}

Parse .dyr file into a dictionary indexed by bus number. Each bus number key has a dictionary indexed by component type and id.

Comments in .dyr files are not supported (beginning of lines with //).

source
PowerSystems._parse_dyr_generator_components!Method
_parse_dyr_generator_components!(
    bus_dict::Dict,
    componentID,
    componentValues,
    gen_map::Dict,
    param_map::Dict
)

Parse dictionary of data (from _parse_dyr_file) into a dictionary of struct components. The function receives the parsed dictionary and constructs a dictionary indexed by bus, that contains a dictionary with each dynamic generator indexed by its id.

source
PowerSystems._parse_dyr_inverter_components!Method
_parse_dyr_inverter_components!(
    bus_dict::Dict,
    inv_dict::Dict,
    componentID::Tuple{String, String},
    inv_map::Dict
)

Parse dictionary of data (from _parse_dyr_file) into a dictionary of struct components. The function receives the parsed dictionary and constructs a dictionary indexed by bus, that contains a dictionary with each dynamic inverter indexed by its id.

source
PowerSystems._parse_elementsMethod
_parse_elements(
    elements::Array,
    dtypes::Array,
    defaults::Dict,
    section::AbstractString
) -> Dict{String, Any}

This is an experimental method for parsing elements and setting defaults at the same time. It is not currently working but would reduce memory allocations if implemented correctly.

source
PowerSystems._parse_line_element!Method
_parse_line_element!(
    data::Dict,
    elements::Array,
    section::AbstractString,
    dtypes::Dict{String, Array}
)
_parse_line_element!(data, elements, section)

Internal function. Parses a single "line" of data elements from a PTI file, as given by elements which is an array of the line, typically split at ,. Elements are parsed into data types given by section and saved into data::Dict.

source
PowerSystems._parse_pti_dataMethod
_parse_pti_data(data_io::IO) -> Dict{String, Array{Dict}}
_parse_pti_data(data_string, sections)

Internal function. Parse a PTI raw file into a Dict, given the data_string of the file and a list of the sections in the PTI file (typically given by default by get_pti_sections().

source
PowerSystems._populate_argsMethod
_populate_args(param_map::Vector, val) -> Vector{Any}

Populate arguments in a vector for each dynamic component (except Shafts). Returns a vector with the parameter values of the argument of each component.

source
PowerSystems._populate_defaults!Method
_populate_defaults!(data::Dict)
_populate_defaults!(pti_data)

Internal function. Populates empty fields with PSS(R)E PTI default values, selecting the version-specific default set (v35 adds fields — e.g. load DGENP/DGENQ/DGENM, generator NREG/BASLOD — that have no v33 default; using the v33 set there leaves them as "" and breaks the downstream numeric conversions).

source
PowerSystems._process_get_costMethod
_process_get_cost(
    _::Type{T},
    _,
    cost,
    transform_fn,
    start_time::Union{Nothing, Dates.DateTime},
    len::Union{Nothing, Int64}
) -> TimeSeries.TimeArray

Helper function for cost getters.

Arguments

source
PowerSystems._process_set_costMethod
_process_set_cost(_, _, _, _, _::Nothing)

Helper function for cost setters.

Arguments

  • T1: type we expect if it's not a time series
  • T2: eltype we expect if it is a time series
  • sys::System: the system
  • component::Component: the component
  • cost: the data: either a single element of type T1 or a IS.TimeSeriesData of eltype T2
source
PowerSystems._psse2pm_branch!Method
_psse2pm_branch!(
    pm_data::Dict,
    pti_data::Dict,
    import_all::Bool
)
_psse2pm_branch!(pm_data, pti_data)

Parses PSS(R)E-style Branch data into a PowerModels-style Dict. "source_id" is given by ["I", "J", "CKT"] in PSS(R)E Branch specification.

source
PowerSystems._psse2pm_bus!Method
_psse2pm_bus!(
    pm_data::Dict,
    pti_data::Dict,
    import_all::Bool
)
_psse2pm_bus!(pm_data, pti_data)

Parses PSS(R)E-style Bus data into a PowerModels-style Dict. "source_id" is given by ["I", "NAME"] in PSS(R)E Bus specification.

source
PowerSystems._psse2pm_dcline!Method
_psse2pm_dcline!(
    pm_data::Dict,
    pti_data::Dict,
    import_all::Bool
)
_psse2pm_dcline!(pm_data, pti_data)

Parses PSS(R)E-style Two-Terminal and VSC DC Lines data into a PowerModels compatible Dict structure by first converting them to a simple DC Line Model. For Two-Terminal DC lines, "sourceid" is given by ["IPR", "IPI", "NAME"] in the PSS(R)E Two-Terminal DC specification. For Voltage Source Converters, "sourceid" is given by ["IBUS1", "IBUS2", "NAME"], where "IBUS1" is "IBUS" of the first converter bus, and "IBUS2" is the "IBUS" of the second converter bus, in the PSS(R)E Voltage Source Converter specification.

source
PowerSystems._psse2pm_generator!Method
_psse2pm_generator!(
    pm_data::Dict,
    pti_data::Dict,
    import_all::Bool
) -> Union{Nothing, Vector{Dict{String, Any}}}
_psse2pm_generator!(pm_data, pti_data)

Parses PSS(R)E-style Generator data in a PowerModels-style Dict. "source_id" is given by ["I", "ID"] in PSS(R)E Generator specification.

source
PowerSystems._psse2pm_load!Method
_psse2pm_load!(
    pm_data::Dict,
    pti_data::Dict,
    import_all::Bool
)
_psse2pm_load!(pm_data, pti_data)

Parses PSS(R)E-style Load data into a PowerModels-style Dict. "source_id" is given by ["I", "ID"] in the PSS(R)E Load specification.

source
PowerSystems._psse2pm_shunt!Method
_psse2pm_shunt!(
    pm_data::Dict,
    pti_data::Dict,
    import_all::Bool
)
_psse2pm_shunt!(pm_data, pti_data)

Parses PSS(R)E-style Fixed and Switched Shunt data into a PowerModels-style Dict. "source_id" is given by ["I", "ID"] for Fixed Shunts, and ["I", "SWREM"] for Switched Shunts, as given by the PSS(R)E Fixed and Switched Shunts specifications.

source
PowerSystems._psse2pm_transformer!Method
_psse2pm_transformer!(
    pm_data::Dict,
    pti_data::Dict,
    import_all::Bool
)
_psse2pm_transformer!(pm_data, pti_data)

Parses PSS(R)E-style Transformer data into a PowerModels-style Dict. "source_id" is given by ["I", "J", "K", "CKT", "winding"], where "winding" is 0 if transformer is two-winding, and 1, 2, or 3 for three-winding, and the remaining keys are defined in the PSS(R)E Transformer specification.

source
PowerSystems._pti_to_powermodels!Method
_pti_to_powermodels!(
    pti_data::Dict;
    import_all,
    validate,
    correct_branch_rating
) -> Dict{String, Any}
_pti_to_powermodels!(pti_data)

Converts PSS(R)E-style data parsed from a PTI raw file, passed by pti_data into a format suitable for use internally in PowerModels. Imports all remaining data from the PTI file if import_all is true (Default: false).

source
PowerSystems._read_data_rowMethod
_read_data_row(
    data::PowerSystemTableData,
    row,
    field_infos;
    na_to_nothing
) -> NamedTuple

Reads values from dataframe row and performs necessary conversions.

source
PowerSystems._remove_pwl_cost_duplicates!Function
_remove_pwl_cost_duplicates!(id, comp, type_name) -> Bool
_remove_pwl_cost_duplicates!(
    id,
    comp,
    type_name,
    tolerance
) -> Bool

checks that each point in the a pwl function is unique, simplifies the function if duplicates appear

source
PowerSystems._select_fewer_significant_figuresMethod
_select_fewer_significant_figures(
    a::Float64,
    b::Float64
) -> Float64

Select the value with fewer significant figures (the "rounder" number). Uses trailing zeros after stripping the decimal point as a proxy.

source
PowerSystems._simplify_pwl_cost!Function
_simplify_pwl_cost!(id, comp, type_name) -> Bool
_simplify_pwl_cost!(id, comp, type_name, tolerance) -> Bool

checks the slope of each segment in a pwl function, simplifies the function if the slope changes is below a tolerance

source
PowerSystems._split_loads_shunts!Method
_split_loads_shunts!(data::Dict{String, Any})
_split_loads_shunts!(data)

Seperates Loads and Shunts in data under separate "load" and "shunt" keys in the PowerModels data format. Includes references to originating bus via "loadbus" and "shuntbus" keys, respectively.

source
PowerSystems._standardize_cost_terms!Method
_standardize_cost_terms!(
    components::Dict{String},
    comp_order::Int64,
    cost_comp_name::String
) -> Set{Int64}

ensures all polynomial costs functions have at exactly comp_order terms

source
PowerSystems._type_arrayMethod
_type_array(
    string_array::Array{T<:AbstractString, 1}
) -> Vector

Attempts to determine the type of an array of strings extracted from a matlab file

source
PowerSystems._type_valueMethod
_type_value(
    value_string::AbstractString
) -> Union{Float64, Int64, InlineStrings.InlineString, SubString}

Attempts to determine the type of a string extracted from a matlab file

source
PowerSystems.bus_gen_lookupMethod
bus_gen_lookup(
    gen_data::Dict{String},
    bus_data::Dict{String}
) -> Dict

builds a lookup list of what generators are connected to a given bus

source
PowerSystems.bus_load_lookupMethod
bus_load_lookup(
    load_data::Dict{String},
    bus_data::Dict{String}
) -> Dict

builds a lookup list of what loads are connected to a given bus

source
PowerSystems.bus_shunt_lookupMethod
bus_shunt_lookup(
    shunt_data::Dict{String},
    bus_data::Dict{String}
) -> Dict

builds a lookup list of what shunts are connected to a given bus

source
PowerSystems.bus_storage_lookupMethod
bus_storage_lookup(
    storage_data::Dict{String},
    bus_data::Dict{String}
) -> Dict

builds a lookup list of what storage is connected to a given bus

source
PowerSystems.calc_branch_flow_acMethod
calc_branch_flow_ac(data::Dict{String}) -> Dict{String, Any}

assumes a vaild ac solution is included in the data and computes the branch flow values

source
PowerSystems.calc_branch_flow_dcMethod
calc_branch_flow_dc(data::Dict{String}) -> Dict{String, Any}

assumes a vaild dc solution is included in the data and computes the branch flow values

source
PowerSystems.calc_connected_componentsMethod
calc_connected_components(
    pm_data::Dict{String};
    edges
) -> Set{Set{Int64}}

computes the connected components of the network graph returns a set of sets of bus ids, each set is a connected component

source
PowerSystems.calc_cost_pwl_linesMethod
calc_cost_pwl_lines(comp_dict::Dict) -> Dict{Any, Any}

compute lines in m and b from from pwl cost models data is a list of components.

Can be run on data or ref data structures

source
PowerSystems.calc_power_balanceMethod
calc_power_balance(data::Dict{String}) -> Dict{String, Any}

assumes a vaild solution is included in the data and computes the power balance at each bus

source
PowerSystems.calculate_IM_torque_paramsMethod
calculate_IM_torque_params(
    A::Float64,
    B::Float64
) -> Float64

Calculate the torque constant C for an induction motor model from load-torque coefficients.

Throws an error if any of A, B, or C is negative (coefficients must be non-negative and sum to 1).

Arguments

  • A::Float64: Load torque coefficient for the quadratic speed term.
  • B::Float64: Load torque coefficient for the linear speed term. The constant term is C = 1 - A - B.
source
PowerSystems.calculate_ramp_limitMethod
calculate_ramp_limit(
    d::Dict{String, Any},
    gen_name::Union{SubString{String}, String},
    base_conversion::Float64
) -> Union{Nothing, NamedTuple{(:up, :down), <:Tuple{Any, Any}}}

Return (up, down) ramp limits scaled into the device per-unit base by base_conversion = sys_mbase / mbase. Returns nothing when no ramp data is available.

source
PowerSystems.calculate_saturation_coefficientsMethod
calculate_saturation_coefficients(
    E::Tuple{Float64, Float64},
    Se::Tuple{Float64, Float64}
) -> Tuple{Float64, Float64}

Obtain coefficients (A, B) of the function Se(x) = B(x - A)^2/x for Se(E1) = B(E1 - A)^2/E1 and Se(E2) = B(E2 - A)^2/E2 and uses the negative solution of the quadratic equation

source
PowerSystems.check_component_additionMethod
check_component_addition(
    sys::System,
    component::Component;
    kwargs...
)

Throws ArgumentError if a PowerSystems rule blocks addition to the system.

This method is tied with handlecomponentaddition!. If the methods are re-implemented for a subtype then whatever is added in handlecomponentaddition! must be checked here.

source
PowerSystems.check_statusMethod
check_status(data::Dict{String})

checks that active components are not connected to inactive buses, otherwise prints warnings

source
PowerSystems.check_typeMethod
check_type(typ, value) -> Any

Checks if the given value is of a given type, if not tries to make it that type

source
PowerSystems.correct_network_data!Method
correct_network_data!(
    data::Dict{String};
    correct_branch_rating
) -> Dict{String, Dict{Symbol, Set{Int64}}}

Runs various data quality checks on a PowerModels data dictionary. Applies modifications in some cases. Reports modified component ids.

source
PowerSystems.correct_transformer_parameters!Method
correct_transformer_parameters!(
    data::Dict{String}
) -> Set{Int64}

checks that each branch has a reasonable transformer parameters

this is important because setting tap == 0.0 leads to NaN computations, which are hard to debug

source
PowerSystems.correct_voltage_angle_differences!Function
correct_voltage_angle_differences!(
    data::Dict{String}
) -> Set{Int64}
correct_voltage_angle_differences!(
    data::Dict{String},
    default_pad
) -> Set{Int64}

checks that voltage angle differences are within 90 deg., if not tightens

source
PowerSystems.deactivate_isolated_components!Method
deactivate_isolated_components!(data::Dict{String}) -> Bool

removes buses with single branch connections and without any other attached components. Also removes connected components without suffuceint generation or loads.

also deactivates 0 valued loads and shunts.

source
PowerSystems.deserialize_uuid_handlingMethod
deserialize_uuid_handling(
    field_type,
    val,
    component_cache
) -> Any

Deserialize val of field_type, replacing UUID values with the corresponding components from component_cache where applicable.

Arguments

  • field_type: The expected type of the field.
  • val: The raw serialized value.
  • component_cache: A dictionary mapping UUIDs to already-deserialized components.

See also: serialize_uuid_handling

source
PowerSystems.get_AggregateDistributedGenerationA_statesMethod
get_AggregateDistributedGenerationA_states(
    Freq_Flag::Int64
) -> Tuple{Vector{Symbol}, Int64}

Return the state names and count for an AggregateDistributedGenerationA model based on Freq_Flag.

Arguments

  • Freq_Flag::Int: Frequency flag (0 or 1).
source
PowerSystems.get_GenericDER_statesMethod
get_GenericDER_states(
    Qref_Flag::Int64
) -> Tuple{Vector{Symbol}, Int64}

Return the state names and count for a GenericDER model based on Qref_Flag.

Arguments

  • Qref_Flag::Int: Reactive power reference flag (1, 2, or 3).
source
PowerSystems.get_dataframeMethod
get_dataframe(
    data::PowerSystemTableData,
    category::PowerSystems.InputCategoryModule.InputCategory
) -> DataFrame

Return the dataframe for the category.

source
PowerSystems.get_exponential_saturationMethod
get_exponential_saturation(
    Se::Tuple{Float64, Float64}
) -> Tuple{Float64, Float64}

Obtain coefficients (A, B) of the function Se = Bx^A for Se(1.2) = B(1.2)^A and Se(1.0) = B(1.0)^A as: B = Se(1.0) and hence (1.2)^A = Se(1.2)/B -> A = log(Se(1.2)/B) / log(1.2)

source
PowerSystems.get_generator_mappingMethod
get_generator_mapping(
    filename::String
) -> Dict{NamedTuple, DataType}

Return a dict where keys are a tuple of input parameters (fuel, unit_type) and values are generator types.

source
PowerSystems.get_generator_typeMethod
get_generator_type(
    fuel,
    unit_type,
    mappings::Dict{NamedTuple, DataType}
) -> Union{Nothing, DataType}

Return the PowerSystems generator type for this fuel and unit_type.

source
PowerSystems.get_quadratic_saturationMethod
get_quadratic_saturation(
    Se::Tuple{Float64, Float64}
) -> Tuple{Float64, Float64}

Obtain coefficients (A, B) of the function Se = B(x - A)^2/x for Se(1.2) = B(1.2 - A)^2/1.2 and Se(1.0) = B(1.0 - A)^2/1.0 as: Se(1.0) = (Se(1.2) * 1.2) /(1.2 - A)^2 * (1.0 - A)^2/1.0 that yields (1.2 - A)^2 Se(1.0) = Se(1.2) * 1.2 * (1.0 - A)^2 or expanding: (1.2 * Se(1.2) - Se(1.0)) A^2 + (2.4 Se(1.0) - 2 * 1.2 * Se(1.2)) A + (1.2 * Se(1.2) - 1.44 Se(1.0)) = 0 and uses the negative solution of the quadratic equation.

source
PowerSystems.get_series_admittancesMethod
get_series_admittances(
    b::PhaseShiftingTransformer3W
) -> Tuple{ComplexF64, ComplexF64, ComplexF64}

Return the series admittances of a PhaseShiftingTransformer3W as a 3-tuple of complex values (one per winding), each computed as 1 / (turns_ratio_i × (Ri + jXi)). Phase shift angles affect the admittance matrix but not series impedance magnitudes.

See also: get_series_admittance for 2-winding transformers

source
PowerSystems.get_user_fieldMethod
get_user_field(
    data::PowerSystemTableData,
    category::PowerSystems.InputCategoryModule.InputCategory,
    field::AbstractString
) -> Any

Return the custom name stored in the user descriptor file.

Throws DataFormatError if a required value is not found in the file.

source
PowerSystems.get_user_fieldsMethod
get_user_fields(
    data::PowerSystemTableData,
    category::PowerSystems.InputCategoryModule.InputCategory
) -> Any

Return a vector of user-defined fields for the category.

source
PowerSystems.im_replicateMethod
im_replicate(
    sn_data::Dict{String},
    count::Int64,
    global_keys::Set{String}
) -> Dict{String, Any}

Transforms a single network into a multinetwork with several deepcopies of the original network

source
PowerSystems.is_attachedMethod
is_attached(component::Component, sys::System) -> Bool

Return true if the component is attached to the system.

source
PowerSystems.isafieldMethod
isafield(component::Component, field::Symbol) -> Any

Checks if a PowerSystemDevice has a field or subfield name.

source
PowerSystems.iterate_rowsMethod
iterate_rows(
    data::PowerSystemTableData,
    category;
    na_to_nothing
) -> Channel{Any}

Return a NamedTuple of parameters from the descriptor file for each row of a dataframe, making type conversions as necessary.

Refer to the PowerSystems descriptor file for field names that will be created.

source
PowerSystems.line_rating_calculationMethod
line_rating_calculation(
    l::Union{Line, MonitoredLine}
) -> Float64

Calculates the line rating based on the formula for the maximum transfer limit over an impedance

source
PowerSystems.load_csv_parser!Method
load_csv_parser!(sys::System, data::PowerSystemTableData)
load_csv_parser!(sys::System, data::PowerSystemTableData)

Add loads to the System from the raw load data.

source
PowerSystems.loadzone_csv_parser!Method
loadzone_csv_parser!(
    sys::System,
    data::PowerSystemTableData
)
loadzone_csv_parser!(sys::System, data::PowerSystemTableData)

Add branches to the System from the raw data.

source
PowerSystems.make_busMethod
make_bus(bus_dict::Dict{String, Any}) -> ACBus

Creates a PowerSystems.ACBus from a PowerSystems bus dictionary

source
PowerSystems.make_generatorMethod
make_generator(
    data::PowerSystemTableData,
    gen,
    cost_colnames,
    bus,
    gen_storage
) -> Tuple{Union{Nothing, EnergyReservoirStorage, HydroDispatch, HydroTurbine, RenewableDispatch, RenewableNonDispatch, SynchronousCondenser, ThermalMultiStart, ThermalStandard}, Union{Nothing, Vector{HydroReservoir}}}

Creates a generator of any type.

source
PowerSystems.make_import_export_curveFunction
make_import_export_curve(
    curve::PiecewiseStepData
) -> CostCurve{PiecewiseIncrementalCurve}
make_import_export_curve(
    curve::PiecewiseStepData,
    power_units::UnitSystem
) -> CostCurve{PiecewiseIncrementalCurve}

Make a CostCurve{PiecewiseIncrementalCurve} suitable for inclusion in a ImportExportCost from the FunctionData that might be used to store such a cost curve in a time series.

source
PowerSystems.make_import_export_curveFunction
make_import_export_curve(
    powers::Vector{Float64},
    prices::Vector{Float64}
) -> CostCurve{PiecewiseIncrementalCurve}
make_import_export_curve(
    powers::Vector{Float64},
    prices::Vector{Float64},
    power_units::UnitSystem
) -> CostCurve{PiecewiseIncrementalCurve}

Make a CostCurve{PiecewiseIncrementalCurve} suitable for inclusion in an ImportExportCost from a vector of power values, a vector of costs, and an optional units system.

Examples

iec = make_import_export_curve([0.0, 100.0, 105.0, 120.0, 130.0], [25.0, 26.0, 28.0, 30.0])
iec1 = make_import_export_curve([0.0, 100.0, 105.0, 120.0, 130.0], [25.0, 26.0, 28.0, 30.0]; power_units = UnitSystem.NATURAL_UNITS)
source
PowerSystems.make_thermal_genMethod
make_thermal_gen(
    gen_name::Union{SubString{String}, String},
    d::Dict,
    bus::ACBus,
    sys_mbase::Float64
) -> ThermalStandard

The polynomial term follows the convention that for an n-degree polynomial, at least n + 1 components are needed. c(p) = cn*p^n+...+c1p+c0 co is stored in the field in of the Econ Struct

source
PowerSystems.name_formatter_from_component_idsMethod
name_formatter_from_component_ids(
    raw_name_mapping,
    bus_number_mapping,
    sig
) -> PowerSystems.var"#component_id_formatter#name_formatter_from_component_ids##0"{Dict{K, V}} where {K, V}

Use PSS/E exporter metadata to build a function that maps component names back to their original Sienna values.

source
PowerSystems.parse_export_metadata_dictMethod
parse_export_metadata_dict(md::Dict) -> Tuple{Dict, Dict}

Parse an export_metadata dictionary, returning the kwargs that should be passed to the System constructor and the bus number remapping that should be used to effect the retransformation.

source
PowerSystems.parse_psseMethod
parse_psse(io::IO; kwargs...) -> Dict{String, Any}
function parse_psse(io::IO; kwargs...)::Dict

Parses directly from iostream

source
PowerSystems.parse_psseMethod
parse_psse(filename::String; kwargs...) -> Dict{String, Any}
parse_psse(filename::String; kwargs...)::Dict

Parses directly from file

source
PowerSystems.parse_ptiMethod
parse_pti(io::IO) -> Dict{String, Array{Dict}}
parse_pti(io::IO)

Reads PTI data in io::IO, returning a Dict of the data parsed into the proper types.

source
PowerSystems.parse_ptiMethod
parse_pti(filename::String) -> Dict{String, Array{Dict}}
parse_pti(filename::String)

Open PTI raw file given by filename, returning a Dict of the data parsed into the proper types.

source
PowerSystems.parse_substation_nodes!Method
parse_substation_nodes!(
    section_data::Dict{String, Any},
    data_lines::Vector{String},
    start_line_index::Int64
) -> Int64

Process substation data with elements and parse associated nodes

source
PowerSystems.process_substation_data!Method
process_substation_data!(
    section_data,
    elements,
    section,
    current_dtypes,
    data_lines,
    line_index,
    pti_data
) -> Int64

Process substation data with elements and parse associated nodes

source
PowerSystems.propagate_topology_status!Method
propagate_topology_status!(
    data::Dict{String}
) -> Union{Nothing, Bool}

finds active network buses and branches that are not necessary for the computation and sets their status to off.

Works on a PowerModels data dict, so that a it can be used without a GenericPowerModel object

Warning: this implementation has quadratic complexity, in the worst case

source
PowerSystems.read_and_convert_tsFunction
read_and_convert_ts(
    ts::TimeSeriesData,
    component::Component
) -> TimeSeries.TimeArray
read_and_convert_ts(
    ts::TimeSeriesData,
    component::Component,
    start_time::Union{Nothing, Dates.DateTime}
) -> TimeSeries.TimeArray
read_and_convert_ts(
    ts::TimeSeriesData,
    component::Component,
    start_time::Union{Nothing, Dates.DateTime},
    len::Union{Nothing, Int64}
) -> TimeSeries.TimeArray
read_and_convert_ts(
    ts::TimeSeriesData,
    component::Component,
    start_time::Union{Nothing, Dates.DateTime},
    len::Union{Nothing, Int64},
    transform_fn
) -> TimeSeries.TimeArray

Call gettimeseriesarray on the given time series and return a TimeArray of the results, values mapped by `transformfn` if it is not nothing

source
PowerSystems.read_gen!Method
read_gen!(
    sys::System,
    data::Dict,
    bus_number_to_bus::Dict{Int64, ACBus};
    kwargs...
)

Transfer generators to ps_dict according to their classification

source
PowerSystems.replicateMethod
replicate(
    sn_data::Dict{String},
    count::Int64;
    global_keys
) -> Dict{String, Any}

Turns in given single network data in multinetwork data with a count replicate of the given network. Note that this function performs a deepcopy of the network data. Significant multinetwork space savings can often be achieved by building application specific methods of building multinetwork with minimal data replication.

source
PowerSystems.resolve_swithces!Method
resolve_swithces!(data::Dict{String})

given a network data dict merges buses that are connected by closed switches converting the dataset into a pure bus-branch model.

source
PowerSystems.simplify_network!Method
simplify_network!(data::Dict{String}) -> Bool

attempts to deactive components that are not needed in the network by repeated calls to propagate_topology_status! and deactivate_isolated_components!

warning: this implementation has quadratic complexity, in the worst case

source
PowerSystems.single_start_up_to_stagesMethod
single_start_up_to_stages(
    start_up::Real
) -> NamedTuple{(:hot, :warm, :cold), <:Tuple{Any, Float64, Float64}}

Convert a single start-up cost value to a StartUpStages

source
PowerSystems.update_bus_ids!Method
update_bus_ids!(
    data::Dict{String},
    bus_id_map::Dict{Int64, Int64};
    injective
)

given a network data dict and a mapping of current-bus-ids to new-bus-ids modifies the data dict to reflect the proposed new bus ids.

source
PowerSystems.update_data!Method
update_data!(data::Dict{String}, new_data::Dict{String})

recursively applies new_data to data, overwriting information

source
PowerSystems.verify_device_eligibilityMethod
verify_device_eligibility(
    sys::System,
    component::StaticInjection,
    service::Service
)

Validates if a device is eligible to contribute to a service.

Arguments

  • sys::System: PowerSystem System
  • component::StaticInjection: Static injection device
  • service::Service: Service for which the device is eligible to contribute
source