Home > matpower6.0 > dSbus_dV.m

dSbus_dV

PURPOSE ^

DSBUS_DV Computes partial derivatives of power injection w.r.t. voltage.

SYNOPSIS ^

function [dSbus_dVm, dSbus_dVa] = dSbus_dV(Ybus, V)

DESCRIPTION ^

DSBUS_DV   Computes partial derivatives of power injection w.r.t. voltage.
   [DSBUS_DVM, DSBUS_DVA] = DSBUS_DV(YBUS, V) returns two matrices containing
   partial derivatives of the complex bus power injections w.r.t voltage
   magnitude and voltage angle respectively (for all buses). If YBUS is a
   sparse matrix, the return values will be also. The following explains
   the expressions used to form the matrices:

   S = diag(V) * conj(Ibus) = diag(conj(Ibus)) * V

   Partials of V & Ibus w.r.t. voltage magnitudes
       dV/dVm = diag(V./abs(V))
       dI/dVm = Ybus * dV/dVm = Ybus * diag(V./abs(V))

   Partials of V & Ibus w.r.t. voltage angles
       dV/dVa = j * diag(V)
       dI/dVa = Ybus * dV/dVa = Ybus * j * diag(V)

   Partials of S w.r.t. voltage magnitudes
       dS/dVm = diag(V) * conj(dI/dVm) + diag(conj(Ibus)) * dV/dVm
              = diag(V) * conj(Ybus * diag(V./abs(V)))
                                       + conj(diag(Ibus)) * diag(V./abs(V))

   Partials of S w.r.t. voltage angles
       dS/dVa = diag(V) * conj(dI/dVa) + diag(conj(Ibus)) * dV/dVa
              = diag(V) * conj(Ybus * j * diag(V))
                                       + conj(diag(Ibus)) * j * diag(V)
              = -j * diag(V) * conj(Ybus * diag(V))
                                       + conj(diag(Ibus)) * j * diag(V)
              = j * diag(V) * conj(diag(Ibus) - Ybus * diag(V))

   Example:
       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
       [dSbus_dVm, dSbus_dVa] = dSbus_dV(Ybus, V);

   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 [dSbus_dVm, dSbus_dVa] = dSbus_dV(Ybus, V)
0002 %DSBUS_DV   Computes partial derivatives of power injection w.r.t. voltage.
0003 %   [DSBUS_DVM, DSBUS_DVA] = DSBUS_DV(YBUS, V) returns two matrices containing
0004 %   partial derivatives of the complex bus power injections w.r.t voltage
0005 %   magnitude and voltage angle respectively (for all buses). If YBUS is a
0006 %   sparse matrix, the return values will be also. The following explains
0007 %   the expressions used to form the matrices:
0008 %
0009 %   S = diag(V) * conj(Ibus) = diag(conj(Ibus)) * V
0010 %
0011 %   Partials of V & Ibus w.r.t. voltage magnitudes
0012 %       dV/dVm = diag(V./abs(V))
0013 %       dI/dVm = Ybus * dV/dVm = Ybus * diag(V./abs(V))
0014 %
0015 %   Partials of V & Ibus w.r.t. voltage angles
0016 %       dV/dVa = j * diag(V)
0017 %       dI/dVa = Ybus * dV/dVa = Ybus * j * diag(V)
0018 %
0019 %   Partials of S w.r.t. voltage magnitudes
0020 %       dS/dVm = diag(V) * conj(dI/dVm) + diag(conj(Ibus)) * dV/dVm
0021 %              = diag(V) * conj(Ybus * diag(V./abs(V)))
0022 %                                       + conj(diag(Ibus)) * diag(V./abs(V))
0023 %
0024 %   Partials of S w.r.t. voltage angles
0025 %       dS/dVa = diag(V) * conj(dI/dVa) + diag(conj(Ibus)) * dV/dVa
0026 %              = diag(V) * conj(Ybus * j * diag(V))
0027 %                                       + conj(diag(Ibus)) * j * diag(V)
0028 %              = -j * diag(V) * conj(Ybus * diag(V))
0029 %                                       + conj(diag(Ibus)) * j * diag(V)
0030 %              = j * diag(V) * conj(diag(Ibus) - Ybus * diag(V))
0031 %
0032 %   Example:
0033 %       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
0034 %       [dSbus_dVm, dSbus_dVa] = dSbus_dV(Ybus, V);
0035 %
0036 %   For more details on the derivations behind the derivative code used
0037 %   in MATPOWER information, see:
0038 %
0039 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0040 %          their Derivatives using Complex Matrix Notation", MATPOWER
0041 %          Technical Note 2, February 2010.
0042 %             http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf
0043 
0044 %   MATPOWER
0045 %   Copyright (c) 1996-2016, Power Systems Engineering Research Center (PSERC)
0046 %   by Ray Zimmerman, PSERC Cornell
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 n = length(V);
0053 Ibus = Ybus * V;
0054 
0055 if issparse(Ybus)           %% sparse version (if Ybus is sparse)
0056     diagV       = sparse(1:n, 1:n, V, n, n);
0057     diagIbus    = sparse(1:n, 1:n, Ibus, n, n);
0058     diagVnorm   = sparse(1:n, 1:n, V./abs(V), n, n);
0059 else                        %% dense version
0060     diagV       = diag(V);
0061     diagIbus    = diag(Ibus);
0062     diagVnorm   = diag(V./abs(V));
0063 end
0064 
0065 dSbus_dVm = diagV * conj(Ybus * diagVnorm) + conj(diagIbus) * diagVnorm;
0066 dSbus_dVa = 1j * diagV * conj(diagIbus - Ybus * diagV);

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