Home > matpower7.1 > lib > d2Ibr_dV2.m

d2Ibr_dV2

PURPOSE ^

D2IBR_DV2 Computes 2nd derivatives of complex branch current w.r.t. voltage.

SYNOPSIS ^

function [H11, H12, H21, H22] = d2Ibr_dV2(Ybr, V, mu, vcart)

DESCRIPTION ^

D2IBR_DV2   Computes 2nd derivatives of complex branch current w.r.t. voltage.

   The derivatives can be take with respect to polar or cartesian coordinates
   of voltage, depending on the 4th argument.

   [HAA, HAV, HVA, HVV] = D2IBR_DV2(YBR, V, MU)
   [HAA, HAV, HVA, HVV] = D2IBR_DV2(YBR, V, MU, 0)

   Returns 4 matrices containing the partial derivatives w.r.t. voltage angle
   and magnitude of the product of a vector MU with the 1st partial
   derivatives of the complex branch currents.

   [HRR, HRI, HIR, HII] = D2IBR_DV2(YBR, V, MU, 1)

   Returns 4 matrices (all zeros) containing the partial derivatives w.r.t.
   real and imaginary part of complex voltage of the product of a vector MU
   with the 1st partial derivatives of the complex branch currents.

   Takes sparse branch admittance matrix YBR, voltage vector V and nl x 1
   vector of multipliers MU. Output matrices are sparse.

   Examples:
       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
       Ybr = Yf;
       [Haa, Hav, Hva, Hvv] = d2Ibr_dV2(Ybr, V, mu);

   Here the output matrices correspond to:
       Haa = d/dVa (dIbr_dVa.' * mu)
       Hav = d/dVm (dIbr_dVa.' * mu)
       Hva = d/dVa (dIbr_dVm.' * mu)
       Hvv = d/dVm (dIbr_dVm.' * mu)

       [Hrr, Hri, Hir, Hii] = d2Ibr_dV2(Ybr, V, mu, 1);

   Here the output matrices correspond to:
       Hrr = d/dVr (dIbr_dVr.' * mu)
       Hri = d/dVi (dIbr_dVr.' * mu)
       Hir = d/dVr (dIbr_dVi.' * mu)
       Hii = d/dVi (dIbr_dVi.' * mu)

   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
   [TN4]  B. Sereeter and R. D. Zimmerman, "AC Power Flows and their
          Derivatives using Complex Matrix Notation and Cartesian
          Coordinate Voltages," MATPOWER Technical Note 4, April 2018.
          [Online]. Available: https://matpower.org/docs/TN4-OPF-Derivatives-Cartesian.pdf
          doi: 10.5281/zenodo.3237909

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [H11, H12, H21, H22] = d2Ibr_dV2(Ybr, V, mu, vcart)
0002 %D2IBR_DV2   Computes 2nd derivatives of complex branch current w.r.t. voltage.
0003 %
0004 %   The derivatives can be take with respect to polar or cartesian coordinates
0005 %   of voltage, depending on the 4th argument.
0006 %
0007 %   [HAA, HAV, HVA, HVV] = D2IBR_DV2(YBR, V, MU)
0008 %   [HAA, HAV, HVA, HVV] = D2IBR_DV2(YBR, V, MU, 0)
0009 %
0010 %   Returns 4 matrices containing the partial derivatives w.r.t. voltage angle
0011 %   and magnitude of the product of a vector MU with the 1st partial
0012 %   derivatives of the complex branch currents.
0013 %
0014 %   [HRR, HRI, HIR, HII] = D2IBR_DV2(YBR, V, MU, 1)
0015 %
0016 %   Returns 4 matrices (all zeros) containing the partial derivatives w.r.t.
0017 %   real and imaginary part of complex voltage of the product of a vector MU
0018 %   with the 1st partial derivatives of the complex branch currents.
0019 %
0020 %   Takes sparse branch admittance matrix YBR, voltage vector V and nl x 1
0021 %   vector of multipliers MU. Output matrices are sparse.
0022 %
0023 %   Examples:
0024 %       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
0025 %       Ybr = Yf;
0026 %       [Haa, Hav, Hva, Hvv] = d2Ibr_dV2(Ybr, V, mu);
0027 %
0028 %   Here the output matrices correspond to:
0029 %       Haa = d/dVa (dIbr_dVa.' * mu)
0030 %       Hav = d/dVm (dIbr_dVa.' * mu)
0031 %       Hva = d/dVa (dIbr_dVm.' * mu)
0032 %       Hvv = d/dVm (dIbr_dVm.' * mu)
0033 %
0034 %       [Hrr, Hri, Hir, Hii] = d2Ibr_dV2(Ybr, V, mu, 1);
0035 %
0036 %   Here the output matrices correspond to:
0037 %       Hrr = d/dVr (dIbr_dVr.' * mu)
0038 %       Hri = d/dVi (dIbr_dVr.' * mu)
0039 %       Hir = d/dVr (dIbr_dVi.' * mu)
0040 %       Hii = d/dVi (dIbr_dVi.' * mu)
0041 %
0042 %   For more details on the derivations behind the derivative code used
0043 %   in MATPOWER information, see:
0044 %
0045 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0046 %          their Derivatives using Complex Matrix Notation", MATPOWER
0047 %          Technical Note 2, February 2010. [Online]. Available:
0048 %          https://matpower.org/docs/TN2-OPF-Derivatives.pdf
0049 %          doi: 10.5281/zenodo.3237866
0050 %   [TN4]  B. Sereeter and R. D. Zimmerman, "AC Power Flows and their
0051 %          Derivatives using Complex Matrix Notation and Cartesian
0052 %          Coordinate Voltages," MATPOWER Technical Note 4, April 2018.
0053 %          [Online]. Available: https://matpower.org/docs/TN4-OPF-Derivatives-Cartesian.pdf
0054 %          doi: 10.5281/zenodo.3237909
0055 
0056 %   MATPOWER
0057 %   Copyright (c) 2008-2019, Power Systems Engineering Research Center (PSERC)
0058 %   by Ray Zimmerman, PSERC Cornell
0059 %
0060 %   This file is part of MATPOWER.
0061 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0062 %   See https://matpower.org for more info.
0063 
0064 %% default input args
0065 if nargin < 4
0066     vcart = 0;      %% default to polar coordinates
0067 end
0068 
0069 %% define
0070 nb = length(V);
0071 
0072 if vcart
0073     H11 = sparse(nb, nb);
0074     H12 = H11;
0075     H21 = H11;
0076     H22 = H11;
0077 else
0078     diagInvVm = sparse(1:nb, 1:nb, ones(nb, 1)./abs(V), nb, nb);
0079 
0080     H11 = sparse(1:nb, 1:nb, -(Ybr.' * mu) .* V, nb, nb);
0081     H21 = -1j * H11 * diagInvVm;
0082     H12 = H21;
0083     H22 = sparse(nb, nb);
0084 end

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