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

Module int2ext

source code

Converts internal to external bus numbering.

Functions [hide private]
 
int2ext(ppc, val_or_field=None, oldval=None, ordering=None, dim=0)
Converts internal to external bus numbering.
source code
 
int2ext1(i2e, bus, gen, branch, areas)
Converts from the consecutive internal bus numbers back to the originals using the mapping provided by the I2E vector returned from ext2int.
source code
Variables [hide private]
  __package__ = 'pypower'
Function Details [hide private]

int2ext(ppc, val_or_field=None, oldval=None, ordering=None, dim=0)

source code 

Converts internal to external bus numbering.

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

  1. ppc = int2ext(ppc)

    If the input is a single PYPOWER case dict, then it restores all buses, generators and branches that were removed because of being isolated or off-line, and reverts to the original generator ordering and original bus numbering. This requires that the 'order' key created by ext2int be in place.

    Example:

       ppc = int2ext(ppc)
    
  2. val = int2ext(ppc, val, oldval, ordering)

    val = int2ext(ppc, val, oldval, ordering, dim)

    ppc = int2ext(ppc, field, ordering)

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

    For a case dict using internal indexing, this function can be used to convert other data structures as well by passing in 2 to 4 extra parameters in addition to the case dict. If the values passed in the 2nd argument (val) is a column vector, it will be converted according to the ordering specified by the 4th argument (ordering, described below). If val is an n-dimensional matrix, then the optional 5th argument (dim, default = 0) can be used to specify which dimension to reorder. The 3rd argument (oldval) is used to initialize the return value before converting val to external indexing. In particular, any data corresponding to off-line gens or branches or isolated buses or any connected gens or branches will be taken from oldval, with val supplying the rest of the returned data.

    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 corresponding oldval is taken from where it was stored by ext2int in ppc["order"]["ext"] and the updated case dict is returned. If field is a list of strings, they specify nested fields.

    The ordering argument 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: ext2int

Authors:
Ray Zimmerman (PSERC Cornell), Richard Lincoln

int2ext1(i2e, bus, gen, branch, areas)

source code 

Converts from the consecutive internal bus numbers back to the originals using the mapping provided by the I2E vector returned from ext2int.