Home > matpower7.0 > lib > d2Abr_dV2.m

d2Abr_dV2

PURPOSE ^

D2ABR_DV2 Computes 2nd derivatives of |branch flow|^2 w.r.t. V.

SYNOPSIS ^

function [H11, H12, H21, H22] = d2Abr_dV2(d2F_dV2, dF_dV1, dF_dV2, F, V, mu)

DESCRIPTION ^

D2ABR_DV2   Computes 2nd derivatives of |branch flow|^2 w.r.t. V.

   The derivatives can be take with respect to polar or cartesian coordinates
   of voltage, depending on the first 3 arguments. Flows could be complex
   current or complex or real power. Notation below is based on complex power.

   [H11, H12, H21, H22] = D2ABR_DV2(D2F_DV2, DF_DV1, DF_DV2, F, V, MU)

   Returns 4 matrices containing the partial derivatives w.r.t. voltage
   components (angle, magnitude or real, imaginary) of the product of a
   vector MU with the 1st partial derivatives of the square of the magnitude
   of branch flows.

   Takes as inputs a handle to a function that evaluates the 2nd derivatives
   of the flows (with args V and mu only), sparse first derivative matrices
   of flow, flow vector, voltage vector V and nl x 1 vector of multipliers
   MU. Output matrices are sparse.

   Example:
       f = branch(:, F_BUS);
       Cf =  sparse(1:nl, f, ones(nl, 1), nl, nb);
       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
       [dSf_dV1, dSf_dV2, dSt_dV1, dSt_dV2, Sf, St] = ...
               dSbr_dV(branch, Yf, Yt, V);
       dF_dV1 = dSf_dV1;
       dF_dV2 = dSf_dV2;
       F = Sf;
       d2F_dV2 = @(V, mu)d2Sbr_dV2(Cf, Yf, V, mu, 0);
       [H11, H12, H21, H22] = ...
             d2Abr_dV2(d2F_dV2, dF_dV1, dF_dV2, F, V, mu);

   Here the output matrices correspond to:
     H11 = d/dV1 (dAF_dV1.' * mu)
     H12 = d/dV2 (dAF_dV1.' * mu)
     H21 = d/dV1 (dAF_dV2.' * mu)
     H22 = d/dV2 (dAF_dV2.' * mu)

   See also DABR_DV, 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 [H11, H12, H21, H22] = d2Abr_dV2(d2F_dV2, dF_dV1, dF_dV2, F, V, mu)
0002 %D2ABR_DV2   Computes 2nd derivatives of |branch flow|^2 w.r.t. V.
0003 %
0004 %   The derivatives can be take with respect to polar or cartesian coordinates
0005 %   of voltage, depending on the first 3 arguments. Flows could be complex
0006 %   current or complex or real power. Notation below is based on complex power.
0007 %
0008 %   [H11, H12, H21, H22] = D2ABR_DV2(D2F_DV2, DF_DV1, DF_DV2, F, V, MU)
0009 %
0010 %   Returns 4 matrices containing the partial derivatives w.r.t. voltage
0011 %   components (angle, magnitude or real, imaginary) of the product of a
0012 %   vector MU with the 1st partial derivatives of the square of the magnitude
0013 %   of branch flows.
0014 %
0015 %   Takes as inputs a handle to a function that evaluates the 2nd derivatives
0016 %   of the flows (with args V and mu only), sparse first derivative matrices
0017 %   of flow, flow vector, voltage vector V and nl x 1 vector of multipliers
0018 %   MU. Output matrices are sparse.
0019 %
0020 %   Example:
0021 %       f = branch(:, F_BUS);
0022 %       Cf =  sparse(1:nl, f, ones(nl, 1), nl, nb);
0023 %       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
0024 %       [dSf_dV1, dSf_dV2, dSt_dV1, dSt_dV2, Sf, St] = ...
0025 %               dSbr_dV(branch, Yf, Yt, V);
0026 %       dF_dV1 = dSf_dV1;
0027 %       dF_dV2 = dSf_dV2;
0028 %       F = Sf;
0029 %       d2F_dV2 = @(V, mu)d2Sbr_dV2(Cf, Yf, V, mu, 0);
0030 %       [H11, H12, H21, H22] = ...
0031 %             d2Abr_dV2(d2F_dV2, dF_dV1, dF_dV2, F, V, mu);
0032 %
0033 %   Here the output matrices correspond to:
0034 %     H11 = d/dV1 (dAF_dV1.' * mu)
0035 %     H12 = d/dV2 (dAF_dV1.' * mu)
0036 %     H21 = d/dV1 (dAF_dV2.' * mu)
0037 %     H22 = d/dV2 (dAF_dV2.' * mu)
0038 %
0039 %   See also DABR_DV, DIBR_DV, DSBR_DV.
0040 %
0041 %   For more details on the derivations behind the derivative code used
0042 %   in MATPOWER information, see:
0043 %
0044 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0045 %          their Derivatives using Complex Matrix Notation", MATPOWER
0046 %          Technical Note 2, February 2010. [Online]. Available:
0047 %          https://matpower.org/docs/TN2-OPF-Derivatives.pdf
0048 %          doi: 10.5281/zenodo.3237866
0049 
0050 %   MATPOWER
0051 %   Copyright (c) 2008-2019, Power Systems Engineering Research Center (PSERC)
0052 %   by Ray Zimmerman, PSERC Cornell
0053 %
0054 %   This file is part of MATPOWER.
0055 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0056 %   See https://matpower.org for more info.
0057 
0058 %% define
0059 nl = length(mu);
0060 
0061 diagmu = sparse(1:nl, 1:nl, mu, nl, nl);
0062 
0063 [F11, F12, F21, F22] = d2F_dV2(V, conj(F) .* mu);
0064 H11 = 2 * real( F11 + dF_dV1.' * diagmu * conj(dF_dV1) );
0065 H21 = 2 * real( F21 + dF_dV2.' * diagmu * conj(dF_dV1) );
0066 H12 = 2 * real( F12 + dF_dV1.' * diagmu * conj(dF_dV2) );
0067 H22 = 2 * real( F22 + dF_dV2.' * diagmu * conj(dF_dV2) );

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005