Home > matpower5.1 > d2Sbus_dV2.m

d2Sbus_dV2

PURPOSE ^

D2SBUS_DV2 Computes 2nd derivatives of power injection w.r.t. voltage.

SYNOPSIS ^

function [Gaa, Gav, Gva, Gvv] = d2Sbus_dV2(Ybus, V, lam)

DESCRIPTION ^

D2SBUS_DV2   Computes 2nd derivatives of power injection w.r.t. voltage.
   [GAA, GAV, GVA, GVV] = D2SBUS_DV2(YBUS, 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
   complex bus power injections. Takes sparse bus admittance matrix YBUS,
   voltage vector V and nb x 1 vector of multipliers LAM. Output matrices
   are sparse.

   Example:
       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
       [Gaa, Gav, Gva, Gvv] = d2Sbus_dV2(Ybus, V, lam);

   Here the output matrices correspond to:
       Gaa = (d/dVa (dSbus_dVa.')) * lam
       Gav = (d/dVm (dSbus_dVa.')) * lam
       Gva = (d/dVa (dSbus_dVm.')) * lam
       Gvv = (d/dVm (dSbus_dVm.')) * lam

   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 [Gaa, Gav, Gva, Gvv] = d2Sbus_dV2(Ybus, V, lam)
0002 %D2SBUS_DV2   Computes 2nd derivatives of power injection w.r.t. voltage.
0003 %   [GAA, GAV, GVA, GVV] = D2SBUS_DV2(YBUS, V, LAM) returns 4 matrices
0004 %   containing the partial derivatives w.r.t. voltage angle and magnitude
0005 %   of the product of a vector LAM with the 1st partial derivatives of the
0006 %   complex bus power injections. Takes sparse bus admittance matrix YBUS,
0007 %   voltage vector V and nb x 1 vector of multipliers LAM. Output matrices
0008 %   are sparse.
0009 %
0010 %   Example:
0011 %       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
0012 %       [Gaa, Gav, Gva, Gvv] = d2Sbus_dV2(Ybus, V, lam);
0013 %
0014 %   Here the output matrices correspond to:
0015 %       Gaa = (d/dVa (dSbus_dVa.')) * lam
0016 %       Gav = (d/dVm (dSbus_dVa.')) * lam
0017 %       Gva = (d/dVa (dSbus_dVm.')) * lam
0018 %       Gvv = (d/dVm (dSbus_dVm.')) * lam
0019 %
0020 %   For more details on the derivations behind the derivative code used
0021 %   in MATPOWER information, see:
0022 %
0023 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0024 %          their Derivatives using Complex Matrix Notation", MATPOWER
0025 %          Technical Note 2, February 2010.
0026 %             http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf
0027 
0028 %   MATPOWER
0029 %   Copyright (c) 2008-2015 by Power System Engineering Research Center (PSERC)
0030 %   by Ray Zimmerman, PSERC Cornell
0031 %
0032 %   $Id: d2Sbus_dV2.m 2644 2015-03-11 19:34:22Z ray $
0033 %
0034 %   This file is part of MATPOWER.
0035 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0036 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0037 
0038 n = length(V);
0039 Ibus    = Ybus * V;
0040 diaglam = sparse(1:n, 1:n, lam, n, n);
0041 diagV   = sparse(1:n, 1:n, V, n, n);
0042 
0043 A = sparse(1:n, 1:n, lam .* V, n, n);
0044 B = Ybus * diagV;
0045 C = A * conj(B);
0046 D = Ybus' * diagV;
0047 E = conj(diagV) * (D * diaglam - sparse(1:n, 1:n, D*lam, n, n));
0048 F = C - A * sparse(1:n, 1:n, conj(Ibus), n, n);
0049 G = sparse(1:n, 1:n, ones(n, 1)./abs(V), n, n);
0050 
0051 Gaa = E + F;
0052 Gva = 1j * G * (E - F);
0053 Gav = Gva.';
0054 Gvv = G * (C + C.') * G;

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