Professional Documents
Culture Documents
Sparse Matrices?
Power Systems?
• Matrices in power systems are often very large and very sparse!
• A large matrix: is for instance of dimension 100x100,
1000x1000 or 10000x10000!
• A sparse matrix: A matrix where, for instance, 99% of the
elements are zero, but 1% are different from zero.
• Examples of these matrices are the Ybus matrix and the Jacobi-
matrix, which both are used in power flow calculations.
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 5
With the above assumption in the Ybus matrix there are 100 diagonal elements ≠ 0 and
150 elements above the diagonal and 150 elements below the diagonal ≠ 0. The
sparsity of this matrix will therefore be:
Similarly for a 1000 bus system we get a matrix with 1000 · 1000 elements. We
have for the same assumption of how each bus is interconnected for the Ybus matrix 1000
diagonal elements ≠ 0 and 1500 elements above the diagonal and 1500 elements
below the diagonal ≠ 0. The sparsity of this matrix will be:
∂δ i k =1, k ≠ i ∂δ i
= ∑
j =1, j ≠ i
∂Pi ∂Qi
= Vi Vk yik ⋅ sin (δ i − δ k − γ ik ) i≠k = − Vi Vk yik ⋅ cos (δ i − δ k − γ ik ) k ≠i
∂δ k ∂δ k
∂ Vi j =1, j ≠ i ∂ Vi j =1, j ≠ i
∂Pi ∂Qi
= Vi yik ⋅ cos (δ i − δ k − γ ik ) k ≠i = Vi yik ⋅ sin (δ i − δ k − γ ik )
∂ Vk k ≠i
∂ Vk
IEEE 14 BUS
TEST CASE
0
10
150 5 10 15
nz = 54
Use the SPY function in Matlab
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 12
10
15
20
25
30
0 5 10 15 20 25 30
nz = 112
10
20
30
40
50
0 10 20 30 40 50
nz = 213
20 (Ybus)
40
60
80
100
0 20 40 60 80 100
nz = 476
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 15
0
(Ybus)
50
100
150
200
10
20
30
40
50
60
70
80
90
100
0 10 20 30 40 50 60 70 80 90 100
nz = 346
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 20
Solutions to the power system problem with
sparse matrices
• For large systems (and power systems are
large) we need to exploit the sparsity of the
system matrices
• Therefore solutions to power flow problem with Newton’s method
involves solution to a set of linear equations rather than direct
inversion of matrices
• We use Gauss elimination as a standard set of solving large
linear systems of equations where we exploit simultaneously the
sparsity structure of the system matrix (Jacobi)
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 21
Sparse Matrices and Solutions to Sets of Linear
Equations in Power Systems
⎡ a1,1 a1,2 a1, n ⎤ ⎡ x1 ⎤ ⎡ b1 ⎤
⎢a a2,2 ⎥
a2, n ⎥ ⎢ x2 ⎥ ⎢b2 ⎥
⎢ 2,1 ⋅⎢ ⎥ = ⎢ ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢⎣ an ,1 an ,2 an , n ⎥⎦ ⎢⎣ xn ⎥⎦ ⎢⎣bn ⎥⎦
A⋅x = b
⎡ a1,1 a1,2 a1,n ⎤ ⎡ x1 ⎤ ⎡ b1 ⎤
⎢a a2,n ⎥⎥ ⎢x ⎥ ⎢b ⎥
⎢ 2,1 a2,2
A= x = ⎢ 2⎥ b = ⎢ 2⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢⎣ an ,1 an ,2 an ,n ⎥⎦ ⎣ xn ⎦ ⎣ bn ⎦
A is a known matrix
x is a vector with unknown
variables. b is a known vector.
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 23
Solution methods for linear equations based on
numerical analysis
Direct methods
Gaussian elimination
Gauss-Jordan elimination
LU factorization
Cholesky factorization
Iterative methods
Jacobi iterations
Gauss-Seidel iteration
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 24
Back Substitution
⎡ a1,1 a1,2 a1, n ⎤ ⎡ x1 ⎤ ⎡ b1 ⎤
⎢0 a2, n ⎥⎥ ⎢ x2 ⎥ ⎢b2 ⎥
⎢ a2,2 an − 2,n − 2 xn − 2 + an − 2,n −1 xn −1 + an − 2,n xn = bn − 2
⋅⎢ ⎥ = ⎢ ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥ ⎢ ⎥ bn − 2 − an − 2,n xn − an − 2,n −1 xn −1
⎢⎣ 0 0 an , n ⎥⎦ ⎢⎣ xn ⎥⎦ ⎢⎣bn ⎥⎦ xn − 2 =
an − 2 , n − 2
The 3rd line from
an ,n xn = bn The last line n the end
xn =
bn bk − ∑a
j = k +1
k, j xj
an , n The second last line xk =
ak , k
an −1,n −1 xn −1 + an −1,n xn = bn −1
b1 − a1, 2 x2 − a1,3 x3 − … − a1,n xn
bn −1 − an −1,n xn x1 =
xn −1 = a1,1
an −1,n −1
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 27
Solution method
• How do we get any matrix to a triangular form?
• Transform the matrix by Gauss elimination to a lower
triangular form matrix
• Solve such a matrix by back substitution
st
Gaussian Elimination (1 step)
The original matrix: ⎡ a1,1 a1,2 a1,3 a1, n ⎤
⎢a a2,2 a2,3 a2, n ⎥⎥
⎢ 2,1
⎢ a3,1 a3,2 a3,3 ⎥
⎢ ⎥
Multiply the 1st row a2,1 ⎢ ⎥
with a2,1/a1,1 and ⎢ an ,1 an , n ⎥⎥⎦
a1,1 ⎢⎣ an ,2 an ,3
subtract from the 2nd row
⎡ a1,1 a1,2 a1,3 a1, n ⎤
⎢ a2,1 a2,1 a2,1 ⎥
Multiply the 1st row ⎢0 a2,2 − ⋅ a1,2 a2,3 − ⋅ a1,3 a2, n − ⋅ a1, n ⎥
⎢ a1,1 a1,1 a1,1 ⎥
with a3,1/a1,1 and ⎢ ⎥
⎢ a3,1 a3,1 a ⎥
subtract from the 3rd row ⎢0 a3,2 −
a1,1
⋅ a1,2 a3,3 −
a1,1
⋅ a1,3 a3, n − 3,1 ⋅ a1, n ⎥
a1,1
⎢ ⎥
⎢ ⎥
⎢ ⎥
Multiply the 1st row ⎢0 ⋅ a1, n ⎥⎥
an ,1 an ,1 an ,1
⎢ an ,2 − ⋅ a1,2 an ,3 − ⋅ a1,3 an , n −
with an,1/a1,1 and ⎣⎢
a1,1 a1,1 a1,1 ⎥⎦
subtract from the last row
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 29
nd
Gaussian Elimination (2 step)
The matrix after the 1st step:
⎡ a1,2 a1,2 a1,3 a1, n ⎤
Now the 2nd row plays the same role⎢ ⎢ 0
(1)
a2,2 (1)
a2,3 a2,(1)n ⎥
⎥
⎢ ⎥
as the 1st row before: ⎢
⎢ 0 an(1)−1,2 an(1)−1,3 an(1)−1, n ⎥
⎥
⎢ 0 an(1),2 an(1),3 an(1), n ⎥⎥⎦
⎢⎣
Multiply the 2nd row
with a3(1, 2)
(1) ⎛ a1,1 a1,2 a1,3 a1, n ⎞
a 2, 2 ⎜ (1) (1) ⎟
⎜ 0 a2,2 a2,3 a2,(1)n ⎟
and subtract from ⎜ (1) (1) ⎟
a3,2 a3,2
the 3rd row ⎜ 0 0 a (1)
− ⋅ a2,3
(1) (1) ⎟
a3, n − (1) ⋅ a2, n
(1)
⎜ ⎟
3,3 (1)
a 2,2 a2,2
⎜ ⎟
Multiply(1the 2 nd row ⎜ ⎟
⎜ an(1),2 an(1),2 (1) ⎟
an , )2
with (1) ⎜ 0 0 a (1)
− ⋅ a2,3
(1)
an , n − (1) ⋅ a2, n ⎟
(1)
⎜ ⎟
n ,3 (1)
a a2,2
a2 , 2 ⎝ 2,2
⎠
and subtract from
the last row
Lecture 20 Power Engineering - Egill Benedikt Hreinsson 31
rd
Gaussian Elimination (3 step)
Gaussian Elimination