Transfer Function Extraction with SCILAB from time domain result, using deconvolution and FFT algorithms (Patrick DUBUS – Zaatar MAKNI) Date: 28/06/2011 Summary Introduction Proposed Method Deconvolution Algorithm 2 FFT Examples of use Conclusion 28/06/11I 2 I Introduction Analog Electronic Designers are accustomed to transfer function description in frequency domain using Bode plots. Can be obtained from: Tests by using dedicated test equipment (sinewave signal injected at input, gain and phase shift measured then frequency is changed, …) – Not always available From simulation by using equivalent linear model to reduce simulation time – In most of the case, this is not straight forward (hard job) and with risk of errors 28/06/11I 3 I New Method Transfer function extraction rely on simulation or test in time domain using signal with large spectrum to cover quickly the entire frequency domain. Proposed method is to: inject a step signal at function input, extract the impulse response by deconvolution algorithm use FFT to plot transfer function in frequency domain. Benefits are: No dedicated test tool needed No equivalent AC model requested Results are processed with SCILAB 28/06/11I 4 I Deconvolution Algorithm Remind on Convolution Mathematical Expression: t Out (t ) = Out (0) + ∫ In(u ) ⋅ Tf (t − u ) ⋅ du 0 Converted into discrete Algorithm: n −1 Out ( n) = Out (0) + dt ⋅ ∑ k =0 In( k ) + In(k + 1) ⋅ Tf ( n − 1 − k ) 2 Tf In Out 28/06/11I 5 I Deconvolution Algorithm Application of the Convolution When applied to the various terms gives: In(0) + In(1) Out (1) = Out (0) + dt ⋅ ⋅ Tf (0) 2 TF(0) can be computed Then TF(1) In(0) + In(1) In(1) + In( 2) Out (2) = Out (0) + dt ⋅ ⋅ Tf (0) ⋅ Tf (1) + dt ⋅ 2 2 In( k ) + In( k + 1) Out (n) = Out (0) + dt ⋅ ∑ ⋅ Tf ( n − 1 − k ) 2 k =0 n −1 Then TF(n-1) 28/06/11I 6 I Deconvolution Algorithm Final Algorithm Final formulae: Tf (0) = 2 ⋅ (Out (1) − Out (0) ) dt ⋅ [In(0) + In(1)] 2 Tf (n − 1) = dt ⋅ [In(0) + In(1)] ⋅ (Out (n) − Out (0) − Outx ) n −1 Outx = dt ⋅ In(k ) + In(k + 1) ⋅ Tf (n − 1 − k ) ∑ 2 k =1 28/06/11I 7 I Deconvolution Algorithm Remarks DC values from the Input signal have to be removed. Deconvolution starts when input signal is applied (synchronization to input signal is needed). Due to sampling effect, input signal is factored by a ZOH (Zero Order Hold). This will introduce a phase shift in the extracted transfer function which must be corrected. ZOH t 28/06/11I 8 ut u t Ts 1 e j j Ts Ts e j Ts 2 sin Ts 2 Ts 2 I FFT Standard SCILAB algorithm used … at the beginning. The following corrections/limitations apply: Fs = 1/Ts Spectrum starts at 1/(N.Ts) with N = number of points Spectrum plotted up to Fs/10 Phase corrected to take into account sampling effect Number of sample not limited to 2n 28/06/11I 9 I Simple Open Loop Case (1) First Order XCos model Case description: TF is described by a Laplace Model System is in open loop Step signal is injected Output and input are recorded 28/06/11I 10 1 TF ( s ) = 1 + T0 ⋅ s 1 T0 = → 1Hz 2π I Simple Open Loop Case (2) First Order XCos model Input and output are plotted and recorded. Time step is 0.01s Duration is 10s to reach steady state conditions. 28/06/11I 11 I Simple Open Loop Case (3) First Order XCos model Impulse response extracted by Deconvolution 28/06/11I 12 I Simple Open Loop Case (4) First Order XCos model Transfer function in frequency domain computed using FFT algorithm: Extracted value in blue Theoretical value in red Good Matching Extraction is correct 28/06/11I 13 I Another Open Loop Case (1) Second Order XCos model Case description: TF ( s ) = A (1 + T0 ⋅ s ) ⋅ (1 + T1 ⋅ s ) 1 → 1Hz 2π 1 T0 = → 10 Hz 2π ⋅10 T0 = 28/06/11I 14 I Another Open Loop Case (2) Transfer Function in Frequency Domain Input & Output Impulse & Step Response Second Order XCos model 28/06/11I 15 Good Matching Extraction is correct I Last example in Open Loop Case (1) First Order with Integrator (PI) Case description: TF ( s ) = A (1 + T0 ⋅ s ) ⋅ s (1 + T1 ⋅ s ) 1 → 1Hz 2π 1 T0 = → 10 Hz 2π ⋅10 T0 = 28/06/11I 16 I Last example in Open Loop Case (2) Transfer Function in Frequency Domain Input & Output Impulse & Step Response First Order with Integrator (PI) 28/06/11I 17 Integrator function not extracted !!! I Last example in Open Loop Case (3) First Order with Integrator (PI) Problem comes from non convergence condition when transfer function has an integrator Fourier Transform doesn’t exist But thanks to its real part in the exponential term, Laplace Transform exists Current tested solution is to rewrite the Fourier Transform algorithm with an additional negative real part jω changed to a+jω This limit the integrator behavior to frequency higher than a/2π but a corrective factor is added to compensate for Criteria selection for a to be investigated 28/06/11I 18 I Last example in Open Loop Case (4) First Order with Integrator (PI) Transfer Function in Frequency Domain Extracted Transfer Function with modified algorithm 28/06/11I 19 Good Matching Now I Closed Loop Case (1) First Order with Integrator (PI) Now extraction is test for a closed loop configuration: A (1 + T0 ⋅ s ) TF ( s ) = ⋅ s (1 + T1 ⋅ s ) 1 → 1Hz 2π 1 T0 = → 10 Hz 2π ⋅10 T0 = 28/06/11I 20 I Closed Loop Case (2) Transfer Function in Frequency Domain Input & Output Impulse & Step Response First Order with Integrator (PI) 28/06/11I 21 Extraction is working in closed loop I Motor Control Algorithm (1) Real Use Case PI controller for current control in the dq domain Magnetic model of electric motor based on Lookup tables Target: extraction of the current control loop transfer function in order to perform stability study 28/06/11I 22 I Closed Loop Case (2) Transfer Function in Frequency Domain Input & Output Impulse & Step Response First Order with Integrator (PI) 28/06/11I 23 Fc = 460Hz Ph margin > 90 ° I Conclusion Quick and Relevant method for transfer function extraction Applicable to Open Loop or Closed Loop System Proposed solution (addition of a real term) to solve non convergence problems need to be further investigated Have to be used on several use cases to confirm applicability and accuracy … To be continued 28/06/11I 24 I