+

WO2017128160A1 - Method for machining reset, compiler, robot, numerical control system, and machine tool - Google Patents

Method for machining reset, compiler, robot, numerical control system, and machine tool Download PDF

Info

Publication number
WO2017128160A1
WO2017128160A1 PCT/CN2016/072437 CN2016072437W WO2017128160A1 WO 2017128160 A1 WO2017128160 A1 WO 2017128160A1 CN 2016072437 W CN2016072437 W CN 2016072437W WO 2017128160 A1 WO2017128160 A1 WO 2017128160A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
program segment
compiler
line number
processing
Prior art date
Application number
PCT/CN2016/072437
Other languages
French (fr)
Chinese (zh)
Inventor
庞华冲
Original Assignee
深圳配天智能技术研究院有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 深圳配天智能技术研究院有限公司 filed Critical 深圳配天智能技术研究院有限公司
Priority to CN201680031510.2A priority Critical patent/CN108027606B/en
Priority to PCT/CN2016/072437 priority patent/WO2017128160A1/en
Publication of WO2017128160A1 publication Critical patent/WO2017128160A1/en

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/18Numerical control [NC], i.e. automatically operating machines, in particular machine tools, e.g. in a manufacturing environment, so as to execute positioning, movement or co-ordinated operations by means of programme data in numerical form
    • G05B19/4155Numerical control [NC], i.e. automatically operating machines, in particular machine tools, e.g. in a manufacturing environment, so as to execute positioning, movement or co-ordinated operations by means of programme data in numerical form characterised by programme execution, i.e. part programme or machine function execution, e.g. selection of a programme
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • the embodiments of the present application relate to the field of numerical control technologies, and in particular, to a processing reset implementation method, a compiler, a robot, a numerical control system, and a machine tool.
  • NCS Genetic Control System
  • CNC system NCS Physical Control System
  • CNC machine tools its accuracy and performance can directly affect the processing quality and processing efficiency of CNC machine tools.
  • the machining program can be executed sequentially from the head of the program, or it can be specified in the beginning of a certain line of the machining program. This machining mode is called machining reset. This line is called machining reset line, machining reset.
  • the contour position before the line is called the break point position.
  • the numerical control system capable of machining reset is more commonly used in numerical control machining, mainly because the CNC machine machine is suddenly powered off or broken, and it needs to be restarted. It needs to restart the original machining program from the last machining position after restarting, or in some processing. It needs to be quickly executed from the middle of the machining program and requires modal information with the first half of the machining program. In both cases, the CNC machine tool requires the compiler of the CNC system to quickly process the first half of the machining reset line in the machining program, that is, the machining reset in the calculation mode, and the machining start position and the modal position can be both Restore to the state of a certain block, so as to achieve a better processing effect.
  • some processing reset implementation methods are also provided, such as: a method called "program restart" has the same purpose, application scenario and the like, and the method can be selected from the order. Start or start from the line number, then select to start from the current tool position or start from the tool position at the last stop. It may be necessary to manually restore the breakpoint position and the offset of the tool and coordinate system before starting, and observe whether the start line is In the middle of the macro program and the rigid tapping, after starting, it needs to be transferred to the MDI mode to restore the modality of some TSM codes, and once the processing code main instruction is an incremental instruction, or some cases using the mirroring instruction are used.
  • block search After searching for a block, you can specify to start from the line, after the system executes the "last action block”
  • the program after this is executed normally, but it is necessary to avoid searching for operations from certain blocks; in other similar schemes, it is required After manually restore TSM modal like the code, and then reset processing, otherwise there will be an alarm.
  • the embodiment of the invention provides a processing reset implementation method, a compiler, a robot, a numerical control system and a machine tool.
  • the processing reset implementation method has the advantages of high usability and high efficiency, and the operator does not need to consider processing reset from any program segment. Whether there will be problems such as compile errors, and there is no need to wait for a long time in the large program processing reset, thereby improving the processing efficiency of the numerical control machine tool.
  • the first aspect of the present invention provides a processing reset implementation method, which may include:
  • the compiler reads the processed text in the target order
  • the compiler determines whether the processing text has a processing reset flag
  • the compiler determines the target text, the target text is the text in the processed text whose line number is smaller than the line number of the processing reset line, and the processing reset behavior is the block in which the processing reset flag is located;
  • the compiler obtains the target program segment with modal instructions by performing fast pre-compilation processing on the target text.
  • the compiler determines whether the target program segment has a first program segment including a target modal command or absolute coordinates
  • the compiler records the line number of the first program segment, and replaces the original line number corresponding to the first member variable in the structure body with the line number of the first program segment, and the structure body is the preset program segment in the recording target program segment.
  • the member variable of the original line number, the original line number of the preset block includes the line number of the block in which the modal command was last specified, or the line of the block in which the set of absolute coordinates was last specified. number;
  • the compiler processes the line number of each member variable in the structure to obtain a sequence of target line numbers
  • the compiler performs fragment compilation processing on the corresponding program segment of the target line number sequence to obtain the corresponding program segment.
  • the target information is such that the machine tool starts machining from the machining reset line according to the target information.
  • the processing reset line includes a circular interpolation line or a fixed cycle line or a macro program line.
  • the target information includes modal information and Coordinate information.
  • the first embodiment or the second embodiment of the first aspect of the embodiment of the present invention in the third implementation manner of the first aspect of the embodiment of the present invention, is compiled Before processing the line number of each member variable in the structure to obtain the target line number sequence, the method further includes:
  • the compiler determines whether there is a contiguous block of the third block to the fourth block in the second block, fourth The program segment is adjacent to the program segment corresponding to the processing reset line;
  • the compiler records the original line number of the third block in the corresponding second member variable in the structure.
  • the method further includes:
  • the compiler obtains the original line number of the third program block from the structure, and performs continuous line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment.
  • the compiler Fragmentation processing of the corresponding program segment of the target line number sequence includes:
  • the compiler determines the corresponding program segment according to the target line number sequence
  • the compiler reads the corresponding program segment by lexical analysis, identifies each character in the corresponding program segment, and converts each character in the corresponding program segment into a first endpoint of the first target number;
  • the compiler stores the first endpoint in the buffer
  • the compiler obtains the first endpoint from the buffer in the target order by parsing
  • the compiler matches the first endpoint to the target grammar rule
  • the compiler performs semantic analysis on the first endpoint.
  • the compiler performs the continuous program segment according to the original line number of the third program segment.
  • Line compilation processing includes:
  • the compiler determines the continuous program segment according to the original line number of the third program segment
  • the compiler reads the continuous block by lexical analysis, identifies each character in the continuous block, and converts each character in the continuous block into a second end point of the second target number;
  • the compiler stores the second endpoint in the buffer
  • the compiler obtains the second endpoint from the buffer in the target order by parsing
  • the compiler matches the second endpoint with the target grammar rules
  • the compiler performs a semantic analysis of the second endpoint.
  • a second aspect of the present invention provides a compiler, which may include:
  • a reading module for reading processed text in a target order
  • a first determining module configured to determine whether the processing text has a processing reset flag
  • the first determining module is configured to: when the machining reset mark exists in the processed text, determine the target text, the target text is the text in the processed text whose line number is smaller than the line number of the processing reset line, and the processing reset behavior is performed in the program segment where the processing reset mark is located;
  • a fast pre-compilation processing module configured to perform a fast pre-compilation process on the target text determined by the first determining module to obtain a target program segment having a modal command
  • a second determining module configured to determine whether the target program segment determined by the second determining module has a first program segment including a target modal command or absolute coordinates
  • a first recording module configured to record a line number of the first program segment when the target program segment has a first program segment including a target modal command or absolute coordinates
  • the replacement module is configured to replace the original line number corresponding to the first member variable in the structure by using the line number of the first program segment, and the structure body is a member variable for recording the original line number of the preset program segment in the target program segment, and the preset program
  • the original line number of the segment includes the line number of the program segment in which the modal command was last specified, or the line number of the program segment in which a set of absolute coordinates was last designated;
  • a processing module configured to process a line number of each member variable in the structure to obtain a sequence of the target line number
  • a fragment compilation processing module configured to perform segment compilation processing on a corresponding program segment of the target line number sequence
  • the first obtaining module is configured to acquire target information of the corresponding program segment, so that the machine tool starts processing from the processing reset line according to the target information.
  • the compiler further includes:
  • a third determining module configured to: when the compiler determines that the target block has a second block that does not include the target modal command or the absolute coordinate, determines whether the third block to the fourth block exist in the second block a continuous block, the fourth block is adjacent to the block corresponding to the machining reset line;
  • the second recording module is configured to record the original line number of the third program segment corresponding to the second member variable in the structure when there is a continuous program segment of the third program segment to the fourth program segment in the second program segment.
  • the compiler further includes:
  • a second obtaining module configured to acquire a primary line number of the third program segment from the structure
  • the line-by-line compilation processing module is configured to perform line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment acquired by the second acquisition module.
  • the fragment compilation Processing modules include:
  • a first determining unit configured to determine a corresponding program segment by the target line number sequence
  • a first reading unit configured to read, by lexical analysis, a corresponding program segment determined by the first determining unit
  • a first identifying unit configured to identify each character in a corresponding program segment read by the first reading unit
  • a first converting unit configured to convert each character in the corresponding program segment identified by the first identifying unit into a first target number of first end points
  • a first storage unit configured to store, by the first conversion unit, a first endpoint to the buffer
  • a first acquiring unit configured to obtain, by syntax analysis, the first endpoint stored in the first storage unit from the buffer according to the target order;
  • a first determining unit configured to determine whether the first endpoint matches the target grammar rule
  • the first semantic analysis unit is configured to perform semantic analysis on the first endpoint when the first endpoint matches the target grammar rule.
  • the progressive compilation processing module includes:
  • a second determining unit configured to determine a continuous program segment according to a primary line number of the third program segment
  • a second reading unit configured to read, by lexical analysis, a continuous program segment determined by the second determining unit
  • a second identifying unit configured to identify each character in the continuous program segment read by the second reading unit
  • a second converting unit configured to convert each character in the continuous block identified by the second identifying unit into a second target number of second target points
  • the second endpoint for the second conversion unit conversion is stored in the buffer
  • a second acquiring unit configured to obtain, by syntax analysis, the second endpoint stored in the second storage unit from the buffer according to the target order
  • a second determining unit configured to determine whether the second endpoint matches the target grammar rule
  • the second semantic analysis unit is configured to perform semantic analysis on the second endpoint when the second endpoint matches the target grammar rule.
  • a third aspect of the present invention provides a robot comprising the second aspect of the above-described embodiment, and the compiler according to any one of the first to fourth embodiments of the second aspect of the above-described embodiment .
  • a fourth aspect of the present invention provides a numerical control system including the second aspect of the above-described embodiment, and the compilation of any one of the first to fourth embodiments of the second aspect of the above-described embodiment Device.
  • a fifth aspect of the invention provides a numerically controlled machine tool comprising the compiler of the fourth aspect of the above embodiment.
  • the processing text when the compiler needs to implement the processing reset, the processing text can be read according to the target sequence, and during the reading process, whether the processing reset flag exists in the processed text can be determined, and if present, the compiler can determine the target.
  • the target text is the text in the processed text whose line number is smaller than the line number of the processing reset line, and the machining reset line is the block where the machining reset mark is located.
  • the compiler can determine the target program segment having the modal instruction by performing fast pre-compilation processing on the target text, and then the compiler can determine whether the target program segment includes the target modal command or the absolute coordinate.
  • the compiler may record the first line number of the first program segment, and replace the original line number corresponding to the first member variable in the structure with the first line number, wherein the structure is a recording target
  • the member variable of the original line number of the preset block in the block includes a modal command or the line number of the block in which the absolute coordinate is last specified.
  • the compiler can process the line number of each member variable in the structure to obtain the target line number sequence, and can perform segment compilation processing on the corresponding program segment of the target line number sequence. Obtain the target information of the corresponding block so that the machine can start machining from the machining reset line according to the target information.
  • the compiler can process the target text by fast pre-compilation in the process of processing reset, and replace the modal instruction of the corresponding member variable in the structure line by line and the line number when the absolute coordinate is finally specified, the compiler can
  • the target information about the modal command and the absolute coordinate is obtained by performing the segment compiling process on the corresponding block of the target serial number, so that the machine can start processing in the processing reset line according to the target information, and the operator does not need to consider whether a compile error will occur.
  • the compiler obtains the target serial number by processing each member variable in the structure, and can compile the corresponding program segment, thereby avoiding the time consumption, thereby improving the processing efficiency of the machine tool.
  • 1 is an embodiment of a method for implementing processing reset in an embodiment of the present invention
  • the embodiment of the invention provides a processing reset implementation method and a compiler, and the processing reset implementation method has the advantages of high usability and high efficiency, and the operator does not need to consider whether processing reset from any program segment may cause problems or Waiting for a long time in the large program processing reset, thus improving the processing efficiency of the CNC machine.
  • the machining program of the numerical control system is a multi-line text, and the compiler can compile and execute the processed text sequentially in rows, and may also have branches, loops, and jumps.
  • the compiler can compile and execute the processed text sequentially in rows, and may also have branches, loops, and jumps.
  • it is often processed from a certain line in the processing text due to some original needs, which is commonly referred to as a machining reset line.
  • the compiler of the numerical control system can perform the fast pre-compilation processing on the target text before processing the reset line in the processed text, and can determine the target program segment having the modal command, and perform the target program segment in the target program segment.
  • a series of processing such as fragment compilation, so that the compiler can obtain the target information before compiling the processed text to reach the processing reset line, and recover the breakpoint position and the TSM state according to the target information, and perform normal compilation of the remaining programs, so that the machine tool is processed. Reset the line for processing.
  • the numerical control system can be processed and reset in any machining block, and the acquisition of the target information does not require the operator to consider whether a compilation error or a position error will occur, and the compiler only compiles the target program segment.
  • the time consumption is avoided, which improves the machining efficiency of the machine tool.
  • the compiler determines whether the target program segment has the first program segment including the target modal command or the absolute coordinate, if it exists, it may also include two a case where there is only a first block including a target modal command or absolute coordinates, and a first block including a target modal command or absolute coordinates and a first modal command or absolute coordinate
  • the second block is described separately below:
  • the target block only has the first block including the target modal command or absolute coordinates:
  • an embodiment of a method for implementing processing reset in an embodiment of the present invention includes:
  • the compiler reads the processed text according to the target order
  • the compiler can read the processed text in the order of the target.
  • the compiler determines whether there is a processing reset flag in the processed text, if not, then proceeds to step 103, and if so, proceeds to step 104;
  • the machining position mark may exist in the specific machining position.
  • the compiler can determine whether there is a machining reset flag in the processed text after reading the processed text.
  • the compiler executes other processes
  • the compiler can perform other operations, so that the compiler can compile the processed text according to the normal program, and the machine tool can process according to the normal machining program.
  • the compiler determines the target text
  • the compiler can determine the target text from the processed text, and the target text can be the text in the processed text whose line number is smaller than the line number of the processing reset line, and the processing reset line can be processed.
  • the processing reset line may include a circular interpolation line or a fixed cycle line or a macro program line, which is not limited herein.
  • the compiler obtains a target program segment having a modal instruction by performing fast pre-compilation processing on the target text.
  • the target text can be quickly pre-compiled, that is, the program segment in the processed text is quickly browsed, and the target program segment with the modal command can be obtained through lexical analysis.
  • the compiler records the line number of the first program segment, and replaces the original line number corresponding to the first member variable in the structure with the line number of the first program segment;
  • the compiler can record the line number of the first block, and can replace the original line number of the corresponding first member variable in the structure with the line number of the first block.
  • the structure is a member variable that records the original line number of the preset block in the target block.
  • the original line number of the preset block includes the line number of the block in which the modal command was last specified, or a group.
  • the target modal command is the absolute mode G90 and the non-target modal command is the incremental mode G91
  • the line number of the first block can be recorded, and this is used.
  • the line number replaces the original line number of the corresponding member in the structure (the initial value is 0), and the member variable associated with G91 is cleared.
  • the target modal command or the non-target modal command may also be other instruction modes, and this embodiment is only an example for description.
  • the compiler determines that the first program segment including the target modal command or the absolute coordinate does not exist in the target program segment, the target program segment is all the command mode to not include the target modal command or The second block of absolute coordinates, then the compiler can process the target block.
  • the specific processing method can be:
  • the compiler determines whether there is a continuous block of the third block to the fourth block in the second block, and the fourth block is adjacent to the block corresponding to the processing reset line;
  • the compiler performs line-by-line compilation processing from the third block.
  • the compiler can also use other processing methods for processing, as long as the target program segment can be processed.
  • the processing can be performed, and the specific processing manner is not limited herein.
  • the compiler processes the line number of each member variable in the structure to obtain a sequence of the target line number
  • the compiler can process the line number of each member variable in the structure, such as the compiler checking the structure.
  • the value of each member variable line number is then sorted in ascending order and de-duplicated to obtain a sequence of target line numbers.
  • sequence of the target line number in this embodiment may be other sequence manners, as long as the compiler can obtain the target line number sequence, which is not limited herein.
  • the compiler performs fragment compilation processing on the corresponding program segment of the target line number sequence
  • the corresponding program segment of the target line number sequence may be subjected to fragment compilation processing, that is, the compiled adjacent two-stage program may not be a continuous processing operation.
  • a compilation error such as an arc radius error or a spindle stop before the tool change may occur during the segment compilation process, but since the process does not send motion data to other modules, a real alarm is not generated, and the segment can be guaranteed. Compilation proceeds smoothly, and all interpolated statements can be treated as G00 statements during fragment compilation, so that there is no problem with arc radius errors.
  • the specific manner in which the compiler performs fragment compilation processing on the corresponding program segment of the target line number sequence may be:
  • the compiler determines the corresponding program segment according to the target line number sequence
  • the compiler reads the corresponding program segment by lexical analysis, identifies each character in the corresponding program segment, and converts each character in the corresponding program segment into a first endpoint of the first target number;
  • the compiler stores the first endpoint in the buffer
  • the compiler obtains the first endpoint from the buffer in the target order by parsing
  • the compiler matches the first endpoint to the target grammar rule
  • the compiler performs semantic analysis on the first endpoint.
  • the compiler's lexical analysis program can recognize words from the corresponding program segments of the character stream, such as characters from left to right.
  • the lexical analysis program can be used as a subroutine. When the lexical analysis program needs a word, the subroutine can be called. Each time the lexical analysis program gets a call, some characters are read from the corresponding program segment. Until a word is recognized, or until the first character of the next word is recognized.
  • the lexer in the compiler can convert each character in the corresponding block into the first
  • the first endpoint of a target number that is, the corresponding program segment of the character stream is converted into a word sequence
  • the compiler can store the converted word sequence into the buffer.
  • the parser of the compiler front end can follow the buffer.
  • the word ordering sequence obtains the word sequence and tries to match the grammar rules specified by itself.
  • the corresponding semantic analysis is performed.
  • the semantic analyzer of the compiler front end can assemble the scattered words into meaningful expressions according to the predefined grammar.
  • the compiler obtains target information of the corresponding program segment.
  • the compiler After the compiler compiles the corresponding segments of the target line number sequence, the coordinates or modal information of these blocks can be saved into the compiled data. Thus, when the compiler compiles to the processing reset line, it is completely intact.
  • the program segment that must be compiled is compiled, and the compiler can obtain the target information of the corresponding program segment from the compiled data, so that the machine tool can start processing from the processing reset line according to the target information.
  • the target information may include modal information and coordinate information, and may also include information such as a tool, a spindle rotation speed, a spindle rotation, and the like, which are not limited herein.
  • the coordinate information in the target information may include the coordinates of the workpiece in the X, Y, and Z axes, so that the tool can be lifted from a random position before the tool resumes the breakpoint position. It is the height of the tool change. For example, if the parallel axis of the tool is the Z axis, then the breakpoint position of the X and Y axes is restored first, and then the Z axis breakpoint position is restored. This ensures that the tool can move at a safe height without happening with the workpiece. collision. Conversely, moving the XY axis without first lifting the tool to a safe position can be very prone to collisions.
  • the compiler can perform fast pre-compilation processing on the target text before the processing reset line, obtain the target program segment with the modal command, and can pass the target modality in the target program segment.
  • the first block of the instruction or absolute coordinate performs a series of processing, so that the compiler can acquire the target information before reaching the processing reset line, and the machine tool can process the processing reset line according to the modal information and the coordinate information in the target information, thereby Effectively avoid problems such as compilation errors or position errors.
  • the compiler only processes the first block in the target block, not all the target blocks, which saves the time required for the machining reset, thereby improving the machining efficiency of the machine.
  • the target program segment has both the first program segment including the target modal command or absolute coordinates and the second program segment not including the target modal command or absolute coordinates:
  • FIG. 2 another embodiment of the method for implementing the processing and compiling function in the embodiment of the present invention includes:
  • Steps 201 to 205 in this embodiment are the same as steps 101 to 105 of the embodiment shown in FIG. 1, and are not described herein.
  • step 206 in this embodiment except that the compiler may determine that the first program segment including the target modal command or the absolute coordinate may exist in the target program segment, there may be a second program segment that does not include the target modal command or absolute coordinates. Others are the same as step 106 of the embodiment shown in FIG. 1, and are not described herein again.
  • step 207 the compiler determines whether there is a continuous block of the third block to the fourth block in the second block, and if so, step 208 is performed, and if not, step 209 is performed;
  • the compiler can determine whether there is a contiguous block of the third block to the fourth block in the second block.
  • the fourth block is adjacent to the block corresponding to the machining reset line, that is, whether the command mode of several consecutive blocks before the machining reset line is a non-target modal command.
  • the compiler can determine whether the command mode of several consecutive blocks before the machining reset line is G91.
  • the compiler records the original line number of the third program segment corresponding to the second member variable in the structure.
  • the compiler may record the original line number of the third block in the corresponding second member variable in the structure.
  • Steps 209 to 210 of this embodiment are the same as steps 107 to 108 of the embodiment shown in FIG. 1, and details are not described herein again.
  • step 207 to step 208 and step 206 in this embodiment as long as the compiler processes the line number of each member variable in the structure to obtain the target line number sequence, it is not limited herein. .
  • the target line number sequence when the target line number sequence is obtained, the target line number sequence may be sorted in ascending order, and the corresponding second member variable in the structure may record the third program segment.
  • the original line number, then the third block of the instruction mode is the non-target modal command.
  • the value of the line number of the corresponding second member variable in the structure is not zero and is the original line number, and the original line of the first member variable
  • the number can be replaced in step 206 by the line number of the first block whose initial value is 0, so that the value of the line number of the second member variable is the largest in the structure, and the third block can be used in step 210.
  • the corresponding block of the target line number sequence performs the last line of the fragment compilation process.
  • the compiler obtains the original line number of the third program segment from the structure.
  • the compiler needs to process the continuous block. , the compiler can get the original line number of the third program block from the structure.
  • step 211 in this embodiment may be between step 208 and step 212, as long as the compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment, specifically not here. Make a limit.
  • the compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment;
  • the compiler can perform the line-by-line compilation processing on the continuous block of the third program segment to the fourth program segment according to the original line number of the third program segment.
  • the three blocks can again be used as the starting line for the line-by-line compilation process.
  • the specific manner in which the compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment may be:
  • the compiler determines the continuous program segment according to the original line number of the third program segment
  • the compiler reads the continuous block by lexical analysis, identifies each character in the continuous block, and converts each character in the continuous block into a second end point of the second target number;
  • the compiler stores the second endpoint in the buffer
  • the compiler obtains the second endpoint from the buffer in the target order by parsing
  • the compiler matches the second endpoint with the target grammar rules
  • the compiler performs a semantic analysis of the second endpoint.
  • the progressive compilation processing in this embodiment is consistent with the step operation performed by the fragment compilation processing, but the processed objects are inconsistent, and the fragment compilation processing is the first program segment that is likely to be discrete and the line number is discontinuous.
  • Compile for example, when there are both target modal commands or For the first block of coordinates, when there is a second block that does not include the target modal command or absolute coordinates, the first block is a discrete block, and the progressive compile process is the second block.
  • the contiguous blocks of the third block to the fourth block are compiled. Therefore, the description of the line-by-line compiling process in the present embodiment in the actual application will not be repeated here.
  • the embodiment only illustrates the specific manner in which the compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment.
  • the compiler may adopt other The line compiling processing method is combined or used separately, as long as the compiler can perform the line-by-line compiling process on the continuous program segment according to the original line number of the third program segment, and the specific processing manner is not limited herein.
  • steps 211 to 212 may not be performed, and the compiler is in the target. After the corresponding program segment of the line number sequence is subjected to the fragment compiling process, the target information of the corresponding program may be obtained, which is not limited herein.
  • Step 213 in this embodiment is the same as step 109 in the above embodiment, and details are not described herein again.
  • the compiler determines that there is a first program segment including a target modal command or absolute coordinates in the target program segment, and a second program that does not include the target modal command or absolute coordinates.
  • the first block and the second block can be processed separately, and if the compiler determines that there is a continuous block of the third block to the fourth block in the second block before the machining reset line, the compiler After the segment compiling process is performed on the corresponding block of the target line number sequence, the continuous block can be compiled line by line, so that even in a mode such as a non-target modal command of the incremental instruction, the compiler is The total incremental value can also be obtained before the processing reset line, so that the compiler can restore the breakpoint position and the TSM state according to the obtained target information, and perform normal compilation of the remaining programs, so that the machine tool is processed in the processing reset line, thereby realizing The CNC system performs machining reset in any machining block without problems such as compile errors or position errors.
  • an embodiment of the compiler in the embodiment of the present invention includes:
  • a reading module 301 configured to read the processed text according to the target sequence
  • the first determining module 302 is configured to determine whether the processed text has a processing reset flag
  • the first determining module 303 is configured to: when the machining reset mark exists in the processed text, determine the target text, where the target text is the text in the processed text whose line number is smaller than the line number of the processing reset line, and the processing reset line The block in which the processing reset flag is located;
  • a fast pre-compilation processing module 304 configured to perform a fast pre-compilation process on the target text determined by the first determining module to obtain a target program segment having a modal command;
  • a second determining module 305 configured to determine whether the target program segment determined by the second determining module has a first program segment including a target modal command or absolute coordinates
  • a first recording module 306 configured to record a first line number of the first program segment when the target program segment has a first program segment including a target modal command or absolute coordinates;
  • the replacement module 307 is configured to replace the original line number corresponding to the first member variable in the structure with the first line number, and the structure body is a member variable for recording the original line number of each program segment in the target text, and a modal command is finally The line number of the block in which the designation is located, or the line number of the block in which a set of absolute coordinates was last specified;
  • the processing module 308 is configured to process a line number of each member variable in the structure to obtain a target line number sequence
  • a fragment compilation processing module 309 configured to perform segment compilation processing on a corresponding program segment of the target line number sequence
  • the first obtaining module 310 is configured to acquire target information of the corresponding program segment, so that the machine tool starts processing from the processing reset line according to the target information.
  • the fragment compilation processing module 309 may further include:
  • a first determining unit 3091 configured to determine a corresponding program segment by the target line number sequence
  • a first reading unit 3092 configured to read, by using lexical analysis, a corresponding program segment determined by the first determining unit
  • a first identifying unit 3093 configured to identify each character in a corresponding program segment read by the first reading unit
  • a first converting unit 3094 configured to convert each character in the corresponding program segment identified by the first identifying unit into a first target number of first endpoints
  • the first storage unit 3095 is configured to store, by the first conversion unit, the first endpoint to the buffer;
  • the first obtaining unit 3096 is configured to obtain, by syntax analysis, the first endpoint stored by the first storage unit from the buffer according to the target sequence;
  • the first determining unit 3097 is configured to determine whether the first endpoint matches the target grammar rule
  • a first semantic analysis unit 3098 configured to: when the first endpoint matches the target grammar rule, Semantic analysis of the first endpoint.
  • the first determining module 302 can determine whether the processing text has a processing reset flag.
  • the first determining module 303 can Determining the target text, and the fast pre-compilation processing module 304 may perform the fast pre-compilation process on the target text to obtain the target program segment having the modal command, and once the second determining module 305 determines that the target program segment determined by the second determining module includes the target modality
  • the first recording module 306 may record the first line number of the first program segment, and the replacement module 307 may replace the original line number of the corresponding first member variable in the structure with the first line number.
  • the fragment compilation processing module 309 can perform the fragment compilation processing on the corresponding program segments of the target line number sequence, and the first obtaining module 310
  • the target information of the corresponding program segment can be obtained, so that the machine tool can according to the modal letter in the target information And coordinate information processed in the processing reset row, so as to effectively avoid position errors compilation errors or problems.
  • the compiler only processes the first block in the target block, not all the target blocks, which saves the time required for the machining reset, thereby improving the machining efficiency of the machine.
  • FIG. 4 another embodiment of the compiler in the embodiment of the present invention includes:
  • the module 401 in this embodiment is the same as the module 301 in FIG. 3, the module 402 is the same as the module 302 in FIG. 3, the module 403 is the same as the module 303 in FIG. 3, and the module 404 is the same as the module 304 in FIG. 405 is the same as module 305 in FIG. 3, module 406 is the same as module 306 in FIG. 3, and module 407 is the same as module 307 in FIG. 3, and details are not described herein again.
  • the third determining module 408 is configured to: when the compiler determines that the target program segment has a second block that does not include the target modal command or the absolute coordinate, determine whether the third block to the fourth block exist in the second block a continuous block, the fourth block is adjacent to the block corresponding to the processing reset line;
  • the second recording module 409 is configured to: when the third block to the fourth block of the continuous block in the second block, record the original line number of the third block in the corresponding second member variable in the structure ;
  • the module 410 in this embodiment is the same as the module 308 in FIG. 3, and the module 411 is the same as the module 309 in FIG. 3, and details are not described herein again.
  • a second obtaining module 412 configured to acquire a primary line number of the third program segment from the structure
  • the progressive compilation processing module 413 is configured to perform, according to the original line of the third program segment acquired by the second obtaining module The number of consecutive blocks is compiled line by line;
  • the module 414 in this embodiment is the same as the module 310 in the embodiment shown in FIG. 4, and details are not described herein again.
  • the progressive compilation processing module 413 may further include:
  • the second determining unit 4131 is configured to determine a continuous program segment for the original line number of the third program segment
  • a second reading unit 4132 configured to read, by lexical analysis, a continuous program segment determined by the second determining unit
  • a second identifying unit 4133 configured to identify each character in the continuous program segment read by the second reading unit
  • a second converting unit 4134 configured to convert each character in the continuous block identified by the second identifying unit into a second target number of the second ending point
  • a second storage unit 4135 the second endpoint for the second conversion unit conversion is stored in the buffer
  • a second obtaining unit 4136 configured to obtain, by syntax analysis, the second endpoint stored by the second storage unit from the buffer according to the target order;
  • the second determining unit 4137 is configured to determine whether the second endpoint matches the target grammar rule
  • the second semantic analysis unit 4138 is configured to perform semantic analysis on the second endpoint when the second endpoint matches the target grammar rule.
  • the module 414 in this embodiment is the same as the module 310 in FIG. 3, and details are not described herein again.
  • the second determining module 405 determines that the first program segment including the target modal command or the absolute coordinate exists in the target program segment, and the first program segment including the target modal command or the absolute coordinate is not included, Therefore, when the third determining module 408 can determine that there are consecutive blocks of the third block to the fourth block in the second block, the second recording module 409 can record the third block of the corresponding second member variable in the structure.
  • the second acquisition module 412 can obtain the original line number of the third program segment from the structure, and the line-by-line compilation processing module 413 can be based on the second Obtaining the original line number of the third program segment acquired by the module, and compiling the continuous program segment line by line, so that the compiler can perform the processing before the reset line even in the mode of the non-target modal command such as the incremental instruction
  • the total increment value is obtained, so that the compiler can restore the breakpoint position and the TSM state according to the obtained target information, and perform normal compilation of the remaining programs, so that the machine tool Processing the reset row processing, thereby realizing a numerical control machining system reset any machining block, without a compilation error or position error problems.
  • the robot provided in this embodiment is provided with the compiler in any of the above embodiments. There are all the benefits of the compiler, so I won't go into details here.
  • the numerical control system provided in this embodiment has all the beneficial effects of the compiler by setting the compiler in any of the above embodiments, and details are not described herein again.
  • the numerical control machine tool provided in this embodiment has all the beneficial effects of the compiler in any of the above embodiments by setting the numerical control system provided with the compiler in the above embodiment, and details are not described herein again.
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Manufacturing & Machinery (AREA)
  • Automation & Control Theory (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

Disclosed is a method for machining reset. The method comprises: a compiler reading a machining text according to a target sequence (101), then determining whether a machining reset tag is present in the machining text (102); if yes, determining a target text in the machining text having a line number less than a line number of a machining reset line (104); determining whether a first program segment comprising a target modal instruction or absolute coordinates is present in a target program segment in the target text having a modal instruction, and, if yes, recording a line number of the first program segment and substituting the line number for an original line number corresponding to a first member variable in a structure (106); the compiler processing line numbers of member variables in the structure to obtain a target line number sequence (107), performing segment compilation processing on a corresponding program segment of the target line number sequence (108), and acquiring target information of the corresponding program segment (109), so that a machine tool starts machining from the machining reset line according to the target information. Also provided in the present invention is a compiler for effective avoidance of problems such as compilation error and for improving machining efficiency of a numerical control machine tool.

Description

加工复位实现方法、编译器、机器人、数控系统及机床Processing reset implementation method, compiler, robot, numerical control system and machine tool 技术领域Technical field
本申请实施例涉及数控技术领域,尤其涉及一种加工复位实现方法、编译器、机器人、数控系统及机床。The embodiments of the present application relate to the field of numerical control technologies, and in particular, to a processing reset implementation method, a compiler, a robot, a numerical control system, and a machine tool.
背景技术Background technique
数控系统NCS(Numerical Control System)作为数控机床的指挥控制中心,其精度与性能能够直接影响到数控机床的加工质量与加工效率。在数控加工过程中,加工程序既可以从程序头部开始顺序执行,也可以指定加工程序的某一行开始顺序执行,这种加工方式被称为加工复位,该行称为加工复位行,加工复位行之前的轮廓位置则被称为断点位置。CNC system NCS (Numerical Control System) as the command and control center of CNC machine tools, its accuracy and performance can directly affect the processing quality and processing efficiency of CNC machine tools. In the NC machining process, the machining program can be executed sequentially from the head of the program, or it can be specified in the beginning of a certain line of the machining program. This machining mode is called machining reset. This line is called machining reset line, machining reset. The contour position before the line is called the break point position.
能够实现加工复位的数控系统在数控加工中较常应用,主要是由于数控机床突然断电或断刀而停机,需要重新开机后从上一次加工位置开始继续执行原加工程序,或者在某些加工中需要快速地从加工程序的中部开始执行,并且要求具有前半部分加工程序的模态信息。在此两类情况下,数控机床则要求数控系统的编译器能够快速处理加工程序中加工复位行的前半部分,即在计算模式下进行加工复位,并可以将加工起始位置和模态位置都恢复到某一程序段的状态,从而达到较理想的加工效果。The numerical control system capable of machining reset is more commonly used in numerical control machining, mainly because the CNC machine machine is suddenly powered off or broken, and it needs to be restarted. It needs to restart the original machining program from the last machining position after restarting, or in some processing. It needs to be quickly executed from the middle of the machining program and requires modal information with the first half of the machining program. In both cases, the CNC machine tool requires the compiler of the CNC system to quickly process the first half of the machining reset line in the machining program, that is, the machining reset in the calculation mode, and the machining start position and the modal position can be both Restore to the state of a certain block, so as to achieve a better processing effect.
在现有的数控系统中,也提供了一些加工复位实现方法,如:一种被称为“程序再启动”的方法具有相同的目的、应用场景以及类似的操作,该种方法可以选择从顺序号启动或者从行号启动,再选择从当前刀具位置启动或者从上次停机处的刀具位置启动,启动前可能需要手动恢复断点位置以及刀具和坐标系的偏置,并且要观察启动行是否处在宏程序与刚性攻丝中间,启动后则需要视情况转入录入MDI模式恢复某些TSM代码的模态,而一旦加工代码主要指令为增量指令,或使用了镜像指令的某些情况下,可能无法正确地恢复断点位置;一种被称为“程序段搜索”的方法,该方法搜索到某个程序段之后,可以指定从该行启动,系统执行“最后动作程序段”后正常执行此后的程序,但需要避免从某些特定的程序段搜索操作;在其它的一些类似方案中,则需要先手动地恢复TSM等代码的模态之后,再进行加工复位,否则会出现报警。 In the existing numerical control system, some processing reset implementation methods are also provided, such as: a method called "program restart" has the same purpose, application scenario and the like, and the method can be selected from the order. Start or start from the line number, then select to start from the current tool position or start from the tool position at the last stop. It may be necessary to manually restore the breakpoint position and the offset of the tool and coordinate system before starting, and observe whether the start line is In the middle of the macro program and the rigid tapping, after starting, it needs to be transferred to the MDI mode to restore the modality of some TSM codes, and once the processing code main instruction is an incremental instruction, or some cases using the mirroring instruction are used. Under, the breakpoint position may not be restored correctly; a method called "block search", after searching for a block, you can specify to start from the line, after the system executes the "last action block" The program after this is executed normally, but it is necessary to avoid searching for operations from certain blocks; in other similar schemes, it is required After manually restore TSM modal like the code, and then reset processing, otherwise there will be an alarm.
从上述内容可以看出,现有技术的数控系统的加工复位实现方法都具有一个共同的缺陷,即数控机床不能从加工程序的任意行开始加工复位,而同时又保持该行之前程序段的变量计算和加工模态,若从某些行开始加工,会导致系统报警,或者出现断点位置不正确的问题,这样就需要操作人员具有相当的经验,来判断这个功能是否可以使用,增加了操作人员的负担。例如,当刀具从任意位置直接移动到断点位置时,由于断点位置错误等问题可能会与工件发生碰撞。此外,即使数控系统能够恢复断点位置和相应加工模态,也需要花费很长的时间,这样在加工程序相当大的情况下,可能需要等待相当长的时间才能启动加工,降低了加工效率。It can be seen from the above that the processing reset implementation methods of the prior art numerical control system have a common defect that the numerical control machine cannot start the machining reset from any line of the machining program while maintaining the variables of the previous block of the line. Computation and processing modality, if processing starts from some lines, it will cause the system to alarm, or the problem of incorrect position of the breakpoint, so the operator has considerable experience to judge whether the function can be used or not, and the operation is increased. The burden of personnel. For example, when the tool moves directly from any position to the breakpoint position, problems such as broken position of the breakpoint may collide with the workpiece. In addition, even if the numerical control system can recover the breakpoint position and the corresponding machining mode, it takes a long time, so that in the case where the machining program is quite large, it may take a long time to start the machining and reduce the machining efficiency.
发明内容Summary of the invention
本发明实施例提供了一种加工复位实现方法、编译器、机器人、数控系统及机床,该加工复位实现方法具有易用性强、效率高的优点,操作人员无需考虑从任意程序段进行加工复位是否会产生编译错误等问题,也无需在大程序加工复位时等待很长的时间,进而提高了数控机床的加工效率。The embodiment of the invention provides a processing reset implementation method, a compiler, a robot, a numerical control system and a machine tool. The processing reset implementation method has the advantages of high usability and high efficiency, and the operator does not need to consider processing reset from any program segment. Whether there will be problems such as compile errors, and there is no need to wait for a long time in the large program processing reset, thereby improving the processing efficiency of the numerical control machine tool.
有鉴于此,本发明第一方面提供一种加工复位实现方法,可包括:In view of this, the first aspect of the present invention provides a processing reset implementation method, which may include:
编译器按照目标顺序读取加工文本;The compiler reads the processed text in the target order;
编译器判断加工文本是否存在加工复位标记;The compiler determines whether the processing text has a processing reset flag;
若是,则编译器确定目标文本,目标文本为加工文本中行号小于加工复位行的行号的文本,加工复位行为加工复位标记所在的程序段;If yes, the compiler determines the target text, the target text is the text in the processed text whose line number is smaller than the line number of the processing reset line, and the processing reset behavior is the block in which the processing reset flag is located;
编译器通过对目标文本进行快速预编译处理得到具有模态指令的目标程序段;The compiler obtains the target program segment with modal instructions by performing fast pre-compilation processing on the target text.
编译器判断目标程序段是否存在包括目标模态指令或绝对坐标的第一程序段;The compiler determines whether the target program segment has a first program segment including a target modal command or absolute coordinates;
若存在,则编译器记录第一程序段的行号,并用第一程序段的行号替代结构体中对应第一成员变量的原行号,结构体为记录目标程序段中预设程序段的原行号的成员变量,预设程序段的原行号包括一种模态指令最后被指定时所处的程序段的行号,或一组绝对坐标最后被指定时所处的程序段的行号;If yes, the compiler records the line number of the first program segment, and replaces the original line number corresponding to the first member variable in the structure body with the line number of the first program segment, and the structure body is the preset program segment in the recording target program segment. The member variable of the original line number, the original line number of the preset block includes the line number of the block in which the modal command was last specified, or the line of the block in which the set of absolute coordinates was last specified. number;
编译器对结构体中各成员变量的行号进行处理得到目标行号序列;The compiler processes the line number of each member variable in the structure to obtain a sequence of target line numbers;
编译器将目标行号序列的对应程序段进行片段编译处理,获取对应程序段 的目标信息,以使得机床根据目标信息从加工复位行开始加工。The compiler performs fragment compilation processing on the corresponding program segment of the target line number sequence to obtain the corresponding program segment. The target information is such that the machine tool starts machining from the machining reset line according to the target information.
结合本发明实施例的第一方面,在本发明实施例的第一方面的第一种实施方式中,加工复位行包括圆弧插补行或固定循环行或宏程序行。In conjunction with the first aspect of the embodiments of the present invention, in a first embodiment of the first aspect of the embodiments of the present invention, the processing reset line includes a circular interpolation line or a fixed cycle line or a macro program line.
结合本发明实施例的第一方面,或本发明实施例的第一方面的第一种实施方式,在本发明实施例的第一方面的第二种实施方式中,目标信息包括模态信息和坐标信息。With reference to the first aspect of the embodiments of the present invention, or the first embodiment of the first aspect of the embodiments of the present invention, in the second implementation manner of the first aspect of the embodiment of the present invention, the target information includes modal information and Coordinate information.
结合本发明实施例的第一方面,本发明实施例的第一方面的第一种实施方式或第二种实施方式,在本发明实施例的第一方面的第三种实施方式中,在编译器对结构体中各成员变量的行号进行处理得到目标行号序列之前,该方法还包括:With reference to the first aspect of the embodiments of the present invention, the first embodiment or the second embodiment of the first aspect of the embodiment of the present invention, in the third implementation manner of the first aspect of the embodiment of the present invention, is compiled Before processing the line number of each member variable in the structure to obtain the target line number sequence, the method further includes:
若编译器判断目标程序段存在不包括目标模态指令或绝对坐标的第二程序段,则编译器判断第二程序段中是否存在第三程序段至第四程序段的连续程序段,第四程序段与加工复位行对应的程序段相邻;If the compiler determines that the target block has a second block that does not include the target modal command or absolute coordinates, the compiler determines whether there is a contiguous block of the third block to the fourth block in the second block, fourth The program segment is adjacent to the program segment corresponding to the processing reset line;
若存在,则编译器将结构体中对应第二成员变量记录第三程序段的原行号。If it exists, the compiler records the original line number of the third block in the corresponding second member variable in the structure.
结合本发明实施例的第一方面的第三种实施方式,在本发明实施例的第一方面的第四种实施方式中,在编译器将目标行号序列的对应程序段进行片段编译处理之后,在编译器获取对应程序段的目标信息之前,该方法还包括:In conjunction with the third implementation manner of the first aspect of the embodiment of the present invention, in a fourth implementation manner of the first aspect of the embodiment of the present invention, after the compiler performs fragment compilation processing on the corresponding program segment of the target line number sequence Before the compiler obtains the target information of the corresponding program segment, the method further includes:
编译器从结构体中获取第三程序段的原行号,并根据第三程序段的原行号对连续程序段进行逐行编译处理。The compiler obtains the original line number of the third program block from the structure, and performs continuous line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment.
结合本发明实施例的第一方面,本发明实施例的第一方面的第一种实施方式至第四种实施方式,在本发明实施例的第一方面的第五种实施方式中,编译器将目标行号序列的对应程序段进行片段编译处理包括:With reference to the first aspect of the embodiments of the present invention, the first to fourth embodiments of the first aspect of the embodiments of the present invention, in the fifth implementation manner of the first aspect of the embodiment of the present invention, the compiler Fragmentation processing of the corresponding program segment of the target line number sequence includes:
编译器根据目标行号序列确定对应程序段;The compiler determines the corresponding program segment according to the target line number sequence;
编译器通过词法分析读取对应程序段,识别对应程序段中的各个字符,并将对应程序段中的各个字符转换为第一目标数量的第一终结点;The compiler reads the corresponding program segment by lexical analysis, identifies each character in the corresponding program segment, and converts each character in the corresponding program segment into a first endpoint of the first target number;
编译器将第一终结点存储至缓冲区;The compiler stores the first endpoint in the buffer;
编译器通过语法分析从缓冲区中按照目标顺序获取第一终结点;The compiler obtains the first endpoint from the buffer in the target order by parsing;
编译器将第一终结点是否与目标语法规则匹配;The compiler matches the first endpoint to the target grammar rule;
若是,则编译器将第一终结点进行语义分析。 If so, the compiler performs semantic analysis on the first endpoint.
结合本发明实施例的第一方面的第四种实施方式,在本发明实施例的第一方面的第六种实施方式中,编译器根据第三程序段的原行号对连续程序段进行逐行编译处理包括:With reference to the fourth embodiment of the first aspect of the embodiment of the present invention, in a sixth implementation manner of the first aspect of the embodiment of the present invention, the compiler performs the continuous program segment according to the original line number of the third program segment. Line compilation processing includes:
编译器根据第三程序段的原行号确定连续程序段;The compiler determines the continuous program segment according to the original line number of the third program segment;
编译器通过词法分析读取连续程序段,识别连续程序段中的各个字符,并将连续程序段中的各个字符转换为第二目标数量的第二终结点;The compiler reads the continuous block by lexical analysis, identifies each character in the continuous block, and converts each character in the continuous block into a second end point of the second target number;
编译器将第二终结点存储至缓冲区;The compiler stores the second endpoint in the buffer;
编译器通过语法分析从缓冲区中按照目标顺序获取第二终结点;The compiler obtains the second endpoint from the buffer in the target order by parsing;
编译器将第二终结点是否与目标语法规则匹配;The compiler matches the second endpoint with the target grammar rules;
若是,则编译器将第二终结点进行语义分析。If so, the compiler performs a semantic analysis of the second endpoint.
本发明第二方面提供一种编译器,可包括:A second aspect of the present invention provides a compiler, which may include:
读取模块,用于按照目标顺序读取加工文本;a reading module for reading processed text in a target order;
第一判断模块,用于判断加工文本是否存在加工复位标记;a first determining module, configured to determine whether the processing text has a processing reset flag;
第一确定模块,用于当加工文本中存在加工复位标记时,则确定目标文本,目标文本为加工文本中行号小于加工复位行的行号的文本,加工复位行为加工复位标记所在的程序段;The first determining module is configured to: when the machining reset mark exists in the processed text, determine the target text, the target text is the text in the processed text whose line number is smaller than the line number of the processing reset line, and the processing reset behavior is performed in the program segment where the processing reset mark is located;
快速预编译处理模块,用于通过对第一确定模块确定的目标文本进行快速预编译处理得到具有模态指令的目标程序段;a fast pre-compilation processing module, configured to perform a fast pre-compilation process on the target text determined by the first determining module to obtain a target program segment having a modal command;
第二判断模块,用于判断第二确定模块确定的目标程序段是否存在包括目标模态指令或绝对坐标的第一程序段;a second determining module, configured to determine whether the target program segment determined by the second determining module has a first program segment including a target modal command or absolute coordinates;
第一记录模块,用于当目标程序段存在包括目标模态指令或绝对坐标的第一程序段时,记录第一程序段的行号;a first recording module, configured to record a line number of the first program segment when the target program segment has a first program segment including a target modal command or absolute coordinates;
替代模块,用于用第一程序段的行号替代结构体中对应第一成员变量的原行号,结构体为记录目标程序段中预设程序段的原行号的成员变量,预设程序段的原行号包括一种模态指令最后被指定时所处的程序段的行号,或一组绝对坐标最后被指定时所处的程序段的行号;The replacement module is configured to replace the original line number corresponding to the first member variable in the structure by using the line number of the first program segment, and the structure body is a member variable for recording the original line number of the preset program segment in the target program segment, and the preset program The original line number of the segment includes the line number of the program segment in which the modal command was last specified, or the line number of the program segment in which a set of absolute coordinates was last designated;
处理模块,用于对结构体中各成员变量的行号进行处理,得到目标行号序列;a processing module, configured to process a line number of each member variable in the structure to obtain a sequence of the target line number;
片段编译处理模块,用于将目标行号序列的对应程序段进行片段编译处理; a fragment compilation processing module, configured to perform segment compilation processing on a corresponding program segment of the target line number sequence;
第一获取模块,用于获取对应程序段的目标信息,以使得机床根据目标信息从加工复位行开始加工。The first obtaining module is configured to acquire target information of the corresponding program segment, so that the machine tool starts processing from the processing reset line according to the target information.
结合本发明实施例的第二方面,在本发明实施例的第二方面的第一种实施方式中,该编译器还包括:With reference to the second aspect of the embodiments of the present invention, in a first implementation manner of the second aspect of the embodiment, the compiler further includes:
第三判断模块,用于当编译器判断目标程序段存在不包括目标模态指令或绝对坐标的第二程序段时,则判断第二程序段中是否存在第三程序段至第四程序段的连续程序段,第四程序段与加工复位行对应的程序段相邻;a third determining module, configured to: when the compiler determines that the target block has a second block that does not include the target modal command or the absolute coordinate, determines whether the third block to the fourth block exist in the second block a continuous block, the fourth block is adjacent to the block corresponding to the machining reset line;
第二记录模块,用于当第二程序段中存在第三程序段至第四程序段的连续程序段时,则将结构体中对应第二成员变量记录第三程序段的原行号。The second recording module is configured to record the original line number of the third program segment corresponding to the second member variable in the structure when there is a continuous program segment of the third program segment to the fourth program segment in the second program segment.
结合本发明实施例的第二方面,或本发明实施例的第二方面的第一种实施方式,在本发明实施例的第二种实施方式中,该编译器还包括:With reference to the second aspect of the embodiments of the present invention, or the first embodiment of the second aspect of the embodiments of the present invention, in a second implementation manner of the embodiment of the present invention, the compiler further includes:
第二获取模块,用于从结构体中获取第三程序段的原行号;a second obtaining module, configured to acquire a primary line number of the third program segment from the structure;
逐行编译处理模块,用于根据第二获取模块获取的第三程序段的原行号对连续程序段进行逐行编译处理。The line-by-line compilation processing module is configured to perform line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment acquired by the second acquisition module.
结合本发明实施例的第二方面,本发明实施例的第二方面的第一种实施方式或第二种实施方式,在本发明实施例的第二方面的第三种实施方式中,片段编译处理模块包括:With reference to the second aspect of the embodiments of the present invention, the first implementation manner or the second implementation manner of the second aspect of the embodiment of the present invention, in the third implementation manner of the second aspect of the embodiment of the present invention, the fragment compilation Processing modules include:
第一确定单元,用于目标行号序列确定对应程序段;a first determining unit, configured to determine a corresponding program segment by the target line number sequence;
第一读取单元,用于通过词法分析读取第一确定单元确定的对应程序段;a first reading unit, configured to read, by lexical analysis, a corresponding program segment determined by the first determining unit;
第一识别单元,用于识别第一读取单元读取的对应程序段中的各个字符;a first identifying unit, configured to identify each character in a corresponding program segment read by the first reading unit;
第一转换单元,用于并将第一识别单元识别的对应程序段中的各个字符转换为第一目标数量的第一终结点;a first converting unit, configured to convert each character in the corresponding program segment identified by the first identifying unit into a first target number of first end points;
第一存储单元,用于第一转换单元转换的第一终结点存储至缓冲区;a first storage unit, configured to store, by the first conversion unit, a first endpoint to the buffer;
第一获取单元,用于通过语法分析从缓冲区中按照目标顺序获取第一存储单元存储的第一终结点;a first acquiring unit, configured to obtain, by syntax analysis, the first endpoint stored in the first storage unit from the buffer according to the target order;
第一判断单元,用于判断第一终结点是否与目标语法规则匹配;a first determining unit, configured to determine whether the first endpoint matches the target grammar rule;
第一语义分析单元,用于当第一终结点与目标语法规则匹配时,则将第一终结点进行语义分析。The first semantic analysis unit is configured to perform semantic analysis on the first endpoint when the first endpoint matches the target grammar rule.
结合本发明实施例的第二方面的第一种实施方式,在本发明实施例的第二方面的第四种实施方式中,逐行编译处理模块包括: With reference to the first embodiment of the second aspect of the embodiment of the present invention, in the fourth implementation manner of the second aspect of the embodiment of the present invention, the progressive compilation processing module includes:
第二确定单元,用于根据第三程序段的原行号确定连续程序段;a second determining unit, configured to determine a continuous program segment according to a primary line number of the third program segment;
第二读取单元,用于通过词法分析读取第二确定单元确定的连续程序段;a second reading unit, configured to read, by lexical analysis, a continuous program segment determined by the second determining unit;
第二识别单元,用于识别第二读取单元读取的连续程序段中的各个字符;a second identifying unit, configured to identify each character in the continuous program segment read by the second reading unit;
第二转换单元,用于并将第二识别单元识别的连续程序段中的各个字符转换为第二目标数量的第二终结点;a second converting unit, configured to convert each character in the continuous block identified by the second identifying unit into a second target number of second target points;
第二存储单元,用于第二转换单元转换的第二终结点存储至缓冲区;a second storage unit, the second endpoint for the second conversion unit conversion is stored in the buffer;
第二获取单元,用于通过语法分析从缓冲区中按照目标顺序获取第二存储单元存储的第二终结点;a second acquiring unit, configured to obtain, by syntax analysis, the second endpoint stored in the second storage unit from the buffer according to the target order;
第二判断单元,用于判断第二终结点是否与目标语法规则匹配;a second determining unit, configured to determine whether the second endpoint matches the target grammar rule;
第二语义分析单元,用于当第二终结点与目标语法规则匹配时,则将第二终结点进行语义分析。The second semantic analysis unit is configured to perform semantic analysis on the second endpoint when the second endpoint matches the target grammar rule.
本发明第三方面提供一种机器人,包括有上述实施例的第二方面,以及上述实施例的第二方面的第一种实施方式至第四种实施方式中的任意一种所述的编译器。A third aspect of the present invention provides a robot comprising the second aspect of the above-described embodiment, and the compiler according to any one of the first to fourth embodiments of the second aspect of the above-described embodiment .
本发明第四方面提供一种数控系统,包括有上述实施例的第二方面,以及上述实施例的第二方面的第一种实施方式至第四种实施方式中的任意一种所述的编译器。A fourth aspect of the present invention provides a numerical control system including the second aspect of the above-described embodiment, and the compilation of any one of the first to fourth embodiments of the second aspect of the above-described embodiment Device.
本发明第五方面提供一种数控机床,包括有上述实施例的第四方面所述的编译器。A fifth aspect of the invention provides a numerically controlled machine tool comprising the compiler of the fourth aspect of the above embodiment.
从以上技术方案可以看出,本发明实施例具有以下优点:It can be seen from the above technical solutions that the embodiments of the present invention have the following advantages:
本发明实施例中,当编译器需要实现加工复位时,可以按照目标顺序读取加工文本,并在读取过程中可以判断加工文本中是否存在加工复位标记,若存在,则编译器可以确定目标文本,该目标文本为加工文本中行号小于加工复位行的行号的文本,加工复位行则为加工复位标记所在的程序段。在确定目标文本后,编译器可以通过对该目标文本进行快速预编译处理确定具有模态指令的目标程序段,接着,编译器可以判断目标程序段是否存在包括目标模态指令或绝对坐标的第一程序段,若包含,则编译器可以记录第一程序段的第一行号,并用该第一行号替代结构体中对应第一成员变量的原行号,其中,该结构体为记录目标程序段中预设程序段的原行号的成员变量,预设程序段的原行号包括一种模态指令,或一组绝对坐标最后被指定时所处的程序段的行号。替代完结 构体中对应第一成员变量的原行号后,编译器可以对结构体中各成员变量的行号进行处理得到目标行号序列,且可以将目标行号序列的对应程序段进行片段编译处理,获取对应程序段的目标信息,以使得机床能够根据目标信息从加工复位行开始加工。In the embodiment of the present invention, when the compiler needs to implement the processing reset, the processing text can be read according to the target sequence, and during the reading process, whether the processing reset flag exists in the processed text can be determined, and if present, the compiler can determine the target. Text, the target text is the text in the processed text whose line number is smaller than the line number of the processing reset line, and the machining reset line is the block where the machining reset mark is located. After determining the target text, the compiler can determine the target program segment having the modal instruction by performing fast pre-compilation processing on the target text, and then the compiler can determine whether the target program segment includes the target modal command or the absolute coordinate. a program segment, if included, the compiler may record the first line number of the first program segment, and replace the original line number corresponding to the first member variable in the structure with the first line number, wherein the structure is a recording target The member variable of the original line number of the preset block in the block. The original line number of the preset block includes a modal command or the line number of the block in which the absolute coordinate is last specified. Replacement After the original line number corresponding to the first member variable in the structure, the compiler can process the line number of each member variable in the structure to obtain the target line number sequence, and can perform segment compilation processing on the corresponding program segment of the target line number sequence. Obtain the target information of the corresponding block so that the machine can start machining from the machining reset line according to the target information.
由于编译器在实现加工复位的过程中,能够通过快速预编译处理目标文本,并逐行替代结构体中相应成员变量的模态指令以及绝对坐标最后被指定时的行号,因此,编译器可以通过对目标序列号的对应程序段进行片段编译处理获得有关模态指令以及绝对坐标的目标信息,从而机床可以根据该目标信息在加工复位行开始加工,操作人员则不需要考虑是否会产生编译错误或位置错误等问题,同时,编译器通过对结构体中各成员变量进行处理获得目标序列号,可以对对应程序段进行编译,避免了时间的耗费,进而提高了机床的加工效率。Because the compiler can process the target text by fast pre-compilation in the process of processing reset, and replace the modal instruction of the corresponding member variable in the structure line by line and the line number when the absolute coordinate is finally specified, the compiler can The target information about the modal command and the absolute coordinate is obtained by performing the segment compiling process on the corresponding block of the target serial number, so that the machine can start processing in the processing reset line according to the target information, and the operator does not need to consider whether a compile error will occur. Or the position error and other problems, at the same time, the compiler obtains the target serial number by processing each member variable in the structure, and can compile the corresponding program segment, thereby avoiding the time consumption, thereby improving the processing efficiency of the machine tool.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
图1为本发明实施例中加工复位实现方法一个实施例;1 is an embodiment of a method for implementing processing reset in an embodiment of the present invention;
图2为本发明实施例中加工复位实现方法另一实施例;2 is another embodiment of a method for implementing processing reset in an embodiment of the present invention;
图3为本发明实施例中编译器一个实施例;3 is an embodiment of a compiler in an embodiment of the present invention;
图4为本发明实施例中编译器另一实施例。4 is another embodiment of a compiler in an embodiment of the present invention.
具体实施方式detailed description
本发明实施例提供了一种加工复位实现方法以及编译器,该加工复位实现方法具有易用性强、效率高的优点,操作人员无需考虑从任意程序段进行加工复位是否会产生问题,也无需在大程序加工复位时等待很长的时间,进而提高了数控机床的加工效率。The embodiment of the invention provides a processing reset implementation method and a compiler, and the processing reset implementation method has the advantages of high usability and high efficiency, and the operator does not need to consider whether processing reset from any program segment may cause problems or Waiting for a long time in the large program processing reset, thus improving the processing efficiency of the CNC machine.
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发 明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is an embodiment of the invention, but not all of the embodiments. Based on this issue All other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the scope of the present invention.
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if present) in the specification and claims of the present invention and the above figures are used to distinguish similar objects without having to use To describe a specific order or order. It is to be understood that the data so used may be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than what is illustrated or described herein. In addition, the terms "comprises" and "comprises" and "the" and "the" are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to Those steps or units may include other steps or units not explicitly listed or inherent to such processes, methods, products or devices.
众所周知,数控系统的加工程序是一个多行文本,编译器可以将加工文本顺序地按行编译和执行,也可能有分支、循环和跳转。在实际的数控加工过程中,常常会由于某种原有需要从加工文本中某一行开始进行加工,该加工文本行俗称为加工复位行。As is known, the machining program of the numerical control system is a multi-line text, and the compiler can compile and execute the processed text sequentially in rows, and may also have branches, loops, and jumps. In the actual numerical control machining process, it is often processed from a certain line in the processing text due to some original needs, which is commonly referred to as a machining reset line.
在现有的一些数控系统中,纵然可以通过“程序再启动”、“程序段搜索”等方法实现加工复位,然而这些方法并不能从加工程序的任意行开始加工复位,而同时又保持之前程序段的变量计算和加工模态。若从某些行开始加工,会导致系统报警,或者出现断点位置不正确的问题,这样就需要操作人员具有相当的经验,来判断这个功能是否可以使用。例如,恢复断点位置时可能使用原程序段的插补类型,当这个插补类型是G2/G3时,就会引起圆弧半径错误。又如,从几段宏程序中间开始启动,可能会造成丢失变量计算的结果。此外,即使能够恢复断点位置和相应加工模态,这些方法在加工程序相当大(例如几百万行或几千万行的精雕程序)的情况下,可能需要等待相当长的时间才能启动加工,这在某些加工场合下无法应用进行,而有些方法试图仅编译加工复位行之前的几千行,可能仍然导致出现模态错误的问题。In some existing CNC systems, even if the machining reset can be realized by "program restart" or "block search", these methods cannot be processed and reset from any line of the machining program while maintaining the previous program. The variable calculation and processing modality of the segment. If you start processing from some lines, it will cause the system to alarm, or the problem of incorrect position of the breakpoint, so the operator has considerable experience to judge whether this function can be used. For example, the interpolation type of the original block may be used when restoring the breakpoint position. When this interpolation type is G2/G3, the arc radius error will be caused. For another example, starting from the middle of several macro programs may result in missing variable calculations. In addition, even if the breakpoint position and the corresponding machining mode can be restored, these methods may take a considerable amount of time to start up when the machining program is quite large (for example, a few million or tens of millions of rows of engraving programs). Machining, which cannot be applied in some machining situations, and some methods attempting to compile only a few thousand lines before the processing reset line may still cause modal errors.
在本发明实施例中,数控系统的编译器通过对加工文本中加工复位行之前的目标文本进行快速预编译处理,可以确定具有模态指令的目标程序段,并通过对该目标程序段中进行片段编译等一系列处理,从而编译器可以在对加工文本进行编译到达加工复位行之前获得目标信息,并根据该目标信息恢复断点位置和TSM状态,进行剩余程序的正常编译,使得机床在加工复位行进行加工。 由此可以实现数控系统在任意加工程序段进行加工复位,而目标信息的获取使得操作人员不需要考虑是否会产生编译错误或位置错误等问题,同时,编译器只对目标程序段进行编译处理,避免了时间的耗费,进而提高了机床的加工效率。In the embodiment of the present invention, the compiler of the numerical control system can perform the fast pre-compilation processing on the target text before processing the reset line in the processed text, and can determine the target program segment having the modal command, and perform the target program segment in the target program segment. A series of processing such as fragment compilation, so that the compiler can obtain the target information before compiling the processed text to reach the processing reset line, and recover the breakpoint position and the TSM state according to the target information, and perform normal compilation of the remaining programs, so that the machine tool is processed. Reset the line for processing. Therefore, the numerical control system can be processed and reset in any machining block, and the acquisition of the target information does not require the operator to consider whether a compilation error or a position error will occur, and the compiler only compiles the target program segment. The time consumption is avoided, which improves the machining efficiency of the machine tool.
为便于理解,下面对本发明实施例中的具体流程进行描述,由于当编译器判断目标程序段是否存在包括目标模态指令或绝对坐标的第一程序段时,若存在的情况下还可以包括两种情况,即只存在包括目标模态指令或绝对坐标的第一程序段,和,既存在包括目标模态指令或绝对坐标的第一程序段又存在不包括目标模态指令或绝对坐标的第二程序段,下面进行分别说明:For ease of understanding, the specific flow in the embodiment of the present invention is described below. When the compiler determines whether the target program segment has the first program segment including the target modal command or the absolute coordinate, if it exists, it may also include two a case where there is only a first block including a target modal command or absolute coordinates, and a first block including a target modal command or absolute coordinates and a first modal command or absolute coordinate The second block is described separately below:
一、目标程序段只存在包括目标模态指令或绝对坐标的第一程序段:1. The target block only has the first block including the target modal command or absolute coordinates:
本实施例中,请参阅图1,本发明实施例中加工复位实现方法一个实施例包括:In this embodiment, referring to FIG. 1, an embodiment of a method for implementing processing reset in an embodiment of the present invention includes:
101、编译器按照目标顺序读取加工文本;101. The compiler reads the processed text according to the target order;
在数控加工过程中,编译器可以按照目标顺序读取加工文本。During CNC machining, the compiler can read the processed text in the order of the target.
102、编译器判断加工文本是否存在加工复位标记,若否,则执行步骤103,若是,则执行步骤104;102, the compiler determines whether there is a processing reset flag in the processed text, if not, then proceeds to step 103, and if so, proceeds to step 104;
在数控加工过程中,当数控系统由于某种原因,比如突然断电或断刀或某种特殊加工需求,需要在特定加工位置执行原加工程序时,该特定加工位置可以存在加工复位标记,因此编译器可以在读取加工文本后,判断加工文本中是否存在加工复位标记。In the NC machining process, when the CNC system needs to perform the original machining program at a specific machining position for some reason, such as sudden power failure or broken knife or a special machining requirement, the machining position mark may exist in the specific machining position. The compiler can determine whether there is a machining reset flag in the processed text after reading the processed text.
103、编译器执行其它流程;103. The compiler executes other processes;
若编译器判断加工文本中不存在加工复位标记,则编译器可以不进行其它操作,使得编译器可以按照正常程序对加工文本进行编译,机床可以按照正常加工程序进行加工。If the compiler determines that there is no machining reset mark in the processed text, the compiler can perform other operations, so that the compiler can compile the processed text according to the normal program, and the machine tool can process according to the normal machining program.
104、编译器确定目标文本;104. The compiler determines the target text;
若编译器判断加工文本中存在加工复位标记,则编译器可以从加工文本中确定目标文本,该目标文本可以为加工文本中行号小于加工复位行的行号的文本,该加工复位行可以为加工复位标记所在的程序段。If the compiler determines that there is a machining reset mark in the processed text, the compiler can determine the target text from the processed text, and the target text can be the text in the processed text whose line number is smaller than the line number of the processing reset line, and the processing reset line can be processed. The block in which the reset tag is located.
本实施例中,加工复位行可以包括圆弧插补行或固定循环行或宏程序行,具体此处不做限定。 In this embodiment, the processing reset line may include a circular interpolation line or a fixed cycle line or a macro program line, which is not limited herein.
105、编译器通过对目标文本进行快速预编译处理得到具有模态指令的目标程序段;105. The compiler obtains a target program segment having a modal instruction by performing fast pre-compilation processing on the target text.
编译器确定目标文本后,可以对该目标文本进行快速预编译处理,即对加工文本中的程序段进行快速浏览,通过词法分析可以得到具有模态指令的目标程序段。After the compiler determines the target text, the target text can be quickly pre-compiled, that is, the program segment in the processed text is quickly browsed, and the target program segment with the modal command can be obtained through lexical analysis.
106、编译器记录第一程序段的行号,并用第一程序段的行号替代结构体中对应第一成员变量的原行号;106. The compiler records the line number of the first program segment, and replaces the original line number corresponding to the first member variable in the structure with the line number of the first program segment;
本实施例中,编译器得到具有模态指令的目标程序段后,可以判断该目标程序段中是否存在包括目标模态指令或绝对坐标的第一程序段,若该目标程序段中只存在包括目标模态指令或绝对坐标的第一程序段,则编译器可以记录第一程序段的行号,并可以用第一程序段的行号替代结构体中对应第一成员变量的原行号,结构体为记录目标程序段中预设程序段的原行号的成员变量,预设程序段的原行号包括一种模态指令最后被指定时所处的程序段的行号,或一组绝对坐标最后被指定时所处的程序段的行号。In this embodiment, after the compiler obtains the target program segment with the modal command, it can be determined whether there is a first program segment including the target modal command or the absolute coordinate in the target program segment, if only the target program segment is included in the target program segment. The target modal command or the first block of absolute coordinates, the compiler can record the line number of the first block, and can replace the original line number of the corresponding first member variable in the structure with the line number of the first block. The structure is a member variable that records the original line number of the preset block in the target block. The original line number of the preset block includes the line number of the block in which the modal command was last specified, or a group. The line number of the block in which the absolute coordinate was last specified.
例如,假设目标模态指令为绝对模式G90,非目标模态指令为增量模式G91,则当编译器判断第一程序段为G90时,则可以记录该第一程序段的行号,并用这个行号替代结构体中对应成员的原行号(初始值为0),并将与G91相关的成员变量清零。可以理解的是,在实际应用中,目标模态指令或非目标模态指令还可以为其它的指令模式,本实施例只是举例进行说明。For example, if the target modal command is the absolute mode G90 and the non-target modal command is the incremental mode G91, when the compiler determines that the first block is G90, the line number of the first block can be recorded, and this is used. The line number replaces the original line number of the corresponding member in the structure (the initial value is 0), and the member variable associated with G91 is cleared. It can be understood that, in practical applications, the target modal command or the non-target modal command may also be other instruction modes, and this embodiment is only an example for description.
需要说明的是,本实施例中,若编译器判断目标程序段中不存在包括目标模态指令或绝对坐标的第一程序段,则目标程序段全部是指令模式为不包括目标模态指令或绝对坐标的第二程序段,那么编译器可以对该目标程序段进行处理,具体的处理方式可以为:It should be noted that, in this embodiment, if the compiler determines that the first program segment including the target modal command or the absolute coordinate does not exist in the target program segment, the target program segment is all the command mode to not include the target modal command or The second block of absolute coordinates, then the compiler can process the target block. The specific processing method can be:
编译器判断第二程序段中是否存在第三程序段至第四程序段的连续程序段,第四程序段与加工复位行对应的程序段相邻;The compiler determines whether there is a continuous block of the third block to the fourth block in the second block, and the fourth block is adjacent to the block corresponding to the processing reset line;
若存在,则编译器从第三程序段进行逐行编译处理。If it exists, the compiler performs line-by-line compilation processing from the third block.
可以理解的是,上述仅以一个例子说明了目标程序段为第二程序段时编译器的处理方式,在实际应用中,编译器还可以采用其它的处理方式进行处理,只要能够对目标程序段进行处理即可,具体处理方式此处不做限定。It can be understood that the above describes the processing mode of the compiler when the target program segment is the second program segment by using only one example. In practical applications, the compiler can also use other processing methods for processing, as long as the target program segment can be processed. The processing can be performed, and the specific processing manner is not limited herein.
107、编译器对结构体中各成员变量的行号进行处理得到目标行号序列; 107. The compiler processes the line number of each member variable in the structure to obtain a sequence of the target line number;
当编译器用第一程序段的第一行号替代结构体中对应第一成员变量的原行号后,编译器可以对结构体中各成员变量的行号进行处理,如编译器检查结构体中各成员变量行号的数值,然后进行升序排序、去重,可以得到目标行号序列。When the compiler replaces the original line number of the first member variable in the structure with the first line number of the first block, the compiler can process the line number of each member variable in the structure, such as the compiler checking the structure. The value of each member variable line number is then sorted in ascending order and de-duplicated to obtain a sequence of target line numbers.
需要说明的是,本实施例中目标行号序列除了上述说明的升序排序方式之外,还可以是其它的序列方式,只要编译器可以得到目标行号序列即可,具体此处不做限定。It should be noted that, in addition to the ascending ordering manner described above, the sequence of the target line number in this embodiment may be other sequence manners, as long as the compiler can obtain the target line number sequence, which is not limited herein.
108、编译器将目标行号序列的对应程序段进行片段编译处理;108. The compiler performs fragment compilation processing on the corresponding program segment of the target line number sequence;
当编译器得到结构体中各成员变量对应的目标行号序列后,可以将目标行号序列的对应程序段进行片段编译处理,即编译的相邻两段程序可能并不是连续的加工工序。本实施例中,在片段编译过程中可能出现圆弧半径错误、换刀前未停止主轴等编译错误,但由于该过程不向其他模块发送运动数据,所以不会产生真实的报警,可以保证片段编译顺畅地进行,且在片段编译过程中,可以将所有插补语句都视为G00语句,从而不会出现圆弧半径错误的问题。After the compiler obtains the target line number sequence corresponding to each member variable in the structure, the corresponding program segment of the target line number sequence may be subjected to fragment compilation processing, that is, the compiled adjacent two-stage program may not be a continuous processing operation. In this embodiment, a compilation error such as an arc radius error or a spindle stop before the tool change may occur during the segment compilation process, but since the process does not send motion data to other modules, a real alarm is not generated, and the segment can be guaranteed. Compilation proceeds smoothly, and all interpolated statements can be treated as G00 statements during fragment compilation, so that there is no problem with arc radius errors.
本实施例中,编译器将目标行号序列的对应程序段进行片段编译处理的具体方式可以为:In this embodiment, the specific manner in which the compiler performs fragment compilation processing on the corresponding program segment of the target line number sequence may be:
编译器根据目标行号序列确定对应程序段;The compiler determines the corresponding program segment according to the target line number sequence;
编译器通过词法分析读取对应程序段,识别对应程序段中的各个字符,并将对应程序段中的各个字符转换为第一目标数量的第一终结点;The compiler reads the corresponding program segment by lexical analysis, identifies each character in the corresponding program segment, and converts each character in the corresponding program segment into a first endpoint of the first target number;
编译器将第一终结点存储至缓冲区;The compiler stores the first endpoint in the buffer;
编译器通过语法分析从缓冲区中按照目标顺序获取第一终结点;The compiler obtains the first endpoint from the buffer in the target order by parsing;
编译器将第一终结点是否与目标语法规则匹配;The compiler matches the first endpoint to the target grammar rule;
若是,则编译器将第一终结点进行语义分析。If so, the compiler performs semantic analysis on the first endpoint.
即,在实际应用中,编译器根据目标行号序列按照设定的路径确定对应程序段后,编译器的词法分析程序可以从字符流的对应程序段中识别单词,比如从左至右逐个字符地扫描对应程序段,词法分析程序可以作为一个子程序,每当词法分析程序需要一个单词时,则可以调用该子程序,词法分析程序每得到一次调用,便从对应程序段中读入一些字符直到识别出一个单词,或直到识别出下一个单词的第一个字符。That is, in an actual application, after the compiler determines the corresponding program segment according to the set path according to the target line number sequence, the compiler's lexical analysis program can recognize words from the corresponding program segments of the character stream, such as characters from left to right. The lexical analysis program can be used as a subroutine. When the lexical analysis program needs a word, the subroutine can be called. Each time the lexical analysis program gets a call, some characters are read from the corresponding program segment. Until a word is recognized, or until the first character of the next word is recognized.
随后,编译器中的词法分析程序可以将对应程序段中的各个字符转换为第 一目标数量的第一终结点,即将字符流的对应程序段转换为单词序列,编译器可以将转换的单词序列存储至缓冲区,此时,编译器前端的语法分析器可以从缓冲区中按照单词的排列顺序获取单词序列,并试图匹配自身规定的语法规则,匹配成功后执行对应的语义分析,编译器前端的语义分析器可以将分散的单词按预先定义好的语法组装成有意义的表达式、语句或函数等等,例如“a=b+c”,语法分析器看到的是“a,=,b,+,c,”语义分析器按定义的语法,可以先将语法分析器看到的字符组装成表达式“b+c”再组装成“a=b+c”的语句,语义分析器还可以检查语义,例如检测参与运算的变量是否是同一类型,由此生成的语法树可以在编译器后端进行优化处理,并将处理结果按照生成携带有目标信息的目标文件,Subsequently, the lexer in the compiler can convert each character in the corresponding block into the first The first endpoint of a target number, that is, the corresponding program segment of the character stream is converted into a word sequence, and the compiler can store the converted word sequence into the buffer. At this time, the parser of the compiler front end can follow the buffer. The word ordering sequence obtains the word sequence and tries to match the grammar rules specified by itself. After the matching is successful, the corresponding semantic analysis is performed. The semantic analyzer of the compiler front end can assemble the scattered words into meaningful expressions according to the predefined grammar. Formula, statement or function, etc., such as "a=b+c", the parser sees "a,=,b,+,c," the semantic parser can define the parser first. The characters that are seen are assembled into the expression "b+c" and then assembled into "a=b+c". The semantic analyzer can also check the semantics, such as detecting whether the variables participating in the operation are of the same type, and thus the generated grammar. The tree can be optimized at the back end of the compiler, and the processing result is generated according to the target file carrying the target information.
需要说明的是,本实施例仅以上述一个例子说明了编译器将目标行号序列的对应程序段进行片段编译处理的具体方式,在实际应用中,编译器可以采用其它的片段编译处理方式进行结合或单独使用,只要编译器可以将目标行号序列的对应程序段进行片段编译处理即可,具体的处理方式此处不做限定。It should be noted that, in the embodiment, only the specific example of the compiler compiling the corresponding program segment of the target line number sequence is described in the above example. In practical applications, the compiler may use other segment compilation processing methods. Combined or used alone, as long as the compiler can perform fragment compilation processing on the corresponding program segment of the target line number sequence, the specific processing manner is not limited herein.
109、编译器获取对应程序段的目标信息。109. The compiler obtains target information of the corresponding program segment.
编译器将目标行号序列的对应程序段进行片段编译处理后,可以将这些程序段的坐标或模态信息保存到编译数据中,由此,当编译器编译到加工复位行时,已经完整地编译了所必须编译的程序段,编译器可以从编译数据中获取该对应程序段的目标信息,以使得机床可以根据目标信息从加工复位行开始加工。After the compiler compiles the corresponding segments of the target line number sequence, the coordinates or modal information of these blocks can be saved into the compiled data. Thus, when the compiler compiles to the processing reset line, it is completely intact. The program segment that must be compiled is compiled, and the compiler can obtain the target information of the corresponding program segment from the compiled data, so that the machine tool can start processing from the processing reset line according to the target information.
可以理解的是,本实施例中,该目标信息可以包括模态信息和坐标信息,也可以包括刀具、主轴转速、主轴转向等信息,具体此处不做限定。It can be understood that, in this embodiment, the target information may include modal information and coordinate information, and may also include information such as a tool, a spindle rotation speed, a spindle rotation, and the like, which are not limited herein.
需要说明的是,在实际应用中,目标信息中的坐标信息可以包括加工工件在X、Y和Z轴的坐标,这样在机床的刀具恢复断点位置前,可以从原来的某个随机位置抬起到换刀高度。比如,假设刀具平行轴为Z轴,则接下来先恢复X、Y轴的断点位置,再恢复Z轴断点位置,这样能够确保刀具可以在安全的高度上移动,而不会与工件发生碰撞。相反的是,如果没有先将刀具抬起到安全位置,就移动XY轴,则会非常容易发生碰撞。It should be noted that, in practical applications, the coordinate information in the target information may include the coordinates of the workpiece in the X, Y, and Z axes, so that the tool can be lifted from a random position before the tool resumes the breakpoint position. It is the height of the tool change. For example, if the parallel axis of the tool is the Z axis, then the breakpoint position of the X and Y axes is restored first, and then the Z axis breakpoint position is restored. This ensures that the tool can move at a safe height without happening with the workpiece. collision. Conversely, moving the XY axis without first lifting the tool to a safe position can be very prone to collisions.
本实施例中,编译器可以对加工复位行之前的目标文本进行快速预编译处理,得到具有模态指令的目标程序段,并可以通过对目标程序段中有目标模态 指令或绝对坐标的第一程序段进行一系列处理,使得编译器在到达加工复位行之前可以获取目标信息,机床可以根据该目标信息中的模态信息和坐标信息在加工复位行进行加工,从而有效避免产生编译错误或位置错误等问题。同时,编译器只对目标程序段中的第一程序段进行处理,而非所有的目标程序段,可以节省加工复位所耗费的时间,进而提高了机床的加工效率。In this embodiment, the compiler can perform fast pre-compilation processing on the target text before the processing reset line, obtain the target program segment with the modal command, and can pass the target modality in the target program segment. The first block of the instruction or absolute coordinate performs a series of processing, so that the compiler can acquire the target information before reaching the processing reset line, and the machine tool can process the processing reset line according to the modal information and the coordinate information in the target information, thereby Effectively avoid problems such as compilation errors or position errors. At the same time, the compiler only processes the first block in the target block, not all the target blocks, which saves the time required for the machining reset, thereby improving the machining efficiency of the machine.
二、目标程序段中既存在包括目标模态指令或绝对坐标的第一程序段又存在不包括目标模态指令或绝对坐标的第二程序段:2. The target program segment has both the first program segment including the target modal command or absolute coordinates and the second program segment not including the target modal command or absolute coordinates:
下面对本发明实施例中的具体流程进行描述,请参阅图2,本发明实施例中加工编译功能实现方法另一实施例包括:The following describes the specific process in the embodiment of the present invention. Referring to FIG. 2, another embodiment of the method for implementing the processing and compiling function in the embodiment of the present invention includes:
本实施例中步骤201至步骤205与图1所示实施例的步骤101至步骤105相同,此处不赘述。 Steps 201 to 205 in this embodiment are the same as steps 101 to 105 of the embodiment shown in FIG. 1, and are not described herein.
本实施例中的步骤206中除编译器判断目标程序段中可以存在包括目标模态指令或绝对坐标的第一程序段,也可以存在不包括目标模态指令或绝对坐标的第二程序段外,其它与图1所示实施例的步骤106相同,此处不再赘述。In the step 206 in this embodiment, except that the compiler may determine that the first program segment including the target modal command or the absolute coordinate may exist in the target program segment, there may be a second program segment that does not include the target modal command or absolute coordinates. Others are the same as step 106 of the embodiment shown in FIG. 1, and are not described herein again.
207、编译器判断第二程序段中是否存在第三程序段至第四程序段的连续程序段,若是,则执行步骤208,若否,则执行步骤209;207, the compiler determines whether there is a continuous block of the third block to the fourth block in the second block, and if so, step 208 is performed, and if not, step 209 is performed;
当编译器判断目标程序段中存在不包括目标模态指令或绝对坐标的第二程序段后,编译器可以判断第二程序段中是否存在第三程序段至第四程序段的连续程序段,第四程序段与加工复位行对应的程序段相邻,即判断在加工复位行之前连续若干行程序段的指令模式是否为非目标模态指令。When the compiler determines that there is a second block in the target block that does not include the target modal command or absolute coordinates, the compiler can determine whether there is a contiguous block of the third block to the fourth block in the second block. The fourth block is adjacent to the block corresponding to the machining reset line, that is, whether the command mode of several consecutive blocks before the machining reset line is a non-target modal command.
例如,假设非目标模态指令为G91,则编译器可以判断在加工复位行之前连续若干行程序段的指令模式是否为G91。For example, assuming that the non-target modal command is G91, the compiler can determine whether the command mode of several consecutive blocks before the machining reset line is G91.
208、编译器将结构体中对应第二成员变量记录第三程序段的原行号;208. The compiler records the original line number of the third program segment corresponding to the second member variable in the structure.
若编译器判断第二程序段中存在第三程序段至第四程序段的连续程序段,则编译器可以将结构体中对应第二成员变量记录第三程序段的原行号。If the compiler determines that there are consecutive blocks of the third block to the fourth block in the second block, the compiler may record the original line number of the third block in the corresponding second member variable in the structure.
本实施例中步骤209至步骤210与图1所示实施例的步骤107至步骤108相同,此处不再赘述。 Steps 209 to 210 of this embodiment are the same as steps 107 to 108 of the embodiment shown in FIG. 1, and details are not described herein again.
可以理解的是,本实施例中步骤207至步骤208与步骤206之前,只要在编译器对结构体中各成员变量的行号进行处理得到目标行号序列之前即可,具体此处不做限定。 It can be understood that, before step 207 to step 208 and step 206 in this embodiment, as long as the compiler processes the line number of each member variable in the structure to obtain the target line number sequence, it is not limited herein. .
需要说明的是,在实际应用中,假设本实施例中步骤209在得到目标行号序列时,目标行号序列可以按照升序排序,且结构体中对应第二成员变量可以记录第三程序段的原行号,那么指令模式为非目标模态指令的第三程序段在结构体中对应的第二成员变量的行号数值不为零且为原行号,而此前第一成员变量的原行号可以在步骤206中被行号初始值为0的第一程序段的行号所替代,从而在结构体中第二成员变量的行号数值最大,则第三程序段可以在步骤210中作为目标行号序列的对应程序段进行片段编译处理的的最后一行。It should be noted that, in practical applications, it is assumed that in step 209 in the embodiment, when the target line number sequence is obtained, the target line number sequence may be sorted in ascending order, and the corresponding second member variable in the structure may record the third program segment. The original line number, then the third block of the instruction mode is the non-target modal command. The value of the line number of the corresponding second member variable in the structure is not zero and is the original line number, and the original line of the first member variable The number can be replaced in step 206 by the line number of the first block whose initial value is 0, so that the value of the line number of the second member variable is the largest in the structure, and the third block can be used in step 210. The corresponding block of the target line number sequence performs the last line of the fragment compilation process.
211、编译器从结构体中获取第三程序段的原行号;211. The compiler obtains the original line number of the third program segment from the structure.
由于第二程序段中存在第三程序段至第四程序段的连续程序段,为了保证编译器总能够在到达加工复位行之前正确地恢复断点位置,编译器需要对该连续程序段进行处理,则编译器可以从结构体中获取第三程序段的原行号。Since there are consecutive blocks from the third block to the fourth block in the second block, in order to ensure that the compiler can always restore the breakpoint position correctly before reaching the machining reset line, the compiler needs to process the continuous block. , the compiler can get the original line number of the third program block from the structure.
可以理解是,本实施例中步骤211可以在步骤208至步骤212之间,只要在编译器根据第三程序段的原行号对连续程序段进行逐行编译处理之前即可,具体此处不做限定。It can be understood that step 211 in this embodiment may be between step 208 and step 212, as long as the compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment, specifically not here. Make a limit.
212、编译器根据第三程序段的原行号对连续程序段进行逐行编译处理;212. The compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment;
编译器从结构体中获取第三程序段的原行号后,编译器可以根据第三程序段的原行号对第三程序段至第四程序段的连续程序段进行逐行编译处理,第三程序段又可以作为逐行编译处理的起始行。After the compiler obtains the original line number of the third program segment from the structure, the compiler can perform the line-by-line compilation processing on the continuous block of the third program segment to the fourth program segment according to the original line number of the third program segment. The three blocks can again be used as the starting line for the line-by-line compilation process.
本实施例中,编译器根据第三程序段的原行号对连续程序段进行逐行编译处理的具体方式可以为:In this embodiment, the specific manner in which the compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment may be:
编译器根据第三程序段的原行号确定连续程序段;The compiler determines the continuous program segment according to the original line number of the third program segment;
编译器通过词法分析读取连续程序段,识别连续程序段中的各个字符,并将连续程序段中的各个字符转换为第二目标数量的第二终结点;The compiler reads the continuous block by lexical analysis, identifies each character in the continuous block, and converts each character in the continuous block into a second end point of the second target number;
编译器将第二终结点存储至缓冲区;The compiler stores the second endpoint in the buffer;
编译器通过语法分析从缓冲区中按照目标顺序获取第二终结点;The compiler obtains the second endpoint from the buffer in the target order by parsing;
编译器将第二终结点是否与目标语法规则匹配;The compiler matches the second endpoint with the target grammar rules;
若是,则编译器将第二终结点进行语义分析。If so, the compiler performs a semantic analysis of the second endpoint.
需要说明的是,本实施例中的逐行编译处理与片段编译处理所执行的步骤动作一致,但处理的对象不一致,片段编译处理是对有可能离散的、行号不连续的第一程序段进行编译,比如当目标程序段中既存在包括目标模态指令或绝 对坐标的第一程序段,又存在不包括目标模态指令或绝对坐标的第二程序段时,第一程序段是离散的程序段,而逐行编译处理则是对第二程序段中第三程序段至第四程序段的连续程序段进行编译,因此,本实施例中逐行编译处理在实际应用中的描述此处不再赘述。It should be noted that the progressive compilation processing in this embodiment is consistent with the step operation performed by the fragment compilation processing, but the processed objects are inconsistent, and the fragment compilation processing is the first program segment that is likely to be discrete and the line number is discontinuous. Compile, for example, when there are both target modal commands or For the first block of coordinates, when there is a second block that does not include the target modal command or absolute coordinates, the first block is a discrete block, and the progressive compile process is the second block. The contiguous blocks of the third block to the fourth block are compiled. Therefore, the description of the line-by-line compiling process in the present embodiment in the actual application will not be repeated here.
可以理解是,本实施例仅以上述一个例子说明了编译器根据第三程序段的原行号对连续程序段进行逐行编译处理的具体方式,在实际应用中,编译器可以采用其它的逐行编译处理方式进行结合或单独使用,只要编译器可以根据第三程序段的原行号对连续程序段进行逐行编译处理即可,具体的处理方式此处不做限定。It can be understood that the embodiment only illustrates the specific manner in which the compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment. In practical applications, the compiler may adopt other The line compiling processing method is combined or used separately, as long as the compiler can perform the line-by-line compiling process on the continuous program segment according to the original line number of the third program segment, and the specific processing manner is not limited herein.
需要说明的是,本实施例中,若编译器判断第二程序段中不存在第三程序段至第四程序段的连续程序段,那么步骤211至步骤212可以不执行,编译器在对目标行号序列的对应程序段进行片段编译处理之后,获取对应程序的目标信息即可,具体此处不做限定。It should be noted that, in this embodiment, if the compiler determines that there is no continuous program segment of the third program segment to the fourth program segment in the second program segment, then steps 211 to 212 may not be performed, and the compiler is in the target. After the corresponding program segment of the line number sequence is subjected to the fragment compiling process, the target information of the corresponding program may be obtained, which is not limited herein.
本实施例中步骤213与上述实施例的步骤109相同,此处不再赘述。Step 213 in this embodiment is the same as step 109 in the above embodiment, and details are not described herein again.
本实施例在上述实施例的基础上,当编译器判断目标程序段中既存在包括目标模态指令或绝对坐标的第一程序段,又存在不包括目标模态指令或绝对坐标的第二程序段时,可以分别对第一程序段和第二程序段进行处理,若编译器判断在加工复位行之前第二程序段中存在第三程序段至第四程序段的连续程序段,则编译器可以在对目标行号序列的对应程序段进行片段编译处理之后,可以对连续程序段进行逐行编译处理,这样即使在诸如增量指令一类非目标模态指令的模态下,编译器在加工复位行之前也能得到总的增量值,从而编译器可以根据获得的目标信息恢复断点位置和TSM状态,进行剩余程序的正常编译,使得机床在加工复位行进行加工,由此实现了数控系统在任意加工程序段进行加工复位,而不会产生编译错误或位置错误等问题。In this embodiment, on the basis of the above embodiment, when the compiler determines that there is a first program segment including a target modal command or absolute coordinates in the target program segment, and a second program that does not include the target modal command or absolute coordinates. In the segment, the first block and the second block can be processed separately, and if the compiler determines that there is a continuous block of the third block to the fourth block in the second block before the machining reset line, the compiler After the segment compiling process is performed on the corresponding block of the target line number sequence, the continuous block can be compiled line by line, so that even in a mode such as a non-target modal command of the incremental instruction, the compiler is The total incremental value can also be obtained before the processing reset line, so that the compiler can restore the breakpoint position and the TSM state according to the obtained target information, and perform normal compilation of the remaining programs, so that the machine tool is processed in the processing reset line, thereby realizing The CNC system performs machining reset in any machining block without problems such as compile errors or position errors.
上面对本发明实施例中加工编译功能实现方法进行描述,下面对本发明实施例中编译器进行描述,请参阅图3,本发明实施例中编译器一个实施例包括:The method for implementing the processing and compiling function in the embodiment of the present invention is described above. The following describes the compiler in the embodiment of the present invention. Referring to FIG. 3, an embodiment of the compiler in the embodiment of the present invention includes:
读取模块301,用于按照目标顺序读取加工文本;a reading module 301, configured to read the processed text according to the target sequence;
第一判断模块302,用于判断加工文本是否存在加工复位标记;The first determining module 302 is configured to determine whether the processed text has a processing reset flag;
第一确定模块303,用于当加工文本中存在加工复位标记时,则确定目标文本,目标文本为加工文本中行号小于加工复位行的行号的文本,加工复位行 为加工复位标记所在的程序段;The first determining module 303 is configured to: when the machining reset mark exists in the processed text, determine the target text, where the target text is the text in the processed text whose line number is smaller than the line number of the processing reset line, and the processing reset line The block in which the processing reset flag is located;
快速预编译处理模块304,用于通过对第一确定模块确定的目标文本进行快速预编译处理得到具有模态指令的目标程序段;a fast pre-compilation processing module 304, configured to perform a fast pre-compilation process on the target text determined by the first determining module to obtain a target program segment having a modal command;
第二判断模块305,用于判断第二确定模块确定的目标程序段是否存在包括目标模态指令或绝对坐标的第一程序段;a second determining module 305, configured to determine whether the target program segment determined by the second determining module has a first program segment including a target modal command or absolute coordinates;
第一记录模块306,用于当目标程序段存在包括目标模态指令或绝对坐标的第一程序段时,记录第一程序段的第一行号;a first recording module 306, configured to record a first line number of the first program segment when the target program segment has a first program segment including a target modal command or absolute coordinates;
替代模块307,用于用第一行号替代结构体中对应第一成员变量的原行号,结构体为记录目标文本中各个程序段的原行号的成员变量,一种模态指令最后被指定时所处的程序段的行号,或一组绝对坐标最后被指定时所处的程序段的行号;The replacement module 307 is configured to replace the original line number corresponding to the first member variable in the structure with the first line number, and the structure body is a member variable for recording the original line number of each program segment in the target text, and a modal command is finally The line number of the block in which the designation is located, or the line number of the block in which a set of absolute coordinates was last specified;
处理模块308,用于对结构体中各成员变量的行号进行处理得到目标行号序列;The processing module 308 is configured to process a line number of each member variable in the structure to obtain a target line number sequence;
片段编译处理模块309,用于将目标行号序列的对应程序段进行片段编译处理;a fragment compilation processing module 309, configured to perform segment compilation processing on a corresponding program segment of the target line number sequence;
第一获取模块310,用于获取对应程序段的目标信息,以使得机床根据目标信息从加工复位行开始加工。The first obtaining module 310 is configured to acquire target information of the corresponding program segment, so that the machine tool starts processing from the processing reset line according to the target information.
本实施例中,片段编译处理模块309可以进一步包括:In this embodiment, the fragment compilation processing module 309 may further include:
第一确定单元3091,用于目标行号序列确定对应程序段;a first determining unit 3091, configured to determine a corresponding program segment by the target line number sequence;
第一读取单元3092,用于通过词法分析读取第一确定单元确定的对应程序段;a first reading unit 3092, configured to read, by using lexical analysis, a corresponding program segment determined by the first determining unit;
第一识别单元3093,用于识别第一读取单元读取的对应程序段中的各个字符;a first identifying unit 3093, configured to identify each character in a corresponding program segment read by the first reading unit;
第一转换单元3094,用于并将第一识别单元识别的对应程序段中的各个字符转换为第一目标数量的第一终结点;a first converting unit 3094, configured to convert each character in the corresponding program segment identified by the first identifying unit into a first target number of first endpoints;
第一存储单元3095,用于第一转换单元转换的第一终结点存储至缓冲区;The first storage unit 3095 is configured to store, by the first conversion unit, the first endpoint to the buffer;
第一获取单元3096,用于通过语法分析从缓冲区中按照目标顺序获取第一存储单元存储的第一终结点;The first obtaining unit 3096 is configured to obtain, by syntax analysis, the first endpoint stored by the first storage unit from the buffer according to the target sequence;
第一判断单元3097,用于判断第一终结点是否与目标语法规则匹配;The first determining unit 3097 is configured to determine whether the first endpoint matches the target grammar rule;
第一语义分析单元3098,用于当第一终结点与目标语法规则匹配时,则 将第一终结点进行语义分析。a first semantic analysis unit 3098, configured to: when the first endpoint matches the target grammar rule, Semantic analysis of the first endpoint.
本实施例中,在读取模块301按照目标顺序读取加工文本后,第一判断模块302可以判断加工文本是否存在加工复位标记,当加工文本中存在加工复位标记时,第一确定模块303可以确定目标文本,且快速预编译处理模块304可以目标文本进行快速预编译处理得到具有模态指令的目标程序段,一旦第二判断模块305判断第二确定模块确定的目标程序段存在包括目标模态指令或绝对坐标的第一程序段,第一记录模块306则可以记录第一程序段的第一行号,替代模块307可以用第一行号替代结构体中对应第一成员变量的原行号,在处理模块308对结构体中各成员变量的行号进行处理得到目标行号序列后,片段编译处理模块309可以将目标行号序列的对应程序段进行片段编译处理,且第一获取模块310可以获取对应程序段的目标信息,使得机床可以根据该目标信息中的模态信息和坐标信息在加工复位行进行加工,从而有效避免产生编译错误或位置错误等问题。同时,编译器只对目标程序段中的第一程序段进行处理,而非所有的目标程序段,可以节省加工复位所耗费的时间,进而提高了机床的加工效率。In this embodiment, after the reading module 301 reads the processing text according to the target order, the first determining module 302 can determine whether the processing text has a processing reset flag. When there is a processing reset flag in the processing text, the first determining module 303 can Determining the target text, and the fast pre-compilation processing module 304 may perform the fast pre-compilation process on the target text to obtain the target program segment having the modal command, and once the second determining module 305 determines that the target program segment determined by the second determining module includes the target modality For the first program segment of the instruction or absolute coordinates, the first recording module 306 may record the first line number of the first program segment, and the replacement module 307 may replace the original line number of the corresponding first member variable in the structure with the first line number. After the processing module 308 processes the line numbers of the member variables in the structure to obtain the target line number sequence, the fragment compilation processing module 309 can perform the fragment compilation processing on the corresponding program segments of the target line number sequence, and the first obtaining module 310 The target information of the corresponding program segment can be obtained, so that the machine tool can according to the modal letter in the target information And coordinate information processed in the processing reset row, so as to effectively avoid position errors compilation errors or problems. At the same time, the compiler only processes the first block in the target block, not all the target blocks, which saves the time required for the machining reset, thereby improving the machining efficiency of the machine.
请参阅图4,本发明实施例中编译器另一实施例包括:Referring to FIG. 4, another embodiment of the compiler in the embodiment of the present invention includes:
本实施例中的模块401与图3中的模块301相同,模块402与图3中的模块302相同,模块403与图3中的模块303相同,模块404与图3中的模块304相同,模块405与图3中的模块305相同,模块406与图3中的模块306相同,模块407与图3中的模块307相同,此处不再赘述。The module 401 in this embodiment is the same as the module 301 in FIG. 3, the module 402 is the same as the module 302 in FIG. 3, the module 403 is the same as the module 303 in FIG. 3, and the module 404 is the same as the module 304 in FIG. 405 is the same as module 305 in FIG. 3, module 406 is the same as module 306 in FIG. 3, and module 407 is the same as module 307 in FIG. 3, and details are not described herein again.
第三判断模块408,用于当编译器判断目标程序段存在不包括目标模态指令或绝对坐标的第二程序段时,则判断第二程序段中是否存在第三程序段至第四程序段的连续程序段,第四程序段与加工复位行对应的程序段相邻;The third determining module 408 is configured to: when the compiler determines that the target program segment has a second block that does not include the target modal command or the absolute coordinate, determine whether the third block to the fourth block exist in the second block a continuous block, the fourth block is adjacent to the block corresponding to the processing reset line;
第二记录模块409,用于当第二程序段中是否存在第三程序段至第四程序段的连续程序段时,则将结构体中对应第二成员变量记录第三程序段的原行号;The second recording module 409 is configured to: when the third block to the fourth block of the continuous block in the second block, record the original line number of the third block in the corresponding second member variable in the structure ;
本实施例中的模块410与图3中的模块308相同,模块411与图3中的模块309相同,此处不再赘述。The module 410 in this embodiment is the same as the module 308 in FIG. 3, and the module 411 is the same as the module 309 in FIG. 3, and details are not described herein again.
第二获取模块412,用于从结构体中获取第三程序段的原行号;a second obtaining module 412, configured to acquire a primary line number of the third program segment from the structure;
逐行编译处理模块413,用于根据第二获取模块获取的第三程序段的原行 号对连续程序段进行逐行编译处理;The progressive compilation processing module 413 is configured to perform, according to the original line of the third program segment acquired by the second obtaining module The number of consecutive blocks is compiled line by line;
本实施例中模块414与图4所示实施例中的模块310相同,此处不再赘述。The module 414 in this embodiment is the same as the module 310 in the embodiment shown in FIG. 4, and details are not described herein again.
本实施例中,逐行编译处理模块413可以进一步包括:In this embodiment, the progressive compilation processing module 413 may further include:
第二确定单元4131,用于第三程序段的原行号确定连续程序段;The second determining unit 4131 is configured to determine a continuous program segment for the original line number of the third program segment;
第二读取单元4132,用于通过词法分析读取第二确定单元确定的连续程序段;a second reading unit 4132, configured to read, by lexical analysis, a continuous program segment determined by the second determining unit;
第二识别单元4133,用于识别第二读取单元读取的连续程序段中的各个字符;a second identifying unit 4133, configured to identify each character in the continuous program segment read by the second reading unit;
第二转换单元4134,用于并将第二识别单元识别的连续程序段中的各个字符转换为第二目标数量的第二终结点;a second converting unit 4134, configured to convert each character in the continuous block identified by the second identifying unit into a second target number of the second ending point;
第二存储单元4135,用于第二转换单元转换的第二终结点存储至缓冲区;a second storage unit 4135, the second endpoint for the second conversion unit conversion is stored in the buffer;
第二获取单元4136,用于通过语法分析从缓冲区中按照目标顺序获取第二存储单元存储的第二终结点;a second obtaining unit 4136, configured to obtain, by syntax analysis, the second endpoint stored by the second storage unit from the buffer according to the target order;
第二判断单元4137,用于判断第二终结点是否与目标语法规则匹配;The second determining unit 4137 is configured to determine whether the second endpoint matches the target grammar rule;
第二语义分析单元4138,用于当第二终结点与目标语法规则匹配时,则将第二终结点进行语义分析。The second semantic analysis unit 4138 is configured to perform semantic analysis on the second endpoint when the second endpoint matches the target grammar rule.
本实施例中的模块414与图3中的模块310相同,此处不再赘述。The module 414 in this embodiment is the same as the module 310 in FIG. 3, and details are not described herein again.
本实施例中,由于第二判断模块405判断目标程序段中既存在包括目标模态指令或绝对坐标的第一程序段,又存在不包括包括目标模态指令或绝对坐标的第一程序段,从而当第三判断模块408可以判断第二程序段中存在第三程序段至第四程序段的连续程序段时,第二记录模块409可以将结构体中对应第二成员变量记录第三程序段的原行号,并在片段编译处理模块411执行片段编译处理功能之后,第二获取模块412可以从结构体中获取第三程序段的原行号,且逐行编译处理模块413可以根据第二获取模块获取的第三程序段的原行号对连续程序段进行逐行编译处理,这样即使在诸如增量指令一类非目标模态指令的模态下,编译器在加工复位行之前也能得到总的增量值,从而编译器可以根据获得的目标信息恢复断点位置和TSM状态,进行剩余程序的正常编译,使得机床在加工复位行进行加工,由此实现了数控系统在任意加工程序段进行加工复位,而不会产生编译错误或位置错误等问题。In this embodiment, since the second determining module 405 determines that the first program segment including the target modal command or the absolute coordinate exists in the target program segment, and the first program segment including the target modal command or the absolute coordinate is not included, Therefore, when the third determining module 408 can determine that there are consecutive blocks of the third block to the fourth block in the second block, the second recording module 409 can record the third block of the corresponding second member variable in the structure. The original line number, and after the fragment compilation processing module 411 performs the fragment compilation processing function, the second acquisition module 412 can obtain the original line number of the third program segment from the structure, and the line-by-line compilation processing module 413 can be based on the second Obtaining the original line number of the third program segment acquired by the module, and compiling the continuous program segment line by line, so that the compiler can perform the processing before the reset line even in the mode of the non-target modal command such as the incremental instruction The total increment value is obtained, so that the compiler can restore the breakpoint position and the TSM state according to the obtained target information, and perform normal compilation of the remaining programs, so that the machine tool Processing the reset row processing, thereby realizing a numerical control machining system reset any machining block, without a compilation error or position error problems.
本实施例提供的机器人,通过设置上述任一项实施例中的编译器,从而具 有编译器所具有的一切有益效果,在此不再赘述。The robot provided in this embodiment is provided with the compiler in any of the above embodiments. There are all the benefits of the compiler, so I won't go into details here.
本实施例提供的数控系统,通过设置上述任一项实施例中的编译器,从而具有编译器所具有的一切有益效果,在此不再赘述。The numerical control system provided in this embodiment has all the beneficial effects of the compiler by setting the compiler in any of the above embodiments, and details are not described herein again.
本实施例提供的数控机床,通过设置上述实施例中设有编译器的数控系统,从而具有上述任一项实施例中编译器所具有的一切有益效果,在此不再赘述。The numerical control machine tool provided in this embodiment has all the beneficial effects of the compiler in any of the above embodiments by setting the numerical control system provided with the compiler in the above embodiment, and details are not described herein again.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述 的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,RandomAccess Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. And the foregoing The storage medium includes: a U disk, a removable hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes.
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。 The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the embodiments are modified, or the equivalents of the technical features are replaced by the equivalents of the technical solutions of the embodiments of the present invention.

Claims (15)

  1. 一种加工复位实现方法,其特征在于,包括:A processing reset implementation method, comprising:
    编译器按照目标顺序读取加工文本;The compiler reads the processed text in the target order;
    所述编译器判断所述加工文本是否存在加工复位标记;The compiler determines whether the processed text has a processing reset flag;
    若是,则所述编译器确定目标文本,所述目标文本为所述加工文本中行号小于加工复位行的行号的文本,所述加工复位行为所述加工复位标记所在的程序段;If yes, the compiler determines the target text, the target text is the text in the processing text whose line number is smaller than the line number of the processing reset line, and the processing resets the program segment where the processing reset flag is located;
    所述编译器通过对所述目标文本进行快速预编译处理得到具有模态指令的目标程序段;The compiler obtains a target program segment having a modal instruction by performing fast pre-compilation processing on the target text;
    所述编译器判断所述目标程序段是否存在包括目标模态指令或绝对坐标的第一程序段;Determining, by the compiler, whether the target program segment has a first program segment including a target modal command or absolute coordinates;
    若存在,则所述编译器记录所述第一程序段的行号,并用所述第一程序段的行号替代结构体中对应第一成员变量的原行号,所述结构体为记录所述目标程序段中预设程序段的原行号的成员变量,所述预设程序段的原行号包括一种模态指令最后被指定时所处的程序段的行号,或一组绝对坐标最后被指定时所处的程序段的行号;If yes, the compiler records the line number of the first program segment, and replaces the original line number corresponding to the first member variable in the structure with the line number of the first program segment, where the structure is a record office a member variable of a preset line number of the preset program segment in the target program segment, where the original line number of the preset program segment includes a line number of a program segment in which a modal command is finally specified, or a set of absolute The line number of the block in which the coordinates were last specified;
    所述编译器对所述结构体中各成员变量的行号进行处理得到目标行号序列;The compiler processes the line number of each member variable in the structure to obtain a target line number sequence;
    所述编译器将所述目标行号序列的对应程序段进行片段编译处理,获取所述对应程序段的目标信息,以使得机床根据所述目标信息从所述加工复位行开始加工。The compiler performs segment compilation processing on the corresponding program segment of the target line number sequence, and acquires target information of the corresponding program segment, so that the machine tool starts processing from the machining reset line according to the target information.
  2. 根据权利要求1所述的加工复位实现方法,其特征在于,所述加工复位行包括圆弧插补行或固定循环行或宏程序行。The machining reset implementation method according to claim 1, wherein the machining reset line comprises a circular interpolation line or a fixed cycle line or a macro program line.
  3. 根据权利要求1所述的加工复位实现方法,其特征在于,所述目标信息包括模态信息和坐标信息。The processing reset implementation method according to claim 1, wherein the target information comprises modal information and coordinate information.
  4. 根据权利要求1至3中任一项所述的加工复位实现方法,其特征在于,在所述编译器对所述结构体中各成员变量的行号得到目标行号序列进行处理之前,所述方法还包括:The processing reset implementation method according to any one of claims 1 to 3, wherein before the compiler processes the line number of each member variable in the structure to obtain a target line number sequence, The method also includes:
    若所述编译器判断所述目标程序段存在不包括目标模态指令或绝对坐标 的第二程序段,则所述编译器判断所述第二程序段中是否存在第三程序段至第四程序段的连续程序段,所述第四程序段与所述加工复位行对应的程序段相邻;If the compiler determines that the target program segment does not include a target modal command or absolute coordinates The second program segment, the compiler determines whether there is a continuous program segment of the third program segment to the fourth program segment in the second program segment, and the program corresponding to the processing reset row in the fourth program segment Parallel adjacent;
    若存在,则所述编译器将所述结构体中对应第二成员变量记录所述第三程序段的原行号。If present, the compiler records the original line number of the third program segment corresponding to the second member variable in the structure.
  5. 根据权利要求4所述的加工复位实现方法,其特征在于,所述编译器将所述目标行号序列的对应程序段进行片段编译处理之后,在所述编译器获取所述对应程序段的目标信息之前,所述方法还包括:The processing reset implementation method according to claim 4, wherein after the compiler performs fragment compilation processing on the corresponding program segment of the target line number sequence, the compiler acquires the target of the corresponding program segment Before the information, the method further includes:
    所述编译器从所述结构体中获取所述第三程序段的原行号,并根据所述第三程序段的原行号对所述连续程序段进行逐行编译处理。The compiler obtains the original line number of the third program segment from the structure, and performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment.
  6. 根据权利要求1至3中任一项所述的加工复位实现方法,其特征在于,所述编译器将所述目标行号序列的对应程序段进行片段编译处理包括:The processing reset implementation method according to any one of claims 1 to 3, wherein the compiler performs fragment compilation processing on a corresponding program segment of the target line number sequence, including:
    所述编译器根据所述目标行号序列确定对应程序段;The compiler determines a corresponding program segment according to the target line number sequence;
    所述编译器通过词法分析读取所述对应程序段,识别所述对应程序段中的各个字符,并将所述对应程序段中的各个字符转换为第一目标数量的第一终结点;The compiler reads the corresponding program segment by lexical analysis, identifies each character in the corresponding program segment, and converts each character in the corresponding program segment into a first target number of first end points;
    所述编译器将所述第一终结点存储至缓冲区;The compiler stores the first endpoint to a buffer;
    所述编译器通过语法分析从所述缓冲区中按照目标顺序获取所述第一终结点;The compiler acquires the first endpoint from the buffer according to a target order by syntax analysis;
    所述编译器将所述第一终结点是否与目标语法规则匹配;The compiler matches the first endpoint with a target grammar rule;
    若是,则所述编译器将所述第一终结点进行语义分析。If so, the compiler performs semantic analysis on the first endpoint.
  7. 根据权利要求5所述的加工复位实现方法,其特征在于,所述编译器根据所述第三程序段的原行号对所述连续程序段进行逐行编译处理包括:The processing reset implementation method according to claim 5, wherein the compiler performs line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment, including:
    所述编译器根据所述第三程序段的原行号确定所述连续程序段;The compiler determines the continuous program segment according to the original line number of the third program segment;
    所述编译器通过词法分析读取所述连续程序段,识别所述连续程序段中的各个字符,并将所述连续程序段中的各个字符转换为第二目标数量的第二终结点;The compiler reads the continuous program segment by lexical analysis, identifies each character in the continuous program segment, and converts each character in the continuous program segment into a second target number of second target points;
    所述编译器将所述第二终结点存储至所述缓冲区;The compiler stores the second endpoint to the buffer;
    所述编译器通过语法分析从所述缓冲区中按照所述目标顺序获取所述第二终结点; The compiler acquires the second endpoint from the buffer according to the target order by syntax analysis;
    所述编译器将所述第二终结点是否与所述目标语法规则匹配;The compiler matching the second endpoint with the target grammar rule;
    若是,则所述编译器将所述第二终结点进行语义分析。If so, the compiler performs semantic analysis on the second endpoint.
  8. 一种编译器,其特征在于,包括:A compiler, comprising:
    读取模块,用于按照目标顺序读取加工文本;a reading module for reading processed text in a target order;
    第一判断模块,用于判断所述加工文本是否存在加工复位标记;a first determining module, configured to determine whether the processed text has a processing reset flag;
    第一确定模块,用于当所述加工文本中存在加工复位标记时,则确定目标文本,所述目标文本为所述加工文本中行号小于加工复位行的行号的文本,所述加工复位行为所述加工复位标记所在的程序段;a first determining module, configured to: when there is a processing reset mark in the processed text, determine target text, where the target text is text in the processed text whose line number is smaller than a line number of the processing reset line, the processing reset behavior a program segment in which the processing reset flag is located;
    快速预编译处理模块,用于通过对所述第一确定模块确定的所述目标文本进行快速预编译处理得到具有模态指令的目标程序段;a fast pre-compilation processing module, configured to obtain a target program segment having a modal instruction by performing a fast pre-compilation process on the target text determined by the first determining module;
    第二判断模块,用于判断所述第二确定模块确定的所述目标程序段是否存在包括目标模态指令或绝对坐标的第一程序段;a second determining module, configured to determine whether the target program segment determined by the second determining module has a first program segment including a target modal command or absolute coordinates;
    第一记录模块,用于当所述目标程序段存在包括目标模态指令或绝对坐标的第一程序段时,记录所述第一程序段的行号;a first recording module, configured to record a line number of the first program segment when the target program segment has a first program segment including a target modal command or absolute coordinates;
    替代模块,用于用所述第一程序段的行号替代结构体中对应第一成员变量的原行号,所述结构体为记录所述目标文本中各个程序段的原行号的成员变量,所述一种模态指令最后被指定时所处的程序段的行号,或一组绝对坐标最后被指定时所处的程序段的行号;a replacement module, configured to replace, by the line number of the first program segment, a original line number corresponding to the first member variable in the structure, where the structure body is a member variable that records the original line number of each program segment in the target text , the line number of the program segment in which the modal command is last specified, or the line number of the program segment in which a set of absolute coordinates is finally specified;
    处理模块,用于对所述结构体中各成员变量的行号进行处理,得到目标行号序列;a processing module, configured to process a line number of each member variable in the structure to obtain a target line number sequence;
    片段编译处理模块,用于将所述目标行号序列的对应程序段进行片段编译处理;a segment compilation processing module, configured to perform segment compilation processing on a corresponding program segment of the target line number sequence;
    第一获取模块,用于获取所述对应程序段的目标信息,以使得机床根据所述目标信息从所述加工复位行开始加工。And a first acquiring module, configured to acquire target information of the corresponding program segment, so that the machine tool starts processing from the processing reset line according to the target information.
  9. 根据权利要求8所述的编译器,其特征在于,所述编译器还包括:The compiler of claim 8 wherein said compiler further comprises:
    第三判断模块,用于当所述编译器判断所述目标程序段存在不包括目标模态指令或绝对坐标的第二程序段时,则判断所述第二程序段中是否存在第三程序段至第四程序段的连续程序段,所述第四程序段与所述加工复位行对应的程序段相邻;a third determining module, configured to: when the compiler determines that the target program segment has a second program segment that does not include a target modal command or absolute coordinates, determine whether the third program segment exists in the second program segment a continuous block of the fourth block, the fourth block being adjacent to the block corresponding to the machining reset line;
    第二记录模块,用于当所述第二程序段中是否存在第三程序段至第四程序 段的连续程序段时,则将所述结构体中对应第二成员变量记录所述第三程序段的原行号。a second recording module, configured to: when there is a third program to a fourth program in the second program segment When the continuous block of the segment is used, the corresponding second member variable in the structure records the original line number of the third block.
  10. 根据权利要求9所述的编译器,其特征在于,所述编译器还包括:The compiler of claim 9 wherein said compiler further comprises:
    第二获取模块,用于从所述结构体中获取所述第三程序段的原行号;a second acquiring module, configured to acquire, from the structure, an original line number of the third program segment;
    逐行编译处理模块,用于根据所述第二获取模块获取的所述第三程序段的原行号对所述连续程序段进行逐行编译处理。And the line-by-line compilation processing module is configured to perform line-by-line compilation processing on the continuous program segment according to the original line number of the third program segment acquired by the second acquisition module.
  11. 根据权利要求8所述的编译器,其特征在于,所述片段编译处理模块包括:The compiler according to claim 8, wherein the fragment compiling processing module comprises:
    第一确定单元,用于所述目标行号序列确定对应程序段;a first determining unit, configured to determine, according to the target line number sequence, a corresponding program segment;
    第一读取单元,用于通过词法分析读取所述第一确定单元确定的所述对应程序段;a first reading unit, configured to read, by lexical analysis, the corresponding program segment determined by the first determining unit;
    第一识别单元,用于识别所述第一读取单元读取的所述对应程序段中的各个字符;a first identifying unit, configured to identify each character in the corresponding program segment read by the first reading unit;
    第一转换单元,用于并将所述第一识别单元识别的所述对应程序段中的各个字符转换为第一目标数量的第一终结点;a first converting unit, configured to convert each character in the corresponding program segment identified by the first identifying unit into a first target number of first endpoints;
    第一存储单元,用于所述第一转换单元转换的所述第一终结点存储至缓冲区;a first storage unit, configured to store, by the first conversion unit, the first endpoint to a buffer;
    第一获取单元,用于通过语法分析从所述缓冲区中按照目标顺序获取所述第一存储单元存储的所述第一终结点;a first acquiring unit, configured to obtain, by syntax analysis, the first endpoint stored by the first storage unit from the buffer according to a target order;
    第一判断单元,用于判断所述第一终结点是否与目标语法规则匹配;a first determining unit, configured to determine whether the first endpoint matches a target grammar rule;
    第一语义分析单元,用于当所述第一终结点与目标语法规则匹配时,则将所述第一终结点进行语义分析。The first semantic analysis unit is configured to perform semantic analysis on the first endpoint when the first endpoint matches the target grammar rule.
  12. 根据权利要求10所述的逐行编译处理模块,其特征在于,所述逐行编译处理模块包括:The progressive compilation processing module according to claim 10, wherein the progressive compilation processing module comprises:
    第二确定单元,用于所述第三程序段的原行号确定连续程序段;a second determining unit, configured to determine a continuous program segment for the original line number of the third program segment;
    第二读取单元,用于通过词法分析读取所述第二确定单元确定的所述连续程序段;a second reading unit, configured to read, by lexical analysis, the continuous program segment determined by the second determining unit;
    第二识别单元,用于识别所述第二读取单元读取的所述连续程序段中的各个字符;a second identifying unit, configured to identify each character in the continuous program segment read by the second reading unit;
    第二转换单元,用于并将所述第二识别单元识别的所述连续程序段中的各 个字符转换为第二目标数量的第二终结点;a second conversion unit for each of the continuous blocks identified by the second identification unit Converting characters to a second endpoint of the second target number;
    第二存储单元,用于所述第二转换单元转换的所述第二终结点存储至所述缓冲区;a second storage unit, configured to store the second endpoint converted by the second conversion unit into the buffer;
    第二获取单元,用于通过语法分析从所述缓冲区中按照所述目标顺序获取所述第二存储单元存储的所述第二终结点;a second acquiring unit, configured to acquire, by syntax analysis, the second endpoint stored by the second storage unit from the buffer according to the target sequence;
    第二判断单元,用于判断所述第二终结点是否与所述目标语法规则匹配;a second determining unit, configured to determine whether the second endpoint matches the target grammar rule;
    第二语义分析单元,用于当所述第二终结点与所述目标语法规则匹配时,则将所述第二终结点进行语义分析。a second semantic analysis unit, configured to perform semantic analysis on the second endpoint when the second endpoint matches the target grammar rule.
  13. 一种机器人,其特征在于,包括如权利要求8至12中任一项所述的编译器。A robot characterized by comprising the compiler according to any one of claims 8 to 12.
  14. 一种数控系统,其特征在于,包括如权利要求8至12中任一项所述的编译器。A numerical control system comprising the compiler according to any one of claims 8 to 12.
  15. 一种数控机床,其特征在于,包括如权利要求14所述的数控系统。 A numerically controlled machine tool comprising the numerical control system of claim 14.
PCT/CN2016/072437 2016-01-28 2016-01-28 Method for machining reset, compiler, robot, numerical control system, and machine tool WO2017128160A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201680031510.2A CN108027606B (en) 2016-01-28 2016-01-28 Machining reset implementation method, compiler, robot, numerical control system and machine tool
PCT/CN2016/072437 WO2017128160A1 (en) 2016-01-28 2016-01-28 Method for machining reset, compiler, robot, numerical control system, and machine tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/072437 WO2017128160A1 (en) 2016-01-28 2016-01-28 Method for machining reset, compiler, robot, numerical control system, and machine tool

Publications (1)

Publication Number Publication Date
WO2017128160A1 true WO2017128160A1 (en) 2017-08-03

Family

ID=59396824

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/072437 WO2017128160A1 (en) 2016-01-28 2016-01-28 Method for machining reset, compiler, robot, numerical control system, and machine tool

Country Status (2)

Country Link
CN (1) CN108027606B (en)
WO (1) WO2017128160A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112034784A (en) * 2020-08-10 2020-12-04 珠海格力电器股份有限公司 Machining method, device, equipment and storage medium for machine tool
CN113110300A (en) * 2021-03-04 2021-07-13 新代科技(苏州)有限公司 Special tool-breaking point regression method for machining center

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111090260A (en) * 2018-10-23 2020-05-01 广州锐智恒软件有限公司 Method for realizing continuous machining of CNC equipment in case of power failure through NC code analysis
CN113885438B (en) * 2021-10-26 2023-10-27 中国航发沈阳黎明航空发动机有限责任公司 Method for automatically intercepting program in mixing milling process of blisk
CN113985811B (en) * 2021-11-01 2024-03-22 珠海格力电器股份有限公司 Anti-collision control method for numerical control machine tool and numerical control machine tool

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1425982A (en) * 2001-12-11 2003-06-25 松下电器产业株式会社 Program changing device, method and computer program for treating program changing
CN1435755A (en) * 2002-01-30 2003-08-13 松下电器产业株式会社 Command converting device and method
CN101799763A (en) * 2009-02-10 2010-08-11 华为技术有限公司 Method, device and system for patching kernel on line
CN102012843A (en) * 2010-11-19 2011-04-13 曙光信息产业(北京)有限公司 Task migration system
JP2013168031A (en) * 2012-02-15 2013-08-29 Fuji Electric Co Ltd Programmable controller system, support device thereof, and program

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011150459A (en) * 2010-01-20 2011-08-04 Nomura Research Institute Ltd Disaster recovery system and backup site construction method
CN102902231A (en) * 2011-07-29 2013-01-30 株式会社森精机制作所 Device for controlling restart of automatic operation of machine tools
CN103149875B (en) * 2013-01-17 2015-09-30 宁波恒大机械有限公司 Breaker point continuous transmission method during numerically-controlled machine DNC on-line machining
KR101560879B1 (en) * 2013-10-15 2015-10-15 주식회사 포스코 System for managing task and executing service of steel process middleware

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1425982A (en) * 2001-12-11 2003-06-25 松下电器产业株式会社 Program changing device, method and computer program for treating program changing
CN1435755A (en) * 2002-01-30 2003-08-13 松下电器产业株式会社 Command converting device and method
CN101799763A (en) * 2009-02-10 2010-08-11 华为技术有限公司 Method, device and system for patching kernel on line
CN102012843A (en) * 2010-11-19 2011-04-13 曙光信息产业(北京)有限公司 Task migration system
JP2013168031A (en) * 2012-02-15 2013-08-29 Fuji Electric Co Ltd Programmable controller system, support device thereof, and program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112034784A (en) * 2020-08-10 2020-12-04 珠海格力电器股份有限公司 Machining method, device, equipment and storage medium for machine tool
CN113110300A (en) * 2021-03-04 2021-07-13 新代科技(苏州)有限公司 Special tool-breaking point regression method for machining center
CN113110300B (en) * 2021-03-04 2022-04-19 新代科技(苏州)有限公司 Special tool-breaking point regression method for machining center

Also Published As

Publication number Publication date
CN108027606B (en) 2020-09-11
CN108027606A (en) 2018-05-11

Similar Documents

Publication Publication Date Title
WO2017128160A1 (en) Method for machining reset, compiler, robot, numerical control system, and machine tool
US10228675B2 (en) Controlling one or more devices upon detecting abnormal behavior
CN103077064B (en) A kind of parsing also executive language method and interpreting means
CN109807903B (en) Robot control method, device, equipment and medium
EP2515189B1 (en) Plc cpu unit, system program for plc, and storage medium having system program for plc stored therein
CN104281096B (en) The building method of NC code compiler
US20180299866A1 (en) Nc control method and a nc control apparatus
US20120239201A1 (en) Cpu unit of plc, system program for plc, and recording medium storing system program for plc
US9824229B2 (en) Controller with enhanced reliability
JP5800869B2 (en) Numerical control device with program restart function
US9581991B2 (en) DNC operation system
US11320800B2 (en) Optimization device
US10268184B2 (en) Apparatus and method for transforming NC programs
US11531551B2 (en) PLC device that transmits an instruction to a control device
JP2009053823A (en) Machining simulation device
JP6318214B2 (en) PLC debugging method using a general-purpose microprocessor
JP2018197989A (en) Numerical control apparatus
CN116237653B (en) Point selection processing method and device of laser cutting system
US20230305512A1 (en) Managing a postprocessor for machining with a machine tool method, computer system, and machine tool
CN114115763B (en) Configuration device and configuration method for printer platform product
Cheng et al. Design and implementation of G-code interpreter based on QT
CN115185536A (en) Program code compiling method and device, computer equipment and readable storage medium
Vlašiček et al. Program memory optimization for automatically generated tests for AUTOSAR RTE
JP2005267036A (en) Trace output control method and trace system
JP6898556B2 (en) Information processing equipment, compilation method and compilation program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16887047

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16887047

Country of ref document: EP

Kind code of ref document: A1

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载