Created
March 21, 2013 19:03
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Now transfer values from the branch to the matrices A,B and E. | |
# Look where each branch appears and transfer the info. | |
for c1 in range(len(system_loops_copy)): | |
for c2 in range(len(system_loops_copy)): | |
for c3 in range(len(system_loops_copy[c1][c2])): | |
for c4 in range(len(branch_params)): | |
if system_loops_copy[c1][c2][c3][:-1]==branch_params[c4][:-1]: | |
if c1==c2: | |
sys_mat_a.data[c1][c2]+=branch_params[c4][-1][0][0] | |
sys_mat_e.data[c1][c2]+=branch_params[c4][-1][0][1] | |
if system_loops_copy[c1][c2][c3][-1]=="forward": | |
for c5 in range(len(source_list)): | |
sys_mat_b.data[c1][c5]+=branch_params[c4][-1][1][c5] | |
else: | |
for c5 in range(len(source_list)): | |
sys_mat_b.data[c1][c5]-=branch_params[c4][-1][1][c5] | |
else: | |
if system_loops_copy[c1][c2][c3][-1]=="forward": | |
sys_mat_a.data[c1][c2]+=branch_params[c4][-1][0][0] | |
sys_mat_e.data[c1][c2]+=branch_params[c4][-1][0][1] | |
else: | |
sys_mat_a.data[c1][c2]-=branch_params[c4][-1][0][0] | |
sys_mat_e.data[c1][c2]-=branch_params[c4][-1][0][1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment