1 Introduction
The RS274/NGC Interpreter (the Interpreter) is a software system that reads numerical control code in the "NGC" dialect of the RS274 numerical control language and produces calls to a set of canonical machining functions. The output of the Interpreter can be used to drive machining centers with three to six axes. Two earlier versions of the RS274/NGC Interpreter were built. This report describes a new version, version 3.
The Interpreter may be used either (1) in a stand-alone system, the "Stand-Alone Interpreter" (SAI) that reads RS274/NGC control code and writes canonical machining function calls but does not control physical equipment, or (2) integrated with an Enhanced Machine Controller (EMC) system, as described below, to control a machining center.
This report is self-contained in regard to the RS274/NGC language, the canonical machining functions, and the operation of the SAI; no other documents should be required to understand them fully. The report is not self-contained with regard to EMC systems. The reader operating an EMC system will need additional documentation.
The report does not deal with unimplemented alternatives or research issues.
1.1 Audience
This report is intended to be useful to:
· programmers writing RS274/NGC programs that will be run on an EMC controller or tested on the SAI,
The beginning of each major section and appendix of the report describes the audience for the section.
1.2 Background
1.2.1 Enhanced Machine Controller Project
The Intelligent Systems Division of the National Institute of Standards and Technology (NIST) is carrying out an Enhanced Machine Controller project. The primary objective of the project is to build a testbed for evaluating application programming interface standards for open-architecture machine controllers. A secondary objective is to demonstrate implementations of the Next Generation Controller (NGC) architecture.
1.2.2 Numerical Control Programming Language RS274
RS274 is a programming language for numerically controlled (NC) machine tools, which has been used for many years. The most recent standard version of RS274 is RS274-D, which was completed in 1979. It is described in the document "EIA Standard EIA-274-D" by the Electronic Industries Association [EIA]. Most NC machine tools can be run using programs written in RS274. Implementations of the language differ from machine to machine, however, and a program that runs on one machine probably will not run on one from a different maker.
1.2.3 The RS274/NGC Language
The NGC architecture has many independent parts, one of which is a specification for the RS274/NGC language, a numerical control code language for machining and turning centers. The specification was originally given in an August 24, 1992 report "RS274/NGC for the LOW END CONTROLLER - First Draft" [Allen-Bradley] prepared by the Allen-Bradley company. A second draft of that document was released in August 1994 by the National Center for Manufacturing Sciences under the name "The Next Generation Controller Part Programming Functional Specification (RS-274/NGC)" [NCMS]. All references in this report are to the second draft. The RS274/NGC language has many capabilities beyond those of RS274-D.
In the remainder of this report, "the RS274/NGC language" means that portion of the specification implemented in the EMC project (with modifications and additions). The report does not provide specific references to parts of [NCMS] or discuss how the implementation differs from it. The in-line documentation of the source code for the Interpreter, however, has many references and discusses differences.
1.2.4 Previous Work at NIST
As part of its assistance to the program that developed the NGC architecture, the Intelligent Systems Division prepared a report "NIST Support to the Next Generation Controller Program: 1991 Final Technical Report," [Albus] containing a variety of suggestions. Appendix C to that report proposed three sets of commands for 3-axis machining, one set for each of three proposed hierarchical control levels. The suite proposed for the lowest (primitive) control level was implemented in 1993 by the EMC project as a set of functions in the C programming language. This suite, known in the EMC project and in this report as the "canonical machining functions," was upgraded in 1994 for 4-axis machining, and in 1995 for 5-axis machining. For the Interpreter, the suite has been revised to be suitable for 3-axis to 6-axis machining.
Also in 1993, the authors developed a software system in the C language for reading machining commands in the RS274/NGC language and outputting canonical machining functions. This was called "the RS274/NGC Interpreter." A report, "The NIST RS274/NGC Interpreter, Version 1" [Kramer1] was published in April 1994 describing that interpreter.
In 1994, the EMC project, in collaboration with the General Motors Company (GM), undertook to retrofit a 4-axis Kearney and Trecker 800 machining center with an EMC controller. The retrofit was successfully completed in 1995. For this project, NIST built both Version 2 of the RS274/NGC Interpreter and an RS274KT Interpreter, which interprets programs written in the K&T dialect of RS274 [K&T]. These two interpreters were written in the C++ programming language. Reports were written describing the RS274KT Interpreter [Kramer2] and version 2 of the RS274/NGC Interpreter [Kramer3]. In addition, a report about the canonical machining functions was written [Proctor] which extended them to six axes.
In 1995 the EMC project collaborated with several industrial partners in an open-architecture machine tool controller project known as VGER (a name, not an acronym). This project retrofitted an SNK 5-axis machining center with an open architecture controller. NIST provided the RS274 interpreter for this project [Kramer4]. It was intended to be able to interpret some existing programs for the SNK machine which were written for its former Fanuc controller [Fanuc]. Thus, the RS274/VGER Interpreter took Fanuc flavored RS274/NGC code as input.
1.2.5 Current Work at NIST
The EMC project has provided the EMC controller to several small machine shops. Version 2 of the RS274/NGC Interpreter, with numerous upgrades, has been used as the interpreter. In order to be able to provide EMC controllers for 3-axis to 6-axis machining centers without having many sets of source code to maintain, it was decided to build a single set of interpreter source code that would serve for all. The Interpreter reported here is that one.
1.3 Major Characteristics of the Interpreter
1.3.1 How it Runs
When the Interpreter starts up, before accepting any input, it sets up a world model that includes data about itself, parameter data, and data about the machining center being controlled (including data about the tools in the tool carousel of the machine).
Once initialized, the Interpreter runs using a two-step process:
1. Get a line of RS274/NGC code and read it into memory, building an internal representation of the meaning of the entire line. We will call this stage "reading."
- 2. Change internal state and/or call one or more canonical machining functions (see Section 4) in order to do what the line says to do. We will call this "executing" the line.
The Interpreter runs integrated with the EMC system or in the SAI system. The Interpreter software is the same in both cases. We will refer to the software that tells the Interpreter what to do and asks it for data as the "driver," regardless of whether it runs in the EMC system or in the SAI.
If an error occurs, the Interpreter returns an error code to the driver. It is always possible to recover from an error that occurs during reading. If an error occurs while executing the line, recoverability is situation dependent.
1.3.2 Modes of Use
1.3.2.1 Integrated with EMC System
In the EMC system, the Interpreter is used both to interpret NC programs from files and to interpret individual commands entered using the manual data input (MDI) capability of the control system. When running an NC program from a file, the driver tells the Interpreter when to read another line of code from the program file. When using MDI input, the driver sends the Interpreter a line of code to read that the controller has received from its user interface. Either way, the Interpreter reads the line and tells the driver if the line was readable. If so, the driver tells the Interpreter to execute the line.
The Interpreter does not control machine action directly. Rather, the Interpreter calls canonical machining functions that generate messages, which are passed back to the control system. The control system queues up and executes the messages.
1.3.2.2 Stand-Alone Interpreter (SAI)
The SAI runs in a command window on any computer for which it is compiled. It also reads either from a file or by MDI (from the keyboard of the computer). The SAI is intended to allow the pre-testing of NC programs. It can also be used in MDI mode to experiment with the RS274/NGC language and the Interpreter.