Home > matpower7.1 > lib > dAbr_dV.m

dAbr_dV

PURPOSE ^

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

SYNOPSIS ^

function [dAf_dV1, dAf_dV2, dAt_dV1, dAt_dV2] =dAbr_dV(dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft)

DESCRIPTION ^

DABR_DV   Partial derivatives of squared flow magnitudes w.r.t voltage.
   [DAF_DV1, DAF_DV2, DAT_DV1, DAT_DV2] = ...
               DABR_DV(DFF_DV1, DFF_DV2, DFT_DV1, DFT_DV2, 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 components (either angle and magnitude, respectively, if polar,
   or real and imaginary, respectively, if cartesian) 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 V1 & V2 (e.g. Va and Vm, or Vr and Vi)
       dAf/dV1 = dAf/dPf * dPf/dV1 + dAf/dQf * dQf/dV1
       dAf/dV2 = dAf/dPf * dPf/dV2 + dAf/dQf * dQf/dV2

   Derivations for "to" bus are similar.

   Examples:
       %% squared current magnitude
       [dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft] = ...
               dIbr_dV(branch(il,:), Yf, Yt, V);
       [dAf_dV1, dAf_dV2, dAt_dV1, dAt_dV2] = ...
               dAbr_dV(dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft);

       %% squared apparent power flow
       [dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft] = ...
               dSbr_dV(branch(il,:), Yf, Yt, V);
       [dAf_dV1, dAf_dV2, dAt_dV1, dAt_dV2] = ...
               dAbr_dV(dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft);

       %% squared real power flow
       [dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft] = ...
               dSbr_dV(branch(il,:), Yf, Yt, V);
       dFf_dV1 = real(dFf_dV1);
       dFf_dV2 = real(dFf_dV2);
       dFt_dV1 = real(dFt_dV1);
       dFt_dV2 = real(dFt_dV2);
       [dAf_dV1, dAf_dV2, dAt_dV1, dAt_dV2] = ...
               dAbr_dV(dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, 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. [Online]. Available:
          https://matpower.org/docs/TN2-OPF-Derivatives.pdf
          doi: 10.5281/zenodo.3237866

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [dAf_dV1, dAf_dV2, dAt_dV1, dAt_dV2] = ...
0002                         dAbr_dV(dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft)
0003 %DABR_DV   Partial derivatives of squared flow magnitudes w.r.t voltage.
0004 %   [DAF_DV1, DAF_DV2, DAT_DV1, DAT_DV2] = ...
0005 %               DABR_DV(DFF_DV1, DFF_DV2, DFT_DV1, DFT_DV2, 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 components (either angle and magnitude, respectively, if polar,
0009 %   or real and imaginary, respectively, if cartesian) for all buses, given
0010 %   the flows and flow sensitivities. Flows could be complex current or
0011 %   complex or real power. Notation below is based on complex power. The
0012 %   following explains the expressions used to form the matrices:
0013 %
0014 %   Let Af refer to the square of the apparent power at the "from" end of
0015 %   each branch,
0016 %
0017 %       Af = abs(Sf).^2
0018 %          = Sf .* conj(Sf)
0019 %          = Pf.^2 + Qf.^2
0020 %
0021 %   then ...
0022 %
0023 %   Partial w.r.t real power,
0024 %       dAf/dPf = 2 * diag(Pf)
0025 %
0026 %   Partial w.r.t reactive power,
0027 %       dAf/dQf = 2 * diag(Qf)
0028 %
0029 %   Partial w.r.t V1 & V2 (e.g. Va and Vm, or Vr and Vi)
0030 %       dAf/dV1 = dAf/dPf * dPf/dV1 + dAf/dQf * dQf/dV1
0031 %       dAf/dV2 = dAf/dPf * dPf/dV2 + dAf/dQf * dQf/dV2
0032 %
0033 %   Derivations for "to" bus are similar.
0034 %
0035 %   Examples:
0036 %       %% squared current magnitude
0037 %       [dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft] = ...
0038 %               dIbr_dV(branch(il,:), Yf, Yt, V);
0039 %       [dAf_dV1, dAf_dV2, dAt_dV1, dAt_dV2] = ...
0040 %               dAbr_dV(dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft);
0041 %
0042 %       %% squared apparent power flow
0043 %       [dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft] = ...
0044 %               dSbr_dV(branch(il,:), Yf, Yt, V);
0045 %       [dAf_dV1, dAf_dV2, dAt_dV1, dAt_dV2] = ...
0046 %               dAbr_dV(dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft);
0047 %
0048 %       %% squared real power flow
0049 %       [dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft] = ...
0050 %               dSbr_dV(branch(il,:), Yf, Yt, V);
0051 %       dFf_dV1 = real(dFf_dV1);
0052 %       dFf_dV2 = real(dFf_dV2);
0053 %       dFt_dV1 = real(dFt_dV1);
0054 %       dFt_dV2 = real(dFt_dV2);
0055 %       [dAf_dV1, dAf_dV2, dAt_dV1, dAt_dV2] = ...
0056 %               dAbr_dV(dFf_dV1, dFf_dV2, dFt_dV1, dFt_dV2, Ff, Ft);
0057 %
0058 %   See also DIBR_DV, DSBR_DV.
0059 %
0060 %   For more details on the derivations behind the derivative code used
0061 %   in MATPOWER information, see:
0062 %
0063 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0064 %          their Derivatives using Complex Matrix Notation", MATPOWER
0065 %          Technical Note 2, February 2010. [Online]. Available:
0066 %          https://matpower.org/docs/TN2-OPF-Derivatives.pdf
0067 %          doi: 10.5281/zenodo.3237866
0068 
0069 %   MATPOWER
0070 %   Copyright (c) 1996-2019, Power Systems Engineering Research Center (PSERC)
0071 %   by Ray Zimmerman, PSERC Cornell
0072 %
0073 %   This file is part of MATPOWER.
0074 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0075 %   See https://matpower.org for more info.
0076 
0077 %% dimensions
0078 nl = length(Ff);
0079 
0080 %%----- partials w.r.t. real and imaginary flows -----
0081 dAf_dFfr = sparse(1:nl, 1:nl, 2 * real(Ff), nl, nl);
0082 dAf_dFfi = sparse(1:nl, 1:nl, 2 * imag(Ff), nl, nl);
0083 dAt_dFtr = sparse(1:nl, 1:nl, 2 * real(Ft), nl, nl);
0084 dAt_dFti = sparse(1:nl, 1:nl, 2 * imag(Ft), nl, nl);
0085 
0086 %% partials w.r.t. voltage components (angle, magnitude or real, imaginary)
0087 dAf_dV1 = dAf_dFfr * real(dFf_dV1) + dAf_dFfi * imag(dFf_dV1);
0088 dAf_dV2 = dAf_dFfr * real(dFf_dV2) + dAf_dFfi * imag(dFf_dV2);
0089 dAt_dV1 = dAt_dFtr * real(dFt_dV1) + dAt_dFti * imag(dFt_dV1);
0090 dAt_dV2 = dAt_dFtr * real(dFt_dV2) + dAt_dFti * imag(dFt_dV2);

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005