Home > matpower4.1 > d2Sbr_dV2.m

d2Sbr_dV2

PURPOSE ^

D2SBR_DV2 Computes 2nd derivatives of complex power flow w.r.t. voltage.

SYNOPSIS ^

function [Haa, Hav, Hva, Hvv] = d2Sbr_dV2(Cbr, Ybr, V, lam)

DESCRIPTION ^

D2SBR_DV2   Computes 2nd derivatives of complex power flow w.r.t. voltage.
   [HAA, HAV, HVA, HVV] = D2SBR_DV2(CBR, YBR, V, LAM) returns 4 matrices
   containing the partial derivatives w.r.t. voltage angle and magnitude
   of the product of a vector LAM with the 1st partial derivatives of the
   complex branch power flows. Takes sparse connection matrix CBR, sparse
   branch admittance matrix YBR, voltage vector V and nl x 1 vector of
   multipliers LAM. 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);
       Cbr = Cf;
       Ybr = Yf;
       [Haa, Hav, Hva, Hvv] = d2Sbr_dV2(Cbr, Ybr, V, lam);

   Here the output matrices correspond to:
       Haa = (d/dVa (dSbr_dVa.')) * lam
       Hav = (d/dVm (dSbr_dVa.')) * lam
       Hva = (d/dVa (dSbr_dVm.')) * lam
       Hvv = (d/dVm (dSbr_dVm.')) * lam

   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 [Haa, Hav, Hva, Hvv] = d2Sbr_dV2(Cbr, Ybr, V, lam)
0002 %D2SBR_DV2   Computes 2nd derivatives of complex power flow w.r.t. voltage.
0003 %   [HAA, HAV, HVA, HVV] = D2SBR_DV2(CBR, YBR, V, LAM) returns 4 matrices
0004 %   containing the partial derivatives w.r.t. voltage angle and magnitude
0005 %   of the product of a vector LAM with the 1st partial derivatives of the
0006 %   complex branch power flows. Takes sparse connection matrix CBR, sparse
0007 %   branch admittance matrix YBR, voltage vector V and nl x 1 vector of
0008 %   multipliers LAM. Output matrices are sparse.
0009 %
0010 %   Example:
0011 %       f = branch(:, F_BUS);
0012 %       Cf =  sparse(1:nl, f, ones(nl, 1), nl, nb);
0013 %       [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
0014 %       Cbr = Cf;
0015 %       Ybr = Yf;
0016 %       [Haa, Hav, Hva, Hvv] = d2Sbr_dV2(Cbr, Ybr, V, lam);
0017 %
0018 %   Here the output matrices correspond to:
0019 %       Haa = (d/dVa (dSbr_dVa.')) * lam
0020 %       Hav = (d/dVm (dSbr_dVa.')) * lam
0021 %       Hva = (d/dVa (dSbr_dVm.')) * lam
0022 %       Hvv = (d/dVm (dSbr_dVm.')) * lam
0023 %
0024 %   For more details on the derivations behind the derivative code used
0025 %   in MATPOWER information, see:
0026 %
0027 %   [TN2]  R. D. Zimmerman, "AC Power Flows, Generalized OPF Costs and
0028 %          their Derivatives using Complex Matrix Notation", MATPOWER
0029 %          Technical Note 2, February 2010.
0030 %             http://www.pserc.cornell.edu/matpower/TN2-OPF-Derivatives.pdf
0031 
0032 %   MATPOWER
0033 %   $Id: d2Sbr_dV2.m,v 1.8 2010/11/16 16:05:47 cvs Exp $
0034 %   by Ray Zimmerman, PSERC Cornell
0035 %   Copyright (c) 2008-2010 by Power System Engineering Research Center (PSERC)
0036 %
0037 %   This file is part of MATPOWER.
0038 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0039 %
0040 %   MATPOWER is free software: you can redistribute it and/or modify
0041 %   it under the terms of the GNU General Public License as published
0042 %   by the Free Software Foundation, either version 3 of the License,
0043 %   or (at your option) any later version.
0044 %
0045 %   MATPOWER is distributed in the hope that it will be useful,
0046 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0047 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0048 %   GNU General Public License for more details.
0049 %
0050 %   You should have received a copy of the GNU General Public License
0051 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0052 %
0053 %   Additional permission under GNU GPL version 3 section 7
0054 %
0055 %   If you modify MATPOWER, or any covered work, to interface with
0056 %   other modules (such as MATLAB code and MEX-files) available in a
0057 %   MATLAB(R) or comparable environment containing parts covered
0058 %   under other licensing terms, the licensors of MATPOWER grant
0059 %   you additional permission to convey the resulting work.
0060 
0061 %% define
0062 nl = length(lam);
0063 nb = length(V);
0064 
0065 diaglam = sparse(1:nl, 1:nl, lam, nl, nl);
0066 diagV   = sparse(1:nb, 1:nb, V, nb, nb);
0067 
0068 A = Ybr' * diaglam * Cbr;
0069 B = conj(diagV) * A * diagV;
0070 D = sparse(1:nb, 1:nb, (A*V) .* conj(V), nb, nb);
0071 E = sparse(1:nb, 1:nb, (A.'*conj(V)) .* V, nb, nb);
0072 F = B + B.';
0073 G = sparse(1:nb, 1:nb, ones(nb, 1)./abs(V), nb, nb);
0074 
0075 Haa = F - D - E;
0076 Hva = 1j * G * (B - B.' - D + E);
0077 Hav = Hva.';
0078 Hvv = G * F * G;

Generated on Mon 26-Jan-2015 15:00:13 by m2html © 2005