# Chapter 18 : Load Flows¶

## Example 18.1, Page No 605¶

In [1]:
import math
import numpy
#initialisation of variables
Y=[[complex(3,-12),complex(-2,8),complex(-1,4),0],
[complex(-2,8), complex(3.666,-14.664), complex(-0.666,2.6664),complex(-1,4)],
[complex(-1,4), complex(-0.666,2.6664), complex(3.666,-14.664), complex(-2,8)],
[0,complex(-1,4), complex(-2,8),complex(3,-12)]]
P2=-.5
P3=-.4
P4=-.3
Q4=-.1
Q3=-.3
Q2=-.2
V2=1.0
V3=1.0
V4=1.0
V10=1.06
V30=1.0
V40=1

#Calculations
V21=(((complex(P2,-Q2))/V2)-Y[2][1]*V10-Y[1][2]*V30-Y[1][3]*V40)/(Y[1][1])
V21acc=1+1.6*(V21-1)
print("V21acc= {0:.5f}{1:.5f}i".format(V21acc.real, V21acc.imag))
V31=((complex(P3,-Q3)/V3)-Y[2][0]*V10-Y[2][1]*V21acc-Y[2][3]*V40)/(Y[2][2])
V31acc=1+1.6*(V31-1)
print("V31acc= {0:.5f}{1:.5f}i".format(V31acc.real, V31acc.imag))
V41=((complex(P4,-Q4)/V4)-Y[3][1]*V21acc-Y[3][2]*V31acc)/(Y[3][3])
V41acc=1+1.6*(V41-1)

#Results
print("V41acc= {0:.5f}{1:.5f}i".format(V41acc.real, V41acc.imag))

V21acc= 0.40236-0.04634i
V31acc= 0.81149-0.04688i
V41acc= 0.45822-0.10923i


## Example 18.2, Page No 606¶

In [2]:
import math
#initialisation of variables

Y=[[complex(3,-12),complex(-2,8),complex(-1,4),0],[complex(-2,8),complex(3.666,14.664),complex(-0.666,2.6664),complex(-1,4)],[complex(-1,4), complex(-.666,2.6664),complex(3.666,-14.664),complex(-2,8)],[0,complex(-1,4),complex(-2,8), complex(3,-12)]]
P2=.5
P3=-.4
P4=-.3
Q4=-.1
Q3=-.3
V3=1
V4=1
V1=1.06
V2=1.04
V30=1
V40=1

#Calculations
Q2=-((V2*(Y[1][0]*V1+Y[1][1]*V2+Y[1][2]*V3+Y[1][3]*V4))).imag
V21=((complex(P2,-Q2)/V2)-Y[1][0]*V1-Y[1][2]*V30-Y[1][3]*V40)/(Y[1][1])
d=math.degrees(math.atan(0.0291473/1.0472868))

#Results
print("The value of V21 is= {0:.5f}+{1:.5f}i".format(V21.real, V21.imag))
V31=((complex(P3,-Q3)/V3)-Y[2][0]*V1-Y[2][1]*V21-Y[2][3]*V40)/(Y[2][2])
print("The value of V31 is= {0:.5f}+{1:.5f}i".format(V31.real, V31.imag))
V41=((complex(P4,-Q4)/V4)-Y[3][1]*V21-Y[3][2]*V31)/Y[3][3]
print("The value of V41 is= {0:.5f}+{1:.5f}i".format(V41.real, V41.imag))

The value of V21 is= 1.03960+0.02893i
The value of V31 is= 0.99805+-0.01564i
The value of V41 is= 0.99817+-0.02235i


## Example 18.3, Page No 607¶

In [3]:
import math
#initialisation of variables

Y=[[complex(3,-12),complex(-2,8),complex(-1,4),0],[complex(-2,8),complex(3.666,14.664),complex(-0.666,2.6664),complex(-1,4)],[complex(-1,4), complex(-.666,2.6664),complex(3.666,-14.664),complex(-2,8)],[0,complex(-1,4),complex(-2,8), complex(3,-12)]]
P2=.5
P3=-.4
P4=-.3
Q4=-.1
Q3=-.3
V3=1
V4=1
V1=1.06
V2=1
V30=1
V40=1
Q2=.2
V3=1

#Calculations
V21=((complex(P2,-Q2)/V2)-Y[1][0]*V1-Y[1][2]*V30-Y[1][3]*V40)/(Y[1][1])
V31=((complex(P3,-Q3)/V3)-Y[2][0]*V1-Y[2][1]*V21-Y[2][3]*V40)/(Y[2][2])
V41=((complex(P4,-Q4)/V4)-Y[3][1]*V21-Y[3][2]*V31)/Y[3][3]

#Results
print("The value of V21 is= {0:.5f}+{1:.5f}i".format(V21.real, V21.imag))
print("The value of V31 is= {0:.5f}+{1:.5f}i".format(V31.real, V31.imag))
print("The value of V41 is= {0:.5f}+{1:.5f}i".format(V41.real, V41.imag))

The value of V21 is= -0.91620+-0.52133i
The value of V31 is= 0.64242+-0.11561i
The value of V41 is= 0.10915+-0.27242i


## Example 18.4 Page No 615¶

In [4]:
import math
#initialisation of variables
V1=1.06
G11=6.25
G12=-1.25
G21=G12
G13=-5
G31=G13
G22=2.916
G23=-1.666
G32=G23
G33=6.666
B11=18.75
B12=-3.75
B21=B12
B13=-15
B31=B13
B22=8.75
B23=-5
B32=B23
B33=20
e1=1.06
e2=1
e3=1
f1=0
f2=0
f3=0

#Calculations
P2=e2*(e1*G21+f1*B21) +f2*(f1*G21-e1*B21) +e2*(e2*G22+f2*B22)+f2*(f2*G22-e2*B22)+e2*(e3*G23+f3*B23)+f2*(f3*G23-e3*B23)
P3=-.3
Q2=-.225
Q3=-.9
dP2=.2-(-.225)
dP3=-.6-(-.3)
dQ2=0-(-.225)
dQ3=-.25-(-.9)
a1=2*e2*G22+e1*G21+f1*B21+e3*G23+f3*B23#a1=dP2/de2
a2=2*e3*G33+e1*G31+f1*B31+e3*G32+f2*B32#a2=dP3/de3
b1=2*f2*G22 +f1*G21-e1*B21+f3*G23-e3*B23#b1=dP2/df2
b2=20.9#dP3/df3
a3=e2*G23-f2*B23#dP2/de3
a4=-1.666		#dP3/de2
b3=-5			#dP2/df3
b4=-5			#dP3/df2
c1=2*e2*B22-f1*G21+e1*B21-f3*G23+e3*B23#dQ2/de2
c2=19.1			#dQ3/de3
c3=-2.991		#dQ2/df2
c4=-6.966		#dQ3/df3

#Results
print("set of linear equations at the end of first iteration are")
print("%.3fde2 %.3fde3+ %.3fdf2 %.3fdf3 = %.3f" %(2.846,-1.666,8.975,-5,2.75))
print("%.3fde2 +%.3fde3 %.3fdf2 +%.3fdf3 = %.3f" %(-1.666,6.366,-5,20.90,-.3))
print("%.3fde2  %.3fde3 %.3fdf2 +%.3fdf3 = %.3f" %(8.525,-5,-2.991,1.666,.225))
print("%.3fde2 +%.3fde3+ %.3fdf2 %.3fdf3 = %.3f" %(-5,19.1,1.666,-6.966,.65))

set of linear equations at the end of first iteration are
2.846de2 -1.666de3+ 8.975df2 -5.000df3 = 2.750
-1.666de2 +6.366de3 -5.000df2 +20.900df3 = -0.300
8.525de2  -5.000de3 -2.991df2 +1.666df3 = 0.225
-5.000de2 +19.100de3+ 1.666df2 -6.966df3 = 0.650


## Example 18.5, Page No 617¶

In [5]:
import math
#initialisation of variables
Q2=-0.225
dP2=0.2-(-.075)
dP3=-0.6-(-0.3)
dQ3=-0.25-(-0.9)

#Calculations
dV2=1.04**2 - 1**2   #dV2=|dV2|^2

#Results
print("set of linear equations at the end of first iteration are")
print("%.3fde2 %.3fde3+ %.3fdf2 %.3fdf3 = %.3f" %(2.846,-1.666,8.975,-5,2.75))
print("%.3fde2 +%.3fde3 %.3fdf2 +%.3fdf3 = %.3f" %(-1.666,6.366,-5,20.90,-.3))
print("%.3fde2  %.3fde3 %.3fdf2 +%.3fdf3 = %.3f" %(8.525,-5,-2.991,1.666,.225))
print("%.3fde2 +%.3fde3+ %.3fdf2 +%.3fdf3 = %.5f" %(2,0,0,0,dV2))

set of linear equations at the end of first iteration are
2.846de2 -1.666de3+ 8.975df2 -5.000df3 = 2.750
-1.666de2 +6.366de3 -5.000df2 +20.900df3 = -0.300
8.525de2  -5.000de3 -2.991df2 +1.666df3 = 0.225
2.000de2 +0.000de3+ 0.000df2 +0.000df3 = 0.08160