adaptive pid control of a stepper motor driving a flexible...

10
ORIGINAL ARTICLE Adaptive PID control of a stepper motor driving a flexible rotor Nehal M. Elsodany * , Sohair F. Rezeka, Noman A. Maharem Faculty of Engineering, Alexandria University, Egypt Received 29 September 2009; accepted 22 August 2010 Available online 30 August 2011 KEYWORDS Stepper motor; Fuzzy control; Gain scheduling; Flexible rotor Abstract Stepping motors are widely used in robotics and in the numerical control of machine tools to perform high precision positioning operations. The classical closed-loop control of the stepper motor can not respond properly to the system variations unless adaptive technique is used. In this paper, the feasibility of fuzzy gain scheduling control for stepping motor driving flexible rotor has been investigated and illustrated by numerical simulation. The proposed control was concerned with the permanent magnet step motor (PMSM) with mechanical variations such as stiffness of rotor and load inertia. A mathematical model for the PMSM was derived and the gains of a conventional PID control were presented. The data base required in learning process of the fuzzy logic gain scheduling mechanism was obtained from the mathematical model. It was found that the stable value for the integral gain is half the value of the proportional gain. The fuzzy systems for scheduling the derivative gain and the proportional gain are presented. The conducted simulation showed that the fuzzy system is able to adapt the controller gains to track the desired load and speed response. Fuzzy PID performance is much better than the con- ventional PID control scheme. Fuzzy self-tuning controller demonstrates a very fast response and little overshoot. ª 2011 Faculty of Engineering, Alexandria University. Production and hosting by Elsevier B.V. All rights reserved. 1. Introduction Mechatronics is defined as the interdisciplinary field of engi- neering that deals with the design of products whose function relies on the integration of mechanical, electrical, and elec- tronic components [1,2]. Actuators (motors) are considered as essential components of all Mechatronics systems. Stepper motors are widely implemented in systems that demand high accuracy combined with quick response [3]. Stepping motors were mainly used for simple point-to-point positioning tasks in which they were open-loop controlled. In this way, they were driven by a pulse train with a predetermined time interval between successive pulses applied to the power driver, and no * Corresponding author. E-mail addresses: [email protected] (N.M. Elsodany), [email protected] (S.F. Rezeka). 1110-0168 ª 2011 Faculty of Engineering, Alexandria University. Production and hosting by Elsevier B.V. All rights reserved. Peer review under responsibility of Faculty of Engineering, Alexandria University. doi:10.1016/j.aej.2010.08.002 Production and hosting by Elsevier Alexandria Engineering Journal (2011) 50, 127136 Alexandria University Alexandria Engineering Journal www.elsevier.com/locate/aej www.sciencedirect.com

Upload: lamkhanh

Post on 12-Mar-2018

219 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

Alexandria Engineering Journal (2011) 50, 127–136

Alexandria University

Alexandria Engineering Journal

www.elsevier.com/locate/aejwww.sciencedirect.com

ORIGINAL ARTICLE

Adaptive PID control of a stepper motor driving

a flexible rotor

Nehal M. Elsodany *, Sohair F. Rezeka, Noman A. Maharem

Faculty of Engineering, Alexandria University, Egypt

Received 29 September 2009; accepted 22 August 2010Available online 30 August 2011

*

E-

sr

11

Pr

Pe

U

do

KEYWORDS

Stepper motor;

Fuzzy control;

Gain scheduling;

Flexible rotor

Corresponding author.

mail addresses: nehalmoham

[email protected] (S.F. Rez

10-0168 ª 2011 Faculty o

oduction and hosting by Els

er review under responsibility

niversity.

i:10.1016/j.aej.2010.08.002

Production and h

ed22@y

eka).

f Engine

evier B.V

of Facu

osting by E

Abstract Stepping motors are widely used in robotics and in the numerical control of machine

tools to perform high precision positioning operations. The classical closed-loop control of the

stepper motor can not respond properly to the system variations unless adaptive technique is used.

In this paper, the feasibility of fuzzy gain scheduling control for stepping motor driving flexible

rotor has been investigated and illustrated by numerical simulation. The proposed control was

concerned with the permanent magnet step motor (PMSM) with mechanical variations such as

stiffness of rotor and load inertia. A mathematical model for the PMSM was derived and the

gains of a conventional PID control were presented. The data base required in learning process

of the fuzzy logic gain scheduling mechanism was obtained from the mathematical model. It

was found that the stable value for the integral gain is half the value of the proportional gain.

The fuzzy systems for scheduling the derivative gain and the proportional gain are presented.

The conducted simulation showed that the fuzzy system is able to adapt the controller gains to

track the desired load and speed response. Fuzzy PID performance is much better than the con-

ventional PID control scheme. Fuzzy self-tuning controller demonstrates a very fast response and

little overshoot.ª 2011 Faculty of Engineering, Alexandria University. Production and hosting by Elsevier B.V.

All rights reserved.

ahoo.com (N.M. Elsodany),

ering, Alexandria University.

. All rights reserved.

lty of Engineering, Alexandria

lsevier

1. Introduction

Mechatronics is defined as the interdisciplinary field of engi-neering that deals with the design of products whose functionrelies on the integration of mechanical, electrical, and elec-

tronic components [1,2]. Actuators (motors) are consideredas essential components of all Mechatronics systems. Steppermotors are widely implemented in systems that demand high

accuracy combined with quick response [3]. Stepping motorswere mainly used for simple point-to-point positioning tasksin which they were open-loop controlled. In this way, theywere driven by a pulse train with a predetermined time interval

between successive pulses applied to the power driver, and no

Page 2: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

Step motor

LoadJL

θL Jm, Tm, θm

k, B

128 N.M. Elsodany et al.

information on the motor shaft position or speed was used

[4,5]. Unfortunately, the open-loop control scheme suffersfrom low-performance capability and lack of adaptability toload variations and system variations. Indeed, without feed-back, there is no way of knowing if the motor has missed a

pulse or if the speed response is oscillatory. The closed-loopprinciple [6] was introduced in order to increase the accuracypositioning of the stepping motor while making it less sensitive

to load disturbances. The closed-loop control is characterizedby starting the motor with one pulse, and subsequent drivepulses are generated as a function of the motor shaft position

and/or speed by the use of a feedback encoder. Nowadays, dueto advances made in both power electronics and data process-ing, stepping motors are more often closed-loop controlled, in

particular, for machine tools and robotic manipulators inwhich they have to perform high precision operations in spiteof the mechanical configuration changes. Also, the use of clas-sic closed-loop algorithms such as Proportional-integral-deriv-

ative (PID) control is weak unless the closed-loop control isforced to adapt to the motor operating conditions. Fuzzy Lo-gic [7–9] is a technology of great potential in the fields of arti-

ficial intelligence and Mechatronics. It mimics the human wayof thinking and decision-making. Fuzzy PID control can beclassified into two major categories according to their con-

struction [10]. One category has no explicit proportional, inte-gral, and derivative gains; instead the control signal is directlydeduced from knowledge base and fuzzy inference. Most of theresearch on fuzzy logic control design belongs to this category

[11–14]. Another category is fuzzy-scheduling of conventionalPID gains. In recent years, fuzzy-scheduling control has beenwidely applied to solve versatile control problems. Zhao and

Collins [15] designed fuzzy PI controller for weigh belt feederto maintain a constant feed rate. They used singleton TS fuzzymodel based on the error and the change in error as inputs to

tune the proportional and integral gains. Chang et al. [16] pro-posed fuzzy scheduling control scheme, including the feedbackstates and the integral of tracking error for induction servo

motor. Regional stability was discussed upon considering thesaturation phenomena of the actuator. Hazzab et al. [17] pre-sented control of an induction motor using fuzzy gain schedul-ing of PI controller based on tracking error and its first time

derivative. Chang et al. [18] applied fuzzy-scheduling controlto a linear permanent magnet synchronous motor with payload variations. They implemented the technique adopted in

[16]. Allaoua et al. [19] studied DC motor scheduling PID con-trol with particle swarm optimization strategy and comparedthe results with those of fuzzy logic controller. Ghafari and

Alasty [20–22] implemented gain scheduling PID fuzzy con-troller for hybrid stepper motor. He did not consider rotorflexibility nor load variations (Fig. 1).

The aim of this paper is to investigate the feasibility of afuzzy PID control for a stepping motor drive of flexible rotorand to evaluate its sensitivity for mechanical configurationchanges. The simulation allows the generation of load torque

and inertia variations, which are the main disturbances, foundin the control machine tools and robotic manipulators. Thesetwo mechanical variations are generated in order to test the

system response to external disturbances and the effectivenessin the plant parameters. The scope of this work is limited to thestudy of the control of permanent magnet stepper motor

(PMSM).

2. System mathematical model

2.1. Modeling of a permanent magnet stepper (PMS) motor

This section provides a brief derivation of a nonlinear model ofthe 2-phase PM stepper motor. A number of references are

available on the generation of stepper motor model [1,2].The rotor shaft dynamics are given by:-

Jmdxdt¼ Tm � Fx� TL ð1Þ

Jm = Total inertia of the rotor, F = Viscous friction coeffi-cient, TL = Load torque.The angular velocity is given:-

The above Eq. (1) forms the basis for a general rotor

dynamics model of a PM stepper motor. Hence for a 2 phasePM motor with P rotor pole pairs and the two phases (uj) at 0and (p/2) the following state space equations can be derived.

dhdt¼ x

dxdt¼ Km

Jmð�ia sinPhþ ib cosPhÞ � F

Jmx� TL

Jmdiadt¼ �R

Lia þ

Km

Lx sinPhþ ua

Lð2Þ

dibdt¼ �R

Lib �

Km

Lx cosPh� ub

L

where, x is the angular velocity, dxdtis the load acceleration, dia

dtis

the current through winding a, dibdtis the current through wind-

ing b.

2.2. Flexible shaft

Considering the case when the load is connected to the motor

through a long stiff shaft with stiffness k, then the motor iner-tia will be Jm and the load inertia will be JL as shown in Fig. 3.

In this case, the load and flexible shaft equation will be:-

dhL

dt¼ xL ð3Þ

dxL

dt¼ 1

JL½ð�kðhL � hmÞ � BðxL � xmÞÞ�

A classical control technique for PMSM is based on park’stransformation [1]. That is, the transformation of the vector(u) and (i) expressed in the fixed stator frame (a, b) into vectorsexpressed in a frame (d, q) that rotates along the fictitious exci-

tation vector such that:

Xd

Xq

� �¼

cosPh sinPh

� sinPh cosPh

� �Xa

Xb

� �

The state Eq. (2) expressed in terms of currents and voltages inrotating (d, q) coordinates become:

Figure 1 Flexible rotor system.

Page 3: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

Stepper motor

PID Controller

ω,ud

uq

θr, ω r

+

Figure 2 Block diagram of PID controller.

Adaptive PID control of a stepper motor driving a flexible rotor 129

dhm

dt¼ xm

dxm

dt¼ Km

Jmiq �

F

Jmxm �

TL

Jm� 1

Jmfkðhm � hLÞ þ Bðxm � xLÞg

diddt¼ �R

Lid þ Pxm � iq þ

udL

diqdt¼ �R

Liq � Pxm � id �

Km

Lxm þ

uqL

ð4Þ

3. Stepper motor control

The control objective is to find the suitable control variables

(ud, uq) so that the system tracks desired load angular positionand velocity with accepted errors while keeping the states andcontrol variables bounded too.

There are many internal and external uncertainties that

may affect the performance of the controlled system. Theseuncertainties are the stiffness of the flexible shaft, the inertiaof the rotor.

0 0.1 0.2 0.3 0.4 0.5-10

0

10

20

Time,s

Mo

tor

po

sitio

n,ra

d

Response of motor position

Reference signalmotor position

Figure 4 Response of PMSM with PID control

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5-1

0

1

2

3

4

Time,s

Mot

or p

ositi

on,r

ad

Response of motor position

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5-200

0

200

400

600

Time,s

Mot

or s

peed

,rad

/s

Response of motor speed

Reference signalmotor speed

Reference signalmotor position

Figure 3 Response of PMSM with PID control subjected to step

input of motor position and motor speed.

Two control laws will be considered

1. Static PID control law.

2. Intelligent control law which implements fuzzy logic con-trol to adapt the static PID control law.

3.1. Static proportional-integral-derivative (PID) control law

Fig. 2 shows the block diagram of closed-loop PID control. udand uq denote the controller’s output signal, xr and hr are thereference angular speed and angular displacement, respec-tively. The control closed loop outputs are the actual angular

displacement and speed (h, x). The PID gains are: K1, K2,K3 are the proportional, integral and derivative control gainsrespectively. The approach of Ref. [1] of selecting PID gains

is adopted in order to compare results for the same motorspecifications. According to Ref. [1], the static PID controloutput can be put in the form;

uq ¼ Kmx� K4ðiq � iqrÞ � K5

Z t

0

½iqðsÞ � iqrðsÞ� � ds

ud ¼ �PLx � iq � K4ðid � idrÞ � K5

Z t

0

½idðsÞ � idrðsÞ� � ds

with ð5Þidr ¼ 0

iqr ¼JmKm

K1ðh� hrÞ þ K2

Z t

0

½hðsÞ � hrðsÞ�dsþ K3ðx� xrÞ� �

where iq, id are the actual current in rotating (d, q) and iqr, idrare the reference current in rotating (d, q).

The controller gains are tuned for (Jm = 0.08 kg m2,B = 3 Nms/rad, L = 3 Henry, R= 3 X, P = 6, Km = 2 Nm/rad). The values of the gains in SI units are: K1 = 80,000,

K2 = 651K1, K3 = 500, K4 = L/T, K5 = R/T, andT = 0.0005.

T is the equivalent time constant of the current loops .With

the above choice of K4 and K5, the current loop transfer func-tion is,

0 0.1 0.2 0.3 0.4 0.5-50

0

50

100

Time,s

Mot

or

spee

d,ra

d/s

Response of motor speed

Reference signalmotor speed

subjected to arbitrary reference input signal.

Page 4: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

0 0.1 0.2 0.3 0.4 0.5-1.5

-1

-0.5

0

0.5

1

1.5x 10

4

Time,s

Load

pos

ition

,rad

Response of load position

k=16.5k=30k=50k=120k=200

0 0.1 0.2 0.3 0.4 0.5-1.5

-1

-0.5

0

0.5

1x 10

6

Time,s

Load

spe

ed,r

ad/s

Response of load speed

k=16.5k=30k=50k=120k=200

Figure 5 Position and speed response of PMSM with flexible shaft at different stiffness (k), and JL = 0.08 kg m2.

0 0.1 0.2 0.3 0.4 0.5-2

-1.5

-1

-0.5

0

0.5

1

1.5

2x 10

6

Time,s

Load

spe

ed,r

ad/s

Response of load speed

JL=0.05JL=0.08JL=0.1JL=0.5

0 0.1 0.2 0.3 0.4 0.5-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5x 10

4

Time,s

Load

pos

ition

,rad

Response of load position

JL=0.05JL=0.08JL=0.1JL=0.5

Figure 6 Position and speed response of PMSM with flexible shaft at different load inertia (JL), k= 16.5 N m/rad.

0 0.1 0.2 0.3 0.4 0.5-1

0

1

2

3

4

5

6

7

Time,s

Load

pos

ition

,rad

Response of load position

K2=0.5*K1K2=5*K1K2=10*K1K2=20*K1

Figure 7 Effects of integral gain K2 on load position response,

k= 16.5 N m/rad, J = 0.08 kg m2, K = 80,000 and K = 500.

130 N.M. Elsodany et al.

iqðsÞiqrðsÞ

¼ idðsÞidrðsÞ

¼ 1

1þ TS

where the break frequency = 1/T = 2000 rad/s. The gain K1 ischosen so that natural resonant frequency is 285 rad/s and the

damping ratio is equal to 0.9. K3 is chosen so that 1/K3 = 4T.The closed-loop system, based on the choice of poles, is stableupon using the above PID gains and system parameters.

3.1.1. Performance of PID control with rigid shaftThe PID control is required to track two different referencedsignals: step input and any arbitrary reference signals. The

nominal value of the inertia is 0.01 kg m2 and the load torqueis 2 N m. The simulation is based on the rigid shaft Eqs. (2)and (4). The system responses of the PID controller are ob-

tained and reported in Fig. 3 for step input signal. It can be no-ticed from the figures, that at the beginning the responseexhibits an oscillation and the system reach to the desired po-

sition at 0.05 s. The PID control guarantees the desired refer-ence position and speed in short time.

The second test for tracking is the typical position reference

trajectory br (t) with trapezoidal speed reference xr (t). Fig. 4shows the response of motor position error, motor positionand motor speed. The simulated results are the same as that

obtained Ref. [1]. It is clear that the stepper motor recoveredthe targeted position with a small overshoot.

L 1 3

Page 5: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

-200

-100

0

100

200

300

Load

spe

ed,ra

d/s

Response of load speed

K3=400K3=500K3=700K3=1000

Adaptive PID control of a stepper motor driving a flexible rotor 131

3.1.2. PID control for a stepper motor with flexible rotorIn this section the mechanical variations such as (load torqueand the stiffness of the system) are generated in order to testthe response of the PID control upon adding an external

disturbance.

3.1.2.1. Classical PID control with fixed gains. The PID con-

trollers gains are held constant: K1 = 80,000,K2 = 65*80,000, K3 = 500. The equations of the flexible shaftEq. (4) were added to the system model. A step input reference

signal is considered. The obtained results are presented inFigs. 5–8. In these figures, the effects of changing the shaftstiffness from k= 16.5 to 200 N m/s and the inertia load fromJL = 0.05–0.5 kg m2 on the time response of load position, the

load speed are reported It can be shown that the performance

0 0.1 0.2 0.3 0.4 0.5-300

-200

-100

0

100

200

300

Time,s

Load

spe

ed,r

ad/s

Response of load speed

K2=0.5*K1K2=5*K1K2=10*K1K2=20*K1

Figure 8 Effects of integral gain K2 on load speed response,

k = 16.5 N m/rad, JL = 0.08 kg m2, K1 = 80,000 and K3 = 500.

0 0.1 0.2 0.3 0.4 0.5-1

0

1

2

3

4

5

6

Time,s

Load

pos

ition

,rad

Response of load position

K3=400K3=500K3=700K3=1000

Figure 9 Effects of derivative gain K3 on load position response,

k = 16.5 N m/rad, JL = 0.08 kg m2, K1 = 80,000 and K2 =

0.5K1.

0 0.1 0.2 0.3 0.4 0.5-300

Time,s

Figure 10 Effects of derivative gain K3 on load speed response,

k = 16.5 N m/rad, JL = 0.08 kg m2, K1 = 80,000 and K2 =

0.5K1.

Time,s0 0.1 0.2 0.3 0.4 0.5

-1

0

1

2

3

4

Load

pos

ition

,rad

Response of load potsition

K1=8000K1=10000K1=50000K1=80000

Figure 11 Effects of proportional gain K1 on position response,

k = 16.5 N m/rad, JL = 0.08 kg m2, K2 = 0.5K1 and K3 = 1000.

of the fixed gain PID controller is not satisfactory and the sys-

tem is unstable To improve the system performance and to beable to track the reference load position and speed, the PIDgains should be varied continuously.

3.1.2.2. Effects of PID gains on the response and uncertainties.In this section the PID gains K1, K2 and K3 are changed to ob-

tain stable performance at different shaft stiffness and inertiaload. Sample of these results reported in Figs. 7–12. It canbe noticed that the oscillations were damped and the system

become stable. As both the shaft stiffness and the inertiachange, there will be another optimum set of PID constantsto track the desired load position and speed. The above proce-dures were repeated for different values of k and JL to obtain

Page 6: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

132 N.M. Elsodany et al.

the data base required in learning process of the Fuzzy logic

gain scheduling mechanism.

3.2. Fuzzy PID (FPID)

The Fuzzy logic control is used to tune the parameters of thePID controller on line. This is achieved by scheduling the gainsof the PID control based on system performance indices as

shown in Fig. 13.

Response of load speed

0 0.1 0.2 0.3 0.4 0.5-50

0

50

100

150

200

Time,s

Load

spe

ed,ra

d/s

K1=8000K1=10000K1=50000K1=80000

Figure 12 Effects of proportional gain K1 on speed response,

k= 16.5 N m/rad, JL = 0.08 kg m2, K2 = 0.5K1 and K3 = 1000.

Stepper motor

PID Controlle

r

ω,

uq

r, ωr ud

Gain schedule

Performanceindices

Figure 13 Block diagram of fuzzy PID controller.

0 100 200 300 400 5000

0.2

0.4

0.6

0.8

1

max error of speed(input1)

LowmediumHigh

Figure 14 Membership functions

4. Optimum fuzzy gain scheduling mechanism

Numerical simulations were carried out upon varying the shaft

stiffness (k) from 16.5 to 200 N m/rad and the load inertia (JL)from 0.01 to 5.0 kg m2. This task has two-fold aim, the first isto determine the control parameters which are robust to thesevarying operating conditions and the second is to identify the

indices that will drive the gain scheduling mechanism. Thechanges in the integral controller gain K2 may render unstableresponse. Comparing Figs. 7 and 8 with Figs. 5 and 6, it can be

noticed that the closed loop is stable as the ratio of K2 to K1 isdecreased. It was found that maintaining the value of K2 to0.5K1 realizes the most stable damped performance at all oper-

ating conditions. K2 is not fixed but it will be changed as K1

changes.

4.1. Fuzzy model for K

The fuzzy system has two antecedents (eh,max and ex,max) andone consequent K3. The inference system is based on the

TSK model. The Gaussian membership function (MF) shownin Fig. 14 produced better results than the triangular member-ship function. The Guassian MFs have smooth transition

which is required with derivative gain.The system has a single output, which is a crisp value that

corresponds to the derivative gain K3. The output has three

values: mf1 = 500, mf2 = 900 and mf3 = 1000.The inference rules are:

- If (input1) is low and (input 2) is high, then K3 is mf3.

- If (input1) is medium and (input 2) is medium, then K3 ismf2.

- If (input1) is high and (input 2) is low, then K3 is mf1.

4.2. Fuzzy model for K1

The indices are the instantaneous error in both load position(eh) and load speed (ex). The fuzzy system has two antecedents

(eh and ex) and one consequent (K1). The inference system isbased on Mamdani model. It was found that both Guassianand triangular MFs have same results. This is because the

0 1 2 3 40

0.2

0.4

0.6

0.8

1

max error of position(input2)

LowmediumHigh

generated by Sugeno method.

Page 7: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

-4 -3 -2 -1 0 1 2 3 40

0.2

0.4

0.6

0.8

1

instantaneous error of position

NLNSZPSPL

-80 -60 -40 -20 0 20 40 60 800

0.2

0.4

0.6

0.8

1

instantaneous error of speed

NLNSZPSPL

(a) (b)

0 1 2 3 4 5 6 7 8 9x 10

4

0

0.2

0.4

0.6

0.8

1

123

(c)

Figure 15 Membership functions generated for the fuzzy model of K1 a-input eh b-input ew c-output K1.

Adaptive PID control of a stepper motor driving a flexible rotor 133

universe of discourse in this case is small for the two anteced-ents. The triangular membership functions are applied as

shown in Fig. 15 since it is simpler in computation.The inference rules are:

- If eh is NS and ex is PL then K1 is 2.- If eh is NS and ex is NS then K1 is 1.- If eh is PS and ex is NL then K1 is 2.

0 0.5 1 1.5 2-1

0

1

2

3

4

5

Time,s

Load

pos

ition

,rad

Response of load position

FUZZY PIDPIDReference signal

Figure 16 Load position with PID and fuzzy PID

(JL = 0.08 kg m2, k = 16.5 N m/rad).

- If eh is PL and ex is Z then K1 is 2.- If eh is NL and ex is PS then K1 is 3.

- If eh is Z and ex is PL then K1 is 2.- If eh is PL and ex is PS then K1 is 1.

Stability of fuzzy PID controlled system is discussed inAppendix B.

0 0.5 1 1.5 2-1

0

1

2

3

4

5

6

Time,s

Load

pos

ition

,rad

Response of load position

FUZZY PIDPIDReference signal

Figure 17 Load position with PID and fuzzy PID

(JL = 0.5 kg m2, k = 30.N m/rad.

Page 8: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

134 N.M. Elsodany et al.

5. Results of the fuzzy PID

The PID and FPID are required to track two reference signals:

step input signal as shown in Fig. 3 and an arbitrary trapezoi-dal reference signal as illustrated in Fig. 4. The PID gains areheld constants at K1 = 80,000, K2 = 0.5*80,000, andK3 = 500 for all simulations to guarantee stable response.

5.1. Results of step input signal

Figs. 16–19 show that fuzzy gain scheduling of the PID con-troller performs better than the conventional PID controller.It is clear that the oscillations are damped upon using FPID

controller and the response is fast. FPID is robust to plantparameter variations such as inertia change and stiffness. Itcan be noticed that the output gain from fuzzy control is vary-

ing when changing the mechanical configuration as shown inFig. 20. The output control signals are stable, smoother fasterand less than that resulted from the PID control as depicted in

0 0.5 1 1.5 2-200

-100

0

100

200

300

Time,s

Load

spe

ed,ra

d/s

Response of load speed

FUZZY PIDPIDReference signal

Figure 18 Load speed response with PID and fuzzy PID

(JL = 0.08 kg m2, k= 16.5 N m/rad).

0 0.5 1 1.5 2-100

-50

0

50

100

150

Time,s

Load

spe

ed,ra

d/s

Response of load speed

FUZZY PIDPIDReference signal

Figure 19 Load speed with PID and fuzzy PID (JL = 0.5 kg m2,

k= 30.N m/rad).

Figs. 21 and 22. Therefore the power is saved upon using the

FPID control which is useful from industrial point of view.

5.2. Results of arbitrary trapezoidal reference signal

Figs. 23 and 24 illustrate the load position and load speed ob-tained with FPID and PID control. It can be seen that FPIDperformance is much better than the conventional PID control

scheme. Fuzzy self-tuning controller demonstrates a very quickresponse and little overshoot, because the fuzzy self-tuningcontrol is based on the function relationship among the errors,

parameters K1, K3, and operation experiences.

6. Conclusion

The feasibility of fuzzy gain scheduling control for steppingmotor driving flexible rotor has been investigated and

0 0.5 1 1.5 2 2.5 3820

840

860

880

900

920

940

Time,s

Out

put g

ain

K3

Output gain from FPID

k=30,JL=0.5k=16.5,JL=0.08

Figure 20 Output gain K3 variations with FPID control for

different stiffness and load inertia.

0 0.5 1 1.5 2-5000

0

5000

Time,s

volta

geuq

,v

Maximum uq

FUZZY PIDPID

Figure 21 Output control voltage uq from PID and FPID

controller (JL = 0.08 kg m2, k= 16.5 N m/rad).

Page 9: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

0 0.1 0.2 0.3 0.4 0.5-50

0

50

100

150

Time,s

Load

spe

ed ,r

ad/s

Response of load speed

Reference signalFUZZY PIDPID

Figure 23 Reference load speed signal and controllers response

at JL = 0.08 kg m2, k = 16.5 N m/rad.

0 0.1 0.2 0.3 0.4 0.5-5

0

5

10

15

Time,s

Load

pos

ition

,rad

Response of load position

Reference signalFUZZY PIDPID

Figure 24 Reference load position signal and controllers

response at JL = 0.08 kg m2, k = 16.5 N m/rad.

0 0.5 1 1.5 2

-4000

-2000

0

2000

4000

6000

Time,s

volta

geuq

,vMaximum uq

FUZZY PIDPID

Figure 22 Output control voltage uq from PID and FPID

controller at JL = 0.5 kg m2, k= 30 N m/rad.

Adaptive PID control of a stepper motor driving a flexible rotor 135

illustrated by numerical simulation. The proposed control was

concernedwith the permanentmagnet stepmotor (PMSM)withmechanical variations such as stiffness of rotor and load inertia.Amathematical model for the PMSMwas derived and the gainsof a conventional PID control were presented. The data base re-

quired in learning process of the fuzzy logic gain schedulingmechanism was obtained from the mathematical model. BothFPID and PID control are required to track step input reference

signal and arbitrary trapezoidal input signal. For rigid rotor andspecified load inertia the conventional PID control guaranteesthe desired step reference position and speed in short time and

the performance is less satisfactory with trapezoidal referencespeed signal, but For flexible rotor and variable load inertiathe performance of constant gain PID is unstable. It was found

that the stable value for the integral gain is half the value of theproportional gain. The fuzzy system for scheduling the deriva-tive gain K3 has two antecedents which are the maximum errorsin both load position and speed and one consequent K3.The

inference system is based on the TSK model. The Gaussianmembership function produced the best results. The fuzzy sys-tem for scheduling the proportional gainK1 has two antecedents

which are the instantaneous errors in both load position andspeed and one consequent K1.The inference system is based onthe Mamdani model. The triangular membership function

(MF) produced the best results. The conducted simulationshowed that the fuzzy system is able to adapt the controller gainsto track the desired load and speed responses. FPID perfor-mance is much better than the conventional PID control

scheme. Fuzzy self-tuning controller demonstrates a very quickresponse and little overshoot, because the fuzzy self-tuning con-trol is based on the function relationship among the errors,

parameters K1, K3, and operation experiences. The output con-trol voltage and current produced by FPID are stable, smootherand faster than that resulted from the PID control. The output

control signals from FPID are much less than these from thePID. Therefore, the control power is saved upon using the FPIDcontrol which is useful from industrial point of view. Although

the FPID is trained based on step input response, it is able totrack an arbitrary trapezoidal reference signal.

Appendix A

(See Tables A-1 and A-2).

Table A-1 Motor simulation specification.

Motor parameters Symbol Value Units

Rotor inertia Jm 0.01 Kg m2

Viscous friction B 0.05 N-m-s^2/rad

Self inductance of winding L 0.006 Henry

Resistance in phase winding R 3 Ohm

Number of pole pairs p 6

Motor torque constant Km 2 N m/A

Load torque TL 2 N m

Table A-2 Flexible rotor simulation specification.

Flexible rotor parameters Symbol Value Units

Load inertia JL From 0.08 to 5 Kg m2

Stiffness k From 16.5 to 200 N m

Page 10: Adaptive PID control of a stepper motor driving a flexible ...motodrive.ir/wp-content/uploads/2014/07/Adaptive-PID-control-of-a... · The classical closed-loop control of the stepper

136 N.M. Elsodany et al.

Appendix B

PID stability: Since the gains of PID controller were chosen to

satisfy certain pole placement, therefore the controlled systemis stable unless the system parameters are changed.

Fuzzy PID stability: According to Eq. (5), the control volt-ages are determined based on determining the desired current

iqr and idr through the PID control. Considering the variationin the load and the rotor stiffness as disturbances, then Eq. (4)can be rearranged in the form:

K ¼ gðex; ehÞ

Assuming the disturbances are bounded, then �ee U where U isa compact set andZU

d�e ¼ V <1

For any g € L2(U), there exists a continuous function ~g on Usuch that

ZU

jg� ~gj2:d�e

� �12

< e:=2

By the Universal Approximation Theorem, there exists fuzzy

approximation f�eÞ such that

suph2Ujfð�eÞ � ~gð�eÞj < e

2V12

� �

Fuzzy system for Ki is developed based on numerical simula-

tions considering wide range of disturbances such that,

K ¼ fð�eÞ ¼Pm

i¼1y�iðQn

i¼1lFiðeiÞÞPmi¼1Qn

i¼1lFiðeiÞ�

So the fuzzy system is considered as an approximation for

ggð�eÞ, therefore:ZU

jfð�eÞ � gð�eÞj2d�e

� �12

6

ZU

jfð�eÞ � gð�eÞj2d�e

� �12

þZU

jgð�eÞ�

� ~gð�eÞj2d�e

6

ZU

suph2Ujfð�eÞ � ~gð�eÞj2d�e

� �12

þ e=2

6 ð e2

4V:VÞ þ e

26 e

References

[1] Petar Crnosija, Microcomputer implementation of optimal

algorithms for closed-loop control of hybrid stepper motor

drives, I EEE Transactions on Industrial Electronics 47 (2000).

[2] Miodrag Bolic1, Vujo Drndarevic, Branko Samardzic,

Distributed measurement and control system based on

microcontrollers with automatic program generation, Sensor

and Actuators 90 (2001).

[3] D.O. Carrica, S.A. Gonz_alez, M. Benedetti, A high speed

velocity control algorithm of multiple stepper motors,

Mechatronics (2004).

[4] Ali Selk Ghafari, Mehdi Behzad, Investigation of the micro -step

control positioning system performance affected by random

input signals, Mechatronics 15 (2005).

[5] M.P. Henry, Keynote paper, Control Engineering 3 (7) (1995).

[6] R. Marino, S. Peresada, P. Tomei, Nonlinear adaptive control

of permanent magnet step motors, Automatica 31 (11) (1995).

[7] Frank betin, Daniel Pinchon, Gerare Andro Capolino, Fuzzy

logic applied to steed control of a stepping motor drive, I EEE

Transactions on Industrial Electronics 47(3) 9 (2000).

[8] Sergey Ddward Lyshevski, Motion control of electromechanical

servo devices with permanent-magnet stepper motor,

Mechatronics 7 (6) (1997).

[9] Xuquan Li, Jiangping Chen, Zhijiu Chen, WeihuLiu, Wei Hu

Xiaobing Liu, A new method for controlling refrigerant Flow in

automobile air conditioning, Applied Thermal Engineering 24

(2004).

[10] J. Xu, C.C. Hang, C. Liu, Parellel structure and tuning of a

fuzzy PID controller, Automatica 36 (5) (2000) 673–684.

[11] R.K. Mudi, N.K. Pal, A self-tuning fuzzy PI controller, Fuzzy

Sets Systems 115 (2) (2000).

[12] J. Carvajal, G. Chen, H. Ogmen, Fuzzu PID controller; design,

performance evaluation, and stability analysis, Information

Sciences 123 (3) (2000).

[13] Z. Ming-fa, C. Yan, Z. Zhi-yuan, D. Chun, D. Yu, Research of

complex fuzzy control on-off magnetism team motor speed-

adjusting, Power Electronics and Motion Control Conference,

IPEMC 2006. CES/IEEE 5th International, (2006).

[14] Y. Tipsuwan, JiraSrisabye, and S. Kamonsantiroj, An

experimental study of network-based DC motor speed control

using SANFIS, IECON 2007, 33rd Annual Conference of the

IEEE, Industrial Electronics Society, pp 426–432 (2007).

[15] Y. Zhao, E.G. Collins Jr., Fuzzy PI control design for an

industrial weigh belt feeder, IEE Transactions on Fuzzy Systems

11 (3) (2003) 311–319.

[16] Y.-H. Chang, Y.-Y. Wang, M.-H. Hung, P.-C. Chen, Fuzzy-

scheduling integral control of induction servo motor with

actuator saturation via LMI approach, International Journal

of Computer Applications in Technology 27 (2/3) (2006) 107–

118.

[17] A. Hazzab, I. Bousserhane, M. Zerbo, P. Sicard, Real time

implementation of fuzzy gain scheduling of PI controller for

induction motor machine control, Neural Processing Letters 24

(3) (2006) 203–215.

[18] Y.-H. Chang, Y.-Y. Wang, M.-H. Hung, P.-C. Chen, Fuzzy-

scheduling control of a linear permanent magnet synchronous

motor with payload variations, Procceedings IMechE, Journal

Systems and Control Engineering 222 (2008) 465–479.

[19] B. Allaoua, B. Gasbaoui, I. Mebarki, Setting up PID DC motor

speed control alteration parameters using particle swarm

optimization strategy, Leonardo Electronic Journal of

Practices and Technology (14) (2009) 19–32.

[20] A.S. Ghafari, A. Alasty, Design and real-time experimental

implementation of gain scheduling PID fuzzy controller for

hybrid stepper motor in micro-step operation, Proceedings of

IEEE, ICM’04 (2004) 421–426.

[21] Thanassis Speliotisa, Dimitris Niarchosa, Patrick Meneroudb,

G. Magnacb, Franck Claeyssenb, John Pepinc, Claude

Fermond, M. Pannetierd, N. Biziered, Micro-motor with

screen-printed rotor Magnets, Journal of Magnetism and

Magnetic Materials 2 (1997).

[22] John R. Rogers, Kevin Craig, On-hardware optimization of

stepper motor system dynamics, Mechatronics 15 (2005).