OPF_BRANCH_ANG_HESS Evaluates Hessian of branch angle difference constraints. D2VADIF = OPF_BRANCH_ANG_HESS(X, LAMBDA, AANG, LANG, UANG) 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 Outputs: D2VADIF : Hessian of branch angle difference constraints. Example: d2VaDif = opf_branch_ang_hess(x, lambda, Aang, lang, uang); See also OPF_BRANCH_ANG_FCN.
0001 function d2VaDif = opf_branch_ang_hess(x, lambda, Aang, lang, uang) 0002 %OPF_BRANCH_ANG_HESS Evaluates Hessian of branch angle difference constraints. 0003 % D2VADIF = OPF_BRANCH_ANG_HESS(X, LAMBDA, AANG, LANG, UANG) 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 % 0016 % Outputs: 0017 % D2VADIF : Hessian of branch angle difference constraints. 0018 % 0019 % Example: 0020 % d2VaDif = opf_branch_ang_hess(x, lambda, Aang, lang, uang); 0021 % 0022 % See also OPF_BRANCH_ANG_FCN. 0023 0024 % MATPOWER 0025 % Copyright (c) 2018-2020, Power Systems Engineering Research Center (PSERC) 0026 % by Ray Zimmerman, PSERC Cornell 0027 % and Baljinnyam Sereeter, Delft University of Technology 0028 % 0029 % This file is part of MATPOWER. 0030 % Covered by the 3-clause BSD License (see LICENSE file for details). 0031 % See https://matpower.org for more info. 0032 0033 0034 %% unpack data 0035 [Vr, Vi] = deal(x{:}); 0036 nb = length(Vr); 0037 0038 %%----- evaluate Hessian of branch angle difference constraints ----- 0039 nlam = length(lambda) / 2; 0040 if nlam 0041 lam = lambda(nlam+1:2*nlam) - lambda(1:nlam); %% lamU - lamL 0042 else 0043 lam = zeros(0,1); 0044 end 0045 0046 Vr2 = Vr.^2; 0047 Vi2 = Vi.^2; 0048 0049 lam_Vm4 = (Aang' * lam) ./ (Vr2 + Vi2).^2; 0050 0051 VaDif_rr = sparse(1:nb, 1:nb, 2 * lam_Vm4 .* Vr .* Vi, nb, nb); 0052 VaDif_ri = sparse(1:nb, 1:nb, lam_Vm4 .* (Vi2 - Vr2), nb, nb); 0053 VaDif_ir = VaDif_ri; 0054 VaDif_ii = -VaDif_rr; 0055 0056 %% construct Hessian 0057 d2VaDif = [ VaDif_rr VaDif_ri; 0058 VaDif_ir VaDif_ii ];