Home > matpower6.0 > 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, 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, 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-2016, Power Systems Engineering Research Center (PSERC)
0030 %   by Ray Zimmerman, PSERC Cornell
0031 %
0032 %   This file is part of MATPOWER.
0033 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0034 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0035 
0036 n = length(V);
0037 Ibus    = Ybus * V;
0038 diaglam = sparse(1:n, 1:n, lam, n, n);
0039 diagV   = sparse(1:n, 1:n, V, n, n);
0040 
0041 A = sparse(1:n, 1:n, lam .* V, n, n);
0042 B = Ybus * diagV;
0043 C = A * conj(B);
0044 D = Ybus' * diagV;
0045 E = conj(diagV) * (D * diaglam - sparse(1:n, 1:n, D*lam, n, n));
0046 F = C - A * sparse(1:n, 1:n, conj(Ibus), n, n);
0047 G = sparse(1:n, 1:n, ones(n, 1)./abs(V), n, n);
0048 
0049 Gaa = E + F;
0050 Gva = 1j * G * (E - F);
0051 Gav = Gva.';
0052 Gvv = G * (C + C.') * G;

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005