Subroutine GenerateBCIRC is used to detect parallel lines and generate the circuit number of every branch. [BCIRC] = GenerateBCIRC(branch) INPUT DATA: branch: matrix, includes branch data in MATPOWER case format OUTPUT DATA: BCIRC: n*1 vector, includes branch circuit number NOTE: For one branch, if its circuit number is greater than 1 then it is parallel to one of the branch whose circuit number is 1.
0001 function [BCIRC] = GenerateBCIRC(branch) 0002 % Subroutine GenerateBCIRC is used to detect parallel lines and generate the circuit number of every 0003 % branch. 0004 % 0005 % [BCIRC] = GenerateBCIRC(branch) 0006 % 0007 % INPUT DATA: 0008 % branch: matrix, includes branch data in MATPOWER case format 0009 % 0010 % OUTPUT DATA: 0011 % BCIRC: n*1 vector, includes branch circuit number 0012 % 0013 % NOTE: For one branch, if its circuit number is greater than 1 then it is 0014 % parallel to one of the branch whose circuit number is 1. 0015 0016 % MATPOWER 0017 % Copyright (c) 2014-2016, Power Systems Engineering Research Center (PSERC) 0018 % by Yujia Zhu, PSERC ASU 0019 % 0020 % This file is part of MATPOWER/mx-reduction. 0021 % Covered by the 3-clause BSD License (see LICENSE file for details). 0022 % See https://github.com/MATPOWER/mx-reduction/ for more info. 0023 0024 [FTnum,m,n]=unique(branch(:,[1,2]),'rows','first'); 0025 n2 = unique(n); 0026 BCIRC = zeros(size(branch,1),1); 0027 for i = 1:length(n2) 0028 Ind = find(n==n2(i)); 0029 BCIRC(Ind)=[1:length(Ind)]'; 0030 end 0031 end