pwrs.core.opf#

pwrs.core.opf.opf(*args, nargout=1)[source]#

Solve an optimal power flow.

This port preserves the MATLAB opf calling conventions, supporting case dicts, case names, and the extended argument forms handled by opf_args().

Parameters:
  • *args – MATPOWER OPF inputs. Supported forms include opf(mpc), opf(mpc, mpopt), user linear/cost extensions, and the expanded baseMVA, bus, gen, branch, ... signatures.

  • nargout (int, optional) – Number of outputs to emulate from the MATLAB interface.

Returns:

With one or two outputs, returns the structured solved result and optional success flag. With more outputs, returns (bus, gen, branch, f, success, info, et, g, jac, xr, pimul) with g and jac currently left as None.

Return type:

OptimalPowerFlowResult or tuple

pwrs.core.opf.opf_with_success(*args)[source]#

Solve an OPF and return (results, success).

Parameters:

args (Any)

Return type:

tuple[OptimalPowerFlowResult, bool]