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-2015 by Power System Engineering Research Center (PSERC) 0018 % by Yujia Zhu, PSERC ASU 0019 % 0020 % $Id: GenerateBCIRC.m 2655 2015-03-18 16:40:32Z ray $ 0021 % 0022 % This file is part of MATPOWER. 0023 % Covered by the 3-clause BSD License (see LICENSE file for details). 0024 % See http://www.pserc.cornell.edu/matpower/ for more info. 0025 0026 [FTnum,m,n]=unique(branch(:,[1,2]),'rows','first'); 0027 n2 = unique(n); 0028 BCIRC = zeros(size(branch,1),1); 0029 for i = 1:length(n2) 0030 Ind = find(n==n2(i)); 0031 BCIRC(Ind)=[1:length(Ind)]'; 0032 end 0033 end