ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical...

38
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign [email protected] 1 Lecture 4: Newton-Raphson Method

Transcript of ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical...

Page 1: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

ECE 530 – Analysis Techniques for Large-Scale Electrical Systems

Prof. Hao ZhuDept. of Electrical and Computer Engineering

University of Illinois at Urbana-Champaign

[email protected]

1

Lecture 4: Newton-Raphson Method

Page 2: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Power Flow Analysis

2

i1

In the Newton-Raphson power flow we use Newton's

method to determine the voltage magnitude and angle

at each bus in the power system.

We need to solve the power balance equations

P ( cosn

i k ik ikk

V V G

i1

sin )

Q ( sin cos )

ik ik Gi Di

n

i k ik ik ik ik Gi Dik

B P P

V V G B Q Q

• When analyzing power systems, we know the complex power being consumed by the load, and the power being injected by the generators plus their voltage magnitudes• Want to find voltage magnitude and angle at every bus

Page 3: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Solving Nonlinear Equations

• Most common technique for solving the nonlinear power flow is to use the Newton-Raphson method•

• Key idea behind Newton-Raphson is to use sequential linearization• More tractable for linear systems

General form of problem: Find an x such that

( ) 0ˆf x

3

Page 4: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Linear Equations

• Linear system of equations

• Here we will use the style of bolding matrices and vectors• Later in course we’ll consider solution methods for

sparse linear equations, which are quite common in electric power systems• Linear equations are conceptually easy to solve,

provided A is nonsingular; then there is a single solution

4

Ax = b

Page 5: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Linear Power System Elements

5

Resistors, inductors, capacitors, independent

voltage sources and current sources are linear

circuit elements

1V = R I V = V =

Such systems may be analyzed by superposition

j L I Ij C

Page 6: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Nonlinear Equations

• Motivated by power flow analysis, we’ll consider the solution of nonlinear equations of the form:

• Problem may be restated as finding a root x of f where both x and f(x) are n-vectors• A key challenge with nonlinear equations is there may

be one, none or multiple solutions!

6

f(x) = 0

Page 7: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Nonlinear Example of Multiple Solutions and No Solution

7

f(x) = x2 - 2 f(x) = x2 + 2

two solutions where f(x) = 0 no solution f(x) = 0

Example 1: x2 - 2 = 0 has solutions x = 1.414…

Example 2: x2 + 2 = 0 has no real solution

Page 8: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Nonlinear Equations

• The notation f(x) is short-hand for the vector function

so the problem is to solve n equations for n unknowns

8

1 1 2

2 1 2

1 2

, , ,

, , ,

, , ,

n

n

n n

f x x x

f x x x

f x x x

Page 9: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Newton-Raphson Method

• Newton developed his method for solving for the roots of nonlinear equations in 1671, but it wasn’t published until 1736• Raphson developed a similar method in 1690;

Raphson’s approach was actually simpler than Newton’s, and is what is used today • General form of scalar problem is to find an x such that

f(x) = 0• Key idea behind the Newton-Raphson method is to use

sequential linearization

9

Page 10: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Newton-Raphson Method (scalar)

10

( )

( ) ( )

( )( ) ( )

2 ( ) 2( )2

1. For each guess of , , define

-

2. Represent ( ) by a Taylor series about ( )

( )( ) ( )

1 ( )higher order terms

2

v

v v

vv v

vv

x x

x x x

f x f x

df xf x f x x

dx

d f xx

dx

Note, a priori we do NOT know x

Page 11: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Newton-Raphson Method, cont’d

11

( )( ) ( )

( )

1( )( ) ( )

3. Approximate ( ) by neglecting all terms

except the first two

( )( ) 0 ( )

4. Use this linear approximation to solve for

( )( )

5. Solve for a new estimat

vv v

v

vv v

f x

df xf x f x x

dx

x

df xx f x

dx

( 1) ( ) ( )

e of xv v vx x x

Page 12: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Newton-Raphson Example

12

2

1( )( ) ( )

( ) ( ) 2( )

( 1) ( ) ( )

( 1) ( ) ( ) 2( )

Use Newton-Raphson to solve ( ) - 2 0

The equation we must iteratively solve is

( )( )

1(( ) - 2)

2

1(( ) - 2)

2

vv v

v vv

v v v

v v vv

f x x

df xx f x

dx

x xx

x x x

x x xx

Page 13: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Newton-Raphson Example, cont’d

13

( 1) ( ) ( ) 2( )

(0)

( ) ( ) ( )

3 3

6

1(( ) - 2)

2

Guess x 1. Iteratively solving we get

v ( )

0 1 1 0.5

1 1.5 0.25 0.08333

2 1.41667 6.953 10 2.454 10

3 1.41422 6.024 10

v v vv

v v v

x x xx

x f x x

Page 14: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Sequential Linear Approximations

14

Function is f(x) = x2 - 2 = 0.Solutions are points wheref(x) intersects f(x) = 0 axis

At each iteration theN-R methoduses a linearapproximationto determine the next valuefor x

Page 15: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Newton’s Method for a Scalar Equation

x (3) x (2) x (0)

root x*

x (4) x (1) x

f (x)

15

Page 16: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Example 2

• Find the positive root of

using Newton’s method starting

• Computation must be done using radians!!!

. .. .

.

0

1 0

0

1 0 0 785391 57079 2 00001

0 0 5

f x x x

f x

0.5 0sin x x

x (0) 2

16

Page 17: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Example 2 Graphical View

2

x

2

xf x sin x

17

Page 18: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Example 2 Iterations

• We continue the iterations to obtain the following set of results

iteration number v

0 1.57079

1 2.00001

2 1.90100

3 1.89551

4 1.89549

vx

18

Page 19: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Example 2, Changed Initial Guess

• It is interesting to note that we get to the value of 1.89549 also if we start at 3.14159

iteration number v

0 3.14159

1 2.09440

2 1.91322

3 1.89567

4 1.89549

vx

19

Page 20: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Newton-Raphson Comments

• When close to the solution the error decreases quite quickly -- method has quadratic convergence• f(x(v)) is known as the mismatch, which we would like

to drive to zero• Stopping criteria is when f(x(v)) < • Results are dependent upon the initial guess. What if

we had guessed x(0) = 0, or x (0) = -1?• A solution’s region of attraction (ROA) is the set of

initial guesses that converge to the particular solution. The ROA is often hard to determine

20

Page 21: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Normal Convergence

desired root

( )x 0( )1x ( )2x x

f (x)

21

Page 22: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Oscillatory Convergence

x (3) x

(1) x (2) x

(0)x

(4)

f (x)Note that we actuallyovershoot the solution

22

Page 23: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Convergence to an Unwanted Root

x

desired root

undesired root

x (1)

x (0)

f (x)

23

Page 24: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Divergence

x (1) x

(0)

x (2) x

f (x)

24

Page 25: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Multi-Variable Newton-Raphson

25

1 1

2 2

Next we generalize to the case where is an n-

dimension vector, and ( ) is an n-dimension function

( )

( )( )

( )

Define the solution so ( ) 0 andˆ ˆ

ˆ

n n

x f

x f

x f

x

f x

x

xx f x

x

x f x

x x x

Page 26: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Multi-Variable Case, cont’d

26

i

1 11 1 1 2

1 2

1

n nn n 1 2

1 2

n

The Taylor series expansion is written for each f ( )

f ( ) f ( )f ( ) f ( )ˆ

f ( )higher order terms

f ( ) f ( )f ( ) f ( )ˆ

f ( )higher order terms

nn

nn

x xx x

xx

x xx x

xx

x

x xx x

x

x xx x

x

Page 27: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Multi-Variable Case, cont’d

27

1 1 1

1 21 1

2 2 22 2

1 2

1 2

This can be written more compactly in matrix form

( ) ( ) ( )

( )( ) ( ) ( )

( )( )ˆ

( )( ) ( ) ( )

n

n

nn n n

n

f f fx x x

f xf f f

f xx x x

ff f fx x x

x x x

xx x x

xf x

xx x x

higher order terms

nx

Page 28: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Jacobian Matrix

28

1 1 1

1 2

2 2 2

1 2

1 2

The n by n matrix of partial derivatives is known

as the Jacobian matrix, ( )

( ) ( ) ( )

( ) ( ) ( )

( )

( ) ( ) ( )

n

n

n n n

n

f f fx x x

f f fx x x

f f fx x x

J x

x x x

x x x

J x

x x x

Page 29: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Multi-Variable N-R Procedure

29

1

( 1) ( ) ( )

( 1) ( ) ( ) 1 ( )

( )

Derivation of N-R method is similar to the scalar case

( ) ( ) ( ) higher order termsˆ

( ) 0 ( ) ( )ˆ

( ) ( )

( ) ( )

Iterate until ( )

v v v

v v v v

v

f x f x J x x

f x f x J x x

x J x f x

x x x

x x J x f x

f x

Page 30: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Multi-Variable Example

30

1

2

2 21 1 2

2 22 1 2 1 2

1 1

1 2

2 2

1 2

xSolve for = such that ( ) 0 where

x

f ( ) 2 8 0

f ( ) 4 0

First symbolically determine the Jacobian

f ( ) f ( )

( ) =f ( ) f ( )

x x

x x x x

x x

x x

x f x

x

x

x x

J xx x

Page 31: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Multi-variable Example, cont’d

31

1 2

1 2 1 2

11 1 2 1

2 1 2 1 2 2

(0)

1(1)

4 2( ) =

2 2

Then

4 2 ( )

2 2 ( )

1Arbitrarily guess

1

1 4 2 5 2.1

1 3 1 3 1.3

x x

x x x x

x x x f

x x x x x f

J x

x

x

x

x

Page 32: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Multi-variable Example, cont’d

32

1(2)

(2)

2.1 8.40 2.60 2.51 1.8284

1.3 5.50 0.50 1.45 1.2122

Each iteration we check ( ) to see if it is below our

specified tolerance

0.1556( )

0.0900

If = 0.2 then we wou

x

f x

f x

ld be done. Otherwise we'd

continue iterating.

Page 33: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Stopping Criteria: Vector Norms

• When x is a vector the stopping criteria is determined by calculating the vector norm. Any norm could be used, but the most common norm used is the infinity norm, , where

• Other common norms are the one norm, which is the sum of the element absolute values and the Euclidean (or two norm) defined as

max iixx

=

x

1

22

2 21

n

ii

x @

33

=

=

Page 34: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Newton-Raphson Power Flow

i1

In the Newton-Raphson power flow we use Newton's

method to determine the voltage magnitude and angle

at each bus in the power system.

We need to solve the power balance equations

P ( cosn

i k ik ikk

V V G

i1

sin )

Q ( sin cos )

ik ik Gi Di

n

i k ik ik ik ik Gi Dik

B P P

V V G B Q Q

34

Page 35: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Power Flow Variables

2 2 2

n

2

Assume the slack bus is the first bus (with a fixed

voltage angle/magnitude). We then need to determine

the voltage angle/magnitude at the other buses.

( )

( )

G

n

P P

V

V

x

x f x

2

2 2 2

( )

( )

( )

D

n Gn Dn

G D

n Gn Dn

P

P P P

Q Q Q

Q Q Q

x

x

x

35

Page 36: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

N-R Power Flow Solution

( )

( )

( 1) ( ) ( ) 1 ( )

The power flow is solved using the same procedure

discussed with the general Newton-Raphson:

Set 0; make an initial guess of ,

While ( ) Do

( ) ( )

1

End While

v

v

v v v v

v

v v

x x

f x

x x J x f x

36

Page 37: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Power Flow Jacobian Matrix

1 1 1

1 2

2 2 2

1 2

1 2

The most difficult part of the algorithm is determining

and inverting the n by n Jacobian matrix, ( )

( ) ( ) ( )

( ) ( ) ( )

( )

( ) ( ) ( )

n

n

n n n

n

f f fx x x

f f fx x x

f f fx x x

J x

x x x

x x x

J x

x x x

37

Page 38: ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.

Power Flow Jacobian Matrix, cont’d

i

i

i1

Jacobian elements are calculated by differentiating

each function, f ( ), with respect to each variable.

For example, if f ( ) is the bus i real power equation

f ( ) ( cos sin )n

i k ik ik ik ik Gik

x V V G B P P

x

x

i

1

i

f ( )( sin cos )

f ( )( sin cos ) ( )

Di

n

i k ik ik ik iki k

k i

i j ik ik ik ikj

xV V G B

xV V G B j i

38