Académique Documents
Professionnel Documents
Culture Documents
Research Article
FPGA Realization of Sensorless PMSM
Speed Controller Based on Extended Kalman Filter
Ying-Shieh Kung,1 Nguyen Vu Quynh,2 Nguyen Trung Hieu,1 and Jin-Mu Lin1
1
Department of Electrical Engineering, Southern Taiwan University of Science and Technology, 1 Nan-Tai Street,
Yong-Kang District, Tainan City 710, Taiwan
2
Department of Electrical Engineering, Lac Hong University, 10 Huynh Van Nghe Street, Buu Long District,
Bien Hoa City 084, Dong Nai Province, Vietnam
Copyright © 2013 Ying-Shieh Kung et al. This is an open access article distributed under the Creative Commons Attribution
License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly
cited.
Based on extended Kalman filter (EKF), the design and FPGA implementation of a sensorless control intellectual property (IP) for
permanent magnet synchronous motor (PMSM) drive are presented in this paper. Firstly, the mathematical model for PMSM is
derived and the vector control is built up. Secondly, the rotor flux angle (FA) and rotor speed which are estimated by using EKF
are described. These estimated values are feedbacked to the current loop for vector control and to the speed loop for speed control.
Thirdly, the very-high-speed IC hardware description language (VHDL) is adopted to describe the behavior of the sensorless speed
control IP which includes the circuits of space vector pulse width modulation (SVPWM), coordinate transformation, EKF, and
PI controller. Finally, to evaluate the effectiveness and correctness of the proposed of system, a cosimulation work performed by
Simulink and ModelSim is firstly conducted. Then, an experimental system by FPGA chip and motor driving board is set up to
further validate the performance of the proposed EKF-based sensorless speed control IP.
1. Introduction estimate the angular speed and it has high convergence rate
which can give a more rapid speed response [5]. However,
PMSM has been increasingly used in many automation EKF requires heavy online 4 × 4 matrix computing; therefore,
control fields as actuators, due to its advantages of supe- the complex computation becomes a challenge for a fixed-
rior power density, high-performance motion control with point processor system. In realization, a fixed-point processor
fast speed, and better accuracy. However, conventional motor
using digital signal processor (DSP) and field programmable
control needs a speed sensor or an optical encoder to
gate array (FPGA) both can provide a good solution in
measure the rotor speed and feedback it to the controller for
this issue. Particularly, FPGA with programmable hard-
ensuring the precision speed control. Such sensor presents
some disadvantages such as drive cost, machine size, reliabil- wired feature, fast computation ability, shorter design cycle,
ity, and noise immunity. In recent years, a sensorless control embedding processor, low power consumption, and higher
without position and speed sensors for PMSM drive become density is better for the implementation of the digital system
a popular research topic in the literature [1–7]. Those sen- [8, 9] than DSP.
sorless control strategies have sliding mode observer (SMO), Recently, a cosimulation work by Electronic Design Au-
extended Kalman filter (EKF), reduced-order EKF, and so tomation (EDA) Simulator Link has been gradually applied
forth. The EKF is basically a full-order stochastic observer to verify the effectiveness of the Verilog and VHDL code
for the recursive optimum state estimation of a nonlinear in the motor drive system [10–12]. The EDA Simulator Link
dynamic system in real time by using signals that are in noisy [13] provides a cosimulation interface between MATLAB or
environment [7]. Comparing with SMO, EKF can directly Simulink and HDL simulators-ModelSim [14]. Using it you
2 Mathematical Problems in Engineering
can verify a VHDL, Verilog, or mixed-language implemen- 2.2. Extended Kalman Filter (EKF). For a motor stochastic
tation against your Simulink model or MATLAB algorithm nonlinear equation, it can be written in the following form:
[13]. Therefore, EDA Simulator Link lets you use MATLAB
code and Simulink models as a test bench that generates 𝑥̇ (𝑡) = 𝑓 [𝑥 (𝑡)] + 𝐵𝑢 (𝑡) + 𝜎 (𝑡) , (4)
stimulus for an HDL simulation and analyzes the simulation’s
response [13]. In this paper, a cosimulation by EDA Simulator 𝑦 (𝑡) = ℎ [𝑥 (𝑡)] + 𝜇 (𝑡) , (5)
Link is applied to sensorless speed control for PMSM drive.
The PMSM, inverter, and speed command are performed in where 𝑥(𝑡), 𝑢(𝑡), and 𝑦(𝑡) are system state, system input,
Simulink and the EKF algorithm; current vector controller and system output, respectively. The 𝜎(𝑡) and 𝜇(𝑡) represent
and speed PI controller described by VHDL code are exe- system noise and measurement noise which are zero-mean
cuted in ModelSim. After successful verification in simula- white Gaussian distribution with covariance 𝑄(𝑡) and 𝑅(𝑡),
tion, an FPGA-based experimental system is established with respectively. Once a nominal solution to a motor nonlinear
configuration as in Figure 1 for realizing the proposed IP code equation can be found in (4)-(5), the linearized perturbation
again, and experiment results will validate the effectiveness of equation is
the sensorless speed control system of PMSM drive.
𝛿𝑥̇ (𝑡) = 𝐹 (𝑥 (𝑡)) 𝛿𝑥 (𝑡) + 𝐵𝛿𝑢 (𝑡) + 𝜎 (𝑡) , (6)
2. System Description of PMSM Drive and
𝛿𝑦 (𝑡) = 𝐻 (𝑥 (𝑡)) 𝛿𝑥 + 𝜇 (𝑡) , (7)
Sensorless Speed Control
The sensorless speed control block diagram for PMSM drive where the Jacobian and output matrices are defined as fol-
is shown in Figure 1. The modeling of PMSM, the EKF-based lows:
rotor flux angle (FA) and rotor speed estimation, and the PI 𝜕𝑓
𝐹 (𝑥 (𝑡)) = ,
controller are introduced as follows. 𝜕𝑥 𝑥=𝑥(𝑡)
(8)
2.1. Mathematical Model of PMSM. The mathematical model 𝜕ℎ
𝐻 (𝑥 (𝑡)) = .
of a PMSM is described, in two-axis 𝑑-𝑞 synchronous rotat- 𝜕𝑥 𝑥=𝑥(𝑡)
ing reference frame, as follows:
After discretization with sampling time 𝑇𝑐 , (6) becomes
𝑑𝑖𝑑 𝑟 𝐿𝑞 1
= − 𝑠 𝑖𝑑 + 𝜔𝑒 𝑖𝑞 + V , 𝑥 (𝑡𝑛 ) = Φ (𝑡𝑛 , 𝑡𝑛−1 , 𝑥 (𝑡𝑛−1 )) 𝑥 (𝑡𝑛−1 )
𝑑𝑡 𝐿𝑑 𝐿𝑑 𝐿𝑑 𝑑
(1) 𝑡𝑛
𝑑𝑖𝑞 𝐿 𝑟 𝜆𝑓 1 +∫ Φ (𝑡𝑛 , 𝑡𝑛−1 , 𝑥 (𝑡𝑛−1 )) 𝐵𝑑𝜏 ⋅ 𝑢 (𝑡𝑛−1 ) + ] (𝑡𝑛−1 ) ,
= −𝜔𝑒 𝑑 𝑖𝑑 − 𝑠 𝑖𝑞 − 𝜔𝑒 + V, 𝑡𝑛−1
𝑑𝑡 𝐿𝑞 𝐿𝑞 𝐿𝑞 𝐿𝑞 𝑞
(9)
where V𝑑 , V𝑞 are the 𝑑 and 𝑞 axes voltages; 𝑖𝑑 , 𝑖𝑞 , are
where Φ(𝑡𝑛 , 𝑡𝑛−1 , 𝑥(𝑡𝑛−1 )) is an exponential matrix and its
the 𝑑 and 𝑞 axes currents, 𝑟𝑠 is the phase winding resis-
computation can be simplified by
tance; 𝐿 𝑑 , 𝐿 𝑞 are the 𝑑 and 𝑞 axes inductance; 𝜔𝑒 is the rotat-
ing speed of magnet flux; and 𝜆 𝑓 is the permanent magnet
Φ (𝑡𝑛 , 𝑡𝑛−1 , 𝑥 (𝑡𝑛−1 )) ≅ I + 𝐹𝑇𝑐 . (10)
flux linkage.
The current loop control of PMSM drive in Figure 1 is Further,
based on a vector control approach. That is, if the 𝑖𝑑 is forced
to 0, the PMSM will be decoupled, and controlling a PMSM 𝑡𝑛
is like controlling a DC motor. After decoupling, the motor’s ∫ Φ (𝑡𝑛 , 𝑡𝑛−1 , 𝑥 (𝑡𝑛−1 )) 𝐵𝑑𝜏 ≅ 𝐵𝑇𝑐 . (11)
𝑡𝑛−1
torque is proportional to 𝑖𝑞 :
Therefore, the discrete model of (6)-(7) becomes
3𝑁𝑃 Δ
𝑇𝑒 = 𝜆 𝑖 = 𝐾𝑡 𝑖𝑞 . (2) 𝑥 (𝑛) = (𝐼 + 𝐹𝑇𝑐 ) 𝑥 (𝑛 − 1) + 𝐵𝑇𝑐 ⋅ 𝑢 (𝑛 − 1) + ] (𝑛 − 1) ,
4 𝑓𝑞
(12)
Considering the mechanical load, the overall dynamic equa- 𝑦 (𝑛) = 𝐻 ⋅ 𝑥 (𝑛) + 𝜉 (𝑛 − 1) , (13)
tion of PMSM drive system is obtained by
where 𝑡𝑛 = 𝑛𝑇𝑐 and 𝑡𝑛−1 = (𝑛 − 1)𝑇𝑐 .
𝑑 The EKF is an optimal estimator which searches the
𝐽𝑚 𝜔𝑟 + 𝐵𝑚 𝜔𝑟 = 𝑇𝑒 − 𝑇𝐿 , (3)
𝑑𝑡 cost function 𝐽 = ∑𝑚 ̃2 (𝑛)} at the least square sense.
𝑛=1 𝐸{𝑥
̃
The 𝑥(𝑛) ̃
is defined by 𝑥(𝑛) ̂
= 𝑥(𝑛) − 𝑥(𝑛), which is
where 𝑇𝑒 is the motor torque, 𝑁𝑃 is pole pairs, 𝐾𝑡 is torque ̂
the difference of estimation of state 𝑥(𝑛) and system state
constant, 𝐽𝑚 is the inertial value, 𝐵𝑚 is damping ratio, 𝑇𝐿 is 𝑥(𝑛). The EKF algorithm is described by the following two-
the external torque, and 𝜔𝑟 is rotor speed. step recursive equations.
Mathematical Problems in Engineering 3
Ac source
Rectifier
FPGA
Nios II processor
Speed Current C L
UART controller controller Modify
CPU
𝜔r∗ iq∗ q Park−1 clark−1 ref1 PWM 1
PIO 𝛼
PI PWM 2
Avalon bus
On-chip PI d, q 𝛼, 𝛽
ROM
Timer + + ref2 PWM 3
− − PWM 4 Inverter
SPI SVPWM
On-chip id∗ = 0 d
𝛼, 𝛽
𝛽 ref3 PWM 5
RAM SDRAM
̂r
𝜔 PI a, b, c PWM 6
controller
+
−
Speed command iu
ia
generation iq d, q i𝛼 A/D LPF
𝛼, 𝛽
ib A/D
id i𝛽 interface iw
𝛼, 𝛽 a, b, c ic LPF
A/D
sin 𝜃̂e , cos 𝜃̂e Park Clark
Δ
Step 1 (prediction step). From (4) and using a simple rectan- where 𝐿 𝑠 = 𝐿 𝑑 = 𝐿 𝑞 . Transforming (20), the circuit equation
gular integration, of PMSM on the 𝛼 − 𝛽 fixed coordinate can be derived by the
following equation:
𝑥̂𝑛|𝑛−1 = 𝑥̂𝑛−1 + (𝑓 [𝑥̂𝑛−1 ] + 𝐵 ⋅ 𝑢𝑛−1 ) 𝑇𝑐 (14)
V 𝑟 + 𝑠𝐿 𝑠 0 𝑖 − sin 𝜃𝑒
[ 𝛼] = [ 𝑠 ] [ 𝛼 ] + 𝜔𝑒 𝜆 𝑓 [ ] , (21)
or from (12) V𝛽 0 𝑟𝑠 + 𝑠𝐿 𝑠 𝑖𝛽 cos 𝜃𝑒
𝑇 𝑇
𝑥̂𝑛|𝑛−1 = Φ𝑛−1 𝑥̂𝑛−1 + 𝐵𝑇𝑐 ⋅ 𝑢𝑛−1 . (15) where [V𝛼 V𝛽 ] is voltage on fixed coordinate; [𝑖𝛼 𝑖𝛽 ] is
current on fixed coordinate; 𝜃𝑒 is angular position at magnet
The covariance is updated by flux; and 𝑠 is differential operator. If we choose the 𝑥(𝑡) =
[𝑖𝛼 , 𝑖𝛽 , 𝜔𝑒 , 𝜃𝑒 ]𝑇 as the state variable of the PMSM mathematical
𝑃𝑛|𝑛−1 = Φ𝑛−1 𝑃𝑛−1 Φ𝑇𝑛−1 + 𝑄𝑑 . (16) model, then (21) can be expanded to the following formula-
tion:
Step 2 (innovation step). Consider 𝑟𝑠 𝑖𝛼 𝜔𝑒 𝜆 𝑓
𝑖𝛼 [− + sin 𝜃𝑒 ]
[ 𝐿𝑠 𝐿𝑠 ]
𝑥̂𝑛 = 𝑥̂𝑛|𝑛−1 + 𝐾𝑛 (𝑦𝑛 − 𝐻𝑥̂𝑛|𝑛−1 ) , (17) [ ] [ ]
[ 𝑖 ] [
𝑑 [ 𝛽 ] [ 𝑟𝑠 𝑖𝛽 𝜔𝑒 𝜆 𝑓 ]
[ ] = [− − cos 𝜃𝑒 ]
]
𝑃𝑛 = 𝑃𝑛|𝑛−1 − 𝐾𝑛 𝐻𝑃𝑛|𝑛−1 . (18) 𝑑𝑡 [𝜔𝑒 ] [ 𝐿 𝑠 𝐿𝑠 ]
[ ]
𝜃 [ 0 ]
The Kalman gain is calculated by [ 𝑒]
[ 𝜔 𝑒 ] (22)
−1 1
𝐾𝑛 = 𝑃𝑛|𝑛−1 𝐻𝑇 [𝐻𝑃𝑛|𝑛−1 𝐻𝑇 + 𝑅] . (19) [ 𝐿𝑠 0 ]
[ ]
[ ]
[ 0 1 ] V𝛼 Δ V𝛼
Figure 2 shows the procedure of EKF with two step above, +[ ][ ] = 𝑓 + 𝐵[ ],
[ 𝐿 𝑠 ] V𝛽 V𝛽
after measurement update, it will be changed to time update. [ ]
[0 0]
Initial Pn|n−1 , Qd , R
𝜕𝑓 ̂𝑒 (𝑛)
𝜔
𝐹 (𝑥 (𝑡)) = ̂𝑟 (𝑛) =
𝜔 . (27)
𝜕𝑥 𝑥=𝑥(𝑡) 𝑁𝑃
𝑟𝑠 𝜆𝑓 𝜔𝑒 𝜆 𝑓 Finally, a summary for the estimation of rotor FA and
[− 0 sin 𝜃𝑒 cos 𝜃𝑒 ] rotor speed based on EKF is presented as follows.
[ 𝐿𝑠 𝐿𝑠 𝐿𝑠 ]
[ ]
[ 𝑟 𝜆 𝜔 𝜆 ]
[
=[ 0 − 𝑓 𝑒 𝑓
sin 𝜃𝑒 ] Step 1. Set the initial values of 𝑄𝑑 , 𝑅, 𝑃0 , and 𝑛 = 1.
],
𝑠
− cos 𝜃𝑒
[ 𝐿𝑠 𝐿𝑠 𝐿𝑠 ]
[ ] Step 2. Measure the values of 𝑖𝛼 (𝑛), 𝑖𝛽 (𝑛), V𝛼 (𝑛), and V𝛽 (𝑛)
[ 0 0 0 0 ]
0 0 1 0 from PMSM system.
[ ]
(24)
Step 3. Estimate the temporary state variables from (14). In
𝜕ℎ 1 0 0 0 addition, refer to (22), and the scalar form of the prediction
𝐻 (𝑥 (𝑡)) = =[ ]. (25) equation can be expressed as follows:
𝜕𝑥 𝑥=𝑥(𝑡) 0 1 0 0
Further, substituting (24) into (10), the exponential matrix is ̂𝑖𝛼 (𝑛 | 𝑛 − 1) = (1 − 𝑇𝑐 𝑟𝑠 ) ̂𝑖𝛼 (𝑛 − 1)
shown as follows: 𝐿𝑠
A[22]
Nios II embedded processor IP
Avalon bus
Avalon bus On-chip PIO
Application IP
D[0] ROM
Sram be[3] 𝜔r∗ [15..0]
Sram be[2] On-chip Timer Clk
Sram be[1]
Sram be[0]
RAM Clk-step Frequency CK
Sram oe SPI
Sram we divider
Sram cs
ADIN[11]
Clk
Clk ADIN[0]
Clk-step Clk ADC BDIN[11]
Speed Clk-step interface
controller ia [11..0]
𝜔r∗ [15..0] (PI controller) BDIN[0]
ib [11..0] CHA
iq∗ [11..0] CHB
̂ r [15..0]
𝜔 ic [11..0] RCA
Current controllers RCB
and coordinate STSA
𝜃̂e [11..0] STSB
transformation Clk
𝛼 [11..0] (CCCT) Clk-step PWM 1
Rotor flux and PWM 2
Clk rotor speed 𝛽 [11..0] rx[11..0] PWM 3
PWM 4
estimation SVPWM PWM 5
Clk-step based on EKF i𝛼 [11..0] ry [11..0] PWM 6
generation
i𝛽 [11..0] rz[11..0]
Step 5. Obtain the temporary covariance matrix 𝑃𝑛|𝑛−1 from 𝑝23 ⇐ 𝐺𝑝23 + 𝜙23 𝑝33 + 𝜙24 𝑝34 ,
(16). Because matrix 𝑃𝑛|𝑛−1 is symmetric matrix by 𝑝𝑖𝑗 = 𝑝𝑗𝑖 , 𝑝24 ⇐ (𝐺𝑝23 + 𝜙23 𝑝33 + 𝜙24 𝑝34 ) 𝑇𝑐 + 𝐺𝑝24
it can be chosen by the following form:
+ 𝜙24 𝑝44 + 𝜙23 𝑝34 ,
𝑝11 𝑝12 𝑝13 𝑝14 𝑝33 ⇐ 𝑝33 + 𝑞33 ,
[𝑝21 𝑝22 𝑝23 𝑝24 ] 𝑝34 ⇐ 𝑇𝑐 𝑝33 + 𝑝34 ,
𝑃𝑛|𝑛−1 =[
[𝑝31
]. (29)
𝑝32 𝑝33 𝑝34 ]
𝑝44 ⇐ 𝑝44 + 𝑇𝑐2 𝑝33 + 2𝑇𝑐 𝑝34 + 𝑞44 .
[𝑝41 𝑝42 𝑝43 𝑝44 ]
(30)
Hence, from (16), individual elements of 𝑃𝑛|𝑛−1 could be Step 6. Calculate the Kalman gain from (19). Using (25) and
updated as follows: (29), the formulation is further simplified as follows. Firstly,
−1
𝑝11 ⇐ 𝐺2 𝑝11 + 2𝐺𝜙14 𝑝14 + 2𝐺𝜙13 𝑝13 + 2𝜙14 𝜙13 𝑝34 [𝐻𝑃𝑛|𝑛−1 𝐻𝑇 + 𝑅]
2 2
+ 𝜙14 𝑝44 + 𝜙13 𝑝33 + 𝑞11 , 𝑝11 𝑝12 𝑝13 𝑝14 1 0
[ 1 0 0 0 [𝑝21 𝑝22 𝑝23 𝑝24 ] [ 0 1]
2
𝑝12 ⇐ 𝐺 𝑝12 + 𝐺𝜙14 𝑝24 + 𝐺𝜙13 𝑝23 =[ [
[[ 0 1 0 0 ] [𝑝31
][ ]
𝑝32 𝑝33 𝑝34 ] [ 0 0]
+ 𝜙23 (𝐺𝑝13 + 𝜙13 𝑝33 + 𝜙14 𝑝34 ) [ [𝑝41 𝑝42 𝑝43 𝑝44 ] [ 0 0]
+ 𝜙24 (𝐺𝑝14 + 𝜙13 𝑝34 + 𝜙14 𝑝44 ) , −1
𝜆 f Tc
rs Tc Ls
1 − Tc × (n − 1)
Ls Ls 𝛼 𝜙13
𝜃̂e (n − 1) sin(𝜃̂e (n − 1)) ̂i𝛼 (n|n − 1) × Q11Q22 Q33 Q44
̂i𝛼 (n − 1)
sin × + +
Tc 𝜙24
𝜔̂ e (n − 1)𝜆 f Tc ̂ e (n − 1)𝜆 f Tc L 𝛽 (n − 1)
𝜔 ×
s sin(𝜃̂e (n − 1)) −𝜆 f Tc Obtain the P
𝜔̂ e (n − 1) Ls L ̂i𝛽 (n|n − 1) n|n−1
− s Ls temporary
× × + + ̂ e (n − 1)𝜆 f Tc
𝜔 covariance
̂𝜃e (n|n − 1) 𝜙23
̂ e (n − 1)
𝜔 Ls matrix
𝜆 f Tc ̂i𝛽 (n − 1) × + ×
Ls ×
̂ Tc 𝜃̂e (n − 1) cos(𝜃̂e (n − 1))
𝜃̂e (n − 1) cos(𝜃e (n − 1)) ×
𝜙14
cos r Pn−1
1 − Tc s
Ls
s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s11 s12 s13 s68
Calculate Jacobian matrix and predict state variables Prediction of temporary
̂i𝛼 (n|n − 1) covariance matrix Pn
̂i𝛽 (n|n − 1)
̂i𝛼 (n)
K11 × ̂i𝛽 (n)
i𝛼 (n) + +
̃i𝛼 (n) k 21 × + +
+
̃i𝛼 (n)
− Update Pn ̃i𝛼 (n)
k12 × ×
̂i𝛼 (n|n − 1) Pn|n−1 matrix Pn k22
and ̃i𝛼 (n) 𝜃̂e (n|n − 1)
̃i𝛽 (n) ̃i (n) 𝜔
̂ e (n|n − 1) ̃i𝛽 (n)
calculate 𝛼
matrix Kn K 𝜃̂e (n)
n k41 × + +
i𝛽 (n) + ̃i𝛽 (n) k31 × + +
̂ e (n)
𝜔
− k42 ×
R11 R22 k32 ×
̂i𝛽 (n|n − 1)
̂ r (n)
𝜔
̃i𝛽 (n) SR2 ̃i𝛽 (n)
s69 s70 s71 s120 s121 s122 s123 s124 s125 s126 s127 s128 s129 s130
Calculation of error Update Pn and calculate Kn Update estimated state
2
where 𝑅 represents the uncertainties of measurement vari- where 𝑀 = (𝑝11 𝑝22 + 𝑝11 + 𝑝22 − 𝑝12 + 1)/4. Then, from (19),
able which are very difficult to know. Hence, 𝑅 is often chosen the Kalman gain can be calculated by
as unity matrix for simplifying the task but does not affect the
outcome (31). Since 𝑃12 = 𝑃21 , (31) can be rewritten in the 𝑘11 𝑘12
[ ]
following form: Δ [ 𝑘21 𝑘22 ]
𝐾𝑛 = [
[𝑘
]
[𝐻𝑃𝑛|𝑛−1 𝐻𝑇 + 𝑅]
−1
[ 31 𝑘32 ]
]
[ 𝑘41 𝑘42 ]
1 𝑝 + 1 −𝑝12
= [ 22 ].
2 +1
𝑝11 𝑝22 + 𝑝11 + 𝑝22 − 𝑝12 −𝑝12 𝑝11 + 1
𝑝11 𝑝12
(32) [ ]
[ 𝑝21 𝑝22 ] 𝑡11 𝑡12
To normalize the input value and to prevent the numerical =[
[𝑝
][ ] (34)
overflow condition which occurred during computation, (32) [ 31 𝑝32 ]
] 𝑡21 𝑡22
is normalized and those values are all divided by 4. Therefore, [ 𝑝41 𝑝42 ]
(32) becomes
𝑝22 + 1 −𝑝12 𝑝11 𝑡11 + 𝑝12 𝑡21 𝑝11 𝑡12 + 𝑝12 𝑡22
[
1 [ 4 4 ] [ ]
−1 ] Δ 𝑡11 𝑡12 [ 𝑝21 𝑡11 + 𝑝22 𝑡21 𝑝21 𝑡12 + 𝑝22 𝑡22 ]
[𝐻𝑃𝑛|𝑛−1 𝐻𝑇 + 𝑅] = [ −𝑝 𝑝 ] = [𝑡 𝑡 ] , =[ ].
11 + 1 ] [ 𝑝 𝑡 +𝑝 𝑡
𝑀[ 12 21 22
[ 31 11 32 21 𝑝31 𝑡12 + 𝑝32 𝑡22 ]
]
4 4
[ ]
(33) [ 𝑝41 𝑡11 + 𝑝42 𝑡21 𝑝41 𝑡12 + 𝑝42 𝑡22 ]
Mathematical Problems in Engineering 7
s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 s33 s34
G
𝜙14 t11
× SL1 + × + + + + +
p14
𝜙13 q11
× SL1
p13
p11 ×
𝜙14 × SL1 𝜙14
G2
×
𝜙13 × G
p34
p24
𝜙14 × × p23 × + ×
p44 𝜙13
𝜙13 × ×
t12
2
p33 G ×
G
+ +
t33 t13
p33 + p12
× + + ×
𝜙13 𝜙14
q33
p13 × 𝜙23
×
p33 p34
s35 s36 s37 s38 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s49 s50 s51 s52 s53 s54 s55 s56
G
t12
× p34 + + × +
p44
p14 × 𝜙24
t12
×
t14
𝜙13 t13 × +
𝜙14 𝜙24
G2 𝜙24
Tc 𝜙23 ×
× × × p
G × 34
p22 p44 𝜙24 p33 t23
q22 × + +
𝜙23 G
p23
t22
× + × + + + + +
𝜙24 𝜙24
p23 SL1
× 𝜙23 × × SL1
p33 𝜙23
s57 s58 s59 s60 s61 s62 s63 s64 s65 s66 s67 s68
Tc p44
𝜙24 t44 t11 p11 × Product + Sum
Tc × + + +
t12 p12 Q
t34 t13
𝜙23 × × + q44
p13 SL1 Shift left 1 bit
2Tc t14 p14
p44 p34 t22 p22
G × p33 Pn−1
× t23 Pn|n−1
p34 p23
× + + + t24 t24 p24
t23 p34 t33 p33
p24
t34 p34 Q n|n−1
×
t44 p44 Predicted estimate
Tc covariance
s1 s2 s3 s4 s5 s6 s7 s8
−p12 sr2
SR2 sr2 Shift right 2 bits
SR2
p11
+ + + sr2
SR2 + M A/B Divide
A/B
p22 A/B
A/B t12
−
p11 0.25 X
× Product
X
× p22 sr2
SR2 + A/B
A/B t11 M
p22 + Sum
p12 ×
X 0.25 M
k11
p12 p11 sr2
SR2 + A/B
A/B t22
k12
0.25 M
k21
s9 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23
s10 s24 s25 Matrix Kn
k22
k11
t11 X
× + t11 X
× ÷+ k31 k31
p11 t11 X
× + k21 p13 t 11 X
× + k41 k32 Pn|n−1
p22
t12 ×
X p12 t12 X
× p14 p 42
t12 X
×
t12 X
×
p12 p32
t12 X
× + t12 X
× + k32
k12 k42
p11 p13 t12 X
× +
t12 X
× +
k22
t22 X
× X
× p14 p24
p t22
12
p12 t22 X
× p23 t22 X
×
p22 Kn
(a)
s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24
(b)
Figure 6: State diagram of FSM for (a) the calculation of matrix 𝐾𝑛 and (b) the update of covariance matrix 𝑃𝑛 .
Step 7. Tune the present state variables from (17), and its 𝜔 ̂𝑒 (𝑛𝑛 − 1) + 𝑘31̃𝑖𝛼 (𝑛) + 𝑘32̃𝑖𝛽 (𝑛) ,
̂𝑒 (𝑛) = 𝜔
scalar form is shown as follows:
𝜃̂𝑒 (𝑛) = 𝜃̂𝑒 (𝑛 | 𝑛 − 1) + 𝑘41̃𝑖𝛼 (𝑛) + 𝑘42̃𝑖𝛽 (𝑛) ,
(35)
̂𝑖𝛼 (𝑛) = ̂𝑖𝛼 (𝑛𝑛 − 1) + 𝑘11̃𝑖𝛼 (𝑛) + 𝑘12̃𝑖𝛽 (𝑛) ,
where 𝑘𝑖𝑗 is the element in Kalman gain 𝐾𝑛 ⋅ ̃𝑖𝛼 (𝑛) = 𝑖𝛼 (𝑛) −
̂𝑖𝛽 (𝑛) = ̂𝑖𝛽 (𝑛𝑛 − 1) + 𝑘21̃𝑖𝛼 (𝑛) + 𝑘22̃𝑖𝛽 (𝑛) , ̂𝑖𝛼 (𝑛 | 𝑛 − 1) and ̃𝑖𝛽 (𝑛) = 𝑖𝛽 (𝑛) − ̂𝑖𝛽 (𝑛 | 𝑛 − 1).
Mathematical Problems in Engineering 9
Full-order EKF
Convert -K-
Convert -K-
Figure 7: The Simulink/ModelSim cosimulation architecture for sensorless speed control of PMSM drive.
𝑘11 𝑝11 + 𝑘12 𝑝21 𝑘11 𝑝12 + 𝑘12 𝑝22 𝑘11 𝑝13 + 𝑘12 𝑝23 𝑘11 𝑝14 + 𝑘12 𝑝24
[𝑘 𝑝 + 𝑘 𝑝 𝑘21 𝑝12 + 𝑘22 𝑝22 𝑘21 𝑝13 + 𝑘22 𝑝23 𝑘21 𝑝14 + 𝑘22 𝑝24 ]
[ 21 11 22 21 ]
𝐾𝑛 𝐻𝑃𝑛|𝑛−1 =[ ]. (36)
[𝑘31 𝑝11 + 𝑘32 𝑝21 𝑘31 𝑝12 + 𝑘32 𝑝22 𝑘31 𝑝13 + 𝑘32 𝑝23 𝑘31 𝑝14 + 𝑘32 𝑝24 ]
[𝑘41 𝑝11 + 𝑘42 𝑝21 𝑘41 𝑝12 + 𝑘42 𝑝22 𝑘41 𝑝13 + 𝑘42 𝑝23 𝑘41 𝑝14 + 𝑘42 𝑝24 ]
Step 9. Calculate the rotor speed from (27); then set 𝑛 = 𝑛 + the function of two PI controllers, table look-up for sin/cos
1 and go back to Step 2. function, and the coordinate transformation for Clark, Park,
inverse Park, and modified inverse Clarke. The detailed
circuit design of CCCT, speed PI controller, ADC interface,
3. Design of Sensorless Speed Controller IP and SVPWM generation in Figure 3 refers to [8]. Herein,
Figure 3 illustrates the internal architecture of the proposed only the digital hardware circuit design of the EKF-based
FPGA implementation of a sensorless speed control IP for rotor FA and rotor speed estimation is described. To reduce
PMSM drive system. The internal circuit comprises a Nios the FPGA resource usage, a finite-state machine (FSM) is
II embedded processor IP and an application IP. The Nios II employed to model the EKF-based algorithm whose design
processor is depicted to generate the speed command, collect procedure and mathematical formulation are presented in the
the response data, and communicate with external device. previous section. The design result is shown in Figure 4 which
All programs in Nios II processor are coded in the C uses one adder, one multiplier, one divider, two sin/cos look-
language. The application IP includes mainly a circuit of an up table, shifters, registers, and so forth and manipulates 131
EKF-based rotor FA and rotor speed estimation, a speed steps machine to carry out the overall computation. The data
PI controller, a circuit for current controllers and coordinate type adopts 16-bit length with Q15 format and 2’s complement
transformation (CCCT), a SVPWM circuit, and an ADC operation. The multiplier, adder, and divider apply Altera
interface circuit. The sampling frequencies of the speed LPM (Library Parameterized Modules) standard. In Figure 4,
control loop and current control loop are designed with 2 kHz the steps 𝑠0 ∼ 𝑠12 execute the calculation of Jacobian matrix
and 16 kHz, respectively. The frequency divider generates and predict temporary state variables; 𝑠13 ∼ 𝑠68 perform the
50 Mhz (Clk) and 12.5 Mhz (Clk-step) clock to supply all computation of temporary covariance matrix; steps 𝑠69 ∼
circuits in Figure 3. The internal circuit of CCCT performs 𝑠70 are for state error calculation; steps 𝑠71 ∼ 𝑠120 update of
10 Mathematical Problems in Engineering
300 1.5
200 Estimated
1
Current (A)
Speed (rpm)
rotor speed id iq
100
Speed 0.5
0 Actual
command 0
−100 rotor speed
−200 −0.5
−300 −1
0 0.1 0.2 0.3 0.4 0.5 0.6 0 0.1 0.2 0.3 0.4 0.5 0.6
Time (s) Time (s)
(a) (b)
3000 4
2000 iq
2
Current (A)
Speed (rpm)
1000 Estimated
Speed rotor speed
0 0
command
−1000
−2 id
−2000 Actual
rotor speed
−3000 −4
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time (s) Time (s)
(a) (b)
Flux angle (FA) (deg)
the present covariance matrix 𝑃𝑛 and calculate the Kalman resource usages of the circuits of CCCT, speed PI controller,
gain 𝐾𝑛 ; 𝑠121 ∼ 𝑠130 describe the present state tuning as well ADC interface, and SVPWM in Figure 3 are 864 LEs and
as executing the computation of rotor FA and rotor speed. 24,576 RAM, 2,043 LEs and 0RAM bits, 136 LEs and 0RAM
According to (30), the computation of temporary covariance bits, and 1,221 LEs and 0RAM bits, respectively.
matrix 𝑃𝑛|𝑛−1 in Figure 4 is described in Figure 5. Further,
according to (18), (33)-(34), and (36), the update of the 4. Simulink/ModelSim Cosimulation and
present covariance matrix 𝑃𝑛 and calculation the Kalman gain Its Simulation Results
𝐾𝑛 in Figure 4 are illustrated in Figure 6. The operation of
each step in Figure 4 is 80 ns (12.5 MHz) in FPGA; therefore The Simulink/ModelSim cosimulation architecture for sen-
a total of 131 steps need only 10.48 𝜇s operation times. sorless PMSM speed control system is shown in Figure 7.
The FPGA (Altera) resource usages of EKF-based rotor FA The SimPowerSystem-Blockset in the Simulink executes the
and rotor speed estimation in Figure 4 is 4,158 LEs (logic PMSM and the IGBT-based inverter. The EDA simulator link
elements) and 2,890 RAM bits. Additionally, the FPGA for ModelSim executes the cosimulation using VHDL code
Mathematical Problems in Engineering 11
Rectifier L Inverter
TA+ TB+ TC+
Ac source U, V, W
C
TA− TB− TC−
Load
PMSM
Isolated and driving circuits
PWM1 PWM6
LP filter
circuit
UART ia
CPU Digital circuit
ADC
PIO of speed PI controller,
Avalon bus
(Nios II processor)
FPGA-based sensorless speed control IP
(a)
(b)
Figure 10: Experimental system (a) with block diagram and (b) in real system.
running in ModelSim program. It executes the function of In simulation, the designed PMSM parameters used in
the sensorless speed controller by three works. The work-1 Figure 7 are as follows: pole pairs are 4, stator phase resis-
to work-3 of ModelSim in Figure 7, respectively, perform the tance is 1.3 Ω, stator inductance is 6.3 mH, inertia is 𝐽 =
function of speed loop PI controller, the function of cur- 0.000108 kg∗m2 , and friction factor is 𝐹 = 0.0013 N∗m∗s.
rent controller and coordinate transformation (CCCT) and PI gains in speed control loop are designed with 𝐾𝑝 = 0.2442
SVPWM, and the function of EKF-based rotor FA and rotor and 𝐾𝑖 = 0.00458. To evaluate the proposed controller
speed estimation. The sampling frequency in current control performance, PMSM running at low speed (200 rpm) and
loop and EKF-based estimation algorithm is designed with inverse speed (from 200 rpm to −200 rpm or vice versa) con-
16 kHz, but in speed control loop is 2 kHz. The clocks of dition is firstly considered, and its simulation results regard-
50 MHz and 12.5 MHz will supply all works of ModelSim. ing as the speed step response, the current response as well
The FPGA (Altera) resource usages of work-1 to work-3 are as the actual rotor flux angle (FA) and the estimated rotor
2,043 LEs and 0 RAM bits, 2,085 LEs and 24,576 RAM bits, flux angle are shown in Figure 8. It shows that the motor
and 4,158 LEs and 2,890 RAM bits, respectively. speed gives a good dynamic response performance with a
12 Mathematical Problems in Engineering
200 300
0 200
−200 Rotor
speed 100
−500 0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (s) Time (s)
(a) (b)
Figure 11: (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA.
1200 1.5
Speed
1000 command 1 iq
Current (A)
Speed (rpm)
800
0.5
600
0
400 Estimated rotor
200 Actual rotor speed −0.5 id
speed
0 −1
0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3
Time (s) Time (s)
(a) (b)
Figure 12: (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response.
little overshoot and 25 ms rising time. It also shows that embedded multipliers. The chip can be embedded with a
the estimated rotor speed can track actual rotor speed well. Nios II multicore processor that is equipped with several
Figure 8(b) shows a successful vector control because 𝑖𝑑 is 32-bit CPU, flexibility of core size, 1 to 16 Mbytes of flash
controlled to zero. Figure 8(c) shows that the estimated rotor memory in the available memory chip, 1 Mbyte SRAM, 16 M
FA can fast track the actual rotor FA even in the inverse speed byte SDRAM, and 4 Gbytes memory outside of the chip. In
command condition. Further, another simulation case while implementation, except the VHDL codes of CCCT, EKF, and
the PMSM running at wide-range high speed (from 0 rpm → PI controller, the VHDL code of ADC interface circuit should
1000 rpm → 2000 rpm → 1000 rpm → −1000 pm → be added and integrated and then downloaded into FPGA.
−2000 rpm) and inverse speed (from 1000 rpm to −1000 rpm) The PI gains of speed control loop in experiment are designed
condition is tested, and its simulation results are shown in with 𝐾𝑝 = 0.512 and 𝐾𝑖 = 0.021.
Figure 9. It presents that not only at speed tracking but In the experimental case, PMSM running at low speed
also at rotor FA tracking, the estimated value adopted by (200 rpm) and inverse speed (from 200 rpm to −200 rpm or
EKF method can give a good follow to the real rotor value. vice versa) condition are firstly considered, and its experi-
However, except in the initial condition, the actual rotor ment results regarding the speed step response as well as the
speed gives a fast step response by 18 ms rising time, near actual rotor FA and the estimated rotor FA are shown in
0 mm steady-state value, and maximum 17.5% overshoot. Figure 11. Figure 11(a) shows that the motor speed gives a
good dynamic response performance with a little oscillation
5. Experimental System and Results and overshoot and it has 15 ms rising time. Figure 11(b) shows
that the estimated FA can fast track the actual rotor FA even
After confirming the correctness of the proposed EKF-based in the inverse speed command condition. Further, another
sensorless control IP by simulation, the VHDL codes are experimental case while the PMSM running at medium
directly applied to the experimental FPGA-based sensorless speed (from 0 rpm → 300 rpm → 600 rpm → 900 rpm →
PMSM drive system. The block diagram and real experi- 600 rpm → 900 rpm) condition is evaluated, and its experi-
mental system are depicted in Figure 10. The main devices ment results are shown in Figure 12. The Figure 12(a) presents
include a PMSM, a DE2 board with Altera CycloneII FPGA, a fast speed tracking with 15 ms rising time and no occurrence
a motor driver, and a power supplier. The parameters of the of overshoot condition. Figure 12(b) shows a successful vector
PMSM are 𝑟𝑠 = 0.63 Ω, 𝐿 = 2.77 mH, and 4 pole pairs. The control due to the 𝑖𝑑 being controlled to zero. Therefore, from
input voltage, continuous current, rating torque, rating speed, the simulation results in Figures 8 and 9 and the experimental
and continuous power of the PMSM are 220 V, 12 A, 2.3 N- results in Figures 11 and 12, it is demonstrated that the EKF-
m, 3000 rpm, and 750 W, respectively. The Altera CycloneII based estimation algorithm used in sensorless PMSM drive
EP2C35 chip adopted in the design possesses 33,216 LEs, and the behavior description by using VHDL are effective and
maximum 475 available I/O pins, 483,840 RAM, and 35 correct.
Mathematical Problems in Engineering 13
References
[1] V. C. Ilioudis and N. I. Margaris, “PMSM sensorless speed
estimation based on sliding mode observers,” in Proceedings of
the 39th IEEE Annual Power Electronics Specialists Conference
(PESC ’08), pp. 2838–2843, June 2008.
[2] S. Chi, Z. Zhang, and L. Xu, “Sliding-mode sensorless control
of direct-drive PM synchronous motors for washing machine
applications,” IEEE Transactions on Industry Applications, vol.
45, no. 2, pp. 582–590, 2009.
[3] V. Delli Colli, R. di Stefano, and F. Marignetti, “A system-on-
chip sensorless control for a permanent-magnet synchronous
motor,” IEEE Transactions on Industrial Electronics, vol. 57, no.
11, pp. 3822–3829, 2010.
[4] S. Bolognani, R. Oboe, and M. Zigliotto, “Sensorless full-digital
pmsm drive with ekf estimation of speed and rotor position,”
IEEE Transactions on Industrial Electronics, vol. 46, no. 1, pp.
184–191, 1999.
[5] M. C. Huang, A. J. Moses, and F. Anayi, “The comparison of
sensorless estimation techniques for PMSM between extended
Kalman filter and flux-linkage observer,” in Proceedings of the
21st Annual IEEE Applied Power Electronics Conference and
Exposition (APEC ’06), pp. 654–659, March 2006.
[6] W. Wang, M. Zhang, and Q. Wu, “Application of reduced-order
extended kalman filter in permanent magnet synchronous
motor sensorless regulating system,” in Proceedings of the Inter-
national Conference on Digital Manufacturing and Automation
(ICDMA ’10), pp. 271–274, December 2010.
[7] J.-S. Jang, B.-G. Park, T.-S. Kim, D. M. Lee, and D.-S. Hyun,
“Parallel reduced-order extended Kalman Filter for PMSM
sensorless drives,” in Proceedings of the 34th Annual Conference
of the IEEE Industrial Electronics Society (IECON ’08), pp. 1326–
1331, November 2008.
[8] Y.-S. Kung and M.-H. Tsai, “FPGA-based speed control IC for
PMSM drive with adaptive fuzzy control,” IEEE Transactions on
Power Electronics, vol. 22, no. 6, pp. 2476–2486, 2007.
Copyright of Mathematical Problems in Engineering is the property of Hindawi Publishing
Corporation and its content may not be copied or emailed to multiple sites or posted to a
listserv without the copyright holder's express written permission. However, users may print,
download, or email articles for individual use.