<<

G-Code interpreter development using for ABL63 Control SystemS

Alma G. Rodríguez* Luis R. Vidal P.** *** submitted date: November 2013 Juan Miguel Díaz M. received date: December 2013 Cesar Leonardo González Pinzón**** accepted date: February 2014

Abstract This paper discusses the development process involved in making a user interface translate G-Code (ISO6983) using Microsoft Visual Basic 2010 together with communication protocol OPC. This interface was developed in three modules, the first one verifies syntax and lexicon, the second is a command converter for a Programmable Logic Controller Allen Bradley L63 using a SERCOS interface card and servo drive ULTRA 3000, and the last one executes motion control instructions. The interface is used for a profile milling process, on an XY plane and using G00, G01, G02 and G03 codes generated in a Fanuc postprocessor 3XMILL. The interface shows errors detected in the verification module according to the parameters established and identifies the corresponding line; it also monitors the XY position in real time, The interface allows line-by-line execution or auto- matic mode. The interface does not require information for cutting speed, tool advance speed, and spindle speed or tool compensation from the NC

* B.Sc. In Industrial Engineering, Universidad Autónoma de Ciudad Juárez (México). E-mail: [email protected] ** B.Sc. And MSc. in Industrial Engineering, Instituto Tecnológico y de Estudios Superiores de Monterrey (México). Current position: Professor Universidad Autónoma de Ciudad Juárez (México). E-mail: [email protected] *** B.Sc. In Industrial engineering and MSc. in Industrial Engineering, Instituto Tecnológico y de Estudios Superiores de Monterrey, (México). Current position: Professor Universidad Autónoma de Ciudad Juárez (México). E-mail: [email protected] **** B.Sc. In Production engineering, Universidad EAN, Bogotá (Colombia). MSc. In Industrial Automation Engineering, Universidad Nacional de Colombia, (Colombia). Current position: Professor Universidad Autónoma de Ciudad Juárez (México).E-mail: [email protected], [email protected]

Electronic Vision - year 7 number 1 pp. 143 - 153 january -june of 2014 143 Alma G. Rodríguez - Luis R. Vidal P. - Juan Miguel Díaz M. - Cesar Leonardo González Pinzón

program. The interface was also developed using With the implementation of Programmable incremental and reuse oriented methodologies. Logic Controller (PLC) [4] the motion control functions can be executed, assisted by motion Key words control instructions and motion analysis soft- Interface, G-Code, Programmable Logic Con- ware. The motion control is an automation troller, Milling process, servo drive, commu- field in charge of developing technologies and products that improve precision systems sig- nication protocol. nificantly [5]. Servomotors are controlled by the PLC through the use of a servo drive and 1. Introduction a communications interface, such as the I/O cards for sensors and other actuators. The increasing demand for quality products introduces the need to develop and impro- In recent years, research on G-Code inter- ve CNC (Computer Numerical Control) ma- preters has become relevant and intended to chine tools. CNC systems have a computer develop open systems with universal appli- that reads and interprets instructions in ma- cations, some cover standards ISO6983 and chine language or G-Codes for guiding a tool NC program structures [6], [7], [8], [9], [1]. The Numerical Control (NC) program is some others cover the most recent standard the one that details the instructions step by STEP-NC (Standard for the Exchange and step, indicating the machine what path to fo- Sharing of Product) [10] and [11]. In general, llow and which operation to execute for the the trend is marked by the interpreter. machining of a part. At the beginning, CNC machines were used exclusively by the aeros- 2. Methodology pace industry, now they have been adapted to other industries like wood [2] and plastics [3]. The method used for the development of What distinguishes a particular machine for this study includes six main stages, as shown a specific application is a variety of settings in Figure 1. In the first stage, requirements like load charges, vibration, cutter, working are defined, namely the definition of the NC area, machining velocities and precision re- program structure, selection of the post pro- quirements. Through the Computer Aided cessor used for test and validation, hardware and software requirements. The second sta- Design and Computed Aided Manufacture ge is called conceptual design and consists in (CAD/CAM) it is possible to create different proposing the conceptual model. The third part designs and generate the corresponding stage is the development of the GUI, where NC program with a postprocessor. Postpro- the main module and the process interface are cessors are translation tools of CAM software explained. Since the validation of the interface that convert a design, or path, in a language is taken to a physical cutting process, the next that can be understood by the control modu- stage, called development of the control mo- le of the CNC machine. The commands and dule, is necessary for the control of the multi- information described in the NC program axis system. After the GUI and the control cannot be managed directly, so it is the inter- module are finished, integration takes place in preter that extracts the corresponding data order to make everything work together. Fi- and translates it into machining and motion nally, the last stage involves validation of the control commands for the controller. method. Two validations were conducted; the

144 Universidad Distrital Francisco José de Caldas - Technological Faculty G-Code interpreter development using Microsoft Visual Basic for ABL63 Control SystemS

first validation is through a checklist of the ex- of the file is not satisfied, the program will A CASE-STUDY pected operation and performance of the GUI stop and the error should be shown to the VISION as a software product, and the second valida- user in the interface and saved on an errors tion was performed over the milling process file (location shown to the user). Some of the when machining an irregular path. rules defined for the verification function are:

2.1 Defining requirements 1. XY plane. The structure and format of the NC program change from one postprocessor to another, so it 2. Metric system. was necessary to specify a basic structure with 3. Absolute coordinates. a generic format for the test of the G-Code in- terpreter prototype. The structure was defined 4. Eliminate commentaries. following the research made by Hong et al. [12]. 5. Each block must be numbered (exam- The format considered the default postproces- ple,”N100 G00 X3. Y3.”). sors included in MasterCAM X4; the one selec- ted was a Fanuc 3XMILL postprocessor. 6. Machining commands G00, G01, G02, and G03 are written once and the following Figure 1. Method blocks take the same command unless other command is specified.

7. Verify that there is a numeric value after the address character X/Y.

8. Limit travel for X-axis -350 to 350 mm.

9. Limit travel for Y-axis -150 to 150 mm.

An XY multi-axis system was used for the execution of the motion commands of the G- Code. For the DDE between the interface and the PLC, a communication protocol is requi- red. OPC technology was chosen as a solution for the data exchange, making it possible to monitor the process and also to convert ma- chining control commands into motion con- trol instructions in the PLC. Since the main Source: own elaboration purpose of this research is the interpretation of the machining control commands, turning As a requirement for the interpreter’s develo- them into physical motion and therefore a cut- pment, the lexicon and syntax rules are speci- ting process (milling), it has been set that the fied for a quick revision of the file, that is, for cutting parameters are not taken from the NC interpretation so as to check the verification program but are to remain fixed in the PLC rules and identify errors. The verification is program. The execution of the interpreter is made in the interface and once it is positive, line-by-line and the process may operate bet- the process may continue. If the verification ween semi-automatic and single block modes.

Electronic Vision - year 7 number 1 pp. 143 - 153 january -june of 2014 145 Alma G. Rodríguez - Luis R. Vidal P. - Juan Miguel Díaz M. - Cesar Leonardo González Pinzón

2.2 Conceptual Design Figure 2. Conceptual design The conceptual design proposed for the G- Code interface consists in a modular design, as shown in Figure 2. The first module co- rresponds to the reading and storage of the NC program based on a basic structure, whe- re a block is made of a word and the words made of characters; finally these characters are divided in direction and value. After the data is stored, the revision of lexicon and syn- tax is made in the verification module, where a table of legal words and limit travel para- meters is accessed for comparison. During verification, the errors found in the NC pro- gram are displayed on the interface with the Source: own elaboration corresponding block and description. Finally, a .txt file is generated containing an error re- 2.3 Design port. Once the file has been verified, the co- A GUI assists the interaction between the rresponding G-Codes and its XY parameters user and the machine. The software product are sent as OPC data to the PLC controller consists of two GUIs and the controller pro- for translation into motion command instruc- gram. The GUIs correspond to the main inter- tions, based on the conversion table shown in face and the process interface. Two software Table 1. The motion control instructions are development process models were followed, executed by the multi-axis system. namely reused-oriented and incremental.

For the reused-oriented model there were Table 1. Conversion Table two components, the first component for mo- nitoring a variable by OPC [13] and the se- G- Motion Control OPC data cond consisting of a VB class with functions Code Instructions (PLC) required for sending and reading OPC data [14]. The incremental model consists of three incre- MAM G00 X, Y (Motion Axis Move) ments developed for the interfaces; the first for the function that stores the observation. MCLM (Motion The second, and one of the most important, G01 Coordinated X, Y was for the function that verifies the file Linear Move) chosen, generating an error report if neces- MCCM (Motion sary. For the third increment, a function for Direction, G02 Coordinated X, Y, R the preparation of the data that will be sent Circular Move) though OPC was developed. MCCM (Motion Direction, 2.3.1 Main and Process Interfaces G03 Coordinated X, Y, R Circular Move) During the process, the main interface inclu- des a user control access, verification file, posi- Source: own elaboration tion monitoring, error handling, and stop-reset.

146 Universidad Distrital Francisco José de Caldas - Technological Faculty G-Code interpreter development using Microsoft Visual Basic for ABL63 Control SystemS

The interface follows sequential programming. When the process is running, either on semi- A CASE-STUDY The NC program is chosen and verified. automatic or single block mode, the main VISION interface displays the current and expected For the process to start, it is necessary to position using monitoring variables created make sure that the OPC connection has been with the first reused-oriented component. established. The “Connect” button calls for the OPC connection function from the VB class of The main interface also displays the comple- the second reused-oriented component. te NC program for further observations. The user has the option of stopping and resetting For the semi-automatic mode, the file is read the process in case of emergency or whe- again line by line sending the data extracted never a particular situation arises. The data from each block. The next line is read until the sent to the PLC in these cases is a priority for axes operation is finished. The single block the controller program. Once the stop button mode also reads line by line, extracting the co- rresponding data, but the data is sent until the is activated, the reset button is enabled and user makes this decision, as long as the pre- it has to be pressed to star another process vious axes operation has been completed. from the beginning, Figs. 3 a, b.

Figure 3. a) Main interface. b) Process interface a) b)

Soruce:

Overall, 33 OPC items were used for the co- program to the PLC so it has most of the OPC rrect NC program interpretation and functio- item used. In Figure 4, the items and their co- nality of the interface and process. The items rresponding interface relation is shown. It is exchange data between the interfaces and the important for the process to start with all the PLC, which controls the servo drives and the- items on-line; to this end, on the first tests, refore the axis system. The process interface the items were monitored in the OPC Test sends the information extracted from the NC Client tool of RSLinx.

Electronic Vision - year 7 number 1 pp. 143 - 153 january -june of 2014 147 Alma G. Rodríguez - Luis R. Vidal P. - Juan Miguel Díaz M. - Cesar Leonardo González Pinzón

Figure 4. OPC items on-line

Source: own elaboration 2.4 Control Module ming in RSLogix 5000. The commands are When the interpreter has sent the correspon- run block by block as the interpreter transla- ding data to the motion control instructions, tes the program. the control module sets these data into the PLC program. The routines programmed in The connections and cabling of the system requi- the PLC make the translation into motion red are shown in Figure 5. The configuration of control instructions possible as well as the Ethernet and the OPC Server was made in RS- execution of these commands. The program Linx Classic. The axes were configured following includes ladder and structured text program- the Rockwell Automation manuals [15], [16].

148 Universidad Distrital Francisco José de Caldas - Technological Faculty G-Code interpreter development using Microsoft Visual Basic for ABL63 Control SystemS

Figure 5. Hardware diagram A CASE-STUDY VISION

Source: own elaboration 2.5 Integration interface started sending data of the same ba- For the integration of the interfaces and the sic shapes, now described in a NC program file. control module three routines were program- This data-sending process was monitored using med for each of the motion control instructions the OPC Test Client. Finally, data reading from used. The first tests had all the PLC data preset the PLC to the interface for the position moni- for basic figures such as squares, a diamonds toring was added to both programs completing and moon-like shapes, and also for testing the the software product proposed. The tests for circular interpolations, as shown in Figure 6. the integration were not conducted, simulating Once the PLC program was ready for the in- the machining process controlling the axes in coming OPC data, the function of the process semi-automatic and single block modes.

Figure 6. Testing paths

Source: own elaboration

Electronic Vision - year 7 number 1 pp. 143 - 153 january -june of 2014 149 Alma G. Rodríguez - Luis R. Vidal P. - Juan Miguel Díaz M. - Cesar Leonardo González Pinzón

2.6 Validation program as an input. The result of the main For the validation of the interpreter, the pro- interface during a process is shown in Figure gram was run for irregular paths. The Z para- 7. The verification, error handling and moni- meter was identified during the process and a toring worked as expected. If an error occurs prompt window was displayed indicating the during the NC program verification, the pro- user when to turn the drill on/off and when to cess will not continue and the errors will be drill down or lift it. The validation of the inter- displayed and saved in an error report file (the preter was also made by using a requirement file location is indicated on a prompt window). revision that included checking the correct Regarding the position monitoring, the current functionality of the control user, browsing and expected position (corresponding to the the file, programming the file displayed, ve- current block) are displayed in the interface, rification, error handling, homing sequence, as well as the block in process. This is possible position monitoring, etc. The second valida- due to the OPC data transference between the tion was carried out through the machining interface and the control module (PLC). process of the irregular path generated. The first tests are shown in Figure 8; the re- 3. Results sults were as expected since the machined The G-Code interpreter prototype was deve- path followed the programmed routine. The loped and successfully implemented using Vi- milling process was done with a 1/16” cut- sual Basic and a control module. The current ter, a 2mm depth at a 7.08 in/min speed. The version achieved all the functions proposed routines verified the motion machining com- for the research. The program was made to be mands (G00, G01, G02, and G03) conversion tested in a Fanuc postprocessor 3XMILL NC into motion control commands

Figure 7. Main interface during process

Source: own elaboration

150 Universidad Distrital Francisco José de Caldas - Technological Faculty G-Code interpreter development using Microsoft Visual Basic for ABL63 Control SystemS

The equipment used for the control modu- For the first run with the whole system inte- A CASE-STUDY le included an L63 PLC, a Multi-Axis MPS- grated, a 1/8” cutter was used at a 4mm depth VISION Series and two servos drives ULTRA3000, and a speed of 35.43in/min in a delrin sheet brand Allen Bradley. The control module of 1ft 2.1 of thickness. For a better fi- program consists of seven routines: Startup, nish, the rest of the validation tests were run Shutdown, Homing, Restart, Positioning Mo- at a speed of 7.08 in/min with a 2mm depth. tion, Linear Motion, and Circular Motion. The path designed in MasterCAM X4, used for the validation, is shown in Figure 10. The final machining is shown in Figure 11. Figure 8. Motion control-routine test result. a) Diamond, b) Moon, ) Square Figure 10. “UACJ” paths CAM design. a)

b) Figure 11. “UACJ” Machining results.

c) 3. Conclusion

A prototype of G-Code interpreter was propo- sed. The interpreter was successfully imple- mented through a semi-automatic and single- block CNC milling process. The machining process used for the validation was possible through the control of a three-axis system. The control was PLC-based and the data was sent Source: own elaboration using OPC, making the communication bet-

Electronic Vision - year 7 number 1 pp. 143 - 153 january -june of 2014 151 Alma G. Rodríguez - Luis R. Vidal P. - Juan Miguel Díaz M. - Cesar Leonardo González Pinzón

ween the user interface and the control modu- [5] Rockwell Automation, “Literature Li- le possible. The conversion into motion control brary”, 2013, April, disponible en: http:// instructions made it possible to construct the ab.rockwellautomation.com/ interpreter from a physical point of view. Since [6] Long Chen, Dong Yu, Han Zhang, Cong the purpose of this research was to validate the Geng & Lei Dong. "Design and imple- interpretation of the motion machining control ment of a modularized CNC interpreter commands, the non-motion machining control based on the integration of tool path commands remained fixed during the milling planning module". IEEE International process. Compared to previous works, the pre- Conference on Computer Science and sent interpretation of the motion machining Automation Engineering (CSAE), vol. commands of the G-Code was taken into a con- 3, DOI: 10.1109/CSAE.2012.6273027, trol module to actually carry out a machining 2012, pp. 613-616 process (milling), [17], [18]. [7] Gao Qi & Zu Yingli (2011). Research on In future work, the lexicon and syntax rules universal NC program processor for CNC will be incremented to have a complete dic- system. 2nd International Conference on tionary data structure as well as the control of Digital Manufacturing & Automation. the Z-Axis for a complete automatic control of 2011, pp. 1046- 1049. the CNC milling prototype machine. The GUI [8] Yadong Liu, Xingui Guo, Wei Li, Kazuo will also be improved by adding an edition tab Yamazaki, Keizo Kashihara & Makoto and a simulator for path and machining. Fujishim, “An intelligent NC program processor for CNC system of machine References tool. Robotics and Computer-Integrated Manufacturing”.2007, pp.160-169 [1] Albert. "Understanding CNC Routers. [9] Xingui Guo, Yadong Liu, Daoshan Du, Canada",Canadá: FP Innovations. 2011. Kazuo Yamazaki & Makoto Fujishima, “A [2] Fusaomi Nagata, Yukihiro Kusumoto & universal NC program processor design Keigo Watanabe. "Intelligent machining and prototype implementation for CNC system for the artistic design of wooden systems”. The International Journal of paint rollers. Robotics and Computer-In- Advanced Manufacturing Technology, tegrated Manufacturing",2009, pp. 680- 2012, volumen 60, pp. 561-575, DOI: 688. doi:10.1016/j.rcim.2008.05.001: 1.1007/s00170-011-3618-6 [3] Hui Zhang, Changsheng Ai, Fang Zhao [10] H. Lan, R. Liu & C. Zhang, “A multi- & Xiangbo Ze, “The CNC Development agent-based intelligent STEPNC contro- of the Sawing and Milling Machining ller for CNC machine tools". Internatio- Center for Plastic Door and Window nal Journal of Production Research. , vol. PVC Profile Based on Fanuc0. 7th World 46, no. 14, pp. 3887-3907, Julio 2008 Congress on Intelligent Control and Au- [11] W. X. Chen (2010). Research on STEP- tomation (WCICA)”, DOI:10.1109/WCI- Compliant CNC System for Integration CA.2008.4593912, 2008, pp. 9362 - 9367 of CAD/CAPP/CAM. Mechanical Manu- [4] W. Bolton, “Programmable Logic Contro- facturing and Automation, pp. 529-551, llers”. USA: Newnes, 2009. 2010.

152 Universidad Distrital Francisco José de Caldas - Technological Faculty G-Code interpreter development using Microsoft Visual Basic for ABL63 Control SystemS

[12] Haitao Hong, Dong Yu, Xiaohui Zhang & [15] Rockwell Automation (2010, November). A CASE-STUDY Long Chen (2010), Research on a new MP-Series Integrated Multi-axis Linear VISION model of numerical control program Stages. Allen Bradley, Rockwell Soft- interpreter. 2nd International Confe- ware, Rockwell Automation, pp. 1-136, rence on Advanced Computer Control 2010, November (ICACC), vol. 2, 467-472. doi: 10.1109/ [16] Rockwell Automation (2011, November). ICACC.2010.5486632 SERCOS and Analog Motion Configura- [13] Guo Huijuan, Guo Huijuan & Zhi Derui. tion and Startup. Allen Bradley, Rockwell Design of several OPC servers commu- Software, Rockwell Automation, 1-318, nication system. International Conference MOTION-UM001B-EN-P. on Electric Information and Control Engi- [17] QIAN Xinhua, JIA Shiyang, SU Xing, neering (ICEICE), pp. 317-319, 2011. CHEN Yue, WANG Kefeng & YAO Pin- [14] Yuxiang Wu & Christine W. Chan, “A data gjing (2010). Adaptive analysis decision support system for the [18] On-line Operation Guide for Dry Gas-to- carbon dioxide capture process. Expert ethylbenzene Reactor. Chinese Journal Systems with Applications”, pp. 9949- of Chemical Engineering, vol.18, no.3, 9960, 2009 419-424.

Electronic Vision - year 7 number 1 pp. 143 - 153 january -june of 2014 153