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.