Sensorless ACIM Field-Oriented Control: Design Reference Manual
Sensorless ACIM Field-Oriented Control: Design Reference Manual
Sensorless ACIM Field-Oriented Control: Design Reference Manual
Contents
1. Introduction
This document describes the software design of the 1. Introduction ....................................................................... 1
direct vector control of 3-phase AC Induction Motors 2. AC induction motor ........................................................... 2
2.1. Equivalent circuit of induction motor ........................ 4
(ACIM). ACIMs are popular in the industry for a 2.2. Space vector model of AC induction motor............... 5
number of reasons, such as: 3. ACIM field-oriented control .............................................. 9
3.1. Rotor flux observer .................................................. 12
• Their construction is extremely optimized, because 3.2. Rotor speed estimation ............................................ 15
they have been produced for years. 3.3. Max Torque Per Ampere ......................................... 16
3.4. Flux weakening ....................................................... 17
• They are very simple and the manufacturing costs 3.5. Space vector modulation ......................................... 18
are low, because they do not include any expensive 4. Software design ............................................................... 20
4.1. Data types ................................................................ 22
components (such as permanent magnets). 4.2. Scaling of analog quantities ..................................... 23
• They are robust and require minimum maintenance 4.3. Motor-control algorithms synchronization .............. 24
4.4. State machines ......................................................... 25
due to the absence of brushes, permanent magnets, 4.5. ACIM control software implementation .................. 34
or other complicated mechanical elements. 5. References ....................................................................... 39
6. Revision history ............................................................... 39
• Unlike Permanent Magnet Synchronous Motors
(PMSM), they can run without any control method
using the mains 3-phase voltage.
You can find induction motors in applications like
water pumps, compressors, fans, and air-conditioning
systems. To achieve variable speed operations with a
3-phase AC induction motor, variable voltage and
frequency must be supplied to the motor. The modern
3-phase variable speed drives achieve this using
digitally-controlled switching inverters. NXP offers the
High-Voltage Motor-Control Platform (HVP) power
stage, which supports many kinds of MCUs, easily
interchangeable using expansion cards. For more
information, see the Freescale High-Voltage Motor-
Control Platform User's Guide (document
HVPMC3PHUG).
The control algorithms can be divided into two groups. The first group is called Scalar Control (SC). As
the name suggest, these algorithms were inferred for a steady state (all quantities are scalar values) and
the dynamic behavior of the machine is ignored. The constant Volt per Hertz (V/Hz) control is a very
popular and simple technique, representing the scalar control of variable speed drives. The second group
is called Vector Control (VC), or Field-Oriented Control (FOC). This time the quantities like voltages
and currents within the motor are treated as vectors. While being more computationally complex, FOC
brings overall improvements in drive performance over the scalar control, such as improved dynamics,
full torque control from zero to the nominal speed, higher efficiency, decoupled control of flux and
torque, and other.
The field-oriented methods for the PMSM and ACIM have basically the same principle, but, for the
ACIM FOC, the amplitude of the rotor flux must be controlled and its position must be estimated, rather
than the position of the rotor itself. It is because the rotor flux is not attached to the rotor (as in the case
of PMSM). This also means that the rotor speed does not match the magnetic flux speed (there is the
slip) and must be estimated separately as well. More details about the ACIM FOC are found further on
in this document.
This document shows the reference design of a platform-independent field-oriented control algorithm
for 3-phase AC induction motors, targeted mainly for the consumer and industrial applications. The
reference design is based on the Real-Time Control Embedded Software Libraries (RTCESL) for the
ARM® Cortex® platform, which include various math, general, and motor-control function libraries (see
www.nxp.com/rtcesl).
2. AC induction motor
An AC induction motor is a rotating electric machine, designed to be powered by a 3-phase alternating
current. For variable speed drives, the source is usually an inverter that uses power switches to produce
voltage pulses and generate approximate sinusoidal voltages and currents of a controllable magnitude
and frequency.
The squirrel-cage AC induction motors are popular due to their simple construction, low cost per
horsepower, minimum maintenance, and are available in a wide range of power ratings. With
field-oriented control methods, AC induction motors can fully replace standard DC motors, even in
high-performance applications. The squirrel-cage rotor has aluminum conductors (or bars), which are
cast into the slots in the outer periphery of the rotor. These conductors (or bars) are shorted together at
both ends of the rotor by cast aluminum end rings, which can be also shaped to act as fans. In larger
induction motors, copper or copper-alloy bars are used to fabricate the rotor cage winding.
The cross section of a 2-pole induction motor is shown in the following figure. The slots in the inner
periphery of the stator accommodate the 3-phase windings A, B, and C. The turns in each winding are
distributed in such way that the current in the stator winding produces the approximate
harmonically-distributed flux density around the periphery of the air gap. When the 3-phase sinusoidal
current with a 120° phase mutual displacement of each phase flows through the stator, a radially directed
flux, rotating with a synchronous speed is generated.
When the harmonically-distributed flux density wave produced by the stator magnetizing currents
sweeps past the rotor conductors, it induces voltage in them. The result is a harmonically distributed set
of currents in the short-circuited rotor bars. Because of the low resistance of these shorted bars, only a
small relative angular velocity between the angular velocity of the flux wave 𝜔𝜔𝑒𝑒 and the mechanical
angular velocity 𝜔𝜔𝑚𝑚 of the 2-pole rotor is required to produce the necessary rotor current. This relative
angular velocity is called the slip velocity
where 𝜔𝜔𝑟𝑟 is the rotor electrical speed and 𝑃𝑃𝑝𝑝 is the number of motor pole-pairs. This leads to the
definition of an important quantity, called the slip:
(𝝎𝝎𝒆𝒆 −𝝎𝝎𝒓𝒓 ) Eq. 2
𝒔𝒔 = [-]
𝝎𝝎𝒆𝒆
The interaction of the harmonically distributed air gap flux and the induced rotor currents produces
torque in the rotor. The machine produces torque only with a non-zero slip. This is why the induction
motors are also called asynchronous. The relationship between the rotor electrical speed 𝜔𝜔𝑟𝑟 and
frequency 𝑓𝑓𝑟𝑟 is:
The mechanical rotor speed related to the number of pole-pairs in revolutions per minute (rpm) is:
𝒇𝒇𝒓𝒓 Eq. 4
𝑵𝑵𝒎𝒎 = 𝟔𝟔𝟔𝟔 [rpm]
𝑷𝑷𝒑𝒑
The typical induction machine speed-torque characteristic is shown in the following figure. The first
way of characteristic division is by the machine states into the braking, motor, and generator regions.
FOC can control the machine in each of these states. The motor and generator states are
centrally-symmetric around the zero-torque point. When the motor operates in the stable motor region
(green area located between the machine maximum positive or negative torques), the increasing slip
(loading torque) leads to the generation of a higher torque. The increase of the load torque in unstable
motor regions leads to a drop in the generated torque and potentially to the stopping or reversing of the
rotor. When the motor operates using FOC, it uses only the stable part. The stable region can be moved
left or right by changing the supply frequency.
The following sections are dedicated to the ACIM modeling. Section 2.1, “The equivalent circuit of
induction motor” shows the equivalent circuit of ACIM. However, the model used for the FOC design
utilizes the space-vector theory, which is described in Section 2.2, “Space vector model of AC induction
machine”.
where 𝑎𝑎 = 𝑒𝑒 𝑗𝑗2𝜋𝜋\3 and 𝑎𝑎2 = 𝑒𝑒 −𝑗𝑗2𝜋𝜋\3 are the spatial operators, and 𝑘𝑘 is the transformation constant. This
constant is usually selected as 𝑘𝑘 = 2/3, so that the resulting stator current space vector has the same
amplitude as the phase currents. Figure 4 shows the stator-current space vector projection.
However, the space vector rotates only in a 2-dimensional space, so only two axes are needed to express
it. The stator current vector can be expressed as:
where 𝑖𝑖𝑠𝑠𝑠𝑠 and 𝑖𝑖𝑠𝑠𝑠𝑠 are the real and imaginary components of the stator current vector in the 𝛼𝛼𝛼𝛼 stator
reference frame (the alpha axis is usually selected to be aligned with the axis of phase A). Note that the
currents 𝑖𝑖𝑠𝑠𝑠𝑠 and 𝑖𝑖𝑠𝑠𝑠𝑠 are only fictitious and can’t be measured directly within the machine. This is called
the Clarke transformation, and, assuming that 𝑖𝑖𝑠𝑠𝑠𝑠 + 𝑖𝑖𝑠𝑠𝑠𝑠 + 𝑖𝑖𝑠𝑠𝑠𝑠 = 0, the relation between two and three
phase currents is:
𝟏𝟏 𝟐𝟐
𝒊𝒊𝒔𝒔𝒔𝒔 = 𝒊𝒊𝒔𝒔b + 𝒊𝒊𝒔𝒔𝒔𝒔 Eq. 8
√𝟑𝟑 √𝟑𝟑
The principle of Clarke transformation is shown in Figure 4. The inverse Clarke transformation is
defined as:
𝟏𝟏 √𝟑𝟑 Eq. 10
𝒊𝒊𝒔𝒔𝒔𝒔 = − 𝒊𝒊𝒔𝒔𝒔𝒔 + 𝒊𝒊
𝟐𝟐 𝟐𝟐 𝒔𝒔𝒔𝒔
𝟏𝟏 √𝟑𝟑 Eq. 11
𝒊𝒊𝒔𝒔𝒔𝒔 = − 𝒊𝒊𝒔𝒔𝒔𝒔 − 𝒊𝒊
𝟐𝟐 𝟐𝟐 𝒔𝒔𝒔𝒔
The space vectors of the other motor quantities (like voltages and magnetic fluxes) can be defined in the
same way as the stator-current space vector above.
Besides the stationary 𝛼𝛼𝛼𝛼 reference frame, the space vectors can be formulated in the general 𝛾𝛾𝛾𝛾
reference frame, rotating at the general speed 𝜔𝜔𝑔𝑔 = d𝜃𝜃𝑔𝑔 /d𝑡𝑡, as shown in Figure 5. The direct axis of the
rotating reference frame 𝛾𝛾 is rotated from axis 𝛼𝛼 by angle 𝜃𝜃𝑔𝑔 . The stator-current space vector in the
general 𝛾𝛾𝛾𝛾 reference frame can be expressed as:
The voltage and flux-linkage space vectors in the general reference frame 𝛾𝛾𝛾𝛾 can be obtained in a
similar way.
𝒅𝒅𝝍𝝍𝒔𝒔𝒔𝒔
𝒖𝒖𝒔𝒔𝒔𝒔 = 𝑹𝑹𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 + , Eq. 18
𝒅𝒅𝒅𝒅
𝒅𝒅𝝍𝝍𝒓𝒓𝒓𝒓
𝒖𝒖𝒓𝒓𝒓𝒓 = 𝟎𝟎 = 𝑹𝑹𝒓𝒓 𝒊𝒊𝒓𝒓𝒓𝒓 + − 𝝎𝝎𝒓𝒓 𝝍𝝍𝒓𝒓𝒓𝒓 , Eq. 20
𝒅𝒅𝒅𝒅
where 𝜓𝜓�⃗𝑟𝑟𝑟𝑟𝑟𝑟 = 𝜓𝜓𝑟𝑟𝑟𝑟 + 𝑗𝑗𝜓𝜓𝑟𝑟𝑟𝑟 is the rotor flux linkage. The left-hand side shows that the rotor voltage sums
up to zero in a squirrel-cage induction motor.
The stator and rotor flux linkages, expressed in terms of the stator and rotor current space vectors, are:
where 𝐿𝐿𝑠𝑠 , 𝐿𝐿𝑟𝑟 , and 𝐿𝐿𝑚𝑚 are the stator, rotor, and mutual inductances. The electromagnetic torque generated
by the machine is:
𝟑𝟑 𝑳𝑳𝒎𝒎
𝑻𝑻 = 𝑷𝑷𝒑𝒑 �𝝍𝝍𝒔𝒔𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 − 𝝍𝝍𝒔𝒔𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 � Eq. 25
𝟐𝟐 𝑳𝑳𝒓𝒓
The mechanical differential equation of the rotor is:
𝒅𝒅𝝎𝝎𝒓𝒓 𝑷𝑷𝒑𝒑 𝑩𝑩
= �𝑻𝑻 − 𝑻𝑻𝒍𝒍𝒍𝒍𝒍𝒍𝒍𝒍 − 𝑷𝑷 𝝎𝝎𝒓𝒓 �, Eq. 26
𝒅𝒅𝒅𝒅 𝑱𝑱 𝒑𝒑
where 𝐽𝐽 is the moment of inertia, 𝐵𝐵 is the viscous friction, and 𝑇𝑇𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙 is the load torque.
���⃗
𝝍𝝍𝒓𝒓𝒓𝒓𝒓𝒓 = 𝑳𝑳𝒓𝒓 𝒊𝒊⃗𝒓𝒓𝜸𝜸𝜸𝜸 + 𝑳𝑳𝒎𝒎 𝒊𝒊⃗𝒔𝒔𝜸𝜸𝜸𝜸 Eq. 30
Because of the alignment with rotor flux, the 𝑑𝑑𝑑𝑑 reference frame is rotating at a synchronous speed
𝜔𝜔𝑒𝑒 = d𝜃𝜃𝜓𝜓𝑟𝑟 /d𝑡𝑡. When substituting 𝜔𝜔𝑔𝑔 = 𝜔𝜔𝑒𝑒 in the machine model from Section 2.2.3, “ACIM model in
general rotating reference frame”, the stator and rotor voltages are:
���⃗𝒔𝒔𝒔𝒔𝒔𝒔
𝒅𝒅𝝍𝝍
�⃗𝒔𝒔𝒔𝒔𝒔𝒔 = 𝑹𝑹𝒔𝒔 𝒊𝒊⃗𝒔𝒔𝒔𝒔𝒔𝒔 +
𝒖𝒖 + 𝒋𝒋𝝎𝝎𝒆𝒆 ���⃗
𝝍𝝍𝒔𝒔𝒔𝒔𝒔𝒔 Eq. 32
𝒅𝒅𝒅𝒅
���⃗𝒓𝒓𝒓𝒓𝒓𝒓
𝒅𝒅𝝍𝝍
𝟎𝟎 = 𝑹𝑹𝒓𝒓 𝒊𝒊⃗𝒓𝒓𝒅𝒅𝒅𝒅 + ���⃗𝒓𝒓𝒓𝒓𝒓𝒓
+ 𝒋𝒋(𝝎𝝎𝒆𝒆 − 𝝎𝝎𝒓𝒓 )𝝍𝝍 Eq. 33
𝒅𝒅𝒅𝒅
Combining the voltage equations Eq. 32 and Eq. 33 with the flux-linkage equations Eq. 29 and Eq. 30
leads to:
𝒅𝒅𝒊𝒊⃗𝒔𝒔𝒔𝒔𝒔𝒔 ���⃗𝒓𝒓𝒓𝒓𝒓𝒓
𝑳𝑳𝒎𝒎 𝒅𝒅𝝍𝝍 𝑳𝑳𝒎𝒎
�𝒖𝒖⃗𝒔𝒔𝒔𝒔𝒔𝒔 = 𝑹𝑹𝒔𝒔 𝒊𝒊⃗𝒔𝒔𝒔𝒔𝒔𝒔 + 𝝈𝝈𝑳𝑳𝒔𝒔 + 𝒋𝒋𝝎𝝎𝒆𝒆 𝝈𝝈𝑳𝑳𝒔𝒔⃗ı𝒔𝒔𝒔𝒔𝒔𝒔 + + 𝒋𝒋𝝎𝝎𝒆𝒆 ���⃗
𝝍𝝍𝒓𝒓𝒓𝒓𝒓𝒓 , Eq. 34
𝒅𝒅𝒅𝒅 𝑳𝑳𝒓𝒓 𝒅𝒅𝒅𝒅 𝑳𝑳𝒓𝒓
���⃗𝒓𝒓𝒓𝒓𝒓𝒓
𝒅𝒅𝝍𝝍 𝑳𝑳𝒎𝒎 𝟏𝟏
= 𝒊𝒊⃗ − �𝒋𝒋(𝝎𝝎𝒆𝒆 − 𝝎𝝎𝒓𝒓 ) + � ���⃗
𝝍𝝍𝒓𝒓𝒓𝒓𝒓𝒓 , Eq. 35
𝒅𝒅𝒅𝒅 𝝉𝝉𝒓𝒓 𝒔𝒔𝒅𝒅𝒅𝒅 𝝉𝝉𝒓𝒓
where 𝜎𝜎 = 1 − 𝐿𝐿2𝑚𝑚 /(𝐿𝐿𝑠𝑠 𝐿𝐿𝑟𝑟 ) is the leakage coefficient and 𝜏𝜏𝑟𝑟 = 𝐿𝐿𝑟𝑟 /𝑅𝑅𝑟𝑟 is the rotor time constant. Notice
that the above equations no longer contain the rotor current. Because the rotor flux is aligned with the
direct axis, the q-axis component of the rotor flux 𝜓𝜓𝑟𝑟𝑟𝑟 is zero. Considering motor operation with the
constant flux d𝜓𝜓𝑟𝑟𝑟𝑟 /d𝑡𝑡 = 0, the above equations are simplified as:
𝒅𝒅𝒊𝒊𝒔𝒔𝒔𝒔
𝒖𝒖𝒔𝒔𝒔𝒔 = 𝑹𝑹𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 + 𝝈𝝈𝑳𝑳𝒔𝒔 − 𝝎𝝎𝒆𝒆 𝝈𝝈𝑳𝑳𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 Eq. 36
𝒅𝒅𝒅𝒅
𝒅𝒅𝒊𝒊𝒔𝒔𝒔𝒔 𝑳𝑳𝒎𝒎
𝒖𝒖𝒔𝒔𝒔𝒔 = 𝑹𝑹𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 + 𝝈𝝈𝑳𝑳𝒔𝒔 + 𝝎𝝎𝒆𝒆 𝝈𝝈𝑳𝑳𝒔𝒔 𝒊𝒊s𝒅𝒅 + 𝝎𝝎𝒆𝒆 𝝍𝝍 Eq. 37
𝒅𝒅𝒅𝒅 𝑳𝑳𝒓𝒓 𝒓𝒓𝒓𝒓
𝒅𝒅𝝍𝝍𝒓𝒓𝒓𝒓 𝟏𝟏 𝑳𝑳𝒎𝒎
= − 𝝍𝝍𝒓𝒓𝒓𝒓 + 𝒊𝒊 ≅ 𝟎𝟎 → 𝝍𝝍𝒓𝒓𝒓𝒓 = 𝑳𝑳𝒎𝒎 𝒊𝒊𝒔𝒔𝒔𝒔 Eq. 38
𝒅𝒅𝒅𝒅 𝝉𝝉𝒓𝒓 𝝉𝝉𝒓𝒓 𝒔𝒔𝒔𝒔
The torque equation is:
𝟑𝟑 𝑳𝑳𝒎𝒎
𝑻𝑻 = 𝑷𝑷𝒑𝒑 𝝍𝝍 𝒊𝒊 Eq. 39
𝟐𝟐 𝑳𝑳𝒓𝒓 𝒓𝒓𝒓𝒓 𝒔𝒔𝒔𝒔
Notice from equations Eq. 38 and Eq. 39 that the stator current is decoupled into the torque-producing
𝑖𝑖𝑠𝑠𝑠𝑠 and flux-producing 𝑖𝑖𝑠𝑠𝑠𝑠 components.
A very important aspect of using the 𝑑𝑑𝑑𝑑 reference synchronous frame is that all motor quantities in this
frame are no longer harmonic, but DC functions (as shown in the following figure), which greatly
simplifies their control.
The basic scheme of the direct field-oriented ACIM control is shown in the following figure. Because
the rotor flux can’t be easily measured directly, the rotor flux observer algorithm is necessary for the
estimation of the 𝜃𝜃𝜓𝜓𝑟𝑟 angle. The required rotor flux amplitude and torque commands are the inputs of
FOC.
The overview block diagram of the implemented control algorithm is shown in the following figure. The
rotor flux position 𝜃𝜃𝜓𝜓𝑟𝑟 and rotor speed 𝜔𝜔𝑚𝑚 are estimated using the rotor flux observer and the speed
estimator (the Model-Reference Adaptive System type in this design). The control process utilizes the
𝑖𝑖𝑠𝑠𝑠𝑠 and 𝑖𝑖𝑠𝑠𝑠𝑠 current PI controllers. The 𝑖𝑖𝑠𝑠𝑠𝑠 current is used to control the rotor magnetizing flux. The goal
of the 𝑖𝑖𝑠𝑠𝑠𝑠 current control is usually to achieve a better power efficiency (for example, with the Max
Torque per Ampere algorithm) or to reach the above-nominal speed (flux-weakening algorithm). The
torque-producing 𝑖𝑖𝑠𝑠𝑠𝑠 current required value is set by the speed PI controller. The DC-Bus
ripple-elimination and SVM algorithms are used to generate the desired stator voltage vector, which is
applied to the motor.
The following sections provide a closer description of the rotor flux observer, the MRAS speed
estimator, and the field-weakening, Max Torque per Ampere, and Space Vector Modulation algorithms
used in this reference design.
However, the stator flux estimator in this form contains a pure integration, which has problems with the
drift. These problems can be solved by approximating the pure integrator with the low-pass filter, which
suppresses the lower frequencies and prevents the drift. The operator transfer function of the integrator
is then replaced as:
𝟏𝟏 𝝉𝝉𝟏𝟏
≅ , Eq. 41
𝒔𝒔 𝝉𝝉𝟏𝟏 𝒔𝒔+𝟏𝟏
where 𝜏𝜏1 = 1/(2𝜋𝜋𝑓𝑓1 ) is the approximation time constant. The example of this situation is shown in
Figure 11. Set the low-pass filter cut-off frequency one order below the lowest frequency of the signal
that must be integrated. A very low cut-off frequency might not prevent the drift and very high values
might lead to a high number of estimation errors. The final transfer function of the stator flux estimator
is:
𝝉𝝉𝟏𝟏
𝜳𝜳𝒔𝒔𝒔𝒔 (𝒔𝒔) = [𝑼𝑼 (𝒔𝒔) − 𝑹𝑹𝒔𝒔 𝑼𝑼𝒔𝒔𝜶𝜶 (𝒔𝒔)] Eq. 42
𝝉𝝉𝟏𝟏 𝒔𝒔 + 𝟏𝟏 𝒔𝒔𝜶𝜶
𝝉𝝉𝟏𝟏
𝜳𝜳𝒔𝒔𝒔𝒔 (𝒔𝒔) = �𝑼𝑼 (𝒔𝒔) − 𝑹𝑹𝒔𝒔 𝑼𝑼𝒔𝒔𝜷𝜷 (𝒔𝒔)� Eq. 43
𝝉𝝉𝟏𝟏 𝒔𝒔 + 𝟏𝟏 𝒔𝒔𝜷𝜷
The final rotor flux estimation is obtained from Eq. 21, Eq. 22, Eq. 23, and Eq. 24 as:
���⃗ 𝑳𝑳 ���⃗
� 𝒓𝒓𝒓𝒓𝒓𝒓 = 𝒓𝒓 �𝝍𝝍
𝝍𝝍 � − 𝝈𝝈𝝈𝝈𝒔𝒔 𝒊𝒊⃗𝒔𝒔𝜶𝜶𝜶𝜶 � Eq. 44
𝑳𝑳𝒎𝒎 𝒔𝒔𝒔𝒔𝒔𝒔
These equations show that the rotor flux linkage is basically the difference between the stator flux
linkage and the leakage flux.
These discrete equations of the voltage model rotor flux estimator are obtained using the Euler’s method
with the sampling time 𝑇𝑇𝑠𝑠 :
𝝉𝝉𝟏𝟏
� 𝒔𝒔𝒔𝒔 (𝒌𝒌) =
𝝍𝝍 � (𝒌𝒌 − 𝟏𝟏) + 𝑻𝑻𝒔𝒔 �𝒖𝒖𝒔𝒔𝒔𝒔 (𝒌𝒌) − 𝑹𝑹𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 (𝒌𝒌)��
�𝝍𝝍 Eq. 45
𝝉𝝉𝟏𝟏 + 𝑻𝑻𝒔𝒔 𝒔𝒔𝒔𝒔
𝝉𝝉𝟏𝟏
� 𝒔𝒔𝒔𝒔 (𝒌𝒌) =
𝝍𝝍 � (𝒌𝒌 − 𝟏𝟏) + 𝑻𝑻𝒔𝒔 �𝒖𝒖𝒔𝒔𝒔𝒔 (𝒌𝒌) − 𝑹𝑹𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 (𝒌𝒌)��
�𝝍𝝍 Eq. 46
𝝉𝝉𝟏𝟏 + 𝑻𝑻𝒔𝒔 𝒔𝒔𝒔𝒔
𝑳𝑳𝒓𝒓
� 𝒓𝒓𝒓𝒓 (𝒌𝒌) =
𝝍𝝍 � (𝒌𝒌) − 𝝈𝝈L𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 (𝒌𝒌)�
�𝝍𝝍 Eq. 47
𝑳𝑳𝒎𝒎 𝒔𝒔𝒔𝒔
𝑳𝑳𝒓𝒓
� 𝒓𝒓𝒓𝒓 (𝒌𝒌) =
𝝍𝝍 � (𝒌𝒌) − 𝝈𝝈𝝈𝝈𝒔𝒔 𝒊𝒊𝒔𝒔𝒔𝒔 (𝒌𝒌)�
�𝝍𝝍 Eq. 48
𝑳𝑳𝒎𝒎 𝒔𝒔𝒔𝒔
This rotor flux estimation is used to calculate the final RFO output rotor flux angle 𝜃𝜃𝜓𝜓𝑟𝑟 estimate,
according to this equation:
� 𝒓𝒓𝒓𝒓
𝝍𝝍
𝜽𝜽𝝍𝝍𝒓𝒓 = 𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 � � Eq. 49
� 𝒓𝒓𝒓𝒓
𝝍𝝍
The stator model is sufficiently robust and accurate at higher frequencies. These two deficiencies can
degrade this model as the speed reduces: the integration problem, and the model’s sensitivity to the
stator resistance mismatch.
Using the Euler’s discretization method with the sampling time 𝑇𝑇𝑠𝑠 , the current model rotor flux
estimator is obtained:
𝝉𝝉𝒓𝒓 𝑳𝑳𝒎𝒎
𝝍𝝍𝒓𝒓𝒓𝒓 (𝒌𝒌) = �𝝍𝝍𝒓𝒓𝒓𝒓 (𝒌𝒌 − 𝟏𝟏) + 𝑻𝑻𝒔𝒔 𝒊𝒊 (𝒌𝒌)� Eq. 51
𝝉𝝉𝒓𝒓 + 𝑻𝑻𝒔𝒔 𝝉𝝉𝒓𝒓 𝒔𝒔𝒔𝒔
The accuracy of the rotor model estimator depends on correct model parameters, especially the rotor
time constant 𝜏𝜏𝑟𝑟 .
The RFO described in Section 3.1, “Rotor flux observer” serves as the reference rotor flux model. The
adaptive model is based on Eq. 35 and operates in the 𝑑𝑑𝑑𝑑 synchronous rotating reference frame,
according to this equation:
Sensorless ACIM Field-Oriented Control, Design Reference Manual, Rev. 1, 01/2017
NXP Semiconductors 15
ACIM field-oriented control
���⃗
� 𝒓𝒓𝒓𝒓𝒓𝒓
𝒅𝒅𝝍𝝍 𝟏𝟏 𝑳𝑳
= − ���⃗ � 𝒓𝒓 ���⃗
� 𝒓𝒓𝒓𝒓𝒓𝒓 + 𝒋𝒋𝝎𝝎
𝝍𝝍 � 𝒓𝒓𝒓𝒓𝒓𝒓 + 𝒎𝒎 𝒊𝒊⃗𝒔𝒔𝒔𝒔𝒔𝒔
𝝍𝝍 Eq. 52
𝒅𝒅𝒅𝒅 𝝉𝝉𝒓𝒓 𝝉𝝉𝒓𝒓
The phase angle between the two rotor flux vectors 𝜓𝜓��⃗𝑟𝑟𝑟𝑟𝑟𝑟
′
and 𝜓𝜓��⃗𝑟𝑟𝑟𝑟𝑟𝑟
′′
, estimated by the reference and
adaptive model observers, is compensated by the PI controller that sets the estimated rotor speed 𝜔𝜔 �𝑟𝑟 for
the adaptive model. The control error for this PI controller is calculated as a cross-product of two
estimated fluxes:
𝒆𝒆𝑴𝑴𝑴𝑴𝑴𝑴𝑴𝑴 = ���⃗
𝝍𝝍 ���⃗
� ′𝒓𝒓𝒓𝒓𝒓𝒓 ×𝝍𝝍
� ′′ � ′ � ′′ � ′ � ′′
𝒓𝒓𝒓𝒓𝒓𝒓 = 𝝍𝝍𝒓𝒓𝒓𝒓 𝝍𝝍𝒓𝒓𝒓𝒓 − 𝝍𝝍𝒓𝒓𝒓𝒓 𝝍𝝍𝒓𝒓𝒓𝒓
Eq. 53
where 𝜃𝜃𝐼𝐼 is the angle of the current vector 𝚤𝚤⃗𝑠𝑠𝑠𝑠𝑠𝑠 . The optimal current angle is then calculated as:
𝒅𝒅𝒅𝒅 𝟑𝟑 𝑳𝑳𝟐𝟐𝒎𝒎 𝝅𝝅
= 𝑷𝑷𝒑𝒑 �𝒊𝒊⃗𝒔𝒔𝒔𝒔𝒔𝒔 � 𝒄𝒄𝒄𝒄𝒄𝒄 𝜽𝜽𝑰𝑰 = 𝟎𝟎 → 𝜽𝜽𝑰𝑰 = , Eq. 55
𝒅𝒅𝜽𝜽𝑰𝑰 𝟐𝟐 𝑳𝑳𝒓𝒓 𝟒𝟒
According to MTPA, the components of the stator current vector in the 𝑑𝑑𝑑𝑑 reference frame should be
simply equal.
The power equation for ACIM is:
𝟐𝟐
𝑷𝑷𝒊𝒊𝒊𝒊 = 𝑷𝑷𝑪𝑪𝑪𝑪 + 𝑷𝑷𝒍𝒍𝒍𝒍𝒍𝒍𝒍𝒍 + 𝑷𝑷𝒐𝒐𝒐𝒐𝒐𝒐 = 𝑹𝑹𝒔𝒔 �𝒊𝒊⃗𝒔𝒔𝒔𝒔𝒔𝒔 � + 𝑷𝑷𝒍𝒍𝒍𝒍𝒍𝒍𝒍𝒍 + 𝑻𝑻𝝎𝝎𝒎𝒎 , Eq. 56
where 𝑃𝑃𝑖𝑖𝑖𝑖 is the input electrical power, 𝑃𝑃𝐶𝐶𝐶𝐶 is the Joule loss in the stator, 𝑃𝑃𝑜𝑜𝑜𝑜𝑜𝑜 is the output mechanical
power, and 𝑃𝑃𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙 is the remaining power loss including the core losses, the Joule losses in the rotor, and
the stray losses. Notice that selecting 𝑖𝑖𝑠𝑠𝑠𝑠 = 𝑖𝑖𝑠𝑠𝑠𝑠 minimizes the stator joule losses. While the overall
power losses 𝑃𝑃𝐶𝐶𝐶𝐶 + 𝑃𝑃𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙 are not minimized by such selection, the stator Joule losses form the majority
of the overall losses and their minimization improves the power efficiency significantly.
The output d-axis stator current must be limited. The upper limit 𝑖𝑖𝑠𝑠𝑠𝑠,𝑚𝑚𝑚𝑚𝑚𝑚 is set so that the stator current
amplitude �𝚤𝚤⃗𝑠𝑠𝑠𝑠𝑠𝑠 � does not exceed the maximal stator current amplitude 𝐼𝐼𝑚𝑚𝑚𝑚𝑚𝑚 (usually the nominal
current), which means 𝑖𝑖𝑠𝑠𝑠𝑠,𝑚𝑚𝑚𝑚𝑚𝑚 = 𝐼𝐼𝑚𝑚𝑚𝑚𝑚𝑚 /√2. When the available stator voltage 𝑈𝑈𝑚𝑚𝑚𝑚𝑚𝑚 is lower than the
nominal voltage 𝑈𝑈𝑁𝑁 and the nominal speed must remain reachable, the maximal d-axis stator current can
be calculated as:
𝑼𝑼𝒎𝒎𝒎𝒎𝒎𝒎
𝒊𝒊𝒔𝒔𝒔𝒔,𝒎𝒎𝒎𝒎𝒎𝒎 ≅ , Eq. 57
𝟐𝟐𝝅𝝅𝑳𝑳𝒎𝒎 𝒇𝒇𝑵𝑵
where 𝑓𝑓𝑁𝑁 is the nominal frequency. The other upper 𝑖𝑖𝑠𝑠𝑠𝑠,𝑚𝑚𝑚𝑚𝑚𝑚 limitations may be set by the
flux-weakening algorithms (see Section 3.4, “Flux weakening”). The lower limit 𝑖𝑖𝑠𝑠𝑠𝑠,𝑚𝑚𝑚𝑚𝑚𝑚 has only one
particular restriction, which is keeping the sufficient rotor flux amplitude level for the RFO to function
properly (very low signal levels lead to problems with noise, rounding, and parameter uncertainty). The
final stator current trajectory is shown in this figure:
There are two issues to note. As mentioned in Section 3, “ACIM field-oriented control”, FOC is based
on the assumption that the d-axis rotor flux is constant (d𝜓𝜓𝑟𝑟𝑟𝑟 /d𝑡𝑡 = 0) and the 𝑖𝑖𝑠𝑠𝑠𝑠 is constant as well.
While it is preferable to keep this condition true for high-dynamic applications, a slow change of the
d-axis current causes only minimal effect. It is recommended to use a low-pass filter on the d-axis stator
current required value or set a slower d-axis current control loop bandwidth to prevent too fast d-axis
current changes. Another issue is that, without an adequate compensation, the d-axis current level affects
the speed loop gain which is no longer constant. This causes a variation of the transient speed response.
There are eight possible switching states (vectors) on such 3-phase power stage configuration. They are
given by the combinations of the corresponding power switches 𝑆𝑆𝐴𝐴 , 𝑆𝑆𝐵𝐵 , and 𝑆𝑆𝐶𝐶 . The combinations of the
ON/OFF states in the power stage switches for each voltage vector are listed in the following table.
For each phase, a value of one means that the upper switch (𝑆𝑆𝐴𝐴𝐴𝐴 , 𝑆𝑆𝐵𝐵𝐵𝐵 , or 𝑆𝑆𝐶𝐶𝐶𝐶 ) is ON and the bottom
switch (𝑆𝑆𝐴𝐴𝐴𝐴 , 𝑆𝑆𝐵𝐵𝐵𝐵 , or 𝑆𝑆𝐶𝐶𝐶𝐶 ) is OFF. A value of zero means that the upper switch is OFF and the bottom
switch is ON. The resulting instantaneous output line-to-line voltages, phase voltages, and voltage
vectors for all states are listed in this table as well:
Table 1. Switching patterns and resulting instantaneous line-to-line phase voltages
𝑺𝑺𝑨𝑨 𝑺𝑺𝑩𝑩 𝑺𝑺𝑪𝑪 𝒖𝒖𝒔𝒔𝒔𝒔 𝒖𝒖𝒔𝒔𝒔𝒔 𝒖𝒖𝒔𝒔𝒔𝒔 𝒖𝒖𝒔𝒔𝒔𝒔𝒔𝒔 𝒖𝒖𝒔𝒔𝒔𝒔𝒔𝒔 𝒖𝒖𝒔𝒔𝒔𝒔𝒔𝒔 Vector
0 0 0 0 0 0 0 0 0 𝑂𝑂000
1 1 1 2𝑈𝑈𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷 /3 −𝑈𝑈𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷 /3 −𝑈𝑈𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷 /3 𝑈𝑈𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷 /3 0 −𝑈𝑈𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷 /3 𝑈𝑈0
R
There are six non-zero vectors 𝑈𝑈𝑥𝑥 ∈ 〈𝑈𝑈0 , 𝑈𝑈60 , 𝑈𝑈120 , 𝑈𝑈180 , 𝑈𝑈240 , 𝑈𝑈300 〉 and two zero vectors (𝑂𝑂000 and
𝑂𝑂111 ) defined in the 𝛼𝛼𝛼𝛼 coordinates. The six non-zero vectors also delimit the six sectors in which the
desired voltage vector 𝑢𝑢 �⃗𝑠𝑠𝑠𝑠𝑠𝑠 can be located. This 𝑢𝑢
�⃗𝑠𝑠𝑠𝑠𝑠𝑠 voltage vector is then created by applying the
sector base vectors (𝑈𝑈𝑥𝑥 and 𝑈𝑈𝑥𝑥±60 ) and the zero vectors (𝑂𝑂000 or 𝑂𝑂111 ) in such way that the average
vector of the PWM period 𝑇𝑇𝑃𝑃𝑃𝑃𝑃𝑃 is equal to the desired voltage vector. This means:
�⃗𝒔𝒔𝒔𝒔𝒔𝒔 = 𝑻𝑻𝟏𝟏 𝑼𝑼𝒙𝒙 + 𝑻𝑻𝟐𝟐 𝑼𝑼𝒙𝒙±𝟔𝟔𝟔𝟔 + 𝑻𝑻𝟎𝟎 (𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎 𝒗𝒗 𝟎𝟎𝟏𝟏𝟏𝟏𝟏𝟏 )
𝑻𝑻𝑷𝑷𝑷𝑷𝑷𝑷 𝒖𝒖 Eq. 58
To solve the time periods 𝑇𝑇0 , 𝑇𝑇1 , and 𝑇𝑇2 , the space voltage vector 𝑢𝑢
�⃗𝑠𝑠𝑠𝑠𝑠𝑠 must be decomposed into the
directions of the current sector base vectors 𝑈𝑈𝑥𝑥 and 𝑈𝑈𝑥𝑥±60 .
4. Software design
The basic steps of the FOC calculation are described in Section 3, “ACIM field-oriented control”. This
section provides more detailed information about the design of the ACIM FOC software and specific
issues, such as the numerical scaling in fixed-point fractional arithmetic, current sensing, prioritizing of
tasks, and the control state machines.
The ACIM FOC algorithm overview is provided in Figure 17. ACIM is an electro-mechanical system.
The electrical part of this system (described by the equivalent circuit in Section 2.1, “The equivalent
circuit of induction motor”) contains relatively very short time constants, and therefore the control of the
stator currents and the estimation of the rotor flux requires the short sampling time periods 𝑇𝑇𝑆𝑆 (usually
selected in order of 10-4 s). On the other hand, the mechanical part (described by the differential
equation Eq. 26) is usually represented by a system with much longer time constants, its control does not
require such a short sampling time, and it is calculated with the slow period 𝑇𝑇𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 . Thus, the
motor-control application can be divided into:
• Fast control loop—a high-priority task that executes these basic operations and algorithms every
𝑇𝑇𝑆𝑆 :
— Phase-current and DC-Bus voltage ADC sensing
The ADC sampling is synchronized with the PWM module using the trigger signals. A
digital filter is applied to the sampled values of the DC-Bus voltage. The phase currents
are used unfiltered. The 3-phase motor current is reconstructed from two samples taken at
the inverter’s shunt resistors. The ADC sensing and synchronization is described in more
detail later on in this document and in Sensorless ACIM Field-Oriented Control on
Kinetis® KV and KE (document AN5051) for specific peripherals .
— Clark and Park transformations
Used for transformations between different reference frames, as explained in
Section 2.2.1, “Space vector theory”.
— Rotor flux position observer and rotor speed MRAS estimator
Both algorithms are more closely described in Section 3.1, “Rotor flux observer” and
Section 3.2, “Rotor speed estimation”.
— Stator current PI controllers
The direct and quadrature axis stator currents are controlled using the PI controllers. The
direct axis voltage is limited as 𝑢𝑢𝑠𝑠𝑠𝑠 < 𝑈𝑈𝑚𝑚𝑚𝑚𝑚𝑚 and the quadrature voltage as
2
𝑢𝑢𝑠𝑠𝑠𝑠 < �𝑈𝑈𝑚𝑚𝑚𝑚𝑚𝑚 2
− 𝑢𝑢𝑠𝑠𝑠𝑠 . The maximum available stator voltage amplitude is reconstructed
based on the DC-Bus voltage measurement.
This application is written as a simple C project with the inclusion of the Real-Time Control Embedded
Software Libraries (RTCESL) written in the assembly language. Beside the data types, math functions,
controllers, and filters used in the application, the library also contains these algorithms:
where:
• Fractional value is a dimensionless fractional representation of a given quantity.
• Real value is the real quantity in physical units.
• Norm is the maximum defined quantity value used for scaling in physical units.
The following subsections provide examples of scaling of different quantities used by the ACIM FOC.
The implementation of this state machine structure is done in the state_machine.c and .h files. This code
defines the state machine structure:
/* State machine control structure */
typedef struct
{
SM APP_STATE_FCN_T const* psState; /* State functions */
SM_APP_TRANS_FCN_T const* psTrans; /* Transition functions */
SM_APP_CTRL uiCtrl; /* Control flags */
SM_APP_STATE_T eState; /* State */
} SM_APP_CTRL_T;
The user transient state machine functions are defined in this structure:
/* User state-transition functions structure*/
typedef struct
{
PFCN_VOID_VOID FaultStop;
PFCN_VOID_VOID InitFault;
PFCN_VOID_VOID InitStop;
PFCN_VOID_VOID StopFault;
PFCN_VOID_VOID StopRun;
PFCN_VOID_VOID RunFault;
PFCN_VOID_VOID RunStop;
} SM_APP_TRANS_FCN_T;
FAULT = 0,
INIT = 1,
STOP = 2,
RUN = 3,
} SM_APP_STATE_T;
Call the state machine from the code periodically using the following inline function, as shown in the
example for the fast control loop below. This function’s input is the pointer to the state machine
structure described above. This structure is declared and initialized in the code where the state machine
is called:
/* State machine function */
static inline void SM_StateMachineFast(SM_APP_CTRL_T *sAppCtrl)
{
gSM_STATE_TABLE_FAST[sAppCtrl -> eState](sAppCtrl);
}
The particular example of how to initialize and use the state machine structure is described later on in
this document.
The Run sub-states have transition functions that are called when going from one sub-state to another.
The sub-state transition functions are:
• Calib → Ready
— Calibration is done; entering the Ready state.
• Ready → Startup
— A non-zero speed command was issued.
— Certain variables are initialized (voltage, speed, position).
• Startup → Spin
— Startup elapsed; entering the Spin state.
• Startup → Freewheel
— Zero speed command; entering the Freewheel state.
— Certain variables are initialized (voltage, speed, position).
— The freewheel timer is set up.
• Spin → Freewheel
— Zero speed command issued; entering the Freewheel state.
— Certain variables are initialized (voltage, speed, position).
The Run sub-state machine is declared in a similar way. The Run sub-state identification variable has
these definitions:
typedef enum {
M1_CALIB = 0,
M1_READY = 1,
M1_STARTUP = 2,
M1_SPIN = 3,
M1_FREEWHEEL = 4
} M1_RUN_SUBSTATE_T; /* Run sub-states */
For the Run sub-states, two sets of user functions are defined. The user function prototypes of the Run
sub-states are:
static void M1_StateRunCalib(void);
static void M1_StateRunReady(void);
static void M1_StateRunStartup(void);
static void M1_StateRunSpin(void);
static void M1_StateRunFreewheel(void);
The state machine is called from the fast control loop ISR. The code syntax used to call the state
machine is:
/* StateMachine call */
SM_StateMachine(&gsM1_Ctrl);
Inside the user Run state function, the sub-state functions are called as:
/* Run sub-state function */
mM1_STATE_RUN_TABLE[meM1_StateRun]();
The inputs to this routine include the 3-phase current, the DC-Bus voltage, the electrical rotor flux
position, and the required 𝑑𝑑𝑑𝑑 currents. The output of this routine is the 3-phase duty cycle, the SVM
sector, and the saturation flags of the PI controllers. The PI controllers and filters have structures that
must be initialized before using this routine.
Example 1. Field-oriented current control code
typedef struct
{
AMCLIB_ACIM_ROT_FLUX_OBSRV_T_FLT sRFO; /* Rotor Flux Observer structure */
AMCLIB_ACIM_SPEED_MRAS_T_FLT sSpdObs; /* MRAS speed observer structure */
GFLIB_CTRL_PI_P_AW_T_FLT sPIParId; /* d-axis current controller */
GFLIB_CTRL_PI_P_AW_T_FLT sPIParIq; /* q-axis current controller */
GDFLIB_FILTER_IIR1_T_FLT sFiltParUDcBus; /* DC-bus voltage filter */
GMCLIB_3COOR_T_F16 sIABCFrac; /* meas. 3-phase current (f16) */
GMCLIB_3COOR_T_FLT sIABC; /* meas. 3-phase current [A] */
GMCLIB_3COOR_T_F16 sDutyABC; /* duty cycles (f16) */
GMCLIB_2COOR_ALBE_T_FLT sIAlBe; /* alpha/Beta current [A] */
GMCLIB_2COOR_DQ_T_FLT sIDQ; /* DQ stator current [A] */
GMCLIB_2COOR_DQ_T_FLT sIDQReq; /* required DQ current [A] */
GMCLIB_2COOR_DQ_T_FLT sIDQErr; /* DQ current error [A] */
GMCLIB_2COOR_ALBE_T_FLT sUAlBe; /* alpha/Beta stator voltage */
GMCLIB_2COOR_ALBE_T_F16 sUAlBeCmpFrac; /* DC-bus ripple elim. voltage */
GMCLIB_2COOR_ALBE_T_FLT sUAlBeDTComp; /* alpha/Beta stator voltage */
GMCLIB_2COOR_DQ_T_FLT sUDQReq; /* req. DQ voltage [V] */
GMCLIB_2COOR_DQ_T_FLT sUDQReqScalar; /* req. DQ scalar voltage [V] */
GMCLIB_2COOR_SINCOS_T_FLT sSCFOC; /* S&C of rotor flux angle [-] */
float_t fltDutyLim; /* max. allowable duty cycle [-] */
float_t fltUDcBus; /* DC-bus voltage [V] */
float_t fltUDcBusFilt; /* filtered DC-bus voltage [V] */
frac16_t f16UDcBus; /* DC-bus voltage (FRAC16) */
uint16_t ui16SectorSVM; /* SVM sector (sector) */
bool_t bFlagPIIdStopInt; /* d-axis PI ctrl stop int. flag */
bool_t bFlagPIIqStopInt; /* q-axis PI ctrl stop int. flag */
bool_t bFlagSpdStart; /* motor startup flag */
bool_t bFlagDTComp; /* dead-time compensation ctrl */
} MCS_ACIM_FOC_A1_T;
Example 1 shows the field-oriented current control structure content. This structure encapsulates all the
necessary variables or sub-structures for the field-oriented control algorithm implementation. The data
types used in this structure are defined in RTCESL. Here is the description of items used in this
application:
• Rotor flux observer—input structure for the rotor flux observer function.
• Speed estimator—input structure for the speed estimator structure.
• 𝑑𝑑 and q-axis current PI controllers—used to control the direct and quadrature current.
• DC-Bus voltage first order IIR filter—used to filter the DC-Bus voltage.
• Phase currents—measured 3-phase current; input to the algorithm.
• Alpha and beta currents—currents transformed into the 𝛼𝛼𝛼𝛼 frame.
• 𝑑𝑑𝑞𝑞 currents—currents transformed into the 𝑑𝑑𝑑𝑑 frame.
• Required 𝑑𝑑𝑑𝑑 currents—currents required in the 𝑑𝑑𝑑𝑑 frame; input to the algorithm.
• 𝑑𝑑𝑞𝑞 current error—error (difference) between the required and measured 𝑑𝑑𝑑𝑑 currents.
• Phase duty cycles—3-phase duty cycles; output from the algorithm.
• Required alpha and beta voltages—voltages required in the 𝛼𝛼𝛼𝛼 frame.
• Required 𝛼𝛼𝛼𝛼 voltages after the dead time compensation—voltages required in the 𝛼𝛼𝛼𝛼 frame with
the compensation of the inverter non-linearity.
• Compensated required alpha and beta voltages—the previous item recalculated on the actual
level of the DC-Bus voltage.
• Required 𝑑𝑑𝑑𝑑 voltages—voltages required in the alpha/beta frame; outputs from the PI
controllers.
• Sin & Cos angle—sine and cosine of the rotor flux electrical angle.
• Duty-cycle limit—this variable limits the maximum value of the phase duty cycles.
• DC-Bus voltage—measured DC-Bus voltage.
• Filtered DC-Bus voltage—filtered value of the previous item.
• SVM sector—sector information; output from the SVM algorithm.
• 𝑑𝑑-axis current saturation flag—saturation flag for the 𝑑𝑑-axis current PI controller.
• 𝑞𝑞-axis current saturation flag—saturation flag for the 𝑞𝑞-axis current PI controller.
• Speed startup flag—indicates that the motor is in the startup.
• Dead-time compensation flag—dead-time compensation enable (true) and disable (false) flag.
The first structure referred to by the I/O structure pointer is the same as for the current control mode
described in the previous section. The second structure has the scalar control variables defined in this
example:
Example 2. Scalar control structure
typedef struct
{
GFLIB_RAMP_T_FLT sRampParSpdMe; /* scalar speed ramp structure */
float_t fltSpdMeReq; /* speed command [rpm] */
float_t fltSpdMeRamp; /* speed command ramped [rpm] */
This structure contains the additional variables or sub-structures necessary for the scalar control
algorithm implementation. The types used in this structure are defined in RTCESL. Here is a description
of the items used in this application:
• Speed ramp—parameters for the speed ramp generation.
• Speed command—required mechanical speed, commanded by the user application.
• Ramped speed—output from the speed ramp algorithm.
• Scalar position—generated electrical position of the stator voltage.
• Scalar integration gain—integration gain used when integrating speed.
• V/rpm gain—factor to calculate the required q-axis voltage from the mechanical speed.
• Minimal q-axis voltage—minimum phase voltage to produce a sufficient rotor flux.
This routine calculates the q-axis voltage from the actual electrical rotor frequency. The inputs to this
routine are the required mechanical speed and the V/rpm factor. The outputs of this routine are the
3-phase duty cycle and the SVM sector. The filters have structures that must be initialized before using
this routine. This routine is called in the fast-loop state machine.
5. References
For a current list of all documents, see www.nxp.com.
• Real-Time Control Embedded Software Libraries located at www.nxp.com/rtcesl
• Sensorless ACIM Field-Oriented Control on Kinetis® KV and KE (document AN5051)
6. Revision history
The following table summarizes the changes done to this document since the initial release.
Table 2. Revision history
Revision number Date Substantive changes
0 01/2016 Initial release.
1 01/2017 -Added sections on MTPA and FW
algorithms
-Updated graphics
NXP, the NXP logo, NXP SECURE CONNECTIONS FOR A SMARTER WORLD,
Freescale, the Freescale logo, Kinetis, Tower System, and Freedom are trademarks of
NXP B.V. All other product or service names are the property of their respective
owners. ARM, the ARM Powered logo, Keil, µVsion, and Cortex are registered
trademarks of ARM Limited (or its subsidiaries) in the EU and/or elsewhere. IAR
Embedded Workbench is a registered trademark of IAR Systems. All rights reserved.