This blog is about Python Power Electronics - a free and open source software for power electronics and power systems professionals. Aimed at providing education about power electronics application specifically to renewable energy and smart grids, the software will be accompanied by simulation examples, short reports and presentations. The software can found on the website http://www.pythonpowerelectronics.com/.

Monday, January 7, 2013

Loop identification

Moving on from branch identification (for the time being at least), I now take on the task of identifying the loops. Which actually is a little tricky.

Anyway, pasting what all the branches that have been identified look like as an matrix on a spreadsheet:

Its a pretty huge spreadsheet, so can only capture a small part of it as a snapshot. But this is just the matrix "branch_map" computed in the previous blog pasted into cells of a spreadsheet.

For any circuit, the number of independent loops is equal to (B-N+1) where B is the number of branches, N is the number of nodes. The length of "node_list" will give us N and the number of elements (non-null) in the upper triangular part of branch_matrix will give us B. This can be found by this simple block of code:
---------------------------------------------------------------------------------------------------------number_of_branches=0

1. Take the branch_map matrix and start from the first element in the upper triangular part.
2. The way nodes have been determined, this will be the uppermost row in the connected circuit of the input csv file. Nodes will then be in later columns of the same row and then in later rows. So esentially moving left to right and then down and then again left to right.
3. So by moving to the right from the first element (say element [0, 1] which is [0 5] ;[0 6] ;[0 7] ;[0 8]), we encounter element [0,2] which is [0 5] ;[0 4] ;[0 3] ;[0 2] ;[0 1] ;[1 1] ;[2 1].
4. Element [0,1] contains the branch which connects node [0, 5] to [0, 8]. Element [0,2] contains the branch which connects node [0, 5] to [2,1].
5. Since, we are on row 0 of branch_map, the common element in node 0 which is [0,5].
6. So, if we traverse element [0, 1] in the reverse direction and element [0, 2] in the forwarsd direction, we are moving from right to left and then down.
7. Now, in an attempt to complete the loop, we move down from element [0, 2]. The first non-empty element encountered is [1,2].
8. This is [0 8] ;[1 8] ;[2 8] ;[2 2] ;[2 1].
9. This connects node [2, 1] to [0, 8] through the the "jump1" jump label. And this essentially completes a loop because [0,8] was where we started.