Thursday, January 3, 2013

Branch identification - II

A mistake in the previous code. If there are parallel branches between two nodes, there will be a problem. Take a look at the circuit again.


Between Elements 9E ([8,4]) and 8I ([7,8]) there are two parallel branches. The first one goes: 9E-9F-9G-8G-8H-8I. The second one goes: 9E-10E-11E-11F-11G-11H-11I-10I-9I-8I.

But the code that updates the branch matrix is:
----------------------------------------------------------------------------
branch_map[c1][node_list.index([next_node_row, next_node_column])] = branch_iter
----------------------------------------------------------------------------

This will overwrite the second branch when that is detected. So the statement needs to be changed as:
------------------------------------------------------------------------------
branch_map[c1][node_list.index([next_node_row, next_node_column])].append(branch_iter)
------------------------------------------------------------------------------

This adds the new branch to the existing branch found between the nodes. Again an array (list of lists) where an element is a list of lists of lists!

No comments:

Post a Comment