You are on page 1of 17

International Journal of Machine Tools & Manufacture 46 (2006) 11071123

www.elsevier.com/locate/ijmactool

Virtual CNC system. Part I. System architecture


Chi-Ho Yeunga, Yusuf Altintasa, Kaan Erkorkmazb,*
a

Manufacturing Automation Laboratory University of British Columbia, Department of Mechanical Engineering,


2324 Main Mall, Vancouver, BC, Canada V6T 1Z4
b
Department of Mechanical Engineering, University of Waterloo, 200 University Avenue West, Waterloo, Ont., Canada N2L 3G1
Received 8 July 2005; accepted 4 August 2005
Available online 29 September 2005

Abstract
The paper presents a comprehensive virtual simulation model of a realistic and modular CNC system. The Virtual CNC architecture
represents an actual CNC, but with modular feed drives, sensors, motors, and amplifiers. The CNC software library includes a variety of
trajectory interpolation and axis control laws. Constant, trapezoidal and cubic acceleration profiles can be selected as a trajectory generation
module. The control laws can be selected ranging from a simple PID to complex Pole Placement, Generalized Predictive Control or Sliding
Mode Controller with friction compensation. When the Virtual CNC is assembled, its performance can be tested using frequency and time
domain response analyses, which are automated. The Virtual CNC includes both analytical tuning methods for linear controllers, as well as
Fuzzy Logic based expert auto-tuning system for Adaptive Sliding Mode Control. The paper includes detailed experimental verification of
the Virtual CNC.
q 2005 Elsevier Ltd. All rights reserved.
Keywords: Virtual machining; CNC; Modeling; Controls; Interpolation

1. Introduction
The objective of the Virtual Manufacturing technology is
to design a completely digital factory where the part is
modeled, machined with optimized process parameters, and
resulting errors are predicted with corrective actions being
taken in a computer simulation environment. This paper
presents a Virtual model of a CNC system for machine
tools.
The CNC system consists of mechanical feed drives,
motors, amplifiers, position-velocity-acceleration sensors,
and real-time computer algorithms which generate time
stamped position commands through trajectory generation
and close the axis servo loops [1]. The Virtual CNC requires

* Corresponding author. Tel.: C1 519 885 1211 5214; fax: 1 519 885
5862.
E-mail addresses: cyeung@mech.ubc.ca (C.-H. Yeung), altintas@
mech.ubc.ca (Y. Altintas), kaane@mecheng1.uwaterloo.ca
(K. Erkorkmaz).

0890-6955/$ - see front matter q 2005 Elsevier Ltd. All rights reserved.
doi:10.1016/j.ijmachtools.2005.08.002

a realistic mathematical model of each CNC component and


their logical interconnection.
There has been significant research reported in modeling
various trajectory generation algorithms [24], control laws
[59], and physical components of the drives such as
motors, amplifiers, ball-screw and linear drives with various
friction characteristics [1013]. The majority of the past
research focused on trajectory generation, modeling and
identification of feed drive dynamics, and control law
development. When the trajectory generation leads to
discontinuous position commands, their first (velocity),
second (acceleration) and third (jerk) derivatives contain
fluctuation and sudden changes. High fluctuation in the
velocity results in poor feeds as well as high frequency
content beyond the bandwidth of the closed loop system,
which leads to poor tracking. High frequency content in
acceleration and large jerk commands may excite structural
modes of the machine, which are not desirable. To deal with
these problems, Pritschow [14] recommended jerk-limited
trajectories with trapezoidal or sine square acceleration
profiles, favoring the latter for better continuity. Chen and
Tlusty [2] also used the jerk-limited trajectories with
trapezoidal acceleration profiles in their feed drive

1108

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

development work. Later, Erkorkmaz and Altintas [4]


developed a trajectory generation with cubic acceleration
profiles for high speed milling operations.
Typically, the position errors originating from the CNC
are dependent on the robustness and tracking ability of the
axis control laws. Pritschow [8] noted the importance of
achieving high servo bandwidth, in order to be able to track
sudden changes in the motion commands accurately, while
rejecting disturbances originating from axis friction and
cutting forces. Tomizuka [9] developed the Zero Phase
Error Tracking Controller (ZPETC), which provides a wide
bandwidth with zero phase delay. This design philosophy is
based on the cancellation of stable components of the closed
loop servo dynamics in a feedforward fashion. Boucher et
al. [6] used cascaded Generalized Predictive Control (GPC)
for accurate tracking of velocity and position commands.
Erkorkmaz and Altintas [5,12] applied the Sliding Mode
Control (SMC) technique for the control of high speed feed
drives. They first designed a SMC based on the rigid body
dynamics alone. Later, they improved their control
methodology to actively compensate the effect of the
structural flexibilities of ball screw drives.
Numerous publications have dealt with the modeling and
identification of the dynamics of the machine tools feed
drive system. Koren [15] used a simple first order linear
model for identifying the dynamics of classical feed drives.
In a lead screw driven mechanism, non-linear guideway
friction becomes a significant factor in degrading the
tracking and contouring accuracy, especially at motion
reversals in sharp corners and circular arc quadrants.
Armstrong et al. [10] presented an excellent survey on the
physics behind the friction phenomenon. They pointed out
that the typical friction characteristics for lubricated
metallic surfaces in contact could be described by the
Stribeck curve. Backlash is also responsible for the motion
accuracy limitation of CNC machine tools. Kao et al. [13]
reported an analytical method to observe and model the
backlash behavior on the motion accuracy of CNC lathes.
Tuning plays an important role in controller design. Over
the last two decades, the use of fuzzy logic control has been
widely proposed in literature for auto-tuning control
parameters. de Silva and MacFarlane [16] conducted
research on auto-tuning servo controllers through a
hierarchical, multi-level system that could be applied in
the control structure of industrial robotic manipulators.
Wickramarachchi and de Silva [17,18] applied a knowledge-based hierarchical control system for fish processing
applications. Later, de Silva [19] investigated an analytical
framework for knowledge-based tuning of servo controllers.
He pointed out that a substantial reduction in computational
effort could be achieved through the application of the
analytical framework. Goulet et al. [20] has also used a
hierarchical control structure for a deployable orbiting
manipulator. They addressed the advantages of combining
crisp conventional control with knowledge-based fuzzy

logic control for stabilizing a space-based manipulator with


flexible deployable and slewing links.
Henceforth, the paper is organized as follows. The
architecture of the Virtual CNC system is presented in
Section 2, which includes the mathematical modeling of
actuators, friction, trajectory generation and control laws.
Fuzzy logic auto tuning of the axis control law is shown in
Section 3. The Virtual CNC is experimentally verified in
contouring standard diamond and circular paths in Section 4,
and the paper is concluded in Section 5.

2. Virtual CNC architecture


The Virtual CNC system must be able to predict the
performance of a real CNC system during part machining.
The mathematical models of all working modules of a real
CNC must be identified and integrated as in a real CNC
system for accurate prediction of part machining performance. The architecture of the developed Virtual CNC system
is illustrated in Fig. 1, which resembles the real,
reconfigurable and open CNC developed in the Manufacturing Automation Laboratory, UBC [21]. The Virtual CNC
system accepts reference toolpath generated on CAD/CAM
systems in the form of industry standard Cutter-Location
(CL) format. Each block in the CL file contains NC block
numbers, tool paths in the form of linear, circular and spline
segments, the cutter dimensions, tool center coordinates,
and feed speed for machining a particular part on a CNC
machine tool. Each tool path segment, such as linear,
circular or spline path, is passed through the trajectory
generation algorithm which creates displacement, feed,
acceleration and jerk expression at divided segments [1].
Trajectory generation sets up the real time interpolation
parameters such as discrete displacement along the path and
its frequency. The interpolator generates discrete displacement commands for each axis at every control interval. The
axis commands are passed on to the control law, which
shapes the overall response of the feed drive transfer
function, consisting of Digital to Analog (D/A) converter,
amplifier, servo motor, inertia, viscous damping, guideway
friction and lead screw backlash. The axis can be configured
to have acceleration, velocity and position sensors with
defined accuracy and noise parameters. The position error of
each axis is evaluated in the feedback loop and combined to
predict the contouring error at each control interval. The
user can select any control law, lead screw or linear drive
parameters, as well as amplifier, motor, friction field and
sensor so that most machine tools can be reconfigured
automatically by the user, who can add new modules or
modify the existing algorithms which are created in
MATLAB environment.
The Virtual CNC system consists of three main modules:
Feed drive, trajectory generation, and axis tracking control
modules.

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

1109

Fig. 1. Architecture of Virtual CNC system.

Fig. 2. Feed drive mechanism with a lead screw drive.

2.1. Dynamic model of feed drive


A typical ball screw drive system consists of current
amplifier, servo-motor, lead screw coupling mechanism,
ball screw with preloaded nut, table carrying the workpiece,
guideway friction and feedback sensors, as shown in Fig. 2.
The ball screw drive and rotary servo-motor are replaced by
a linear motor and bearings for direct drive feed
mechanisms. Both drive mechanisms are considered in the
Virtual CNC system.
(i)Rigid body motion: The linear dynamic model of a
classical feed drive is shown in Fig. 3. The control signal
ua [V] generated by the axis controller is applied to the
current amplifier which has a gain of Ka [A/V]. In the
motor armature, the motor dynamic torque Tm [Nm]
is produced, which is assumed to be linearly proportional
to the motor current with the motor torque constant Kt
[Nm/A]. The total dynamic torque delivered by the motor
is spent in overcoming the external disturbance torque Td
[Nm] which is due to nonlinear static and Coulomb
friction in the drive and cutting forces, and in
accelerating the inertia (J [kg/m2]) of the rigid body
motion of the table, and overcoming the systems viscous
damping (B [kg/m2/s]). In return, the angular velocity u

[rad/s] of the motor shaft is determined, and then


transferred to the angular position q [rad] through
integration. The angular position of the motor shaft is
then transmitted as a linear displacement of the table by
the ball screw and nut mechanism, which has a
transmission gain of rg [mm/rad]. Further basics of feed
drive design and modeling are given in [1].
Considering Fig. 3, the angular velocity of the motor
shaft and actual position of the table can be expressed in
Laplace domain as:
us Z


1 
K K u sKTd s
Js C B t a a


rg
rg
1 
Kt Ka ua sKTd s
xl s Z us Z
s
s Js C B

Fig. 3. Linear dynamics of a feed drive.

(1)

1110

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

or in state space as:


(
)
(
)
(
)
_
ut
ua t
ut
C Bc
Z Ac
_
xt
Td t
xt
"
#
"
#
KB=J 0
Ka Kt =J K1=J
Where Ac Z
and Bc Z
0
rg
0
0

Kdu/2 and Cdu/2 as shown in Fig. 4,


(
~
1=du; Kdu=2% u%Cdu=2
~ Z
pu
0;
otherwise
(2)

(7)

The variance Ru~ of u~ is computed as,


~ Z0
~
~ 2 0 as Eu
Ru~ Z EuKE
u

The discrete time equivalent of Eq. (2) is,


(
)
(
)
(
)
uk C 1
uk
ua k
Z Fc Ts
C Hc Ts
(3)
xl k C 1
Td k
xl k
!
Ts A t
Ac Ts
c
e dt Bc , k is the
where Fc Ts Z e , Hc Ts Z

~ Z
rRu~ Z Eu

C
N

Cdu=2

~ u~ du~ Z
pu
KN

1 2
u~ du~
du

(8)

Kdu=2

du2
12

The position measurement noise x~ is defined as,

sample counter, and Ts [s] is the digital control interval.


(ii) Saturation of actuation system: the saturation of the
actuation system is considered at the input as,
8
u ; us k! umin
>
< min
ua k Z us k; umin % us k% umax
>
:
umax ; us kO umax

~
~ Z xm kKxa k
xm k Z xa k C xk0
xk

where xa and xm are the actual and measured axis position


respectively. Similarly, x~ is assumed to have a uniform
distribution between Kdx/2 and Cdx/2 with a zero mean
and a variance of,

(4)
Rx~ Z

where us is the current (i.e. torque) command generated by


the control law and ua is the actual control signal passed to
the amplifier. umin and umax are the lower and upper
saturation limits, which are identified from torque limits of
the motor Tmin/max as,

(9)

dx2
12

(10)

where dx is encoder resolution. The tachometer measurement noise u~ is defined as:


~
~ Z uk
~ Z um kKuk
um k Z uk C uk0
uk
(11)

(iii) Quantization error and measurement noise: the


digital control command is converted into voltage for
analog drives through the Digital-to-Analog converter
circuit (DAC). The DAC quantization error u~ is assumed
to be present in the control signal after being quantized by
the DAC, which has a resolution of du:

where u and um are the actual and measured angular velocity


respectively. The profile of the tachometer measurement
noise is reasonably assumed to have a normal distribution
~ The variance of the
with zero mean and variance of Ru.
tachometer measurement noise is obtained either from the
catalog, or by monitoring the noise in the tachometer signal
when CNC is powered, but the axis is at rest.
(iv) Guideway friction: the disturbance torque Td consists
of non-linear guideway friction Tf and cutting forces Tc
reflected to the motor shaft as,

~
~ Z us kKuc k
us k Z uc k C uk0
uk

Td k Z Tf k C Tc k

1
T
umin=max Z
Ka Kt min=max

(5)

(6)

where uc is the command control signal generated by the


motion controller. The quantization error u~ has a uniform
probability distribution with zero mean and is bounded by

(12)

The dominant non-linear axis friction reflected on the


motor shaft is considered as the typical friction characteristic
for lubricated metallic surfaces in contact, which can be

Fig. 4. Quantization error of DAC: (a) Block diagram of DAC quantization, (b) Uniform probability distribution function.

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

1111

Fig. 5. Stribeck friction curve for two lubricated metallic surfaces in contact.

described by the Stribeck curve, as shown in Fig. 5. The


Stribeck curve consists of four different regions: static
friction zone, boundary lubrication zone, partial lubrication
zone, and full fluid lubrication zone [10]. Tstribeck can be
characterized analytically with sufficient closeness as:
G Ku=u1
Ku=u2
C TG
C Tvise u
TG
stribeck u Z Tstat e
counl 1Ke
G

(13)

where
Ta k ZTm kKTc k*Tm k ZKa Kt ua k

(15)

Since the effect of viscous damping is included in the


model of rigid body dynamics, the friction torque expression
in Eq. (13) is re-written, neglecting viscous damping
component as,
G

G
Kuk=u1
G
Tstribeck
uk ZTG
CTcounl
1KeKuk=u2
stat e

(16)
where Tstat and Tcoul are the static friction and the Coulomb
friction torque respectively. Tvisc is the viscous damping
(v) Backlash: The spacing or dead-zone between the
coefficient that corresponds to B in Eq. (1). u1 determines the
screw and nut creates the backlash, which is modeled by: a
spacing between the boundary lubrication and partial fluid
disengaged zone, engagement in the positive direction, and
lubrication zones. u2 determines the spacing between the
engagement in the negative direction, as shown in Fig. 6.
The analytical expressions for the backlash model are
partial lubrication and full fluid lubrication regions. The
summarized as follows,
superscript G corresponds to positive and negative
8
C
dK
x kK1;
>
e % xl k% de
>
< a
K
C
(17)
xa k Z xl kKDb =2; xl kR dC
e 0 set de Z xl kKDb and de Z xl k
>
>
:
K
K
C
xl k C Db =2; xl k% de 0 set de Z xl k and de Z xl k C Db
directions of motion. The parameters of the Stribeck friction
curve can be entered in the drive model. The characteristics
of guideway friction torque Tf in discrete time domain can be
summarized as follows,
8
0;
>
>
>
>
>
>
Ta k;
>
>
>
>
< TC ;
stat
Tf k Z
K
>
;
> Tstat
>
>
>
> C
>
>
Tstribeck uk;
>
>
: K
Tstribeck uk;

uk Z0 and Ta k Z0
K
C
uk Z0 and Tstat
!Ta k!Tstat

where Db denotes the backlash of the feed drive


mechanism. xa and xl are the actual axis position due
to backlash and the axis position obtained from Eq. (3)
C
respectively. dK
e and de are the positions of the negative
and positive ends of the dead-band. The axis position is
assumed to be located at the middle of the dead-zone at
C
initial conditions. Therefore, dK
e and de are initially set
to be:

C
uk Z0 and Ta kRTstat
O0
K
uk Z0 and Ta k!Tstat
!0

C
initial0 dK
e ZKDb =2 and de Z CDb =2

(18)

ukO0
uk!0
(14)

The parametric model of the overall feed drive is


shown in Fig. 7.

1112

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

Fig. 6. Classical dead-zone backlash model: (a) disengaged zone, (b) system engaged in positive direction, (c) system engaged in negative direction,
(d) backlash plot.

2.2. Trajectory generation mechanism


The trajectory generation mechanism implemented in
the Virtual CNC is illustrated in Fig. 8. After interpreting
the CL file, the start and end coordinates of the toolpath,
the types of the tool movement and the feedrate are
recognized and stored into a buffer. By executing the
buffer block by block, the descriptions for each toolpath

segment are obtained and then passed to the trajectory


generation process sequentially. The trajectory generation
algorithm identifies the distance to be traveled, and
divides it into acceleration, constant velocity and
deceleration sub-segments depending on kinematic profiles selected in the CNC design. The Virtual CNC
system presented here gives a choice of constant,
trapezoidal, or cubic acceleration profiles, as shown in

Fig. 7. Overall block diagram of feed drive model.

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

1113

Fig. 8. Mechanism of trajectory generation.

Fig. 9. Step changes in the constant acceleration profile


lead to infinite jerk and severe acceleration discontinuities, which contain high frequencies in the generated
position commands. Such high frequency content may
excite structural vibrations and cause severe tracking
errors in high-speed machines. Cubic acceleration leads
to much smoother position commands with continuity in
velocity, acceleration and jerk, which is better suited for
high speed and precision drives, but at the expense of
increased computational load on the CNC computer.

The details of each algorithm can be found in [22] and


are not repeated here.
2.3. Axis control module
There are a significant number of control laws, which can
be implemented in CNC systems. Typically, any axis
control law has two components: the feedforward part
which processes the reference position commands, and the
feedback part that shapes the measured states such as

1114

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

Fig. 9. Feed motion profiles: (a) constant acceleration, (b) trapezoidal acceleration, (c) cubic acceleration.

position, velocity and acceleration to stabilize the closed


loop dynamics, as shown in Fig. 10. The control law
generates the control signal command (i.e. uc(k))) which is
sent to the physical drives as:
uc k Z DT zXr kKDs zXm k


8
DT z Z dT1 z dT2 z dT2 z 1!3
>
>
>


>
>
>
D
z
Z
d
z
d
z
d
z
>
S
S1
S2
S2
1!3
<
2
3
2
3
where
xr k
xk k
>
>
>
6
7
6
7
>
>
Xr k Z 4 x_r k 5
and Xm z Z 4 x_k k 5
>
>
:
x r k 3!1
x k k 3!1
(19)
DT(z) and Ds(z) are the matrices corresponding to the
feedforward and feedback transfer functions respectively, in
the discrete time domain. Xr(k) is the reference axis
command state vector and Xm(k) is the axis measurement
state vector.
The presented Virtual CNC system has a number of
user reconfigurable control laws, which have all been
experimentally proven on our open CNC system [21].
The conventional control laws include P-PI control, PID
control and Lead-Lag control [1]. More sophisticated
control laws include Pole Placement Control (PPC) [23],
Zero-Phase Tracking Error Control (ZPTEC) [9], Generalized Predictive Control (GPC) [6], and Sliding Mode
Control (SMC) [5]. While the conventional control laws
can be found in standard control texts, details of the more
advanced control laws can be found in the referenced
articles.

initial design. Once the control law is well tuned and


optimized, further adjustments can be made on the real
machine. Depending on the structure of the control laws,
they are either analytically tuned according to desired
performance criteria, or manually tuned with trial-and-error.
Pole placement and model based control laws can be tuned
by defining the rise time, overshoot and bandwidth of the
closed loop position control system [1]. Since the analytical
tuning techniques can be found in literature, a newly
developed fuzzy logic based tuning of an adaptive Sliding
Mode Controller is presented here.
3.1. Sliding mode controller
The control law of rigid body-based Sliding Mode
Controller (SMC) for high speed feed drives is given as
follows [5]:


uSMC
k Z Je lx_r kKx_m k C x r k C Be x_m k
c
h

C KS Sk C d k

where
8
Sk Z lxr kKxm k C_xr kKx_m k
>
>
>
>
>
>
8 2
9
3
>
>
>
<
=
<


T
z
T
z
d^ kzr l4 s xr kK s xm k5 C xr kKxm k
: zK1
;
zK1
>
>
>
>
>
>
J
B
>
> Je Z
; and Be Z
;
>
:
Ka Kt rg
Ka Kt rg
(21)

3. Auto-tuning of axis control laws in virtual CNC


It is desirable to tune the feed drives in a simulated,
virtual environment, provided that the mathematical model
of the system is sufficiently accurate. The virtual tuning
allows modification to the machine tool drive mechanism as
well as proper selection of motors and sensors during the

(20)

Fig. 10. Axis control law in a standard form.

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

1115

Fig. 11. Hierarchical structure of auto-tuning strategy.

Je and Be are the equivalent inertia and viscous


damping reflected on the motor shaft respectively, S is a
stable sliding surface function and d^ is the axis
disturbance estimated using a simple observer for
adaptation. The control parameters that need to be
tuned are: sliding surface bandwidth l [rad/s], feedback
gain KS [V/(mm/s)], and disturbance adaptation gain r
[V/mm]. l is assumed to be fixed and is determined
according to the achievable bandwidth of the drive, and
the two control parameters (KS and r) are considered in
the auto-tuning of SMC.

Considering Fig. 11, the auto-tuning process has a threelevel hierarchical structure: bottom layer for SMC which
needs to be tuned, intermediate layer for system performance evaluation, and upper layer for decision making using
fuzzy logic tuning. A smooth back-and-forth motion
command is applied to the closed loop. The system
performance is observed and characterized in the intermediate layer, where descriptors of the system response
such as oscillation of the control signal, stability of the loop,
and tracking error are evaluated. If the system response is
not found to be satisfactory, then new control parameters are

Fig. 12. Fourier spectrum analysis of control signal: (a) clean signal, (b) noisy signal.

1116

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

Table 1
Primary fuzzy sets for performance attributes of OSC, PHM, and TRE
Performance attributes
OSC and
PHM

TRE

Discrete
performance
index

HIUN
LIUN

EL
LA

1
2

Index of deviation
(IOD) for OSC, PHM,
TRE

Threshold(1)%IOD
Threshold(2)%IOD !
Threshold(1)
ACCP
ME
3
Threshold(3)%IOD!
Threshold(2)
LIOQ
SM
4
Threshold(4)%IOD!
Threshold(3)
HIOQ
OK
5
Threshold(5)%IOD!
Threshold(4)
For OSC and PHM: HIOQ, over-qualified; LIOQ, little-qualified; ACCP,
acceptable; LIUN, little unsatisfactory; HIUN, highly unsatisfactory
For TRE: OK, okay; SM, small; ME, medium; LA, large; EL, extremely
large

assigned to the SMC through fuzzy logic tuning in the upper


layer. The control parameters are iteratively adjusted until
the overall system performance becomes satisfactory.
3.2. System performance evaluation and specification
System performance attributes are evaluated and classified into linguistic statements such as acceptable, overqualified, unsatisfactory, and so on. The oscillation level of
the control signal, loop stability, and tracking accuracy are
evaluated as follows.
(i) Oscillation level of control signal (OSC): a noisy
control command contains high frequency harmonics which
damages the actuators and degrades the tracking accuracy;
hence, it needs to be constrained. The frequency content and

strength of the unwanted jitter can be evaluated by


considering the Fourier spectrum of the control commands,
see Fig. 12. The index of deviation corresponding to the
oscillation level of the control signal, OSCindex, is defined as,
9
>
Sc Hmax KHmean
>
>
OSCindex Z
>
>
=
Lmax KLmean
low frequency range0 0% f % Fthresh

where

high frequency range0 Fthresh % f % Fnyquist

>
>
>
>
>
;
(22)

Fthresh is introduced as a threshold value to distinguish


between low and high frequency regions. FNyquist corresponds to the nyquist frequency, or the half of the control
sampling frequency. Lmax and Hmax are the maximum power
spectrum magnitudes of the dominant frequencies in the low
and high frequency ranges, respectively. Similarly, Lmean and
Hmean are the averages of magnitudes corresponding to the
low and high frequency ranges in the power spectrum
respectively. Sc is a scaling factor to adjust the sensitivity of
the control signal oscillation level, as needed.
(ii) Stability margin analysis (PHM): The system
stability can be analytically defined by evaluating the
phase margin (fm) of the loop frequency response as,
PHMindex Z fm Z 1808 C arg b Gl jug c

(23)

where PHMindex is the index corresponding to the system


stability. G(ju) is the loop transfer function corresponding
to the linear system model in the frequency domain. The
gain cross-over frequency ug is the frequency where the
magnitude of the loop transfer function Gl(ju) is equal to
unity.

Table 2
Mapping from index of deviation to discrete performance index
Discrete performance index

Index of deviation for OSC

Index of deviation for PHM

Index of deviation for TRE

1
2
3
4
5

1.00%OSCindex
0.75%OSCindex!1.00
0.50%OSCindex!0.75
0.25%OSCindex!0.50
0%OSCindex!0.25

PHMindex!308
308%PHMindex!408
408%PHMindex!458
458%PHMindex!608
608%PHMindex!1808

20 mm%TREindex
5 mm %TREindex!20 mm
1 mm %TREindex!5 mm
0.1 mm %TREindex!1 mm
0%TREindex!0.1 mm

Table 3
Membership functions of fuzzy input variables for OSC, PHM, and TRE
Fuzzy input variablesOSC, PHM, and TRE
5 Primary fuzzy set

Discrete performance index

For OSC and PHM

For TRE

HIUN
LIUN
ACCP
LIOQ
HIOQ

EL
LA
ME
SM
OK

1
0.7
0.3
0
0

0.7
1
0.7
0.3
0

0.3
0.7
1
0.7
0.3

0
0.3
0.7
1
0.7

0
0
0.3
0.7
1

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

1117

Table 4
Membership functions of fuzzy output variables for DKS and Dr
Fuzzy output variables DKS and Dr
7 selected fuzzy set

Representative numerical value (ci)

NL (negative large)
NM (negative medium)
NS (negative small)
ZR (no change)
PS (positive small)
PM (positive medium)
PL (positive large)

K3
1
0.9
0.8
0.7
0.6
0.5
0.4

K2
0.9
1
0.9
0.8
0.7
0.6
0.5

0
0.7
0.8
0.9
1
0.9
0.8
0.7

K1
0.8
0.9
1
0.9
0.8
0.7
0.6

C1
0.6
0.7
0.8
0.9
1
0.9
0.8

C2
0.5
0.6
0.7
0.8
0.9
1
0.9

C3
0.4
0.5
0.6
0.7
0.8
0.9
1

Table 5
Heuristic manipulation of SMC parameters
Performance attribute

Action for performance improvement

Oscillation of control signal (OSC)


System stability (PHM)
Tracking accuracy (TRE)

KS

Decrease
Decrease
No change (or slightly decrease)

No change (or slightly decrease)


Decrease
Increase (decrease if system is unstable)

(iii) Tracking accuracy (TRE): During the back-and-forth


motion cycle, the tracking error is obtained by comparing
the reference (xr) and the measured (xm) axis position at
each time step. The maximum absolute value of tracking
error (i.e. TREindex) is evaluated as,
TREindex Z maxjxr tKxm tj; 0% t% Tend

(24)

where Tend is the total duration needed for one cycle of


back-and-forth motion. Once the system performance
attributes corresponding to the oscillation level of control
signal (OSC), the system stability (PHM), and tracking
accuracy (TRE) are evaluated, they are mapped into discrete
performance indices corresponding to selected primary
fuzzy sets as shown in Tables 1 and 2.

3.3. Development of fuzzy decision table


A Fuzzy Decision Table, which is used to tune the
control law parameters in real time, is first prepared off-line
as follows.
(i) Membership functions: In development of the fuzzy
decision table, the system performance attributes and the
corresponding tuning actions must be fuzzified into predefined membership functions. In auto-tuning of SMC, the
fuzzy input variables are the system performance attributes
based on the evaluation of OSC, PHM, and TRE. The fuzzy
output variables correspond to the tuning actions that are
defined as follows: DKS and Dr denote the changes in KS
and r, respectively. The membership function for each
fuzzy input or output set is designed in a discrete tabular
form, by applying a triangular shaped function with a full

Table 6
Linguistic rules for tuning SMC
Performance attributes
Or
Or
Or
Or
Or
Or
Or
Or
Or
Or
Or
Or

If
If
If
If
If
If
If
If
If
If
If
If
If
If
If

Tuning action
OSCZ
OSCZ
OSCZ
OSCZ
OSCZ
PHMZ
PHMZ
PHMZ
PHMZ
PHMZ
TREZ
TREZ
TREZ
TREZ
TREZ

HIUN
LIUN
ACCP
LIOQ
HIOQ
HIUN
LIUN
ACCP
LIOQ
HIOQ
EL
LA
ME
SM
OK

then
then
then
then
then
then
then
then
then
then
then
then
then
then
then

DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ
DKSZ

NL
NM
ZR
PS
PM
NM
NS
ZR
ZR
PS
NS
ZR
PS
PS
ZR

and
and
and
and
and
and
and
and
and
and
and
and
and
and
and

DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ
DrZ

NS
ZR
ZR
ZR
PS
NM
NM
ZR
PS
PM
NL
NM
PL
PS
ZR

1118

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

Table 7
Fuzzy decision table for SMC tuning
Performance attributes (input)

Tuning action (output)


DKS

Dr

OSC

HIUN
LIUN
ACCP
LIOQ
HIOQ

K0.2545
K0.2456
0
0.1552
0.2456

K0.1552
0
0
0
0.1552

PHM

HIUN
LIUN
ACCP
LIOQ
HIOQ

K0.2456
K0.1552
0
0
0.1552

K0.2456
K0.2456
0
0.1552
0.2456

TRE

EL
LA
ME
SM
OK

K0.1552
0
0.1552
0.1552
0

K0.2545
K0.2456
0.2545
0.1552
0

membership grade (i.e. unity) assigned at its normalized


representative value (i.e. diagonal elements in the membership function tables). The off diagonal terms represent the
reducing weight to model the degree of fuzziness as
indicated in Tables 3 and 4.
(ii) Fuzzy linguistic rules: Expert knowledge on tuning
the sliding mode controller is expressed as a set of linguistic
rules containing reference to the defined fuzzy sets.
According to the expert knowledge and experience, the
SMC tuning rules developed are summarized in Tables 5

and 6. For example, the first row of the Table 6 is interpreted


as follows: If the oscillation level of the control signal is
highly unsatisfactory (if OSCZHIUN), then the feedback
gain (KS) must be largely decreased and disturbance estimator gain (r) must be slightly decreased (then DKSZNL
and DrZNS).
(iii) Fuzzy composite relation table: The performance
attributes of the controller, the tuning actions, and the rules
of tuning must be related to each other using fuzzy
composite relationship functions [24]. Through fuzzy
implication (IF-THEN), the fuzzy relation (mRi) for the ith
individual rule (Ri) defined in Table 6 is developed as,

 OSC; PHM; TRE

mRi 
 DKs ; Dr


Z min minputi OSC; PHM; TREmoutputi DKs ; Dr

where minput, formed as a 5!1 column vector, is a


membership function of the measured fuzzy state for the
input variables (i.e. OSC, PHM, and TRE) listed in Table 3.
moutput denotes a 1!7 row vector which relates to
membership functions of the corresponding fuzzy state for
the output variables (i.e. DKS and Dr) given in Table 4.
minputi OSC; PHM; TRE+moutputi DKS ; Dr leads to the
comparison of each corresponding element and the min
operation enforces the selection of the element which has
the minimum value. Each resulting rule mRi becomes a 5!7
matrix, and there are five rules mapping from each input

Table 8
Summary of axis feed drive parameters
Feed drive parameters

(25)

X-axis

Y-axis

Feed drive rigid body dynamics


Current amplifier gain, Ka
Motor gain, Kt
Total reflected inertia, J
Viscous damping, B
Pitch length hp
Transmission gain rg

[A/V]
[Nm/A]
[kg m2]
[kg m2/s]
[mm]
[mm/rad]

6.4898
0.4769
0.0077736
0.019811
10
1.5915

7.5768
0.4769
0.0098109
0.028438
10
1.5915

Quantization and saturation limits


D/A Converter bit
Voltage range of D/A chip
D/A resolution, du
Quantization variance, Ru~
Saturation limits, umin/umax

[]
[V]
[V]
[V2]
[V]

16
G10
3.0518!10K4
7.761!10K9
K5,C5

16
G10
3.0518!10K4
7.761!10K9
K5,C5

Measurement noise
Linear encoder resolution, dx
Linear encoder noise variance, Rx~
Tachometer noise variance, Ru~

[mm]
[mm2]
[(rad/s)2]

1.22!10K3
1.2418!10K7
50!10K3

1.22!10K3
1.2418!10K7
50!10K3

Non-linear friction characteristics


Static friction, TG
stat
Coulomb friction, TG
coul
Velocity threshold 1, uG
1
Velocity threshold 2, uG
2

[Nm]
[Nm]
[rad/s]
[rad/s]

2.6256, K1.8672
2.1529, K1.4730
3.88, K3.51
4.20, K3.52

2.7658, K2.4520
2.5228, K2.3887
2.37, K4.41
3.01, K4.20

Backlash
Backlash, Db

[mm]

0.003

0.003

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123
Table 9
Summary of fuzzy tuning for three different scenarios
Results of fuzzy
tuning for SMC

Case 1

Case 2

Case 3

Pre-selected l [rad/s]
Initial/Tuned KS
[V/(mm/s)]
Initial/tuned r
[V/mm]
Initial/final maximum
tracking error [mm]

200
1/0.363

200
0.01/0.315

200
10/0.269

100/47.16

1/39.12

10,000/37.16

0.009/0.009

0.136/0.011

Unstable/0.012

1119

considered in SMC tuning, 6 resulting fuzzy composite


relation matrices or tables are developed in total.
(iv) Fuzzy decision table: The fuzzy decision table
is calculated by matching the system performance
attributes to the composite fuzzy relation tables, through
the use of the compositional rule of inference (i.e. sup of
min operation) as [24],

!
 OSC;PHM;TRE

mC Zsupmin minput OSC;PHM;TRE;mR 
 DKs;Dr
(27)

variable to each output variable, totaling 15 sets of matrices


for each of DKS and Dr. As the individual rules are joined
through the fuzzy connective (OR) operator, the resulting
fuzzy relation matrix between each of the fuzzy input and
output variables is formed as,

" 
#
 OSC; PHM; TRE
 OSC; PHM; TRE
5


mR 
Z max mRi 
 DKS ; Dr
 DKS ; Dr
iZ1
(26)
By comparing each element of the fuzzy relation table for
individual rules, the maximum of the membership grades
corresponding to each pair of input-output states is chosen.
Using a similar fashion, the composite fuzzy relation tables
between all condition and action variables are constructed.
Since there are 3 fuzzy input variables (i.e. OSC, PHM, and
TRE) and 2 fuzzy output variables (i.e. DKS and Dr) that are

where minput, mR, and mC are the membership functions of the


fuzzy input variables, the resulting fuzzy composite relation
calculated using Eq. (26), and the corresponding output
variables, respectively. In the use of a sup of min operation,
the membership function vector of the input variables is first
compared with each column of the fuzzy relation table. Then,
the lower value in each pair of compared elements is taken.
For each column, the largest value in the vector of elements is
selected, thus resulting in a row vector. In order to obtain a
numerical value, c^ , that determines the degree of tuning
action, a de-fuzzification is applied using the discrete
centroid method as,
P7

i1 ci mC ci

c^ Z

mC ci

(28)

Fig. 13. System performance before and after fuzzy tuning: (a) initially noisy system, (b) initially highly stable and sluggish system, (c) initially unstable
system.

1120

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

Table 10
Summary of control parameters for PID and SMC
PID Control
Proportional gain, Kp
Integral gain, Ki
Differentiation gain, Kd
Sliding mode control (SMC)
Sliding surface bandwidth, l
Feedback gain, KS
Disturbance adaptation gain, r

[V/mm]
[V/(mm$s)]
[V/(mm/s)]
[rad/s]
[V/(mm/s)]
[V/mm]

4. Experimental validation of virtual cnc


X-Axis

Y-Axis

70
800
0.30
X-axis
200
0.30
30

70
800
0.30
Y-axis
200
0.30
30

where ci corresponds to the representative numerical value


for the tuning parameters DKS and Dr, given in Table 4. The
fuzzy decision table, shown in Table 7, is obtained off-line
which allows efficient real-time tuning of the control
parameters. Through this fuzzy decision table, the new
tuning actions are assigned according to system performance
attributes. The formulation used for updating the control
parameters is given in Eq. (29),
!
3OSC;PHM;TRE
X
KSnew ZKSold C
DKS !KSold ;
iZ1

rnew Zrold C

3OSC;PHM;TRE
X

(29)

!
Dr !rold

iZ1

where KSnew and rnew correspond to the new SMC


parameters after fuzzy decision making. KSold and rold are
the current SMC parameters that need to be tuned. DKS and
Dr are the degree of the tuning actions obtained from the
fuzzy decision table.

The Virtual CNC system is experimentally verified


on a three-axis vertical machining center with ball
screw drives. The identified feed drive parameters of
the machine are summarized in Table 8. The machine
tool is controlled by an in house developed open CNC
system [21], which allows modular integration of any
trajectory generation, control law, and compensation
strategies.
4.1. Fuzzy tuning of axis control law
The sliding mode control law for the drives is
automatically tuned in the Virtual CNC environment
using Fuzzy Logic. The desired sliding surface bandwidth
(l) is pre-selected to be 200 rad/s. A back-and-forth test
motion with a travel distance of 100 mm and a command
feedrate of 200 mm/s is used as the reference input for
system performance diagnosis. The noise in the control
law and the tracking error are identified from Virtual
CNC simulation for given feedback (KS) and disturbance
observer (r) gains. The phase margin of the closed loop
controller is also calculated. The auto-tuning starts with
initial values of KS and r, and the fuzzy logic tuner
determines the optimal gains automatically, regardless of
the initial guess. The initial and tuned control law
parameters are listed along with their performance results
in Table 9. The corresponding control performances
before and after tuning with experimental validation are
shown in Fig. 13.

Fig. 14. Diamond-shaped contouring tests with PID control.

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

1121

Fig. 15. Diamond-shaped contouring tests with sliding mode control (SMC).

4.2. Prediction of CNC performance in machining


circular and diamond profiles
The Virtual CNC system has been experimentally
verified by trying out various tracking control schemes,

such as P-PI, PID, SMC, GPC, and Pole Placement Control


with feedforward friction compensation. PID and SMC
results are reported here as examples. The control interval
was 1 ms. The control parameters of the developed PID
and SMC are summarized in Table 10. Standard circular

Fig. 16. Circle-shaped contouring tests with PID control.

1122

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

Fig. 17. Circle-shaped contouring tests with sliding mode control (SMC).

and diamond toolpath contouring tests were conducted: The


diamond had a side length of 50 mm and the circular path
radius was 50 mm. The reference trajectories have been
generated to achieve a feedrate of 200 mm/s with maximum
acceleration and jerk values of 2000 mm/s2 and 50,000 mm/
s3, respectively. The selected acceleration profile was
trapezoidal, resulting in piecewise constant jerk commands
along the toolpath. The experiments were conducted under
air-cutting conditions in order to avoid structural deformations of the machine under cutting load.
The measured and predicted tracking and contour error
profiles are shown in Figs. 1417, and summarized in

Tables 11 and 12. It can be seen that the most critical parts
on the diamond paths are located at the corners where
transients in reference trajectory occur. The most significant
deviations on the circular paths are located at the quadrants
where the direction of the axis motion changes, and the
errors are mostly due to friction, which holds the slide until
sufficient torque is accumulated to overcome the static
friction disturbance. The experimental results clearly
indicate the accurate prediction capability of the Virtual
CNC system, also indicating that the sliding mode controller
(SMC) yields significantly less contouring and tracking
error than the standard PID controller.

Table 11
Summary of simulation and experimental results for air-cutting of diamond
profile

Table 12
Summary of simulation and experimental results for air-cutting of circle
profile

Diamond contouring tests

Circle contouring tests

Axis control
law

Tracking and contouring


error

Comparison analysis

Simulation
(mm)

Experiment
(mm)

Abs. difference (mm)

Deviation
(%)

X-axis tracking analysis


PID
0.0375
SMC
0.0122

0.0376
0.0115

0.0001
0.0007

0.2659
6.0870

Y-axis tracking analysis


PID
0.0412
SMC
0.0074

0.0414
0.0070

0.0002
0.0004

Contouring error analysis


PID
0.0126
SMC
0.0084

0.0138
0.0081

0.0012
0.0003

Axis control
law

Tracking and contouring


error

Comparison analysis

Simulation
(mm)

Experiment
(mm)

Abs. Difference (mm)

Deviation
(%)

X-axis tracking analysis


PID
0.0471
SMC
0.0117

0.0436
0.0109

0.0035
0.0008

8.0275
7.3394

0.4831
5.7143

Y-axis tracking analysis


PID
0.0223
SMC
0.0077

0.0220
0.0072

0.0003
0.0005

1.3636
6.9444

8.6957
3.7037

Contouring error analysis


PID
0.0215
SMC
0.0117

0.0226
0.0108

0.0011
0.0009

4.8673
8.3333

C.-H. Yeung et al. / International Journal of Machine Tools & Manufacture 46 (2006) 11071123

5. Conclusion
A comprehensive virtual model of a Modular CNC is
presented. The Virtual CNC allows modular integration of
trajectory planning and interpolation routines, mathematical
models of ball screw and linear drives, friction, feedback
sensors, amplifiers, D/A converters and flexible motion
control laws. The system allows the designer to try out
various feed drive design alternatives, control laws, and
sensors with different resolutions. The accurate model of the
drives allows realistic simulation of the drives high speed
contouring capability, and auto-tuning of sophisticated axis
control laws in a virtual environment, as has been
demonstrated for the presented Sliding Mode Controller.

Acknowledgements
This research is sponsored by NSERC and Pratt &
Whitney Canada under research chair and strategic grant
agreements.

References
[1] Y. Altintas, Manufacturing automation: metal cutting mechanics
Machine Tool Vibrations, and CNC Design, Cambridge University
Press, Cambridge, 2000.
[2] Y.C. Chen, J. Tlusty, Effect of low-friction guideways and lead-screw
flexibility on dynamics of high-speed machines, Annals of CIRP 44
(1) (1995) 353356.
[3] K. Erkorkmaz, Y. Altintas, High speed CNC system design. Part I.
Jerk limited trajectory generation and quintic spline interpolation,
International Journal of Machine Tools and Manufacture 41 (9)
(2001) 13231345.
[4] K. Erkorkmaz, Y. Altintas, Trajectory generation for high speed
milling of molds and dies, Proceedings of the Second International
Conference and Exhibition on Design and Production of Dies and
Molds, Kusadasi, Turkey, DM_46 2001.
[5] Y. Altintas, K. Erkorkmaz, W.-H. Zhu, Sliding mode controller design
for high speed drives, Annals of CIRP 49 (1) (2000) 265270.
[6] P. Boucher, D. Dumur, K.F. Rahmani, Generalized predictive cascade
control (GPCC) for machine tool drives, Annals of CIRP 39 (1) (1990)
357360.
[7] K. Erkorkmaz, Y. Altintas, High speed CNC system design. Part III.
High speed tracking and contouring control of feed drives,
International Journal of Machine Tools and Manufacture 41 (11)
(2001) 16371658.

1123

[8] G. Pritschow, On the influence of the velocity gain factor on the path
deviation, Annals of CIRP 45 (1) (1996) 367371.
[9] M. Tomizuka, Zero phase error tracking algorithm for digital control,
ASME Journal of Dynamic Systems, Measurement, and Control 109
(1987) 6568.
[10] H.B. Armstrong, P. Dupont, C. Canudas De Wit, A survey of models,
analysis tools and compensation methods for the control of machines
with friction, Automatica 30 (7) (1994) 10831138.
[11] K. Erkorkmaz, Y. Altintas, High speed CNC system design. Part II.
Modeling and identification of feed drives, International Journal of
Machine Tools and Manufacture 41 (10) (2001) 14871509.
[12] K. Erkorkmaz, PhD Thesis: Optimal Trajectory Generation and
Precision Tracking Control for Multi-Axis Machines, University of
British Columbia, Department of Mechanical Engineering, Vancouver, BC, Canada, 2004.
[13] J.Y. Kao, Z.M. Yeh, Y.S. Tarng, Y.S. Lin, A study of backlash on the
motion accuracy of CNC lathes, International Journal of Machine
Tools and Manufacture 36 (5) (1996) 539550.
[14] G. Pritschow, Course notes: control techniques of machine tools and
industrial robots, Institute of Control Technology for Machine Tools
and Manufacturing Units, Stuttgart University, Germany, 1997.
[15] Y. Koren, Computer Control of Manufacturing Systems, McGrawHill, New York, 1983.
[16] C.W. de Silva, A.G.J. MacFarlane, Knowledge-based control
approach for robotic manipulators, International Journal of Control
50 (1) (1989) 249273.
[17] N. Wickramarachchi, C.W. de Silva, Knowledge-based supervisory
control system of a fish processing workcell. Part I. System
development, Engineering Applications of Artificial Intelligence 11
(1) (1998) 97118.
[18] N. Wickramarachchi, C.W. de Silva, Knowledge-based supervisory
control system of a fish processing workcell. Part II. Implementation
and evaluation, Engineering Applications of Artificial Intelligence 11
(1) (1998) 119134.
[19] C.W. de Silva, An analytical framework for knowledge-based tuning
of a servo controller, Engineering Applications in Artificial
Intelligence 4 (3) (1991) 177189.
[20] J.-F. Goulet, C.W. de Silva, V.J. Modi, Hierarchical knowledge-based
control of a deployable orbiting manipulator, Acta Astronautica 50 (3)
(2002) 139148.
[21] Y. Altintas, N.A. Erol, Open architecture modular tool kit for motion
and machining process control, Annals of CIRP 47 (1) (1998) 295
300.
[22] C.H. Yeung, MASc Thesis: A Three-Axis Virtual Computer
Numerical Control (CNC) System, University of British Columbia,
Department of Mechanical Engineering, Vancouver, BC, Canada,
2004.
[23] K.J. Astrom, B. Wittenmark, Computer-Controlled Systems: Theory
and Design, third ed., Prentice-Hall Inc., New Jersey, 1997.
[24] C.W. de Silva, Intelligent ControlFuzzy Logic Applications, CRC
Press LLC, Boca Raton, FL, 1995.