MAKELODF Builds the line outage distribution factor matrix. LODF = MAKELODF(BRANCH, PTDF) returns the DC line outage distribution factor matrix for a given PTDF. The matrix is nbr x nbr, where nbr is the number of branches. Example: H = makePTDF(baseMVA, bus, branch); LODF = makeLODF(branch, H); See also MAKEPTDF.
0001 function LODF = makeLODF(branch, PTDF); 0002 %MAKELODF Builds the line outage distribution factor matrix. 0003 % LODF = MAKELODF(BRANCH, PTDF) returns the DC line outage 0004 % distribution factor matrix for a given PTDF. The matrix is nbr x nbr, 0005 % where nbr is the number of branches. 0006 % 0007 % Example: 0008 % H = makePTDF(baseMVA, bus, branch); 0009 % LODF = makeLODF(branch, H); 0010 % 0011 % See also MAKEPTDF. 0012 0013 % MATPOWER 0014 % Copyright (c) 2008-2015 by Power System Engineering Research Center (PSERC) 0015 % by Ray Zimmerman, PSERC Cornell 0016 % 0017 % $Id: makeLODF.m 2644 2015-03-11 19:34:22Z ray $ 0018 % 0019 % This file is part of MATPOWER. 0020 % Covered by the 3-clause BSD License (see LICENSE file for details). 0021 % See http://www.pserc.cornell.edu/matpower/ for more info. 0022 0023 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ... 0024 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ... 0025 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch; 0026 0027 [nl, nb] = size(PTDF); 0028 f = branch(:, F_BUS); 0029 t = branch(:, T_BUS); 0030 Cft = sparse([f; t], [1:nl 1:nl]', [ones(nl, 1); -ones(nl, 1)], nb, nl); 0031 0032 H = PTDF * Cft; 0033 h = diag(H, 0); 0034 LODF = H ./ (ones(nl, nl) - ones(nl, 1) * h'); 0035 LODF = LODF - diag(diag(LODF)) - eye(nl, nl);