Package pypower :: Module ext2int
[hide private]
[frames] | no frames]

Module ext2int

source code

Converts external to internal indexing.

Functions [hide private]
 
ext2int(ppc, val_or_field=None, ordering=None, dim=0)
Converts external to internal indexing.
source code
 
ext2int1(bus, gen, branch, areas=None)
Converts from (possibly non-consecutive) external bus numbers to consecutive internal bus numbers which start at 1.
source code
Variables [hide private]
  __package__ = 'pypower'
Function Details [hide private]

ext2int(ppc, val_or_field=None, ordering=None, dim=0)

source code 

Converts external to internal indexing.

This function performs several different tasks, depending on the arguments passed.

  1. ppc = ext2int(ppc)

    If the input is a single PYPOWER case dict, then all isolated buses, off-line generators and branches are removed along with any generators, branches or areas connected to isolated buses. Then the buses are renumbered consecutively, beginning at 0, and the generators are sorted by increasing bus number. All of the related indexing information and the original data matrices are stored under the 'order' key of the dict to be used by int2ext to perform the reverse conversions. If the case is already using internal numbering it is returned unchanged.

    Example:

       ppc = ext2int(ppc);
    
  2. val = ext2int(ppc, val, ordering)

    val = ext2int(ppc, val, ordering, dim)

    ppc = ext2int(ppc, field, ordering)

    ppc = ext2int(ppc, field, ordering, dim)

    When given a case dict that has already been converted to internal indexing, this function can be used to convert other data structures as well by passing in 2 or 3 extra parameters in addition to the case dict. If the value passed in the 2nd argument is a column vector, it will be converted according to the ordering specified by the 3rd argument (described below). If val is an n-dimensional matrix, then the optional 4th argument (dim, default = 0) can be used to specify which dimension to reorder. The return value in this case is the value passed in, converted to internal indexing.

    If the 2nd argument is a string or list of strings, it specifies a field in the case dict whose value should be converted as described above. In this case, the converted value is stored back in the specified field, the original value is saved for later use and the updated case dict is returned. If field is a list of strings, they specify nested fields.

    The 3rd argument, ordering, is used to indicate whether the data corresponds to bus-, gen- or branch-ordered data. It can be one of the following three strings: 'bus', 'gen' or 'branch'. For data structures with multiple blocks of data, ordered by bus, gen or branch, they can be converted with a single call by specifying ordering as a list of strings.

    Any extra elements, rows, columns, etc. beyond those indicated in ordering, are not disturbed.

See Also: int2ext

Authors:
Ray Zimmerman (PSERC Cornell), Richard Lincoln

ext2int1(bus, gen, branch, areas=None)

source code 

Converts from (possibly non-consecutive) external bus numbers to consecutive internal bus numbers which start at 1. Changes are made to BUS, GEN, BRANCH and optionally AREAS matrices, which are returned along with a vector of indices I2E that can be passed to INT2EXT to perform the reverse conversion.