An Improved FPGA Implementation of Direct Torque Control For Induction Machines
An Improved FPGA Implementation of Direct Torque Control For Induction Machines
An Improved FPGA Implementation of Direct Torque Control For Induction Machines
optimized to achieve fast sampling frequency. Work [20] φs : stator flux linkage space vectors in stationary reference frame
reports significant max. sampling frequency improvement to φr : rotor flux linkage space vectors in stationary reference frame
twice of that obtained with a DSP (which is 40 kHz). ωr : rotor electrical speed in rad/s
vs : stator voltage space vector in stationary reference frame
This paper presents an effective way to design, simulate and
implement the flux and torque estimations for hysteresis-based
Te,ref + ΔHBTe
DTC utilizing FPGAs. The main contribution of this paper is
the development of the flux and torque estimators using (a) Te,ref
VHDL code on the FPGA (i.e. from scratch), the code being
Te,ref - ΔHBTe
optimized to achieve a sampling frequency of 200 kHz. With
the highest sampling frequency, it is therefore possible for the Te,ref + ΔHBTe
torque ripple to be restricted within its hysteresis band and (b) Te,ref
hence minimize the ripple by reducing the band size.
Te,ref - ΔHBTe
Moreover, the performance of flux estimation as well as the
inherent current control in DTC system can be improved. Te,ref + ΔHBTe
Taking this into account, the estimations in DTC are the main Te,ref
parts to be implemented using FPGA, as they involve complex (c)
Te,ref - ΔHBTe
calculations (e.g. integrals, square-root, multiplication and
precise current scaling factor). The optimized VHDL code DT
design will be based on the MATLAB simulation model, Fig. 1. The waveforms of output torque sampled at DT in the hysteresis
where the type of data, number of bits (resolution), sampling comparator for (a) low speed, (b) middle speed and (c) high speed
time, scaling factor performed in simulation are similar to that
of FPGA implementation. The estimations of stator flux and
To illustrate this, waveforms of discretized electromagnetic
torque in the DTC of the induction machine will be presented
torque under 3 different steady-state operating conditions are
in Section II. The equations of stator flux and torque in
shown in Fig. 1. These are drawn so that only the effects of
discrete form and sector identification will be given in Section
motor speed and the applied voltage are considered. During
III. Section IV will present the description of the estimations
the positive torque slope, the active voltage vector is applied;
using MATLAB simulation and Modelsim Altera simulation.
otherwise, the zero voltage vector is selected. It can be noticed
Finally, the simulation and experimental results are compared,
that the torque slopes (for positive and negative slopes) vary
to verify code/design effectiveness at the highest sampling
with the operating speed. As a result, the torque switching
frequency.
frequency and hence the VSI switching frequency also vary
with operating conditions. Thus, it is common practice to
II. MAJOR PROBLEM IN HYSTERESIS-BASED DTC
select the device with switching capability based on the worst
Despite its simplicity, the DTC based on hysteresis case of operating conditions.
controller causes some major problems such as variable
inverter switching frequency, high torque ripple and high B. High torque ripple
sampling requirement for digital implementation [3-8]. These In digital implementation, the output torque is calculated,
problems are briefly described as follows. and the appropriate switching states are determined at fixed
sampling time (DT in Fig. 1). This, however, causes a delay
A. Variable inverter switching frequency between the instant the variables are sampled and the instant
In hysteresis-based DTC, the switching frequency of a VSI in which the corresponding switching status is passed to the
is mainly governed by the switching of the torque hysteresis inverter, therefore, the torque ripple cannot be restricted
comparator. The slope of the torque waveform, which directly exactly within the hysteresis band. If the band is set to be too
affects the switching of the hysteresis comparator, vary with small, the overshoot of the torque beyond the hysteresis band
the operating conditions (rotor speed, stator and rotor fluxes, could cause a reverse active voltage vector selection, instead
DC link voltage) [5]. This can be seen from the discrete form of a zero voltage vector selection. The selection of the reverse
of the torque equation given by (1): voltage vector causes the torque to decrease rapidly and as a
result the torque ripple increases [8, 18, 21-24]. This situation
Te,n 1 Te,n 1 1
Torque slope Te,n
is illustrated in Fig. 1(a).
Δt στ
s στ r
(1) C. The need for high speed processor
P m vs,n jωr s,n j r,n
3 L
Reducing torque ripple by lowering the band width of
2 σLs Lr hysteresis comparator would be fruitless when the processor
where: used has a limited sampling frequency. All the constraints
Te : electromagnetic torque P : number of pole pairs which have been mentioned above can be eliminated if a high-
∆t : small value Lm : mutual inductance
σ : total flux leakage factor Ls : stator self-inductance
speed processor is utilized, where the discrete hysteresis
τs : stator time constant Lr : rotor self-inductance controller performs closer to the operation of an analog based
τr : rotor time constant
J : moment of inertia comparator. As shown in Fig. 1(a) and discussed in sub-
3
3. LP Filter
Notice that Rs is the estimated stator resistance, while Ts is Through the simplification, it will be possible to get simpler
the implementation sampling time. Works [27-28] suggested logic of the sector analysis for FPGA implementation through
that a filter should be added to the integrator in the practical VHDL gate level coding; each sector is represented on 3-bits.
implementation to avoid integration drift problem due to the
DC offset in the sensed currents. The stator flux equations are: B. The Design Flow
( old ( V RS I )Ts )( 1 c * Ts ) (10) The validation of the designed torque and flux estimators
( old ( V RS I )Ts )( 1 c * Ts ) (11) was performed by using the Hardware-in-the-Loop (HiL)
method. The DTC MATLAB/Simulink model was simulated
4. Non-restoring Square Root Algorithm and then, the same data Ia, Ib, Sa, Sb, and Sc used for the
In DTC drives, the stator flux ( s ) is calculated as square simulation, was copied from the MATLAB workspace to
VHDL codes, along with the inputs for the targeted FPGA.
root of the quadrature flux magnitude. To calculate the stator
The VHDL codes were simulated in ModelSim-Altera before
flux ( s ), the non-restoring square root algorithm, proposed being synthesized and implemented in FPGA.
by [29], is modified as below (D=radicand, q=quotient,
r=remainder, and n=half of the radicand word size): V. MATLAB AND MODELSIM-ALTERA SIMULATIONS
r0 1 ( n 2 2bits ) In order to verify the torque and stator flux estimator
q0 0 (n 2 1bits )
models, a comprehensive DTC simulation was conducted. in
For i=0 to n-1 do: Matlab/Simulink (Fig. 3). The upper model is a standard
If ri 0 then model (which is not ready yet to be implemented in FPGA)
ri 1 4ri D( n 2i )1 D( n 2i ) 2 ( 4qi 1 ) and the lower model is generated as one ready to be
implemented in FPGA. The simulations of the DTC model,
else
ri 1 4ri D( n 2i )1D( n 2i ) 2 ( 4qi 3 )
which perform double-precision calculations, are used as
references to digital computations executed in FPGA
If ri 1 0 implementation.
qi 1 2qi 1 The standard Simulink models are not ready as direct FPGA
else design input, , the designer must prepare them, as the FPGA
qi 1 2qi programming will be conducted in two’s complement. In
principle, the procedure is similar with the one in [19, 32],
The square root result is qn( n 2 -1 downto 0), coded in n
2 bits. which is aimed to use a minimum number of operators that
process a maximum number of operations.
5. New Sector Identification The DTC model was simulated in Matlab/Simulink and
The present work has created a simpler method to analyze then the same data (Ia, Ib, Sa, Sb and Sc) used for the simulation
the sectors of the voltage vector, based on a comparison was copied from the Matlab workspace to VHDL code, as
between , 3 , 3 and 0, which is modified from [30]. well as the inputs for the targeted FPGA. The VHDL codes
were simulated in ModelSim-Altera before being synthesized
With the comparison, it is simpler to determine the sector of
and implemented in FPGA. However, the stage is optional.
the voltage vector, compared to the conventional methods of
From Matlab simulation, the designers can go the to FPGA
using arc tan of angle, three stages comparison based on
implementation stage, without using ModelSim-Altera
, or determination of angle using CORDIC algorithm
simulation stage. Quartus simulation environment can be used
[31]. The proposed method is single stage, based on the fact to verify the design.
that three comparisons are performed in parallel, without angle
calculation, so that faster computation is achieved and less VI. FPGA IMPLEMENTATION OF THE TORQUE AND FLUX
incorrect voltage vector selections. Table I shows the ESTIMATORS
Karnaugh map of the proposed sector identification.
The algorithm of torque and flux estimation is implemented
TABLE I
KARNAUGH MAP OF THE PROPOSED SIMPLER IDENTIFICATION OF in an architecture consisting of six main blocks, as shown in
THE SECTORS Fig. 4. This architecture has six inputs: two 21-bit currents (Ia
INPUT OUTPUT and Ib), 12-bit high voltage DC-supply (Vdc) and three
> 0 > 3 > 3
(sector) switching statuses Sa, Sb and Sc. At the end, it produces three
0 0 0 101 outputs: the estimation values of torque (T e), flux ( s ) and
0 1 0 110 sector. The sampling time chosen is 5 µs, which is limited by
0 0 1 100
the ADC used.
0 1 1 ddd
1 0 0 ddd A. The Architecture of Torque and Flux Estimator
1 1 0 001
1 0 1 011 All the equations modeling the motor’s behavior are
1 1 1 010 implemented in a two-stage-pipelined architecture, as in Fig. 5
5
[6.12]
[5.12] [6.12] [6.12]
iα [11.12]
[11.12] [1.27] [1.27]
[8.54]
[4.27] [4.27]
[10.12] [8.54]
[4.13]
Vβ
[11.12]
φβ
[11.12] [1.27] [1.27]
[4.27]
[8.54]
[10.12]
Vα
φα
2. Vα and Vβ Calculation
The function of this block is to calculate the stator voltages
in α-β components - refer to equations (4) and (5). The input is
Fig. 6. Block Arithmetic unit of the Iα and Iβ calculations 12-bit high voltage DC-supply and three switching status. The
output voltages are represented in 22-bit two’s-complement
fixed-point format [10.12]. The RTL viewer of the calculation
3. Sampling time
The sampling time Ts is limited to 5 µs by the ADC used. is shown in Fig. 7. The numbers “19’ h24F35” and “19’
√
Therefore, all the operations involved in this model were h15555” are to represent and in equation (4) and (5)
performed within this sampling time.
respectively. In these cases represent 87381 (i.e ) and
√
C. The VHDL Design of the Torque and Stator Flux 151349 (i.e ) respectively in binary 19-bits, each as
Estimators [1.18]. It is important to be known that the results (before
The algorithm of stator flux and torque estimator is truncated) of the Vα and Vβ are allocated each to 34-bit, as
implemented in an architecture consisting of seven blocks: [16.18], but the final values of the Vα and Vβ are only 22-bit.
1. Iα and Iβ Calculation The most significant 9-bit and lest significant 6-bit of each the
The function of this block is to transform the stator currents Vα and Vβ 34-bits are truncated, so only 27th – 6th bits are used
from the motor Ia and Ib into α-β coordinates (Iα and Iβ) refer to to represent the final values of each the Vα and Vβ as 22-bit,
equation (1) and (2). In this design, the values (I a, Ib) and (Iα i.e. [10.12]. The truncations are conducted to minimize
and Iβ) are represented on 17-bits and 18-bits two’s- hardware resources, while still retaining sufficient precision.
complement fixed-point format [5.12 bit] and [6.12 bit] Once again, the tailoring and adaptation made by the designers
respectively to get the precise values. As shown in Fig. 5, to are very important here.
avoid overflow that the result calculation of “Ia+2Ib” and 1
3
3 3. s Calculation
of the equation (2) are represented each on 19 bits, as [7.12] a. and Calculation
1
and [1.18] respectively. The part of 3
3 of the equation (2) is After the calculation of α-β components of current and
voltage, the α-β flux is calculated in this block (refer to
represented as 151349 (i.e 1
3 x 218 ). In Fig. 6, the value of
3 equation (6) and (7)). The other input, Rs, is represented on 10-
1
3 x 218 is represented as “19’ h24F35” (the 19 is number bits (5.5 bit). The output α-β components of the stator flux are
3
represented in 31-bit two’s-complement fixed-point format
of bits, and the h24F35 is value of 151349 in hexadecimal). [4.27]. In this paper, the sampling time (T s) is 5 µs. The value
The output of the signed multiplier is represented on 38-bits, of Ts is represented in [1.27] as “28’ h000029F” (=671), and
as [8.30]. However, the Iβ is only represented on 18-bits as therefore the sampling time of 5 µs will be calculated as
[6.12] to minimize hardware resource, so the 38-bit [8.30] is 4.99934 µs (671/227 ≈ 0,00000499934 s). Consider the
truncated to become 18-bit [6.12]. Based on the evaluation
result, the 18-bit has been considered suitable to represent Iβ ( 1 c * Ts ) filter part of equation (9) and (10), the part is
precisely. Here, the “tailor made” experience of designers is selected: 0.999975. In this case, the value is represented in
very important in order to develop the VHDL code effectively. [1.22] as “23’ h3FFF97“ (=4194199), so 0.999974966 will be
7
(a)
Fig. 7. RTL viewer of the VD and VQ calculations
(b)
Fig. 11. The effect sampling time to torque ripple;
(a) Estimated torque for Ts=50µs, (b) Estimated torque for Ts=5µs.
DTC - FPGA
T* + Torque
Fig. 8. RTL viewer of the magnitude calculator hysteresis Voltage
- comparator vector
Test
Look-up
+ table
φ* Flux hysteresis
comparator
-
φest
sector
Test Stator flux and torque
φest estimators
ia ib ic Vdc
Sa
Te Induction machine
Sb
look-up table-based
φs simulator (FPGA) Sc
simplification, it only involves two comparisons (not three this paper, with other works, are shown in Table II.
comparisons). The RTL viewer of the sector judgment is
TABLE II
shown in Fig. 9. COMPARISON OF THE LES CONSUMPTION
No Reference LEs DTC sampling
5. Torque Calculation consumption period (kHz)
The function of this block is to calculate torque - refer to 1 Ferreira [20] 4,100 40
equation (8). The output is represented on 55 bits [14.41] 2 Llor [36] 3,901 40
3 Utsumi [37]
fixed-point format, and then it is truncated to 26 bits [6.20]. - Type A controller 3,737 20
The RTL magnitude calculation viewer is shown in Fig. 10. - Type B controller 5,622 40
4 Bossoufi [38] 3,166 20
D. Synchronizations 5 Proposed 2,093 200
In the proposed architecture of the torque and flux As an alternative solution to the implementation, a low cost
estimators, synchronizations are conducted in two stages. The FPGA devices, such as from Cyclone family, can be used. For
first stage is used to synchronize the output of α-β stator example Altera DE2 board which offers a rich set of features
currents ( i and i ) and α-β stator fluxes ( and ), and the is suitable for sophisticated digital systems implementation.
second stage to synchronize the flux magnitude ( Te ) and the APEX EP20K200EFC484-2X was used for our
implementation due to the availability of this device/board in
electromagnetic torque ( s ). It is very important to consider our laboratory during the development of the system.
that the delay or un-synchrony in estimating the flux and
torque, becomes the root case where the switching frequency
can’t be raised.
The synchronizations are designed in one cycle of the
sampling time (in this case 5 µs), same with the sampling time.
By using the low sampling time (high switching frequency) like
this, the torque ripple can be reduced significantly. In other
words, the undesired overshoot or undershoot in torque can be
minimized by employing a faster sampling time. The 5 µs
sampling time (in the flux and torque estimators) is only
possible to be conducted/achieved by employing FPGA, and it
is not possible to use microprocessors or DSPs in current
condition. The one cycle synchronizations also have a function
as buffer, so that the parameters can be loaded to the buffer in
each clock cycle. The similar data-path and buffering concept
have been introduced in [35], for application to an automatic
speech recognition system based on FPGA.
IX. CONCLUSIONS
(a) This paper has achieved the reduction of the sampling time
(to increase the sampling frequency) by using FPGAs, so that
the appropriate value of the band width of the hysteresis
comparator can be achieved. The technique will retain the
simple control structures of the DTC drive. The paper
presented an effective way to design, simulate and implement
hysteresis-based DTC utilizing FPGAs. All modules in the
(b) system have been designed in fully generic VHDL code,
Fig. 13. The comparison between MATLAB/Simulink simulation and which is independent of the FPGA target implementation
experimental result for torque estimation. (a) MATLAB/Simulink technology. All calculations in the modules are conducted in
simulation, (b) FPGA based experimental result two's complement fixed-point arithmetic with appropriate
word sizes. The choice of word sizes, the binary format and
the sampling time used are very important in order to achieve
a good implementation of the estimators. To get simpler
implementation and fast computation, several methods were
introduced: i) the backward Euler approach to calculate the
discrete integration operation of stator flux, ii) the modified
non-restoring method to calculate complicated square root
operation of stator flux, iii) a new sector analysis method; the
(a) (b) simulation results of the DTC model in MATLAB/Simulink,
Fig. 14. The comparison between MATLAB/Simulink simulation and the
experimental result for flux locus. (a) MATLAB/Simulink simulation, TABLE III
(b) FPGA based experimental result INDUCTION MACHINE PARAMETERS
Parameters Type or values
Rotor type Squirrel-cage
The tests have taken place only during certain periods of Nominal power 2425 VA
motor’s steady state and the results were observed on the Voltage (line to line) 400 V
oscilloscope. The experiment results are based on hardware- Frequency 50 Hz
Stator resistance, Rs 5.5 ohm
in-the-loop (HiL). In order to evaluate these FPGA-based
Rotor resistance, Rr 4.45 ohm
estimators and controller, the induction machine is simulated Stator self inductance, Ls 0.0149 H
using the FPGA device. The induction motor is modeled based Rotor self inductance, Lr 0.0149 H
on look-up table whereby the motor currents are generated Mutual inductance, Lm 0.299 H
based on the switching status generated by the DTC controller Combined inertia, J 0.00925 kg-m2
Combined viscous friction, B 0.006 N.m.s
and the DC link voltage. The HiL set-up is illustrated in Number of pole pairs, P 2
Fig. 12 and the parameters used for the simulation and HiL are
listed in Table III. Thereafter, the results were compared to the
which performed double-precision calculations, are used as
validated MATLAB/Simulink simulations (carried out in
references to digital computations executed in FPGA
double precision). Fig. 13 and Fig. 14 show some comparison
implementation. The Hardware-in-the-loop (HIL) method is
results between MATLAB/Simulink simulations and the
used to verify the minimal error between MATLAB/Simulink
experimental results. The conclusion is that of a fairly good
simulation and the experimental results. The design, which
match, It is important to know that the experimental outputs
was coded in synthesizable VHDL code for implementation
are displayed through a 12-bit DAC. So, all outputs are
on Altera APEX20K200EFC484-2x device, has produced very
truncated within 12-bits. Therefore, it is fair to accept that the
good estimations, giving minimal errors when being compared
outputs are not perfectly the same as the simulation outputs.
to MATLAB/Simulink double-precision calculations.
However, the results have proved that the proposed FPGA
implementation of the torque and stator flux estimators was
successful. This means that the main problem - "the heart of ACKNOWLEDGMENT
the DTC" of the FPGA implementation - has been resolved. The authors would like to thank the Universiti Teknologi
All units in the system have been designed in fully generic Malaysia (UTM) for providing the funding for this research.
VHDL code, independent of the target implementation
technology, without the need for third party products or
special FPGAs. Given that most of the DTC research solutions
have limitations on the performance of the implementation of
10