Home > matpower4.1 > 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 %   $Id: dSbus_dV.m,v 1.11 2010/11/16 16:05:47 cvs Exp $
0046 %   by Ray Zimmerman, PSERC Cornell
0047 %   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC)
0048 %
0049 %   This file is part of MATPOWER.
0050 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0051 %
0052 %   MATPOWER is free software: you can redistribute it and/or modify
0053 %   it under the terms of the GNU General Public License as published
0054 %   by the Free Software Foundation, either version 3 of the License,
0055 %   or (at your option) any later version.
0056 %
0057 %   MATPOWER is distributed in the hope that it will be useful,
0058 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0059 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0060 %   GNU General Public License for more details.
0061 %
0062 %   You should have received a copy of the GNU General Public License
0063 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0064 %
0065 %   Additional permission under GNU GPL version 3 section 7
0066 %
0067 %   If you modify MATPOWER, or any covered work, to interface with
0068 %   other modules (such as MATLAB code and MEX-files) available in a
0069 %   MATLAB(R) or comparable environment containing parts covered
0070 %   under other licensing terms, the licensors of MATPOWER grant
0071 %   you additional permission to convey the resulting work.
0072 
0073 n = length(V);
0074 Ibus = Ybus * V;
0075 
0076 if issparse(Ybus)           %% sparse version (if Ybus is sparse)
0077     diagV       = sparse(1:n, 1:n, V, n, n);
0078     diagIbus    = sparse(1:n, 1:n, Ibus, n, n);
0079     diagVnorm   = sparse(1:n, 1:n, V./abs(V), n, n);
0080 else                        %% dense version
0081     diagV       = diag(V);
0082     diagIbus    = diag(Ibus);
0083     diagVnorm   = diag(V./abs(V));
0084 end
0085 
0086 dSbus_dVm = diagV * conj(Ybus * diagVnorm) + conj(diagIbus) * diagVnorm;
0087 dSbus_dVa = 1j * diagV * conj(diagIbus - Ybus * diagV);

Generated on Mon 26-Jan-2015 15:00:13 by m2html © 2005