You are on page 1of 9

Algorithm for Gauss Seidal Iterative Method

Step 1: Read data : no. of buses (NB), no of PV buses (NPV), no. of


elements (NE)
Step 2: Read voltage and angle for slack bus 𝑉1 , 𝛿1
Active power for all buses 𝑃𝑖 , 𝑖 = 1,2, … 𝑁𝐵, Reactive power for all PQ
buses 𝑄𝑖 , 𝑖 = (𝑁𝑃𝑉 + 1), … 𝑁𝐵,
Specified voltage for all PV buses 𝑉𝑖 , 𝑖 = 2, … 𝑁𝑃𝑉, Maximum and
minimum limits of voltage for all PQ buses
𝑉𝑖𝑚𝑖𝑛 , 𝑉𝑖𝑚𝑎𝑥 , 𝑖 = 𝑁𝑃𝑉 + 1 , … 𝑁𝐵)
Maximum and minimum limits of reactive power for all PV buses
𝑄𝑖𝑚𝑖𝑛 , 𝑄𝑖𝑚𝑎𝑥 , 𝑖 = 2,3, … 𝑁𝑃𝑉)
Step length (acceleration factor) α=1.1-1.6, convergence tolerance =0.01
and maximum number of iterations 𝐼𝑇𝑚𝑎𝑥
Step 2: Assemble 𝑌𝐵𝑈𝑆 for given network.
Step 3: Assume voltage magnitude and phase angle for unknown
variables as 𝑉𝑖 = 1.0 𝑓𝑜𝑟 𝑖 = (𝑁𝑃𝑉 + 1), … NB and
𝛿𝑖 = 00 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑏𝑢𝑠𝑒𝑠 , 𝑖 = 2,3, … 𝑁𝐵
Step 4: Set iteration count r=0 and ∆𝑉 𝑚𝑎𝑥 =0
Step 5: Set bus count 𝑖 =2 and check its bus type.
3/17/2019 EIED MBK 1
GS algorithm cont…
Step 6: in case bus is PQ bus then compute voltage at the bus as
𝑖−1 𝑁𝐵
(𝑟+1) 1 𝑃𝑖 − 𝑗𝑄𝑖 (𝑟+1) (𝑟)
𝑉𝑖 = − 𝑌 𝑉
𝑖𝑘 𝑘 − 𝑌 𝑉
𝑖𝑘 𝑘
𝑌𝑖𝑖 0 ∗
𝑉𝑖 𝑘=1 𝑘=𝑖+1
Step 7: Update the voltage using acceleration factor as
(𝑟+1) (𝑟) (𝑟+1) (𝑟)
𝑉𝑖 =𝑉𝑖 + α 𝑉𝑖 − 𝑉𝑖
(𝑟+1)
Step 8: Check the limits of 𝑉𝑖 𝑖 and set according to
𝑉𝑖 (𝑚𝑖𝑛) ; 𝑖𝑓 𝑉𝑖 (𝑟+1) ≤ 𝑉𝑖 (𝑚𝑖𝑛)
(𝑟+1) (𝑚𝑎𝑥) ;
𝑉𝑖 = 𝑉𝑖 𝑖𝑓 𝑉𝑖 (𝑟+1) ≥ 𝑉𝑖 (𝑚𝑎𝑥)
𝑉𝑖 (𝑟+1) ; 𝑖𝑓 𝑉𝑖 (𝑚𝑖𝑛) ≤ 𝑉𝑖 (𝑟+1) ≤ 𝑉𝑖 (𝑚𝑎𝑥)
(𝑟+1) (𝑟)
Step 9: Compute ∆𝑉𝑖 = 𝑉𝑖 − 𝑉𝑖 . If ∆𝑉𝑖 > ∆𝑉 𝑚𝑎𝑥 , then set
∆𝑉 𝑚𝑎𝑥 = ∆𝑉𝑖 .
(𝑟+1) (𝑟)
Step 10: Assign 𝑉𝑖 → 𝑉𝑖

3/17/2019 EIED MBK 2


GS algorithm cont…
Step 11: in case bus is PV bus then compute reactive power at the bus as
𝑁𝐵
(𝑟+1) (𝑟) ∗ (𝑟)
𝑄𝑖 = −𝐼𝑚𝑔 𝑉𝑖 𝑌𝑖𝑘 𝑉𝑘
𝑘=1
(𝑟+1)
Step 12: Check the limits of 𝑄𝑖 𝑖 and set according to
𝑄𝑖 (𝑚𝑖𝑛) ; 𝑖𝑓 𝑄𝑖 (𝑟+1) ≤ 𝑄𝑖 (𝑚𝑖𝑛)
𝑄𝑖 (𝑟+1) = 𝑄𝑖 (𝑚𝑎𝑥) ; 𝑖𝑓 𝑄𝑖 (𝑟+1) ≥ 𝑄𝑖 (𝑚𝑎𝑥)
𝑄𝑖 (𝑟+1) ; 𝑖𝑓 𝑄𝑖 (𝑚𝑖𝑛) ≤ 𝑄𝑖 (𝑟+1) ≤ 𝑄𝑖 (𝑚𝑎𝑥)
If no limit is violated then set =0 else set =1
Step 13: compute voltage at the ith PV bus as
𝑖−1 𝑁𝐵
(𝑟+1) 1 𝑃𝑖 − 𝑗𝑄𝑖 (𝑟+1) (𝑟)
𝑉𝑖 = ∗ − 𝑌 𝑉
𝑖𝑘 𝑘 − 𝑌 𝑉
𝑖𝑘 𝑘
𝑌𝑖𝑖 𝑉𝑖0 𝑘=1 𝑘=𝑖+1
(𝑟+1) (𝑟) (𝑟+1) (𝑟)
Step 14: If =1, then update the voltage as 𝑉𝑖 =𝑉𝑖 + α 𝑉𝑖 − 𝑉𝑖
(𝑟+1)
Step 15: Check the limits of 𝑉𝑖 𝑖 and set according to
𝑉𝑖 (𝑚𝑖𝑛) ; 𝑖𝑓 𝑉𝑖 (𝑟+1) ≤ 𝑉𝑖 (𝑚𝑖𝑛)
(𝑟+1)
𝑉𝑖 = 𝑉𝑖 (𝑚𝑎𝑥) ; 𝑖𝑓 𝑉𝑖 (𝑟+1) ≥ 𝑉𝑖 (𝑚𝑎𝑥)
𝑉𝑖 (𝑟+1) ; 𝑖𝑓 𝑉𝑖 (𝑚𝑖𝑛) ≤ 𝑉𝑖 (𝑟+1) ≤ 𝑉𝑖 (𝑚𝑎𝑥)
3/17/2019 EIED MBK 3
GS algorithm cont…
Step 16: =0 then compute
(𝑟+1)
(𝑟+1)
𝐼𝑚𝑔 𝑉𝑖
𝛿𝑖 = 𝑡𝑎𝑛−1 (𝑟+1)
𝑅𝑒𝑎𝑙 𝑉𝑖
(𝑟+1) (𝑠𝑝) (𝑟+1)
And set 𝑉𝑖 = 𝑉𝑖 ∠(𝛿𝑖 )
(𝑟+1) (𝑟)
Step 17: Assign 𝑉𝑖 → 𝑉𝑖
Step 18: Increment the bus count 𝑖 = 𝑖 + 1
Step 19: If 𝑖 ≤ 𝑁𝐵, then go to Step 6 and repeat.
Step 20: Check convergence as if ∆𝑉 𝑚𝑎𝑥 ≥ ε , 𝑡ℎ𝑒𝑛 𝑔𝑜 𝑡𝑜 𝑠𝑡𝑒𝑝 5.
Step 21: Increment iteration count r= 𝑟 + 1, If
𝑟 ≤ 𝐼𝑇𝑚𝑎𝑥 𝑡ℎ𝑒𝑛 𝑔𝑜 𝑡𝑜 𝑠𝑡𝑒𝑝 5 𝑎𝑛𝑑 𝑟𝑒𝑝𝑒𝑎𝑡 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 𝑓𝑔𝑜 𝑡𝑜 𝑠𝑡𝑒𝑝 22
Step 22: Compute powers on slack bus as (Bus 1 is a slack bus)
𝑁𝐵

𝑆1 = 𝑃1 − 𝑗𝑄1 = 𝑉1∗ 𝑌𝑖𝑘 𝑉𝑘


𝑘=1
Step 23: Compute the line flows as:
𝑆𝑖𝑘 = 𝑉𝑖 𝑉𝑖∗ − 𝑉𝑘∗ 𝑦𝑖𝑘

+ 𝑉𝑖∗ 𝑦𝑖𝑘0

Step 24: Print the results and stop.


3/17/2019 EIED MBK 4
Newton Raphson Load Flow Algorithm
Step 1: Read data : no. of buses (NB), no of PV buses (NPV), no. of elements (NE)
Step 2: Read voltage and angle for slack bus 𝑉1 , 𝛿1
Active power for all buses 𝑃𝑖 , 𝑖 = 1,2, … 𝑁𝐵, Reactive power for all PQ buses 𝑄𝑖 , 𝑖 = (𝑁𝑃𝑉 +
1), … 𝑁𝐵,
Specified voltage for all PV buses 𝑉𝑖 , 𝑖 = 2, … 𝑁𝑃𝑉, Maximum and minimum limits of voltage
for all PQ buses 𝑉𝑖𝑚𝑖𝑛 , 𝑉𝑖𝑚𝑎𝑥 , 𝑖 = 𝑁𝑃𝑉 + 1 , … 𝑁𝐵)
Maximum and minimum limits of reactive power for all PV buses 𝑄𝑖𝑚𝑖𝑛 , 𝑄𝑖𝑚𝑎𝑥 , 𝑖 =
2,3, … 𝑁𝑃𝑉)
convergence tolerance =0.01 and maximum number of iterations 𝐼𝑇𝑚𝑎𝑥
Step 2: Assemble 𝑌𝐵𝑈𝑆 for given network.
Step 3: Assume voltage magnitude and phase angle for unknown variables as
𝑉𝑖 = 1.0 𝑓𝑜𝑟 𝑖 = (𝑁𝑃𝑉 + 1), … NB and 𝛿𝑖 = 00 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑏𝑢𝑠𝑒𝑠 , 𝑖 = 2,3, … 𝑁𝐵
Step 4: Set iteration count r=0
Step 5:Compute 𝑃𝑖 , 𝑄𝑖 and power mismatch vector ∆𝑃𝑖 , ∆𝑄𝑖 as
𝑃𝑖 = 𝑉𝑖 𝑁𝐵 𝑘=1 𝑉𝑘 𝐺𝑖𝑘 𝑐𝑜𝑠 𝛿𝑖 − 𝛿𝑘 + 𝐵𝑖𝑘 𝑠𝑖𝑛 𝛿𝑖 − 𝛿𝑘 ; 𝑖 = 1,2, … 𝑁𝐵
𝑠𝑝
∆𝑃𝑖 = 𝑃𝑖 − 𝑃𝑖 ; 𝑖 = 1,2, … 𝑁𝐵
𝑄𝑖 = 𝑉𝑖 𝑁𝐵 𝑘=1 𝑉𝑘 𝐺𝑖𝑘 𝑠𝑖𝑛 𝛿𝑖 − 𝛿𝑘 − 𝐵𝑖𝑘 𝑐𝑜𝑠 𝛿𝑖 − 𝛿𝑘 ; 𝑖 = (𝑁𝑉 + 1), … 𝑁𝐵
𝑠𝑝
∆𝑄𝑖 = 𝑄𝑖 − 𝑄𝑖 ; 𝑖 = 𝑁𝑉 + 1 , … 𝑁𝐵
Step 6: Check if max(∆𝑃𝑖 , ∆𝑄𝑖 ) ≤ 𝜀, then go to step 16.
Step 7: Compute Jaccobian matrix elements;
𝑓𝑜𝑟 𝑖 = 𝑘; 𝐻𝑖𝑖 , 𝐿𝑖𝑖 , 𝐽𝑖𝑖 , 𝑀𝑖𝑖 And for 𝑖 ≠ 𝑘; 𝐻𝑖𝑘 , 𝐿𝑖𝑘 , 𝐽𝑖𝑘 , 𝑀𝑖𝑘
3/17/2019 EIED MBK 5
NR Method cont…
𝜕𝑃𝑖
For 𝑖 = 𝑘, 𝐻𝑖𝑖 = = −𝑄𝑖 − 𝐵𝑖𝑖 𝑉𝑖2
𝜕𝛿𝑖
𝜕𝑃𝑖
𝑁𝑖𝑖 = 𝑉𝑖 = 𝑃𝑖 + 𝐺𝑖𝑖 𝑉𝑖2
𝜕𝑉𝑖
𝜕𝑄𝑖
𝐽𝑖𝑖 = = 𝑃𝑖 − 𝐺𝑖𝑖 𝑉𝑖2
𝜕𝛿𝑖
𝜕𝑄𝑖
𝑀𝑖𝑖 = 𝑉𝑖 = 𝑄𝑖 − 𝐵𝑖𝑖 𝑉𝑖2
𝜕𝑉𝑖
For 𝑖 ≠ 𝑘;
𝜕𝑃𝑖
𝐻𝑖𝑘 = = 𝑉𝑖 𝑉𝑘 (𝐺𝑖𝑘 sin 𝛿𝑖 − 𝛿𝑘 − 𝐵𝑖𝑘 cos(𝛿𝑖 − 𝛿𝑘 ))
𝜕𝛿𝑘
𝜕𝑃𝑖
𝑁𝑖𝑘 = 𝑉𝑘 = 𝑉𝑖 𝑉𝑘 (𝐺𝑖𝑘 cos 𝛿𝑖 − 𝛿𝑘 + 𝐵𝑖𝑘 sin(𝛿𝑖 − 𝛿𝑘 ))
𝜕𝑉𝑘
𝜕𝑄𝑖
𝐽𝑖𝑘 = = 𝑉𝑖 𝑉𝑘 (−𝐺𝑖𝑘 cos 𝛿𝑖 − 𝛿𝑘 − 𝐵𝑖𝑘 sin(𝛿𝑖 − 𝛿𝑘 ))
𝜕𝛿𝑘
𝜕𝑄𝑖
𝑀𝑖𝑘 = 𝑉𝑘 = 𝑉𝑖 𝑉𝑘 (𝐺𝑖𝑘 sin 𝛿𝑖 − 𝛿𝑘 − 𝐵𝑖𝑘 cos(𝛿𝑖 − 𝛿𝑘 ))
𝜕𝑉𝑘

3/17/2019 EIED MBK 6


NR Method cont…
Step 8: Compute ∆𝛿𝑖 𝑖 = 2,3, . . 𝑁𝐵 𝑎𝑛𝑑
∆𝑉𝑖
(𝑖= 𝑁𝑉 + 1 , … 𝑁𝐵) using equation as
𝑉𝑖
𝐻 𝑁 ∆𝛿 ∆𝑃
=
𝐽 𝐿 ∆𝑉/ 𝑉 ∆𝑄
Step 9: Update 𝛿𝑖 and 𝑉𝑖 as
(𝑟+1) (𝑟)
𝛿𝑖 = 𝛿𝑖 + ∆𝛿𝑖 ; 𝑖 = 2,3, . . 𝑁𝐵
(𝑟+1) (𝑟)
And 𝑉𝑖 = 𝑉𝑖 + ∆𝑉𝑖 ; 𝑖 = (𝑁𝑉 + 1), . . 𝑁𝐵
Step 9: Set bus count i=2
Step 10: If it is PQ bus then check voltage limits and set
accordingly
𝑉𝑖 (𝑚𝑖𝑛) ; 𝑖𝑓 𝑉𝑖 (𝑟+1) ≤ 𝑉𝑖 (𝑚𝑖𝑛)
𝑉𝑖 (𝑟+1) = 𝑉𝑖 (𝑚𝑎𝑥) ; 𝑖𝑓 𝑉𝑖 (𝑟+1) ≥ 𝑉𝑖 (𝑚𝑎𝑥)
𝑉𝑖 (𝑟+1) ; 𝑖𝑓 𝑉𝑖 (𝑚𝑖𝑛) ≤ 𝑉𝑖 (𝑟+1) ≤ 𝑉𝑖 (𝑚𝑎𝑥)

3/17/2019 EIED MBK 7


NR Method cont…
Step 11: If it is PV bus then compute 𝑄𝑖 and check
(𝑟+1)
reactive power
(𝑚𝑖𝑛)
limits and set accordingly
(𝑟+1)
𝑄𝑖
(𝑚𝑖𝑛)
=
𝑄𝑖 ; 𝑖𝑓 𝑄𝑖 ≤ 𝑄𝑖
𝑄𝑖 (𝑚𝑎𝑥) ; 𝑖𝑓 𝑄𝑖 (𝑟+1) ≥ 𝑄𝑖 (𝑚𝑎𝑥)
𝑄𝑖 (𝑟+1) ; 𝑖𝑓 𝑄𝑖 (𝑚𝑖𝑛) ≤ 𝑄𝑖 (𝑟+1) ≤ 𝑄𝑖 (𝑚𝑎𝑥)
Step 12: If Q limits are violated then recalculate voltage
of that PV bus as
𝑁𝐵 𝑁𝐵
𝑉𝑖 ∆𝑉𝑘
∆𝑉𝑖 = ∆𝑄𝑖 − 𝐽𝑖𝑘 ∆𝛿𝑘 − 𝑀𝑖𝑘
𝑀𝑖𝑖 𝑉𝑘
𝑘=2 𝑘=𝑁𝑉+1
𝑘≠𝑖
(𝑟+1)
And update the voltage of PV bus as 𝑉𝑖 =
(𝑠𝑝)
𝑉𝑖 + ∆𝑉𝑖
3/17/2019 EIED MBK 8
NR algorithm cont…
Step 13: Increment the bus count 𝑖 = 𝑖 + 1
Step 14: If 𝑖 ≤ 𝑁𝐵, then go to Step 11 and repeat.
Step 15: Increment iteration count r= 𝑟 + 1, If 𝑟 ≤ 𝐼𝑇𝑚𝑎𝑥
𝑡ℎ𝑒𝑛 𝑔𝑜 𝑡𝑜 𝑠𝑡𝑒𝑝 5 𝑎𝑛𝑑 𝑟𝑒𝑝𝑒𝑎𝑡 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 𝑓𝑔𝑜 𝑡𝑜 𝑠𝑡𝑒𝑝 16.
Step 16: Compute powers on slack bus as (Bus 1 is a slack bus)
𝑁𝐵

𝑆1 = 𝑃1 − 𝑗𝑄1 = 𝑉1∗ 𝑌𝑖𝑘 𝑉𝑘


𝑘=1
Or
𝑁𝐵
𝑃1 = 𝑉1 𝑘=1 𝑉𝑘 𝐺𝑖𝑘 𝑐𝑜𝑠 𝛿𝑖 − 𝛿𝑘 + 𝐵𝑖𝑘 𝑠𝑖𝑛 𝛿𝑖 − 𝛿𝑘
𝑁𝐵

𝑄1 = 𝑉1 𝑉𝑘 𝐺𝑖𝑘 𝑠𝑖𝑛 𝛿𝑖 − 𝛿𝑘 − 𝐵𝑖𝑘 𝑐𝑜𝑠 𝛿𝑖 − 𝛿𝑘


𝑘=1
Step 17: Compute the line flows as:
𝑆𝑖𝑘 = 𝑉𝑖 𝑉𝑖∗ − 𝑉𝑘∗ 𝑦𝑖𝑘

+ 𝑉𝑖∗ 𝑦𝑖𝑘0

Step 18: Print the results and stop.


3/17/2019 EIED MBK 9

You might also like