opf_branch_flow_fcn

opf_branch_flow_fcn(x, mpc, Yf, Yt, il, mpopt)

opf_branch_flow_fcn() - Evaluates AC branch flow constraints and Jacobian.

[H, DH] = OPF_BRANCH_FLOW_FCN(X, OM, YF, YT, IL, MPOPT)

Branch flow constraints for AC optimal power flow.
Computes constraint vectors and their gradients.

Inputs:
  X : optimization vector
  MPC : MATPOWER case struct
  YF : admittance matrix for "from" end of constrained branches
  YT : admittance matrix for "to" end of constrained branches
  IL : vector of branch indices corresponding to branches with
       flow limits (all others are assumed to be unconstrained).
       YF and YT contain only the rows corresponding to IL.
  MPOPT : MATPOWER options struct

Outputs:
  H  : vector of inequality constraint values (flow limits)
       where the flow can be apparent power, real power, or
       current, depending on the value of opf.flow_lim in MPOPT
       (only for constrained lines), normally expressed as
       (limit^2 - flow^2), except when opf.flow_lim == 'P',
       in which case it is simply (limit - flow).
  DH : (optional) inequality constraint gradients, column j is
       gradient of H(j)

Examples:
    h = opf_branch_flow_fcn(x, mpc, Yf, Yt, il, mpopt);
    [h, dh] = opf_branch_flow_fcn(x, mpc, Yf, Yt, il, mpopt);

See also opf_branch_flow_hess().