70 numerical integration techniques
TRANSCRIPT
-
8/4/2019 70 Numerical Integration Techniques
1/51
NUMERICAL INTEGRATIONNUMERICAL INTEGRATION
TECHNIQUESTECHNIQUES
Applications to power system
reated ByNIRMAL PATEL
uided ByS.G.
-
8/4/2019 70 Numerical Integration Techniques
2/51
2
OutlineOutline
Introduction One Step Methods
Forward Eulers Method
Backward Eulers Method Trapezoidal Method Taylor series based Methods Runge-Kutte Method
2nd order
4th
order Accuracy & Error Analysis Stability Analysis Stiff systems Power System Applications
Transient stability Analysis
-
8/4/2019 70 Numerical Integration Techniques
3/51
3
IntroductionIntroduction
In power systems,1. Some times analytical formulae for
integration i.e. is notavailable .2. Some times we dont know the
functional form and have only a
set of tabulated data points.n both cases it is necessaryo use numerical methods to.valuate the integrals
-
8/4/2019 70 Numerical Integration Techniques
4/51
4
Mathematics 101Mathematics 101
Mean Value Theorem:-Mean Value Theorem:- If a function is continuous & differentiable between two
points, say (x1 , y1) & (x2 , y2), then the slope of the linejoining these points is equal to the derivative of the function at
least at one other point, say (a , b), between these two points,i.e...
&If th e n w e ca n d e riv e th e..E u le r's E q u a tio n
-
8/4/2019 70 Numerical Integration Techniques
5/51
5
One Step MethodOne Step Method
These methods allow us to vary the stepsize.
Use only one initial value After each step is completed the past step
is forgotten We do not use thisinformation.
:T h e te ch n iq u e s a re d e fin e d a s
-
8/4/2019 70 Numerical Integration Techniques
6/51
6
F o r w a r do r w a r d u l e r s M e t h o du l e r s M e t h o dConsider the First order ODE
With an initial condition
Then the (i+1)th point of the solution
is obtained from the ith point usingthe following formula
-
8/4/2019 70 Numerical Integration Techniques
7/517
GeometricalGeometricalInterpretationInterpretation
X
Y
C
B
A
..
-
8/4/2019 70 Numerical Integration Techniques
8/518
ExampleExample
Let f=y y(0)=1.
For i=1 y1=1+(0.01*1)
y1=1.01NEW INITIAL POINT:-
(x1,y1)=(0.01,1.01)Similarly we will go until desired x as we can
see the step 1 will be forgotten & newinitial point will be (x1,y1).
The complete solution is given in next slide.
-
8/4/2019 70 Numerical Integration Techniques
9/519
O N T IN U E D O N T IN U E Di h=0.01 h=0.005
xi yi xi yi1 0.01 1.01 0.005 1.0050
2 0.02 1.0201 0.010 1.01003 0.03 1.030301 0.015 1.051
4 0.04 1.040606 0.020 1.0202
5 0.05 1.05101206 0.025 1.0253
6 - - 0.030 1.0304
7 - - 0.035 1.03568 - - 0.040 1.0408
9 - - 0.045 1.046004
10 - - 0.05 1.05123402
-
8/4/2019 70 Numerical Integration Techniques
10/5110
CONTINUEDCONTINUED
Since the exact solution of this equation is y= ex, the correct value at x = 0.05 is1.05127109. It is clear that, to obtain more accuracywith Eulers forward method, we must take aconsiderably smaller value for h. These results are correct to four decimalplaces after the decimal point. Because of therelatively small step size required, Eulersmethod is not commonly used for integratingdifferential equations. We could, of course, apply Taylorsalgorithm of higher order to obtain betteraccuracy, and in general, we would expectthat the higher the order of the algorithm, the
-
8/4/2019 70 Numerical Integration Techniques
11/5111
Backward EulersBackward EulersMethodMethod
Consider the First order ODE
With an initial condition
Then the (i+1)th point of the solution
is obtained from the ith point usingthe following formula
-
8/4/2019 70 Numerical Integration Techniques
12/5112
ExampleExample
Let f=y y(0)=1.
where 0
-
8/4/2019 70 Numerical Integration Techniques
13/5113
CONTINUEDCONTINUED
Solution table is given herei h=0.005
xi yi
1 0 12 0.005 1.0050253 0.01 1.0100754 0.015 1.01515125 0.02 1.02025252
6 0.025 1.025379417 0.03 1.030532088 0.035 1.0357106339 0.04 1.04091520910 0.045 1.04614593811 0.05 .1 0 5 1 4 0 2 9 5 3
-
8/4/2019 70 Numerical Integration Techniques
14/5114
CONTINUEDCONTINUED
Since the exact solution of thisequation isy = ex, the correct value at x= 0.05 is 1.05127109. It is clear that, we can obtain moreaccuracy with Eulers Backward methodw.r.t. Forward Eulers method. These results are correct to four
decimal places after the decimal point.Because it is relatively Implicit, Eulersbackward method is not commonly usedfor integrating differential equations.
-
8/4/2019 70 Numerical Integration Techniques
15/51
15
ra p e z o id a l M e th o dra p e z o id a l M e th o dConsider the First order ODE
With an initial condition
Then the (i+1)th point of the solution
is obtained from the ith point usingthe following formula
-
8/4/2019 70 Numerical Integration Techniques
16/51
16
ExampleExample
Let f=y y(0)=1.
where 0
-
8/4/2019 70 Numerical Integration Techniques
17/51
17
CONTINUEDCONTINUED
For i=1 First we predict the value of y1 by Eulersforward method.
y1=1+(0.005*1) y1=1.005
Also X1=0.005 So the corrected value of y1is given by:-
1=1.005038
-
8/4/2019 70 Numerical Integration Techniques
18/51
18
CONTINUEDCONTINUED
i xi yi1 0 1
2 0.005 1.005013
3 0.01 1.010050
4 0.015 1.015113
5 0.020 1.020201
6 0.025 1.025315
7 0.030 1.030454
8 0.035 1.0356199 0.040 1.040810
10 0.045 1.046028
11 0.050 1.051271
-
8/4/2019 70 Numerical Integration Techniques
19/51
19
SummarySummary
Trap Rule, Forward-Euler, Backward-Euler
All are one-step methods as xk+1 is
computed using only xk
, not xk-1
, xk-2
, xk-
3...Forward-Euler is the simplest
As No equation solutionexplicit method.
Backward-Euler is more expensive Equation solution each step
implicit method most stable.
Trapezoidal Rule might be moreaccurate
-
8/4/2019 70 Numerical Integration Techniques
20/51
20
TaylorTaylorseriesseriesbasedbasedMethodsMethods
Numerical methods we saw earlier have anunderlying derivation from Taylors Theorem.
For IVP the solution by Taylor series is given by
where
-
8/4/2019 70 Numerical Integration Techniques
21/51
21
CONTINUEDCONTINUED
The Taylor series method is astraight forward adaptation ofclassic calculus to develop thesolution as an infinite series. Thecatch is that a computer usuallycan not be programmed to
construct the terms and one doesnot know how many terms shouldbe used.
The method is not strictly a
numerical method but is use in
-
8/4/2019 70 Numerical Integration Techniques
22/51
22
CONTINUEDCONTINUED
From the Taylor series expansionThe step size is defined as :Using the initial condition, the
higher order derivatives of theequation can be obtained.
( ) ( ) ( ) ( ) ( ) ( )+++++=
0
IV4
0
3
0
2
00 !4!3!2 xy
h
xy
h
xy
h
xyhxyxy
0xxh =
-
8/4/2019 70 Numerical Integration Techniques
23/51
23
ExampleExample
Let f=y=y
With initial condition y(0)=1.
The analytical solution is
( )x
exy =
-
8/4/2019 70 Numerical Integration Techniques
24/51
24
CONTINUEDCONTINUED
The higher order derivatives can befound with the initial condition,
y(0) = 1, and the equation( ) ( )
( ) ( )
( ) ( )
( ) ( )xyxy
xyxy
xyxy
xyxy
=
=
=
=
IV
( ) ( )
( ) ( )
( ) ( )
( ) ( ) 100
100
100
100
IV==
==
==
==
yy
yy
yy
yy
-
8/4/2019 70 Numerical Integration Techniques
25/51
25
CONTINUEDCONTINUED
From the Taylor series expansion
Plug in the initial conditions:
Resulting in the equation:
( ) ( ) ( ) ( ) ( ) ( ) +++++= 0IV
4
0
3
0
2
00 !4
!3
!2
xyh
xyh
xyh
xyhxyxy
( ) ( ) ( ) ( ) ( ) Error1!4
1!3
1!2
11432
+++++=hhh
hhy
( ) Error
24
6
2
1432
+++++=hhh
hhy
-
8/4/2019 70 Numerical Integration Techniques
26/51
26
CONTINUEDCONTINUED
h Secondy(h ) Thirdy(h ) Fourthy(h ) ExactSolution
0 1 1 1 1
0.01 1.01005 1.010050167 1.010050167 1.010050167
0.02 1.0202 1.020201333 1.02020134 1.02020134
0.03 1.03045 1.0304545 1.030454534 1.030454534
0.04 1.0408 1.040810667 1.040810773 1.040810774
0.05 1.05125 1.051270833 1.051271094 1.051271096
1 2.5 2.666666667 2.708333333 2.718281828
1.2 2.92 3.208 3.2944 3.320116923
1.4 3.38 3.837333333 3.9974 4.055199967
1.5 3.625 4.1875 4.3984375 4.48168907
2 5 6.333333333 7 7.389056099
The results
-
8/4/2019 70 Numerical Integration Techniques
27/51
27
-u n ge K ut tau n g e K u t t a M e t h o de t h o dRunge-Kutta methods are very popular
because of their good efficiency; and areused in most computer programs fordifferential equations. They are single-
step methods.Eulers method is not very useful in practicalproblems because it requires a very smallstep size for reasonable accuracy. Taylorsalgorithm of higher order is unacceptable
as a general-purpose procedure becauseof the need to obtain higher totalderivatives of y(x). The Runge-Kuttamethods attempt to obtain greateraccuracy, and at the same time avoid the
need for higher derivatives, by evaluatingthe function f(x,y) at selected points on
-
8/4/2019 70 Numerical Integration Techniques
28/51
28
22ndnd order RK methodorder RK method
To convey some idea of how theRunge-Kutta is developed, lets
look at the derivation of the2ndorder. Two estimates
( )
( )1nn2nn1
21n1n
,
,
kyhxhfk
yxhfk
bkakyy
++==
++=+
-
8/4/2019 70 Numerical Integration Techniques
29/51
29
CONTINUEDCONTINUED
( /T h e Ta y lo r se rie s co e fficie n ts 3 e q u a tio n s 4)u n k n o w n s
If you select a as
If you select a as
* : -Note These co efficient would result in a modified Euler or Midpoint Method
# : -Note These Co efficient are derived by mathematician Heun so this method is also
.known as Heun s method
[ ]2
1,
2
1,1 ===+ bbba
2
3,
2
3,
3
1,
3
2#
==== ba
1,2
1
2
1 *==== ba
-
8/4/2019 70 Numerical Integration Techniques
30/51
30
ExampleExample
Let f=y=y
With initial condition y(0)=1.
The analytical solutionis
The step size & co-efficient
( ) xexy =
1.0=h
2
3,
2
3,
3
1,
3
2==== ba
( )
( )[ ]
21i1i
1ii2
ii1
2
1,
,
kkyy
kyhxhfk
yxhfk
++=
++=
=
+
-
8/4/2019 70 Numerical Integration Techniques
31/51
31
CONTINUEDCONTINUED
x y exact k k1 k20 1 1 1.05 1 1.1
0.1 1.105 1.105171 1.16025 1.105 1.2155
0.2 1.221025 1.221403 1.282076 1.221025 1.3431275
0.3 1.349232625 1.349859 1.416694 1.349233 1.484155888
0.4 1.490902051 1.491825 1.565447 1.490902 1.639992256
0.5 1.647446766 1.648721 1.729819 1.647447 1.812191443
0.6 1.820428676 1.822119 1.91145 1.820429 2.0024715440.7 2.011573687 2.013753 2.112152 2.011574 2.212731056
0.8 2.222788925 2.225541 2.333928 2.222789 2.445067817
0.9 2.456181762 2.459603 2.578991 2.456182 2.701799938
1 2.714080847 2.718282 2.849785 2.714081 2.985488931
1.1 2.999059336 3.004166 3.149012 2.999059 3.298965269
1.2 3.313960566 3.320117 3.479659 3.313961 3.645356622
1.3 3.661926425 3.669297 3.845023 3.661926 4.028119068
1.4 4.0464287 4.0552 4.24875 4.046429 4.45107157
1.5 4.471303713 4.481689 4.694869 4.471304 4.918434085
1.6 4.940790603 4.953032 5.18783 4.940791 5.434869663
1.7 5.459573616 5.473947 5.732552 5.459574 6.005530978
1.8 6.032828846 6.049647 6.33447 6.032829 6.636111731
1.9 6.666275875 6.685894 6.99959 6.666276 7.332903463
2 7.366234842 7.389056 7.734547 7.366235 8.102858326
-
8/4/2019 70 Numerical Integration Techniques
32/51
44thth order RK methodorder RK method
( + )The i 1 thpoint of the solution is obtained fromthe ith point using the following formula
Where
( )This will result in a local error of O h5 and a( )global error of O h4
kyy ii +=+ 1
[ ]4321 226
1kkkkk +++=
-
8/4/2019 70 Numerical Integration Techniques
33/51
33
CONTINUEDCONTINUED
:The general form of the equations
[ ]
( )[ ]
( )[ ]34
23
12
1
4321
,
2
1,
2
1
2
1,
2
1
,
22
6
1
kyhxfhk
kyhxfhk
kyhxfhk
yxfhk
kkkkk
++=
++=
++=
=
+++=
-
8/4/2019 70 Numerical Integration Techniques
34/51
34
CONTINUEDCONTINUED
xi
x +/2
x + h
f 1
f 2
f 3f 4
( )432122
6
1
fffff +++=
f
-
8/4/2019 70 Numerical Integration Techniques
35/51
ExampleExample
Let f=y=y
With initial condition y(0)=1.
The analytical solution is
The step size & co-efficient
( )x
exy =
1.0=h
-
8/4/2019 70 Numerical Integration Techniques
36/51
36
CONTINUEDCONTINUED:The example of a single step
( )[ ] ( ) ( )
( )
( )
( )[ ] ( )
[ ] 105170833.1226
1
110525.010525.1,1.01.0,
10525.02/105.01,05.01.0
2
1,
2
1
105.005.1,05.01.021,
21
1.011.01,01.0,
4321n1n
34
23
12
1
=++++=
==++=
=+=
++=
==
++=
====
+kkkkyy
fkyhxfhk
fkyhxfhk
fkyhxfhk
fyxfhk
-
8/4/2019 70 Numerical Integration Techniques
37/51
37
CONTINUEDCONTINUEDxi yi k k1 k2 k3 k4 exact
0 1 0.105170833 0.1 0.105 0.10525 0.110525 1
0.1 1.105170833 0.116231738 0.110517083 0.116043 0.116319 0.122149 1.105171
0.2 1.221402571 0.128455926 0.122140257 0.128247 0.128553 0.134996 1.221403
0.3 1.349858497 0.141965743 0.13498585 0.141735 0.142073 0.149193 1.349859
0.4 1.49182424 0.156896399 0.149182424 0.156642 0.157015 0.164884 1.491825
0.5 1.648720639 0.173397323 0.164872064 0.173116 0.173528 0.182225 1.648721
0.6 1.822117962 0.191633665 0.182211796 0.191322 0.191778 0.20139 1.822119
0.7 2.013751627 0.211787937 0.201375163 0.211444 0.211947 0.22257 2.013753
0.8 2.225539563 0.23406185 0.222553956 0.233682 0.234238 0.245978 2.225541
0.9 2.459601414 0.25867833 0.245960141 0.258258 0.258873 0.271847 2.459603
1 2.718279744 0.285883746 0.271827974 0.285419 0.286099 0.300438 2.718282
1.1 3.00416349 0.315950378 0.300416349 0.315437 0.316188 0.332035 3.004166
1.2 3.320113868 0.349179142 0.332011387 0.348612 0.349442 0.366956 3.320117
1.3 3.66929301 0.385902604 0.366929301 0.385276 0.386193 0.405549 3.669297
1.4 4.055195614 0.426488302 0.405519561 0.425796 0.426809 0.4482 4.0552
1.5 4.481683916 0.471342432 0.448168392 0.470577 0.471697 0.495338 4.481689
1.6 4.953026348 0.520913909 0.495302635 0.520068 0.521306 0.547433 4.953032
1.7 5.473940256 0.575698858 0.547394026 0.574764 0.576132 0.605007 5.473947
1.8 6.049639115 0.636245587 0.604963911 0.635212 0.636725 0.668636 6.049647
1.9 6.685884702 0.703160066 0.66858847 0.702018 0.703689 0.738957 6.685894
2 7.389044767 0.777111996 0.738904477 0.77585 0.777697 0.816674 7.389056
-
8/4/2019 70 Numerical Integration Techniques
38/51
38
CONTINUEDCONTINUED
The values are equivalent to.those of the exact solution If
= .we were to go out to x 5
( ) =y 5 .148 4131591( .148 4125901 )
The error is small relative to.the exact solution
-
8/4/2019 70 Numerical Integration Techniques
39/51
39
CONTINUEDCONTINUEDA comparison between the 2ndorder and the 4th -order Runge Kutta
.methods show a slight difference
-
8/4/2019 70 Numerical Integration Techniques
40/51
40
Methods ComparisonMethods Comparison
Metho
Euler
( )[ ]yxfhk
kk
,1
1
==
[ ]
( )[ ]
( )[ ]12
1
21
,
,
2
1
kyhxfhk
yxfhk
kkk
++==
+=
[ ]
( )[ ]
++=
++=
=
+=
23
12
1
31
3
2,
3
2
3
1,
3
1
,
34
1
kyhxfhk
kyhxfhk
yxfhk
kkk
[ ]
( )[ ]
( )[ ]34
23
12
1
4321
,
2
1,
2
1
2
1,
2
1
,
226
1
kyhxfhk
kyhxfhk
kyhxfhk
yxfhk
kkkkk
++=
++=
++=
=
+++=
Stiffness & StiffStiffness & Stiff
-
8/4/2019 70 Numerical Integration Techniques
41/51
41
Stiffness & StiffStiffness & StiffSystemsSystems
A stiff system is one involving rapidly changingcomponents together with slowly changingones.
An example of a single stiff ODE is:
whose solution if y(0)=0 is:
dy
dt=1000 y+3000 2000 e
t
y=30.998e1000t2.002e
t
Transient StabilityTransient Stability
-
8/4/2019 70 Numerical Integration Techniques
42/51
42
Transient StabilityTransient StabilityAnalysisAnalysis
For transient stability analysis weneed to consider three systems
1.Prefault - before the fault occurs thesystem is assumed to be at anequilibrium point
2.Faulted - the fault changes the
system equations, moving thesystem away from its equilibriumpoint
3.Postfault - after fault is cleared the
Transient Stability SolutionTransient Stability Solution
-
8/4/2019 70 Numerical Integration Techniques
43/51
43
Transient Stability SolutionTransient Stability SolutionMethodsMethods
There are two methods for solving thetransient stability problem
1.Numerical integration
l this is by far the most common technique,particularly for large systems; during thefault and after the fault the powersystem differential equations are solvedusing numerical methods
2.Direct or energy methods; for a two bussystem this method is known as theequal area criterial mostly used to provide an intuitive insight
into the transient stability problem
-
8/4/2019 70 Numerical Integration Techniques
44/51
44
ExampleExample
A 60 Hz generator is supplying 550 MW to an infinite bus(with 1.0 per unit voltage) through two paralleltransmission lines. Determine initial angle change for afault midway down one of the lines.H = 20 seconds, D = 0.1. Use t=0.01 second.
-
8/4/2019 70 Numerical Integration Techniques
45/51
45
CONTINUEDCONTINUED
We first need to determine the Pre-faultvalues.
Since P= 550 MW (5.5 pu) I=5.5
Next to get we need to determinethe thevenin equivalent during the fault
looking into the network from thegenerator
8.28141.15.5*1.00.1 =+= jEa
)(eP
08333.01.0||05.005.0 jjjjZth =+=03333.0 =thV
-
8/4/2019 70 Numerical Integration Techniques
46/51
46
CONTINUEDCONTINUED
Therefore prefault we have andAlso during the fault
Let and The Equation tointegrate are
and
-
8/4/2019 70 Numerical Integration Techniques
47/51
47
CONTINUEDCONTINUED
Now
With Eulers Method we get
-
8/4/2019 70 Numerical Integration Techniques
48/51
48
CONTINUEDCONTINUED
0 0.5 1 1.5 2
Simulation time in seconds
0
60
120
180
240
Gen
eratoranglein
degrees
clearing at 0.3 seconds
clearing at 0.2 seconds
clearing at 0.1 seconds
-
8/4/2019 70 Numerical Integration Techniques
49/51
49
CONCLUSIONCONCLUSION
-
8/4/2019 70 Numerical Integration Techniques
50/51
50
BooksBooks
Numerical Methods for Engineers-FifthEdition
. . & . . . -S C Chapra R P Canale McGraw Hill College Applied Numerical Analysis-Second Edition . . & . . ,C F Gerald P O Wheatley Addison Wesley
Boston Elementary Numerical Analysis-Third
Edition
. . . -S D Conte and C de Boor McGraw Hill College Numerical-Methods-Third Edition . & . , -J Douglas Richard L Burden Youngtown State
.University Foundations of Differential Calculus
Euler -
-
8/4/2019 70 Numerical Integration Techniques
51/51
- William Shakespeare
All's Well, that Ends Well