CN104133421A - Motion control code analysis method based on process control - Google Patents
Motion control code analysis method based on process control Download PDFInfo
- Publication number
- CN104133421A CN104133421A CN201410374960.4A CN201410374960A CN104133421A CN 104133421 A CN104133421 A CN 104133421A CN 201410374960 A CN201410374960 A CN 201410374960A CN 104133421 A CN104133421 A CN 104133421A
- Authority
- CN
- China
- Prior art keywords
- process control
- section
- code
- flow process
- control code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Abstract
The invention discloses a motion control code analysis method based on process control. The method includes the following steps that a process control code table and a pairing rule table are set up; an NC code valid section is read from the current position to a computer memory; analytical judgment and processing are carried out on the NC code valid section read into the computer memory; if the NC code valid section is a process control section, the NC code valid section is transferred to a process control processing module for processing, and the process control processing module corrects the current reading position according to processing content; if the current NC code valid section is wrong or an end mark is read, analysis is ended, or the second step is carried out. The universal processing method covers an unconditional transferring process, a conditional branching process and a circulation process and has good universality. An analyzer based on the method can be applied to any motion control code analysis with process control added, and has good openness and expansibility.
Description
Technical field
The present invention relates to motion control code analytic method, relate in particular to a kind of motion control code analytic method based on flow process control, belong to fields of numeric control technique.
Background technology
Digital control processing is the method that completes processing with the motion of digital information control plant equipment, and numerical information is stored in nc program, and therefore, the performance of nc program and execution efficiency will directly affect the quality of digital control processing.A kind of canonical form of nc program is NC code, i.e. NC instruction code.It is to combine after enclosing data by the letter that has defined certain function, and general every instruction completes an action, and some instructions form one section of program by a fixed structure.In concrete nc program, various motion features and the operation of process are generally described with the G code of various preparatory functions and the M code of subsidiary function.NC code is widely used as a kind of canonical form of nc program, but traditional NC code processing in batches, complicated adding show that size of code is huge man-hour, inefficiency, dumb, uncurrent shortcoming.Along with the development of Numeric Control Technology, some advanced digital control systems are incorporated into some flow scheme design modes of computer advanced language in NC code, and such as macroprogram of O instruction, FANUC and the SIEMENS of EMC2 etc., these modes have improved the flexibility of numerical control program.But this class embeds a kind of general analytic method of program shortcoming of flow process control at present, give and wish that the user who oneself customizes digital control system makes troubles.
Chinese invention patent " universal numerical control code analysis method " (application number is 200610161337.6) discloses a kind of universal numerical control code analysis method, but the numerical control code of flow process extension class is not provided to parsing scheme.The realization of decoding of the CNC system user macroprogram function that the people such as Wang Yuhan propose in article " realization of decoding of CNC system user macroprogram function " (" building-block machine and robotization process technology " the 6th phase 4-6 page in 2004), but the method has only been carried out realization of decoding for the macro instruction of FANUC system, lack versatility.
In addition, above-mentioned two kinds of parsing schemes all need after to program code, all scanning deposits in internal memory with data link table form one time, carry out again semantic analysis identification work, can reduce like this execution efficiency, also cannot meet the requirement (as user inputs numerical control code instant execution line by line) of instant execution; Meanwhile, if the valid data amount of a job sequence exceedes memory size, these class methods cannot be carried out.
Summary of the invention
The invention discloses a kind of motion control code analytic method based on flow process control, solved the problem that the motion control code to adding flow process control is resolved.
For achieving the above object, the technical scheme that the present invention takes is:
A motion control code analytic method based on flow process control, comprises the following steps:
The first step: Establishing process control routine table and pairing rules table, pairing rules table indicates the pairing scheme of flow process control code, self-defined according to demand by user;
Second step: read the effective section of one section of NC code to calculator memory from current location, effectively section is a NC program in machine code section or the character field that can find in flow process control routine table, program segment is a line statement of NC code, is made up of one or more program words;
The 3rd step: to read NC code in calculator memory effectively section analyzes and judge and handle it: if effective section of NC code exists grammer or morphology mistake, proceed to wrong processing module and process; If NC code effectively section is a flow process control section, proceed to flow process control processing module and process, flow process control processing module is according to the current position of reading of contents processing amendment; If NC code effectively section is not a flow process control section, judge whether current read mode is omission pattern, if current read mode is omission pattern, directly ignore, otherwise proceed to common NC code process module and process and export result, after completing, current location is pointed to next section of section start;
The 4th step: if the effective section of current NC code exists wrong or reads end mark, finish to resolve, carry out otherwise proceed to second step continuation.
Described flow process control processing module comprises unconditional transfer module, conditional branching module and loop module.
The method of work of described unconditional transfer module is: analysis process control section, obtain flow process control code; If flow process control code is skip instruction, read redirect label, search label list, if find label, revise the current position of reading to this label place, if do not find label, read mode is changed into omission pattern, after completing, current location is pointed to next section of section start; If flow process control code is tag statement, bookmark name and current location are recorded to label list, read mode is set to general mode, after completing, current location is pointed to next section of section start.
The method of work of described conditional branching module is: analysis process control section, obtain flow process control code; If flow process control code is condition initial statement, reading conditions expression formula calculate its value, if condition is true, is set to general mode by read mode, otherwise is omission pattern, after completing, current location is pointed to next section of section start; If flow process control code is condition end statement, read mode is set to general mode, after completing, current location is pointed to next section of section start.
The method of work of described loop module is: analysis process control section, obtain flow process control code; If flow process control code is circulation initial statement, reading conditions expression formula calculate its value, if condition is true, read mode is set to general mode, otherwise be omission pattern, record current round robin start bit to put, after completing, current location is pointed to next section of section start; If flow process control code is circulation end statement, judge the condition at the initial statement place of circulating before, if condition is true, circulation section start is pointed to in the current position of reading, otherwise read mode is set to general mode, after completing, current location is pointed to next section of section start.
Analytic method of the present invention does semantic analysis after need not carrying out all scanning one time to numerical control program again, also be indifferent to program segment source, often obtain an effective section and just can resolve and complete configuration or Output rusults, this also makes the resolver based on the method in digital control system, have better dirigibility in improving analyzing efficiency.The inventive method has contained the universal process method of unconditional transfer flow process, conditional branching flow process and circulation process, has good versatility.Analytic method of the present invention adopts " the flow process control routine table " and " flow process control routine pairing rules table " that can freely customize, this makes to can be applicable to any motion control code that adds flow process control class based on the resolver of this method and resolves, and has good opening and expansibility.
Brief description of the drawings
Fig. 1 is the motion control code process of analysis figure of the inventive method.
Fig. 2 is " flow process control routine table " and " flow process control routine pairing rules table ".
Fig. 3 is the processing flow chart of unconditional transfer module in flow process control processing module.
Fig. 4 is the processing flow chart that flow process control processing module conditional divides formwork.
Fig. 5 is the processing flow chart of loop module in flow process control processing module.
Fig. 6 is the motion control code sample that embeds flow process control.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in further detail.
Processing of the present invention to as if embed the motion control code of flow process control, this code is made up of two parts: the one, common NC code, the 2nd, the flow process control routine of completion logic control.Code sample as shown in Figure 6, the object of the invention is to this code to provide general parsing scheme.
Flow process control routine table of the present invention and pairing rules table are for the special character collection of custom stream process control.These character set are to be different from the code that a class of common standard numerical control code is carried out flow process control, in the time that program is resolved to these special character collection, read the redirect of position according to rule, to reach the object of logic control.
On the basis of synthetic numerical control programming flow process control, the designed flow process control routine of the present invention mainly contains three types: (1) unconditional transfer class, (2) conditional branching class, (3) circulation class.Every type appears in numerical control program with pairing code form, and the structure of non-matching will be considered as mistake in numerical control program.User can customize the character set of control code, as long as the existing character conflict of character used discord standard NC code.
A motion control code analytic method based on flow process control, as shown in Figure 1, carry out successively following steps:
The first step: Establishing process control routine table and pairing rules table, as shown in Figure 2.For avoiding conflicting with the existing character definition of standard NC code, all flow process control codes start with " O_ ".
Second step: current code reads position and points to the 0th line start.
The 3rd step: read the effective section of row of N C code to calculator memory from current location, analyze judgement, process if do not have mistake to proceed to flow process control processing module.
The 4th step: if the effective section of current NC code exists wrong or reads end mark, finish to resolve, carry out otherwise proceed to the 3rd step continuation.
If NC code effectively section exists grammer or morphology mistake, proceed to wrong processing module and process; If the effective section of NC code is a flow process control section, as the row starting with " O_ " in code sample, proceed to flow process control processing module and process, flow process control processing module is according to the current position of reading of contents processing amendment; If NC code effectively section is not a flow process control section, as the row not starting with " O_ " in code sample, judge whether current read mode is omission pattern, if current read mode is omission pattern, directly ignore, otherwise proceed to common NC code process module and process and export result, after completing, current location is pointed to next section of section start.
Flow process control processing module comprises unconditional transfer module, conditional branching module and loop module.
The method of work of described flow process unconditional transfer of control module is: analysis process control section, obtain flow process control code; If flow process control code is skip instruction, as " O_GOTO " of the 1st row in code sample, read redirect label " Start_10 ", search label list, if find label, revise the current position of reading to this label place, if do not find label, read mode is changed into omission pattern, after completing, current location is pointed to next section of section start; If flow process control code is tag statement, as " O_LABEL " of the 2nd row in code sample and the 4th row, bookmark name and current location are recorded to label list, relatively redirect label, if identical, change read mode into general mode, otherwise do not change, after completing, current location is pointed to next section of section start.
The method of work of described conditional branching module is: analysis process control section, obtain flow process control code; If flow process control code is condition initial statement, as the 7th row in code sample and the 10th row " O_IF ", the content in reading conditions expression formula " [] ", and calculate its value, if condition is true, read mode is set to general mode, otherwise is omission pattern, after completing, current location is pointed to next section of section start; If flow process control code is condition end statement, as the 9th row in code sample and the 12nd row " O_ENDIF ", read mode is set to general mode, after completing, current location is pointed to next section of section start.
The method of work of described loop module is: analysis process control section, obtain flow process control code; If flow process control code is circulation initial statement, as " O_WHILE " of the 6th row in code sample, the content in reading conditions expression formula " [] ", and calculate its value, if condition is true, read mode is set to general mode, otherwise is omission pattern, record current round robin start bit and put, after completing, current location is pointed to next section of section start; If flow process control code is circulation end statement, as the 14th row O_ENDWHILE in code sample, judge the condition at the initial statement place of circulating before, if condition is true, circulation section start is pointed to in the current position of reading, otherwise read mode is set to general mode, after completing, current location is pointed to next section of section start.
By above method step, the resolver of formulation just can complete the parsing of the motion control code that embeds flow process control, and output order is controlled lathe by specific regular movement.The notch cuttype path INTERPOLATION CONTROL OF PULSE that code sample is 2 by output XY plane step-length, and common NC code at least needs 1000 row to complete same control.
In the present invention, " flow process control routine table " and " flow process control routine pairing rules table " can freely customize, and makes resolver based on them can resolve the flow process control routine of all kinds of self-defined symbols; Meanwhile, three kinds of flow process control processing modules have contained the general procedure scheme of all flow process controls, make the resolver based on these modules can complete various flow process control analyses; Finally, read the i.e. scan mode piecemeal of use, make to adopt resolver of the present invention redirect flexibly to read position, Output rusults fast, and only take the calculator memory resource of minute quantity.
Claims (5)
1. the motion control code analytic method based on flow process control, is characterized in that comprising the following steps:
A. Establishing process control routine table and pairing rules table, pairing rules table indicates the pairing scheme of flow process control code, self-defined according to demand by user;
B. effectively section is to calculator memory to read one section of NC code from current location, and effectively section is a NC program in machine code section or the character field that can find in flow process control routine table;
C. to read NC code in calculator memory effectively section analyzes and judge and handle it: if effective section of NC code exists grammer or morphology mistake, proceed to wrong processing module and process; If NC code effectively section is a flow process control section, proceed to flow process control processing module and process, flow process control processing module is according to the current position of reading of contents processing amendment; If NC code effectively section is not a flow process control section, judge whether current read mode is omission pattern, if current read mode is omission pattern, directly ignore, otherwise proceed to common NC code process module and process and export result, after completing, current location is pointed to next section of section start;
If D. the effective section of current NC code exists wrong or reads end mark, finish to resolve, carry out otherwise proceed to step B continuation.
2. the motion control code analytic method based on flow process control according to claim 1, is characterized in that: described flow process control processing module comprises unconditional transfer module, conditional branching module and loop module.
3. the motion control code analytic method based on flow process control according to claim 2, is characterized in that: the method for work of described unconditional transfer module is: analysis process control section, obtain flow process control code; If flow process control code is skip instruction, read redirect label, search label list, if find label, revise the current position of reading to this label place, if do not find label, read mode is changed into omission pattern, after completing, current location is pointed to next section of section start; If flow process control code is tag statement, bookmark name and current location are recorded to label list, read mode is set to general mode, after completing, current location is pointed to next section of section start.
4. the motion control code analytic method based on flow process control according to claim 2, is characterized in that: the method for work of described conditional branching module is: analysis process control section, obtain flow process control code; If flow process control code is condition initial statement, reading conditions expression formula calculate its value, if condition is true, is set to general mode by read mode, otherwise is omission pattern, after completing, current location is pointed to next section of section start; If flow process control code is condition end statement, read mode is set to general mode, after completing, current location is pointed to next section of section start.
5. the motion control code analytic method based on flow process control according to claim 2, is characterized in that: the method for work of described loop module is: analysis process control section, obtain flow process control code; If flow process control code is circulation initial statement, reading conditions expression formula calculate its value, if condition is true, read mode is set to general mode, otherwise be omission pattern, record current round robin start bit to put, after completing, current location is pointed to next section of section start; If flow process control code is circulation end statement, judge the condition at the initial statement place of circulating before, if condition is true, circulation section start is pointed to in the current position of reading, otherwise read mode is set to general mode, after completing, current location is pointed to next section of section start.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410374960.4A CN104133421A (en) | 2014-08-01 | 2014-08-01 | Motion control code analysis method based on process control |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410374960.4A CN104133421A (en) | 2014-08-01 | 2014-08-01 | Motion control code analysis method based on process control |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104133421A true CN104133421A (en) | 2014-11-05 |
Family
ID=51806141
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410374960.4A Pending CN104133421A (en) | 2014-08-01 | 2014-08-01 | Motion control code analysis method based on process control |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104133421A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104914790A (en) * | 2015-06-29 | 2015-09-16 | 遵义宏港机械有限公司 | Extended numerical control milling machine encoding system |
CN107102622A (en) * | 2016-06-30 | 2017-08-29 | 安雨青 | A kind of parametric programming method combined based on macroprogram and processing main routine program method |
CN110413530A (en) * | 2019-08-02 | 2019-11-05 | 中国工商银行股份有限公司 | A kind of behavior execution method and device |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1811632A (en) * | 2005-12-19 | 2006-08-02 | 深圳信息职业技术学院 | A digital control code encoder and method for establishing digital control system software based on the same |
CN101206467A (en) * | 2006-12-22 | 2008-06-25 | 南京理工大学 | Universal numerical control code analysis method |
US20100088686A1 (en) * | 2008-10-06 | 2010-04-08 | Microsoft Corporation | Programming language with extensible syntax |
EP2469364A1 (en) * | 2010-12-23 | 2012-06-27 | Siemens Aktiengesellschaft | Method for detecting a program sequence |
CN102540964A (en) * | 2010-12-09 | 2012-07-04 | 中国科学院沈阳计算技术研究所有限公司 | Processing program interpreter implementation method for numerical control system with single motor to drive multiple shafts |
CN103019742A (en) * | 2012-12-31 | 2013-04-03 | 清华大学 | Method for generating automatic codes on multiple DSP (Digital Signal Processor) platform |
CN103942041A (en) * | 2013-12-31 | 2014-07-23 | 江南大学 | Design method of NC code interpreter in numeric control simulation system |
-
2014
- 2014-08-01 CN CN201410374960.4A patent/CN104133421A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1811632A (en) * | 2005-12-19 | 2006-08-02 | 深圳信息职业技术学院 | A digital control code encoder and method for establishing digital control system software based on the same |
CN101206467A (en) * | 2006-12-22 | 2008-06-25 | 南京理工大学 | Universal numerical control code analysis method |
US20100088686A1 (en) * | 2008-10-06 | 2010-04-08 | Microsoft Corporation | Programming language with extensible syntax |
CN102540964A (en) * | 2010-12-09 | 2012-07-04 | 中国科学院沈阳计算技术研究所有限公司 | Processing program interpreter implementation method for numerical control system with single motor to drive multiple shafts |
EP2469364A1 (en) * | 2010-12-23 | 2012-06-27 | Siemens Aktiengesellschaft | Method for detecting a program sequence |
CN103019742A (en) * | 2012-12-31 | 2013-04-03 | 清华大学 | Method for generating automatic codes on multiple DSP (Digital Signal Processor) platform |
CN103942041A (en) * | 2013-12-31 | 2014-07-23 | 江南大学 | Design method of NC code interpreter in numeric control simulation system |
Non-Patent Citations (2)
Title |
---|
徐建国,张友良 等。: "《通用数控程序解析方法研究》", 《计算机集成制造系统》 * |
赵娇: "《数控特殊编程方法研究及编译功能实现》", 《中国优秀硕士学位论文全文数据库 工程科技Ⅰ辑》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104914790A (en) * | 2015-06-29 | 2015-09-16 | 遵义宏港机械有限公司 | Extended numerical control milling machine encoding system |
CN107102622A (en) * | 2016-06-30 | 2017-08-29 | 安雨青 | A kind of parametric programming method combined based on macroprogram and processing main routine program method |
CN110413530A (en) * | 2019-08-02 | 2019-11-05 | 中国工商银行股份有限公司 | A kind of behavior execution method and device |
CN110413530B (en) * | 2019-08-02 | 2024-01-05 | 中国工商银行股份有限公司 | Behavior execution method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10732608B2 (en) | Translation module, processing module and control system | |
CN106737676B (en) | It is a kind of based on script can secondary development industrial robot programing system | |
CN103941650B (en) | Logical AND motion integrated manipulator | |
CN103020176A (en) | Data block dividing method in XML parsing and XML parsing method | |
CN103077064A (en) | Method and interpretation device for analyzing and executing program language | |
CN102508654A (en) | Method for designing ladder diagram editing software of embedded PLC (Programmable Logic Controller) | |
CN104133421A (en) | Motion control code analysis method based on process control | |
WO2020184129A1 (en) | Analysis device, analysis method, and analysis program | |
CN107367686A (en) | A kind of generation method of RTL hardware Trojan horses test vector | |
CN103942081A (en) | Method for generating IL instruction lists of PLC ladder diagrams | |
CN111708525B (en) | Graphical programming system interpreter based on XML industrial robot | |
CN106850559B (en) | Extensible network protocol analysis system and method | |
CN110488738B (en) | Code generation method and device | |
CN103942041A (en) | Design method of NC code interpreter in numeric control simulation system | |
CN101320324A (en) | Processor apparatus and composite condition processing method | |
CN110221836A (en) | A kind of lexical analysis tool | |
CN102937910B (en) | System and method for cross-platform conversion of control algorithms | |
CN102508691A (en) | Graphic language program ordered decomposition method and ordered decomposer | |
CN1936746A (en) | Inlaid numerical control system G code interpretative device based on ARM | |
CN108845804A (en) | A kind of design method of the NC code interpreter based on CYCLE circulation | |
CN110632878B (en) | Method and device for heterogeneous embedded tabular processing and action flow execution | |
CN112534368A (en) | Graph display device, graph display method, and graph display program | |
CN104076736A (en) | Method for achieving motion control multi-branch synchronous execution based on teaching instructions | |
JP7063291B2 (en) | Analytical equipment, analysis method, and analysis program | |
CN117194501B (en) | DCS trend measurement point jump logic configuration method, system, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20141105 |