An intelligent NC program processor for
CNC system of machine tool
Yadong Liua,_, Xingui Guoa, Wei Lia, Kazuo Yamazakia,
Keizo Kashiharab, Makoto Fujishimab
Abstract NC program interpreting is one of the most important tasks of CNC in machine tool system. The existing CNC systems only support
vendor-specific NC program input, which restrict the applying of other similar functional NC programs with different program format.
Especially for those users owning several machine tools with different CNC from the same provider, the diversity of NC programs
dramatically increases their cost and time on operator training and machine tool maintenance. In order to deal with the variety of NC program, an intelligent NC program processor (NCPP) is proposed in this paper.
1. Introduction
In the CNC system of modern machine tool, NCprogram interpreting is very important, which is in charge of the accurate resolving of machining intention generated from CAM system. The major function of NCPP is to decode the input into motion command and programmable logic
controller (PLC) command, and send them to the motion control processor (MCP) and PLC of CNC separately in order to control the movement of the cutting tool and auxiliary machine logic. Most CNC systems can handle only one specific NC program format, while the diversity of NC programs always entangles the machine tool users,especially for those owning several machine tools with different CNC but from the same provider.
2. Interface of NC program processor
NCPP is one module of the CNC, which requires cooperation between different modules; therefore it’s quite necessary to clarify the interface before starting design. The purpose of NCPP is to translate the input NC program into machine instruction, such as
motion command, PLC command or simple parameter settings and error messages. NIST calls these outputs as Canonical Machining Functions.
The canonical machining functions were devised with two objectives
in mind:
_ All the functionality of common 3- to 5-axis machining centers had to
be covered by the functions; for any function a machining center can perform, there has to be a way to tell it to do that function.
_ It must be possible to interpret RS274-compatible NC program into canonical machining function calls.
3. Conceptual model of proposed NCPP
Compared to the traditional design, the major feature of this NCPP
is the structure with separation of NCSD and processing engine.Within this
NCPP, different NC program could be interpreted in terms of different NCSD, while the processing engine keeps the same. For example, suppose the input NC program follows Fanuc specification, the
engine will refer to the Fanuc NCSD to do interpretation. Next time, if a NC program following Mitsubishi specification is given, the same engine will refer to the Mitsubishi NCSD to interpret it. For the two cases, it can be seen that each time only different NCSD is chosen, while the processing engine does not change. Such a solution provides dramatic flexibility and stability for the NCPP development, only one set of software code of the processing engine needs to be maintained. Even if there is an input NC program following a NC specification which is not available in the existing NCSDs, a new NCSD can be generated and added easily without recompiling the source code of the processing engine..
4. Design of proposed NCPP
Based on the conceptual model of the proposed NCPP If looking inside the NCPP, the key portion is the interpreting (processing) engine mentioned before, from a compiler’s point of view, the engine can be divided into four steps in order to check and decode an input NC program.
These four steps are:
_ Lexical analysis, which checks the character-based error within a NC program.
_ Syntax analysis, which makes sure the logic relation within each block of NC program is correct.
_ Semantic analysis, which checks the inter-block logic correctness of a NC program.
_ Optimization and code generation, which decode block and generate the canonical machining functions.
4.1. Lexical analysis
The major functionality of lexical analysis is to merge a sequence of characters from the input NC program intosequence of words, which is a high-level representation unit,Meanwhile, in this step, all blank and comments within the program will be deleted. After lexical analysis, a symbol table with the same information but more systematic compared to the original character-based program will be built. During analysis, all character-based error will be checked, for example whether the unacceptable address letters has been used or not. In this paper, one dictionary has been designed in this step to store all the valid address letters.
4.2. Syntax and semantic analysis
Syntax analysis is to determine if a sequence of words within a block is syntactically correct, it is also called intra-block check. It includes the range checking of the data portion of a word and the parameters format checking.
Semantic analysis checks the major inter-block error,which means to
make sure whether the logical relationship among several blocks of NC program is correct or not, for example, the same group G/M word cannot appear more than once in a block; block/word sequence should be subject to the G/M word execution order table, spindle should be turned on before any cutting motion starts, etc.
In order to design NCSD for syntax and semanticanalysis, three kinds of cases of NC blocks should be analyzed:
Case 1: Extract data expression in each word of NC
program. For example, ‘‘X [1+2_3–4/5], Zsin[30],
#1 2.0 F #1’’ should be correctly decoded as ‘‘X6.2, Z0.5, F2.0’’. Case 2: Check syntax relation of words within each block. For example, within block ‘‘G17 G02 X10 Y20 I-10
F15 S100 M03’’, Z-axis value should not appear since in
_ Terms with quote symbol as header and ender are terminal symbol.
_ Interpreting an expression is to apply one or more of the syntax rules.
NC language can be considered as one type of simple computer programming language; therefore it’s quite reasonable to use EBNF to represent the NC program syntax. Based on that, the structure of NCSD can be systematically defined.
4.3.1. Syntax representation using EBNF
Based on these EBNF representations, case 1 mentioned in Section 4.2 can be easily solved. The fig shows an example of how to interpret word ‘‘X[1+2_3–4/5]’’ using these EBNF representations, as shown in this figure, two stacks (first in last out
Fundamental EBNF representation of NC language
mechanism) are used: value stack and operator stack. The operator stack is subject to a rule: the priority of each item is always in a decreasing order while the execution with highest priority always happens first. Following is the ordered operation list of interpreting:
(1) Apply first EBNF rule defined, read the symbol ‘[’ and push it into the operator stack.
(2) Apply EBNF rule 2,1,7,9 in turn, read value ‘1’ and symbol ‘+’, and then push them into value stack and operator stack, respectively.
(3) Continue to apply rule 1,7,9 twice, read ‘2’/‘3’ and ‘*’/
‘_’ separately, and push them into corresponding stacks.
(4) Since operator ‘*’ on the top of the operator stack has higher priority than its previous one ‘+’ and higher than the current one ‘_’, current value 3’ is used to execute multiplication with ‘2’ popped up from the value stack. The result is pushed back into the value stack, while current operator ‘_’ is pushed into the operator stack.
(5) Continue the quite similar operation as above mentioned until the operator stack is empty and the last value ‘6.2’ is popped up from the value stack.
(6) The last value ‘6.2’ is the final result. Therefore, ‘‘X [1+2_3–4/5’’ is interpreted as ‘‘X6.2’’.
For case 2 and 3, Fig. 9 gives the EBNF representation of a general NC block while Fig. 10 shows partial syntax EBNF representation of each G/M/F/S/T word in a group manner.
Let us use a NC blocks example shown before in Section
4.2 to explain how these EBNF rules are being applied. For each block of the following example:
‘‘N0010 G91 G40
controller翻译中文N0020 S100 M03
N0030 G01 G53 X20 F15’’
EBNF rules B.1 in Fig. 9 will be firstly applied, and then the detailed word EBNF rules in Fig. 10 will be applied. Now for the first block, assuming the default modal is G01, the rule 1, 2 and 6 of B.1 will take
effective, then in rule 6 of B.1, rule B.3 is applied further and a correct check result will be returned. The similar procedure will be done for the second block. Then for the third block, as rule B.3 is applied, rule 4 of B.2 will be applied too, which is (G53_Expr ‘g53’
+ABS_Mode+G40_Expr+‘g00’|’g01’). In this rule, ‘ABS_Mode’ (‘g90’) is required when ‘g53’ is
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论