17
Power Flow Algorithm 1.0 Introduction In these notes we articulate the basic steps taken by a standard power flow algorithm. 2.0 The algorithm The NR algorithm, for application to the  power flow problem, is: 1. Specify: All admittance data (series Y, charging capacitance, transformer taps, & shunts) P d and Q d for all buses (whether PV, PQ, or swing) P g and |V| for all PV buses |V| for swing bus, with θ =0°  2. Set the iteration counter j=0. Use one of the following to guess the initial solution. Flat Start: V k =1.0 0° for all buses. Hot Start: Use the solution to a  previously solved case for this network. 1

Power Flow Algorithm

Embed Size (px)

Citation preview

Page 1: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 1/17

Power Flow Algorithm

1.0 Introduction

In these notes we articulate the basic steps

taken by a standard power flow algorithm.

2.0 The algorithm

The NR algorithm, for application to the power flow problem, is:

1. Specify:

• All admittance data (series Y, charging

capacitance, transformer taps, & shunts)

• Pd

and Qd

for all buses (whether PV, PQ,

or swing)

• Pg and |V| for all PV buses

• |V| for swing bus, with θ =0° 

2. Set the iteration counter j=0. Use one of 

the following to guess the initial solution.

• Flat Start: Vk =1.0 ∠ 0° for all buses.• Hot Start: Use the solution to a

 previously solved case for this network.

1

Page 2: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 2/17

3. Compute the mismatch vector for x(j),

denoted as f(x). In what follows, we

denote elements of the mismatch vector as∆ Pk  and ∆ Qk  corresponding to the real

and reactive power mismatch,

respectively, for the k th bus (which would

not be the k th element of the mismatch

vector for two reasons: one reason pertains

to the swing bus and the other reason tothe fact that for type PQ buses, there are

two equations per bus and not one). This

computation will also result in all

necessary calculated real and reactive

  power injections. Perform the followingstopping criterion tests:

If |∆ Pk |< ε P for all type PQ & PV buses

and

If ||∆ Qk |< ε Q for all type PQ buses,

Then go to step 5

ElseGo to step 4.

2

Page 3: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 3/17

4. Find an improved solution as follows:

Evaluate the Jacobian J at x

(j)

. Denotethis Jacobian as J(j) 

• Solve for  ∆ x(j) by applying LU

decomposition to:

Q

 P 

 x  J j   j  )()(

• Compute the updated solution vector as

x(j+1)= x(j)+ ∆ x(j).

• Return to step 3 with j=j+1.

5. Stop.

The above algorithm is applicable as long as

all PV buses remain within reactive limits.

To account for generator reactive limits, we

must modify the algorithm so that, at each

iteration, we check to ensure PV bus

reactive generation is within its limits. Inthis case, steps 1-4 remain as above, but we

need new steps 5-6, as follows:

3

Page 4: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 4/17

5. Check reactive limits for all generator 

 buses as follows:

a. For all type PV buses, perform thefollowing test:

• If Qgk >Qgk,max, then

Qgk =Qgk,max and CHANGE bus k 

to a type PQ bus (see step 6a)

• If Qgk < Qgk,min, then

Qgk =Qgk,min and CHANGE bus k toa type PQ bus (see step 6b)

  b. For all type PQ generator buses,

 perform the following test:

• If Qgk =Qgk,max and |Vk |>|Vk,set| or if  

Qgk =Qgk,min and |Vk |<|Vk,set|, then CHANGE this bus back to a type

PV bus (see step 6b)

6. If there were no CHANGES in Step 5,

then stop. If there were one or more

CHANGES in step 5, then modify thesolution vector and the mismatch vector as

follows:

4

Page 5: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 5/17

a. For each CHANGE made in step 5-a

(changing a PV bus to a PQ bus):

 NG=NG-1• Include the variable ∆ Vk  to the vector 

∆ x and the variable Vk  to the vector x.

• Include reactive eqt. corresponding to

 bus k to the vector f(x).

• Modify the Jacobian by adding a

column to J12 and adding a row to J21

and J22.

 b. For each CHANGE made in Step 5-b

(changing a PQ gen bus back to a PV

 bus):

 NG=NG+1• Remove variable ∆ Vk  from vector 

∆ x and variable Vk from vector x.

• Remove reactive eqt. corresponding to

 bus k from vector f(x).

• Modify the Jacobian by removing a

column from J12 and removing a row

from J21 and J22.

After modifications have been made for all

CHANGES, go back to Step 4.

5

Page 6: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 6/17

When the algorithm stops, then all line flows

may be computed using **][   jk k   j  j  jk   j  jk  Y V V V  I V S  −==

Example: (Same as example 10.6 in text)

Find θ  2, V  3 , θ  3, SG1, and QG2 for the

system of Fig. 1. All the shunt elements are

capacitors with admittance  yc =  j0.01, while

all the series elements are inductors withimpedance z  L= j0.1.

 

|V2|=1.05

SG1 PG2=0.6661

V1=1∠0° 

V3 

SD3=2.8653+j1.2244

Fig. 1

Solution: The admittance matrix is:

=

98.191010

1098.1910

101098.19

Y

  j  j  j

  j  j  j

  j  j  j

6

Page 7: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 7/17

Bus 1 is the swing bus. Bus 2 is a PV bus.

Bus 3 is a PQ bus. The unknown variables

areθ

2,θ

3, and |V3|. Thus, we will needthree equations, and the Jacobian is a 3 x 3

matrix.

We first write the real power flow equation,

 putting in the known values of |V1|, |V2|, θ 1,

and the Bij’s. Note that since we haveneglected line resistance in the problem

statement, all Gij’s are zero.P2( x)= V 2 V 1  B21sin(θ  2 −θ  1)+V 2 V 3  B23sin (θ  2 −θ  3)

= 10.5sinθ  2 +10.5V 3sin(θ  2 −θ  3) 

P3( x)= V 

3V 

1 B

31sin(θ  3 −θ  1)+V 3V 

2 B

32sin(θ  3 −θ  2)

=10.0 V 3sinθ  

3+10.5V 

3sin (θ  

3−θ  

2)

The equation for Q2(x) will not help since

we do not know the reactive injection for 

 bus 2, and its inclusion would bring in the

reactive injection on the left-hand side as an

additional unknown. But this loss of an

equation is compensated by the fact that we

7

Page 8: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 8/17

know |V2| (and this will always be the case

for a type PV bus). So we do not need to

write the equation for Q2(x). Yet, because  bus 3 is a type PQ bus, we do know its

reactive injection, and so we will know the

left hand side of the reactive power flow

equation. This is fortunate, since we do not

know |V3| (and this will always be the

situation for a type PQ bus).Q

3( x)=− V 

3V 

1 B

31cos( θ  

3−θ  

1)+V 

3V 

2 B

32cos( θ  

3−θ  

2)+V 

3

2 B

33[=-10V 

3cos θ  

3+10.5V 

3cos( θ  

3−θ  

2)−19.98V 

3

2[ ]

The update vector and Jacobian matrix is:

=∆

3

3

2

x

θ 

θ 

 

=

3

3

3

3

2

3

3

3

3

3

2

3

3

2

3

2

2

2

QQQV 

 P  P  P 

 P  P  P 

 J 

∂ 

∂ 

∂θ 

∂ 

∂θ 

∂ 

∂ 

∂ 

∂θ 

∂ 

∂θ 

∂ 

∂ 

∂ 

∂θ 

∂ 

∂θ 

∂ 

The various partial derivatives for the

Jacobian are:( ) ( )

( )3232

322332122112

2

2

cos5.1010.5cos=

coscos

θ

θ

∂θ

 BV V  BV V  P 

( ) ( )323322332

3

2 cos-10.5=cos θ θ θ θ ∂θ 

∂ −−−= V  BV V 

 P 

( ) ( )3232232

3

2 10.5sin=sin θ θ θ θ ∂ 

∂ −−= BV 

 P 

8

Page 9: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 9/17

( )233

2

3 cos5.10 θ θ ∂θ 

∂ −−= V 

 P 

( )23333

3

3 cos5.10cos0.10 θ θ θ ∂θ 

∂ −+= V V 

 P 

( )233

3

3 sin5.10sin10 θ θ θ ∂ 

∂ 

−+=V 

 P 

( ) ( )2332323

2

3 sin5.10sin10 θ θ θ θ ∂θ 

∂ −−=−−= V V V 

Q

( )

( )23333

232333

3

3

sin5.10sin10=

sin10sin10

θ

θ∂θ

V V 

V V V Q

( ) ( )[ ]

( )[ ]3233

3333333232231311

3

3

96.39cos5.10cos10= 

coscos

 BV  BV  BV  BV V 

Q

−−+−

−++−=

θ  θ  θ  

θ  θ  ∂  

∂  

 Note that the injections are P2=PG2=0.6661,

P3=-PD3=-2.8653, and Q3=-QD3=-1.2244;

these quantities remain constant through the

entire iterative process. We use a flat start;

so our initial guess is θ 2=θ 3=0° and |V3|=1.0.

( )( )( )

=

=

=

=

7044.0

8653.2

6661.0

2244.1

8653.2

6661.0

52.0

0

0

x

x

x

)(

3

3

2

)0(

3

)0(

3

)0(

2

)0(

3

3

2

)0(

Q

 P 

 P 

Q

 P 

 P 

Q

 P 

 P 

 x  f  

As expected for a flat start, mismatch is

large. Next calculate the Jacobian matrix:

9

Page 10: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 10/17

=

46.1900

05.205.10

05.1021

 J 

 Note that Jacobian sub-matrices J12 and J21

are both filled with 0s. This is because thesederivatives depend on sin terms, and

 because this is iteration 0 of a flat start, all

angles are zero and therefore sin terms are 0.

As mentioned, commercial power flow

 programs normally use LU factorization toobtain the update. In this case, however,

 because of the low dimensionality, we may

invert the Jacobian. Taking advantage of the

 block diagonal structure, we have:

( )

[ ] [ ]

=

=−

0514.000

00656.00328.0

00328.00640.0

46.19000

0

5.205.10

5.1021

1

1

1 J 

 Now

we compute:

[ ]

=

=

−∆

=

0362.0

1660.0

0513.0

7044.0

8653.2

6661.0

0514.000

00656.00328.0

00328.00640.0

 

|| 3

3

2

1-

3

3

2

)0(

Q

 P 

 P 

 J 

 x  θ

θ

The elements of the update vector 

corresponding to angles are in radians. We

can easily convert them to degrees:

10

Page 11: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 11/17

=

=

0.0362-

9.5139-

9396.2

0.0362-

rad 0.1660-

rad 0513.0o

o)0(

3

3

2

θ

θ

We now find x

(1)

as follows:

=

+

=∆+=

0.9638

9.5139-

9396.2

0.0362-

9.5139-

9396.2

1

0

0

xxx o

o

o

o

)0()0()1(

We note that the exact solution is

9499.0

01.10

00.3o

o

, so

this is pretty good progress for one iteration!

We proceed to the next iteration using the

new values θ 2(1)=-2.9396°, θ 3

(1)=-9.5139°,

and |V3|(1)=0.9638. We get P2(x

(1)) = 0.6202,

and thus ∆ P2(1)= 0.6202-0.6661=-0.0459.

Similarly, we get the updated mismatch

vector:

=

2251.0

1145.0

0463.0)1(

3

3

2

Q

 P 

 P 

 Note that, in just one iteration, the mismatch

vector has been reduced by a factor of about

10. Calculating  J using the updated valuesof the variables, we find that

=

2199.187508.21582.1

8541.25589.190534.10

2017.10534.105396.20)1(

 J 

11

Page 12: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 12/17

The matrix should be compared with J from

the previous iteration, given below for 

convenience:

=

46.1900

05.205.10

05.1021)0(

 J 

It has not changed much. The elements in

the off-diagonal matrices J12 and J21 are no

longer zero, but their elements are small

compared to the elements in the diagonalmatrices J11 and J22. The diagonal matrices

themselves have not changed much. It is

also important to note that the upper left-

hand 2× 2 block of the Jacobian matrix is

symmetric. This fact allows for a significant

savings in storage when dealing with large

systems.

The updated inverse is

( )

=

0561.00084.00009.0

0087.00696.00336.0

0010.00336.00651.01)1(

 J 

Comparing this inverted Jacobian with that

of the last iteration, repeated below:

( )

=

0514.000

00656.00328.0

00328.00640.01)0(

 J 

12

Page 13: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 13/17

we again do not see much change.

Using the same procedure as before tocalculate the update vector, we obtain

=

=

0.9502

9.9924-

0023.3

x o

o

3

3

2

)2(

θ 

θ 

This is very close to the correct answer,

which is

9499.0

01.10

00.3o

o

. The largest error is only

about 0.08%.

Of course in the usual problem we do not

know the answer and we would continue

into the next iteration. We would stop the

iterations when the mismatch vector satisfies

the required tolerance. We would find:

=

0031.0

0023.0

0019.0)2(

3

3

2

Q

 P 

 P 

The mismatch has been reduced from that of 

the last iteration by a factor of 100 and is

small enough. On that basis we can stophere. So we stop with the values

θ 2=-3.0023o, θ 3=-9.9924o, and |V3|

=0.9502. It remains to calculate the real and

13

Page 14: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 14/17

reactive power generation at the swing bus

(bus 1) and the reactive power generation at

the PV bus (bus 2) using the calculatedvalues of θ 2, θ 3, and |V3|.

( ) ( )

1987.2sin9.9924502.902310.5sin3.0= 

sinsin

oo

31133121122111

=+

−+−== θ  θ  θ  θ   BV V  BV V  P  P G  ( ) ( )

[ ]0.1365= 98.1999249.502cos9.+02310.5cos3.0-= 

coscos

oo

11

2

131133121122111

+−+−−== BV  BV V  BV V QQG θ  θ  θ  θ  

 ( ) ( )

( ) ( )[ ]1.6395= 

028.226.9901cos977.93.0023-10.5cos-= 

coscos

oo

22

2

232233212211222

−+

+−+−−== BV  BV V  BV V QQG θ  θ  θ  θ  

  Now: what would happen if  

QG2max=150 MVARS (1.5 pu)? Then the

reactive power injection for bus 2 would beinfeasible. The program would check for 

this, and when a violation occurs, as it does

in this case:

QG2=164.95 MVARS>150MVARS,

it would change bus 2 from a PV bus to a

PQ bus. This would result in the followingsolution procedure:

14

Page 15: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 15/17

Solution: The admittance matrix remains

the same, and is:

−−

=98.191010

1098.1910

101098.19

Y  j  j  j  j  j  j

  j  j  j

Bus 1 is still the swing bus. But bus 2 is no

longer a PV bus but is now a PQ bus (since

we are specifying Q). Bus 3 is a PQ bus. The

unknown variables are θ 2, θ 3, |V2|, and |

V3|. Note that we have added the variable |V2|, since bus 2 is no longer a voltage

control bus and we can therefore NOT 

control |V 2|. Thus, we will need  four 

equations (instead of three), and the

Jacobian is a 4 x 4 matrix.

We first write the real power flow equations,

 putting in the known values of |V1|, |V2|, θ 1,

and the Bij’s. Again, since we have

neglected line resistance in the problem

statement, all Gij’s are zero.

)(sin5.10sin5.10= 

)(sin)(sin)x(

323222

3223321221122

θ

θ

−−

V  V  V  

 BV  V   BV  V   P 

 

15

Page 16: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 16/17

(Note: In the first iteration, we had |V2|=1.0

and so it did not appear in the P2 expression.

 Now, since it is a variable, it does.)

  )(sin5.10sin10.0= 

)(sin)(sin)x(

23333

2332231331133

θ

θ

−−

V  V  

 BV  V   BV  V   P 

Before, we did NOT use the equation for 

Q2(x), since bus 2 was assumed to be

regulating and therefore a PV bus. Now, theit is no longer regulating the voltage because

its reactive limit is set at 1.5 pu. Since its

reactive limit is set at 1.5 pu, we know Q2.

So we will bring in the Q2 equation.

[ ][ ])cos(1098.19cos10-= 

)cos()cos()cos()x(

322

2

222

3223322222

2

21221122

θ

θ

V V V 

 BV V  BV  BV V Q

Likewise (as before in this case), because  bus 3 is a type PQ bus, we do know its

reactive injection, and so we will know the

16

Page 17: Power Flow Algorithm

8/3/2019 Power Flow Algorithm

http://slidepdf.com/reader/full/power-flow-algorithm 17/17

left hand side of the reactive power flow

equation.Q

3( x)=− V 

3V 

1 B

31cos( θ  

3−θ  

1)+V 

3V 

2 B

32cos( θ  

3−θ  

2)+V 

3

2 B

33[=-10V 

3cos θ  3 +10.5V 

3cos( θ  3 −θ  2)−19.98V 

32

[ ]

The update vector and Jacobian matrix are:

=

3

2

3

2

x

θ

θ

 

=

3

3

2

3

3

3

2

3

3

2

2

2

3

2

2

2

3

3

2

3

3

3

2

3

3

2

2

2

3

2

2

2

Q

QQQ

Q

QQQ

 P 

 P  P  P 

 P 

 P  P  P 

 J 

∂ θ

∂ θ

∂ θ

∂ θ

∂ θ

∂ θ

∂ θ

∂ θ

The various partial derivatives for the

Jacobian are….

Assignment: Write Matlab code to

implement the calculations done in the

above example, for this example. Your code

should perform two iterations. Due Friday

11/12.

17