Jacobien

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 12

Obtaining the Jacobian

1.0 Introduction
We have seen that the Jacobian matrix is
essential for solving a set of nonlinear
algebraic equations using the Newton-
Raphson method.

In the last set of notes, we defined the


Jacobian and saw how to use it to solve a
simple two-dimensional problem.

In these notes, let’s see how to obtain the


Jacobian for the power flow problem.

2.0 The form of the Jacobian


The power flow equations were given as:
 f1 ( x )   P2 ( x )  P2 
    
    
 f N 1 ( x )   PN ( x )  PN 
 
f ( x )                   
 
 f N ( x )  Q N G  1 ( x )  Q N G  1 
     
   
 f 2 N  1 N G ( x )   QN ( x )  QN 

1
 P2   0 
    
    
 PN   0 



                 0
 


(1)
 Q N G  1   0 
     
   
 Q N   0 

where:
n
Pi   Vi Vk  Gik cos( i   k )  Bik sin( i   k ) i=2,…N
k 1

(2)
n
Qi   Vi Vk  Gik sin( i   k )  Bik cos( i   k )
k 1

i=NG+1,…N (3)
The solution vector is:
 θ 2   x1 
 θ   x 
 3   2 
     
 θ   θ N   x N 1 
x 
|
V | |V |

  x


(4)
  N G 1 N
|V N  2|  x N 1 
 G   
     
 |V |   x2 N  2 N 
 N   G 

The Jacobian matrix is:


 f1 ( x ( 0) ) (0)
f1 ( x ) f1 ( x ) 
( 0)

  
 x1( 0) x2 xn 
 f 2 ( x ) (0)
f 2 ( x ) f 2 ( x ) 
(0)

J   x
 1 x2

xn 
 (5)
     
(0) ( 0) (0)
 f n ( x ) f n ( x ) f n ( x ) 
 x 
 1 x2 xn 

2
Evaluation of these elements is facilitated by
the recognitions,
 from (2) and (3), that there are only two

kinds of equations to differentiate (real


power equations and reactive power
equations), and
 from eq. (4), that there are only two kinds

of unknowns (voltage angle unknowns


and voltage magnitude unknowns) with
respect to which we will differentiate.

Therefore, there are only 4 basic types of


derivatives in the Jacobian.
We denote four sub-matrices corresponding
to these four basic types of derivatives as:
11
 J : Contains derivatives of P-equations

with respect to angles.


12
 J : Contains derivatives of P-equations

with respect to voltage magnitudes.


21
 J : Contains derivatives of Q-equations

with respect to angles.


22
 J : Contains derivatives of Q-equations

with respect to voltage magnitudes.


3
Therefore,
( 2 N  1  N G ) ( 2 N  1  N G )
 ( N 1)( N  1) ( N  1 ) ( N  N G )
 
  11 12 
J
J
  ( N  N G ) ( N  1 )

J
( N  1  N G ) ( N  N G ) 

(6)
 21 22 
 J J 
The numbers above each sub-matrix in (6)
indicate its dimensions, which can be
inferred by identifying the number of
equations of that type (the number of rows
of the sub-matrix) and the number of
unknowns of that type (the number of
columns of the sub-matrix). We then identify
an individual element of each sub-matrix as:
 Pp Q p  Pp Q p
pq 
J 11
 q
pq 
J 21
 q
pq 
J 12
 Vq
pq 
J 22
 Vq
(7)
Note that the element Jpq11 is not the element
in row p, column q of the submatrix J11,
rather it is the derivative of the real power
injection equation for bus p with respect to
the angle of bus q. Since the swing bus is
numbered 1, the Jacobian matrix will have
J2211 as the element in row 1, column 1. The
situation is similar for the other submatrices.

4
Example: Obtain the form of the Jacobian
for the 5-bus system used previously:

Fig. 1

Solution: We previously identified the


minimal set of equations to solve as
 f 1 ( x )   P2 ( x )  P2   P2  0
 f ( x )  P ( x )  P   P   0 
 2   3 2  3  
 f ( x )  P ( x )  P2   P4  0
f ( x)   3    4
 f 4 ( x )   P5 ( x )  P2

   P5
 0
  0
and the solution
 f 5 ( x )  Q 4 ( x )  Q 4    Q 2   0 
       
 f 6 ( x ) Q5 ( x )  Q5   Q3  0

vector as
 x1    2 
x   
 2  3 
x  4 
x   3   
 x4    5 
 x 5   V2 
   
 x 6   V 3 

5
The Jacobian is the derivatives of all
equations with respect to all variables, in the
form defined by eq. (6). This results in:
 J 2211 J 2311 J 2411 J 2511 J 2412 J 2512 
 11 
   J 32 J 3311 J 3411 J 3511 J 3412 J 3512 
 44 4 2

J   J 45 J 4311 J 4411 J 4511 J 4412 J 4512 


66
  J 11 12 12
J   24 
 22   J 12 J 5311 J 5411 J 5511 J 5412 J 5512 

 21 22   55
J J   21
J J 4321 J 4421 J 4521 J 4422 J 4522 
 4221 
 J 52 J 5321 J 5421 J 5521 J 5422 J 5522 

3.0 Evaluating the elements


To evaluate the elements of the Jacobian
matrix, it is helpful to more explicitly write
out the functions of eq. (1). They are:

6
 P2 ( x)  P2 
  
 
 PN ( x)  PN 
f ( x)          
 
Q N G 1 ( x)  Q N G 1 
  
 
 Q N ( x)  Q N 
 
     
N

  V 2 V j G 2 j cos  2   j  B 2 j sin  2   j  P2 
 j 1

  
V N V j  G Nj cos N   j   B Nj sin  N   j    PN
N
 
  j 1

 
  
    
N
 V  Q N G 1 
 j 1
N G 1 V j G N G 1, j sin  N G 1   j  B N G 1, j sin  N G 1   j 
 
  
V N V j  G N , j sin  N   j   B N , j sin  N   j    Q N
N

 j 1



(8)
So each of the four sub-matrices of the
Jacobian has elements given by the
expressions of eq. (7), respectively. These
expressions are evaluated by taking the
appropriate derivatives of the functions in
eq. (8). One might think that this represents
a formidable problem, since, based on (6),
we have (2N-1-NG)(2N-1-NG) elements in
the Jacobian and therefore the same number
of derivatives to evaluate. For a power flow
7
with 5000 nodes (N=5000) and 1000
generators (NG=1000), the Jacobian will be
89998999 Jacobian matrix containing
80,982,001 elements, with each element
requiring a differentiation of a function like
those represented in eq. (8)!

Fortunately, all of the derivatives can be


expressed by one of just a few
differentiations. Let’s see how….

At first glance, one might think that there


would be four differentiations, one for each
sub-matrix. However, for each sub-matrix,
the off-diagonal terms, with pq, are
expressed differently than the diagonal
terms, with p=q. Therefore, there are eight
differentiations to perform. In obtaining
these expressions, the following tips are
helpful.

8
 Before differentiating, pull out the term
from the summation that corresponds to
the bus injection being computed.
 When differentiating a sum of terms with
respect to a particular variable, the
resulting derivative will be non-zero only
for those terms in which the variable
appears.
 When differentiating with respect to the
angles, the chain rule must be properly
applied to account for the derivatives of
the trigonometric functions and the
arguments of those trigonometric
functions.
 Each of the functions appear in the form of
f(x)=g(x)-A. Because A is a constant
(represented by P2,…, PN and QNg+1,…, QN
in eq. (8)), it has no effect on the resulting
derivatives.

The resulting expressions are given below.


P ( x )
 V V  G sin(   )  B cos(   )
(9)
p
J  11


pq p q pq p q pq p q
q

9
Pp ( x )
(10)
2
pp 
J 11  Q p ( x )  B pp V p
 p
Q ( x )
  V V  G cos(   )  B sin(   )
J 

21
pq
p

q
(11) p q pq p q pq p q

Q ( x )
(12) p 2
J   P ( x)  G V 21

 pp p pp p
p

P ( x )
 V  G cos(   )  B sin(   )
(13)
p
J  12
pq p pq p q pq p q
V q

P ( x ) P ( x )
(14)
p p
J   12
ppG V pp p
V V p p

Q ( x )
 V  G sin(   )  B cos(   ) 
(15)
p
J  22
pq p pq p q pq p q
V q

Q ( x ) Q ( x )
(16)
p p
J   B V 22
pp pp p
V V p p

I will derive two of the above.

Jpq11: The real power equation is:


 
n
Pp   V p Vk G pk cos( p   k )  B pk sin( p   k )
k 1

So the function we want to differentiate is:


f   P   V V  G cos(   )  B sin(   ) But -P is just a
n

p
k 1
p k pk
p p k pk p k

constant and so it will differentiate to 0, so


the derivative of the above will be the same
as the derivative of:
 
n
Pp ( x )   V p Vk G pk cos( p   k )  B pk sin( p   k )
k 1

To obtain Jpq11, we take derivative with


respect to the angle at bus q. In the
summation, there is only one term that
contains θq, and that is when k=q:
10
pq 
J 11
Pp ( x )
 q


 q
 
V p Vq G pq cos( p   q )  B pq sin( p   q )  Using

dcos(x)/dθq=-(dx/dθq)sin(x),
dsin(x)/dθq=(dx/dθq)cos(x), we obtain:
Pp ( x)
pq 
J 11  V p Vq  G pq sin( p   q )  B pq cos( p   q ) 
 q

Jpp11: As before, we are differentiating


 
n
Pp ( x )   V p Vk G pk cos( p   k )  B pk sin( p   k )
k 1

To obtain Jpp11, we take derivative with


respect to the angle at bus p. Note that in the
summation, every term contains θp. In
addition, the term corresponding to k=p
contains two instances of θp. So let’s pull out
this term to obtain:
Pp ( x)  Vp G pp cos( p  p )  Bpp sin( p   p )
2

  Vp Vk G pk cos( p   k )  Bpk sin( p  k ) 


n

k 1
k p

 Vp G pp   Vp Vk Gpk cos( p  k )  Bpk sin( p  k ) 


n
2

k 1
k p

Now differentiate:
J 11pp 
Pp ( x )   2
 n
 


  V G   V V G cos( p   k )  Bpk sin( p   k ) 
 p  p  p pp k1 p k pk 
 k p 

  
n
 V p Vk G pk cos( p   k )  B pk sin( p   k )
k 1  p
k p

 
n
  V p Vk  G pk sin( p   k )  B pk cos( p  k )
k 1
k p

 
n
   V p Vk G pk sin( p   k )  Bpk cos( p   k )
k 1
k p

Compare the above term with the reactive


power flow equation:
 
n
Q p   V p Vk Gik sin( p   k )  B pk cos( p   k )
k 1

What we notice is that Jpp11 is the negative of


Qp, but without the term corresponding to
k=p, that is:

11
G     
n
J 11
pp   
k 1
V p Vk pk sin( p  k )  B pk co s( p  k )
k  p

  
 Q
 p  V p
2
G pp sin(  p   p )  B pp cos(  p   p )  


  
 Q
 p  V p
2
  B pp  


 Q p  V p
2
 B pp 

12

You might also like