You are on page 1of 6

Adaptive Fuzzy logic Position control

Of a Stepper motor with Extended Kalman


filter

Bindu V1, A Unnikrishnan2, R Gopikakumari1


1
Division of Electronics, School of Engineering, Cochin University of science & Technology, Kochi, India. 682022
2
Scientist H, NPOL, Kochi, India
(bindu_lal1@rediffmail.com, unnikrishnan_a@live.com, gopika@cusat.ac.in)

Abstract – The present paper proposes an adaptive motor while making it less sensitive to load
fuzzy logic control (AFLC) for the position control of disturbances. In this paper, the closed loop control
a Stepper motor. The weights used for combining the is achieved by starting the motor with one pulse.
fuzzy rules are also updated, using the least mean Subsequent drive pulses are generated as a function
square algorithm. The paper also demonstrates a of the motor shaft speed which is estimated by the
Kalman filter for the estimation of motor parameters use of Extended Kalman filter.
like speed and flux vector position. The estimation is In this paper, it is proposed to estimate
ensured to be robust even in the presence of arbitrary the speed of the motor and the rotor position from
fluctuation of the input line currents. The modified
the measurements of two phase stator currents,
using an Extended Kalman filter (EKF). The
Extended Kalman Filter (EKF) rejects the outliers in
estimate also produces other quantities, like
real-time, thereby eliminating the need for manual
currents in direct and quadrature axes. The
intervention in tuning the parameters of the EKF.
proposed EKF estimation does not require the
The stability of the controller is checked by
information of the input voltage at all and it makes
computing the Lyapunov exponent from the evolution it different from similar other works [2, 3]. So the
of the state space of direct axis current, quadrature present estimation treats the whole problem as
axis current, synchronous speed; and found to be blind system identification [4, 5]. However, the
stable at all the time. The simulation results show that main problem associated with the EKF is its
the proposed control strategy operates robustly under dependence on the parameters like the initial state,
modeling uncertainty, with a good dynamic initial state co- variance, the measurement noise
performance. and the plant noise. The convergence is highly
dependent on the choice of the covariance matrices
Key words- Stepper motor, Adaptive Fuzzy logic of the plant noise and the measurement noise that
position control, Robust Kalman filter, Lyapunov appear in EKF algorithm [6]. Here the
exponent. measurements to the EKF are the output of space
vector PWM inverter, which is non sinusoidal and
I. INTRODUCTION rich in harmonics, there by degrading the
performance of EKF. To overcome this problem, a
Stepper motors are digital actuators Robust Kalman Filter is used in modifying the
which accept input pulses and respond to them by elements of the measurement covariance matrix, on
rotating the output shaft by equal increments for the run [7]. The estimated quantities show the
each input pulse. The stepping motors are mainly robustness of the technique adopted.
used in simple point to point positioning tasks in Now days stepper motors are mainly used
which they are open loop controlled [1]. The open
in closed loop control mode particularly for
loop control does not use any information
machine tool and robotics applications. According
regarding the motor shaft position or speed and in
to F Betin,D Pinchon et. al. [1], the conventional
open loop, the motor is driven by a train of pulses
with a predetermined time interval. There is no control strategies like PID control are not a good
guaranty that the motor uses all the pulses since choice because of its poor performance. In this
there is no feedback. The digital closed loop paper, the application of the fuzzy logic theory is
principle was introduced in the 1970’s in order to effectively used to control the speed of a stepper
increase the accuracy positioning of the Stepper motor. Compared to the traditional PI controller,

 
  


 
the FLC does not depend on precise system the coil. and  are the direct axis and quadrature
mathematical model [8]. Over the last many years, axis currents.  is the differential operator. is the
the fuzzy logic technique has become very popular moment of inertia.  is the viscous friction,!" is
in the control of ac drives [8, 9] because of the load torque.  is the permanent magnet flux .( is
flexibility in accommodating overlapping the shaft position of the motor , ( # )( .Where
information in the definition of terms. The usual N is the number of rotor teeth,( is the electrical
approach is to compute a fuzzy function on the angle.
error between the set speed and the estimated
speed, using a set of predefined rules. All the rules
are fired with equal weightage, wm to produce the III. ESTIMATION OF STATE VECTOR WITH
ROBUST EKF
output, given by,
The Extended Kalman filter [13] is an
 
 

optimal recursive algorithm suitable to estimate the


q=   state of nonlinear dynamic systems. The system is
 
Here ‘n’ is number of rules; µ m is the described by the following state and measurement
membership of fuzzy function and wm is the equations
weightage. In order to optimize on the choice of the
rules to be fired in FLC, a gradient descent method *+,- = f (*+ ) *+ +.+ +uk (3)
is used, in the present work, to adjust the weightage /+ =0+ *+ + + (4)
wm of each of the rules of the fuzzy controller [10].
The resulting algorithm minimizes the square error where .+ , + are the zero mean white Gaussian
between the rotor speed and the reference speed. A noise , x = [ id iq ωr θ e]. the state vector and the Zk
fuzzy inference system also needs an effective the measurement vector
method to tune the membership functions so as to The measurements /+ are the two phase stator
ensure that the linguistic meaning of the variable is currents [12 13 ]. And u is the input voltages va and
fully absorbed in the definition. The proper vb .Here the state vector x is augmented with the
definition of the membership function minimizes voltage inputs va, vb. Then the new state vector X
the output error measure or maximize performance becomes [id iq ɘ ș vd vq].
index [11]. Accordingly, a gradient descent In discrete form the augmented state model is
technique is used to tune the mean and variance of represented as
 %7&
the Gaussian membership function based on the 6 :
error in speed. The resulting adaptive fuzzy 5  %7& 9
algorithm along with the Robust EKF is 5 %7& 9
demonstrated in an environment, where the Stepper 5 (%7& 9
5 9
motor runs in Simulink and rest of the speed 5 %7&9
estimation and the control run concurrently in 4  %7& 8
Matlab =
< @A D
II. MATHEMATICAL MODEL OF STEPPER 6 ;  =>?  B1C (  EF  :
=
MOTOR 5 < @A DEF 9
5  ;
=>? =
GHB (   9
A Stepper motor is an electromechanical
transducer, whose power drive supply 5I@A B1C ( @A GHB ( K;  @LM D  
9
 9N
5 J J J E
configuration is modified by each input pulse. To 5   DE ;   9
test the dynamic response of the motor, a 5     ;  9
mathematical model must be employed. The most 4      ; 8
popular model used by many researchers are the  %7  ;&
Kuo [12] model, is used in this paper. Basically, 6 :
this model consists of electrical and mechanical 5  %7  ;& 9
5 %7  ;& 9
equations, are given by 5 (5)
(%7  ;& 9
5 9
   
=
  
  +   (1) 5 %7  ;&9
       4  %7  ;& 8


The mathematical model of hybrid stepper
     !" # $ %  & (2)

motor is mutually coupled and hence nonlinear .For
'
this non linear system, an Extended Kalman filter is
#  (3) implemented. For a given sampling time Ts, both

where ,  are the direct axis and quadrature axis the state estimate*P
+O+ and its covariance matrix
voltages,L is the inductance and R the resistance of
Pk/k are generated by the filter through a two step equation. The results also show that the Kalman
loop predictor corrector process. The corrector filter has become robust against input variation,
process starts with an initial value of x,QROI- and with this technique.
follows as below:

IV.ADAPTIVE FUZZY LOGIC POSITION


The algorithm CONTROLLER
1. Computation of the Kalman gain The fuzzy logic controller is based on the fuzzy set
and fuzzy logic theory [14]. It provides an
$+ = Q+O+I- S+> (S+ Q+O+I- S+> algorithm which converts the linguistic control,
+R)-1 based on expert knowledge into an automatic
control strategy. Membership functions are used to
where $+ is the Kalman gain for kth iteration and represent the fuzzy set and in this paper, Gaussian
TU membership function is used. The error in position
S+ = V XX=*Y
+O+I- and R is a constant
TW ’e’ and the rate of change of shaft position error
measurement noise covariance matrix.
‘ρe,’ are used to define the input linguistic
variables and the output linguistic variable ‘q’ is
2. Updation of the estimate with the measurements
taken as the quadrature axis current . The support
for all the fuzzy variables viz. e and ρe, the output
*P
+O+ =*Y
+O+I- +$+ (/+ -0+ *Y
+O+I- )
variable q is scaled to [-1 1]. Seven membership
functions, viz., NB, NM, NS, ZO, PS, PM, PB, as
3. Updation of the error covariance as
shown in Fig. 1 are defined. If x is the input to the
Q+O+ = (I- $+ Hk)Q+O+I- .
node ‘i’ and Ai is the linguistic label (negative big
where I is a identity matrix. NB, negative medium NM etc) associated with this
4. Prediction of the error covariance matrix ahead node function, then the membership function µ Ai
as specifies the degree to which the given x satisfies
Q+O+I- = Z+ Q+I-O+I- Z>+ +Q. the quantifier Ai. Using the Gaussian function, the
membership function is represented as
[Ik _
where Z+ =
T%[&
XX=*Y efg %*& # hij% K M & (7)
TW +O+I- and Q is a constant l
process covariance matrix.
5 The state is predicted ahead as
1
*Y
+O+I- = f (*+ )*+
Beginning the iteration with an initial 0.9

value of X (0) and the Covariance QROI- \the 0.8


Kalman filter estimates the values of rotor shaft
position and the speed .The convergence of 0.7

Kalman filter is highly effected by the choice of 0.6


QROI- ,X(0), Q and R. Since the measurements
contain a large number of harmonics the 0.5

performance of the EKF is often tainted. In this 0.4


paper, the EKF is made more robust using an
alternate method, based on Bayesian approach [7]. 0.3

A scalar weight Gk is introduced for each data 0.2


sample/+ such that the variance of R is weighted
0.1
with Gk, given by
0
^,-O_ -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
]+ = c (6)
`,%aV IUV [Y
VOV &b< %aV dUV [Y
VOV &
a and b are taken as constants equal to one. This Fig 1 Fuzzy Gaussian membership functions
weight Gk is utilized to scale down the
measurement covariance matrix R, to be used in the where Ci and mi are the mean and variance of the
calculation of Kalman gain EKF algorithm. In function respectively. The overlap in the definition
other words, in the expression for Kalman gain, R is decided by the values of the premise parameters
is modified as R /Gk. During Ci and mi.
simulations, it has been observed that the robust
EKF eliminates the need for manual parameter The Fuzzy inference rules are listed in the table
tuning of measurement covariance matrix in EKF given below.
TABLE 1
Rules of quadrature axis current Hybrid
Space vector Stepper
no e
PWM motor
e NB NM NS ZO PS PM PB
NB NB NB NB NB NM NS ZO
N NB NB NB NM NS ZO PS
M Fuzzy Logic
NB NB NM NS ZO PS PB Position
NS controller
NB NM NS ZO PS PM PB Line
ZO currents
PS NM NS ZO PS PM PB PB

PM NS ZO PS PM PB PB PB
PB ZO PS PM PB PB PB PB Δ ia

Using the product inference rule and central


average defuzzifier method the fuzzy output is Robust
expressed as + Kalman
- filter
 
 

q=   (8)
 
Set position θe
where n is the no. of rules, p is the weighting
factor and e g is the membership function of ith rule. Fig 2 Block diagram representation of the proposed
The weighting factor in (10) is updated by the control system
gradient descent technique. The main purpose of
adjusting these parameters of the fuzzy controller is
to minimize the sum of square errors between the
rotor speed and the reference speed. The V. COMPUTATION OF THE LYAPUNOV
instantaneous cost function is defined as: EXPONENT TO ASSESS THE STABILITY

J(k+1)=;Oqr %7  ;&  
P%7
"  ;&s2 (9) The Lyaponov exponent is an important
indicator of the stability of a nonlinear system.
where  is the reference motor speed and  Pis
" Given a continuous dynamical system in an n
the estimated speed. Following [10], the change in dimensional phase space, one can monitor the long
weight ( 10) is given by term evolution of an infinitesimal sphere of initial
condition. The ith one dimensional Lyapunov
{
npt %7& u vwxy% &$z o %7&  .. (10) exponent is then defined as follows [17]:



- ‚%ƒ&
B is the motor parameter, and o %7& is the .|g # }1~€ }H _ (12)
 ‚ %R&
instantaneous error in motor speed.
where Pi : the ith state variable of the phase plane
Ki and Ku are the scaling factors. The current The nature of the Lyapunov exponents provide an
command iq* is obtained by the output of AFC as indication of the stability of the system studies, as
explained below:
Iq*(k)=iq*(k-1)+ ku q(k) (11) | = 0 Ÿ a marginally stable orbit.
| < 0 Ÿ a periodic orbit or a fixed point
„…~HB…HCh| > 0 Ÿ Chaotic behaviour.
For the stepper motor studied, the state space 5.7249, -8.3621 , -4.193, there by confirming the
evolution of the vector [id, iq, ωe] it is collected in stability
sequence and the Lyaponov Exponents are
computed using Eqn. (12). It is seen that all the VII .CONCLUSIONS
Lyaponov exponents are negative i.e. : -5.7249 , - A robust EKF algorithm along with LMS
8.3621 , -4.193 based adaptive fuzzy, sensor less position
(taken from Sec. VI, below) , bring out the controller has been successfully implemented in
stability of the system under control. Simulink/Matlab environment. The performance
really shows that the controller is well suited for
VI. RESULTS AND DISCUSSIONS
Simulation of the given Stepper motor has 14

been carried out using Simulink/Matlab, as shown 12


in Fig. 2. The Stepper motor parameters used for
simulation are as shown below: 10

S t e p p o s it io n in r a d
Permanent magnet /hybrid type,, 2 phases, R=0.7ȳ, motor shaft position
8 Reference position
L=0.0014H, =0.005wb/m2, J= 1.2e-7-m2
The stator currents are taken from the 6
motor model, running in Simulink. The EKF based
approach for the estimation of speed and rotor 4
position are found to be robust, for different step
changes. The estimation needs only the two phase 2
stator current values, which are easily available
0
from the machine. One of the main distinction from
similar other works in literature is that only two -2
stator currents are required in order to estimate six 0 0.05 0.1 0.15 0.2 0.25
Time in sec
quantities at a time. Fig. 3 and Fig. 4 indicate that
the estimation converges in less than 1m S, in Fig 3step position catches up with the reference position
response to a step change. The robust EKF ensures
9
that the estimation is stable, with the digital drive
from the PWM inverter, without having to trim the 8

values of R and Q of EKF. The EKF algorithm is 7


run in Matlab and is integrated with Simulink
S t e p p o s it io n in r a d

6
model of the motor, using embedded Matlab motor shaft position
5 Reference position
facility. Fig 4 shows the effectiveness in estimating
the rotor position very quickly even for step 4

changes in speed. Fig 4 shows that the motor 3


catches up the reference position in less than 1 mS, 2
with minimum variance showing the efficacy of the
1
adaptive weighting terms wi.
0
The proposed method also ensure that the
motor responds to step changes in speed very -1
0 0.05 0.1 0.15 0.2 0.25
quickly. The initial values X(0) and P(0/-1) and the Time in sec
matrices Q and R are carefully fixed so as to get the Fig 4 stepper motor position response
best convergence and stability. The values of those
matrices are given as:
R= diag[10;10;10] 20
X (0) = [0;0;0;0;0;0;0]T ;
s p e e d o f th e m o to r

Q= diag [100; 100 ; 100 ; 100; 100; 100] 10

P (0/-1). = diag[200; 200; 200 ; 200;200; 200]. 0


The sampling time chosen is 4.5 μS.
-10

The phase plane trajectory of the system is -20


1.5
plotted in Fig 5. The plot clearly indicates that 1 5
0.5
there exists a equilibrium point and hence the 0 3
4
-0.5 2
system is stable. The Lyapunov exponents are -1
-1.5 0
1
calculated and the negative values confirm the quadrature axis current direct axis current
stability. The Lyapunov exponent values obtained
for the three state variables viz.[id, iq, ωe] are : - Fig 5 Phase plane trajectory
Effecting the step changes in position very quite [17] Xin Xiaonan,He Li,”Chaotic model of Permanent
magnet Linear Synchronous motor based on MATLAB”,2010
fast and total stability.. The Kalman filter proves its
IEEE Intenational conference ICEEE,Nov2010,pages1-4
competence as an estimator with a blind system
identification approach. The controller performance X BIOGRAPHIES
has been tested for various step changes in position,
in the Simulink enviournment and found stable and
convergent for all set position settings. Bindu V, received BTech
degree and MTech degree in
VIII ACKNOWLEDGMENT Electrical Engineering) from
The first author would like to thank the the Regional Engineering
Institute of Human resource Development for their College Calicut (Calicut,
sponsorship. Kerala, India) in 1995 and
2000 respectively. She is
IX REFERENCES working as Associate Professor in Electrical
Engineering, with Institute of Human resource
[1] F Betin,D Pinchon, G A Capolino, “ Fuzzy Logic applied to
speed control of a Stepping motor Drive”IEEE development. Currently she is pursuing PhD degree
TransonIndustrial Electronics vol 47, No.3, June 2000. from the Cochin University of Science and
[2] F Parasility ,R Petrella and M Tursini,”Sensorless speed Technology (Kochi, India). Her area of interest is
control of a PM Synchronous motor based on slidingmode modeling, and control of AC drive system, soft
observer and Extended Kalman filter”,Industry applications
conference, 2001,Thirty sixth IAS Annual meeting. Conference computing etc
record of the 2001 IEEE, vol.1, pp.533-540.Sep 4-October 2001
[3] Gilbert Foo", Saad Sayeef and M F Rahman,”An Extended
Kalman filter for sensor less Direct torque controlled IPM A Unnikrishnan, graduated
synchronous motor drive”, 2008 Australasian Universities
power Engineering Conference (AUPEC’08) from Regional Engineering
[4] Bindu V, A Unnikrishnan, R Gopikakumari,”Adaptive College (Calicut, Kerala,
fuzzy logic vector control of Permanent magnet synchronous India), India in Electrical
motor with a robust Extended Kalman filter”,International Engineering(1975), completed
journal on Industrial Elctronics and control IJIEC
(paper accepted) his M. Tech from IIT, Kanpur
[5] Bindu V, A Unnikrishnan, R Gopikakumari, “Fuzzy (India) in Electrical
logic Vector control of PMSM with speed and rotor position Engineering(1978) and Ph. D from IISc, Bangalore
estimation using a blind technique based on EKF”, International with a thesis in the area of “Image Data
journal on Applied Engineering Research IJAER
,vol6,number7,2011,pages 967-977 Structures”(1988). He is employed with the
[6] J Wang,H Liu,”Novel intelligent sensorless control of Defense Research and Development Organization
Permanent magnet synchronous motor Drive”,The ninth at Naval Physical and Oceanographic Laboratory,
International conference on Electronic measurements and Kochi, since 1978. His fields of interests include
Instruments,ICEMI2009
[7] A Ting,E Theodorou,SSchaal,”Learning an Outlier Sonar Signal Processing, Image Processing, Soft
RobustKalman filter”,Lecture notes in Computer Computing and Machine Learning. He has penned
science,2003,vol4701,machine learning ECML 2007,pages 748- over more than seventy papers, which have
756 appeared in National and International Journals and
[8] M N Uddin,T S Radwan, M A Rahman,”Fuzzy logic based
position control of Permanent magnet synchronous tor”,Journal Conference Proceedings
of Control and intelligent systems,vol35,No.4,Nov 2007
[9] W J Cao Binggang,Su Guang,,”Fuzzy adaptive controller
Design of Permanent magnet synchronous motor for electric R Gopikakumari received
vehicle”,2009 Third International conference on Intelligent
information technology application Bsc(Engg) degree from the
[10] Ying-Shieh Kung Ming-Hung Tsai , “FPGA-Based Speed Kerala University and MTech
Control IC for PMSM Drive With Adaptive Fuzzy Control and PhD degree from the
“,IEEE Trans on power Electronics,Nov 2007,vol22,issue 6 Cochin University of Science
pages 2476-2486.
[11] Jyh-Shing,Roger Jang,” ANFIS: Adaptive-Network Based and Technology (Kochi, India)
Fuzzy Inference system”, IEEE Transactions on in the year 1984,1987 and
systems,Man,and Cybernetics,vol23,No.3,May/June1993. 1999 respectively. She is working in Cochin
[12] B C Kuo,”Step motors and Control systems” University of Science and Technology since 1988
ChampaignIL:SRL,1979.
[14] LotfiA.Zadeh,"Soft Computing and Fuzzy Logic," IEEE and currently she is the head of the Division of
Software,vol.11,no.6,pp.48-56,Nov./Dec.1994, Electronics Engg. Her field of interest is digital
:10.1109/52.329401 signal processing, Image processing, neural
[15] M.Barut, S.Bogosyan, M.Gokasa,”Speed sensor less networks etc. She has authored many papers,
direct torque control of IMs with rotor resistance estimation”,
Science direct-Energy conversion and management, July which have appeared in National and International
2004(electronic version) Journals and Conference Proceedings
[16] R.Krishnan, Electric Motor Drives, Pearson Education,
Singapore, 2003.

You might also like