Home > matpower4.0 > dAbr_dV.m

dAbr_dV

PURPOSE ^

DABR_DV Partial derivatives of squared flow magnitudes w.r.t voltage.

SYNOPSIS ^

function [dAf_dVa, dAf_dVm, dAt_dVa, dAt_dVm] =dAbr_dV(dSf_dVa, dSf_dVm, dSt_dVa, dSt_dVm, Sf, St)

DESCRIPTION ^

DABR_DV   Partial derivatives of squared flow magnitudes w.r.t voltage.
   [DAF_DVA, DAF_DVM, DAT_DVA, DAT_DVM] = ...
               DABR_DV(DFF_DVA, DFF_DVM, DFT_DVA, DFT_DVM, FF, FT)
   returns four matrices containing partial derivatives of the square of
   the branch flow magnitudes at "from" & "to" ends of each branch w.r.t
   voltage magnitude and voltage angle respectively (for all buses), given
   the flows and flow sensitivities. Flows could be complex current or
   complex or real power. Notation below is based on complex power. The
   following explains the expressions used to form the matrices:

   Let Af refer to the square of the apparent power at the "from" end of
   each branch,

       Af = abs(Sf).^2
          = Sf .* conj(Sf)
          = Pf.^2 + Qf.^2

   then ...

   Partial w.r.t real power,
       dAf/dPf = 2 * diag(Pf)

   Partial w.r.t reactive power,
       dAf/dQf = 2 * diag(Qf)

   Partial w.r.t Vm & Va
       dAf/dVm = dAf/dPf * dPf/dVm + dAf/dQf * dQf/dVm
       dAf/dVa = dAf/dPf * dPf/dVa + dAf/dQf * dQf/dVa

   Derivations for "to" bus are similar.

   Examples:
       %% squared current magnitude
       [dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft] = ...
               dIbr_dV(branch(il,:), Yf, Yt, V);
       [dAf_dVa, dAf_dVm, dAt_dVa, dAt_dVm] = ...
               dAbr_dV(dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft);

       %% squared apparent power flow
       [dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft] = ...
               dSbr_dV(branch(il,:), Yf, Yt, V);
       [dAf_dVa, dAf_dVm, dAt_dVa, dAt_dVm] = ...
               dAbr_dV(dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft);

       %% squared real power flow
       [dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft] = ...
               dSbr_dV(branch(il,:), Yf, Yt, V);
       dFf_dVa = real(dFf_dVa);
       dFf_dVm = real(dFf_dVm);
       dFt_dVa = real(dFt_dVa);
       dFt_dVm = real(dFt_dVm);
       [dAf_dVa, dAf_dVm, dAt_dVa, dAt_dVm] = ...
               dAbr_dV(dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft);

   See also DIBR_DV, DSBR_DV.

   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 [dAf_dVa, dAf_dVm, dAt_dVa, dAt_dVm] = ...
0002                         dAbr_dV(dSf_dVa, dSf_dVm, dSt_dVa, dSt_dVm, Sf, St)
0003 %DABR_DV   Partial derivatives of squared flow magnitudes w.r.t voltage.
0004 %   [DAF_DVA, DAF_DVM, DAT_DVA, DAT_DVM] = ...
0005 %               DABR_DV(DFF_DVA, DFF_DVM, DFT_DVA, DFT_DVM, FF, FT)
0006 %   returns four matrices containing partial derivatives of the square of
0007 %   the branch flow magnitudes at "from" & "to" ends of each branch w.r.t
0008 %   voltage magnitude and voltage angle respectively (for all buses), given
0009 %   the flows and flow sensitivities. Flows could be complex current or
0010 %   complex or real power. Notation below is based on complex power. The
0011 %   following explains the expressions used to form the matrices:
0012 %
0013 %   Let Af refer to the square of the apparent power at the "from" end of
0014 %   each branch,
0015 %
0016 %       Af = abs(Sf).^2
0017 %          = Sf .* conj(Sf)
0018 %          = Pf.^2 + Qf.^2
0019 %
0020 %   then ...
0021 %
0022 %   Partial w.r.t real power,
0023 %       dAf/dPf = 2 * diag(Pf)
0024 %
0025 %   Partial w.r.t reactive power,
0026 %       dAf/dQf = 2 * diag(Qf)
0027 %
0028 %   Partial w.r.t Vm & Va
0029 %       dAf/dVm = dAf/dPf * dPf/dVm + dAf/dQf * dQf/dVm
0030 %       dAf/dVa = dAf/dPf * dPf/dVa + dAf/dQf * dQf/dVa
0031 %
0032 %   Derivations for "to" bus are similar.
0033 %
0034 %   Examples:
0035 %       %% squared current magnitude
0036 %       [dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft] = ...
0037 %               dIbr_dV(branch(il,:), Yf, Yt, V);
0038 %       [dAf_dVa, dAf_dVm, dAt_dVa, dAt_dVm] = ...
0039 %               dAbr_dV(dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft);
0040 %
0041 %       %% squared apparent power flow
0042 %       [dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft] = ...
0043 %               dSbr_dV(branch(il,:), Yf, Yt, V);
0044 %       [dAf_dVa, dAf_dVm, dAt_dVa, dAt_dVm] = ...
0045 %               dAbr_dV(dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft);
0046 %
0047 %       %% squared real power flow
0048 %       [dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft] = ...
0049 %               dSbr_dV(branch(il,:), Yf, Yt, V);
0050 %       dFf_dVa = real(dFf_dVa);
0051 %       dFf_dVm = real(dFf_dVm);
0052 %       dFt_dVa = real(dFt_dVa);
0053 %       dFt_dVm = real(dFt_dVm);
0054 %       [dAf_dVa, dAf_dVm, dAt_dVa, dAt_dVm] = ...
0055 %               dAbr_dV(dFf_dVa, dFf_dVm, dFt_dVa, dFt_dVm, Ff, Ft);
0056 %
0057 %   See also DIBR_DV, DSBR_DV.
0058 %
0059 %   For more details on the derivations behind the derivative code used
0060 %   in MATPOWER information, see:
0061 %
0062 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0063 %          their Derivatives using Complex Matrix Notation", MATPOWER
0064 %          Technical Note 2, February 2010.
0065 %             http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf
0066 
0067 %   MATPOWER
0068 %   $Id: dAbr_dV.m,v 1.11 2010/11/16 16:05:47 cvs Exp $
0069 %   by Ray Zimmerman, PSERC Cornell
0070 %   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC)
0071 %
0072 %   This file is part of MATPOWER.
0073 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0074 %
0075 %   MATPOWER is free software: you can redistribute it and/or modify
0076 %   it under the terms of the GNU General Public License as published
0077 %   by the Free Software Foundation, either version 3 of the License,
0078 %   or (at your option) any later version.
0079 %
0080 %   MATPOWER is distributed in the hope that it will be useful,
0081 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0082 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0083 %   GNU General Public License for more details.
0084 %
0085 %   You should have received a copy of the GNU General Public License
0086 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0087 %
0088 %   Additional permission under GNU GPL version 3 section 7
0089 %
0090 %   If you modify MATPOWER, or any covered work, to interface with
0091 %   other modules (such as MATLAB code and MEX-files) available in a
0092 %   MATLAB(R) or comparable environment containing parts covered
0093 %   under other licensing terms, the licensors of MATPOWER grant
0094 %   you additional permission to convey the resulting work.
0095 
0096 %% dimensions
0097 nl = length(Sf);
0098 
0099 %%----- partials w.r.t. real and reactive power flows -----
0100 dAf_dPf = sparse(1:nl, 1:nl, 2 * real(Sf), nl, nl);
0101 dAf_dQf = sparse(1:nl, 1:nl, 2 * imag(Sf), nl, nl);
0102 dAt_dPt = sparse(1:nl, 1:nl, 2 * real(St), nl, nl);
0103 dAt_dQt = sparse(1:nl, 1:nl, 2 * imag(St), nl, nl);
0104 
0105 %% partials w.r.t. voltage magnitudes and angles
0106 dAf_dVm = dAf_dPf * real(dSf_dVm) + dAf_dQf * imag(dSf_dVm);
0107 dAf_dVa = dAf_dPf * real(dSf_dVa) + dAf_dQf * imag(dSf_dVa);
0108 dAt_dVm = dAt_dPt * real(dSt_dVm) + dAt_dQt * imag(dSt_dVm);
0109 dAt_dVa = dAt_dPt * real(dSt_dVa) + dAt_dQt * imag(dSt_dVa);

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