OPF_VREF_HESS Evaluates Hessian of voltage angle reference. D2VREF = OPF_VREF_HESS(X, LAMBDA, MPC, REFS, MPOPT) Hessian evaluation function for voltage angle reference. Inputs: X : optimization vector LAMBDA : column vector of Lagrange multipliers on active and reactive power balance constraints MPC : MATPOWER case struct REFS : reference vector MPOPT : MATPOWER options struct Outputs: D2VREF : Hessian of voltage angle reference. Example: d2Vref = opf_vref_hess(x, lambda, mpc, refs, mpopt); See also OPF_VREF_FCN.
0001 function d2Vref = opf_vref_hess(x, lam, mpc, refs, mpopt) 0002 %OPF_VREF_HESS Evaluates Hessian of voltage angle reference. 0003 % D2VREF = OPF_VREF_HESS(X, LAMBDA, MPC, REFS, MPOPT) 0004 % 0005 % Hessian evaluation function for voltage angle reference. 0006 % 0007 % Inputs: 0008 % X : optimization vector 0009 % LAMBDA : column vector of Lagrange multipliers on active and reactive 0010 % power balance constraints 0011 % MPC : MATPOWER case struct 0012 % REFS : reference vector 0013 % MPOPT : MATPOWER options struct 0014 % 0015 % Outputs: 0016 % D2VREF : Hessian of voltage angle reference. 0017 % 0018 % Example: 0019 % d2Vref = opf_vref_hess(x, lambda, mpc, refs, mpopt); 0020 % 0021 % See also OPF_VREF_FCN. 0022 0023 % MATPOWER 0024 % Copyright (c) 2018, Power Systems Engineering Research Center (PSERC) 0025 % by Baljinnyam Sereeter, Delft University of Technology 0026 % and Ray Zimmerman, PSERC Cornell 0027 % 0028 % This file is part of MATPOWER. 0029 % Covered by the 3-clause BSD License (see LICENSE file for details). 0030 % See https://matpower.org for more info. 0031 0032 %% unpack data 0033 [Vr, Vi] = deal(x{:}); 0034 nb = length(Vr); 0035 0036 %%----- evaluate Hessian of voltage angle constraints ----- 0037 VVr = Vr(refs); 0038 VVi = Vi(refs); 0039 VVr2 = VVr.^2; 0040 VVi2 = VVi.^2; 0041 lamVm4 = lam ./ (VVr2 + VVi2).^2; 0042 0043 d2Vref_rr = sparse(refs, refs, 2 * lamVm4 .* VVr .* VVi, nb, nb); 0044 d2Vref_ri = sparse(refs, refs, lamVm4 .* (VVi2 - VVr2), nb, nb); 0045 d2Vref_ir = d2Vref_ri; 0046 d2Vref_ii = -d2Vref_rr; 0047 0048 %% construct Hessian 0049 d2Vref = [ d2Vref_rr d2Vref_ri; 0050 d2Vref_ir d2Vref_ii ];