pwrs.core.opf_branch_flow_fcn#

pwrs.core.opf_branch_flow_fcn.opf_branch_flow_fcn(x, mpc, Yf, Yt, il, mpopt, nargout=1)[source]#

Evaluate AC OPF branch flow limit constraints and Jacobian.

Computes the nonlinear inequality constraints for branch flow limits on the selected branches il. The exact form depends on mpopt.opf.flow_lim and matches MATPOWER’s handling of current, active-power, or apparent-power limits.

Parameters:
  • x (sequence of array_like) – Voltage-state blocks. The layout matches MATPOWER: (Va, Vm) in polar form or (Vr, Vi) in cartesian form.

  • mpc (dict) – Internal MATPOWER case struct.

  • Yf (sparse matrix) – Admittance matrix mapping bus voltages to branch “from” currents.

  • Yt (sparse matrix) – Admittance matrix mapping bus voltages to branch “to” currents.

  • il (array_like) – One-based indices of branches with active flow limits.

  • mpopt (MatpowerConfig) – Typed MATPOWER options configuration.

  • nargout (int, optional) – MATLAB compatibility flag controlling whether the Jacobian is returned.

Returns:

Inequality constraint vector h for the selected branch limits, and optionally its Jacobian dh.

Return type:

numpy.ndarray or tuple

pwrs.core.opf_branch_flow_fcn.opf_branch_flow_fcn_with_jacobian(x, mpc, Yf, Yt, il, mpopt)[source]#

Evaluate branch-flow constraints and return their Jacobian.

Parameters:

mpopt (MatpowerConfig)