FPGA-Based Fixed Point Implementation of a Real-Time InductionMotor Emulator

This paper investigates the numerical issue of a discrete-time induction-motor emulator implementation. The stability analysis of the finite-word-length implementation shows a coupling between required word length and the sample rate. We propose specific guidelines to analyze this coupling and to estimate the required data word length for both signals and coefficients of the model. To respect algorithm requirements, an FPGA-based implementation was used for architecture development. The direct torque control is implemented to verify in real time the AC-motor emulator prototype.


Introduction
Control algorithms of electrical drives are usually tested by the attachment of electrical motors.Experimental testing requires direct measuring by employing measurement instrumentation and sensors that would be complex, impractical, noise sensitive, and expensive.Traditionally these tests are performed on motor and inverter models under software simulation environments which are, in most cases, nonreal-time and unable to exactly replicate real operational conditions.
In order to provide a real-time verification of the implemented control algorithm and increase the realism of simulation, the control algorithm is tested while connected to a real-time emulator for the plant (induction motor and inverter) [1].Due to their high capacities of executing in real-time complex algorithm, FPGA technology is a good candidate for this kind of RT emulator [2].
For reasons of cost, simplicity, speeds and memory space, the real-time emulator of the induction motor is performed with the Euler's shift discretization method and quantized with fixed point format [3].
The robustness of the discretized algorithm is a critical issue in fixed-point format implementation.It is well known that, stable, closed-loop system may become unstable when the algorithm is implemented using a fixed-point processor due to finite-word-length effects.The fractional part precisions in fixed point are chosen to guarantee a minimum signal-to-noise ratio for finite-word-length quantization effects.The integer part is computed using norms [4].
In an FPGA implementation, it is possible to use separate fixed-point format for each coefficient and signal in the algorithm.Hence, the use of FPGA allows maintaining a higher computational precision at critical points.
In this paper, authors propose a real-time induction motor emulator designed in fixed point format for an FPGA implementation.The starting point is a continuoustime model.Discrete-time models are derived using the traditional shift form approximation.A study in terms of stability and finite-world-length effects is shown and a design technique for choosing the coefficient and signal bit widths is given [5,6].
To demonstrate the accurateness of the real-time induction motor emulator, a particular example is developed: the direct torque control (DTC) of an induction motor [7].
The paper is organized as follows.The second section reminds the algorithmic study of a discrete-time induction motor model-based shift form approximation. Section 3 gives an efficient methodology for choosing the finite fixed-point word length.Section 4 shows the FPGA-based architecture development and gives emulation results of the induction motor emulator with the DTC algorithm.

Discrete-Time Model Based on Shift Form Approximation
The block diagram of the complete system is outlined in Figure 1 including the control scheme, the induction motor, and the power chain.
As it can be seen, the DTC algorithm is decomposed in three specific blocks.
(i) Transformation block, which is composed by two subalgorithms based on the direct Concordia transformation algorithm for the current and voltage three phases models.
(ii) Estimation block, which is composed by the calculation subalgorithms of flux (φ s(d,q) , φ s ), torque (Γ e ), and flux sector position.The discrete-time model of the flux subalgorithm is based on the shift form approximation: (iii) command block, which is composed by a look-up table (LUT) corresponding to the switching function of the power inverter.
In order to provide a real-time verification of the implemented control algorithm, the DTC is tested while connected to a real-time emulator for the induction motor and inverter.
The induction machine is a nonlinear high-order system and for this reason complicated models must be used to control it.The dynamic behaviour of the induction motors can be described by a set of differential equations in a rotating reference frame with an angular velocity of ω λ .Moreover it is assumed that a stationary reference frame is fixed to the stator axis.The proposed model also assumes the classical decoupling between mechanical and electrical modes.It yields that under these assumptions, the state model of the induction motor (IM) is [8] where, T r = L r /R r is the rotor time constant, σ is leakage coefficient with σ = 1 − M 2 sr /L s L r , γ = (R s + M sr /L r T r )/σL s , and ω is the angular velocity.
By means of (2), the general equation of the electromagnetic torque is transformed to an advantageous form: The purpose of this section is to develop a computationally efficient discrete-time approximation of the continuous motor model operating in real time.
The most used discretization method is based on Forward shift approximation [8].The shift form approximation is given by where T is the sampling period.Introducing ( 5) in (2) yields where The data flow graph (DFG) corresponding to the induction motor model is presented in Figure 2. Coefficients a i depend on the parameters of the machine and are obtained for a per unit model.
The following lines show the different coefficients used for the per unit (PU) DTC algorithm where, The base values are determined from the maximal values by using the following equations, where I m , v m , and f m are, respectively, the phase maximal current, the phase to  neutral maximal voltage, and the maximal frequency of the induction motor: The solution of the continuous system (2) is And if we consider the solution at the instant kT, we obtain The solution at the instant kT to the system (6) is the following: Therefore, the matrices that rule the continuous and discrete time systems are, respectively, e AT and (I + AT), and, consequently, the continuous and discrete time systems will be described by the eigenvalues or the poles of these matrices.
The poles of the matrix e AT are λ = e βT , β being a pole of the matrix A of the continuous time system; the poles of the matrix (I + AT) are (λ = 1 + βT).In this study, a low power induction motor (1.5 kW) has been considered.The corresponding continuous-time model has four poles for electromagnetic model as illustrated below: 2 , Let us suppose the following quadratic error function: Therefore, for sampling periods T tending to zero the difference between e βT and (1 + βT) becomes very small for each β i pole of A, and, consequently, it will optimize the resemblance between the time-domain response of the continuous-time and the discrete-time system.
Discrete-time systems resulting from the shift form approximation are sometime unstable.It is possible, however, to select the sampling rate such that the discrete-time system is always stable when the corresponding continuoustime system is stable.For the shift form realization, the stability domain is located inside the unit circle.Therefore, a z-domain pole is stable if its module is less than one: Therefore, the most critical z-domain pole corresponds to the s-domain pole having the greatest module.The pole β 1 has the greatest module as function of ω.
The locations of poles of the motor for different sampling rate values are shown in Figure 3.It can be seen that for high sampling rate, the poles become very close to one.This can be problematic, particularly when finite precision formats are considered.

Efficient Methodology for Choosing the Word Length of Coefficients and Variables
The following methodology is developed for choosing each coefficient and variable bit width.

Representation of Coefficients.
When the model is implemented in fixed-point format, each coefficient a k must be given a finite-precision representation composed by an integer and fractional part.Each part is estimated separately.The integer part position for a coefficient a k must be estimated by taking the base 2 logarithm of the maximum coefficient: where x rounds x to the nearest integer less than or equal to x.
The fractional part must be determined by the maximum allowable perturbation of the coefficient from its ideal infinite-precision value.This can be achieved by computing the quantized parameter deviation or sensitivity and the stability margin.The angular velocity is selected to be the worst-case value.By means of Figure 3, for pole λ 1 and its conjugate, ω is fixed to the maximal value and for pole λ 2 and its conjugate ω is equal to zero.
Let { a k } be the quantized parameter set consisting of all quantized coefficients of the state matrix A z .When the model is implemented in fixed-point format, each coefficient of the {a k } set is perturbed: Due to the finite-word-length effects, each Δa k perturbation is bounded by where B F is the number of bits of the fractional part.Due to the perturbation and it follows from a firstorder approximation that the deviation can be computed with where N is the number of modified parameters (Δa k / = 0).As an example, for poles λ 2 and λ 4 , the worst-case deviation is obtained with ω = 0.Then, the expression of deviation with, ∂λ 2 /∂a 1 = −∂λ 2 /∂a 6 = −(T/2)(1 + (a 1 − a 6 )/ (a 1 − a 6 ) 2 + 4a 5 a 2 ) and ∂λ 2 /∂a 2 = (a 2 /a 5 )(∂λ 2 /∂a 5 ) = −(T/2)(2a 5 / (a 1 − a 6 ) 2 + 4a 5 a 2 ).
The quantized pole λ i may be outside the unit circle, especially with high sampling rate; thus, it is critical to know when the finite-word-length error leads to instability.This means to determine how close λ i [(a k )] are to the unit circle.Let us consider the following related measure for each pole: where 1−|λ i (a k )| is called the stability margin of the i th pole and ε is a prescribed maximum allowable percent change in pole location relative to the stability margin.
Assuming that all coefficients have the same word-length fractional part, then Δa k = Δa ∀k ∈ {1, . . ., N}; it follows from inequality (21) that From inequalities ( 22) and ( 18), the required fractional part word length can be derived as For the studied motor, setting ε = 5% and T = 100 μs, the conditions (23) yield 19 bits for fractional part word length for A matrix coefficients.

Representation of Signals.
The next step in the fixedpoint motor model implementation is to estimate the format for each signal.An incremental methodology is used to determine the appropriate representation for the state variables.As shown in Figure 4, the first step is to find transfer function from each input and the appropriate signal in the DFG.Then the dynamic range (maximum amplitude) of each signal is carried out by using l ∞ and l 1 norms, and, thus, the integer word length range is identified.Finally, the fractional part word-length is estimated by analysis of the signal-to-quantization-noise ratio (SQNR) for each signal.
The dynamic range (maximum amplitude) of each signal of the DFG allows identifying their integer range.In practice the maximal current supported by the motor as well as the maximal produced torque and fluxes is known.Therefore, for the per-unit motor model, these dynamic ranges are bounded by 1.Notice that the voltage inputs and the electrical velocity are also normalized.Thus, these dynamic ranges are all bounded by 1: where • ∞ denotes the the l ∞ norm, defined by (26) Therefore, signals y 1 and y 2 are bounded by the same quantity: The integer part word length of all the signals is then estimated by taking the base 2 logarithm of the range bound.Table 1 illustrates the signal range bounds and the corresponding integer part word length.
The fractional part word length is estimated by analyzing the signal-to-quantization-noise ratio (SQNR) for each signal [9].The SQNR is measured in decibels as There are two possible sources of quantization noise in the induction motor emulator implementation, namely: (i) the noise introduced by the limited resolution of a possible control technique, producing an input noise variance σ 2 i , (ii) the truncation noise which is introduced when products or sums are quantized.This noise propagates through the emulator and appears at outputs.
It is assumed that the quantization noise has the following properties.
(i) Each quantization noise source is a stationary white noise process.
(ii) Each noise source is uncorrelated with all other noise sources and the input of the system.
(iii) The error resulting from quantization can then be modeled as a random variable uniformly distributed over the appropriate error range.Therefore, the noise variance due to truncation is where B is the fractional part word length.
To investigate the noise propagation, a noise quantization model of the induction motor emulator is developed in Figure 5.The addition is performed without truncation.The quantization is performed after each multiplication; the quantization noise resulting from N multiplications is therefore N-times higher than the one generated by a single multiplication.It yields that the variances of noise e t1 and e t2 are The output noise variances can be estimated using the matrix transfer function from the input vector u(k) = [e t1 (k), e t1 (k), e t2 (k), e t2 (k)] to the output vector y Using matrix notation in (5), the transfer function matrix response is where Let h x → y (k) denote the impulse response from input x to output y for a linear system.Assuming that the input signal has a maximal value x max , the output y must be bounded [10] so that where • 1 denotes the l 1 norm, defined by Using (31) and (33), the variances of resulting output noises are governed by these bounds [11]: Each coefficient H i j (z) 1 is computed to have a maximal value as function of electrical velocity ω: The l 1 norms of discrete-time impulse responses corresponding to these transfer functions are computed approximately by finite sums.Figure 6 shows the impulse response for each coefficient of the matrix H v → φ,i (z).
Assuming that all signals have the same word length, the first inequality gives the worst-case variance error and

FPGA-Based Induction Motor Emulator
4.1.System Architecture.The induction motor emulator is implemented using modular and standard design principles on a Xilinx Development kit, which contain a FPGA from SPARTAN III family, the XC3s200.The emulator module requires important hardware resource.Therefore, the corresponding architecture is optimized in terms of consumed resources by the AAA methodology [12] which leads to only 3 multipliers.
As in [13], the proposed architecture consists in a control unit and a data path.The control unit generates a suitable timing schedule to control the data path and other local sequencers.Figure 8 depicts the proposed system architecture.After the specification of the algorithm with data wordlength and sampling frequency, we propose to develop a modular architecture for the induction motor model to be implemented through an FPGA device. of dedicated modules to guarantee the real-time hardware in the loop (HIL) simulation.

System Architecture under Test in Open Loop
The functional blocks of the global architecture are listed below.
(i) The UART (Universal Asynchronous Receiver Transmitter) module that provides a serial communication between the host PC and the implemented architecture.The UART allows both reconfigurations in real time of the induction motor model by tuning its coefficients and data acquisition to be visualized on the PC.To solve the dialogs between the UART implemented on the FPGA board and the PC, MATLAB's serial port interface is used.
(ii) The input voltage stimuli module.It generates three digital values, which represent the three phases voltage.One can control the output waves amplitude and frequency in real time via the UART module.This module is used to test the induction motor (IM) module.The real-time simulation results presented in Figure 10 with 10 kHz sampling frequency show a slight difference between the torque produced by the implemented motor model architecture and the simulated torque under MATLAB environment under continuous-time conditions.This difference is too small to affect the performance of the real-time model.

System Architecture under
Test with DTC Algorithm.The DTC is a well-known induction motor control strategy [7].This control algorithm is selected to be tested with the real time induction motor model.The implemented architecture of the DTC control algorithm has been tested with the induction motor model architecture in real time.Figure 11 illustrates the proposed real time test bed.It includes a set of dedicated modules to guarantee a real-time simulation.
(i) The UART (Universal Asynchronous Receiver Transmitter) module that provides a serial communication between the host PC and the implemented architecture.
(ii) The stimuli module.It generates the references for the DTC control algorithm.
The torque and the stator flux are collected from the serial interface and visualized under Matlab-Simulink environment.Figure 12 illustrates the real-time emulation results.

Conclusions
This work has presented an optimized fixed-point format induction motor model intended for real-time simulation and emulation.With the analysis of the coupling between the sample rate and the data word length, this work has provided a theoretical guideline to find the optimal hardware implementation.The proposed architecture of the model has been successfully verified by the development and implementation of a real-time test bed that contains the ACmotor model and a DTC control algorithm.
The methodology for estimating the appropriate data word length may be applied to other various discrete-time system realizations.

Figure 1 :
Figure 1: Block diagram of the DTC technique.

Figure 2 :
Figure 2: The DFG of induction motor model.

Figure 3 :
Figure 3: Z-domain pole location of the motor model as function of the sampling frequency.

Figure 5 :
Figure 5: An additive noise model for the truncation and control technique noise through the induction motor model.

Figure 7 :
Figure 7: SQNR as function of the signal fractional part word length.

Figure 10 :Figure 11 :
Figure 10: Simulated torque and torque produced by the implemented model on FPGA during a start-up.

Figure 12 :
Figure 12: Real-time simulation results, obtained with DTC algorithm and the IM emulator: (a) steady-state stator flux vector locus, (b) estimated torque response to a step control from 0 N•m to 4 N•m.T = 100 μs, ω = 500 rpm and Φ * s = 1.15 wb.