CHAPTER 9: LOAD FLOW STUDIES

Example 9.1, Page number 307-308

In [1]:
Y_s12 = complex(2.96,-20.16)     #Line admittance b/w buses 1 & 2(*10^-3 mho)
Y_p12 = complex(0,0.152)         #Line admittance b/w buses 1 & 2(*10^-3 mho)
Y_s15 = complex(2.72,-18.32)     #Line admittance b/w buses 1 & 5(*10^-3 mho)
Y_p15 = complex(0,0.185)         #Line admittance b/w buses 1 & 5(*10^-3 mho)
Y_s23 = complex(3.0,-22.8)       #Line admittance b/w buses 2 & 3(*10^-3 mho)
Y_p23 = complex(0,0.110)         #Line admittance b/w buses 2 & 3(*10^-3 mho)
Y_s25 = complex(1.48,-10.30)     #Line admittance b/w buses 2 & 5(*10^-3 mho)
Y_p25 = complex(0,0.312)         #Line admittance b/w buses 2 & 5(*10^-3 mho)
Y_s34 = complex(2.96,-20.16)     #Line admittance b/w buses 3 & 4(*10^-3 mho)
Y_p34 = complex(0,0.152)         #Line admittance b/w buses 3 & 4(*10^-3 mho)
Y_s45 = complex(3.0,-22.8)       #Line admittance b/w buses 4 & 5(*10^-3 mho)
Y_p45 = complex(0,0.110)         #Line admittance b/w buses 4 & 5(*10^-3 mho)

import scipy
from numpy import *

Y_s13 = complex(0,0)             #Line admittance b/w buses 1 & 3(*10^-3 mho)
Y_p13 = complex(0,0)             #Line admittance b/w buses 1 & 3(*10^-3 mho)
Y_s14 = complex(0,0)             #Line admittance b/w buses 1 & 4(*10^-3 mho)
Y_p14 = complex(0,0)             #Line admittance b/w buses 1 & 4(*10^-3 mho)
Y_11 = (Y_s12+Y_s13+Y_s14+Y_s15)+(Y_p12+Y_p13+Y_p14+Y_p15)
Y_12 = -Y_s12
Y_13 = -Y_s13
Y_14 = -Y_s14
Y_15 = -Y_s15

Y_s21 = Y_s12
Y_p21 = Y_p12
Y_s24 = complex(0,0)             #Line admittance b/w buses 2 & 4(*10^-3 mho)
Y_p24 = complex(0,0)             #Line admittance b/w buses 2 & 4(*10^-3 mho)
Y_21 = Y_12
Y_22 = (Y_s21+Y_s23+Y_s24+Y_s25)+(Y_p21+Y_p23+Y_p24+Y_p25)
Y_23 = -Y_s23
Y_24 = -Y_s24
Y_25 = -Y_s25

Y_s31 = Y_s13
Y_p31 = Y_p13
Y_s32 = Y_s23
Y_p32 = Y_p23
Y_s35 = complex(0,0)             #Line admittance b/w buses 2 & 4(*10^-3 mho)
Y_p35 = complex(0,0)             #Line admittance b/w buses 2 & 4(*10^-3 mho)
Y_33 = (Y_s31+Y_s32+Y_s34+Y_s35)+(Y_p31+Y_p32+Y_p34+Y_p35)
Y_34 = -Y_s34
Y_35 = -Y_s35
Y_31 = Y_13
Y_32 = Y_23
Y_33 = (Y_s31+Y_s32+Y_s34+Y_s35)+(Y_p31+Y_p32+Y_p34+Y_p35)
Y_34 = -Y_s34
Y_35 = -Y_s35

Y_s41 = Y_s14
Y_p41 = Y_p14
Y_s42 = Y_s24
Y_p42 = Y_p24
Y_s43 = Y_s34
Y_p43 = Y_p34
Y_41 = Y_14
Y_42 = Y_24
Y_43 = Y_34
Y_44 = (Y_s41+Y_s42+Y_s43+Y_s45)+(Y_p41+Y_p42+Y_p43+Y_p45)
Y_45 = -Y_s45

Y_s51 = Y_s15
Y_p51 = Y_p15
Y_s52 = Y_s25
Y_p52 = Y_p25
Y_s53 = Y_s35
Y_p53 = Y_p35
Y_s54 = Y_s45
Y_p54 = Y_p45
Y_51 = Y_15
Y_52 = Y_25
Y_53 = Y_35
Y_54 = Y_45
Y_55 = (Y_s51+Y_s52+Y_s53+Y_s54)+(Y_p51+Y_p52+Y_p53+Y_p54)

Y_bus = [[Y_11, Y_12, Y_13, Y_14, Y_15],
         [Y_21, Y_22, Y_23, Y_24, Y_25],
         [Y_31, Y_32, Y_33, Y_34, Y_35],
         [Y_41, Y_42, Y_43, Y_44, Y_45],
         [Y_51, Y_52, Y_53, Y_54, Y_55]]

print('The Y bus matrix for the five-bus system is :\n')
print(array(Y_bus))
The Y bus matrix for the five-bus system is :

[[ 5.68-38.143j -2.96+20.16j  -0.00 -0.j    -0.00 -0.j    -2.72+18.32j ]
 [-2.96+20.16j   7.44-52.686j -3.00+22.8j   -0.00 -0.j    -1.48+10.3j  ]
 [-0.00 -0.j    -3.00+22.8j    5.96-42.698j -2.96+20.16j  -0.00 -0.j   ]
 [-0.00 -0.j    -0.00 -0.j    -2.96+20.16j   5.96-42.698j -3.00+22.8j  ]
 [-2.72+18.32j  -1.48+10.3j   -0.00 -0.j    -3.00+22.8j    7.20-50.813j]]

Example 9.2, Page number 313-314

In [1]:
V_1 = complex(1.04,0)           #Voltage at bus 1(p.u)
S_D1 = complex(0.55,0.15)       #Power at bus 1(p.u)
S_D2 = complex(1.0,0.3)         #Power at bus 2(p.u)
Y_11 = complex(0.988,-9.734)    #Admittance at bus 1(p.u)
Y_22 = Y_11                     #Admittance at bus 2(p.u)
Y_12 = complex(-0.988,9.9)      #Admittance b/w bus 1 & 2(p.u)
Y_21 = Y_12                     #Admittance b/w bus 2 & 1(p.u)

import math
import cmath
V_2_0 = complex(1,0)                                            #Initial value of V_2 
S_2 = complex(-1,0.3)                                           #P_2+j*Q_2
V_2_1 =  (1/Y_22)*((S_2/V_2_0.conjugate())-Y_21*V_1)
V_2_2 =  (1/Y_22)*((S_2/V_2_1.conjugate())-Y_21*V_1)
V_2_3 =  (1/Y_22)*((S_2/V_2_2.conjugate())-Y_21*V_1)
V_2_4 =  (1/Y_22)*((S_2/V_2_3.conjugate())-Y_21*V_1)
V_2_5 =  (1/Y_22)*((S_2/V_2_4.conjugate())-Y_21*V_1)
V_2 = V_2_5                                                     #Voltage 2(p.u)
S_1_con = V_1.conjugate()*Y_11*V_1 + V_1.conjugate()*Y_12*V_2   #Conjugate of slack bus net power
S_1 = S_1_con.conjugate()
S_G1 = S_1 + S_D1                                               #Generated power at bus 1(p.u)
P_L = S_G1.real - (S_D1.real + S_D2.real)                       #Real power loss(p.u)
Q_L = S_G1.imag - (S_D1.imag + S_D2.imag)                       #Reactive power loss(p.u)

print('Voltage at bus 2 , V_2 = %.4f∠%.2f° p.u' %(abs(V_2),(cmath.phase(V_2)*180/math.pi)))
print('Generated power at bus 1 , S_G1 = (%.2f + j%.3f) p.u' %(S_G1.real,S_G1.imag))
print('Real power loss in the system = %.2f p.u' %P_L)
print('Reactive power loss in the system = %.3f p.u' %Q_L)
Voltage at bus 2 , V_2 = 1.0128∠-5.38° p.u
Generated power at bus 1 , S_G1 = (1.56 + j0.199) p.u
Real power loss in the system = 0.01 p.u
Reactive power loss in the system = -0.251 p.u