RECURSIVE SPLINE INTERPOLATION METHOD FOR REAL TIME ENGINE CONTROL APPLICATIONS A. Stotsky Volvo Car Corporaton Engne Desgn and Development Dept. 97542, HA1N, SE- 405 31 Gothenburg Sweden. Emal: astotsky@volvocars.com A. Forgo Volvo Car Corporaton Engne Desgn and Development Dept. 97568, HA1S SE- 405 31 Gothenburg Sweden Emal: aforgo@volvocars.com Keywords: Splne nterpolaton method, Observers, Estmaton, Combuston qualty montorng, Spark gnton engnes. Abstract In ths paper new computatonally effcent algorthms for splne nterpolaton method are explaned. Theoretcal comparatve analyss of the splne nterpolaton method wth combned hgh-gan observer and splne nterpolaton method s presented. New splne nterpolaton algorthms are mplemented for estmaton of the engne angular acceleraton from the crankshaft angle measurements. 1 Introducton Numercal calculaton of the dervatves of a sgnal s an old problem n numercal analyss and dgtal sgnal processng. The backward dfference method gves one of the smplest numercal dfferentators. Despte the fact that t s qute common n engneerng applcatons the behavor of the dervatvesvery often accompaned wth peakng phenomena. Splne nterpolaton method proposed n [2] s based on on-lne least-squares polynomal fttng over the movng n tme wndow of a sze w. The advantage of ths method over the backward dfference method s ts good transent behavor. The dea for the splne nterpolaton method s to ft a polynomal of a certan order as a functon of tme n least squares sense and take the dervatves analytcally. Propertes of ths method are descrbed n [2],[1]. However, several practcal problems reman. Relatvely large wndow sze w requres more on-lne computatons and makes practcal mplementaton of the method dffcult. Ths necesstates the development of computatonally effcent recursve algorthms. Moreover, n [2],[1] only constant ntersamplng tme s consdered, whch n many practcal applcatons s not constant. For example, crankshaft angle measurements n automotve engnes are based on the measurements of the crankwheel tooth number and therefore the elapsed tme between two teeth passng a fxed pont vares. Ths necesstates the development of recursve computatonally effcent algorthms for varable dscretzaton step. The contrbutons of ths paper are the followng : new computatonally effcent recursve splne nterpolaton algorthms for varable dscretzaton step ; theoretcal comparatve analyss of the splne nterpolaton method and combned splne method wth hgh gan observer; real-tme mplementaton of the splne nterpolaton method for the crankshaft acceleraton estmaton. 2 Estmaton of the dervatves of sgnal The frst step s to choose the nterpolatng polynomal as ^ff + c 1 t + ::: + c n t n (1) where ^ff s an estmate of the measured sgnal ff, t s contnuous tme, c, 0; :::; n are coeffcents to be found. The estmates of the dervatves are obtaned by dfferentatng (1) analytcally.
Suppose that there s a measured wndow of data fff k () ; :::; ff k g of a sze w, measured dscretely wth varable dscretzaton step. It s convenent to place the orgn at the pont k (w 1), where k s the step number, then there s a wndow ofdatafff 0 ; :::; ff g measured at f0; :::; t g respectvely. Varable dscretzaton step s presented as t t t 1, 1;:::;w 1. The sum to be mnmzed at every step s S (ff ( + c 1 t + ::: + c n t n ))2 (2) where t, 0;:::;w 1 s a dscrete tme whch corresponds to the sgnal measurements ff, t 0 0. Mnmum of S s acheved when equatng to zero partal dervatves of S wth respect to c, 0;:::;n,.e., @S 0 (3) @c Equatons (3) can be wrtten as follows w + c 1 ::: :::::: t + ::: + c n t + c 1 t 2 + ::: + c n t n t n+1 ff (4) ff t (5) t n + c 1 t n+1 + ::: + c n t 2n ff t n (6) where equaton (4) represents @S 0, equaton (5) @ represents @S 0 and fnally equaton (6) represents @S @c n 0. @c 1 The system (4) - (6) should be resolved at every step n order to fnd the coeffcents c, 0; :::; n. It s clear that for a suffcently large wndow sze w, the calculaton of sums n the system (4) - (6) requres a lot of computatonal power and our next step s to present recursve computatonally effcent algorthms to compute these sums. Let us consder one step of the movng wndow of a sze w. Suppose that at step k 1 there s the followng data fff 0 ; :::; ff g measured at f0;:::;t g, and at step k there s fff 1 ; :::; ff w g measured at f0; :::; t w g. The new value ff w measured at the tme t w enters the wndow ( buffer) and the value ff 0 leaves the wndow. Our problem statement s to fnd computatonally effcent recursve algorthms to compute the sums P S mk va the sums on the prevous step S mk 1 tm, where m 1; :::2n. Defne the sum of order m at step k as follows S mk w 1 P w 1 tm t m t m 2 +( t 2 + t 3 ) m + ::: + ( t 2 + t 3 + ::: + t w ) m (7) where t 1 0. The sum (7) should be computed usng the same sum on a prevous step k 1 whch can wrtten as S mk 1 t m t m 1 +( t 1 + t 2 ) m + ::: + ( t 1 + t 2 + ::: + t ) m (8) and the sums of lower order at step k whch are defned as S (m j)k w 1 t m j t m j 2 +( t 2 + t 3 ) m j + ::: + ( t 2 + t 3 + ::: + t w ) m j (9) where 1» j» (m 1), m>1. Startng wth (8) and usng the followng dentty (x + y) m m j0 where m 0; 1; 2; :::, one gets Cj m xj y m j ; Cj m m! (10) j!(m j)!
S mk 1 (w 1) tm 1 + tm 2 +( t 2 + t 3 ) m + ::: +( t 2 + t 3 + ::: + t ) m + Cj m ( tj 1 tm j 2 + ::: + t j 1 ( t 2 + ::: + t ) m j ) (11) Notce that and t m 2 +( t 2 + t 3 ) m + ::: +( t 2 + t 3 + ::: + t ) m S mk ( t 2 + t 3 + ::: + t w ) m (12) C m j ( tj 1 tm j 2 + ::: + t j 1 ( t 2 + ::: + t ) m j ) C m j tj (S (m j)k ( t 2 + ::: + t w ) m j ) (13) Substtutng (12) and (13) n (11) one gets where S ffmk S ffmk 1 (ff 1 + ff 2 + ::: + ff ) t m 1 C m j tj 1 (S ff(m j)k ff w ( t 2 + t 3 + ::: + t w ) m j ) +ff w ( t 2 + t 3 + ::: + t w ) m (15) S ffmk 1 ff t m ff 1 t m 1 + ff 2( t 1 + t 2 ) m + ::: +ff ( t 1 + t 2 + ::: + t ) m (16) s the sum on the step (k 1), and S ff(m j)k w 1 ff t m j +ff 3 ( t 2 + t 3 ) m j + ff 2 t m j 2 ::: + ff w ( t 2 + t 3 + ::: + t w ) m j (17) where 1» j» (m 1), m>1. The order of the nterpolatng polynomal should be so selectedtobeaslow as possble n order to reduce the computatonal burden and to flter out measurement nose. In the next Secton the detaled soluton of the nterpolaton problem for the second order polynomal s presented. Ths example s used n Secton 4 for the crankshaft acceleraton estmaton. S mk S mk 1 (w 1) tm 1 C m j tj (S (m j)k ( t 2 + ::: + t w ) m j ) +( t 2 + t 3 + ::: + t ) m (14) where Cj m m!,1» j» (m 1), m>1. j!(m j)! Our next step s to calculate the sums on the rght hand sde of the equatons (4) - (6). The sums S ffmk P w 1 ff t m should be P calculated va the sums on the prevous step S ffmk 1 ff t m, where m 2; :::n. Usng smlar arguments one can show that 3 Second Order Example 3.1 Splne Interpolaton Method For the second order polynomal (1), where n 2, equatons (4) - (6) can be wrtten as follows w + c 1 t + c 2 t + c 1 t 2 + c 2 t 2 ff (18) t 3 ff t (19)
t 2 + c 1 t 3 + c 2 t 4 ff t 2 (20) problem, repeatable ntalzaton of the algorthms s requred. where the sums are computed usng recursve formulas (14) and (17). Presentng equatons (18) - (20) n matrx form yelds where A Ac b (21) 0 @ a 11 a 12 a 13 1 a 21 a 22 a 23 A, c T ( ;c 1 ;c 2 ), b T a 31 a 32 a 33 (b 1 ;b 2 ;b 3 ), where 3.2 Combnaton of hgh gan observer and splne nterpolaton method and ther comparatve analyss In [2], [1] t s mentoned that the splne nterpolaton method can be combned wth hgh-gan observers. The combned scheme shows mproved transent behavor. In ths Secton the comparatve analyss of the splne nterpolaton method and combned method s presented. The sgnal s estmated va the second order polynomal descrbed above a 11 w; a 12 S 1k ; a 13 S 2k a 21 S 1k ; a 22 S 2k ; a 23 S 3k a 31 S 2k ; a 32 S 3k ; a 33 S 4k b 1 S ffk ; b 2 S ff1k ; b 3 S ff2k Notce that, a 12 a 21 and a 22 a 31 a 13, a 23 a 32. In order to fnd splne coeffcents c, 0; 1; 2 the matrx equaton (21) should be solved wth respect to c at every step ( c A 1 b). To ths end matrx A s nverted analytcally. Remark 1. Ths algorthm has only one parameter to be optmzed, ths beng the sze of the movng wndow w. If the dervatve of the measured sgnal changes slowly t s advsable to have a relatvely large wndow sze to flter out measurement nose. If the dervatve changes quckly, the wndow sze should be suffcently small to capture correspondng fast changes n the dervatve. The dsadvantage of a small wndow sze s the nose n the estmated sgnal. Ideally, the wndow sze should be adjustable so that t s small enough durng transents to capture fast changes n the dervatve of the sgnal, and large enough under steady-state condtons to flter out measurement and space-dscretzaton nose. Remark 2. For constant dscretzaton step the sums S m do not change wth tme, matrx A s constant and computatonal burden s mnmal. Remark 3. The recursve computatons presented above accumulate an approxmaton error, whch ncreases wth tme. To avod ths error accumulaton ^ff(t) + c 1 t + c 2 t 2 (22) where ^ff(t) s the estmate of the sgnal ff. A combnaton of the splne nterpolaton algorthm wth a smple hgh gan observer s presented as follows y(t) 1 f ff + y 1(t) (23) _y 1 (t) 1 f y(t)+^ ff; y 1 (t 0 )^_ff(t 0 ) 1 f ff(t 0)(24) where y(t) s the estmate of the _ff, f > 0 s the algorthm parameter, ^_ff(t 0 ) s the estmate of the dervatve from splne nterpolaton method evaluated at tme t 0, ^ ff s splne estmate of the second dervatve. The condton y 1 (t 0 )^_ff(t 0 ) 1 f ff(t 0) corresponds to the followng ntal value assgnment y(t 0 )^_ff(t 0 ). Ths means that hgh gan observer (23), (24) s ntalzed to the splne estmate. Moreover, the second order dervatve ^ ff s used drectly as an nput to the hgh gan observer. Notce that, ^_ff(t 0 )c 1 +2c 2 t 0 and ^ ff 2c 2. Remark 4. Equatons (23) and (24) represent the followng estmator of the dervatve y(p) p ff(p) (25) fp +1 f ^ ff 0, where p jw s a Laplace varable. Estmates from the splne nterpolaton method are used as a feedforward part n the estmator (25).
Assumng a splne approxmaton error, then ths error s expressed n terms of the error n splne coeffcents and the true sgnal can be expressed as follows e 2 (t 1 )( c 1 +2 c 2 t 0 2 c 2 f)e t 1 t 0 f +2 c 2 f (34) ff(t) Λ + c 1Λ t + c 2Λ t 2 (26) where ff(t) s the sgnal, c Λ, 0; 1; 2 are true coeffcents. Assumng a constant error n the coeffcents w.r.t. tme one gets c c Λ + c (27) where c, 0; 1; 2 are constant errors n splne coeffcents. Our task s to compare the followng estmaton errors where t 1 s a fxed tme. Frst we evaluate e 1 (t 1 ) e 1 (t 1 ) ^_ff(t 1 ) _ff(t 1 ) (28) e 2 (t 1 ) y(t 1 ) _ff(t 1 ) (29) e 1 (t 1 ) c 1 +2 c 2 t 1 (30) The next step s to evaluate e 2 (t 1 ). Dfferentatng (23) and takng nto account that ^ ff ff +2 c 2 one gets _y ff 1 f (y _ff)+2 c 2 (31) The soluton of (31) s the followng y(t) _ff(t) (y(t 0 ) _ff(t 0 ) 2 c 2 f)e t t 0 f +2 c 2 f (32) Intalzaton of hgh gan observer gves the followng: y(t 0 )^_ff(t 0 ). Takng nto account that ^_ff(t 0 ) _ff(t 0 ) c 1 +2 c 2 t 0 one obtans y(t) _ff(t) ( c 1 +2 c 2 t 0 2 c 2 f)e t t 0 f Evaluatng e 2 (t 1 ) one gets +2 c 2 f (33) Comparng (34) and (30), t can be seen that je 2 (t 1 )j can always be made smaller than je 1 (t 1 )j by reducng the desgn parameter f. However, n the presence of nose the reducton of f leads to a deteroraton of the sgnal qualty. The advantages of ths combned scheme can be shown f the parameter f can be reduced to a suffcently small value wthout any sgnal qualty deteroraton. As the smulaton results dd not show any sgnfcant superorty of the combned method over the splne nterpolaton method and the latter s chosen for mplementaton. 4 Implementaton Results In ths Secton the mplementaton results are presented for a second order splne fttng method, as descrbed n Secton 3.1. A Volvo S80 passenger car equpped wth a crankshaft angle sensor s used for experments. The method descrbed n Secton 3.1 s used to estmate the crankshaft acceleraton,whch gves vtal nformaton about the qualty of the combuston n the engne, from the crankshaft angle measurements. The car s equpped wth a specal Engne Control Unt, whch s called Volvo Rapd Prototypng System. Ths system conssts of the PM (Power Module) and the AM (Applcaton Module) connected together va a 1 Mbt/s CAN channel. The PM provdes nformaton based on a number of engne sensor sgnals. The crankshaft wheel has 58 teeth spaced every 6 degrees and a gap correspondng to two mssng teeth. Engne speed and cylnder poston can be calculated from the resultng crankshaft sensor sgnal. The PM calculates the engne speed based on the measured tme between the tooth events va the backward dfference method. Ths engne speed s transmtted along wth other measurements every 4th mllsecond to the AM. The 4 mllsecond sampled crankshaft angle calculated from the tooth number sgnal s the nput to the crankshaft acceleraton estmaton, whch runs n the
AM. The accuracy of the estmaton s verfed by comparng the engne speed, calculated by the splne nterpolaton method, wth the engne speed calculated n the PM. Implementaton results are presented n Fg.1 whch shows engne speeds as a functon of tme. The accuracy of the estmaton s verfed by comparng fast engne speed measured n the PM module ( dotted lne ) and engne speed calculated va splne nterpolaton method ( sold lne ). Crankshaft Acceleraton [rev/sec 2 ] 120 100 80 60 40 20 0 20 18 40 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 Tme [sec] Engne Speed [rev/sec] 16 14 12 10 Fgure 2 Expermental results. Two engne cycles of 5 cylnder engne. The msfre s generated on the second cycle n the cylnder 4. Tooth number sgnal s plotted wth dashdot lne. Crankshaft acceleraton estmated by the splne nterpolaton method s plotted as a functon of tme wth a sold lne. 8 6 0 0.5 1 1.5 2 2.5 3 3.5 Tme [sec] Fgure 1 Expermental results. The comparson of two engne speeds as functons of tme. Engne speed computed n PM s plotted wth dotted lne. Engne speed calculated wth splne nterpolaton method s plotted wth sold lne. 5 Concluson Computatonally effcent algorthms for splne nterpolaton method allowng a reducton n computatonal burden as well as the mplementaton of the splne nterpolaton method are presented. A further challenge s to mprove the performance of these algorthms by adjustng the sze of the movng wndow. References Fgure 2 shows an applcaton of the proposed recursve splne nterpolaton method to the msfre dagnostcs. In ths Fgure two engne cycles of a 5 cylnder engne are shown, and the msfre s generated on the second cycle of cylnder N 4. The tooth number sgnal s plotted wth a dashdot lne. Crankshaft acceleraton estmated by the splne nterpolaton method s plotted wth a sold lne. In the event of a msfre, the crankshaft acceleraton changes dramatcally, whch permts the cylnder ndvdual msfre detecton. [1] Dabroom A., Khall H. (1999). Dscrete-Tme Implementaton of Hgh-Gan Observers for Numercal Dfferentaton, Internatonal Journal of Control 72 (17), p.p. 1523-1527. [2] Dop S., Grzzle J., Moraal P., Stefanopoulou A. (1994). Interpolaton and Numercal Dfferentaton for Observer Desgn, Proc. Amercan Control Conference, Baltmore, Maryland, p.p. 1329-1333.