File IO

File IO

General Data Formats

parse_file(file; import_all)

Parses a Matpower .m file or PTI (PSS(R)E-v33) .raw file into a PowerModels data structure. All fields from PTI files will be imported if import_all is true (Default: false).

source
source
source

Matpower Data Files

The following method is the main exported methods for parsing Matpower data files:

Parses the matpwer data from either a filename or an IO object

source

We also provide the following (internal) helper methods:

source
source
source

Converts a Matpower dict into a PowerModels dict

source

takes a row from a matrix and assigns the values names and types

source

takes a row from a matrix and assigns the values names

source
source
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

ensures all polynomial costs functions have at least three terms

source

merges generator cost functions into generator data, if costs exist

source

merges bus name data into buses, if names exist

source

merges Matpower tables based on the table extension syntax

source

sets all branch transformer taps to 1.0, to simplify branch models

source

adds pmin and pmax values at to and from buses

source

adds dcline costs, if gen costs exist

source

PTI Data Files (PSS/E)

Note: This feature supports the parsing and conversion of PTI files into a PowerModels format for the following power network components: buses, loads, shunts (fixed and approximation of switched), branches, two-winding and three-winding transformers (incl. magnetizing admittance), generators, two-terminal dc lines, and voltage source converter HVDC lines.

The following method is the main exported method for parsing PSS(R)E v33 specified PTI data files:

parse_psse(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

Parses directly from file

source

Parses directly from iostream

source

The following internal helper methods are also provided:

PowerModels.parse_ptiFunction.
parse_pti(filename::String)

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

source
parse_pti(io::IO)

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

source
parse_pti_data(data_string, sections)

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
get_line_elements(line)

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
add_section_data!(pti_data, section_data, section)

Adds section_data::Dict, which contains all parsed elements of a PTI file section given by section, into the parent pti_data::Dict

source
parse_line_element!(data, elements, section)

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
get_pti_dtypes(field_name)

Returns OrderedDict of data types for PTI file section given by field_name, as enumerated by PSS/E Program Operation Manual

source
get_pti_sections()

Returns Array of the names of the sections, in the order that they appear in a PTI file, v33+

source
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
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
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
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
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
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
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

Imports remaining keys from data_in into data_out, excluding keys in exclude

source
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
find_max_bus_id(pm_data)

Returns the maximum bus id in pm_data

source
PowerModels.init_bus!Function.
init_bus!(bus, id)

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

source