You are on page 1of 7

Available online at www.sciencedirect.

com

ScienceDirect
IFAC-PapersOnLine 49-25 (2016) 229–234

Fault Tolerant CNC Motion Controller


∗ ∗∗ ∗∗∗

J.Arm Z. Bradac P. Fiedler
Department of Control and Instrumentation, Faculty of
Electrical Engineering and Communication, Brno University of
Technology, Brno, Czech Republic (e-mail:
xarmja00@stud.feec.vutbr.cz)
∗∗
Department of Control and Instrumentation, Faculty of
Electrical Engineering and Communication, Brno University of
Technology, Brno, Czech Republic (e-mail:
bradac@feec.vutbr.cz)
∗∗∗
Department of Control and Instrumentation, Faculty of
Electrical Engineering and Communication, Brno University of
Technology, Brno, Czech Republic (e-mail:
fiedlerp@feec.vutbr.cz)

Abstract: The goal of this article is to present and discuss the main parts in designing a CNC
embedded motion controller. Firstly, usable motor and drivers are discussed. Then usable
control components are presented. About the software, the velocity motion profiles are
presented and discussed. Regarding the multi-axis control, some interpolation methods are
presented and compared. The practical architecture of the motion controller is discussed and
some approaches are compared. In the last part, some fault-tolerant techniques suitable for
the controller are discussed. A new approach of fault tolerant method is presented and
discussed.
© 2016, IFAC (International Federation of Automatic Control) Hosting by Elsevier Ltd. All rights reserved.

Keywords: CNC, motion control, velocity profile, S-curve, trapezoid, interpolation,


fault-tolerant, reliability

1. INTRODUCTION in the motion controller or computer, there are more


choices how to deal with motion errors but there is
Without computer numeric control machines, the current higher demand for control system resources. When
automation would not be so developed. CNC systems driver takes care about the feedback, the whole system
are used for every process that can be described as a is considered to do the right movement according to its
set of movements and operations, e.g. laser cutting, setting and con-trol signals from superior controller. The
milling or precise placement. Every CNC machine is a driver is then controlled via industrial bus like EtherCat,
system that consist of hardware, software and electrical CAN, ProfiNet or using raw step and direction signals.
part. Hardware such a linear conducts, screw-like rails, This system is worth in high-demand varying systems.
tool and motors are fitted to do job repeatedly under
certain conditions. Electrical part takes care about power
for motors, sig-nal transmissions and running control
system. Software part has to interpret user commands
and generate precise signals for motors. User
commands are described accord-ing to some standard
language like G-code or PLCopen. The heart of control
system is motion controller which controls motors
through drivers using sensors according to commands.

2. MOTORS AND DRIVERS

Motors are actuators of the system which convert input


electric power to mechanic power. Motors are not con-
trolled directly from signals of a control system but some
kind of driver is used. In the CNC world, two types of
mo-tors are used for making a precise movement - Fig. 1. Closed loop system [Router Source (2011)]
stepper motors and AC synchronous motors.
Stepper motors are often used because of easier control
AC synchronous motors are equiped with encoders which and lower price for the whole system. Stepper motors are
gives an information about rotor position. This set is called powered from drivers, i.e. amplifiers which does not have to
servomotor. Servomotors are controlled in closed loop have positional feedback. The amplifier is usually controlled
system using drivers. There two types of closed loop via step and direction signals and the posi-tion is then
system (see Fig. 1). If the encoder feedback is processed calculated in the control system using count
2405-8963 © 2016, IFAC (International Federation of Automatic Control) Hosting by Elsevier Ltd. All rights reserved.
Peer review under responsibility of International Federation of Automatic Control.
10.1016/j.ifacol.2016.12.039
230 J. Arm et al. / IFAC-PapersOnLine 49-25 (2016) 229–234

of steps in the step signal. This system is considered to 3.3 Exponential


do right movement when all mechanical forces are
expected and motor is dimensioned. This type of control The exponential motion profile minimizes jerk more then
is called open loop (Fig. 2). This system is worth in a S-curve therefore the tracking error is lesser. It is also
low-demand predictable systems. easier to implement. The equations are [Rymansaib et
al. (2013)] :
u = at
f (u) = f (t) −e
−u 3
=1 (3)
vmax
˙ ˙
f ( t)
f ( u) = = 3u2e−u3
αvmax
Exponential motion profile is on Fig. 3.

Fig. 2. Open loop system [Router Source (2011)]

3. MOTION PROFILES

Every CNC system consists of axis. Each axis is


physically moved by a motor. The motor can be in states
: standstill, accelerating, plateau, decelerating. Motor
torque is limited and is dependent on type of the motor
and its speed. Because of load, accelerating and
decelerating are the most tricky states. Firstly, Fig. 3. Exponential motion profile [Rymansaib et al.
acceleration is limited. Then during acceleration, some (2013)]
stroke can be created. Using stepper motors, higher
acceleration and strokes can lead to loss of steps which 3.4 S-curve
is undesired. If there is no acceleration profile, the loss
of step is unavoidable when the load is higher then the
This motion profile is considered to be sufficient to restrict
motor can handle. Some basic motion profiles are :
jerk. Jerk is derivative of acceleration. S-curve can be 3rd,
4th or 5th order. This algorithm is the most computational
3.1 Trapezoidal demanding because it has to be compute when to start de-
celerating and uses more mathematical operations. There
This motion profile is used mostly in PLC and when the is algorithms which uses less computational resources but
system has low resources and low torque requirements. it is less precise. The comparison of S-curve and trape-
The velocity is increasing linearly until it reaches plateau. zoidal motion profile is on Fig. 4.
The equations in discrete form are [Lewin (2007)] :
1
s(k + 1) = s(k) + v(k) + 2 a(k) (1)
v(k + 1) = v(k) + a(k)

3.2 Parabolic

Parabolic profile is closely related to S-curve profile. It


consumes a lot of computational power for calculation of
the deceleration start point. The equations in discrete Fig. 4. S-curve (1A) and trapezoidal (1B) motion profile
form are [Lewin (2007)] : [Lewin (2007)]
1 1
s(k + 1) = s(k) + v(k) + 2 a(k) − 6 J 4. MULTI-AXIS CONTROL
v(k + 1) = v(k) + a(k) − 1 (2)
2J Almost every CNC machine has more than one axis which has
a(k + 1) = a(k) + a(k) − J to cooperate together. Their position, velocity
J. Arm et al. / IFAC-PapersOnLine 49-25 (2016) 229–234 231

and acceleration has to be synchronized. Here are some


of the interpolation algorithm. The main problems, which
every algorithm has to solve, are discretization of path
tra-jectory, reducing path tracking error, implementing
appro-priate motion profile, restricted computational
resources, etc.

4.1 Bressenham

This is one of the oldest algorithm which can be imple-


mented using only integer math. Thus it saves computa-
tional resources. This algorithm discretizes lines and
arcs on the points which are closest the true line or arc.
So it is optimal algorithm because it tries to minimize
path tracking error [Chiang (1994)]. The discretization of
a line can be seen on Fig. 5.

Fig. 6. DDA algorithm for linear interpolation


NURBS The NURBS (Non-uniform rational B-spline)
curve interpolation technology is the key of open CNC. This
method tries to effectively reduce chord error. In or-der to
Fig. 5. Using Bressenham algorithm [Chiang (1994)] reduce impact of vibrations and strokes, the feedrate
fluctuation needs to be controlled so the fluctuation of ac-
4.2 DDA algorithm celeration and jerk needs to be controlled. There are some
implementation variants : de Boor-Cox algorithm, basis
Digital differential analyzer (DDA) algorithm uses lesser function algorithm and other developed algorithms that takes
computational resources than others and it can even run lesser time. The basis function defines B-spline as [Sun
on Atmega MCUs. This is used usually in low cost (2013)] :
automation. Algorithm is periodically executed. In every Ni,k (u) = u − ui Ni,k−1(u)+ ui+k+1 − u Ni+1,k−1(u)
period the registers are integrated. The output signal ui+k − ui ui+k+1 − ui+1
consists of the overflows of the integrator. DDA solves 1u ∈ [ui; u i + 1]
basically these equations [Desai (2015)]: Ni,k (u) = { 0
(4) − (6)
Pk = Pk−1 ± Pk otherwise
Qk = Qk−1 ± Pk Others There are other algorithms based on spline
The DDA algorithm for linear interpolation is on Fig 6. interpolation which try to make movement smoother,
reduce path tracking error and make the algorithm more
4.3 Spline interpolation efficient, e.g. Bezier curve interpolation and cubic curve
interpolation.
Spline interpolation is used when partitioning a curve
into lines is not sufficient. This interpolation solves prob-
lems with smoothness, the discontinuity of segmentation 4.4 Other solution
and some transmission errors between CAD and CNC
sys-tems. On the other side, it has to face many There are many other solutions developed by scientist
practical prob-lems such as implementing command for and enthusiasts. All interpolation algorithms are affected
cutting splines into G-code and the decision which spline by the motion profile which has an impact on a path
interpolation is sufficient to use [Quan (2009)]. tracking error. One of the solution deals with it using dif-
ferent interpolation architecture. It uses rough and finest
B-spline This type of spline is described in CAD/CAM interpolation algorithms which are switched between
theory as a cubic uniform B-spline and it is defined by : [Kim (1995)] and [Lin and more (2012)].
j
3

Pi(t) =pi+j B − j, 3(t) (5) 5. CONTROL COMPONENTS


=0
where p are the control points and the Bj,3(t) are the 3rd- At present, the computational power is enough to control
degree B-spline functions [Quan (2009)]. the motion. The problem is to chose a balance between
used algorithm and price. The used algorithm is dependent
232 J. Arm et al. / IFAC-PapersOnLine 49-25 (2016) 229–234

on a platform power. Moreover, when reliability is Based on FPGA This architecture involves only stan-
desired (see Chapter 6), the underlying platform and the dalone FPGA. In the FPGA, there is soft core proces-sor
software has to be adapted. There are some categories which takes care about communication with superior
how the un-derlying platform could be made : system and do all necessary computes. This is almost
the same approach as architecture MCU+FPGA but all
• PLC with appropriate modules
is in one component and well synchronized. There are
• custom embedded motion controller which can be some approaches which implements all computation
controlled by PC
directly in FPGA without built-in soft core, e.g. [Shao and
• PC with appropriate PCI card or other interface
Sun (2006)] or [Gao et al. (2014)].
• specialized CNC embedded system with standard
HMI Distributed CNC system In this multi-axis system, each axis
PLC can control servo-drivers via industrial bus or spe- is controlled by its MCU or FPGA. All control com-ponents
cialized modules generating step and direction signals. are connected to the master. Each sub-component reduces
PLC is not suitable to control multi-axis systems like computational requirements to master. But there is a big
milling machine. It can control each axis separately problem with motion coordination therefore with
using PLCopen standard or some other non-standard synchronization when more axis has to cooperate together.
interface. On the other hand, the superior PLC systems The buffers has to be made and motion com-mands has to
can do linear interpolation with two or more axis. be triggered according to common precise time [Saputra et
al. (2014)].
Standalone PC with PCI card can be also used. PCI card
generates directly step and direction pulses, or implements 6. RELIABILITY
some industrial interface like EtherCAT. The computer has
to have more resources to handle GUI, motion control
equations, real-time signal generation and other processes. A CNC motion controller generates hardware signals for
On the PC, a real-time OS has to be installed and real-time stepper motor drivers, i.e. amplifiers which powers di-
application has to be developed. Such system has high
rectly motor coils. There is a requirement for fast and
computational power but has usually more problems about
pre-cise motor motion. All motion parameters are set by
a de-veloper. Because motors move usually with
meeting deadlines. This architecture uses e.g. MESA
dangerous tools like a rotating mill, high reliabilty of the
company [Electronics (2016)].
controller is important.
Specialized CNC embedded system is compact system
developed for multi-axis 3D milling systems. The system
Errors, which can occur in the system, can be divided
has usually special CNC based HMI and standard control into system errors and transient errors. The system
interface. This architecture is used on many industrial errors represent errors coming from a bad hardware
machines e.g. from companies Siemens or Fanuc. design, bad software design or software bugs. These
faults has to be detected and eliminated at the
development phase. The transient errors are usually
5.1 Embedded motion controller caused by SEU (Single Event Upset) which causes
single-bit errors for products up to 65 nm and possibly
multi-bit errors for 40 nm. Some errors can be caused by
Custom embedded motion controller is often used component malfunction which is declared as a
because of its good performance and lower price than probability of failure of the component. Only the category
other options with the same characteristics. Controller is of the transient faults can not be eliminated at the
communicating with superior PC which takes care about development phase so they has to be detected as soon
HMI or it is connected as a part of machine control as possible to raise a system reaction. The reaction can
system. Motion controller generates usually step and be system reset, fault masking or system recombination.
direction signals and its architecture can be :
There are several methods how to detect faults. The
Based on MCU All signals are generated and motion is most used is lock-step which compares output of two
controlled by MCU. This solution has higher demands on simi-lar cores but this does not detect which core is
MCU resources but is good for hobby CNC machines. The faulty. In contrast, TMR (Triple Modular Redundancy)
good performance versus price has MCU from STM32 masks the faulty core using a voter of the correct output
family. Projects using this architecture are e.g. Smooth- from three cores. There are some approaches which are
ieBoard or TinyG. When lower demand for motion speed trying to get the faulty core like in [Pham et al. (2012)]
and precision is required, even MCU from AVR family can but the faulty core recognition takes long time or so
be used. The main problem is to generate the precise step called hot-standby system is created. When using FPGA
signal by MCU when it is busy by another operations. as a platform, the configuration memory can be tested
against its CRC image which discovers faulty bits like in
[Altera Corporation (2008)]. Single-bit memory faults are
Based on MCU+FPGA This solution uses advan-
automatically repaired when ECC (Error Checking and
tages of MCU, which is high computational power, and Correcting) is used.
of FPGA, which is real-time signal control. Creating real-
time signal operations on FPGA relieves resources on There are also some software fault detectors. The most used
MCU and thus motion algorithm and path planning can is the watchdog that detects system hangs like infinity loop or
be more sophisticated. Projects using this architecture deadlock. On the other hand, its reaction is slow according to
are e.g. [Fei et al. (2011)] or [Bhatt and More (2014)].
its setting. There is some approach in [Zhu
J. Arm et al. / IFAC-PapersOnLine 49-25 (2016) 229–234 233

et al. (2012)] that tries to lower the hang detector reaction in the middle of a complex CNC motion, keeping the last
time. The architecture of a such system is on Fig. 7. For the change value is the best reaction because it minimizes the
CNC motion controller, there is also suitable detector based error between estimated path and real path called the
on detecting of value range exceeding. chord error. As soon as the error is signaled, a recovery
algorithm has to set the last good context or rather re-
The motion controller operates with signal frequencies up compute the variable again. The input variables in this re-
to 200 kHz beside an internal clock. To lower influence of computation are considered to be alright. This idea (see
EMI, it is suitable to keep shielding rules like monolithic Fig. 9) is more suitable for CNC motion control system
ground surface on PCB, separation of the signal and digital because all output signals to axis have to be smooth.
ground, overall shielding connected to the ground, or keep-
ing a distance between devices in a case. This monitor is implemented in software but it is more
suitable to be implemented to a hardware device which
Besides, one of the main fault tolerant technique used in has lesser probability of failure. The same device can
safety-critical systems is time. All components and de- also implement soft-limit monitor with slow-down
vices are tested for a long time to detect all unpre- reaction be-fore the limit according to the current speed
dictable errors coming from non-complete knowledge of and the max-imal deceleration.
de-vice behaviour in many situations. During this testing,
the reliability of each electrical part can be quantified It is obvious without testing that detected errors are er-
and some software bugs can be revealed. Currently, the rors of bad value calculation generated from SEU, ALU
in-dustrial area is more consume so higher emphasis is (Arithmetic-Logic Unit) fault, software bug or variable
placed on safety. Safety is quantified by a probability of memory malfunction. The change of a variable has to be
fail-ures per hour and per demand. These values significant to overcome a monitor threshold. On the
determines the SIL (Safety Integrity Level) of a device other hand, it monitors directly the software output so
and of a ma-chine [Zezulka and Brad´aˇc (2003)]. when an error of inappropriate motion outside
boundaries hap-pens, a finding fault can be searched in
hardware if monitor runs alright.

Fig. 7. The architecture of system hang detector [Zhu et


al. (2012)]

6.1 New approach


Fig. 8. Error detection principle using ranges [Canham et
There is an approach [Canham et al. (2003)] which detects al. (2003)]
errors according to function values (see Fig. 8). A function
is created as a Cartesian product of two axis/variables 7. FUTURE WORK
(input and output). This function is assumed to change
smoothly. A maximum monitored range is set at the train- A deeper analysis of handled faults is planned. Some faults
ing phase and if a value exceeds the range, an error will be can not be handled because of threshold. So the true
thrown. If an upper axis output value is changing against a negative faults probability has to be evaluated. An analysis
bottom input axis value a lot, the detector will be split and of fault tolerant techniques combination can be also done.
the range will be lowered. The maximal width of the
monitored range is also defined.
8. CONCLUSION
Our approach uses the idea but uses different moni-tored
function and method. In principle, our monitor detects the The CNC motion controller is the heart of a CNC ma-chine.
denied change of input/output value/variable over time. So It has to perform fast, accurate and precise motion signals.
at the time of a value change is the change of a To achieve this, the appropriate velocity profile in
value/variable tested and then restricted or permitted. In combination with interpolation algorithm has to be im-
case of restriction, an error is signaled and the vari-able plemented. At the same time, it has to be reliable because
change is aborted, kept the last change value or set the it operates with potentially dangerous tools. So some fault
maximal change value. If an error is detected tolerant techniques more than soft-limits and watchodgs
234 J. Arm et al. / IFAC-PapersOnLine 49-25 (2016) 229–234

Fei, J., Deng, R., Zhang, Z., and Zhou, M. (2011).


Research on embedded cnc device based on arm and
fpga. Inter-national Workshop on Automobile, Power
and Energy Engineering.
Gao, M., Lou, J., Ye, J., and Wu, Z. (2014). Fpga-based
implementation of circular interpolation. Journal of
Chemical and Pharmaceutical Research.
Kim, D.I. (1995). Study on interpolation algorithms of cnc
machine tools. Industry Applications Conference,
1995. Thirtieth IAS Annual Meeting, IAS ’95.,
Conference Record of the 1995 IEEE.
Lewin, C. (2007). Mathematics of motion control profiles.
Performance Motion Devices, Inc.
Lin, Z. and more (2012). Design and development of the
self-adaptive tool path decision-making cnc platform.
Biomedical Engineering and Biotechnology (iCBEB),
2012 International Conference on.
Pham, H.M., Pillement, S., and Piestrak, S.J. (2012). Low-
overhead fault-tolerance technique for a dynamically
Fig. 9. Principle of the detection of a wrong value change reconfigurable softcore processor. IEEE Transactions on
Computers, 1179 – 1192. doi:10.1109/TC.2012.55.
should be implemented. Our approach should help to de- Quan, L. (2009). The studies of spline interpolation for five-
tect some errors and mask them softly. The proposed axis machining. Industrial Electronics and Applica-tions,
monitor is based on checking boundedness of the value 2009. ICIEA 2009. 4th IEEE Conference on.
derivation. The balance between motion freedom and mo- Router Source (2011). Open vs. closed loop system.
tion monitors has to be determined carefully. http://www.cncroutersource.com.
Currently, the greatest challenge is to make a such path Rymansaib, Z., Iravani, P., and M.N.Sahinkaya (2013).
planning algorithm which takes into account an interpola- Exponential trajectory generation for point to point
tion algorithm to achieve fast, smooth and accurate multi- motions. 2013 IEEE/ASME International Conference
axis motion according to a designed curve. The second on Advanced Intelligent Mechatronics.
challenge is to produce such motion controller at low cost. Saputra, R.P., Atmaja, T.D., and Prawara, B. (2014).
Distributed control system design for portable pc
based cnc machine. Journal of Mechatronics,
ACKNOWLEDGEMENTS Electrical Power, and Vehicular Technology. doi:
10.14203/j.mev.2014.v5.35-42.
This work was supported by grant No. FEKT-S-14-2429 Shao, X. and Sun, D. (2006). An fpga based motion
- “The research of new control methods, measurement control ic and its application to robotic manipulators.
procedures and intelligent instruments in automation”, Con-trol, Automation, Robotics and Vision, 2006.
which was funded by the Internal Grant Agency of Brno ICARCV ’06. 9th International Conference on, 1 – 6.
University of Technology. doi: 10.1109/ICARCV.2006.345255.
Sun, S. (2013). A study on adaptive nurbs interpolation
REFERENCES points calculation with jerk-limited acceleration. Infor-
mation and Automation (ICIA), 2013 IEEE Interna-
Altera Corporation (2008). Error detection and recovery tional Conference on.
using crc in altera fpga devices. Application Note 357. Zezulka, F. and Brad´aˇc, Z. (2003). Development in
URL https : //www.altera.com/content/dam/altera − safety and reliability of programmable devices and
www/global/enU S/pdf s/literature/an/an357.pdf . systems. Programmable devices and systems.
Bhatt, D.B. and More, H.R. (2014). Cnc machine con- Zhu, Y., Li, Y., Xue, J., and Tan, T. (2012). What is
troller using fpga. International Journal of Review in system hang and how to handle it. 2012 IEEE 23rd
Electronics & Communication Engineering, 2. International Symposium on Software Reliability
Canham, R., Jackson, A.H., and Tyrrell, A. (2003). Robot Engineering. doi:10.1109/ISSRE.2012.12.
error detection using an artificial immune system. Evolv-
able Hardware, 2003. Proceedings. NASA/DoD Confer-
ence on, 199 – 207. doi:10.1109/EH.2003.1217667.
Chiang, L. (1994). 3-d cnc trajectory interpolation using
bresenham’s algorithm. Industrial Electronics, 1994.
Symposium Proceedings, ISIE ’94., 1994 IEEE
Interna-tional Symposium on.
Desai, D. (2015). Design of control unit for cnc machine
tool using arduino based embedded system. Smart
Tech-nologies and Management for Computing,
Communica-tion, Controls, Energy and Materials
(ICSTM), 2015 International Conference on.
Electronics, M. (2016). Mesa. http://www.mesanet.com/.

You might also like