pwrs.core.int2ext#

pwrs.core.int2ext.int2ext(i2e, bus=None, gen=None, branch=None, areas=None)[source]#

Convert MATPOWER data from internal to external indexing.

Mirrors MATPOWER’s int2ext for both full case structs and the older matrix-form API. It restores original bus numbering, reinstates out-of-service elements, and maps reordered data back to the stored external ordering.

Parameters:
  • i2e (dict or array_like) – MATPOWER case struct in internal order, or the i2e index vector for the legacy matrix-form API.

  • bus (array_like or dict, optional) – Bus matrix for the legacy matrix-form API, or the mpopt/extra argument used by the struct form.

  • gen (array_like, optional) – Generator matrix for the legacy matrix-form API.

  • branch (array_like, optional) – Branch matrix for the legacy matrix-form API.

  • areas (array_like, optional) – Areas matrix for the legacy matrix-form API.

  • nargout (int, optional) – MATLAB compatibility flag controlling the returned output form.

Returns:

External-order MATPOWER case struct, or the legacy matrix-form outputs with restored external numbering.

Return type:

dict or tuple