Professional Documents
Culture Documents
Cjme 2013 05 940
Cjme 2013 05 940
Received December 22, 2012; revised June 12, 2013; accepted June 24, 2013
Abstract: The high-speed computational performance is gained at the cost of huge hardware resource, which restricts the application of
high-accuracy algorithms because of the limited hardware cost in practical use. To solve the problem, a novel method for designing the
field programmable gate array(FPGA)-based non-uniform rational B-spline(NURBS) interpolator and motion controller, which adopts
the embedded multiprocessor technique, is proposed in this study. The hardware and software design for the multiprocessor, one of
which is for NURBS interpolation and the other for position servo control, is presented. Performance analysis and experiments on an
X-Y table are carried out, hardware cost as well as consuming time for interpolation and motion control is compared with the existing
methods. The experimental and comparing results indicate that, compared with the existing methods, the proposed method can reduce
the hardware cost by 97.5% using higher-accuracy interpolation algorithm within the period of 0.5 ms. A method which ensures the
real-time performance and interpolation accuracy, and reduces the hardware cost significantly is proposed, and it’s practical in the use of
industrial application.
Key words: NURBS interpolator, FPGA-based interpolation, multiprocessor, system on a programmable chip (SOPC),
motion controller
afford the hardware cost. As a result, only 2-degree feedrate setting and adjustment subject to the kinematic
NURBS curve and 16-bits data can be processed. To cope constraints, as well as jerk-limited feedrate scheduling. In
with this issue, YAU, et al[13], later employed a Xilinx the last step, 5-phase S-shape feedrate profile is employed
XC2V4000 FPGA with 4M system gate counts, which can so as to realize smooth motion for less tracking error.
process 3-degree NURBS curve described by 32-bits data.
The total computational time for NURBS interpolation and
motion control with the above two methods is only about
1.84 μs. However, limited by the hardware cost, only the
interpolator based on the first-order Taylor’s expansion is
employed in above studies, which will inevitably cause
considerable feedrate fluctuation. Therefore, though the
interpolation speed is enhanced greatly, the computation
accuracy has to be sacrificed. In addition, with
consideration of the economic factor in practical
applications, it is not an optimal solution to choose a FPGA
with large resource.
This study presents a novel approach to design
FPGA-based NURBS interpolator and motion controller
using the embedded multiprocessor technique. With this
method, two free NIOS II soft cores are embedded into the
FPGA, one for NURBS interpolation while the other for
position servo control. Compared with the existing methods,
it needs less hardware resource but can implement more
complicated interpolation algorithms within the period of
0.5 ms.
The structure of this paper is organized as follows.
Section 2 gives an overview of the NURBS interpolation
and motion control scheme. Section 3 illustrates the
hardware configuration and software realization scheme of
the FPGA system. Performance analysis and experiments
are conducted in section 4. Finally, conclusions are
presented in section 5. Fig. 1. Flowchart of NURBS interpolation and motion control
1 2
∆v(t ) v(t Ts ) v(t ) J max Ts t J max Ts ,
2 (10)
v(t Ts ) v(t ) ∆v(t ),
ACC/DEC process, respectively. complicated algorithms are modularized with this method,
the hardware cost may be larger than the benefit it brings.
Table 1. ∆v(t) and A(t) in different stages In order to solve this issue, a method integrating CPU IP
of the feedrate profile core, HDL and logic blocks is proposed. The CPU
ACC/DEC processors are utilized to perform interpolation and position
Expressions of ∆v(t) and A(t)
stage servo control, while the HDL or block diagram to
∆v(t ) J maxTst J maxTs 2 2, modularize the logical circuits.
Phase 1
A(t ) J max t In this work, NIOS II for the FPGA from Altera is
∆v(t ) J maxTst J maxTs 2 2 2 J maxTstrTs , employed as the soft-core. NIOS II processor provides
Phase 2
A(t ) J maxTstr J max t various attractive features such as 32-bits data path,
Phase 3 ∆v(t ) 0, A(t ) 0 embedded DSP element, floating-point instructions(FPIs)
∆v(t ) J maxTst J maxTs 2 2 2 J maxTstrTs J maxTcvTs , for single-precision operations[20]. In addition, the
Phase 4
A(t ) J max (2Tstr Tcv t ) computational performance of NIOS II can be up to
∆v(t ) J maxTst 2 J maxTstrTs 2 J maxTendTs J maxTcvTs , 250DMIPS, and multiprocessor is also supported. Since all
Phase 5
A(t ) J max (t 2Tstr Tcv 2Tend ) the procedures are written in standard C language and
debugged the same as that in the PC, it is more convenient
than the HDL based method.
2.3 Motion control algorithm
In this work, the traditional PID controller expressed in 3.1.2 Hardware structure
Eq. (11) is chosen for closed-loop position control: The motion control system is implemented using a
k
Cyclone II series FPGA EP2C20F484C8N from Altera,
u (kTs ) K p E (kTs ) K i E ( jTs ) which contains 18 752 logic elements (LEs), 239 616 bits
j 0
random access memory (RAM), 26 embedded multipliers,
K d E (kTs ) E ((k 1)Ts ) , (11)
4 phase-locked loops (PLLs) and 315 user I/O pins. The
hardware structure is depicted in Fig. 3.
where u(kTs), E(kTs), Kp, Ki and Kd represent the velocity
control signal, the position error and three gains,
respectively.
3.1 Hardware design Fig. 3. Structure of the FPGA that configured for NURBS
interpolator and motion controller
3.1.1 Realization scheme
In the traditional motion control system, the combination As shown in Fig. 3, the FPGA consists of five main
of DSP and FPGA is the most popular hardware modules: 1) NURBS interpolator; 2) dual-port RAM
architecture[18–19]. Sharing the same clock cycle, DSP is (DPRAM); 3) mutual exclusion (MUTEX) and shared
adopted to perform various algorithms for motion control memory[21]; 4) position servo controller; 5) encoder sampler.
while FPGA to generate logical modules with parallel The other relative peripherals comprise digital-to-analog
structures which cannot be realized by DSP. However, with converter (DAC) and amplifier, SDRAM and FLASH chip.
the developments of the large scale integration technology 1) NURBS interpolator: The interpolator is designed
and embedded DSP elements, it is more cost-effective to using NIOS IIs processor, which is the standard version
design motion control system just employing FPGA due to with balanced performance and size among three kinds of
its reconfiguration capability, simple development process, NIOS II processors[20]. The dominant frequency provided
high density and economic characteristic. for the processor is 133 MHz, which is generated by the
The methodologies for development of FPGA include PLL. An interval timer core is also embedded to generate
HDL, dedicated logic blocks, intellectual property (IP) the timer interrupt for both the interpolator and motion
cores, etc. Nowadays, the interpolator and motion controller.
controller are usually designed using HDL. In such case, 2) DPRAM: A DPRAM with 2 00016-bits is designed
the FPGA system can execute concurrent operations using the on-chip RAM[22], which is utilized to store the
because of its parallel architecture. However, when feedrate scheduling results transferred from the PC and
ZHAO Huan, et al: Development of FPGA Based NURBS Interpolator and Motion Controller
·944· with Multiprocessor Technique
provide them to the interpolator. configuration: two NIOS II/s cores used as interpolator and
3) MUTEX and shared memory: The shared memory is a motion controller, Avalon-MM tri-state bridge, interval
1632-bits DPRAM, which is used to transfer the timer which interrupts at every 0.5 ms, MUTEX, interface
interpolated results from the interpolator to the motion for the FLASH memory, SDRAM memory, DPRAM and
controller at every sampling interval. In order to protect the shared memory. In order to hardware-accelerate the
resources in the shared memory from data corruption when arithmetic operations, the FPIs for single-precision
multiple processors modify the resource simultaneously, a operations are adopted in the interpolator[23].
MUTEX is added as a component.
4) Motion controller: The configuration of the motion
control processor is the same as the interpolator. It receives
reference commands from the shared memory, and sends
the velocity control signal to the DAC chip utilizing serial
peripheral interface (SPI) protocol.
5) Encoder sampler: This circuit is designed using HDL.
So it is capable of capturing and accumulating the
quadrature encoder pulses(QEP) with high speed. The
actual positions are latched and updated at every clock
cycle.
The DAC module contains two components: converter
and amplifier. Two AD1866 devices, which have 16-bits
serial input and four voltage outputs, are adopted to convert
the digital velocity commands to analog signals. A TL084
chip is utilized to amplify the analog signals from 1~1 V
to 10~10 V. A SDRAM chip K4S641632H-UC60 and a
FLASH chip JS28F640 are used to save the program and
data of the NIOS II cores.
3.2 Software design Fig. 4. Software design flow for the FPGA based
The software is designed in three steps: realization of the interpolator and motion controller
off-line feedrate scheduling, configuration for the Secondly, the block of the NIOS II processor is
interpolator and motion controller, and programming for integrated into the Quartus II. The other functional circuits
two NIOS II processors. or logical modules are added as well, including encoder
sampler, DPRAM and shared memory. With pins connected
3.2.1 Realization of the off-line feedrate scheduling and assigned, the project is analyzed and synthesized. Then
The feedrate scheduling algorithm presented in section a SRAM object file (*.sof) is generated and downloaded to
2.1 is coded in Visual Studio C++, and executed in a the FPGA. Up to now, the hardware environment is ready
non-deterministic Win32 environment. and then the software in the NIOS II IDE can be developed.
After implementation of the algorithm, a data file
containing the following information is generated: the 3.2.3 Programming for multiprocessor
geometrical description of the NURBS curve, which NIOS II IDE is an integrated development tool for
contains the number of the control points, degree of the editing and debugging procedures running in the NIOS II
spline, control points multiplying the weights, weight processors.
vector, knot vector; number of the sub-segments; total Two projects are created for NURBS interpolator and
interpolation time; Jmax, vstr, ACC/DEC time/modes. motion controller, respectively. The project of the NURBS
Then, a normal Win32 thread reads the data file interpolator consists of two threads: timer interrupt thread
sequentially, and sends the information of a new NURBS and loop thread. During the implementation of the loop
curve to the motion controller at the time that the FPGA thread, the interpolator accesses the DPRAM repeatedly to
finishes half of the current block’s interpolation task. check whether updated feedrate scheduling results are
transferred from the PC via the PCI bus. If so the
3.2.2 Configuration for soft-cores interpolator will read the data into the buffer to prepare for
The follow chart of software design for the FPGA system the interpolation of the next curve. When the timer interrupt
is depicted in Fig. 4. occurs, the interpolation interrupt service routine (IISR)
Firstly, the SOPC Builder tool, which is integrated in the executes the interpolation task introduced in section 2.2 and
Altera Quartus II software, is applied to customize the sends the coordinate points to the shared memory.
configuration of the two processors, so as to build the The project of the motion controller has the similar
hardware environment for the program running in the NIOS software structure to that of the interpolator. At every
II cores. The following modules are then added into the sampling interval, the motion controller reads the position
CHINESE JOURNAL OF MECHANICAL ENGINEERING ·945·
commands from the shared memory and actual positions compared to that of method (1)(2). However, the results
from the encoder sampler, and then executes the PID indicate that the computing efficiency of our method is
algorithm. After that, the digital velocity commands are worse than that of method (1)(2). But given the specified
transferred to the DAC chip for conversion. interpolation period of 0.5 ms, there is still enough
The aforementioned two NIOS II processors have computational power for more complex algorithms with the
pipelined architectures, so the processing time is inevitably proposed method. Thus, the analysis demonstrates that our
longer than the scheme based on HDL or logic block. method can not only meet the requirement of high-speed
However, all of the modules in the FPGA execute in interpolation, but also realize significant reduction of
parallel, so interpolation and motion control tasks can be hardware cost, at the same time provide enough resource
implemented at the same time, which means that higher for further promotion of computational accuracy.
real-time performance can be obtained than DSP-based
scheme with the same dominant frequency. 4.2 Experimental results
In this subsection, experiments are performed on a
4 Analysis and Experiments Validation platform containing three components: a PC with Pentium
IV 2.4 GHz CPU and 2 GB SDRAM, a custom motion
In the following, performance analysis and experimental control card which has a FPGA chip as designed in section
verification are implemented to demonstrate the advantages 3, an X-Y table driven by YASKAWA SGDV series servo
and applicability of the proposed design. Concisely, the drivers and SGMJV motors with free load. The
design schemes introduced in Refs. [12–13] are marked as interpolation and motion control tasks are performed in
methods (1) and (2), respectively, while that presented in sequence in the following, and the parameters of the
our work as method (3). interpolator and motion controller are listed in Table 3.
Note: NA stands for “Not Available”, which means the FPGA doesn’t Fig. 5. Trajectory of the butterfly curve
have enough hardware resource to realize the interpolation.
From Table 2, it can be found that higher-accuracy Firstly, the feedrate scheduling algorithm mentioned in
algorithm can be adopted by our method. Meanwhile, the section 2 is performed, and the scheduled feedrate profile
proposed method can reduce the hardware cost by 97.5% as can be obtained as shown in Fig. 6.
ZHAO Huan, et al: Development of FPGA Based NURBS Interpolator and Motion Controller
·946· with Multiprocessor Technique
where xk , yk and zk are the actual feedrates of three axes.
Finally, the X-Y table is driven by the motion control (1) A novel approach to design the hardware interpolator
card to track the desired trajectory. The experimental results and motion controller based on FPGA is proposed. A
about contour error and actual feedrate profile using FPGA chip from Altera is selected as the microprocessor
method (3) are illustrated in Fig. 8 and Fig. 9. The contour on the board. Two NIOS II soft-cores are embedded into
error is evaluated using the algorithm presented in Ref. [25], the FPGA, one of which works as NURBS interpolator and
while the actual feedrate vk* is evaluated using the the other as motion controller.
numerical derivatives estimated from actual x-, y- and z- (2) The feedrate scheduling algorithm is implemented
positions: off-line and a data file is generated. Then, a normal Win32
thread sends the feedrate scheduling results to the custom
motion control card to perform real-time interpolation and
xk 1 xk y yk position servo control.
xk , yk k 1 , (3) Performance analysis and experiments are conducted
Ts Ts
(12) to verify the superiority and applicability of the proposed
zk 1 zk *
zk , vk xk 2 yk 2 zk 2 , method. The results have shown that, despite some
Ts reduction of computational efficiency compared with the
CHINESE JOURNAL OF MECHANICAL ENGINEERING ·947·
existing FPGA-based interpolators, higher-accuracy [16] DE B C. On calculation with B-splines[J]. Journal of Application
interpolation algorithm can be adopted using less hardware Theory, 1972, 6(1): 50–62.
[17] COX M. The numerical evaluation of B-splines[J]. IMA Journal of
resource with specified sampling interval of 0.5 ms.
Applied mathematics, 1972, 10(2): 134.
[18] OH S N, KIM K I, LIM S. Motion control of biped robots using a
References single-chip drive[C]//IEEE International Conference on Robotics
and Automation, Taipei, China, September 14–19, 2003: 2 461–
[1] XU Z M, CHEN J C, FENG Z J. Performance evaluation of a
2 465.
real-time interpolation algorithm for NURBS curves[J]. The
[19] HE S, GAO X, PENG C, et al. Development of DSP and FPGA
International Journal of Advanced Manufacturing Technology, 2002,
based 4-axis motion controller[C]//6th International Symposium on
20(4): 270–276. Precision Engineering Measurements and Instrumentation,
[2] CHENG C W, TSAI M C. Real-time variable feed rate NURBS Hangzhou, China, August 8–11, 2010: 75441K.
curve interpolator for CNC machining[J]. The International Journal [20] ALTERA INC. Nios II processor reference handbook[R].
of Advanced Manufacturing Technology, 2004, 23(11): 865–873. California: Altera Corporation, 2009.
[3] LIU X, AHMAD F, YAMAZAKI K, et al. Adaptive interpolation [21] ALTERA INC. Creating multiprocessor Nios II systems tutorial[R].
scheme for NURBS curves with the integration of machining California: Altera Corporation, 2010.
dynamic[J]. International Journal of Machine Tools and [22] ALTERA INC. Cyclone II device handbook[R]. California: Altera
Manufacture, 2005, 45(4–5): 433–444. Corporation, 2010.
[23] ALTERA INC. Using Nios II floating-point custom instructions
[4] DU D S, LIU Y D, YAN C L, et al. An accurate adaptive parametric
tutorial[R]. California: Altera Corporation, 2010.
curve interpolator for NURBS curve interpolation[J]. The
[24] ALTERA INC. Altera data book[R]. California: Altera Corporation,
International Journal of Advanced Manufacturing Technology, 2007, 1998.
32(9): 999–1 008. [25] LO C C. Cross-coupling control of multi-axis manufacturing
[5] LEI W T, SUNG M P, LIN L Y, et al. Fast real-time NURBS path systems[D]. Michigan: University of Michigan, 1992.
interpolation for CNC machine tools[J]. International Journal of [26] PENG F Y, CHEN X B, ZHOU Y, et al. NURBS curve
Machine Tools and Manufacture, 2007, 47(10): 1 530–1 541. interpolation algorithm adaptive to the machine’s kinetic
[6] TSAI M S, NIEN H W, YAU H T. Development of an integrated characteristics[J]. International Journal of Materials and Product
look-ahead dynamics-based NURBS interpolator for high precision Technology, 2008, 33(1–2): 79–94.
machinery[J]. Computer-Aided Design, 2008, 40(5): 554–566. [27] PENG F Y, HE Y, LI B. Look-ahead control in high feed rate
[7] HENG M, ERKORKMAZ K. Design of a NURBS interpolator with NURBS curve interpolation[J]. Journal of Computer Aided Design
& Computer Graphics, 2006, 18(5): 625–629.
minimal feed fluctuation and continuous feed modulation
capability[J]. International Journal of Machine Tools and
Manufacture, 2010, 50(3): 281–293.
[8] PARK J H, NAM S H, YANG M Y. Development of a real-time Biographical notes
trajectory generator for NURBS interpolation based on the ZHAO Huan, born in 1983, is currently a PhD candidate at State
Key Laboratory of Mechanical System and Vibration, Shanghai
two-stage interpolation method[J]. The International Journal of
Jiao Tong University, China. He received his bachelor degree
Advanced Manufacturing Technology, 2005, 26(4): 359–365.
from Jilin University, China, in 2006. His research interests
[9] LIN M T, TSAI M S, YAU H T. Development of a dynamics-based include parametric interpolation and contour following control for
NURBS interpolator with real-time look-ahead algorithm[J]. CNC machine tools.
International Journal of Machine Tools and Manufacture, 2007, Tel: +86-21-34206412; E-mail: huanzhao@sjtu.edu.cn
47(15): 2 246–2 262.
[10] TAI M C, CHENG C W, CHENG M Y. A real-time NURBS ZHU Limin, born in 1973, is currently a professor at Shanghai
surface interpolator for precision three-axis CNC machining[J]. Jiao Tong University, China. He received his PhD degree from
International Journal of Machine Tools and Manufacture, 2003, Southeast University, China, in 1999. His research interests
43(12): 1 217–1 227. include surface modeling, CNC machining and inspection.
[11] CHENG M Y, TSAI M C, KUO J C. Real-time NURBS command E-mail: zhulm@sjtu.edu.cn
generators for CNC servo controllers[J]. International Journal of
Machine Tools and Manufacture, 2002, 42(7): 801–813. XIONG Zhenhua, born in 1974, is currently a professor at
[12] YAU H T, LIN M T, CHAN Y T, et al. Design and implementation Shanghai Jiao Tong University, China. He received his PhD
of real-time NURBS interpolator using a FPGA-based motion degree from The Hong Kong University of Science & Technology,
controller[C]//IEEE International Conference on Mechatronics, China, in 2002. His research interests include servo motion
Taiwan, China, July 10–12, 2005: 56–61. control and electronic manufacturing.
[13] YAU H T, LIN M T, TSAI M S. Real-time NURBS interpolation E-mail: mexiong@sjtu.edu.cn
using FPGA for high speed motion control[J]. Computer-Aided
Design, 2006, 38(10): 1 123–1 133. DING Han, born in 1963, is currently a professor at Shanghai
[14] LEE A C, LIN M T, PAN Y R, et al. The feedrate scheduling of Jiao Tong University, China. He received his PhD degree from
NURBS interpolator for CNC machine tools[J]. Computer-Aided Huazhong University of Science and Technology, China, in 1989.
Design, 2011, 43(6): 612–628. His research interests include digital and electronic
[15] PIEGL L, TILLER W. The NURBS book[M]. Berlin: Springer manufacturing.
Verlag, 1997. E-mail: hding@sjtu.edu.cn