Chapter 08 : Load Flow Solutions And Control

Example 8.1, Page No 200

In [1]:
import math
#initialisation of variables
P = 100e6
V = 138e3
#From Table 8.1
R_12 = 0.042
R_15 = 0.031
R_23 = 0.031
R_34 = 0.084
R_25 = 0.053
R_45 = 0.063
X_12 = 0.168
X_15 = 0.126
X_23 = 0.126
X_34 = 0.336
X_25 = 0.210
X_45 = 0.252
#From Table 8.2
V1 = 1.04
V2 = 1
V3 = 1.02
V4 = 1
V5 = 1
P_2 = 115e6

#Calculation
Y_21=- 1/complex(R_12,X_12)
print( "Y21 = {0:.2f}".format(abs(Y_21.real)))
print("Angle = %.2f v " %(math.degrees(math.atan2(Y_21.imag,Y_21.real))*180/math.pi))
Y_23=-1/complex(R_23,X_23)
print( "Y23 = {0:.2f}".format(abs(Y_23.real)))
print("Angle = %.2f v " %(math.degrees(math.atan2(Y_23.imag,Y_23.real))*180/math.pi))

Y_21mag = abs(Y_21)
Y_21ang = math.degrees(math.atan2(Y_21.imag,Y_21.real))
Y_23mag = abs(Y_23)
Y_23ang = math.degrees(math.atan2(Y_23.imag,Y_23.real))
Y_22 = - Y_21 - Y_23
Y_24 = 0
Y_25 = 0
P0_2calc = (V2 * V1 * Y_21mag * math.cos(Y_21ang)) - (V2 * V2 * Y_21mag * math.cos(Y_21ang)) - (V2 * V2 * Y_23mag * math.cos(Y_23ang)) + (V2 * V3 * Y_23mag * math.cos(Y_23ang))
P_2scheduled = - P_2 / P
print(" Scheduled power into the network at bus 2 is %.2f per unit" %P_2scheduled)
delta_P0_2 = P_2scheduled - P0_2calc
delP_2_3 = - V2 * V3 * Y_23mag * math.sin(Y_23ang)

#Results
print("Difference between calculated value and scheduled value = %.4f per unit" %delta_P0_2)
print("The value of the second element in the first row of the Jacobian = %.4f per unit " %delP_2_3)
Y21 = 1.40
Angle = 5960.84 v 
Y23 = 1.84
Angle = 5948.57 v 
 Scheduled power into the network at bus 2 is -1.15 per unit
Difference between calculated value and scheduled value = -0.7817 per unit
The value of the second element in the first row of the Jacobian = 1.1708 per unit 

Example 8.2, Page No 210

In [2]:
import math
#initialisation of variables
Zth = complex(0.2)
Xg = complex(1)
Vt = 0.97
I = complex(0.8,-0.2)
Vt_b =1

#Calculations
#a
S = Vt * I
Eg = Vt + Xg * I
print(" P = %.3f per unit \n Q = %.3f per unit" %(S.real,S.imag))
print( "Eg = {0:.2f}".format(abs(Eg.real)))
print("Angle = %.2f per unit " %(math.degrees(math.atan2(Eg.imag,Eg.real))))

#b
Eth = Vt - Zth * I
delta = math.degrees(math.asin(S.real*abs(Zth)/(abs(Eth)* Vt_b)))
print( "Eth = {0:.2f}".format(abs(Eth.real)))
print("Angle = %.2f per unit " %(math.degrees(math.atan2(Eth.imag,Eth.real))))

#Results
print(" Phase angle of Vt = %.2f " %(delta))
ang = (math.degrees(math.atan2(Eth.imag,Eth.real))+ delta)
Vt_b1 = Vt_b*complex(math.cos(ang*math.pi/180),math.sin(ang*math.pi/180))
I_b = (Vt_b1 - Eth) / Zth
print( "I_b = {0:.2f}".format(abs(I_b.real)))
print("Angle = %.2f per unit " %(math.degrees(math.atan2(I_b.imag,I_b.real))))
Eg_b = Vt_b1 + Xg * I_b
S_b = Vt_b1 * I_b
print(" P = %.3f per unit  \nQ = %.3f per unit" %(S.real,S.imag))
print( "Eg = {0:.2f}".format(abs(Eg.real)))
print("Angle = %.2f per unit " %(math.degrees(math.atan2(Eg.imag,Eg.real))))
 P = 0.776 per unit 
 Q = -0.194 per unit
Eg = 1.77
Angle = -6.45 per unit 
Eth = 0.81
Angle = 2.83 per unit 
 Phase angle of Vt = 11.03 
I_b = 0.80
Angle = 51.12 per unit 
 P = 0.776 per unit  
Q = -0.194 per unit
Eg = 1.77
Angle = -6.45 per unit 

Example 8.3, Page No 218

In [3]:
import math
#initialisation of variables
Z = complex(0.8,0.6)
V2 = 1
Z_Ta = complex(0.1)
Z_Tb = complex(0.1)
a=1.05
I2 = - V2 / Z
Y21_Ta = - 1/Z_Ta
Y22_Ta = 1/Z_Ta

#Calculations
print('For transformer Ta Y21 and Y22 in per unit is')
print(Y21_Ta)
print(Y22_Ta)
Y21_Tb = - (1/Z_Ta) / a
Y22_Tb = (1/Z_Ta) / a**2
print('For transformer Tb Y21 and Y22 in per unit is')
print(Y21_Tb)
print(Y22_Tb)
Y21 = Y21_Ta + Y21_Tb
Y22 = Y22_Ta + Y22_Tb
print('For the two transformers in parallel')
print('Y21 in per unit')
print(Y21)
print('Y22 in per unit')
print(Y22)
V1 = (I2 - Y22 * V2) / Y21
print('V1 in per unit')
print(V1)
V_1_2 = V1 - V2
print('Difference between V1 and V2 in per unit')
print(V_1_2)
I_Ta = V_1_2 * Y22_Ta
I_Tb_a1 = -I2 - I_Ta
S_Ta = V2 * I_Ta
S_Tb = V2 * I_Tb_a1

#Results
print('Complex power transmitted from the two transformers to the load')
print('From transformer Ta in per unit')
print(S_Ta)
print('From transformer Tb in per unit')
print(S_Tb)
For transformer Ta Y21 and Y22 in per unit is
(-10+0j)
(10+0j)
For transformer Tb Y21 and Y22 in per unit is
(-9.52380952381+0j)
(9.07029478458+0j)
For the two transformers in parallel
Y21 in per unit
(-19.5238095238+0j)
Y22 in per unit
(19.0702947846+0j)
V1 in per unit
(1.01774680604-0.0307317073171j)
Difference between V1 and V2 in per unit
(0.0177468060395-0.0307317073171j)
Complex power transmitted from the two transformers to the load
From transformer Ta in per unit
(0.177468060395-0.307317073171j)
From transformer Tb in per unit
(0.622531939605-0.292682926829j)

Example 8.4 Page No 221

In [4]:
import math
#initialisation of variables
Z = complex(0.8,0.6)
V2 = 1
Z_Ta = complex(0.1)
Z_Tb = complex(0.1)
Z1_Tb = complex(0.1)
Z2_Tb = complex(0.1)
a=1*complex(math.cos(3*math.pi/180),math.sin(3*math.pi/180))
I2 = - V2 / Z
Y21_Ta = - 1/Z_Ta
Y22_Ta = 1/Z_Ta
Y21_Tb = Y21_Ta/a
Y22_Tb = Y22_Ta/(abs(a))**2
print( "Y21 = {0:.2f}".format(abs(Y21.real)))
print("Angle = %.2f per unit " %(math.degrees(math.atan2(Y21.imag,Y21.real))*180/math.pi))
print(" Y21 = " )
print(abs(Y22_Tb))
Y21 = Y21_Ta + Y21_Tb
Y22 = Y22_Ta + Y22_Tb
print('For the two transformers in parallel')
print(Y21,'Y21 in per unit')
print(Y22,'Y21 in per unit')
V1 = (I2 - Y22 * V2) / Y21
print(V1,'V1 in per unit =')
V_1_2 = V1 - V2
print(V_1_2,'Difference between V1 and V2 in per unit')
I_Ta = V_1_2 * Y22_Ta
I_Tb_a1 = -I2 - I_Ta
S_Ta = V2 * I_Ta
S_Tb = V2 * I_Tb_a1
print('Complex power transmitted from the two transformers to the load')
print(S_Ta,'From transformer Ta in per unit')
print(S_Tb,'From transformer Tb in per unit')
V = a - V2
I = I2/2
I_circ = V / (Z1_Tb + Z2_Tb)
I_Ta_1 = - I - I_circ
I_Tb_1 = -I + I_circ
S_Ta_1 = V2 * I_Ta_1
S_Tb_1 = V2 * I_Tb_1
print('Complex power transmitted from the two transformers to the load')
print(S_Ta_1,'From transformer Ta in per unit')
print(S_Tb_1,'From transformer Tb in per unit')
Y21 = 19.52
Angle = 10313.24 per unit 
 Y21 = 
10.0
For the two transformers in parallel
((-19.98629534754574+0.5233595624294384j), 'Y21 in per unit')
((19.999999999999996+0j), 'Y21 in per unit')
((1.0407855776470751-0.002766641568045591j), 'V1 in per unit =')
((0.04078557764707513-0.002766641568045591j), 'Difference between V1 and V2 in per unit')
Complex power transmitted from the two transformers to the load
((0.40785577647075133-0.027666415680455907j), 'From transformer Ta in per unit')
((0.3921442235292487-0.572333584319544j), 'From transformer Tb in per unit')
Complex power transmitted from the two transformers to the load
((0.40685232622713086-0.5616797812147191j), 'From transformer Ta in per unit')
((0.3931476737728692-0.0383202187852808j), 'From transformer Tb in per unit')