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.