OPF_VEQ_HESS Evaluates Hessian of voltage magnitude equality constraint. D2VEQ = OPF_VEQ_HESS(X, LAMBDA, MPC, IDX, MPOPT) Hessian evaluation function for voltage magnitudes. Inputs: X : optimization vector LAMBDA : column vector of Lagrange multipliers on active and reactive power balance constraints MPC : MATPOWER case struct IDX : index of buses whose voltage magnitudes should be fixed MPOPT : MATPOWER options struct Outputs: D2VEQ : Hessian of voltage magnitudes. Example: d2Veq = opf_veq_hess(x, lambda, mpc, idx, mpopt); See also OPF_VEQ_FCN.
0001 function d2Veq = opf_veq_hess(x, lambda, mpc, idx, mpopt) 0002 %OPF_VEQ_HESS Evaluates Hessian of voltage magnitude equality constraint. 0003 % D2VEQ = OPF_VEQ_HESS(X, LAMBDA, MPC, IDX, MPOPT) 0004 % 0005 % Hessian evaluation function for voltage magnitudes. 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 % IDX : index of buses whose voltage magnitudes should be fixed 0013 % MPOPT : MATPOWER options struct 0014 % 0015 % Outputs: 0016 % D2VEQ : Hessian of voltage magnitudes. 0017 % 0018 % Example: 0019 % d2Veq = opf_veq_hess(x, lambda, mpc, idx, mpopt); 0020 % 0021 % See also OPF_VEQ_FCN. 0022 0023 % MATPOWER 0024 % Copyright (c) 2018, Power Systems Engineering Research Center (PSERC) 0025 % by Ray Zimmerman, PSERC Cornell 0026 % and Baljinnyam Sereeter, Delft University of Technology 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 0035 %% problem dimensions 0036 nb = length(Vi); %% number of buses 0037 n = length(idx); %% number of buses with fixed voltage magnitudes 0038 0039 %% compute voltage magnitude cubed 0040 Vr2 = Vr(idx).^2; 0041 Vi2 = Vi(idx).^2; 0042 VrVi = Vr(idx) .* Vi(idx); 0043 Vm3 = (Vr2 + Vi2).^(3/2); %% Vm.^3; 0044 0045 %%----- evaluate Hessian of voltage magnitude constraints ----- 0046 lamVm_over_Vm3 = lambda ./ Vm3; 0047 0048 Vm_rr = sparse(idx, idx, Vi2 .* lamVm_over_Vm3, nb, nb); 0049 Vm_ri = sparse(idx, idx, -VrVi .* lamVm_over_Vm3, nb, nb); 0050 Vm_ir = Vm_ri; 0051 Vm_ii = sparse(idx, idx, Vr2 .* lamVm_over_Vm3, nb, nb); 0052 0053 %% construct Hessian 0054 d2Veq = [Vm_rr Vm_ri; Vm_ir Vm_ii];