14
Hindawi Publishing Corporation Mathematical Problems in Engineering Volume 2013, Article ID 919318, 13 pages http://dx.doi.org/10.1155/2013/919318 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 Lin 1 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 Correspondence should be addressed to Ying-Shieh Kung; [email protected] Received 9 September 2013; Accepted 22 October 2013 Academic Editor: Teen-Hang Meen Copyright © 2013 Ying-Shieh Kung et al. is 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. ese estimated values are feedbacked to the current loop for vector control and to the speed loop for speed control. irdly, 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. en, 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 PMSM has been increasingly used in many automation control fields as actuators, due to its advantages of supe- rior power density, high-performance motion control with fast speed, and better accuracy. However, conventional motor control needs a speed sensor or an optical encoder to measure the rotor speed and feedback it to the controller for ensuring the precision speed control. Such sensor presents some disadvantages such as drive cost, machine size, reliabil- ity, and noise immunity. In recent years, a sensorless control without position and speed sensors for PMSM drive become a popular research topic in the literature [17]. ose sen- sorless control strategies have sliding mode observer (SMO), extended Kalman filter (EKF), reduced-order EKF, and so forth. e EKF is basically a full-order stochastic observer for the recursive optimum state estimation of a nonlinear dynamic system in real time by using signals that are in noisy environment [7]. Comparing with SMO, EKF can directly estimate the angular speed and it has high convergence rate which can give a more rapid speed response [5]. However, EKF requires heavy online 4×4 matrix computing; therefore, the complex computation becomes a challenge for a fixed- point processor system. In realization, a fixed-point processor using digital signal processor (DSP) and field programmable gate array (FPGA) both can provide a good solution in this issue. Particularly, FPGA with programmable hard- wired feature, fast computation ability, shorter design cycle, embedding processor, low power consumption, and higher density is better for the implementation of the digital system [8, 9] than DSP. Recently, a cosimulation work by Electronic Design Au- tomation (EDA) Simulator Link has been gradually applied to verify the effectiveness of the Verilog and VHDL code in the motor drive system [1012]. e EDA Simulator Link [13] provides a cosimulation interface between MATLAB or Simulink and HDL simulators-ModelSim [14]. Using it you

Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

  • Upload
    ngokiet

  • View
    263

  • Download
    4

Embed Size (px)

Citation preview

Page 1: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

Hindawi Publishing CorporationMathematical Problems in EngineeringVolume 2013 Article ID 919318 13 pageshttpdxdoiorg1011552013919318

Research ArticleFPGA Realization of Sensorless PMSMSpeed Controller Based on Extended Kalman Filter

Ying-Shieh Kung1 Nguyen Vu Quynh2 Nguyen Trung Hieu1 and Jin-Mu Lin1

1 Department of Electrical Engineering Southern Taiwan University of Science and Technology 1 Nan-Tai StreetYong-Kang District Tainan City 710 Taiwan

2Department of Electrical Engineering Lac Hong University 10 Huynh Van Nghe Street Buu Long DistrictBien Hoa City 084 Dong Nai Province Vietnam

Correspondence should be addressed to Ying-Shieh Kung kungmailstustedutw

Received 9 September 2013 Accepted 22 October 2013

Academic Editor Teen-Hang Meen

Copyright copy 2013 Ying-Shieh Kung et al This is an open access article distributed under the Creative Commons AttributionLicense which permits unrestricted use distribution and reproduction in any medium provided the original work is properlycited

Based on extended Kalman filter (EKF) the design and FPGA implementation of a sensorless control intellectual property (IP) forpermanent magnet synchronous motor (PMSM) drive are presented in this paper Firstly the mathematical model for PMSM isderived and the vector control is built up Secondly the rotor flux angle (FA) and rotor speed which are estimated by using EKFare describedThese estimated values are feedbacked to the current loop for vector control and to the speed loop for speed controlThirdly the very-high-speed IC hardware description language (VHDL) is adopted to describe the behavior of the sensorless speedcontrol IP which includes the circuits of space vector pulse width modulation (SVPWM) coordinate transformation EKF andPI controller Finally to evaluate the effectiveness and correctness of the proposed of system a cosimulation work performed bySimulink and ModelSim is firstly conducted Then an experimental system by FPGA chip and motor driving board is set up tofurther validate the performance of the proposed EKF-based sensorless speed control IP

1 Introduction

PMSM has been increasingly used in many automationcontrol fields as actuators due to its advantages of supe-rior power density high-performance motion control withfast speed and better accuracy However conventionalmotorcontrol needs a speed sensor or an optical encoder tomeasure the rotor speed and feedback it to the controller forensuring the precision speed control Such sensor presentssome disadvantages such as drive cost machine size reliabil-ity and noise immunity In recent years a sensorless controlwithout position and speed sensors for PMSM drive becomea popular research topic in the literature [1ndash7] Those sen-sorless control strategies have sliding mode observer (SMO)extended Kalman filter (EKF) reduced-order EKF and soforth The EKF is basically a full-order stochastic observerfor the recursive optimum state estimation of a nonlineardynamic system in real time by using signals that are in noisyenvironment [7] Comparing with SMO EKF can directly

estimate the angular speed and it has high convergence ratewhich can give a more rapid speed response [5] HoweverEKF requires heavy online 4times4matrix computing thereforethe complex computation becomes a challenge for a fixed-point processor system In realization a fixed-point processorusing digital signal processor (DSP) and field programmablegate array (FPGA) both can provide a good solution inthis issue Particularly FPGA with programmable hard-wired feature fast computation ability shorter design cycleembedding processor low power consumption and higherdensity is better for the implementation of the digital system[8 9] than DSP

Recently a cosimulation work by Electronic Design Au-tomation (EDA) Simulator Link has been gradually appliedto verify the effectiveness of the Verilog and VHDL codein the motor drive system [10ndash12] The EDA Simulator Link[13] provides a cosimulation interface between MATLAB orSimulink and HDL simulators-ModelSim [14] Using it you

2 Mathematical Problems in Engineering

can verify a VHDL Verilog or mixed-language implemen-tation against your Simulink model or MATLAB algorithm[13] Therefore EDA Simulator Link lets you use MATLABcode and Simulink models as a test bench that generatesstimulus for anHDL simulation and analyzes the simulationrsquosresponse [13] In this paper a cosimulation by EDA SimulatorLink is applied to sensorless speed control for PMSM driveThe PMSM inverter and speed command are performed inSimulink and the EKF algorithm current vector controllerand speed PI controller described by VHDL code are exe-cuted in ModelSim After successful verification in simula-tion an FPGA-based experimental system is established withconfiguration as in Figure 1 for realizing the proposed IP codeagain and experiment results will validate the effectiveness ofthe sensorless speed control system of PMSM drive

2 System Description of PMSM Drive andSensorless Speed Control

The sensorless speed control block diagram for PMSM driveis shown in Figure 1 The modeling of PMSM the EKF-basedrotor flux angle (FA) and rotor speed estimation and the PIcontroller are introduced as follows

21 Mathematical Model of PMSM Themathematical modelof a PMSM is described in two-axis 119889-119902 synchronous rotat-ing reference frame as follows

119889119894119889

119889119905= minus

119903119904

119871119889

119894119889 + 120596119890

119871119902

119871119889

119894119902 +1

119871119889

V119889

119889119894119902

119889119905= minus120596119890

119871119889

119871119902

119894119889 minus119903119904

119871119902

119894119902 minus 120596119890

120582119891

119871119902

+1

119871119902

V119902

(1)

where V119889 V119902 are the 119889 and 119902 axes voltages 119894119889 119894119902 arethe 119889 and 119902 axes currents 119903119904 is the phase winding resis-tance 119871119889 119871119902 are the 119889 and 119902 axes inductance 120596119890 is the rotat-ing speed of magnet flux and 120582119891 is the permanent magnetflux linkage

The current loop control of PMSM drive in Figure 1 isbased on a vector control approach That is if the 119894119889 is forcedto 0 the PMSM will be decoupled and controlling a PMSMis like controlling a DC motor After decoupling the motorrsquostorque is proportional to 119894119902

119879119890 =3119873119875

4120582119891119894119902

Δ= 119870119905119894119902 (2)

Considering the mechanical load the overall dynamic equa-tion of PMSM drive system is obtained by

119869119898

119889

119889119905120596119903 + 119861119898120596119903 = 119879119890 minus 119879119871 (3)

where 119879119890 is the motor torque 119873119875 is pole pairs 119870119905 is torqueconstant 119869119898 is the inertial value 119861119898 is damping ratio 119879119871 isthe external torque and 120596119903 is rotor speed

22 Extended Kalman Filter (EKF) For a motor stochasticnonlinear equation it can be written in the following form

(119905) = 119891 [119909 (119905)] + 119861119906 (119905) + 120590 (119905) (4)

119910 (119905) = ℎ [119909 (119905)] + 120583 (119905) (5)

where 119909(119905) 119906(119905) and 119910(119905) are system state system inputand system output respectively The 120590(119905) and 120583(119905) representsystem noise and measurement noise which are zero-meanwhite Gaussian distribution with covariance 119876(119905) and 119877(119905)respectively Once a nominal solution to a motor nonlinearequation can be found in (4)-(5) the linearized perturbationequation is

120575 (119905) = 119865 (119909 (119905)) 120575119909 (119905) + 119861120575119906 (119905) + 120590 (119905) (6)

120575119910 (119905) = 119867 (119909 (119905)) 120575119909 + 120583 (119905) (7)

where the Jacobian and output matrices are defined as fol-lows

119865 (119909 (119905)) =120597119891

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

119867 (119909 (119905)) =120597ℎ

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

(8)

After discretization with sampling time 119879119888 (6) becomes

119909 (119905119899) = Φ (119905119899 119905119899minus1 119909 (119905119899minus1)) 119909 (119905119899minus1)

+ int

119905119899

119905119899minus1

Φ(119905119899 119905119899minus1 119909 (119905119899minus1)) 119861119889120591 sdot 119906 (119905119899minus1) + ] (119905119899minus1)

(9)

where Φ(119905119899 119905119899minus1 119909(119905119899minus1)) is an exponential matrix and itscomputation can be simplified by

Φ(119905119899 119905119899minus1 119909 (119905119899minus1)) cong I + 119865119879119888 (10)

Further

int

119905119899

119905119899minus1

Φ(119905119899 119905119899minus1 119909 (119905119899minus1)) 119861119889120591 cong 119861119879119888 (11)

Therefore the discrete model of (6)-(7) becomes

119909 (119899) = (119868 + 119865119879119888) 119909 (119899 minus 1) + 119861119879119888 sdot 119906 (119899 minus 1) + ] (119899 minus 1) (12)

119910 (119899) = 119867 sdot 119909 (119899) + 120585 (119899 minus 1) (13)

where 119905119899 = 119899119879119888 and 119905119899minus1 = (119899 minus 1)119879119888The EKF is an optimal estimator which searches the

cost function 119869 = sum119898

119899=11198641199092(119899) at the least square sense

The 119909(119899) is defined by 119909(119899) = 119909(119899) minus 119909(119899) which isthe difference of estimation of state 119909(119899) and system state119909(119899) The EKF algorithm is described by the following two-step recursive equations

Mathematical Problems in Engineering 3

SVPWM

PMSM

PI

Inverter

PWM 1

Park Clark

PWM 6

PWM 2PWM 3PWM 4PWM 5

PI

a b c

Current controller

AD

Modify

AD interface

AD

sin cos of flux angle

FPGA

LPF

LPF

Speed controller

PI

Rotor flux and rotor speed

estimation based on EKF

Load

Ac source

Rectifier

Speed command generation

CL

iu

iw

ref1

ref2

ref3

ia

ib

ic

120572

120572

120573

120573

i120572

i120572

i120573

i120573

120572 120573

120572 120573

120572 120573

120572 120573

iq

id

q

d

d q

d q

ilowastq

+

++

minus

minusminusilowastd = 0

120596lowastr

120596r

120596r

sin e

e

cos e

clarkminus1Parkminus1

Nios II processor

CPU

On-chipROM

On-chipRAM

Aval

on b

us

UART

PIO

Timer

SPI

SDRAMcontroller

a b c

Figure 1 Architecture of FPGA-based sensorless PMSM drive system

Step 1 (prediction step) From (4) and using a simple rectan-gular integration

119909119899|119899minus1 = 119909119899minus1 + (119891 [119909119899minus1] + 119861 sdot 119906119899minus1) 119879119888 (14)

or from (12)

119909119899|119899minus1 = Φ119899minus1119909119899minus1 + 119861119879119888 sdot 119906119899minus1 (15)

The covariance is updated by

119875119899|119899minus1 = Φ119899minus1119875119899minus1Φ119879

119899minus1+ 119876119889 (16)

Step 2 (innovation step) Consider

119909119899 = 119909119899|119899minus1 + 119870119899 (119910119899 minus 119867119909119899|119899minus1) (17)

119875119899 = 119875119899|119899minus1 minus 119870119899119867119875119899|119899minus1 (18)

The Kalman gain is calculated by

119870119899 = 119875119899|119899minus1119867119879[119867119875119899|119899minus1119867

119879+ 119877]minus1

(19)

Figure 2 shows the procedure of EKF with two step aboveafter measurement update it will be changed to time update

23 Design of the Sensorless PMSMBased on EKF The circuitequation of PMSM on the d-q rotating coordinate in (1) is re-formulated as

[

V119889

V119902] = [

119903119904 + 119904119871 119904 minus120596119890119871 119904

120596119890119871 119904 119903119904 + 119904119871 119904] [119894119889

119894119902] + [

0

120596119890120582119891] (20)

where 119871 119904Δ= 119871119889 = 119871119902 Transforming (20) the circuit equation

of PMSM on the 120572minus120573 fixed coordinate can be derived by thefollowing equation

[V120572V120573] = [

119903119904 + 119904119871 119904 0

0 119903119904 + 119904119871 119904] [119894120572

119894120573] + 120596119890120582119891 [

minus sin 120579119890cos 120579119890

] (21)

where [V120572 V120573]119879 is voltage on fixed coordinate [119894120572 119894120573]

119879 iscurrent on fixed coordinate 120579119890 is angular position at magnetflux and 119904 is differential operator If we choose the 119909(119905) =[119894120572 119894120573 120596119890 120579119890]

119879as the state variable of the PMSMmathematicalmodel then (21) can be expanded to the following formula-tion

119889

119889119905

[[[[[

[

119894120572

119894120573

120596119890

120579119890

]]]]]

]

=

[[[[[[[[[

[

minus119903119904119894120572

119871 119904

+

120596119890120582119891

119871 119904

sin 120579119890

minus

119903119904119894120573

119871 119904

minus

120596119890120582119891

119871 119904

cos 120579119890

0

120596119890

]]]]]]]]]

]

+

[[[[[[[[

[

1

119871 119904

0

01

119871 119904

0 0

0 0

]]]]]]]]

]

[

V120572

V120573]Δ= 119891 + 119861[

V120572

V120573]

(22)

[

119894120572

119894120573

] = [1 0 0 0

0 1 0 0]

[[[[[

[

119894120572

119894120573

120596119890

120579119890

]]]]]

]

Δ= ℎ (23)

4 Mathematical Problems in Engineering

Time update (prediction)

Calculate temporary state variables

Calculate temporary covariance matrix

Measurement update (innovation)

Calculate Kalman gain

Update state variables and covariance matrix

Initial

orxn|nminus1 = xnminus1 + (f[xnminus1] + B middot unminus1)Tc

xn|nminus1 = Φnminus1xnminus1 + BTc middot unminus1

Pn|nminus1 = Φnminus1Pnminus1ΦTnminus1 + Qd

Pn|nminus1 Qd R

xn = xn|nminus1 + Kn(yn minus Hxn|nminus1)

Pn = Pn|nminus1 minus KnHPn|nminus1

Kn = Pn|nminus1HT[HPn|nminus1H

T + R]minus1

Figure 2 Demonstration of the EKF operation

where 119909(119905) = [119894120572 119894120573 120596119890 120579119890]119879 119910(119905) = lfloor119894120572 119894120573rfloor and 119906(119905) =

[V120572 V120573]119879 From (8) and (22) the Jacobian and output matri-

ces can be obtained

119865 (119909 (119905)) =120597119891

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

=

[[[[[[[[[

[

minus119903119904

119871 119904

0

120582119891

119871 119904

sin 120579119890120596119890120582119891

119871 119904

cos 120579119890

0 minus119903119904

119871 119904

minus

120582119891

119871 119904

cos 120579119890120596119890120582119891

119871 119904

sin 120579119890

0 0 0 0

0 0 1 0

]]]]]]]]]

]

(24)

119867(119909 (119905)) =120597ℎ

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

= [1 0 0 0

0 1 0 0] (25)

Further substituting (24) into (10) the exponential matrix isshown as follows

Φ(119905119899 119905119899minus1 119909 (119905119899minus1))

cong 119868 + 119865119879119888

=

[[[[[[[[[

[

1 minus119903119904119879119888

119871 119904

0

120582119891119879119888

119871 119904

sin 120579119890120596119890120582119891119879119888

119871 119904

cos 120579119890

0 1 minus119903119904119879119888

119871 119904

minus

120582119891119879119888

119871 119904

cos 120579119890120596119890120582119891119879119888

119871 119904

sin 120579119890

0 0 1 0

0 0 119879119888 1

]]]]]]]]]

]

Δ=

[[[

[

119866 0 12060113 12060114

0 119866 12060123 12060124

0 0 1 0

0 0 119879119888 1

]]]

]

(26)

As the results the EKF algorithm in (14)ndash(19) can be carriedout to estimate the state valueThe initial values of 119876119889119877 and1198750 need to be chosen Through the recursive calculation the

state value of 119909(119899) = [120572(119899) 120573(119899) 119890(119899) 120579119890(119899)]119879 is estimated

at each sampling period then the rotor speed can be derivedby

119903 (119899) =119890 (119899)

119873119875

(27)

Finally a summary for the estimation of rotor FA androtor speed based on EKF is presented as follows

Step 1 Set the initial values of 119876119889 119877 1198750 and 119899 = 1

Step 2 Measure the values of 119894120572(119899) 119894120573(119899) V120572(119899) and V120573(119899)from PMSM system

Step 3 Estimate the temporary state variables from (14) Inaddition refer to (22) and the scalar form of the predictionequation can be expressed as follows

120572 (119899 | 119899 minus 1) = (1 minus 119879119888

119903119904

119871 119904

) 120572 (119899 minus 1)

+

119890 (119899 minus 1) 119879119888120582119891 sin (120579119890 (119899 minus 1))119871 119904

+119879119888V120572 (119899 minus 1)

119871 119904

120573 (119899 | 119899 minus 1) = (1 minus 119879119904

119903119904

119871 119904

) 120573 (119899 minus 1)

minus

119890 (119899 minus 1) 119879119904120582119891 cos (120579119890 (119899 minus 1))119871 119904

+

119879119888V120573 (119899 minus 1)

119871 119904

119890 (119899119899 minus 1) = 119890 (119899 minus 1)

120579119890 (119899119899 minus 1) = 120579119890 (119899 minus 1) + 119890 (119899 minus 1) 119879119888

(28)

Step 4 Calculate the Φ119899minus1 from (26)

Mathematical Problems in Engineering 5

Clk

STSB

RCBRCA

STSA

CHBCHA

SVPWMgeneration

ADC interface

Frequency

Application IP

dividerCK

PWM 1PWM 2PWM 3PWM 4PWM 5PWM 6

ADIN[11]

ADIN[0]BDIN[11]

BDIN[0]

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

Aval

on b

us

Aval

on b

us

FPGA-based sensorless speed control IP

D[31]

D[0]

A[22]

A[0]

Current controllers and coordinate transformation

(CCCT)

Clk

Clk

Clk

Speed controller

(PI controller)

Clk

Clk-step

Clk-step

Clk-step

Clk-step

Clk-step

Rotor flux and rotor speed estimation

based on EKF

Clk

Nios II embedded processor IP

Sram be[3]Sram be[2]Sram be[1]Sram be[0]

Sram oeSram weSram cs

120596lowastr [150]

120596lowastr [150]

r [150]ilowastq [110]

e[110]

120572[110]

120573[110]

i120572[110]

i120573[110]

ia[110]

ib[110]

ic[110]

[110]

[110]

[110]

rx

ry

rz

Figure 3 Internal architecture of a sensorless speed control IP in FPGA

Step 5 Obtain the temporary covariance matrix 119875119899|119899minus1 from(16) Because matrix 119875119899|119899minus1 is symmetric matrix by 119901119894119895 = 119901119895119894it can be chosen by the following form

119875119899|119899minus1 =

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

(29)

Hence from (16) individual elements of 119875119899|119899minus1 could beupdated as follows

11990111 lArr997904 119866211990111 + 21198661206011411990114 + 21198661206011311990113 + 2120601141206011311990134

+ 1206012

1411990144 + 120601

2

1311990133 + 11990211

11990112 lArr997904 119866211990112 + 1198661206011411990124 + 1198661206011311990123

+ 12060123 (11986611990113 + 1206011311990133 + 1206011411990134)

+ 12060124 (11986611990114 + 1206011311990134 + 1206011411990144)

11990113 lArr997904 11986611990113 + 1206011311990133 + 1206011411990134

11990114 lArr997904 (11986611990113 + 1206011311990133 + 1206011411990134) 119879119888

+ (11986611990114 + 1206011311990134 + 1206011411990144)

11990122 lArr997904 2119866 (1206012311990123 + 1206012411990124) + 119866211990122 + 120601

2

2311990133

+ 1206012

2411990144 + 2120601231206012411990134 + 11990222

11990123 lArr997904 11986611990123 + 1206012311990133 + 1206012411990134

11990124 lArr997904 (11986611990123 + 1206012311990133 + 1206012411990134) 119879119888 + 11986611990124

+ 1206012411990144 + 1206012311990134

11990133 lArr997904 11990133 + 11990233

11990134 lArr997904 11987911988811990133 + 11990134

11990144 lArr997904 11990144 + 1198792

11988811990133 + 211987911988811990134 + 11990244

(30)Step 6 Calculate the Kalman gain from (19) Using (25) and(29) the formulation is further simplified as follows Firstly

[119867119875119899|119899minus1119867119879+ 119877]minus1

=

[[[

[

[1 0 0 0

0 1 0 0]

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

[[[

[

1 0

0 1

0 0

0 0

]]]

]

+ [11987711 0

0 11987722]

]]]

]

minus1

= [[11990111 11990112

11990121 11990122] + [

11987711 0

0 11987722]]

minus1

(31)

6 Mathematical Problems in Engineering

cos

sin

Calculate Jacobian matrix and predict state variables Prediction of temporary

Calculation of error Update estimated state

Obtain the temporary covariance

matrix

Update

and calculate

+ +21k

SR2

e(n

e(n)

minus 1)

e(n minus 1)e

120579e

(n minus 1)

e

sin(e(n minus 1))

sin(e(n minus 1))

cos(e(n minus 1)) cos(e(n minus 1))

e(n minus 1)

e(n

e(n)

minus 1)

e

i120573(n minus 1)

e(n minus 1)120582fTc

Lse(n minus 1)120582fTc

Ls

e(n minus 1)120582fTc

Ls

120582fTc

Ls

120582fTc

Ls1 minus TcrsLs

1 minus Tc

Tc

rsLs

i120572(n minus 1)

i120572(n)

i120572(n)

i120573(n

i120573(n)

i120573(n)

120573(n)i120573(n)

|n minus 1)

i120572(n|n minus 1)

i120573(n|n minus 1)

(n|n minus 1)(n

r(n)

|n minus 1)

i120573(n|n minus 1)

i120572(n|n minus 1)

(n|n minus 1)

i120572(n|n minus 1)

TcLs

120572(n minus 1)

TcLs

120573(n minus 1)12060124

12060123

12060113

12060114

minus120582fTc

Ls

s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s11 s12 s13 s68

s69 s70 s71 s120 s122 s123 s124 s125 s126 s127 s128 s129 s130s121

Q11Q22Q33Q44

Pnminus1

Pn|nminus1

Pn|nminus1

Pn

Kn

K11

covariance matrix Pn

i120572(n)i

i

120572(n)

i120572(n)

i120572(n)i120572(n)

i120573(n)

i120573(n)

i120573(n)

Update Pn and calculate Kn

matrix Pn

matrix Kn

R11 R22

k12

k31

k22

k42k32

k41

++

++

+

+

+ + +

+ +

+ +

minus

minus

minus

times

times

times

times

times

times

times

timestimes

timestimes

times

times

times

times

times

times

times

Figure 4 State diagram of FSM for describing the EKF-based algorithm

where 119877 represents the uncertainties of measurement vari-ablewhich are very difficult to knowHence119877 is often chosenas unity matrix for simplifying the task but does not affect theoutcome (31) Since 11987512 = 11987521 (31) can be rewritten in thefollowing form

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1

[11990122 + 1 minus11990112

minus11990112 11990111 + 1]

(32)To normalize the input value and to prevent the numericaloverflow condition which occurred during computation (32)is normalized and those values are all divided by 4Therefore(32) becomes

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

119872

[[[[

[

11990122 + 1

4

minus11990112

4

minus11990112

4

11990111 + 1

4

]]]]

]

Δ= [11990511 11990512

11990521 11990522]

(33)

where 119872 = (1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1)4 Then from (19)

the Kalman gain can be calculated by

119870119899

Δ=

[[[[[

[

11989611

11989621

11989631

11989641

11989612

11989622

11989632

11989642

]]]]]

]

=

[[[[[

[

11990111

11990121

11990131

11990141

11990112

11990122

11990132

11990142

]]]]]

]

[11990511 11990512

11990521 11990522]

=

[[[[[

[

1199011111990511 + 1199011211990521

1199012111990511 + 1199012211990521

1199013111990511 + 1199013211990521

1199014111990511 + 1199014211990521

1199011111990512 + 1199011211990522

1199012111990512 + 1199012211990522

1199013111990512 + 1199013211990522

1199014111990512 + 1199014211990522

]]]]]

]

(34)

Mathematical Problems in Engineering 7

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

++ + + +

+

+

+ +

+

++ +

+ +

+ + +

++ ++Product Sum

SL1

SL1

SL1

SL1

SL1SL1

Predicted estimate covariance

+ + +

+

s35 s36 s37 s38 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s49 s50 s51 s52 s53 s54 s55 s56

s57 s58 s59 s60 s61 s62 s63 s64 s65 s66 s67 s68

s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 s33 s34

12060114

1206011412060114

12060114

12060113

12060123

12060113

12060114

12060113

12060113

12060113

p14

p13

p34

p44

p33

p12p33

p23

p13

p33 p34

p24

p11

G

12060113 12060114

12060123

12060123

12060123

12060123

12060123

12060124

12060124

12060124

12060124

12060124

12060124

12060123

12060124p14

p34 p44

p22 p44

p23

p44

p33

p34

p34

p34

p24

p44

p33

p34

p23

p33

p34

p24

p11p12p13p14p22p23p24p33p34p44

G

G

G

G

G

G

G2

G2

G2

q11

q22

q44

q33

+

+ + +

+

times

times

times

times

times

times times

times

times

timestimes

times

times

times timestimes

times

times

times

times

times

times

times

times

times

times

times

timestimes

times times

times

times

times

times

times

times

times

times

times

timestimes

times

times

t33

t11

t13

t99840012

t99840012

t12

t44

t34

t24t23

t13

t11t12t13t14t22t23t24t33t34t44

t22

t23

t14

Tc

Tc

Tc

2Tc

Tc

Q

Pn|nminus1

Qn|nminus1

Pnminus1

Shift left 1bit

Figure 5 State diagram of FSM for prediction of covariance matrix 119875119899|119899minus1

8 Mathematical Problems in Engineering

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

025

025

025

+ + + +

+

+ AB

+

+

+

+

+

+

ABAB

AB

Divide

Product

Sum

+

+

+

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25

p11

p11

p11

p12

p13

p32

p22

p22

p11

p11

p22

p22p

M

M

M

M22

p12

p12

p12

p12

p13

p14p24

p14p42

p23

p12

t11

t11

t11

t12

t12

t11

t12

t12

t22

t12

t12t22

t22

t22

t11

t12

t12

t12

t22

k11

k21

k12

k22

k42

k41

k31

k32

divide

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

Shift rightSR2SR2

SR2

SR2

SR2

2bits

k11

k12

k21

k22

k31

k32 Pn|nminus1

Matrix Kn

Kn

minus

minusp12

(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

p11

p22

p23

p11

p13

p12

p12

p12

p33

p13

p23p24

p44

p14

p24

p24

p24

p24

p14

p14

p14

p22

p22

p23

p13

p13p23

p12

p34p14

t11

t12

t33

t24

t34

t11

t12

t13

t14

t22

t23

t24

t33

t34

t14

t22

t13

t23

k12

k12

k12

k11

k31

k32

k21

k11

k31k12

k22

k22

k21

k21

k32

k41

k42

k22

k11

k11

times

times

times

times

times

timestimes

times

times

times

times

times

times

times

times

times

times

times

times

timesProduct Sum+times

K

H

n

p11

p44

p12

p13

p14

p22

p23

p24

p33

p34Update covariance

matrix Pn

Pn

Pn|nminus1

(b)

Figure 6 State diagram of FSM for (a) the calculation of matrix 119870119899 and (b) the update of covariance matrix 119875119899

Step 7 Tune the present state variables from (17) and itsscalar form is shown as follows

120572 (119899) = 120572 (119899119899 minus 1) + 11989611 120572 (119899) + 11989612 120573 (119899)

120573 (119899) = 120573 (119899119899 minus 1) + 11989621 120572 (119899) + 11989622 120573 (119899)

119890 (119899) = 119890 (119899119899 minus 1) + 11989631 120572 (119899) + 11989632 120573 (119899)

120579119890 (119899) = 120579119890 (119899 | 119899 minus 1) + 11989641 120572 (119899) + 11989642 120573 (119899)

(35)

where 119896119894119895 is the element in Kalman gain 119870119899 sdot 120572(119899) = 119894120572(119899) minus120572(119899 | 119899 minus 1) and 120573(119899) = 119894120573(119899) minus 120573(119899 | 119899 minus 1)

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 2: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

2 Mathematical Problems in Engineering

can verify a VHDL Verilog or mixed-language implemen-tation against your Simulink model or MATLAB algorithm[13] Therefore EDA Simulator Link lets you use MATLABcode and Simulink models as a test bench that generatesstimulus for anHDL simulation and analyzes the simulationrsquosresponse [13] In this paper a cosimulation by EDA SimulatorLink is applied to sensorless speed control for PMSM driveThe PMSM inverter and speed command are performed inSimulink and the EKF algorithm current vector controllerand speed PI controller described by VHDL code are exe-cuted in ModelSim After successful verification in simula-tion an FPGA-based experimental system is established withconfiguration as in Figure 1 for realizing the proposed IP codeagain and experiment results will validate the effectiveness ofthe sensorless speed control system of PMSM drive

2 System Description of PMSM Drive andSensorless Speed Control

The sensorless speed control block diagram for PMSM driveis shown in Figure 1 The modeling of PMSM the EKF-basedrotor flux angle (FA) and rotor speed estimation and the PIcontroller are introduced as follows

21 Mathematical Model of PMSM Themathematical modelof a PMSM is described in two-axis 119889-119902 synchronous rotat-ing reference frame as follows

119889119894119889

119889119905= minus

119903119904

119871119889

119894119889 + 120596119890

119871119902

119871119889

119894119902 +1

119871119889

V119889

119889119894119902

119889119905= minus120596119890

119871119889

119871119902

119894119889 minus119903119904

119871119902

119894119902 minus 120596119890

120582119891

119871119902

+1

119871119902

V119902

(1)

where V119889 V119902 are the 119889 and 119902 axes voltages 119894119889 119894119902 arethe 119889 and 119902 axes currents 119903119904 is the phase winding resis-tance 119871119889 119871119902 are the 119889 and 119902 axes inductance 120596119890 is the rotat-ing speed of magnet flux and 120582119891 is the permanent magnetflux linkage

The current loop control of PMSM drive in Figure 1 isbased on a vector control approach That is if the 119894119889 is forcedto 0 the PMSM will be decoupled and controlling a PMSMis like controlling a DC motor After decoupling the motorrsquostorque is proportional to 119894119902

119879119890 =3119873119875

4120582119891119894119902

Δ= 119870119905119894119902 (2)

Considering the mechanical load the overall dynamic equa-tion of PMSM drive system is obtained by

119869119898

119889

119889119905120596119903 + 119861119898120596119903 = 119879119890 minus 119879119871 (3)

where 119879119890 is the motor torque 119873119875 is pole pairs 119870119905 is torqueconstant 119869119898 is the inertial value 119861119898 is damping ratio 119879119871 isthe external torque and 120596119903 is rotor speed

22 Extended Kalman Filter (EKF) For a motor stochasticnonlinear equation it can be written in the following form

(119905) = 119891 [119909 (119905)] + 119861119906 (119905) + 120590 (119905) (4)

119910 (119905) = ℎ [119909 (119905)] + 120583 (119905) (5)

where 119909(119905) 119906(119905) and 119910(119905) are system state system inputand system output respectively The 120590(119905) and 120583(119905) representsystem noise and measurement noise which are zero-meanwhite Gaussian distribution with covariance 119876(119905) and 119877(119905)respectively Once a nominal solution to a motor nonlinearequation can be found in (4)-(5) the linearized perturbationequation is

120575 (119905) = 119865 (119909 (119905)) 120575119909 (119905) + 119861120575119906 (119905) + 120590 (119905) (6)

120575119910 (119905) = 119867 (119909 (119905)) 120575119909 + 120583 (119905) (7)

where the Jacobian and output matrices are defined as fol-lows

119865 (119909 (119905)) =120597119891

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

119867 (119909 (119905)) =120597ℎ

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

(8)

After discretization with sampling time 119879119888 (6) becomes

119909 (119905119899) = Φ (119905119899 119905119899minus1 119909 (119905119899minus1)) 119909 (119905119899minus1)

+ int

119905119899

119905119899minus1

Φ(119905119899 119905119899minus1 119909 (119905119899minus1)) 119861119889120591 sdot 119906 (119905119899minus1) + ] (119905119899minus1)

(9)

where Φ(119905119899 119905119899minus1 119909(119905119899minus1)) is an exponential matrix and itscomputation can be simplified by

Φ(119905119899 119905119899minus1 119909 (119905119899minus1)) cong I + 119865119879119888 (10)

Further

int

119905119899

119905119899minus1

Φ(119905119899 119905119899minus1 119909 (119905119899minus1)) 119861119889120591 cong 119861119879119888 (11)

Therefore the discrete model of (6)-(7) becomes

119909 (119899) = (119868 + 119865119879119888) 119909 (119899 minus 1) + 119861119879119888 sdot 119906 (119899 minus 1) + ] (119899 minus 1) (12)

119910 (119899) = 119867 sdot 119909 (119899) + 120585 (119899 minus 1) (13)

where 119905119899 = 119899119879119888 and 119905119899minus1 = (119899 minus 1)119879119888The EKF is an optimal estimator which searches the

cost function 119869 = sum119898

119899=11198641199092(119899) at the least square sense

The 119909(119899) is defined by 119909(119899) = 119909(119899) minus 119909(119899) which isthe difference of estimation of state 119909(119899) and system state119909(119899) The EKF algorithm is described by the following two-step recursive equations

Mathematical Problems in Engineering 3

SVPWM

PMSM

PI

Inverter

PWM 1

Park Clark

PWM 6

PWM 2PWM 3PWM 4PWM 5

PI

a b c

Current controller

AD

Modify

AD interface

AD

sin cos of flux angle

FPGA

LPF

LPF

Speed controller

PI

Rotor flux and rotor speed

estimation based on EKF

Load

Ac source

Rectifier

Speed command generation

CL

iu

iw

ref1

ref2

ref3

ia

ib

ic

120572

120572

120573

120573

i120572

i120572

i120573

i120573

120572 120573

120572 120573

120572 120573

120572 120573

iq

id

q

d

d q

d q

ilowastq

+

++

minus

minusminusilowastd = 0

120596lowastr

120596r

120596r

sin e

e

cos e

clarkminus1Parkminus1

Nios II processor

CPU

On-chipROM

On-chipRAM

Aval

on b

us

UART

PIO

Timer

SPI

SDRAMcontroller

a b c

Figure 1 Architecture of FPGA-based sensorless PMSM drive system

Step 1 (prediction step) From (4) and using a simple rectan-gular integration

119909119899|119899minus1 = 119909119899minus1 + (119891 [119909119899minus1] + 119861 sdot 119906119899minus1) 119879119888 (14)

or from (12)

119909119899|119899minus1 = Φ119899minus1119909119899minus1 + 119861119879119888 sdot 119906119899minus1 (15)

The covariance is updated by

119875119899|119899minus1 = Φ119899minus1119875119899minus1Φ119879

119899minus1+ 119876119889 (16)

Step 2 (innovation step) Consider

119909119899 = 119909119899|119899minus1 + 119870119899 (119910119899 minus 119867119909119899|119899minus1) (17)

119875119899 = 119875119899|119899minus1 minus 119870119899119867119875119899|119899minus1 (18)

The Kalman gain is calculated by

119870119899 = 119875119899|119899minus1119867119879[119867119875119899|119899minus1119867

119879+ 119877]minus1

(19)

Figure 2 shows the procedure of EKF with two step aboveafter measurement update it will be changed to time update

23 Design of the Sensorless PMSMBased on EKF The circuitequation of PMSM on the d-q rotating coordinate in (1) is re-formulated as

[

V119889

V119902] = [

119903119904 + 119904119871 119904 minus120596119890119871 119904

120596119890119871 119904 119903119904 + 119904119871 119904] [119894119889

119894119902] + [

0

120596119890120582119891] (20)

where 119871 119904Δ= 119871119889 = 119871119902 Transforming (20) the circuit equation

of PMSM on the 120572minus120573 fixed coordinate can be derived by thefollowing equation

[V120572V120573] = [

119903119904 + 119904119871 119904 0

0 119903119904 + 119904119871 119904] [119894120572

119894120573] + 120596119890120582119891 [

minus sin 120579119890cos 120579119890

] (21)

where [V120572 V120573]119879 is voltage on fixed coordinate [119894120572 119894120573]

119879 iscurrent on fixed coordinate 120579119890 is angular position at magnetflux and 119904 is differential operator If we choose the 119909(119905) =[119894120572 119894120573 120596119890 120579119890]

119879as the state variable of the PMSMmathematicalmodel then (21) can be expanded to the following formula-tion

119889

119889119905

[[[[[

[

119894120572

119894120573

120596119890

120579119890

]]]]]

]

=

[[[[[[[[[

[

minus119903119904119894120572

119871 119904

+

120596119890120582119891

119871 119904

sin 120579119890

minus

119903119904119894120573

119871 119904

minus

120596119890120582119891

119871 119904

cos 120579119890

0

120596119890

]]]]]]]]]

]

+

[[[[[[[[

[

1

119871 119904

0

01

119871 119904

0 0

0 0

]]]]]]]]

]

[

V120572

V120573]Δ= 119891 + 119861[

V120572

V120573]

(22)

[

119894120572

119894120573

] = [1 0 0 0

0 1 0 0]

[[[[[

[

119894120572

119894120573

120596119890

120579119890

]]]]]

]

Δ= ℎ (23)

4 Mathematical Problems in Engineering

Time update (prediction)

Calculate temporary state variables

Calculate temporary covariance matrix

Measurement update (innovation)

Calculate Kalman gain

Update state variables and covariance matrix

Initial

orxn|nminus1 = xnminus1 + (f[xnminus1] + B middot unminus1)Tc

xn|nminus1 = Φnminus1xnminus1 + BTc middot unminus1

Pn|nminus1 = Φnminus1Pnminus1ΦTnminus1 + Qd

Pn|nminus1 Qd R

xn = xn|nminus1 + Kn(yn minus Hxn|nminus1)

Pn = Pn|nminus1 minus KnHPn|nminus1

Kn = Pn|nminus1HT[HPn|nminus1H

T + R]minus1

Figure 2 Demonstration of the EKF operation

where 119909(119905) = [119894120572 119894120573 120596119890 120579119890]119879 119910(119905) = lfloor119894120572 119894120573rfloor and 119906(119905) =

[V120572 V120573]119879 From (8) and (22) the Jacobian and output matri-

ces can be obtained

119865 (119909 (119905)) =120597119891

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

=

[[[[[[[[[

[

minus119903119904

119871 119904

0

120582119891

119871 119904

sin 120579119890120596119890120582119891

119871 119904

cos 120579119890

0 minus119903119904

119871 119904

minus

120582119891

119871 119904

cos 120579119890120596119890120582119891

119871 119904

sin 120579119890

0 0 0 0

0 0 1 0

]]]]]]]]]

]

(24)

119867(119909 (119905)) =120597ℎ

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

= [1 0 0 0

0 1 0 0] (25)

Further substituting (24) into (10) the exponential matrix isshown as follows

Φ(119905119899 119905119899minus1 119909 (119905119899minus1))

cong 119868 + 119865119879119888

=

[[[[[[[[[

[

1 minus119903119904119879119888

119871 119904

0

120582119891119879119888

119871 119904

sin 120579119890120596119890120582119891119879119888

119871 119904

cos 120579119890

0 1 minus119903119904119879119888

119871 119904

minus

120582119891119879119888

119871 119904

cos 120579119890120596119890120582119891119879119888

119871 119904

sin 120579119890

0 0 1 0

0 0 119879119888 1

]]]]]]]]]

]

Δ=

[[[

[

119866 0 12060113 12060114

0 119866 12060123 12060124

0 0 1 0

0 0 119879119888 1

]]]

]

(26)

As the results the EKF algorithm in (14)ndash(19) can be carriedout to estimate the state valueThe initial values of 119876119889119877 and1198750 need to be chosen Through the recursive calculation the

state value of 119909(119899) = [120572(119899) 120573(119899) 119890(119899) 120579119890(119899)]119879 is estimated

at each sampling period then the rotor speed can be derivedby

119903 (119899) =119890 (119899)

119873119875

(27)

Finally a summary for the estimation of rotor FA androtor speed based on EKF is presented as follows

Step 1 Set the initial values of 119876119889 119877 1198750 and 119899 = 1

Step 2 Measure the values of 119894120572(119899) 119894120573(119899) V120572(119899) and V120573(119899)from PMSM system

Step 3 Estimate the temporary state variables from (14) Inaddition refer to (22) and the scalar form of the predictionequation can be expressed as follows

120572 (119899 | 119899 minus 1) = (1 minus 119879119888

119903119904

119871 119904

) 120572 (119899 minus 1)

+

119890 (119899 minus 1) 119879119888120582119891 sin (120579119890 (119899 minus 1))119871 119904

+119879119888V120572 (119899 minus 1)

119871 119904

120573 (119899 | 119899 minus 1) = (1 minus 119879119904

119903119904

119871 119904

) 120573 (119899 minus 1)

minus

119890 (119899 minus 1) 119879119904120582119891 cos (120579119890 (119899 minus 1))119871 119904

+

119879119888V120573 (119899 minus 1)

119871 119904

119890 (119899119899 minus 1) = 119890 (119899 minus 1)

120579119890 (119899119899 minus 1) = 120579119890 (119899 minus 1) + 119890 (119899 minus 1) 119879119888

(28)

Step 4 Calculate the Φ119899minus1 from (26)

Mathematical Problems in Engineering 5

Clk

STSB

RCBRCA

STSA

CHBCHA

SVPWMgeneration

ADC interface

Frequency

Application IP

dividerCK

PWM 1PWM 2PWM 3PWM 4PWM 5PWM 6

ADIN[11]

ADIN[0]BDIN[11]

BDIN[0]

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

Aval

on b

us

Aval

on b

us

FPGA-based sensorless speed control IP

D[31]

D[0]

A[22]

A[0]

Current controllers and coordinate transformation

(CCCT)

Clk

Clk

Clk

Speed controller

(PI controller)

Clk

Clk-step

Clk-step

Clk-step

Clk-step

Clk-step

Rotor flux and rotor speed estimation

based on EKF

Clk

Nios II embedded processor IP

Sram be[3]Sram be[2]Sram be[1]Sram be[0]

Sram oeSram weSram cs

120596lowastr [150]

120596lowastr [150]

r [150]ilowastq [110]

e[110]

120572[110]

120573[110]

i120572[110]

i120573[110]

ia[110]

ib[110]

ic[110]

[110]

[110]

[110]

rx

ry

rz

Figure 3 Internal architecture of a sensorless speed control IP in FPGA

Step 5 Obtain the temporary covariance matrix 119875119899|119899minus1 from(16) Because matrix 119875119899|119899minus1 is symmetric matrix by 119901119894119895 = 119901119895119894it can be chosen by the following form

119875119899|119899minus1 =

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

(29)

Hence from (16) individual elements of 119875119899|119899minus1 could beupdated as follows

11990111 lArr997904 119866211990111 + 21198661206011411990114 + 21198661206011311990113 + 2120601141206011311990134

+ 1206012

1411990144 + 120601

2

1311990133 + 11990211

11990112 lArr997904 119866211990112 + 1198661206011411990124 + 1198661206011311990123

+ 12060123 (11986611990113 + 1206011311990133 + 1206011411990134)

+ 12060124 (11986611990114 + 1206011311990134 + 1206011411990144)

11990113 lArr997904 11986611990113 + 1206011311990133 + 1206011411990134

11990114 lArr997904 (11986611990113 + 1206011311990133 + 1206011411990134) 119879119888

+ (11986611990114 + 1206011311990134 + 1206011411990144)

11990122 lArr997904 2119866 (1206012311990123 + 1206012411990124) + 119866211990122 + 120601

2

2311990133

+ 1206012

2411990144 + 2120601231206012411990134 + 11990222

11990123 lArr997904 11986611990123 + 1206012311990133 + 1206012411990134

11990124 lArr997904 (11986611990123 + 1206012311990133 + 1206012411990134) 119879119888 + 11986611990124

+ 1206012411990144 + 1206012311990134

11990133 lArr997904 11990133 + 11990233

11990134 lArr997904 11987911988811990133 + 11990134

11990144 lArr997904 11990144 + 1198792

11988811990133 + 211987911988811990134 + 11990244

(30)Step 6 Calculate the Kalman gain from (19) Using (25) and(29) the formulation is further simplified as follows Firstly

[119867119875119899|119899minus1119867119879+ 119877]minus1

=

[[[

[

[1 0 0 0

0 1 0 0]

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

[[[

[

1 0

0 1

0 0

0 0

]]]

]

+ [11987711 0

0 11987722]

]]]

]

minus1

= [[11990111 11990112

11990121 11990122] + [

11987711 0

0 11987722]]

minus1

(31)

6 Mathematical Problems in Engineering

cos

sin

Calculate Jacobian matrix and predict state variables Prediction of temporary

Calculation of error Update estimated state

Obtain the temporary covariance

matrix

Update

and calculate

+ +21k

SR2

e(n

e(n)

minus 1)

e(n minus 1)e

120579e

(n minus 1)

e

sin(e(n minus 1))

sin(e(n minus 1))

cos(e(n minus 1)) cos(e(n minus 1))

e(n minus 1)

e(n

e(n)

minus 1)

e

i120573(n minus 1)

e(n minus 1)120582fTc

Lse(n minus 1)120582fTc

Ls

e(n minus 1)120582fTc

Ls

120582fTc

Ls

120582fTc

Ls1 minus TcrsLs

1 minus Tc

Tc

rsLs

i120572(n minus 1)

i120572(n)

i120572(n)

i120573(n

i120573(n)

i120573(n)

120573(n)i120573(n)

|n minus 1)

i120572(n|n minus 1)

i120573(n|n minus 1)

(n|n minus 1)(n

r(n)

|n minus 1)

i120573(n|n minus 1)

i120572(n|n minus 1)

(n|n minus 1)

i120572(n|n minus 1)

TcLs

120572(n minus 1)

TcLs

120573(n minus 1)12060124

12060123

12060113

12060114

minus120582fTc

Ls

s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s11 s12 s13 s68

s69 s70 s71 s120 s122 s123 s124 s125 s126 s127 s128 s129 s130s121

Q11Q22Q33Q44

Pnminus1

Pn|nminus1

Pn|nminus1

Pn

Kn

K11

covariance matrix Pn

i120572(n)i

i

120572(n)

i120572(n)

i120572(n)i120572(n)

i120573(n)

i120573(n)

i120573(n)

Update Pn and calculate Kn

matrix Pn

matrix Kn

R11 R22

k12

k31

k22

k42k32

k41

++

++

+

+

+ + +

+ +

+ +

minus

minus

minus

times

times

times

times

times

times

times

timestimes

timestimes

times

times

times

times

times

times

times

Figure 4 State diagram of FSM for describing the EKF-based algorithm

where 119877 represents the uncertainties of measurement vari-ablewhich are very difficult to knowHence119877 is often chosenas unity matrix for simplifying the task but does not affect theoutcome (31) Since 11987512 = 11987521 (31) can be rewritten in thefollowing form

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1

[11990122 + 1 minus11990112

minus11990112 11990111 + 1]

(32)To normalize the input value and to prevent the numericaloverflow condition which occurred during computation (32)is normalized and those values are all divided by 4Therefore(32) becomes

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

119872

[[[[

[

11990122 + 1

4

minus11990112

4

minus11990112

4

11990111 + 1

4

]]]]

]

Δ= [11990511 11990512

11990521 11990522]

(33)

where 119872 = (1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1)4 Then from (19)

the Kalman gain can be calculated by

119870119899

Δ=

[[[[[

[

11989611

11989621

11989631

11989641

11989612

11989622

11989632

11989642

]]]]]

]

=

[[[[[

[

11990111

11990121

11990131

11990141

11990112

11990122

11990132

11990142

]]]]]

]

[11990511 11990512

11990521 11990522]

=

[[[[[

[

1199011111990511 + 1199011211990521

1199012111990511 + 1199012211990521

1199013111990511 + 1199013211990521

1199014111990511 + 1199014211990521

1199011111990512 + 1199011211990522

1199012111990512 + 1199012211990522

1199013111990512 + 1199013211990522

1199014111990512 + 1199014211990522

]]]]]

]

(34)

Mathematical Problems in Engineering 7

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

++ + + +

+

+

+ +

+

++ +

+ +

+ + +

++ ++Product Sum

SL1

SL1

SL1

SL1

SL1SL1

Predicted estimate covariance

+ + +

+

s35 s36 s37 s38 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s49 s50 s51 s52 s53 s54 s55 s56

s57 s58 s59 s60 s61 s62 s63 s64 s65 s66 s67 s68

s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 s33 s34

12060114

1206011412060114

12060114

12060113

12060123

12060113

12060114

12060113

12060113

12060113

p14

p13

p34

p44

p33

p12p33

p23

p13

p33 p34

p24

p11

G

12060113 12060114

12060123

12060123

12060123

12060123

12060123

12060124

12060124

12060124

12060124

12060124

12060124

12060123

12060124p14

p34 p44

p22 p44

p23

p44

p33

p34

p34

p34

p24

p44

p33

p34

p23

p33

p34

p24

p11p12p13p14p22p23p24p33p34p44

G

G

G

G

G

G

G2

G2

G2

q11

q22

q44

q33

+

+ + +

+

times

times

times

times

times

times times

times

times

timestimes

times

times

times timestimes

times

times

times

times

times

times

times

times

times

times

times

timestimes

times times

times

times

times

times

times

times

times

times

times

timestimes

times

times

t33

t11

t13

t99840012

t99840012

t12

t44

t34

t24t23

t13

t11t12t13t14t22t23t24t33t34t44

t22

t23

t14

Tc

Tc

Tc

2Tc

Tc

Q

Pn|nminus1

Qn|nminus1

Pnminus1

Shift left 1bit

Figure 5 State diagram of FSM for prediction of covariance matrix 119875119899|119899minus1

8 Mathematical Problems in Engineering

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

025

025

025

+ + + +

+

+ AB

+

+

+

+

+

+

ABAB

AB

Divide

Product

Sum

+

+

+

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25

p11

p11

p11

p12

p13

p32

p22

p22

p11

p11

p22

p22p

M

M

M

M22

p12

p12

p12

p12

p13

p14p24

p14p42

p23

p12

t11

t11

t11

t12

t12

t11

t12

t12

t22

t12

t12t22

t22

t22

t11

t12

t12

t12

t22

k11

k21

k12

k22

k42

k41

k31

k32

divide

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

Shift rightSR2SR2

SR2

SR2

SR2

2bits

k11

k12

k21

k22

k31

k32 Pn|nminus1

Matrix Kn

Kn

minus

minusp12

(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

p11

p22

p23

p11

p13

p12

p12

p12

p33

p13

p23p24

p44

p14

p24

p24

p24

p24

p14

p14

p14

p22

p22

p23

p13

p13p23

p12

p34p14

t11

t12

t33

t24

t34

t11

t12

t13

t14

t22

t23

t24

t33

t34

t14

t22

t13

t23

k12

k12

k12

k11

k31

k32

k21

k11

k31k12

k22

k22

k21

k21

k32

k41

k42

k22

k11

k11

times

times

times

times

times

timestimes

times

times

times

times

times

times

times

times

times

times

times

times

timesProduct Sum+times

K

H

n

p11

p44

p12

p13

p14

p22

p23

p24

p33

p34Update covariance

matrix Pn

Pn

Pn|nminus1

(b)

Figure 6 State diagram of FSM for (a) the calculation of matrix 119870119899 and (b) the update of covariance matrix 119875119899

Step 7 Tune the present state variables from (17) and itsscalar form is shown as follows

120572 (119899) = 120572 (119899119899 minus 1) + 11989611 120572 (119899) + 11989612 120573 (119899)

120573 (119899) = 120573 (119899119899 minus 1) + 11989621 120572 (119899) + 11989622 120573 (119899)

119890 (119899) = 119890 (119899119899 minus 1) + 11989631 120572 (119899) + 11989632 120573 (119899)

120579119890 (119899) = 120579119890 (119899 | 119899 minus 1) + 11989641 120572 (119899) + 11989642 120573 (119899)

(35)

where 119896119894119895 is the element in Kalman gain 119870119899 sdot 120572(119899) = 119894120572(119899) minus120572(119899 | 119899 minus 1) and 120573(119899) = 119894120573(119899) minus 120573(119899 | 119899 minus 1)

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 3: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

Mathematical Problems in Engineering 3

SVPWM

PMSM

PI

Inverter

PWM 1

Park Clark

PWM 6

PWM 2PWM 3PWM 4PWM 5

PI

a b c

Current controller

AD

Modify

AD interface

AD

sin cos of flux angle

FPGA

LPF

LPF

Speed controller

PI

Rotor flux and rotor speed

estimation based on EKF

Load

Ac source

Rectifier

Speed command generation

CL

iu

iw

ref1

ref2

ref3

ia

ib

ic

120572

120572

120573

120573

i120572

i120572

i120573

i120573

120572 120573

120572 120573

120572 120573

120572 120573

iq

id

q

d

d q

d q

ilowastq

+

++

minus

minusminusilowastd = 0

120596lowastr

120596r

120596r

sin e

e

cos e

clarkminus1Parkminus1

Nios II processor

CPU

On-chipROM

On-chipRAM

Aval

on b

us

UART

PIO

Timer

SPI

SDRAMcontroller

a b c

Figure 1 Architecture of FPGA-based sensorless PMSM drive system

Step 1 (prediction step) From (4) and using a simple rectan-gular integration

119909119899|119899minus1 = 119909119899minus1 + (119891 [119909119899minus1] + 119861 sdot 119906119899minus1) 119879119888 (14)

or from (12)

119909119899|119899minus1 = Φ119899minus1119909119899minus1 + 119861119879119888 sdot 119906119899minus1 (15)

The covariance is updated by

119875119899|119899minus1 = Φ119899minus1119875119899minus1Φ119879

119899minus1+ 119876119889 (16)

Step 2 (innovation step) Consider

119909119899 = 119909119899|119899minus1 + 119870119899 (119910119899 minus 119867119909119899|119899minus1) (17)

119875119899 = 119875119899|119899minus1 minus 119870119899119867119875119899|119899minus1 (18)

The Kalman gain is calculated by

119870119899 = 119875119899|119899minus1119867119879[119867119875119899|119899minus1119867

119879+ 119877]minus1

(19)

Figure 2 shows the procedure of EKF with two step aboveafter measurement update it will be changed to time update

23 Design of the Sensorless PMSMBased on EKF The circuitequation of PMSM on the d-q rotating coordinate in (1) is re-formulated as

[

V119889

V119902] = [

119903119904 + 119904119871 119904 minus120596119890119871 119904

120596119890119871 119904 119903119904 + 119904119871 119904] [119894119889

119894119902] + [

0

120596119890120582119891] (20)

where 119871 119904Δ= 119871119889 = 119871119902 Transforming (20) the circuit equation

of PMSM on the 120572minus120573 fixed coordinate can be derived by thefollowing equation

[V120572V120573] = [

119903119904 + 119904119871 119904 0

0 119903119904 + 119904119871 119904] [119894120572

119894120573] + 120596119890120582119891 [

minus sin 120579119890cos 120579119890

] (21)

where [V120572 V120573]119879 is voltage on fixed coordinate [119894120572 119894120573]

119879 iscurrent on fixed coordinate 120579119890 is angular position at magnetflux and 119904 is differential operator If we choose the 119909(119905) =[119894120572 119894120573 120596119890 120579119890]

119879as the state variable of the PMSMmathematicalmodel then (21) can be expanded to the following formula-tion

119889

119889119905

[[[[[

[

119894120572

119894120573

120596119890

120579119890

]]]]]

]

=

[[[[[[[[[

[

minus119903119904119894120572

119871 119904

+

120596119890120582119891

119871 119904

sin 120579119890

minus

119903119904119894120573

119871 119904

minus

120596119890120582119891

119871 119904

cos 120579119890

0

120596119890

]]]]]]]]]

]

+

[[[[[[[[

[

1

119871 119904

0

01

119871 119904

0 0

0 0

]]]]]]]]

]

[

V120572

V120573]Δ= 119891 + 119861[

V120572

V120573]

(22)

[

119894120572

119894120573

] = [1 0 0 0

0 1 0 0]

[[[[[

[

119894120572

119894120573

120596119890

120579119890

]]]]]

]

Δ= ℎ (23)

4 Mathematical Problems in Engineering

Time update (prediction)

Calculate temporary state variables

Calculate temporary covariance matrix

Measurement update (innovation)

Calculate Kalman gain

Update state variables and covariance matrix

Initial

orxn|nminus1 = xnminus1 + (f[xnminus1] + B middot unminus1)Tc

xn|nminus1 = Φnminus1xnminus1 + BTc middot unminus1

Pn|nminus1 = Φnminus1Pnminus1ΦTnminus1 + Qd

Pn|nminus1 Qd R

xn = xn|nminus1 + Kn(yn minus Hxn|nminus1)

Pn = Pn|nminus1 minus KnHPn|nminus1

Kn = Pn|nminus1HT[HPn|nminus1H

T + R]minus1

Figure 2 Demonstration of the EKF operation

where 119909(119905) = [119894120572 119894120573 120596119890 120579119890]119879 119910(119905) = lfloor119894120572 119894120573rfloor and 119906(119905) =

[V120572 V120573]119879 From (8) and (22) the Jacobian and output matri-

ces can be obtained

119865 (119909 (119905)) =120597119891

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

=

[[[[[[[[[

[

minus119903119904

119871 119904

0

120582119891

119871 119904

sin 120579119890120596119890120582119891

119871 119904

cos 120579119890

0 minus119903119904

119871 119904

minus

120582119891

119871 119904

cos 120579119890120596119890120582119891

119871 119904

sin 120579119890

0 0 0 0

0 0 1 0

]]]]]]]]]

]

(24)

119867(119909 (119905)) =120597ℎ

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

= [1 0 0 0

0 1 0 0] (25)

Further substituting (24) into (10) the exponential matrix isshown as follows

Φ(119905119899 119905119899minus1 119909 (119905119899minus1))

cong 119868 + 119865119879119888

=

[[[[[[[[[

[

1 minus119903119904119879119888

119871 119904

0

120582119891119879119888

119871 119904

sin 120579119890120596119890120582119891119879119888

119871 119904

cos 120579119890

0 1 minus119903119904119879119888

119871 119904

minus

120582119891119879119888

119871 119904

cos 120579119890120596119890120582119891119879119888

119871 119904

sin 120579119890

0 0 1 0

0 0 119879119888 1

]]]]]]]]]

]

Δ=

[[[

[

119866 0 12060113 12060114

0 119866 12060123 12060124

0 0 1 0

0 0 119879119888 1

]]]

]

(26)

As the results the EKF algorithm in (14)ndash(19) can be carriedout to estimate the state valueThe initial values of 119876119889119877 and1198750 need to be chosen Through the recursive calculation the

state value of 119909(119899) = [120572(119899) 120573(119899) 119890(119899) 120579119890(119899)]119879 is estimated

at each sampling period then the rotor speed can be derivedby

119903 (119899) =119890 (119899)

119873119875

(27)

Finally a summary for the estimation of rotor FA androtor speed based on EKF is presented as follows

Step 1 Set the initial values of 119876119889 119877 1198750 and 119899 = 1

Step 2 Measure the values of 119894120572(119899) 119894120573(119899) V120572(119899) and V120573(119899)from PMSM system

Step 3 Estimate the temporary state variables from (14) Inaddition refer to (22) and the scalar form of the predictionequation can be expressed as follows

120572 (119899 | 119899 minus 1) = (1 minus 119879119888

119903119904

119871 119904

) 120572 (119899 minus 1)

+

119890 (119899 minus 1) 119879119888120582119891 sin (120579119890 (119899 minus 1))119871 119904

+119879119888V120572 (119899 minus 1)

119871 119904

120573 (119899 | 119899 minus 1) = (1 minus 119879119904

119903119904

119871 119904

) 120573 (119899 minus 1)

minus

119890 (119899 minus 1) 119879119904120582119891 cos (120579119890 (119899 minus 1))119871 119904

+

119879119888V120573 (119899 minus 1)

119871 119904

119890 (119899119899 minus 1) = 119890 (119899 minus 1)

120579119890 (119899119899 minus 1) = 120579119890 (119899 minus 1) + 119890 (119899 minus 1) 119879119888

(28)

Step 4 Calculate the Φ119899minus1 from (26)

Mathematical Problems in Engineering 5

Clk

STSB

RCBRCA

STSA

CHBCHA

SVPWMgeneration

ADC interface

Frequency

Application IP

dividerCK

PWM 1PWM 2PWM 3PWM 4PWM 5PWM 6

ADIN[11]

ADIN[0]BDIN[11]

BDIN[0]

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

Aval

on b

us

Aval

on b

us

FPGA-based sensorless speed control IP

D[31]

D[0]

A[22]

A[0]

Current controllers and coordinate transformation

(CCCT)

Clk

Clk

Clk

Speed controller

(PI controller)

Clk

Clk-step

Clk-step

Clk-step

Clk-step

Clk-step

Rotor flux and rotor speed estimation

based on EKF

Clk

Nios II embedded processor IP

Sram be[3]Sram be[2]Sram be[1]Sram be[0]

Sram oeSram weSram cs

120596lowastr [150]

120596lowastr [150]

r [150]ilowastq [110]

e[110]

120572[110]

120573[110]

i120572[110]

i120573[110]

ia[110]

ib[110]

ic[110]

[110]

[110]

[110]

rx

ry

rz

Figure 3 Internal architecture of a sensorless speed control IP in FPGA

Step 5 Obtain the temporary covariance matrix 119875119899|119899minus1 from(16) Because matrix 119875119899|119899minus1 is symmetric matrix by 119901119894119895 = 119901119895119894it can be chosen by the following form

119875119899|119899minus1 =

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

(29)

Hence from (16) individual elements of 119875119899|119899minus1 could beupdated as follows

11990111 lArr997904 119866211990111 + 21198661206011411990114 + 21198661206011311990113 + 2120601141206011311990134

+ 1206012

1411990144 + 120601

2

1311990133 + 11990211

11990112 lArr997904 119866211990112 + 1198661206011411990124 + 1198661206011311990123

+ 12060123 (11986611990113 + 1206011311990133 + 1206011411990134)

+ 12060124 (11986611990114 + 1206011311990134 + 1206011411990144)

11990113 lArr997904 11986611990113 + 1206011311990133 + 1206011411990134

11990114 lArr997904 (11986611990113 + 1206011311990133 + 1206011411990134) 119879119888

+ (11986611990114 + 1206011311990134 + 1206011411990144)

11990122 lArr997904 2119866 (1206012311990123 + 1206012411990124) + 119866211990122 + 120601

2

2311990133

+ 1206012

2411990144 + 2120601231206012411990134 + 11990222

11990123 lArr997904 11986611990123 + 1206012311990133 + 1206012411990134

11990124 lArr997904 (11986611990123 + 1206012311990133 + 1206012411990134) 119879119888 + 11986611990124

+ 1206012411990144 + 1206012311990134

11990133 lArr997904 11990133 + 11990233

11990134 lArr997904 11987911988811990133 + 11990134

11990144 lArr997904 11990144 + 1198792

11988811990133 + 211987911988811990134 + 11990244

(30)Step 6 Calculate the Kalman gain from (19) Using (25) and(29) the formulation is further simplified as follows Firstly

[119867119875119899|119899minus1119867119879+ 119877]minus1

=

[[[

[

[1 0 0 0

0 1 0 0]

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

[[[

[

1 0

0 1

0 0

0 0

]]]

]

+ [11987711 0

0 11987722]

]]]

]

minus1

= [[11990111 11990112

11990121 11990122] + [

11987711 0

0 11987722]]

minus1

(31)

6 Mathematical Problems in Engineering

cos

sin

Calculate Jacobian matrix and predict state variables Prediction of temporary

Calculation of error Update estimated state

Obtain the temporary covariance

matrix

Update

and calculate

+ +21k

SR2

e(n

e(n)

minus 1)

e(n minus 1)e

120579e

(n minus 1)

e

sin(e(n minus 1))

sin(e(n minus 1))

cos(e(n minus 1)) cos(e(n minus 1))

e(n minus 1)

e(n

e(n)

minus 1)

e

i120573(n minus 1)

e(n minus 1)120582fTc

Lse(n minus 1)120582fTc

Ls

e(n minus 1)120582fTc

Ls

120582fTc

Ls

120582fTc

Ls1 minus TcrsLs

1 minus Tc

Tc

rsLs

i120572(n minus 1)

i120572(n)

i120572(n)

i120573(n

i120573(n)

i120573(n)

120573(n)i120573(n)

|n minus 1)

i120572(n|n minus 1)

i120573(n|n minus 1)

(n|n minus 1)(n

r(n)

|n minus 1)

i120573(n|n minus 1)

i120572(n|n minus 1)

(n|n minus 1)

i120572(n|n minus 1)

TcLs

120572(n minus 1)

TcLs

120573(n minus 1)12060124

12060123

12060113

12060114

minus120582fTc

Ls

s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s11 s12 s13 s68

s69 s70 s71 s120 s122 s123 s124 s125 s126 s127 s128 s129 s130s121

Q11Q22Q33Q44

Pnminus1

Pn|nminus1

Pn|nminus1

Pn

Kn

K11

covariance matrix Pn

i120572(n)i

i

120572(n)

i120572(n)

i120572(n)i120572(n)

i120573(n)

i120573(n)

i120573(n)

Update Pn and calculate Kn

matrix Pn

matrix Kn

R11 R22

k12

k31

k22

k42k32

k41

++

++

+

+

+ + +

+ +

+ +

minus

minus

minus

times

times

times

times

times

times

times

timestimes

timestimes

times

times

times

times

times

times

times

Figure 4 State diagram of FSM for describing the EKF-based algorithm

where 119877 represents the uncertainties of measurement vari-ablewhich are very difficult to knowHence119877 is often chosenas unity matrix for simplifying the task but does not affect theoutcome (31) Since 11987512 = 11987521 (31) can be rewritten in thefollowing form

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1

[11990122 + 1 minus11990112

minus11990112 11990111 + 1]

(32)To normalize the input value and to prevent the numericaloverflow condition which occurred during computation (32)is normalized and those values are all divided by 4Therefore(32) becomes

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

119872

[[[[

[

11990122 + 1

4

minus11990112

4

minus11990112

4

11990111 + 1

4

]]]]

]

Δ= [11990511 11990512

11990521 11990522]

(33)

where 119872 = (1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1)4 Then from (19)

the Kalman gain can be calculated by

119870119899

Δ=

[[[[[

[

11989611

11989621

11989631

11989641

11989612

11989622

11989632

11989642

]]]]]

]

=

[[[[[

[

11990111

11990121

11990131

11990141

11990112

11990122

11990132

11990142

]]]]]

]

[11990511 11990512

11990521 11990522]

=

[[[[[

[

1199011111990511 + 1199011211990521

1199012111990511 + 1199012211990521

1199013111990511 + 1199013211990521

1199014111990511 + 1199014211990521

1199011111990512 + 1199011211990522

1199012111990512 + 1199012211990522

1199013111990512 + 1199013211990522

1199014111990512 + 1199014211990522

]]]]]

]

(34)

Mathematical Problems in Engineering 7

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

++ + + +

+

+

+ +

+

++ +

+ +

+ + +

++ ++Product Sum

SL1

SL1

SL1

SL1

SL1SL1

Predicted estimate covariance

+ + +

+

s35 s36 s37 s38 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s49 s50 s51 s52 s53 s54 s55 s56

s57 s58 s59 s60 s61 s62 s63 s64 s65 s66 s67 s68

s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 s33 s34

12060114

1206011412060114

12060114

12060113

12060123

12060113

12060114

12060113

12060113

12060113

p14

p13

p34

p44

p33

p12p33

p23

p13

p33 p34

p24

p11

G

12060113 12060114

12060123

12060123

12060123

12060123

12060123

12060124

12060124

12060124

12060124

12060124

12060124

12060123

12060124p14

p34 p44

p22 p44

p23

p44

p33

p34

p34

p34

p24

p44

p33

p34

p23

p33

p34

p24

p11p12p13p14p22p23p24p33p34p44

G

G

G

G

G

G

G2

G2

G2

q11

q22

q44

q33

+

+ + +

+

times

times

times

times

times

times times

times

times

timestimes

times

times

times timestimes

times

times

times

times

times

times

times

times

times

times

times

timestimes

times times

times

times

times

times

times

times

times

times

times

timestimes

times

times

t33

t11

t13

t99840012

t99840012

t12

t44

t34

t24t23

t13

t11t12t13t14t22t23t24t33t34t44

t22

t23

t14

Tc

Tc

Tc

2Tc

Tc

Q

Pn|nminus1

Qn|nminus1

Pnminus1

Shift left 1bit

Figure 5 State diagram of FSM for prediction of covariance matrix 119875119899|119899minus1

8 Mathematical Problems in Engineering

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

025

025

025

+ + + +

+

+ AB

+

+

+

+

+

+

ABAB

AB

Divide

Product

Sum

+

+

+

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25

p11

p11

p11

p12

p13

p32

p22

p22

p11

p11

p22

p22p

M

M

M

M22

p12

p12

p12

p12

p13

p14p24

p14p42

p23

p12

t11

t11

t11

t12

t12

t11

t12

t12

t22

t12

t12t22

t22

t22

t11

t12

t12

t12

t22

k11

k21

k12

k22

k42

k41

k31

k32

divide

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

Shift rightSR2SR2

SR2

SR2

SR2

2bits

k11

k12

k21

k22

k31

k32 Pn|nminus1

Matrix Kn

Kn

minus

minusp12

(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

p11

p22

p23

p11

p13

p12

p12

p12

p33

p13

p23p24

p44

p14

p24

p24

p24

p24

p14

p14

p14

p22

p22

p23

p13

p13p23

p12

p34p14

t11

t12

t33

t24

t34

t11

t12

t13

t14

t22

t23

t24

t33

t34

t14

t22

t13

t23

k12

k12

k12

k11

k31

k32

k21

k11

k31k12

k22

k22

k21

k21

k32

k41

k42

k22

k11

k11

times

times

times

times

times

timestimes

times

times

times

times

times

times

times

times

times

times

times

times

timesProduct Sum+times

K

H

n

p11

p44

p12

p13

p14

p22

p23

p24

p33

p34Update covariance

matrix Pn

Pn

Pn|nminus1

(b)

Figure 6 State diagram of FSM for (a) the calculation of matrix 119870119899 and (b) the update of covariance matrix 119875119899

Step 7 Tune the present state variables from (17) and itsscalar form is shown as follows

120572 (119899) = 120572 (119899119899 minus 1) + 11989611 120572 (119899) + 11989612 120573 (119899)

120573 (119899) = 120573 (119899119899 minus 1) + 11989621 120572 (119899) + 11989622 120573 (119899)

119890 (119899) = 119890 (119899119899 minus 1) + 11989631 120572 (119899) + 11989632 120573 (119899)

120579119890 (119899) = 120579119890 (119899 | 119899 minus 1) + 11989641 120572 (119899) + 11989642 120573 (119899)

(35)

where 119896119894119895 is the element in Kalman gain 119870119899 sdot 120572(119899) = 119894120572(119899) minus120572(119899 | 119899 minus 1) and 120573(119899) = 119894120573(119899) minus 120573(119899 | 119899 minus 1)

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 4: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

4 Mathematical Problems in Engineering

Time update (prediction)

Calculate temporary state variables

Calculate temporary covariance matrix

Measurement update (innovation)

Calculate Kalman gain

Update state variables and covariance matrix

Initial

orxn|nminus1 = xnminus1 + (f[xnminus1] + B middot unminus1)Tc

xn|nminus1 = Φnminus1xnminus1 + BTc middot unminus1

Pn|nminus1 = Φnminus1Pnminus1ΦTnminus1 + Qd

Pn|nminus1 Qd R

xn = xn|nminus1 + Kn(yn minus Hxn|nminus1)

Pn = Pn|nminus1 minus KnHPn|nminus1

Kn = Pn|nminus1HT[HPn|nminus1H

T + R]minus1

Figure 2 Demonstration of the EKF operation

where 119909(119905) = [119894120572 119894120573 120596119890 120579119890]119879 119910(119905) = lfloor119894120572 119894120573rfloor and 119906(119905) =

[V120572 V120573]119879 From (8) and (22) the Jacobian and output matri-

ces can be obtained

119865 (119909 (119905)) =120597119891

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

=

[[[[[[[[[

[

minus119903119904

119871 119904

0

120582119891

119871 119904

sin 120579119890120596119890120582119891

119871 119904

cos 120579119890

0 minus119903119904

119871 119904

minus

120582119891

119871 119904

cos 120579119890120596119890120582119891

119871 119904

sin 120579119890

0 0 0 0

0 0 1 0

]]]]]]]]]

]

(24)

119867(119909 (119905)) =120597ℎ

120597119909

10038161003816100381610038161003816100381610038161003816119909=119909(119905)

= [1 0 0 0

0 1 0 0] (25)

Further substituting (24) into (10) the exponential matrix isshown as follows

Φ(119905119899 119905119899minus1 119909 (119905119899minus1))

cong 119868 + 119865119879119888

=

[[[[[[[[[

[

1 minus119903119904119879119888

119871 119904

0

120582119891119879119888

119871 119904

sin 120579119890120596119890120582119891119879119888

119871 119904

cos 120579119890

0 1 minus119903119904119879119888

119871 119904

minus

120582119891119879119888

119871 119904

cos 120579119890120596119890120582119891119879119888

119871 119904

sin 120579119890

0 0 1 0

0 0 119879119888 1

]]]]]]]]]

]

Δ=

[[[

[

119866 0 12060113 12060114

0 119866 12060123 12060124

0 0 1 0

0 0 119879119888 1

]]]

]

(26)

As the results the EKF algorithm in (14)ndash(19) can be carriedout to estimate the state valueThe initial values of 119876119889119877 and1198750 need to be chosen Through the recursive calculation the

state value of 119909(119899) = [120572(119899) 120573(119899) 119890(119899) 120579119890(119899)]119879 is estimated

at each sampling period then the rotor speed can be derivedby

119903 (119899) =119890 (119899)

119873119875

(27)

Finally a summary for the estimation of rotor FA androtor speed based on EKF is presented as follows

Step 1 Set the initial values of 119876119889 119877 1198750 and 119899 = 1

Step 2 Measure the values of 119894120572(119899) 119894120573(119899) V120572(119899) and V120573(119899)from PMSM system

Step 3 Estimate the temporary state variables from (14) Inaddition refer to (22) and the scalar form of the predictionequation can be expressed as follows

120572 (119899 | 119899 minus 1) = (1 minus 119879119888

119903119904

119871 119904

) 120572 (119899 minus 1)

+

119890 (119899 minus 1) 119879119888120582119891 sin (120579119890 (119899 minus 1))119871 119904

+119879119888V120572 (119899 minus 1)

119871 119904

120573 (119899 | 119899 minus 1) = (1 minus 119879119904

119903119904

119871 119904

) 120573 (119899 minus 1)

minus

119890 (119899 minus 1) 119879119904120582119891 cos (120579119890 (119899 minus 1))119871 119904

+

119879119888V120573 (119899 minus 1)

119871 119904

119890 (119899119899 minus 1) = 119890 (119899 minus 1)

120579119890 (119899119899 minus 1) = 120579119890 (119899 minus 1) + 119890 (119899 minus 1) 119879119888

(28)

Step 4 Calculate the Φ119899minus1 from (26)

Mathematical Problems in Engineering 5

Clk

STSB

RCBRCA

STSA

CHBCHA

SVPWMgeneration

ADC interface

Frequency

Application IP

dividerCK

PWM 1PWM 2PWM 3PWM 4PWM 5PWM 6

ADIN[11]

ADIN[0]BDIN[11]

BDIN[0]

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

Aval

on b

us

Aval

on b

us

FPGA-based sensorless speed control IP

D[31]

D[0]

A[22]

A[0]

Current controllers and coordinate transformation

(CCCT)

Clk

Clk

Clk

Speed controller

(PI controller)

Clk

Clk-step

Clk-step

Clk-step

Clk-step

Clk-step

Rotor flux and rotor speed estimation

based on EKF

Clk

Nios II embedded processor IP

Sram be[3]Sram be[2]Sram be[1]Sram be[0]

Sram oeSram weSram cs

120596lowastr [150]

120596lowastr [150]

r [150]ilowastq [110]

e[110]

120572[110]

120573[110]

i120572[110]

i120573[110]

ia[110]

ib[110]

ic[110]

[110]

[110]

[110]

rx

ry

rz

Figure 3 Internal architecture of a sensorless speed control IP in FPGA

Step 5 Obtain the temporary covariance matrix 119875119899|119899minus1 from(16) Because matrix 119875119899|119899minus1 is symmetric matrix by 119901119894119895 = 119901119895119894it can be chosen by the following form

119875119899|119899minus1 =

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

(29)

Hence from (16) individual elements of 119875119899|119899minus1 could beupdated as follows

11990111 lArr997904 119866211990111 + 21198661206011411990114 + 21198661206011311990113 + 2120601141206011311990134

+ 1206012

1411990144 + 120601

2

1311990133 + 11990211

11990112 lArr997904 119866211990112 + 1198661206011411990124 + 1198661206011311990123

+ 12060123 (11986611990113 + 1206011311990133 + 1206011411990134)

+ 12060124 (11986611990114 + 1206011311990134 + 1206011411990144)

11990113 lArr997904 11986611990113 + 1206011311990133 + 1206011411990134

11990114 lArr997904 (11986611990113 + 1206011311990133 + 1206011411990134) 119879119888

+ (11986611990114 + 1206011311990134 + 1206011411990144)

11990122 lArr997904 2119866 (1206012311990123 + 1206012411990124) + 119866211990122 + 120601

2

2311990133

+ 1206012

2411990144 + 2120601231206012411990134 + 11990222

11990123 lArr997904 11986611990123 + 1206012311990133 + 1206012411990134

11990124 lArr997904 (11986611990123 + 1206012311990133 + 1206012411990134) 119879119888 + 11986611990124

+ 1206012411990144 + 1206012311990134

11990133 lArr997904 11990133 + 11990233

11990134 lArr997904 11987911988811990133 + 11990134

11990144 lArr997904 11990144 + 1198792

11988811990133 + 211987911988811990134 + 11990244

(30)Step 6 Calculate the Kalman gain from (19) Using (25) and(29) the formulation is further simplified as follows Firstly

[119867119875119899|119899minus1119867119879+ 119877]minus1

=

[[[

[

[1 0 0 0

0 1 0 0]

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

[[[

[

1 0

0 1

0 0

0 0

]]]

]

+ [11987711 0

0 11987722]

]]]

]

minus1

= [[11990111 11990112

11990121 11990122] + [

11987711 0

0 11987722]]

minus1

(31)

6 Mathematical Problems in Engineering

cos

sin

Calculate Jacobian matrix and predict state variables Prediction of temporary

Calculation of error Update estimated state

Obtain the temporary covariance

matrix

Update

and calculate

+ +21k

SR2

e(n

e(n)

minus 1)

e(n minus 1)e

120579e

(n minus 1)

e

sin(e(n minus 1))

sin(e(n minus 1))

cos(e(n minus 1)) cos(e(n minus 1))

e(n minus 1)

e(n

e(n)

minus 1)

e

i120573(n minus 1)

e(n minus 1)120582fTc

Lse(n minus 1)120582fTc

Ls

e(n minus 1)120582fTc

Ls

120582fTc

Ls

120582fTc

Ls1 minus TcrsLs

1 minus Tc

Tc

rsLs

i120572(n minus 1)

i120572(n)

i120572(n)

i120573(n

i120573(n)

i120573(n)

120573(n)i120573(n)

|n minus 1)

i120572(n|n minus 1)

i120573(n|n minus 1)

(n|n minus 1)(n

r(n)

|n minus 1)

i120573(n|n minus 1)

i120572(n|n minus 1)

(n|n minus 1)

i120572(n|n minus 1)

TcLs

120572(n minus 1)

TcLs

120573(n minus 1)12060124

12060123

12060113

12060114

minus120582fTc

Ls

s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s11 s12 s13 s68

s69 s70 s71 s120 s122 s123 s124 s125 s126 s127 s128 s129 s130s121

Q11Q22Q33Q44

Pnminus1

Pn|nminus1

Pn|nminus1

Pn

Kn

K11

covariance matrix Pn

i120572(n)i

i

120572(n)

i120572(n)

i120572(n)i120572(n)

i120573(n)

i120573(n)

i120573(n)

Update Pn and calculate Kn

matrix Pn

matrix Kn

R11 R22

k12

k31

k22

k42k32

k41

++

++

+

+

+ + +

+ +

+ +

minus

minus

minus

times

times

times

times

times

times

times

timestimes

timestimes

times

times

times

times

times

times

times

Figure 4 State diagram of FSM for describing the EKF-based algorithm

where 119877 represents the uncertainties of measurement vari-ablewhich are very difficult to knowHence119877 is often chosenas unity matrix for simplifying the task but does not affect theoutcome (31) Since 11987512 = 11987521 (31) can be rewritten in thefollowing form

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1

[11990122 + 1 minus11990112

minus11990112 11990111 + 1]

(32)To normalize the input value and to prevent the numericaloverflow condition which occurred during computation (32)is normalized and those values are all divided by 4Therefore(32) becomes

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

119872

[[[[

[

11990122 + 1

4

minus11990112

4

minus11990112

4

11990111 + 1

4

]]]]

]

Δ= [11990511 11990512

11990521 11990522]

(33)

where 119872 = (1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1)4 Then from (19)

the Kalman gain can be calculated by

119870119899

Δ=

[[[[[

[

11989611

11989621

11989631

11989641

11989612

11989622

11989632

11989642

]]]]]

]

=

[[[[[

[

11990111

11990121

11990131

11990141

11990112

11990122

11990132

11990142

]]]]]

]

[11990511 11990512

11990521 11990522]

=

[[[[[

[

1199011111990511 + 1199011211990521

1199012111990511 + 1199012211990521

1199013111990511 + 1199013211990521

1199014111990511 + 1199014211990521

1199011111990512 + 1199011211990522

1199012111990512 + 1199012211990522

1199013111990512 + 1199013211990522

1199014111990512 + 1199014211990522

]]]]]

]

(34)

Mathematical Problems in Engineering 7

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

++ + + +

+

+

+ +

+

++ +

+ +

+ + +

++ ++Product Sum

SL1

SL1

SL1

SL1

SL1SL1

Predicted estimate covariance

+ + +

+

s35 s36 s37 s38 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s49 s50 s51 s52 s53 s54 s55 s56

s57 s58 s59 s60 s61 s62 s63 s64 s65 s66 s67 s68

s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 s33 s34

12060114

1206011412060114

12060114

12060113

12060123

12060113

12060114

12060113

12060113

12060113

p14

p13

p34

p44

p33

p12p33

p23

p13

p33 p34

p24

p11

G

12060113 12060114

12060123

12060123

12060123

12060123

12060123

12060124

12060124

12060124

12060124

12060124

12060124

12060123

12060124p14

p34 p44

p22 p44

p23

p44

p33

p34

p34

p34

p24

p44

p33

p34

p23

p33

p34

p24

p11p12p13p14p22p23p24p33p34p44

G

G

G

G

G

G

G2

G2

G2

q11

q22

q44

q33

+

+ + +

+

times

times

times

times

times

times times

times

times

timestimes

times

times

times timestimes

times

times

times

times

times

times

times

times

times

times

times

timestimes

times times

times

times

times

times

times

times

times

times

times

timestimes

times

times

t33

t11

t13

t99840012

t99840012

t12

t44

t34

t24t23

t13

t11t12t13t14t22t23t24t33t34t44

t22

t23

t14

Tc

Tc

Tc

2Tc

Tc

Q

Pn|nminus1

Qn|nminus1

Pnminus1

Shift left 1bit

Figure 5 State diagram of FSM for prediction of covariance matrix 119875119899|119899minus1

8 Mathematical Problems in Engineering

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

025

025

025

+ + + +

+

+ AB

+

+

+

+

+

+

ABAB

AB

Divide

Product

Sum

+

+

+

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25

p11

p11

p11

p12

p13

p32

p22

p22

p11

p11

p22

p22p

M

M

M

M22

p12

p12

p12

p12

p13

p14p24

p14p42

p23

p12

t11

t11

t11

t12

t12

t11

t12

t12

t22

t12

t12t22

t22

t22

t11

t12

t12

t12

t22

k11

k21

k12

k22

k42

k41

k31

k32

divide

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

Shift rightSR2SR2

SR2

SR2

SR2

2bits

k11

k12

k21

k22

k31

k32 Pn|nminus1

Matrix Kn

Kn

minus

minusp12

(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

p11

p22

p23

p11

p13

p12

p12

p12

p33

p13

p23p24

p44

p14

p24

p24

p24

p24

p14

p14

p14

p22

p22

p23

p13

p13p23

p12

p34p14

t11

t12

t33

t24

t34

t11

t12

t13

t14

t22

t23

t24

t33

t34

t14

t22

t13

t23

k12

k12

k12

k11

k31

k32

k21

k11

k31k12

k22

k22

k21

k21

k32

k41

k42

k22

k11

k11

times

times

times

times

times

timestimes

times

times

times

times

times

times

times

times

times

times

times

times

timesProduct Sum+times

K

H

n

p11

p44

p12

p13

p14

p22

p23

p24

p33

p34Update covariance

matrix Pn

Pn

Pn|nminus1

(b)

Figure 6 State diagram of FSM for (a) the calculation of matrix 119870119899 and (b) the update of covariance matrix 119875119899

Step 7 Tune the present state variables from (17) and itsscalar form is shown as follows

120572 (119899) = 120572 (119899119899 minus 1) + 11989611 120572 (119899) + 11989612 120573 (119899)

120573 (119899) = 120573 (119899119899 minus 1) + 11989621 120572 (119899) + 11989622 120573 (119899)

119890 (119899) = 119890 (119899119899 minus 1) + 11989631 120572 (119899) + 11989632 120573 (119899)

120579119890 (119899) = 120579119890 (119899 | 119899 minus 1) + 11989641 120572 (119899) + 11989642 120573 (119899)

(35)

where 119896119894119895 is the element in Kalman gain 119870119899 sdot 120572(119899) = 119894120572(119899) minus120572(119899 | 119899 minus 1) and 120573(119899) = 119894120573(119899) minus 120573(119899 | 119899 minus 1)

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 5: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

Mathematical Problems in Engineering 5

Clk

STSB

RCBRCA

STSA

CHBCHA

SVPWMgeneration

ADC interface

Frequency

Application IP

dividerCK

PWM 1PWM 2PWM 3PWM 4PWM 5PWM 6

ADIN[11]

ADIN[0]BDIN[11]

BDIN[0]

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

Aval

on b

us

Aval

on b

us

FPGA-based sensorless speed control IP

D[31]

D[0]

A[22]

A[0]

Current controllers and coordinate transformation

(CCCT)

Clk

Clk

Clk

Speed controller

(PI controller)

Clk

Clk-step

Clk-step

Clk-step

Clk-step

Clk-step

Rotor flux and rotor speed estimation

based on EKF

Clk

Nios II embedded processor IP

Sram be[3]Sram be[2]Sram be[1]Sram be[0]

Sram oeSram weSram cs

120596lowastr [150]

120596lowastr [150]

r [150]ilowastq [110]

e[110]

120572[110]

120573[110]

i120572[110]

i120573[110]

ia[110]

ib[110]

ic[110]

[110]

[110]

[110]

rx

ry

rz

Figure 3 Internal architecture of a sensorless speed control IP in FPGA

Step 5 Obtain the temporary covariance matrix 119875119899|119899minus1 from(16) Because matrix 119875119899|119899minus1 is symmetric matrix by 119901119894119895 = 119901119895119894it can be chosen by the following form

119875119899|119899minus1 =

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

(29)

Hence from (16) individual elements of 119875119899|119899minus1 could beupdated as follows

11990111 lArr997904 119866211990111 + 21198661206011411990114 + 21198661206011311990113 + 2120601141206011311990134

+ 1206012

1411990144 + 120601

2

1311990133 + 11990211

11990112 lArr997904 119866211990112 + 1198661206011411990124 + 1198661206011311990123

+ 12060123 (11986611990113 + 1206011311990133 + 1206011411990134)

+ 12060124 (11986611990114 + 1206011311990134 + 1206011411990144)

11990113 lArr997904 11986611990113 + 1206011311990133 + 1206011411990134

11990114 lArr997904 (11986611990113 + 1206011311990133 + 1206011411990134) 119879119888

+ (11986611990114 + 1206011311990134 + 1206011411990144)

11990122 lArr997904 2119866 (1206012311990123 + 1206012411990124) + 119866211990122 + 120601

2

2311990133

+ 1206012

2411990144 + 2120601231206012411990134 + 11990222

11990123 lArr997904 11986611990123 + 1206012311990133 + 1206012411990134

11990124 lArr997904 (11986611990123 + 1206012311990133 + 1206012411990134) 119879119888 + 11986611990124

+ 1206012411990144 + 1206012311990134

11990133 lArr997904 11990133 + 11990233

11990134 lArr997904 11987911988811990133 + 11990134

11990144 lArr997904 11990144 + 1198792

11988811990133 + 211987911988811990134 + 11990244

(30)Step 6 Calculate the Kalman gain from (19) Using (25) and(29) the formulation is further simplified as follows Firstly

[119867119875119899|119899minus1119867119879+ 119877]minus1

=

[[[

[

[1 0 0 0

0 1 0 0]

[[[

[

11990111 11990112 11990113 11990114

11990121 11990122 11990123 11990124

11990131 11990132 11990133 11990134

11990141 11990142 11990143 11990144

]]]

]

[[[

[

1 0

0 1

0 0

0 0

]]]

]

+ [11987711 0

0 11987722]

]]]

]

minus1

= [[11990111 11990112

11990121 11990122] + [

11987711 0

0 11987722]]

minus1

(31)

6 Mathematical Problems in Engineering

cos

sin

Calculate Jacobian matrix and predict state variables Prediction of temporary

Calculation of error Update estimated state

Obtain the temporary covariance

matrix

Update

and calculate

+ +21k

SR2

e(n

e(n)

minus 1)

e(n minus 1)e

120579e

(n minus 1)

e

sin(e(n minus 1))

sin(e(n minus 1))

cos(e(n minus 1)) cos(e(n minus 1))

e(n minus 1)

e(n

e(n)

minus 1)

e

i120573(n minus 1)

e(n minus 1)120582fTc

Lse(n minus 1)120582fTc

Ls

e(n minus 1)120582fTc

Ls

120582fTc

Ls

120582fTc

Ls1 minus TcrsLs

1 minus Tc

Tc

rsLs

i120572(n minus 1)

i120572(n)

i120572(n)

i120573(n

i120573(n)

i120573(n)

120573(n)i120573(n)

|n minus 1)

i120572(n|n minus 1)

i120573(n|n minus 1)

(n|n minus 1)(n

r(n)

|n minus 1)

i120573(n|n minus 1)

i120572(n|n minus 1)

(n|n minus 1)

i120572(n|n minus 1)

TcLs

120572(n minus 1)

TcLs

120573(n minus 1)12060124

12060123

12060113

12060114

minus120582fTc

Ls

s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s11 s12 s13 s68

s69 s70 s71 s120 s122 s123 s124 s125 s126 s127 s128 s129 s130s121

Q11Q22Q33Q44

Pnminus1

Pn|nminus1

Pn|nminus1

Pn

Kn

K11

covariance matrix Pn

i120572(n)i

i

120572(n)

i120572(n)

i120572(n)i120572(n)

i120573(n)

i120573(n)

i120573(n)

Update Pn and calculate Kn

matrix Pn

matrix Kn

R11 R22

k12

k31

k22

k42k32

k41

++

++

+

+

+ + +

+ +

+ +

minus

minus

minus

times

times

times

times

times

times

times

timestimes

timestimes

times

times

times

times

times

times

times

Figure 4 State diagram of FSM for describing the EKF-based algorithm

where 119877 represents the uncertainties of measurement vari-ablewhich are very difficult to knowHence119877 is often chosenas unity matrix for simplifying the task but does not affect theoutcome (31) Since 11987512 = 11987521 (31) can be rewritten in thefollowing form

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1

[11990122 + 1 minus11990112

minus11990112 11990111 + 1]

(32)To normalize the input value and to prevent the numericaloverflow condition which occurred during computation (32)is normalized and those values are all divided by 4Therefore(32) becomes

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

119872

[[[[

[

11990122 + 1

4

minus11990112

4

minus11990112

4

11990111 + 1

4

]]]]

]

Δ= [11990511 11990512

11990521 11990522]

(33)

where 119872 = (1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1)4 Then from (19)

the Kalman gain can be calculated by

119870119899

Δ=

[[[[[

[

11989611

11989621

11989631

11989641

11989612

11989622

11989632

11989642

]]]]]

]

=

[[[[[

[

11990111

11990121

11990131

11990141

11990112

11990122

11990132

11990142

]]]]]

]

[11990511 11990512

11990521 11990522]

=

[[[[[

[

1199011111990511 + 1199011211990521

1199012111990511 + 1199012211990521

1199013111990511 + 1199013211990521

1199014111990511 + 1199014211990521

1199011111990512 + 1199011211990522

1199012111990512 + 1199012211990522

1199013111990512 + 1199013211990522

1199014111990512 + 1199014211990522

]]]]]

]

(34)

Mathematical Problems in Engineering 7

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

++ + + +

+

+

+ +

+

++ +

+ +

+ + +

++ ++Product Sum

SL1

SL1

SL1

SL1

SL1SL1

Predicted estimate covariance

+ + +

+

s35 s36 s37 s38 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s49 s50 s51 s52 s53 s54 s55 s56

s57 s58 s59 s60 s61 s62 s63 s64 s65 s66 s67 s68

s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 s33 s34

12060114

1206011412060114

12060114

12060113

12060123

12060113

12060114

12060113

12060113

12060113

p14

p13

p34

p44

p33

p12p33

p23

p13

p33 p34

p24

p11

G

12060113 12060114

12060123

12060123

12060123

12060123

12060123

12060124

12060124

12060124

12060124

12060124

12060124

12060123

12060124p14

p34 p44

p22 p44

p23

p44

p33

p34

p34

p34

p24

p44

p33

p34

p23

p33

p34

p24

p11p12p13p14p22p23p24p33p34p44

G

G

G

G

G

G

G2

G2

G2

q11

q22

q44

q33

+

+ + +

+

times

times

times

times

times

times times

times

times

timestimes

times

times

times timestimes

times

times

times

times

times

times

times

times

times

times

times

timestimes

times times

times

times

times

times

times

times

times

times

times

timestimes

times

times

t33

t11

t13

t99840012

t99840012

t12

t44

t34

t24t23

t13

t11t12t13t14t22t23t24t33t34t44

t22

t23

t14

Tc

Tc

Tc

2Tc

Tc

Q

Pn|nminus1

Qn|nminus1

Pnminus1

Shift left 1bit

Figure 5 State diagram of FSM for prediction of covariance matrix 119875119899|119899minus1

8 Mathematical Problems in Engineering

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

025

025

025

+ + + +

+

+ AB

+

+

+

+

+

+

ABAB

AB

Divide

Product

Sum

+

+

+

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25

p11

p11

p11

p12

p13

p32

p22

p22

p11

p11

p22

p22p

M

M

M

M22

p12

p12

p12

p12

p13

p14p24

p14p42

p23

p12

t11

t11

t11

t12

t12

t11

t12

t12

t22

t12

t12t22

t22

t22

t11

t12

t12

t12

t22

k11

k21

k12

k22

k42

k41

k31

k32

divide

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

Shift rightSR2SR2

SR2

SR2

SR2

2bits

k11

k12

k21

k22

k31

k32 Pn|nminus1

Matrix Kn

Kn

minus

minusp12

(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

p11

p22

p23

p11

p13

p12

p12

p12

p33

p13

p23p24

p44

p14

p24

p24

p24

p24

p14

p14

p14

p22

p22

p23

p13

p13p23

p12

p34p14

t11

t12

t33

t24

t34

t11

t12

t13

t14

t22

t23

t24

t33

t34

t14

t22

t13

t23

k12

k12

k12

k11

k31

k32

k21

k11

k31k12

k22

k22

k21

k21

k32

k41

k42

k22

k11

k11

times

times

times

times

times

timestimes

times

times

times

times

times

times

times

times

times

times

times

times

timesProduct Sum+times

K

H

n

p11

p44

p12

p13

p14

p22

p23

p24

p33

p34Update covariance

matrix Pn

Pn

Pn|nminus1

(b)

Figure 6 State diagram of FSM for (a) the calculation of matrix 119870119899 and (b) the update of covariance matrix 119875119899

Step 7 Tune the present state variables from (17) and itsscalar form is shown as follows

120572 (119899) = 120572 (119899119899 minus 1) + 11989611 120572 (119899) + 11989612 120573 (119899)

120573 (119899) = 120573 (119899119899 minus 1) + 11989621 120572 (119899) + 11989622 120573 (119899)

119890 (119899) = 119890 (119899119899 minus 1) + 11989631 120572 (119899) + 11989632 120573 (119899)

120579119890 (119899) = 120579119890 (119899 | 119899 minus 1) + 11989641 120572 (119899) + 11989642 120573 (119899)

(35)

where 119896119894119895 is the element in Kalman gain 119870119899 sdot 120572(119899) = 119894120572(119899) minus120572(119899 | 119899 minus 1) and 120573(119899) = 119894120573(119899) minus 120573(119899 | 119899 minus 1)

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 6: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

6 Mathematical Problems in Engineering

cos

sin

Calculate Jacobian matrix and predict state variables Prediction of temporary

Calculation of error Update estimated state

Obtain the temporary covariance

matrix

Update

and calculate

+ +21k

SR2

e(n

e(n)

minus 1)

e(n minus 1)e

120579e

(n minus 1)

e

sin(e(n minus 1))

sin(e(n minus 1))

cos(e(n minus 1)) cos(e(n minus 1))

e(n minus 1)

e(n

e(n)

minus 1)

e

i120573(n minus 1)

e(n minus 1)120582fTc

Lse(n minus 1)120582fTc

Ls

e(n minus 1)120582fTc

Ls

120582fTc

Ls

120582fTc

Ls1 minus TcrsLs

1 minus Tc

Tc

rsLs

i120572(n minus 1)

i120572(n)

i120572(n)

i120573(n

i120573(n)

i120573(n)

120573(n)i120573(n)

|n minus 1)

i120572(n|n minus 1)

i120573(n|n minus 1)

(n|n minus 1)(n

r(n)

|n minus 1)

i120573(n|n minus 1)

i120572(n|n minus 1)

(n|n minus 1)

i120572(n|n minus 1)

TcLs

120572(n minus 1)

TcLs

120573(n minus 1)12060124

12060123

12060113

12060114

minus120582fTc

Ls

s0 s1 s2 s3 s4 s5 s6 s7 s8 s9 s11 s12 s13 s68

s69 s70 s71 s120 s122 s123 s124 s125 s126 s127 s128 s129 s130s121

Q11Q22Q33Q44

Pnminus1

Pn|nminus1

Pn|nminus1

Pn

Kn

K11

covariance matrix Pn

i120572(n)i

i

120572(n)

i120572(n)

i120572(n)i120572(n)

i120573(n)

i120573(n)

i120573(n)

Update Pn and calculate Kn

matrix Pn

matrix Kn

R11 R22

k12

k31

k22

k42k32

k41

++

++

+

+

+ + +

+ +

+ +

minus

minus

minus

times

times

times

times

times

times

times

timestimes

timestimes

times

times

times

times

times

times

times

Figure 4 State diagram of FSM for describing the EKF-based algorithm

where 119877 represents the uncertainties of measurement vari-ablewhich are very difficult to knowHence119877 is often chosenas unity matrix for simplifying the task but does not affect theoutcome (31) Since 11987512 = 11987521 (31) can be rewritten in thefollowing form

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1

[11990122 + 1 minus11990112

minus11990112 11990111 + 1]

(32)To normalize the input value and to prevent the numericaloverflow condition which occurred during computation (32)is normalized and those values are all divided by 4Therefore(32) becomes

[119867119875119899|119899minus1119867119879+ 119877]minus1

=1

119872

[[[[

[

11990122 + 1

4

minus11990112

4

minus11990112

4

11990111 + 1

4

]]]]

]

Δ= [11990511 11990512

11990521 11990522]

(33)

where 119872 = (1199011111990122 + 11990111 + 11990122 minus 1199012

12+ 1)4 Then from (19)

the Kalman gain can be calculated by

119870119899

Δ=

[[[[[

[

11989611

11989621

11989631

11989641

11989612

11989622

11989632

11989642

]]]]]

]

=

[[[[[

[

11990111

11990121

11990131

11990141

11990112

11990122

11990132

11990142

]]]]]

]

[11990511 11990512

11990521 11990522]

=

[[[[[

[

1199011111990511 + 1199011211990521

1199012111990511 + 1199012211990521

1199013111990511 + 1199013211990521

1199014111990511 + 1199014211990521

1199011111990512 + 1199011211990522

1199012111990512 + 1199012211990522

1199013111990512 + 1199013211990522

1199014111990512 + 1199014211990522

]]]]]

]

(34)

Mathematical Problems in Engineering 7

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

++ + + +

+

+

+ +

+

++ +

+ +

+ + +

++ ++Product Sum

SL1

SL1

SL1

SL1

SL1SL1

Predicted estimate covariance

+ + +

+

s35 s36 s37 s38 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s49 s50 s51 s52 s53 s54 s55 s56

s57 s58 s59 s60 s61 s62 s63 s64 s65 s66 s67 s68

s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 s33 s34

12060114

1206011412060114

12060114

12060113

12060123

12060113

12060114

12060113

12060113

12060113

p14

p13

p34

p44

p33

p12p33

p23

p13

p33 p34

p24

p11

G

12060113 12060114

12060123

12060123

12060123

12060123

12060123

12060124

12060124

12060124

12060124

12060124

12060124

12060123

12060124p14

p34 p44

p22 p44

p23

p44

p33

p34

p34

p34

p24

p44

p33

p34

p23

p33

p34

p24

p11p12p13p14p22p23p24p33p34p44

G

G

G

G

G

G

G2

G2

G2

q11

q22

q44

q33

+

+ + +

+

times

times

times

times

times

times times

times

times

timestimes

times

times

times timestimes

times

times

times

times

times

times

times

times

times

times

times

timestimes

times times

times

times

times

times

times

times

times

times

times

timestimes

times

times

t33

t11

t13

t99840012

t99840012

t12

t44

t34

t24t23

t13

t11t12t13t14t22t23t24t33t34t44

t22

t23

t14

Tc

Tc

Tc

2Tc

Tc

Q

Pn|nminus1

Qn|nminus1

Pnminus1

Shift left 1bit

Figure 5 State diagram of FSM for prediction of covariance matrix 119875119899|119899minus1

8 Mathematical Problems in Engineering

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

025

025

025

+ + + +

+

+ AB

+

+

+

+

+

+

ABAB

AB

Divide

Product

Sum

+

+

+

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25

p11

p11

p11

p12

p13

p32

p22

p22

p11

p11

p22

p22p

M

M

M

M22

p12

p12

p12

p12

p13

p14p24

p14p42

p23

p12

t11

t11

t11

t12

t12

t11

t12

t12

t22

t12

t12t22

t22

t22

t11

t12

t12

t12

t22

k11

k21

k12

k22

k42

k41

k31

k32

divide

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

Shift rightSR2SR2

SR2

SR2

SR2

2bits

k11

k12

k21

k22

k31

k32 Pn|nminus1

Matrix Kn

Kn

minus

minusp12

(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

p11

p22

p23

p11

p13

p12

p12

p12

p33

p13

p23p24

p44

p14

p24

p24

p24

p24

p14

p14

p14

p22

p22

p23

p13

p13p23

p12

p34p14

t11

t12

t33

t24

t34

t11

t12

t13

t14

t22

t23

t24

t33

t34

t14

t22

t13

t23

k12

k12

k12

k11

k31

k32

k21

k11

k31k12

k22

k22

k21

k21

k32

k41

k42

k22

k11

k11

times

times

times

times

times

timestimes

times

times

times

times

times

times

times

times

times

times

times

times

timesProduct Sum+times

K

H

n

p11

p44

p12

p13

p14

p22

p23

p24

p33

p34Update covariance

matrix Pn

Pn

Pn|nminus1

(b)

Figure 6 State diagram of FSM for (a) the calculation of matrix 119870119899 and (b) the update of covariance matrix 119875119899

Step 7 Tune the present state variables from (17) and itsscalar form is shown as follows

120572 (119899) = 120572 (119899119899 minus 1) + 11989611 120572 (119899) + 11989612 120573 (119899)

120573 (119899) = 120573 (119899119899 minus 1) + 11989621 120572 (119899) + 11989622 120573 (119899)

119890 (119899) = 119890 (119899119899 minus 1) + 11989631 120572 (119899) + 11989632 120573 (119899)

120579119890 (119899) = 120579119890 (119899 | 119899 minus 1) + 11989641 120572 (119899) + 11989642 120573 (119899)

(35)

where 119896119894119895 is the element in Kalman gain 119870119899 sdot 120572(119899) = 119894120572(119899) minus120572(119899 | 119899 minus 1) and 120573(119899) = 119894120573(119899) minus 120573(119899 | 119899 minus 1)

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 7: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

Mathematical Problems in Engineering 7

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

+

++ + + +

+

+

+ +

+

+ +

+ + +

+

+ ++ +

+ +

+ + +

+

++ ++

+

++ + + +

+

+

+ +

+

++ +

+ +

+ + +

++ ++Product Sum

SL1

SL1

SL1

SL1

SL1SL1

Predicted estimate covariance

+ + +

+

s35 s36 s37 s38 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s49 s50 s51 s52 s53 s54 s55 s56

s57 s58 s59 s60 s61 s62 s63 s64 s65 s66 s67 s68

s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25 s26 s27 s28 s29 s30 s31 s32 s33 s34

12060114

1206011412060114

12060114

12060113

12060123

12060113

12060114

12060113

12060113

12060113

p14

p13

p34

p44

p33

p12p33

p23

p13

p33 p34

p24

p11

G

12060113 12060114

12060123

12060123

12060123

12060123

12060123

12060124

12060124

12060124

12060124

12060124

12060124

12060123

12060124p14

p34 p44

p22 p44

p23

p44

p33

p34

p34

p34

p24

p44

p33

p34

p23

p33

p34

p24

p11p12p13p14p22p23p24p33p34p44

G

G

G

G

G

G

G2

G2

G2

q11

q22

q44

q33

+

+ + +

+

times

times

times

times

times

times times

times

times

timestimes

times

times

times timestimes

times

times

times

times

times

times

times

times

times

times

times

timestimes

times times

times

times

times

times

times

times

times

times

times

timestimes

times

times

t33

t11

t13

t99840012

t99840012

t12

t44

t34

t24t23

t13

t11t12t13t14t22t23t24t33t34t44

t22

t23

t14

Tc

Tc

Tc

2Tc

Tc

Q

Pn|nminus1

Qn|nminus1

Pnminus1

Shift left 1bit

Figure 5 State diagram of FSM for prediction of covariance matrix 119875119899|119899minus1

8 Mathematical Problems in Engineering

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

025

025

025

+ + + +

+

+ AB

+

+

+

+

+

+

ABAB

AB

Divide

Product

Sum

+

+

+

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25

p11

p11

p11

p12

p13

p32

p22

p22

p11

p11

p22

p22p

M

M

M

M22

p12

p12

p12

p12

p13

p14p24

p14p42

p23

p12

t11

t11

t11

t12

t12

t11

t12

t12

t22

t12

t12t22

t22

t22

t11

t12

t12

t12

t22

k11

k21

k12

k22

k42

k41

k31

k32

divide

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

Shift rightSR2SR2

SR2

SR2

SR2

2bits

k11

k12

k21

k22

k31

k32 Pn|nminus1

Matrix Kn

Kn

minus

minusp12

(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

p11

p22

p23

p11

p13

p12

p12

p12

p33

p13

p23p24

p44

p14

p24

p24

p24

p24

p14

p14

p14

p22

p22

p23

p13

p13p23

p12

p34p14

t11

t12

t33

t24

t34

t11

t12

t13

t14

t22

t23

t24

t33

t34

t14

t22

t13

t23

k12

k12

k12

k11

k31

k32

k21

k11

k31k12

k22

k22

k21

k21

k32

k41

k42

k22

k11

k11

times

times

times

times

times

timestimes

times

times

times

times

times

times

times

times

times

times

times

times

timesProduct Sum+times

K

H

n

p11

p44

p12

p13

p14

p22

p23

p24

p33

p34Update covariance

matrix Pn

Pn

Pn|nminus1

(b)

Figure 6 State diagram of FSM for (a) the calculation of matrix 119870119899 and (b) the update of covariance matrix 119875119899

Step 7 Tune the present state variables from (17) and itsscalar form is shown as follows

120572 (119899) = 120572 (119899119899 minus 1) + 11989611 120572 (119899) + 11989612 120573 (119899)

120573 (119899) = 120573 (119899119899 minus 1) + 11989621 120572 (119899) + 11989622 120573 (119899)

119890 (119899) = 119890 (119899119899 minus 1) + 11989631 120572 (119899) + 11989632 120573 (119899)

120579119890 (119899) = 120579119890 (119899 | 119899 minus 1) + 11989641 120572 (119899) + 11989642 120573 (119899)

(35)

where 119896119894119895 is the element in Kalman gain 119870119899 sdot 120572(119899) = 119894120572(119899) minus120572(119899 | 119899 minus 1) and 120573(119899) = 119894120573(119899) minus 120573(119899 | 119899 minus 1)

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 8: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

8 Mathematical Problems in Engineering

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

+

X

+ +

X

sr2 +

sr2 + AB

sr2 + AB

sr2

AB

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

X

X

+

sr2

AB

X

+

X +

X

X +

X

025

025

025

+ + + +

+

+ AB

+

+

+

+

+

+

ABAB

AB

Divide

Product

Sum

+

+

+

s1 s2 s3 s4 s5 s6 s7 s8

s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 s19 s20 s21 s22 s23 s24 s25

p11

p11

p11

p12

p13

p32

p22

p22

p11

p11

p22

p22p

M

M

M

M22

p12

p12

p12

p12

p13

p14p24

p14p42

p23

p12

t11

t11

t11

t12

t12

t11

t12

t12

t22

t12

t12t22

t22

t22

t11

t12

t12

t12

t22

k11

k21

k12

k22

k42

k41

k31

k32

divide

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

times

Shift rightSR2SR2

SR2

SR2

SR2

2bits

k11

k12

k21

k22

k31

k32 Pn|nminus1

Matrix Kn

Kn

minus

minusp12

(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

p11

p22

p23

p11

p13

p12

p12

p12

p33

p13

p23p24

p44

p14

p24

p24

p24

p24

p14

p14

p14

p22

p22

p23

p13

p13p23

p12

p34p14

t11

t12

t33

t24

t34

t11

t12

t13

t14

t22

t23

t24

t33

t34

t14

t22

t13

t23

k12

k12

k12

k11

k31

k32

k21

k11

k31k12

k22

k22

k21

k21

k32

k41

k42

k22

k11

k11

times

times

times

times

times

timestimes

times

times

times

times

times

times

times

times

times

times

times

times

timesProduct Sum+times

K

H

n

p11

p44

p12

p13

p14

p22

p23

p24

p33

p34Update covariance

matrix Pn

Pn

Pn|nminus1

(b)

Figure 6 State diagram of FSM for (a) the calculation of matrix 119870119899 and (b) the update of covariance matrix 119875119899

Step 7 Tune the present state variables from (17) and itsscalar form is shown as follows

120572 (119899) = 120572 (119899119899 minus 1) + 11989611 120572 (119899) + 11989612 120573 (119899)

120573 (119899) = 120573 (119899119899 minus 1) + 11989621 120572 (119899) + 11989622 120573 (119899)

119890 (119899) = 119890 (119899119899 minus 1) + 11989631 120572 (119899) + 11989632 120573 (119899)

120579119890 (119899) = 120579119890 (119899 | 119899 minus 1) + 11989641 120572 (119899) + 11989642 120573 (119899)

(35)

where 119896119894119895 is the element in Kalman gain 119870119899 sdot 120572(119899) = 119894120572(119899) minus120572(119899 | 119899 minus 1) and 120573(119899) = 119894120573(119899) minus 120573(119899 | 119899 minus 1)

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 9: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

Mathematical Problems in Engineering 9

(work-3)

(work-2)

(work-1)

Speedcommand

Speed commandRotor speed and Kalman speed

Gain1

Torque

S-function

Flux angle

Stator current

DCTm

mA

NSB

C

0001voltage source

Gain6Saturation

Saturation1

Saturation2

Data type conversion 1

Data type conversion 10

Data type conversion 11

Data type conversion 12

Gain7

Gain8

transformation

flux angleReal and estimated

Constant1

Constant2

Permanent magnetsynchronous machine

Convert

Convert

Convert

Convert

Convert

Convert

Convert0

ModelSim

ModelSim

ModelSim

cmd

Rotor speed

Current command

Speed loop PI controller

iq current command

cmd iq

cmd id

Flux angle

Phase a current

Phase b current

Phase c current

PMW1

PMW2

PMW3

PMW4

PMW5

PMW6

id out

iq out

CCCT and SVPWM

-K-

-K-

-K-

-K-

d-axis current

Motor dq current

Flux angle

wr

Full-order EKF

IGBT-based inverter

idq

ln1Conn1

ln2Conn2

ln3Conn3

ln4Conn4

ln5Conn5

ln6Conn6

+⟨Rotor speed wm (rads)⟩⟨Electromagnetic torque Te (Nlowastm)⟩⟨Rotor angle thetam (rad)⟩⟨Stator current is d (A)⟩⟨Stator current is q (A)⟩⟨Stator current is a (A)⟩⟨Stator current is b (A)⟩⟨Stator current is c (A)⟩

120572

i120572

120573

i120573

V120572 out

V120573 out

I120572 out

I120573 out

Figure 7 The SimulinkModelSim cosimulation architecture for sensorless speed control of PMSM drive

Step 8 Update the present covariance matrix 119875119899 from (18)where 119870119899119867119875119899|119899minus1 can be directly obtained as follows

119870119899119867119875119899|119899minus1 =

[[[[

[

1198961111990111 + 1198961211990121 1198961111990112 + 1198961211990122 1198961111990113 + 1198961211990123 1198961111990114 + 1198961211990124

1198962111990111 + 1198962211990121 1198962111990112 + 1198962211990122 1198962111990113 + 1198962211990123 1198962111990114 + 1198962211990124

1198963111990111 + 1198963211990121 1198963111990112 + 1198963211990122 1198963111990113 + 1198963211990123 1198963111990114 + 1198963211990124

1198964111990111 + 1198964211990121 1198964111990112 + 1198964211990122 1198964111990113 + 1198964211990123 1198964111990114 + 1198964211990124

]]]]

]

(36)

Step 9 Calculate the rotor speed from (27) then set 119899 = 119899 +1 and go back to Step 2

3 Design of Sensorless Speed Controller IP

Figure 3 illustrates the internal architecture of the proposedFPGA implementation of a sensorless speed control IP forPMSM drive system The internal circuit comprises a NiosII embedded processor IP and an application IP The Nios IIprocessor is depicted to generate the speed command collectthe response data and communicate with external deviceAll programs in Nios II processor are coded in the Clanguage The application IP includes mainly a circuit of anEKF-based rotor FA and rotor speed estimation a speedPI controller a circuit for current controllers and coordinatetransformation (CCCT) a SVPWM circuit and an ADCinterface circuit The sampling frequencies of the speedcontrol loop and current control loop are designedwith 2 kHzand 16 kHz respectively The frequency divider generates50Mhz (Clk) and 125Mhz (Clk-step) clock to supply allcircuits in Figure 3 The internal circuit of CCCT performs

the function of two PI controllers table look-up for sincosfunction and the coordinate transformation for Clark Parkinverse Park and modified inverse Clarke The detailedcircuit design of CCCT speed PI controller ADC interfaceand SVPWM generation in Figure 3 refers to [8] Hereinonly the digital hardware circuit design of the EKF-basedrotor FA and rotor speed estimation is described To reducethe FPGA resource usage a finite-state machine (FSM) isemployed to model the EKF-based algorithm whose designprocedure andmathematical formulation are presented in theprevious sectionThedesign result is shown in Figure 4whichuses one adder one multiplier one divider two sincos look-up table shifters registers and so forth and manipulates 131steps machine to carry out the overall computationThe datatype adopts 16-bit lengthwithQ15 format and 2rsquos complementoperation The multiplier adder and divider apply AlteraLPM (Library ParameterizedModules) standard In Figure 4the steps 1199040 sim 11990412 execute the calculation of Jacobian matrixand predict temporary state variables 11990413 sim 11990468 perform thecomputation of temporary covariance matrix steps 11990469 sim11990470 are for state error calculation steps 11990471sim119904120 update of

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 10: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

10 Mathematical Problems in Engineering

0 01 02 03 04 05 06

0100200300

Spee

d (r

pm)

Speed command Actual

rotor speed

Estimated rotor speed

minus100minus200minus300

Time (s)

(a)

0 01 02 03 04 05 06

005

115

Curr

ent (

A)

minus05

minus1

iqid

Time (s)

(b)

0 01 02 03 04 05 06

0100200300400500

Flux

angl

e (FA

) (d

eg)

Actual rotor FA

Estimated rotor FAby EKF

minus100

Time (s)

(c)

Figure 8 PMSM running at low speed (200 rpm) and inverse speed (plusmn200 rpm) condition (a) Speed step response (b) current responseand (c) actual rotor FA and estimated rotor FA

0 005 01 015 02 025 03 035 04 045 05

0100020003000

Spee

d (r

pm)

Time (s)

Speed command

Estimated rotor speed

Actual rotor speed

minus1000

minus2000

minus3000

(a)

0 005 01 015 02 025 03 035 04 045 05

0

2

4Cu

rren

t (A

)

Time (s)

minus2

minus4

iq

id

(b)

0 005 01 015 02 025 03 035 04 045 05

0100200300400

Flux

angl

e (FA

) (de

g)

Time (s)

Actual rotor FA

Estimated rotor FA by EKF minus100

(c)

Figure 9 PMSM running at wide-range high speed (2000 rpm) and inverse speed (plusmn1000 rpm) condition (a) Speed step response (b) currentresponse AND (c) actual rotor FA and estimated rotor FA

the present covariance matrix 119875119899 and calculate the Kalmangain 119870119899 119904121sim 119904130 describe the present state tuning as wellas executing the computation of rotor FA and rotor speedAccording to (30) the computation of temporary covariancematrix 119875119899|119899minus1in Figure 4 is described in Figure 5 Furtheraccording to (18) (33)-(34) and (36) the update of thepresent covariancematrix119875119899 and calculation theKalman gain119870119899 in Figure 4 are illustrated in Figure 6 The operation ofeach step in Figure 4 is 80 ns (125MHz) in FPGA thereforea total of 131 steps need only 1048 120583s operation timesThe FPGA (Altera) resource usages of EKF-based rotor FAand rotor speed estimation in Figure 4 is 4158 LEs (logicelements) and 2890 RAM bits Additionally the FPGA

resource usages of the circuits of CCCT speed PI controllerADC interface and SVPWM in Figure 3 are 864 LEs and24576 RAM 2043 LEs and 0RAM bits 136 LEs and 0RAMbits and 1221 LEs and 0RAM bits respectively

4 SimulinkModelSim Cosimulation andIts Simulation Results

The SimulinkModelSim cosimulation architecture for sen-sorless PMSM speed control system is shown in Figure 7The SimPowerSystem-Blockset in the Simulink executes thePMSM and the IGBT-based inverterThe EDA simulator linkfor ModelSim executes the cosimulation using VHDL code

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 11: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

Mathematical Problems in Engineering 11

LP filter circuit

Rectifier Inverter

Ac source

Isolated and driving circuits

ADC

ADC

PWM6PWM1

PMSM

Digital circuitof speed PI controller EKF-based rotor FA and speed estimation

and current vector controller for PMSM

FPGA-based sensorless speed control IP

Load

Externalmemory

(Nios II processor)

Embedded processor IP

Application IP

L

C

T+A

TminusA

T+B

TminusB

T+C

TminusC

U V W

ia

ib

CPU

On-chipROM

On-chipRAM

UART

PIO

Timer

SPI

SDRAMcontroller

Aval

on b

us

(a)

(b)

Figure 10 Experimental system (a) with block diagram and (b) in real system

running in ModelSim program It executes the function ofthe sensorless speed controller by three works The work-1to work-3 of ModelSim in Figure 7 respectively perform thefunction of speed loop PI controller the function of cur-rent controller and coordinate transformation (CCCT) andSVPWM and the function of EKF-based rotor FA and rotorspeed estimation The sampling frequency in current controlloop and EKF-based estimation algorithm is designed with16 kHz but in speed control loop is 2 kHz The clocks of50MHz and 125MHz will supply all works of ModelSimThe FPGA (Altera) resource usages of work-1 to work-3 are2043 LEs and 0 RAM bits 2085 LEs and 24576 RAM bitsand 4158 LEs and 2890 RAM bits respectively

In simulation the designed PMSM parameters used inFigure 7 are as follows pole pairs are 4 stator phase resis-tance is 13Ω stator inductance is 63mH inertia is 119869 =

0000108 kglowastm2 and friction factor is 119865 = 00013NlowastmlowastsPI gains in speed control loop are designed with119870119901 = 02442and 119870119894 = 000458 To evaluate the proposed controllerperformance PMSM running at low speed (200 rpm) andinverse speed (from 200 rpm to minus200 rpm or vice versa) con-dition is firstly considered and its simulation results regard-ing as the speed step response the current response as wellas the actual rotor flux angle (FA) and the estimated rotorflux angle are shown in Figure 8 It shows that the motorspeed gives a good dynamic response performance with a

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 12: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

12 Mathematical Problems in Engineering

0 02 04 06 08 1 12 14 16 18 2

0

500 Speed command

Rotor speed

200

Time (s)

Spee

d (r

pm)

minus500

minus200

(a)

0

100

200

300

400

0 02 04 06 08 1 12 14 16 18 2

Actual rotor FA Estimated rotor FA

Time (s)

Flux

angl

e (de

g)

(b)

Figure 11 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) actual rotor FA and estimated rotor FA

0200400600800

10001200 Speed

command

Actual rotor speed

Estimated rotor speed

0 05 1 15 2 25 3Time (s)

Spee

d (r

pm)

(a)

0 05 1 15 2 25 3Time (s)

Curr

ent (

A) iq

id

0

051

15

minus05

minus1

(b)

Figure 12 (a) Step speed response of actual rotor speed and estimated rotor speed and (b) current response

little overshoot and 25ms rising time It also shows thatthe estimated rotor speed can track actual rotor speed wellFigure 8(b) shows a successful vector control because 119894119889 iscontrolled to zero Figure 8(c) shows that the estimated rotorFA can fast track the actual rotor FA even in the inverse speedcommand condition Further another simulation case whilethe PMSMrunning at wide-range high speed (from0 rpm rarr

1000 rpm rarr 2000 rpm rarr 1000 rpm rarr minus1000 pm rarr

minus2000 rpm) and inverse speed (from 1000 rpm tominus1000 rpm)condition is tested and its simulation results are shown inFigure 9 It presents that not only at speed tracking butalso at rotor FA tracking the estimated value adopted byEKF method can give a good follow to the real rotor valueHowever except in the initial condition the actual rotorspeed gives a fast step response by 18ms rising time near0mm steady-state value and maximum 175 overshoot

5 Experimental System and Results

After confirming the correctness of the proposed EKF-basedsensorless control IP by simulation the VHDL codes aredirectly applied to the experimental FPGA-based sensorlessPMSM drive system The block diagram and real experi-mental system are depicted in Figure 10 The main devicesinclude a PMSM a DE2 board with Altera CycloneII FPGAa motor driver and a power supplier The parameters of thePMSM are 119903119904 = 063Ω 119871 = 277mH and 4 pole pairs Theinput voltage continuous current rating torque rating speedand continuous power of the PMSM are 220V 12A 23N-m 3000 rpm and 750W respectively The Altera CycloneIIEP2C35 chip adopted in the design possesses 33216 LEsmaximum 475 available IO pins 483840 RAM and 35

embedded multipliers The chip can be embedded with aNios II multicore processor that is equipped with several32-bit CPU flexibility of core size 1 to 16Mbytes of flashmemory in the available memory chip 1 Mbyte SRAM 16Mbyte SDRAM and 4 Gbytes memory outside of the chip Inimplementation except the VHDL codes of CCCT EKF andPI controller the VHDL code of ADC interface circuit shouldbe added and integrated and then downloaded into FPGAThePI gains of speed control loop in experiment are designedwith 119870119901 = 0512 and119870119894 = 0021

In the experimental case PMSM running at low speed(200 rpm) and inverse speed (from 200 rpm to minus200 rpm orvice versa) condition are firstly considered and its experi-ment results regarding the speed step response as well as theactual rotor FA and the estimated rotor FA are shown inFigure 11 Figure 11(a) shows that the motor speed gives agood dynamic response performance with a little oscillationand overshoot and it has 15ms rising time Figure 11(b) showsthat the estimated FA can fast track the actual rotor FA evenin the inverse speed command condition Further anotherexperimental case while the PMSM running at mediumspeed (from 0 rpm rarr 300 rpm rarr 600 rpm rarr 900 rpm rarr

600 rpm rarr 900 rpm) condition is evaluated and its experi-ment results are shown in Figure 12The Figure 12(a) presentsa fast speed trackingwith 15ms rising time and no occurrenceof overshoot condition Figure 12(b) shows a successful vectorcontrol due to the 119894119889 being controlled to zeroTherefore fromthe simulation results in Figures 8 and 9 and the experimentalresults in Figures 11 and 12 it is demonstrated that the EKF-based estimation algorithm used in sensorless PMSM driveand the behavior description by usingVHDL are effective andcorrect

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 13: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

Mathematical Problems in Engineering 13

6 Conclusions

This study has presented a sensorless PMSM drive based onEKF and successfully demonstrated its performance throughcosimulation by using SimulinkModelSim and implemen-tation by using FPGA In realization aspect the VHDL isused to describe the behavior of EKF algorithm and FSM isused to reduce the FPGA resource usage therefore it onlyneeds 4158 LEs and 2890 RAMbits In computational poweraspect the operation time to complete the computation ofEKF algorithm is only 1048 120583s which is less than the 625120583s(16 KHz) sampling time in current control loop In simulatedand experimental results it shows that the use of EKF insensorless PMSM drive can accurately estimate the rotorFA and rotor speed and it can give a good step responseperformance in case of low speed control inverse speedcontrol and high speed control as well

Acknowledgment

This work was supported by the National Science Council ofChina under Grant no NSC 101-2221-E-218-039

References

[1] V C Ilioudis and N I Margaris ldquoPMSM sensorless speedestimation based on sliding mode observersrdquo in Proceedings ofthe 39th IEEE Annual Power Electronics Specialists Conference(PESC rsquo08) pp 2838ndash2843 June 2008

[2] S Chi Z Zhang and L Xu ldquoSliding-mode sensorless controlof direct-drive PM synchronous motors for washing machineapplicationsrdquo IEEE Transactions on Industry Applications vol45 no 2 pp 582ndash590 2009

[3] V Delli Colli R di Stefano and F Marignetti ldquoA system-on-chip sensorless control for a permanent-magnet synchronousmotorrdquo IEEE Transactions on Industrial Electronics vol 57 no11 pp 3822ndash3829 2010

[4] S Bolognani R Oboe andM Zigliotto ldquoSensorless full-digitalpmsm drive with ekf estimation of speed and rotor positionrdquoIEEE Transactions on Industrial Electronics vol 46 no 1 pp184ndash191 1999

[5] M C Huang A J Moses and F Anayi ldquoThe comparison ofsensorless estimation techniques for PMSM between extendedKalman filter and flux-linkage observerrdquo in Proceedings of the21st Annual IEEE Applied Power Electronics Conference andExposition (APEC rsquo06) pp 654ndash659 March 2006

[6] WWang M Zhang and Q Wu ldquoApplication of reduced-orderextended kalman filter in permanent magnet synchronousmotor sensorless regulating systemrdquo in Proceedings of the Inter-national Conference on Digital Manufacturing and Automation(ICDMA rsquo10) pp 271ndash274 December 2010

[7] J-S Jang B-G Park T-S Kim D M Lee and D-S HyunldquoParallel reduced-order extended Kalman Filter for PMSMsensorless drivesrdquo in Proceedings of the 34th Annual Conferenceof the IEEE Industrial Electronics Society (IECON rsquo08) pp 1326ndash1331 November 2008

[8] Y-S Kung and M-H Tsai ldquoFPGA-based speed control IC forPMSM drive with adaptive fuzzy controlrdquo IEEE Transactions onPower Electronics vol 22 no 6 pp 2476ndash2486 2007

[9] L Idkhajine and E Monmasson ldquoDesign methodology forcomplex FPGA-based controllersmdashapplication to an EKF sen-sorless AC driverdquo in Proceedings of the 19th International Con-ference on Electrical Machines (ICEM rsquo10) pp 1ndash6 September2010

[10] H-H Chou Y-S Kung N Vu Quynh and S Cheng ldquoOpti-mized FPGA design verification and implementation of aneuro-fuzzy controller for PMSM drivesrdquo Mathematics andComputers in Simulation vol 90 pp 28ndash44 2013

[11] Y S Kung and T H Nguyen ldquoSimulinkModelsim Co-simu-lation of EKF-based Sensorless PMSM drivesrdquo in Proceedingsof IEEE International on Power Electronics and Drive Systems(PEDS rsquo13) pp 709ndash713 2013

[12] Y Li J Huo X Li J Wen YWang and B Shan ldquoAn open-loopsinmicrostepping driver based on FPGA and the co-simulationof modelsim and simulinkrdquo in Proceedings of the InternationalConference on Computer Mechatronics Control and ElectronicEngineering (CMCE rsquo10) pp 223ndash227 August 2010

[13] The Mathworks ldquoMatlabSimulink Users Guide ApplicationProgram Interface Guiderdquo 2004

[14] Modeltech ldquoModelSim Reference Manualrdquo 2004

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of

Page 14: Research Article FPGA Realization of Sensorless PMSM …downloads.hindawi.com/journals/mpe/2013/919318.pdf · Research Article FPGA Realization of Sensorless PMSM Speed Controller

Submit your manuscripts athttpwwwhindawicom

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttpwwwhindawicom

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

CombinatoricsHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttpwwwhindawicom Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

The Scientific World JournalHindawi Publishing Corporation httpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttpwwwhindawicom

Volume 2014 Hindawi Publishing Corporationhttpwwwhindawicom Volume 2014

Stochastic AnalysisInternational Journal of