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 % $Id: makeLODF.m,v 1.6 2010/04/26 19:45:25 ray Exp $ 0015 % by Ray Zimmerman, PSERC Cornell 0016 % Copyright (c) 2008-2010 by Power System Engineering Research Center (PSERC) 0017 % 0018 % This file is part of MATPOWER. 0019 % See http://www.pserc.cornell.edu/matpower/ for more info. 0020 % 0021 % MATPOWER is free software: you can redistribute it and/or modify 0022 % it under the terms of the GNU General Public License as published 0023 % by the Free Software Foundation, either version 3 of the License, 0024 % or (at your option) any later version. 0025 % 0026 % MATPOWER is distributed in the hope that it will be useful, 0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0029 % GNU General Public License for more details. 0030 % 0031 % You should have received a copy of the GNU General Public License 0032 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0033 % 0034 % Additional permission under GNU GPL version 3 section 7 0035 % 0036 % If you modify MATPOWER, or any covered work, to interface with 0037 % other modules (such as MATLAB code and MEX-files) available in a 0038 % MATLAB(R) or comparable environment containing parts covered 0039 % under other licensing terms, the licensors of MATPOWER grant 0040 % you additional permission to convey the resulting work. 0041 0042 [F_BUS, T_BUS, BR_R, BR_X, BR_B, RATE_A, RATE_B, RATE_C, ... 0043 TAP, SHIFT, BR_STATUS, PF, QF, PT, QT, MU_SF, MU_ST, ... 0044 ANGMIN, ANGMAX, MU_ANGMIN, MU_ANGMAX] = idx_brch; 0045 0046 [nl, nb] = size(PTDF); 0047 f = branch(:, F_BUS); 0048 t = branch(:, T_BUS); 0049 Cft = sparse([f; t], [1:nl 1:nl]', [ones(nl, 1); -ones(nl, 1)], nb, nl); 0050 0051 H = PTDF * Cft; 0052 h = diag(H, 0); 0053 LODF = H ./ (ones(nl, nl) - ones(nl, 1) * h'); 0054 LODF = LODF - diag(diag(LODF)) - eye(nl, nl);