OPF_BRANCH_ANG_HESS Evaluates Hessian of branch angle difference constraints. D2VADIF = OPF_BRANCH_ANG_HESS(X, LAMBDA, AANG, LANG, UANG, IANG, MPOPT) Hessian evaluation function for branch angle difference constraints for voltages in cartesian coordinates. Inputs: X : optimization vector LAMBDA : column vector of Lagrange multipliers on branch angle difference constraints, lower, then upper AANG : constraint matrix, see MAKEAANG LANG : lower bound vector, see MAKEAANG UANG : upper bound vector, see MAKEAANG IANG : index vector of branches corresponding to rows of AANG, LANG, UANG MPOPT : MATPOWER options struct Outputs: D2VADIF : Hessian of branch angle difference constraints. Example: d2VaDif = opf_branch_ang_hess(x, lambda, Aang, lang, uang, iang, mpopt); See also OPF_BRANCH_ANG_FCN.
0001 function d2VaDif = opf_branch_ang_hess(x, lambda, Aang, lang, uang, iang, mpopt) 0002 %OPF_BRANCH_ANG_HESS Evaluates Hessian of branch angle difference constraints. 0003 % D2VADIF = OPF_BRANCH_ANG_HESS(X, LAMBDA, AANG, LANG, UANG, IANG, MPOPT) 0004 % 0005 % Hessian evaluation function for branch angle difference constraints 0006 % for voltages in cartesian coordinates. 0007 % 0008 % Inputs: 0009 % X : optimization vector 0010 % LAMBDA : column vector of Lagrange multipliers on branch angle 0011 % difference constraints, lower, then upper 0012 % AANG : constraint matrix, see MAKEAANG 0013 % LANG : lower bound vector, see MAKEAANG 0014 % UANG : upper bound vector, see MAKEAANG 0015 % IANG : index vector of branches corresponding to rows of AANG, LANG, UANG 0016 % MPOPT : MATPOWER options struct 0017 % 0018 % Outputs: 0019 % D2VADIF : Hessian of branch angle difference constraints. 0020 % 0021 % Example: 0022 % d2VaDif = opf_branch_ang_hess(x, lambda, Aang, lang, uang, iang, mpopt); 0023 % 0024 % See also OPF_BRANCH_ANG_FCN. 0025 0026 % MATPOWER 0027 % Copyright (c) 2018, Power Systems Engineering Research Center (PSERC) 0028 % by Ray Zimmerman, PSERC Cornell 0029 % and Baljinnyam Sereeter, Delft University of Technology 0030 % 0031 % This file is part of MATPOWER. 0032 % Covered by the 3-clause BSD License (see LICENSE file for details). 0033 % See https://matpower.org for more info. 0034 0035 0036 %% unpack data 0037 [Vr, Vi] = deal(x{:}); 0038 nb = length(Vr); 0039 0040 %%----- evaluate Hessian of branch angle difference constraints ----- 0041 nlam = length(lambda) / 2; 0042 if nlam 0043 lamL = lambda(1:nlam); 0044 lamU = lambda((1:nlam)+nlam); 0045 else 0046 lamL = zeros(0,1); 0047 lamU = zeros(0,1); 0048 end 0049 0050 Vr2 = Vr.^2; 0051 Vi2 = Vi.^2; 0052 0053 lamL_Vm4 = (Aang' * lamL) ./ (Vr2 + Vi2).^2; 0054 lamU_Vm4 = (Aang' * lamU) ./ (Vr2 + Vi2).^2; 0055 0056 VaDifL_rr = sparse(1:nb, 1:nb, 2 * lamL_Vm4 .* Vr .* Vi, nb, nb); 0057 VaDifL_ri = sparse(1:nb, 1:nb, lamL_Vm4 .* (Vi2 - Vr2), nb, nb); 0058 VaDifL_ir = VaDifL_ri; 0059 VaDifL_ii = -VaDifL_rr; 0060 0061 VaDifU_rr = sparse(1:nb, 1:nb, 2 * lamU_Vm4 .* Vr .* Vi, nb, nb); 0062 VaDifU_ri = sparse(1:nb, 1:nb, lamU_Vm4 .* (Vi2 - Vr2), nb, nb); 0063 VaDifU_ir = VaDifU_ri; 0064 VaDifU_ii = -VaDifU_rr; 0065 0066 %% construct Hessian 0067 d2VaDif = -[ VaDifL_rr VaDifL_ri; 0068 VaDifL_ir VaDifL_ii ] + ... 0069 [ VaDifU_rr VaDifU_ri; 0070 VaDifU_ir VaDifU_ii ];