Development of a Virtual Controller Integrating Virtual and Physical CNC
Y. C. Kao1,a, H. Y. Cheng2,b, Y. C. Chen1,c 1Department of Mechanical Engineering,
2Department of Mold and Die Engineering
National Kaohsiung University of Applied Sciences
415 Chien Kung Road, Kaohsiung 807, Taiwan, R.O.C
Keywords: virtual controller, virtual CNC, distributed, learning assistance, CORBA
Abstract. This paper describes the development of a virtual CNC controller. Controller is the major
driver for a CNC machine. Similarly, virtual controller is the key driving component for a virtual
CNC, which is a three-dimensional digitized physical CNC. A virtual CNC can exist in every PC
serving as the complementary safer counterpart in lecturing and learning the hand on operation of
expensive machinery such as five-axis milling machine, high speed CNC and mill-turn because the
virtual CNC will not break. Virtual reality environment provided by EON studio software has been
adopted in establishing the interactivity of a virtual CNC based on the geometry model constructed in
off-the-shelf CAD software. Visual Basic was used in implementing the graphical user interface to
operate the virtual CNC through the developed virtual controller. The virtual controller is in charge of
(1) parsing user’s NC codes, (2) simulating the tool path of the parsed NC codes, and (3)driving the
virtual CNC according to the tool path. The developed virtual CNC controller has been successfully
applied in implementing virtual CNCs based on two physical three-axis CNC machines and has also
been demonstrated in an international exposition successfully. The virtual controller can enable the
virtual CNC in facilitating lecturing, tutoring, self-learning, and reducing the chances of accidental
breakdown of precious CNC equipment.
Introduction
Numerical control technology has been greatly enhanced since early 1950s owing to the advances of
electronic and electrical industries. Traditional machines such as lathe, milling machine, drilling
machine, grinding machine, punching machine, boring machine, machining center, and metal forming
machines have been gradually computerized and/or automated through the integration of a machine
control unit (MCU) to enhance control, increase accuracy, repeatability and reduce the dependence of
operators etc. based on the powerful numerical computation capabilities. Therefore, computer
numerical controlled machines, as shown in Figure 1, have been the norm of contemporary
automation machinery. The functionalities of computer numerical controlled (CNC) machines have
also been the key enabler towards the rapid development of precision industry. However, Lin [1]
stated that limitations of CNC include (1) high initial investment and (2) high maintenance. That is to
say, CNC machines are normally expensive and it is not feasible to provide every student with one
CNC machine in learning the practice of CNC operation in classroom. This is because more and more
of the education institute just could no longer be able to afford the expenditure in purchasing new
CNCs for each student. The price of maintaining existed CNCs is also costly and becoming heavier
burden in conducting CNC classes.
Advances in the computer and communication technology have offered a lot of convenience to
human beings. For example, the rapid development of networking technology has shortened the
distances among one another; electronic document exchange, commercial businesses, and abundant
multimedia (text, image, audio, and video) information have demonstrated the great influential power
of the Internet in the 21st century. The development of virtual reality technology has been one of the
hottest research focus of information technology (IT) resulted from the performance enhancement of
video adapter (graphics accelerator card). Three-dimensional mimic display that traditionally could
Materials Science Forum Vols. 505-507 (2006) pp 631-636Online available since 2006/Jan/15 at www.scientific.net© (2006) Trans Tech Publications, Switzerlanddoi:10.4028/www.scientific.net/MSF.505-507.631
All rights reserved. No part of contents of this paper may be reproduced or transmitted in any form or by any means without the written permission of TTP,www.ttp.net. (ID: 152.2.176.242, University of North Carolina at Chapel Hill, Chapel Hill, USA-30/11/14,16:05:23)
only be displayed on high-level workstation computer can now be displayed in common personal
computers with effective performance. Similarly, technology of virtual reality has been demonstrated
in earlier military drill and computer games showing very reasonable results and attractive
impressions. Virtual technology has also impacted lecturing methods, for example, web-based
asynchronous servers has been gradually adopted to replace traditional blackboard teaching methods;
students can attend the virtual classroom at any time he or she preferred. Web-based programming has
therefore attracted more and more engineers’ interests. Virtual reality technology can now be
integrated with World Wide Web technology and has very high percentage of opportunity to
revolutionize traditional way of learning through immersive, interactive and imaginary interface.
�Fig.1. basic elements of a typical computer numerical controlled (CNC) machine
Literature review of VR on CNC. The application of virtual reality technology has been extended
to more and more domains such as medical, architectural, aeronautical, and engineering etc. owing to
the great advancement of 3D computer graphics. Education and training of CNC technology has also
been paid great attention in these years. For example, Hsu [2] studied the kinematic movements for
multi-axis machine tool by virtual reality technology. Cheng and Lee [3] applied virtual reality in the
education and training of Lathe operation. Kao and Cheng et al [4] have also developed a web-based
interactive virtual CNC system in learning assistance. Ong and Mannan [5] adopted virtual reality in
the simulation and animation of a web-based interactive manufacturing engineering module; 2D and
3D user interface were developed individually, 3D panoramic view was accomplished via VRML
(Virtual Reality Modeling Language) and JAVA programming environment. Ong, Jiang and Nee [6]
also developed an Internet-based virtual CNC milling system by using VRML as the 3D model and
controlled via JAVA through External Application Interface (EAI) where G code could be simulated
to emulate simple virtual cutting operation; collision detection, and cutting parameters; tool life
estimation could be calculated. VRML and JAVA EAI have also been applied by Suh et al in
developing a Web-based Virtual Machine Tools (WVMT) [7]; NC tool path could be displayed in
WVMT but cutting parameters were not integrated. Lin et al have also applied virtual reality in
developing a virtual environments VRTSs (Virtual Reality-based Training Systems) [8] under UNIX
for industrial training by considering task-planning knowledge based on Petri net theory and SGI
Reality Engine II. This system is difficult to be applied for learning assistance because of its special
hardware and software requirements. Wang et al developed a remote real-time CNC machining
system for web-based manufacturing [9]; JAVA 3D was adopted to create the virtual scene and
sensors were installed on the remote physical CNC machine to synchronize virtual CNC and remote
physical CNC. Although only minor movement data were transmitted and therefore network
bandwidth consumption was far less than that of remote network video transmission, real-time
synchronization between virtual CNC and physical CNC could not be guaranteed based on the
publicly shared characteristics of the Internet. Similarly, real-time simulation of machine tool
dynamics through the virtual machine tool concept has also been proposed by Jınsson, Wall and
Broman [10].Furthermore, five-axis virtual CNC has been studied [11][12][13] and distributed
three-axis virtual CNC has also been studied by the authors [14][15][16]. From the above review, the
Machine
Control Unit
(MCU), i.e.
Controller
Machine
structure: Servo
motor, Machine
drive system,
Machine tool
table, Feedback
system
632 Progress on Advanced Manufacture for Micro/Nano Technology 2005
possibility of applying 3D graphics and VR technology to emulate CNC is very feasible in PC
environment.
Objectives. Although VR technology has been greatly applied in constructing VR CNC, the key
component “Virtual CNC controller” of a virtual CNC has not been explored. Therefore, the
objectives of this paper were focused on studying a vertical VR CNC based on the viewpoint of
functionality in integrating the virtual CNC and the real CNC. By so doing, the virtual CNC can be
used in CNC subject lecturing, tutoring and training. Traditional way of teaching CNC course can be
more fruitful and safer by incorporating three-dimensional VR CNC as a new graphical user interface.
The most difficult part on coordinates system setting and transformation such as G92, G54-G59 can
then be enhanced with movable 3D VR CNC machine.
System architecture of a VR CNC
The VR CNC developed in this paper consists of two modules: (1) VR CNC structure, and (2)VR
CNC controller. These modules will be described as follows. These modules are described as follows:
VR CNC structure. The VR CNC structure includes machine table, servomotor, driving system
and feedback system. The virtual CNC machine table, as shown in Figure 2, of a general PC-based
vertical three-axis CNC can be represented by one solid block that can be moved in both X and Y
directions while Z-axis movement is controlled through the up and down translation of the spindle
head (the cutter).
Fig. 2 Virtual CNC in virtual scene
The dimension of the real CNC was measured before the virtual CNC structure was constructed in
EON studio software. Components of the virtual CNC structure was divided into two categories: (1)
movable – spindle, machine table, and door, (2) fixed – other components. Movable components must
be constructed one by one so that the movement can be controlled independently, while the fixed
component can be constructed in one or more solid pieces. Both movable and fixed components can
be built in CAD software that can output either STL (stereo lithographic) or VRML (Virtual Reality
Modeling Language) format in which the adopted VR software EON studio is able to import. The
CNC components will then be organized into nodes in EON studio such as model mesh, material,
motion, light source, etc. These nodes will be displayed in “Component-Nodes” window and the
behavioral relationship among the components can be assigned in the “Route” window. The sequence
in constructing the VR CNC is shown in Figure 3. Motion control of a real CNC was fulfilled through
control of the servomotor, driving system and feedback system. Similarly, the virtual CNC machine
table could be actuated according to the NC codes such as G00 and G01 for linear motion, G02 and
G03 for circular motion.
Virtual CNC controller. The VR CNC controller is composed of Human Machine Interface
(HMI), NC codes parser, and interpolation algorithm. Visual Basic 6.0 was used in developing the VR
CNC controller. The VR controller HMI interface, as shown in Figure 4, was developed underlying
Microsoft Visual Basic 6.0 environment based on a Mitsubishi V30 PC-based three-axis vertical
machining center in the Remote Virtual Rapid Laboratory, Department of Mechanical Engineering,
Machine
Table: X, Y
movement
Z-axis
movement
Materials Science Forum Vols. 505-507 633
National Kaohsiung University of Applied Sciences, Taiwan, as shown in Figure 1. For the purpose of
demonstrating VR controller in assisting education and training, the HMI of the VR controller has
been simplified from the full functional Mitsubishi V30 controller. The VR controller can emulate
Cycle Start, Cycle Stop, Spindle, Feed rate, Home, Tool exchange, Emergency Stop, and MDI mode
such as Jog, Handle, Rapid, Memory, Tape, etc. Machine coordinates and Workpiece coordinates can
also be shown dynamically. NC codes can also be displayed and edited.
(a) build up CAD
geometry
(b) import geometry into
EON studio
(c) setting levels in
“simulation tree”
(d) setting behaviors in
“Route: simulation” window
Fig. 3 sequence of constructing VR CNC
NC codes parser. Operation of a CNC
machine is based on the user entered commands
and these commands are mostly the numerical
control (NC) codes or programs. Currently, most
of the complex NC codes are generated by
off-the-shelf computer aided manufacturing
(CAM) software and the purpose of NC codes
parser is to realize the meaning of the user’s
intention in operating the CNC through NC codes.
The NC codes parser developed in this paper can
restructure the entered NC program and categorize
the machining data into Line, Arc, Canned Cycle,
and Zero Return structures, as shown in Figure 5.
The coordinate system code G92, G54~G59 for work piece origin settings can also be interpreted and
transformed. Line Arc
Line
No.
Movement
Type
Coordinates Coordinate
System
Offset
Type
Line
No.
Movement
Type
Coordinates Coordinate
System
Offset
Type
Canned Cycle Zero Return
Line
No.
Start Coordinates Coordinate
System
Offset
Type
Line
No
Start. Coordinates - -
Fig.�5 NC codes restructured by the developed NC codes parser
Interpolation. Interpolation algorithm dedicated for the VR CNC needs to be implemented in the
VR controller to ensure the correct motion. For example, total tool path length must be obtained for
the linear motion before X-, Y-, and Z-axis components were calculated. Every axial component
needs to be subdivided to smoothing the movement, as shown in Figure 6(a). Circular motion was
represented via radius and angles, as shown in Figure 6(b), and arc length was subdivided and
converted back to circular angles for the angular movement. The unit linear motion in this paper was
set to 1 mm and 0.1 radian for angular movement.
Integration of virtual CNC controller and virtual CNC machine. The embedded EONX
component provided by the EON studio was adopted in the VB environment to bridge the interfacing
parameters so that the components movement of the VR CNC can be controlled from the developed
virtual CNC controller by VBScript connection in the developed VB program through EONX 3.0
Type Library. These parameters can be used to transfer the structured data, as shown in Figure 5.
Fig.�4 Virtual controller HMI interface
634 Progress on Advanced Manufacture for Micro/Nano Technology 2005
(a) Linear motion through X-, Y-, and Z-components (b) Circular motion through radians
Fig. 6 Movement for Linear and Circular motion
Implementation and case study
Two VR CNCs have been constructed. One is the Davinci
three-axis milling machine developed by the Precision Machinery
Corporation, as shown in Figure 7, and the V30 milling machine, as
shown in Figure 2. The operation of the developed VR CNC was
started from edge tracing of X coordinate, as shown in Figure 8(a);
the edge tracing of Y coordinate is similar to X edge. The Z
workpiece origin is obtained as shown in Figure 8(b). Both Figure
8(a) and Figure 8(b) were operated in MDI mode of the VR CNC.
Once the workpiece edge (X,Y,Z) is obtained from the VR MDI
mode, either G92 or G54~G59 can be used to set the workpiece
origin before the NC tool path can be started. Coordinates settings in through the MDI mode is the
easiest way to teach a novice to be familiar with the meaning of machining coordinate systems.
However, it is always very dangerous in hand on practice for configuring the work piece zero origin.
With the assistance of the developed VR CNC and accompanied VR CNC controller, hand on
operation through VR CNC will not break anymore. The tool exchange can be operated, as shown in
Figure 8(c), and the tool path simulation can also be started as well, as shown in Figure 8(d).
(a) tracing origin in X direction (b) tracing origin in Z direction
(c) tool exchange (d) tool path simulation
Figure 8 Tracing workpiece origin, tool exchange and tool path simulation
Conclusions and future work
This paper has successfully developed a VR CNC milling machine through the integration of virtual
reality software and Microsoft Visual Basic programming environment. The key enabler of the VR
CNC – VR controller was created to parse NC codes and to provide 3D graphic user interface to ease
Figure 7 VR Davinci milling
machine
Materials Science Forum Vols. 505-507 635
the operation of the VR CNC. The NC codes parser can restructure the user entered NC codes file and
the tool path can be simulated afterwards. The file size of he established VR CNC were very small
compared with that of CAD file size, for example, Davinci VR CNC was about 20MB (approximately
120 MB in original CAD geometry) and V30 VR CNC was about 7MB (approximately 80 MB in
original CAD geometry), which is one of the major advantages of VR CNC. The developed VR CNC
has been tested in a CAD/CAM class conducted by the author showing very reasonable performance.
The CNC courses is expected to be changed through the application of VR CNC. Although the
function of real time material removal was not supported directly by the VR software, some work
around might be possible to tackle this issues; for example, collision node and shape deformation
might be possible. Further development can also be focused on integrating electronic message gloves
or Head Mounted Display (HMD) with the VR CNC so as to emulate the operation of VR CNC by
hands. VR CNC structures can also be gradually constructed and installed in the machine data base so
that the VR CNC user can change VR machines as will and so is the VR controller.
Acknowledgments
The authors would like to express their appreciation for the support from the National Science Council (NSC)
in Taiwan through Grand NSC-93-2212-E-151-019.
References
[1] S.C. Lin, “Computer Numerical Control – From programming to Networking”, Delmar Publisher, 1994, pp. 6-22
[2]Peng-Sheng Hsu, “Study on Kinematic Movements for Multi-axis Machine Tool by Virtual Reality”, Master Thesis,
Department of Mechanical Engineering, National Cheng Kung University, Tainan, Taiwan, R.O.C., 2001
[3]Hui-Chin Cheng, Chou-Chen Lee, “The Technique of Virtual Reality Applies and Studies in the Training of Lathe
Machine Operation”, Proceedings of the 21stNational Conference on Mechanical Engineering, the Chinese Society of
Mechanical Engineers, Kaohsiung, pp.6131-6136, 2004
[4]Y. C. Kao, H. Y. Cheng, M. S. Chen, Y. C. Chen, ” Development of a Web-based Interactive Virtual CNC Learning
System”, SME Taipei Chapter 2004 Annual Meeting and the 4th Conference on Precision Mechanical Manufacturing,
B04-003, Taipei, 2004
[5]S.K. Ong and M.A. Mannan, “Virtual reality simulations and animations in a web-based interactive manufacturing
engineering module”, Computers & Education, Vol.43, pp. 361–382, 2004
[6]S. K. Ong, L. Jiang and A. Y. C. Nee, “An Internet-based Virtual CNC Milling System”, The International Journal of
Advanced Manufacturing Technology 20:20-30, 2002.
[7]Suk-Hwan Suh, Yoonho Seo, So-Min Lee, Tae-Hoon Choi, Gwang-Sik Jeong, Dae-Young Kim “ Modelling and
Implementation of Internet-Based Virtual Machine Tools ”The International Journal of Advanced Manufacturing
Technology 21:516-522, 2003
[8]Fuhua Lin, Lan Ye, Vincent G. Duffy, Chuan-Jun Su “Developing Virtual Environments for Industrial Training”
Information Sciences140, pp.153-170, 2002
[9]Lihui Wang, Peter Orban, Andrew Chunningham, Sherman Lang ”Remote Real-time CNC Machining for Web-based
Manufacturing” Robotics and Computer Integrated Manufacturing 20, pp563-571, 2004
[10]Anders Jınsson, Johan Wall, Gıran Broman*, ”A virtual machine concept for real-time simulation of machine tool
dynamics”, International Journal of Machine Tools & Manufacture 45, pp795–801, 2005
[11]Wei-Cheng Hsu, ” Study on Cutting Motion of Multi-axis Machine Tool by Virtual Reality”, Master Thesis,
Department of Mechanical Engineering, National Cheng Kung University, Tainan, Taiwan, R.O.C., 2002
[12]Ta-Lung Liu, ” Study on Simulation of Cutting Motion in Multi-axis Machine Tool by Interpolation Algorithm”,
Master Thesis, Department of Mechanical Engineering, National Cheng Kung University, Tainan, Taiwan, R.O.C.,
2003
[13]Rong-Shean Lee, Yan-Hong Lin, ”Study on Universal Construction of Five-axis Virtual Machine Tool”�The 13th
Automation Technology Conference, Taipei, pp.52-59, 2004
[14]Y. C. Kao, H. Y. Cheng, M. S. Chen, Y. C. Chen, “The Development of a CORBA-Based Virtual CNC Milling
System”, The 13th Automation Technology Conference, Taipei, pp.51-56, 2004
[15]Y. C. Kao, H. Y. Cheng, M. S. Chen, Y. C. Chen, “Research on the Integrated Human-Machine Interface of Virtual
CNC and Remote Networked Machining”, Proceedings of the 21stNational Conference on Mechanical Engineering,
the Chinese Society of Mechanical Engineers, Kaohsiung, pp.6179-6185, 2004
[16] Y.C. Chen, Cheng-An Fang, Mau-Sheng Chen, H. Y. Cheng, Yung-Chou Kao, “Study on the Integration of a Virtual
and Physical CNC Milling System”, Proceedings of Automation 2005, The Eighth International Conference on
Automation Technology Conference, Taichung, Taiwan, 2005
636 Progress on Advanced Manufacture for Micro/Nano Technology 2005
Progress on Advanced Manufacture for Micro/Nano Technology 2005 10.4028/www.scientific.net/MSF.505-507 Development of a Virtual Controller Integrating Virtual and Physical CNC 10.4028/www.scientific.net/MSF.505-507.631
DOI References
[5] S.K. Ong and M.A. Mannan, “Virtual reality simulations and animations in a web-based interactive
manufacturing ngineering module”, Computers & Education, Vol.43, pp. 361–382, 2004
doi:10.1016/j.compedu.2003.12.001 [6] S. K. Ong, L. Jiang and A. Y. C. Nee, “An Internet-based Virtual CNC Milling System”, The
International Journal of dvanced Manufacturing Technology 20:20-30, 2002.
doi:10.1007/s001700200119 [7] Suk-Hwan Suh, Yoonho Seo, So-Min Lee, Tae-Hoon Choi, Gwang-Sik Jeong, Dae-Young Kim “
Modelling and mplementation of Internet-Based Virtual Machine Tools ”The International Journal of
Advanced Manufacturing echnology 21:516-522, 2003
doi:10.1007/s001700300061 [5] S.K. Ong and M.A. Mannan, "Virtual reality simulations and animations in a web-based interactive
manufacturing engineering module", Computers & Education, Vol.43, pp. 361382, 2004
doi:10.1016/j.compedu.2003.12.001 [6] S. K. Ong, L. Jiang and A. Y. C. Nee, "An Internet-based Virtual CNC Milling System", The International
Journal of Advanced Manufacturing Technology 20:20-30, 2002.
doi:10.1007/s001700200119 [7] Suk-Hwan Suh, Yoonho Seo, So-Min Lee, Tae-Hoon Choi, Gwang-Sik Jeong, Dae-Young Kim "
Modelling and Implementation of Internet-Based Virtual Machine Tools "The International Journal of
Advanced Manufacturing Technology 21:516-522, 2003
doi:10.1007/s001700300061 [8] Fuhua Lin, Lan Ye, Vincent G. Duffy, Chuan-Jun Su "Developing Virtual Environments for Industrial
Training" Information Sciences140, pp.153-170, 2002
doi:10.1016/S0020-0255(01)00185-2 [9] Lihui Wang, Peter Orban, Andrew Chunningham, Sherman Lang "Remote Real-time CNC Machining for
Web-based Manufacturing" Robotics and Computer Integrated Manufacturing 20, pp563-571, 2004
doi:10.1016/j.rcim.2004.07.007