Home > matpower4.0 > dIbr_dV.m

dIbr_dV

PURPOSE ^

DIBR_DV Computes partial derivatives of branch currents w.r.t. voltage.

SYNOPSIS ^

function [dIf_dVa, dIf_dVm, dIt_dVa, dIt_dVm, If, It] = dIbr_dV(branch, Yf, Yt, V)

DESCRIPTION ^

DIBR_DV   Computes partial derivatives of branch currents w.r.t. voltage.
   [DIF_DVA, DIF_DVM, DIT_DVA, DIT_DVM, IF, IT] = DIBR_DV(BRANCH, YF, YT, V)
   returns four matrices containing partial derivatives of the complex
   branch currents at "from" and "to" ends of each branch w.r.t voltage
   magnitude and voltage angle respectively (for all buses). If YF is a
   sparse matrix, the partial derivative matrices will be as well. Optionally
   returns vectors containing the currents themselves. The following
   explains the expressions used to form the matrices:

   If = Yf * V;

   Partials of V, Vf & If w.r.t. voltage angles
       dV/dVa  = j * diag(V)
       dVf/dVa = sparse(1:nl, f, j * V(f)) = j * sparse(1:nl, f, V(f))
       dIf/dVa = Yf * dV/dVa = Yf * j * diag(V)

   Partials of V, Vf & If w.r.t. voltage magnitudes
       dV/dVm  = diag(V./abs(V))
       dVf/dVm = sparse(1:nl, f, V(f)./abs(V(f))
       dIf/dVm = Yf * dV/dVm = Yf * diag(V./abs(V))

   Derivations for "to" bus are similar.

   Example:
       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
       [dIf_dVa, dIf_dVm, dIt_dVa, dIt_dVm, If, It] = ...
           dIbr_dV(branch, Yf, Yt, 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 [dIf_dVa, dIf_dVm, dIt_dVa, dIt_dVm, If, It] = dIbr_dV(branch, Yf, Yt, V)
0002 %DIBR_DV   Computes partial derivatives of branch currents w.r.t. voltage.
0003 %   [DIF_DVA, DIF_DVM, DIT_DVA, DIT_DVM, IF, IT] = DIBR_DV(BRANCH, YF, YT, V)
0004 %   returns four matrices containing partial derivatives of the complex
0005 %   branch currents at "from" and "to" ends of each branch w.r.t voltage
0006 %   magnitude and voltage angle respectively (for all buses). If YF is a
0007 %   sparse matrix, the partial derivative matrices will be as well. Optionally
0008 %   returns vectors containing the currents themselves. The following
0009 %   explains the expressions used to form the matrices:
0010 %
0011 %   If = Yf * V;
0012 %
0013 %   Partials of V, Vf & If w.r.t. voltage angles
0014 %       dV/dVa  = j * diag(V)
0015 %       dVf/dVa = sparse(1:nl, f, j * V(f)) = j * sparse(1:nl, f, V(f))
0016 %       dIf/dVa = Yf * dV/dVa = Yf * j * diag(V)
0017 %
0018 %   Partials of V, Vf & If w.r.t. voltage magnitudes
0019 %       dV/dVm  = diag(V./abs(V))
0020 %       dVf/dVm = sparse(1:nl, f, V(f)./abs(V(f))
0021 %       dIf/dVm = Yf * dV/dVm = Yf * diag(V./abs(V))
0022 %
0023 %   Derivations for "to" bus are similar.
0024 %
0025 %   Example:
0026 %       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
0027 %       [dIf_dVa, dIf_dVm, dIt_dVa, dIt_dVm, If, It] = ...
0028 %           dIbr_dV(branch, Yf, Yt, V);
0029 %
0030 %   For more details on the derivations behind the derivative code used
0031 %   in MATPOWER information, see:
0032 %
0033 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0034 %          their Derivatives using Complex Matrix Notation", MATPOWER
0035 %          Technical Note 2, February 2010.
0036 %             http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf
0037 
0038 %   MATPOWER
0039 %   $Id: dIbr_dV.m,v 1.10 2010/11/16 16:05:47 cvs Exp $
0040 %   by Ray Zimmerman, PSERC Cornell
0041 %   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC)
0042 %
0043 %   This file is part of MATPOWER.
0044 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0045 %
0046 %   MATPOWER is free software: you can redistribute it and/or modify
0047 %   it under the terms of the GNU General Public License as published
0048 %   by the Free Software Foundation, either version 3 of the License,
0049 %   or (at your option) any later version.
0050 %
0051 %   MATPOWER is distributed in the hope that it will be useful,
0052 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0053 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0054 %   GNU General Public License for more details.
0055 %
0056 %   You should have received a copy of the GNU General Public License
0057 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0058 %
0059 %   Additional permission under GNU GPL version 3 section 7
0060 %
0061 %   If you modify MATPOWER, or any covered work, to interface with
0062 %   other modules (such as MATLAB code and MEX-files) available in a
0063 %   MATLAB(R) or comparable environment containing parts covered
0064 %   under other licensing terms, the licensors of MATPOWER grant
0065 %   you additional permission to convey the resulting work.
0066 
0067 %% define
0068 nb = length(V);
0069 
0070 Vnorm = V ./ abs(V);
0071 if issparse(Yf)             %% sparse version (if Yf is sparse)
0072     diagV       = sparse(1:nb, 1:nb, V, nb, nb);
0073     diagVnorm   = sparse(1:nb, 1:nb, Vnorm, nb, nb);
0074 else                        %% dense version
0075     diagV       = diag(V);
0076     diagVnorm   = diag(Vnorm);
0077 end
0078 dIf_dVa = Yf * 1j * diagV;
0079 dIf_dVm = Yf * diagVnorm;
0080 dIt_dVa = Yt * 1j * diagV;
0081 dIt_dVm = Yt * diagVnorm;
0082 
0083 %% compute currents
0084 if nargout > 4
0085     If = Yf * V;
0086     It = Yt * V;
0087 end

Generated on Mon 26-Jan-2015 14:56:45 by m2html © 2005