Python Code For (Load Flow Analysis)
Bus Admittance Matrix or Y_Bus
import scipy
from numpy import array
import math
#-------------------------------------#
#LOAD FLOW ANALYSIS#
#-------------------------------------#
Z_Line1 = complex(12.5,56) #series impedeance L1 (ohm)
Z_SLine1 = complex(0,-5241) #shunt impedance L1 (ohm)
Z_Line2 = complex(8.12,43) #series impedance L2 (ohm)
Z_SLine2 = complex(0,-4356) #shunt impedance L2 (ohm)
Z_Line3 = complex(5,34) #series impedance L3 (ohm)
Z_SLine3 = complex(0,-6754) #shunt impedance L3 (ohm)
Y_Se12 = 1.0/Z_Line1
Y_Sh12 = 1.0/Z_SLine1
Y_Se23 = 1.0/Z_Line3
Y_Sh23 = 1.0/Z_SLine3
Y_Se13 = 1.0/Z_Line2
Y_Sh13 = 1.0/Z_SLine2
Y_11 = Y_Sh12+Y_Sh13+Y_Se12+Y_Se13
Y_12 = -Y_Se12
Y_13 = -Y_Se13
Y_21 = Y_12
Y_22 = Y_Sh12+Y_Sh23+Y_Se12+Y_Se23
Y_23 = -Y_Se23
Y_31 = Y_13
Y_32 = Y_23
Y_33 = Y_Sh13+Y_Sh23+Y_Se23+Y_Se13
Y_bus = [[Y_11,Y_12,Y_13],
[Y_21,Y_22,Y_23],
[Y_31,Y_32,Y_33]]
print('[Y_bus] = \n')
print(array(Y_bus))
Output:-
>>>
================ RESTART: D:/Desktop/Python(TUT)/loadflow.py ================
[Y_bus] =
[[ 0.00803715-0.03904435j -0.0037968 +0.01700964j -0.00424035+0.02245508j]
[-0.0037968 +0.01700964j 0.0080305 -0.04545994j -0.0042337 +0.02878916j]
[-0.00424035+0.02245508j -0.0042337 +0.02878916j 0.00847405-0.05086661j]]
>>>