Home > matpower5.1 > d2AIbr_dV2.m

d2AIbr_dV2

PURPOSE ^

D2AIBR_DV2 Computes 2nd derivatives of |complex current|^2 w.r.t. V.

SYNOPSIS ^

function [Haa, Hav, Hva, Hvv] =d2AIbr_dV2(dIbr_dVa, dIbr_dVm, Ibr, Ybr, V, lam)

DESCRIPTION ^

D2AIBR_DV2   Computes 2nd derivatives of |complex current|^2 w.r.t. V.
   [HAA, HAV, HVA, HVV] = D2AIBR_DV2(DIBR_DVA, DIBR_DVM, IBR, YBR, V, LAM)
   returns 4 matrices containing the partial derivatives w.r.t. voltage
   angle and magnitude of the product of a vector LAM with the 1st partial
   derivatives of the square of the magnitude of the branch currents.
   Takes sparse first derivative matrices of complex flow, complex flow
   vector, sparse branch admittance matrix YBR, voltage vector V and
   nl x 1 vector of multipliers LAM. Output matrices are sparse.

   Example:
       f = branch(:, F_BUS);
       Cf =  sparse(1:nl, f, ones(nl, 1), nl, nb);
       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
       [dIf_dVa, dIf_dVm, dIt_dVa, dIt_dVm, If, It] = ...
               dIbr_dV(branch, Yf, Yt, V);
       Cbr = Cf;
       Ybr = Yf;
       dIbr_dVa = dIf_dVa;
       dIbr_dVm = dIf_dVm;
       Ibr = If;
       [Haa, Hav, Hva, Hvv] = ...
             d2AIbr_dV2(dIbr_dVa, dIbr_dVm, Ibr, Ybr, V, lam);

   Here the output matrices correspond to:
     Haa = (d/dVa (dAIbr_dVa.')) * lam
     Hav = (d/dVm (dAIbr_dVa.')) * lam
     Hva = (d/dVa (dAIbr_dVm.')) * lam
     Hvv = (d/dVm (dAIbr_dVm.')) * lam

   See also DIBR_DV.

   For more details on the derivations behind the derivative code used
   in MATPOWER information, see:

   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
          their Derivatives using Complex Matrix Notation", MATPOWER
          Technical Note 2, February 2010.
             http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Haa, Hav, Hva, Hvv] = ...
0002     d2AIbr_dV2(dIbr_dVa, dIbr_dVm, Ibr, Ybr, V, lam)
0003 %D2AIBR_DV2   Computes 2nd derivatives of |complex current|^2 w.r.t. V.
0004 %   [HAA, HAV, HVA, HVV] = D2AIBR_DV2(DIBR_DVA, DIBR_DVM, IBR, YBR, V, LAM)
0005 %   returns 4 matrices containing the partial derivatives w.r.t. voltage
0006 %   angle and magnitude of the product of a vector LAM with the 1st partial
0007 %   derivatives of the square of the magnitude of the branch currents.
0008 %   Takes sparse first derivative matrices of complex flow, complex flow
0009 %   vector, sparse branch admittance matrix YBR, voltage vector V and
0010 %   nl x 1 vector of multipliers LAM. Output matrices are sparse.
0011 %
0012 %   Example:
0013 %       f = branch(:, F_BUS);
0014 %       Cf =  sparse(1:nl, f, ones(nl, 1), nl, nb);
0015 %       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
0016 %       [dIf_dVa, dIf_dVm, dIt_dVa, dIt_dVm, If, It] = ...
0017 %               dIbr_dV(branch, Yf, Yt, V);
0018 %       Cbr = Cf;
0019 %       Ybr = Yf;
0020 %       dIbr_dVa = dIf_dVa;
0021 %       dIbr_dVm = dIf_dVm;
0022 %       Ibr = If;
0023 %       [Haa, Hav, Hva, Hvv] = ...
0024 %             d2AIbr_dV2(dIbr_dVa, dIbr_dVm, Ibr, Ybr, V, lam);
0025 %
0026 %   Here the output matrices correspond to:
0027 %     Haa = (d/dVa (dAIbr_dVa.')) * lam
0028 %     Hav = (d/dVm (dAIbr_dVa.')) * lam
0029 %     Hva = (d/dVa (dAIbr_dVm.')) * lam
0030 %     Hvv = (d/dVm (dAIbr_dVm.')) * lam
0031 %
0032 %   See also DIBR_DV.
0033 %
0034 %   For more details on the derivations behind the derivative code used
0035 %   in MATPOWER information, see:
0036 %
0037 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0038 %          their Derivatives using Complex Matrix Notation", MATPOWER
0039 %          Technical Note 2, February 2010.
0040 %             http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf
0041 
0042 %   MATPOWER
0043 %   Copyright (c) 2008-2015 by Power System Engineering Research Center (PSERC)
0044 %   by Ray Zimmerman, PSERC Cornell
0045 %
0046 %   $Id: d2AIbr_dV2.m 2644 2015-03-11 19:34:22Z ray $
0047 %
0048 %   This file is part of MATPOWER.
0049 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0050 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0051 
0052 %% define
0053 nl = length(lam);
0054 
0055 diaglam = sparse(1:nl, 1:nl, lam, nl, nl);
0056 diagIbr_conj = sparse(1:nl, 1:nl, conj(Ibr), nl, nl);
0057 
0058 [Iaa, Iav, Iva, Ivv] = d2Ibr_dV2(Ybr, V, diagIbr_conj * lam);
0059 Haa = 2 * real( Iaa + dIbr_dVa.' * diaglam * conj(dIbr_dVa) );
0060 Hva = 2 * real( Iva + dIbr_dVm.' * diaglam * conj(dIbr_dVa) );
0061 Hav = 2 * real( Iav + dIbr_dVa.' * diaglam * conj(dIbr_dVm) );
0062 Hvv = 2 * real( Ivv + dIbr_dVm.' * diaglam * conj(dIbr_dVm) );

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005