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-2016, Power Systems Engineering Research Center (PSERC) 0015 % by Ray Zimmerman, PSERC Cornell 0016 % 0017 % This file is part of MATPOWER. 0018 % Covered by the 3-clause BSD License (see LICENSE file for details). 0019 % See https://matpower.org for more info. 0020 0021 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ... 0022 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ... 0023 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch; 0024 0025 [nl, nb] = size(PTDF); 0026 f = branch(:, F_BUS); 0027 t = branch(:, T_BUS); 0028 Cft = sparse([f; t], [1:nl 1:nl]', [ones(nl, 1); -ones(nl, 1)], nb, nl); 0029 0030 H = PTDF * Cft; 0031 h = diag(H, 0); 0032 LODF = H ./ (ones(nl, nl) - ones(nl, 1) * h'); 0033 LODF = LODF - diag(diag(LODF)) - eye(nl, nl);