Home > matpower7.0 > lib > opf_vlim_hess.m

opf_vlim_hess

PURPOSE ^

OPF_VLIM_HESS Evaluates Hessian of voltage magnitudes.

SYNOPSIS ^

function d2Vlims = opf_vlim_hess(x, lambda, mpc, idx, mpopt)

DESCRIPTION ^

OPF_VLIM_HESS  Evaluates Hessian of voltage magnitudes.
   D2VLIMS = OPF_VLIM_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:
     D2VLIMS : Hessian of voltage magnitudes.

   Example:
       d2Vlims = opf_vlim_hess(x, lambda, mpc, idx, mpopt);

   See also OPF_VLIM_FCN.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function d2Vlims = opf_vlim_hess(x, lambda, mpc, idx, mpopt)
0002 %OPF_VLIM_HESS  Evaluates Hessian of voltage magnitudes.
0003 %   D2VLIMS = OPF_VLIM_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 %     D2VLIMS : Hessian of voltage magnitudes.
0017 %
0018 %   Example:
0019 %       d2Vlims = opf_vlim_hess(x, lambda, mpc, idx, mpopt);
0020 %
0021 %   See also OPF_VLIM_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 
0035 %% problem dimensions
0036 nb = length(Vi);            %% number of buses
0037 n = length(idx);            %% number of buses with voltage limits
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 limit constraints -----
0046 nlam = length(lambda) / 2;
0047 if nlam
0048     lamVmin = lambda(1:nlam);
0049     lamVmax = lambda((1:nlam)+nlam);
0050 else    %% keep dimensions of empty matrices/vectors compatible
0051     lamVmin = zeros(0,1);
0052     lamVmax = zeros(0,1);
0053 end
0054 
0055 lamVmin_over_Vm3 = lamVmin ./ Vm3;
0056 lamVmax_over_Vm3 = lamVmax ./ Vm3;
0057 
0058 Vmin_rr = sparse(idx, idx,  Vi2  .* lamVmin_over_Vm3, nb, nb);
0059 Vmin_ri = sparse(idx, idx, -VrVi .* lamVmin_over_Vm3, nb, nb);
0060 Vmin_ir = Vmin_ri;
0061 Vmin_ii = sparse(idx, idx,  Vr2  .* lamVmin_over_Vm3, nb, nb);
0062 
0063 Vmax_rr = sparse(idx, idx,  Vi2  .* lamVmax_over_Vm3, nb, nb);
0064 Vmax_ri = sparse(idx, idx, -VrVi .* lamVmax_over_Vm3, nb, nb);
0065 Vmax_ir = Vmax_ri;
0066 Vmax_ii = sparse(idx, idx,  Vr2  .* lamVmax_over_Vm3, nb, nb);
0067 
0068 %% construct Hessian
0069 d2Vlims =  -[Vmin_rr Vmin_ri; Vmin_ir Vmin_ii] + ...
0070             [Vmax_rr Vmax_ri; Vmax_ir Vmax_ii];

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005