Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Учебники / 0841558_16EA1_federico_milano_power_system_modelling_and_scripting

.pdf
Скачиваний:
72
Добавлен:
08.06.2015
Размер:
6.72 Mб
Скачать

76

4 Power Flow Analysis

if system.DAE.factorize:

 

F = symbolic(A)

 

system.DAE.factorize

= False

try:

N = numeric(A, F) solve(A, N, inc)

except:

print ’Unexpected symbolic factorization’ F = symbolic(A)

solve(A, numeric(A, F), inc)

return -inc

def powerflow():

"""main power flow routine"""

#general settings iteration = 1

iter max = system.Settings.pf max iter convergence = True

tol = system.Settings.tol system.Settings.error = tol + 1 err vec = []

#main loop

while system.Settings.error > tol and iteration <= iter max:

inc = calcInc() system.DAE.y += inc

system.Settings.error = max(abs(inc)) err_vec.append(system.Settings.error)

msg =

’Iteration = %3d

Max. Convergence Error = %8.7f’ \

 

% (iteration, system.Settings.error)

print

msg

 

 

iteration

+= 1

 

# stop if

the error increases too much

if iteration > 4 and err vec[-1] > 1000*err vec[0]:

print

’The error is increasing too much’

print

’Convergence

is likely not reachable’

convergence = False break

if iteration > iter_max:

print ’Reached maximum number of iterations’ convergence = False

4.4 Power Flow Solvers

77

The proposed code is fully independent from the system model. As discussed in Script 3.2 of Chapter 3, g(i) and g(yi) are calculated by means of the statement exec system.Device.call pf, which updates the vector system.DAE.g the matrix and system.DAE.Gy using the current value system.DAE.y. The class system.Device works as an interface between the power flow routine and the classes that define system devices. For further details on the class system.Device see Script 3.2 of Chapter 3.

The function symbolic symbolically factorizes the power flow Jacobian matrix. If the number and the position of non-zero elements of the Jacobian matrix do not change, the symbolic factorization is needed only once, which allows saving CPU time. The symbolic re-factorization is needed, for example, each time a PV generator reaches a reactive power production limit. The code also handles an exception in case the Jacobian matrix has changed unexpectedly. This exception generally occurs if the Jacobian matrix is badly conditioned and it is thus a symptom of convergence issues. Finally, the list err vec allows stopping the algorithm in case the variable increment anomalously increases.

4.4.3Power Flow Jacobian Matrix

For the classical power flow problem (4.16) written in polar form, it is common practice to order variables y so that bus voltage angles are grouped together and come before bus voltage magnitudes:

y = [θT , vT ]T

(4.43)

In the same vein, equations g are organized grouping together active power mismatches first and then reactive power ones:

g = [gpT , gqT ]T

(4.44)

With these assumptions, the Jacobian matrix gy can be written as:

gy =

gp,θ gp,v

(4.45)

gq,θ gq,v

 

 

where gp,θ = Tθ gp, gp,v = Tv gp, gq,θ = Tθ gq , and gq,v = Tv gq .

The expressions for the elements of the Jacobian matrix ∂gp/∂y of (4.16) are:

78

 

 

 

4 Power Flow Analysis

 

∂gp,h

 

nb

 

 

 

 

 

 

 

 

 

= −vhvk

(ghk sin θhk − bhk cos θhk )

(4.46)

 

∂θh

 

∂gp,h

 

k=h

 

 

 

= vhvk (ghk sin θhk − bhk cos θhk)

 

 

∂θk

 

 

∂gp,h = 2vhghh + vk

nb

 

 

(ghk cos θhk + bhk sin θhk )

 

 

 

 

 

 

 

∂vh

k=h

∂gp,h = vh(ghk cos θhk + bhk sin θhk )

∂vk

and the elements of the Jacobian matrix ∂gq /∂y of (4.16) are:

∂gq,h

 

nb

 

 

 

 

 

 

 

 

= −vhvk

(ghk cos θhk + bhk sin θhk )

(4.47)

∂θh

∂gq,h

 

k=h

 

 

= vhvk (ghk cos θhk + bhk sin θhk )

 

∂θk

 

 

 

 

 

∂gq,h

 

 

nb

 

 

 

 

 

 

 

= 2vhbhh − vk

(ghk sin θhk − bhk cos θhk )

 

∂vh

 

∂gq,h

 

 

k=h

 

= −vh(ghk sin θhk − bhk cos θhk )

 

∂vk

 

An advantage of the vectorial notation is that (4.46) and (4.47) can be written very compactly as exemplified in the following script.

Script 4.3 Power Flow Jacobian Matrix

The following Python code implements (4.46) and (4.47) without using for-loops:

def build_gy(self, dae):

Vn = exp(dae.y[self.a]*1j)

Vc = mul(dae.y[self.v] + 0j, Vn)

Ic = self.Y*Vc

nb = len(self.a)

diagVn = spmatrix(Vn, self.a, self.a, (nb, nb), ’z’) diagVc = spmatrix(Vc, self.a, self.a, (nb, nb), ’z’) diagIc = spmatrix(Ic, self.a, self.a, (nb, nb), ’z’)

dS = self.Y*diagVn dS = diagVc*dS.H.T

dS += diagIc.H.T*diagVn

dR = diagIc

dR -= self.Y*diagVc

4.4 Power Flow Solvers

 

 

 

 

79

Table 4.2 Base case power flow results for the IEEE 14-bus system

 

 

 

 

 

 

 

 

 

 

Bus

v

θ

pG

qG

pL

qL

 

 

h

[pu]

[rad]

[pu]

[pu]

[pu]

[pu]

 

 

 

 

 

 

 

 

 

 

1

1.06

0

2.324

0.1655

0

0

 

 

2

1.045

0.0870

0.4

0.4356

0.217

0.127

 

 

3

1.01

0.2221

0

0.2507

0.942

0.19

 

 

4

1.018

0.18

0

0

0.478

0.039

 

 

5

1.02

0.1531

0

0

0.076

0.016

 

 

6

1.07

0.2482

0

0.1273

0.112

0.075

 

 

7

1.062

0.2332

0

0

0

0

 

 

8

1.09

0.2332

0

0.1762

0

0

 

 

9

1.056

0.2607

0

0

0.295

0.0459

 

 

10

1.051

0.2635

0

0

0.09

0.058

 

 

11

1.057

0.2581

0

0

0.035

0.018

 

 

12

1.055

0.2631

0

0

0.061

0.016

 

 

13

1.05

0.2645

0

0

0.135

0.058

 

 

14

1.036

0.2798

0

0

0.149

0.05

 

 

 

 

 

 

 

 

 

 

 

Totals

 

 

2.7239

0.8244

2.59

0.5232

 

dR = diagVc.H.T*dR

return sparse([[dR.imag(), dR.real()], [dS.real(), dS.imag()]])

where self.a and self.v are the indexes of all bus voltage phase angles and magnitudes, respectively, nb is the number of network ac buses and self.Y

¯

contains the admittance matrix Y . As explained above, the notation mat.H.T indicates the transpose of mat. The code above is written as a method of the class that describe transmission lines (see Chapter 11).

Example 4.1 Power Flow Analysis of the IEEE 14-Bus system

The results of the power flow analysis can be conveniently presented in tabular form. For example the base case power flow solution of the IEEE 14-bus system are shown in Table 4.2. Once all bus voltages are known, any other variable of the system can be straightforwardly computed. For example, active and reactive flows as well as losses in transmission lines and transformers are typically included in the power flow report, as shown in Table 4.3.

Example 4.2 Region of Attraction of the Power Flow Solution

Whatever method is used for solving the power flow problem, a good initial guess y(0) is needed to start the iterative process. Typically a flat start is an acceptable initial guess, i.e., load voltage magnitudes are set to 1 pu and all voltage phase angles are set equal to the reference (e.g., 0 rad) [296].

Table 4.3 Base case branch power flows for the IEEE 14-bus system

 

Branch

 

From

To

phk

pkh

qhk

qkh

ploss

qloss

 

 

 

 

bus h bus k

[pu]

[pu]

[pu]

[pu]

[pu]

[pu]

 

 

 

 

 

1

 

 

 

2

 

1.526

0.204

0.2768

0.0430

0.07272

 

 

 

 

 

 

 

 

1

1.569

 

 

2

 

1

5

0.7551

0.7275

0.0386

0.02229

0.0276

0.06084

 

 

3

 

2

3

0.7324

0.7091

0.0356

0.01602

0.02323

0.05162

 

 

4

 

2

4

0.5613

0.5445

0.0155

0.0302

0.0168

0.0147

 

 

 

 

5

 

2

5

0.4152

0.4061

0.0117

0.0210

0.0090

0.0093

 

6

 

3

4

0.2329

0.2366

0.0447

0.0484

0.0037

0.00363

 

 

 

 

7

 

4

5

0.6116

0.6167

0.1582

0.142

0.0051

0.0162

 

 

8

 

4

7

0.2807

0.2807

0.0968

0.1138

0

0.0170

 

 

9

 

4

9

0.1608

0.1608

0.0043

0.0173

0

0.0131

 

 

10

 

5

6

0.4409

0.4409

0.1247

0.0805

0

0.0442

 

 

11

 

6

11

0.0735

0.0730

0.0356

0.0345

0.0006

0.0012

 

 

12

 

6

12

0.0779

0.0771

0.0250

0.0235

0.0007

0.0015

 

 

13

 

6

13

0.1775

0.1754

0.0722

0.0680

0.0021

0.0042

 

 

14

 

7

8

0

0

0.1716

0.1762

0

0.0046

 

 

15

 

7

9

0.2807

0.2807

0.0578

0.0498

0

0.0080

 

 

16

 

9

10

0.0523

0.0522

0.0422

0.0419

0.00013

0.0003

 

 

17

 

9

14

0.0943

0.0931

0.0361

0.0336

0.00116

0.0025

 

 

18

 

10

11

0.03785

0.0380

0.0162

0.0165

0.00013

0.0003

 

 

19

 

12

13

0.0161

0.0161

0.0075

0.0075

0

0

 

 

20

 

13

14

0.0564

0.0559

0.0175

0.0164

0.0005

0.0011

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Totals

 

 

 

 

 

 

 

 

0.1339

0.3012

 

 

 

 

 

 

 

 

 

 

 

 

 

 

80

Analysis Flow Power 4

4.4 Power Flow Solvers

81

1

2

 

z¯ = 0.01 + j0.1 pu

v¯1 = 1.0 + j0 pu

s¯2 = 0.9 + j0.6 pu

Fig. 4.4 2-bus system

Although the flat start works in the majority of the cases, convergence is never guaranteed.

In theory, the only way to know if a given initial guess is adequate for obtaining a solution y0 of (4.8) is to determine the region of attraction of y0. At this regard, the initial guess can be of three types:

1.The initial guess is inside the region of attraction of the solution y0 and the numerical method converges.

2.The initial guess is outside the region of attraction of the solution y0. Numerical methods typically diverge if one starts with such initial guess.

3.Although the initial guess is within the region of attraction, the numerical method diverges.

This example focuses on initial guesses of the first and second type, whereas the latter case implies some interesting mathematical issues that are discussed in Section 4.5.

Unfortunately, an analytical definition of the region of attraction is not possible. Thus, only numerical methods can be used. A simple way to determine the region of attraction of a given solution y0 is to generate a huge number of initial guesses and solve (4.8) for each initial guess. As example, consider the 2-bus system depicted in Figure 4.4. All power flow data are indicated in this figure. To define the region of attraction of the solution v¯2,0 = 0.9209 − j0.0913 pu, one can create a grid of initial guesses and solve for each pair (θ2(0), v2(0)) the power flow problem using the Newton’s method.

The resulting map is depicted in Figure 4.5. Contour labels indicate the number of iterations needed to get the solution while black regions means that the method does not converge. The region of attraction is quite wide and the standard flat start v¯2(0) = 1.0 + j0 pu falls within the region that requires less iteration to converge. It is important to note that the region of attraction depends on the solution method. Di erent algorithms are characterized by di erent region of attractions.

The method discussed above is extremely costly8 and cannot be used for real size systems. For example, the map of Figure 4.5 was obtained using a grid of 1000 × 1000 initial guesses, e.g., solving the power flow problem one

8The computational burden is similar to that of computing Julia’s or Mandelbrot’s sets.

82

4 Power Flow Analysis

 

 

 

 

 

 

Fig. 4.5 Region of attraction of the Newton’s method for a 2-bus system. Contour labels indicate the number of iteration needed to obtain the solution within a tolerance of 105

million times. The interested reader can find further discussion on the region of attraction of power flow solutions in [219].

4.4.4Robust Newton’s Method

For well-conditioned cases, the standard Newton’s method generally converges in 4-5 iterations. Most books on numerical techniques warn about the possibility that the Newton’s technique can cycle around the solution without actually never getting to the solution. Figures 4.3.c and 4.3.d illustrate two ill-conditioned cases by means of a scalar function g(y).

A power flow example that shows a behavior similar to ones depicted in Figures 4.3.c and 4.3.d is quite rare indeed. However, there are idiosyncratic cases for which the Newton’s technique fails to converge. A variety of robust variations of the basic Newton’s method have been proposed in the literature for solving ill-conditioned cases [27, 29, 149, 150, 270, 304, 317]. The majority of these techniques mainly consist in modifying the first equation of (4.40) as follows:

y(i) = −α[gy(i)]1g(i)

(4.48)

4.4 Power Flow Solvers

83

g(y)

g(y)

gy

gy

 

αgy

y

y

gy

 

(a)

(b)

Fig. 4.6 Geometrical interpretation of the robust Newton’s method for a scalar function g(y). (a) standard method and (b) robust method

where α is a factor that improves the convergence properties of the iterative process. If α is the result of an optimization process, α is called optimal multiplier. The geometrical interpretation of robust Newton’s methods is shown in Figure 4.6.

It is important not to confuse ill-conditioned cases with those that are unsolvable since the solution does not exist (see Figure 4.3.b). Robust solvers are useful in case of ill-conditioned systems but do not generally work well for unsolvable cases. Unsolvable cases are better tackled using the continuation power flow technique described in Chapter 5.

At a given iteration i, the optimal value of α is the one that minimizes the maximum power mismatch max{|g(y(i+1))|}. Since the maximum power mismatch at the iteration i + 1 is not known a priori, one has to iterate over α. However, it is not necessary to find the optimum. A simple, yet quite robust method is the bisection method, as follows.

1.Set α 1.

2.Compute max{|g(y(i+1))|}.

3.If max{|g(y(i+1))|} ≤ max{|g(y(i))|}, continue with the next iteration, otherwise set α 0.5 · α and go back to step 2.

For unsolvable cases, α → 0, thus one has to fix a minimum value for α.

Script 4.4 Robust Newton’s method

The following Python code illustrates this simple robust method:

inc = alpha*calcInc() error = max(abs(inc))

if error > error_old: alpha *= 0.5

84 4 Power Flow Analysis

if alpha < tol:

fm_disp(’The optimal multiplier is too small.’) iteration = iter_max + 1

break

else:

system.DAE.y += inc error_old = error alpha = 1.0

In the previous code, it is assumed that calcInc() returns y(i). Clearly, the previous code has to be inserted within the main power flow loop.

4.4.5Iwamoto’s Method

More sophisticate methods attempt to estimate max{|g(y(i+1))|}. For the sake of example, this subsection describes the Iwamoto’s method, that is one of the firstly proposed robust power flow methods [149]. With this aim, consider the Taylor’s expansion of (4.8) at the ith iteration:

g(y) = g(i) + gy(i) y(i) + g( y(i))

(4.49)

In (4.49) the correction vector y(i) is not known. In order to optimize the length of y(i), a factor α is included in (4.49), as follows:

g(y) = g(i) + gy(i)αΔy(i) + g(αΔy(i))

(4.50)

Assuming the rectangular form (4.18) of power flow equations:

g(αΔy(i)) = α2g(

y(i))

(4.51)

Thus (4.49) is a quadratic equation with respect to α:

 

d(α) = c0 + c1α + c2α2

(4.52)

where:

 

 

c0 = g(i), c1 = gy(i) y(i),

c2 = g( y(i))

(4.53)

It is relevant to note that, from (4.40), one has c1 = −c0. The optimal value of α is determined minimizing the following cost function:

 

1

 

κ(α) =

2 d(α)T d(α)

(4.54)

In this case, the KKT conditions simply give:

∂κ

= 0

g0 + g1α + g2α2 + g3α3 = 0

(4.55)

∂α

4.4 Power Flow Solvers

85

where:

 

 

 

 

 

 

 

 

 

g0

= cT c1,

g1

= cT c1

+ 2cT c2,

g2

= 3cT c2,

g3

= 2cT c2

(4.56)

 

0

 

1

0

 

1

 

2

 

Since (4.55) is a cubic scalar polynomial, the Cardan’s formula provides the analytical solution:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

α = a1 + 3

a2 + a3

+ 3

a2 − a3

 

(4.57)

where:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

a

1

=

g2

 

a

2

= a3

+

g2g1 3g3g0

(4.58)

3g3

 

 

 

 

 

1

 

 

 

6g32

 

 

 

 

 

 

 

 

 

 

 

g1

 

a3 = a22 + (a4 − a12)3

a4 =

 

3g3

 

 

An issue of the Iwamoto’s method is that the optimal multiplier α decreases as y converges to the solution, thus the Iwamoto’s method typically converges slowly.

4.4.6Inexact and Dishonest Newton’s Methods

One of the most relevant drawbacks of the Newton’s method is the need of factorizing the full Jacobian matrix at each iteration. From the computational point of view, the factorization of a matrix is an order N 3 operation, i.e., the computational weight increases with the cube of the size N of the matrix. The computational e ort can be reduced to N 1.5 if using sparse matrices techniques, which allows saving a considerable time for large systems (e.g., thousands of buses). However, the Jacobian matrix factorization remains the most critical issue of the Newton’s method (about 85% of the total CPU time for networks with thousands of buses). Thus, in the literature, there are a variety of proposals for reducing as much as possible the computational e ort of the Jacobian matrix factorization.

A family of methods based on the Generalized Minimal Residual (GMRES) method are [54, 97, 275]. The GMRES is a particular case of Krylov’s subspace approaches and attempts to minimize (4.21) by minimizing the residual:

r(y) = b − Ay

(4.59)

For the power flow problem, b = g(i) and A = g(yi). Since A and b are not constant, the residual r in (4.59) has to be minimized at each iteration. GMRES-based methods di er from the Gauss-Seidel’s method in that the latter does not compute the Jacobian matrix. Without entering into mathematical details, GMRES-based methods can be used for setting up the socalled inexact Newton’s methods. The term inexact comes from the fact that the power flow Jacobian matrix factorization is not computed exactly