pwrs.core.opf_current_balance_fcn#
- pwrs.core.opf_current_balance_fcn.opf_current_balance_fcn(x, mpc, Ybus, mpopt, nargout=1)[source]#
Evaluate AC OPF current balance constraints and Jacobian.
Computes the nonlinear equality constraints enforcing real and imaginary current balance at each bus for the current OPF state. When requested, it also returns the Jacobian with respect to the OPF decision variables.
- Parameters:
x (sequence of array_like) – OPF state blocks. The layout matches MATPOWER:
(Va, Vm, Pg, Qg)in polar form or(Vr, Vi, Pg, Qg)in cartesian form.mpc (dict) – Internal MATPOWER case struct.
Ybus (sparse matrix) – Bus admittance matrix.
mpopt (MatpowerConfig) – Typed MATPOWER options configuration.
nargout (int, optional) – MATLAB compatibility flag controlling whether the Jacobian is returned.
- Returns:
Constraint vector
gcontaining stacked real and imaginary current mismatches, and optionally its Jacobiandg.- Return type:
numpy.ndarray or tuple
- pwrs.core.opf_current_balance_fcn.opf_current_balance_fcn_with_jacobian(x, mpc, Ybus, mpopt)[source]#
Evaluate current-balance constraints and return their Jacobian.
- Parameters:
mpopt (MatpowerConfig)