1. Field of the Invention
The present invention relates to a numerical controller for controlling a machine tool. In particular, the invention relates to a numerical controller in which command blocks are read from a program in advance to generate executable data, the execution data are temporarily stored in a look-ahead buffer, and interpolation processing is performed based on the execution data, and more particularly, to a numerical controller capable of shortening the cycle time of look-ahead stop control.
2. Description of the Related Art
In performing look-ahead control in a numerical controller, a block for, for example, a system variable operation in a later stage of a sequence of a machining program is directly executed without being stored in a look-ahead buffer, so that it may possibly influence processing of execution data that are analyzed and temporarily stored in the look-ahead buffer. Look-ahead stop control is carried out in such a case.
In the conventional look-ahead stop control in the numerical controller, a command for the control is inserted as one block in a machining program, and look-ahead processing for the program is stopped by the inserted block (
There is a problem that if a look-ahead stop program is inserted for one block, a processing time for the block is inevitably added to the processing time of the machining program, so that the machining time is extended. Since the look-ahead stop code that can be issued together with the machining program is an auxiliary function, moreover, a signal operation for a programmable controller is required at the end of execution of the block. Thus, the execution is retarded, so that the machining time is further extended.
The present invention provides a numerical controller capable of performing look-ahead control by suspending analysis of a read block of a machining program and resuming the analysis of the read block at a suspended stage when execution of a block immediately preceding the read block is completed, to shorten the cycle time of the look-ahead control.
A numerical controller of the present invention carries out numerical control by performing look-ahead of successively reading and analyzing blocks of a machining program to obtain execution data and storing the execution data in a buffer in advance, and performing execution of the stored execution data. According to an aspect of the present invention, the numerical controller comprises: code determining means that determines whether or not a read block contains a suspend code to suspend analyzing of the read block so that the look-ahead is stopped; suspending means that suspends analyzing of the read block which is determined to contain the suspend code by the code determining means; execution completion determining means that determines whether or not execution of the stored execution data of a block immediately preceding the suspended block is completed; and resuming means that resumes the analyzing of the suspended block when the execution of the stored execution data of the immediately preceding block is determined to be completed by the execution completion determining means.
In this case, the numerical controller may further comprise means for registering the suspend code to stop the look-ahead using a parameter.
According to another aspect of the invention, the numerical controller comprises: code determining means that determines whether or not a read block contains a code of a macro variable operation for which analyzing of the read block is to be suspended so that the look-ahead is stopped; suspending means that suspends analyzing of the read block which is determined to contain the code of the macro variable operation for which the analyzing of the read block is to be suspended by the code determining means; execution completion determining means that determines whether or not execution of the stored execution data of a block immediately preceding the suspended block is completed; and resuming means that resumes the analyzing of the suspended block when the execution of the stored execution data of the immediately preceding block is determined to be completed by the execution completion determining means.
In this case, the numerical controller may further comprise means for designating a range of macro variables for determination of the code of the macro variable operation for which analyzing of the read block is to be suspended, using a parameter.
Further, the numerical controller may comprise means for designating a stage of the macro variable operation for which analyzing of the read block is to be suspended, using a parameter.
According to still another aspect of the invention, the numerical controller comprises: code determining means that determines whether or not a read block contains a look-ahead stop code to stop the look-ahead; code type determining means that determines whether or not the look-ahead stop code determined by the code determining means is a code to suspend analyzing of the read block; execution completion determining means that determines whether or not execution of the stored execution data of a block immediately preceding the suspended block is completed; and suspending/continuing means that suspends analyzing of the read block containing the code to suspend analyzing of the read block and resumes the analyzing of the suspended block to obtain the execution data, or alternatively continues the analyzing of the read block to obtain the execution data, in accordance with results of the determination by the code type discrimination means and the determination of the execution completion determining means.
In this case, the numerical controller may further comprise means for registering one or more look-ahead stop codes using one or more parameters.
By including the code to suspend analysis of a read block to stop the look-ahead in a machining program command, the cycle time for the machining program can be made shorter than in the case of a conventional method in which a block to stop the look-ahead is inserted. Moreover, there is a problem that the look-ahead is stopped after the processing of the block including the look-ahead code is completed, in the conventional look-ahead stop code inserted in the existing block in the machining program. However, this problem can be eliminated by the suspension of the machining program analysis. Since the analysis processing of the machining program is suspended and resumed from the suspended stage, moreover, it is less wasteful than in the conventional look-ahead control method, so that the cycle time can be further shortened.
a and 8b show program examples for the case where G900 is used as a code intended to stop look-ahead.
A numerical controller 8 according to an embodiment of the present invention shown in
The block analysis in the numerical controller 8 implies conversion of the blocks as source codes into object codes, that is, execution data that can be recognized by a computer. This conversion involves seven types of processes; lexical analysis (1), macro analysis (2), macro execution (3), syntactic analysis (4), semantic analysis (5), object code generation (6), and optimization (7). The lexical analysis (1) is a process for dividing alphabetic symbols from numeric symbols. The macro analysis (2) indicates that a macro analysis is performed when the result of the lexical analysis involves special symbols of macro variables. Variable numbers and macro syntaxes are analyzed, and the analysis is stopped if any variable operation registered in the look-ahead stop code table 4 is performed. The macro execution is execution of analyzed macros. Depending on the macro program, macro regions are rewritten according to the result of the lexical analysis. For example, G00X#100; is information to the effect that 350.0 is input to the X-address of result data of the lexical analysis if the value of #100 is 350.0 when this command is executed. The syntactic analysis (4) serves only to determine the numerical value of the G-command. The semantic analysis (5) can specify the function by the numerical value of the G-command so that processing can be executed for each function. The object code generation (6) implies object-coding of the result of the semantic analysis. In the present embodiment of the invention, execution data are generated by the aforesaid processes for the blocks that are looked ahead in succession. If no look-ahead processing is performed based on macro variable operation, the conversion processes for the macro analysis (2) and the macro execution (3) are not performed.
If any code of the type that suspends block analysis is present in the block, the numerical controller 8 performs processing for suspending the block analysis in a predetermined one of the aforesaid processes. The numerical controller 8 is provided with look-ahead stop code register means 5 and macro variable range designation means 6. One or more look-ahead stop codes can be registered in the look-ahead stop code register means 5 by parameters. The macro variable range designation means 6 can designate by parameters the range of macro variables that are used to determine the suspension of the block analysis so that the block analysis can be suspended to stop the look-ahead processing when a variable within the range of #10000 to #11000 is operated. As examples of variable operations, moreover, operations for (1) reading the value of the variable, (2) changing the content of the variable, etc. can also be designated by parameters. For these designations, the numerical controller 8 may be provided with macro variable operation stage designation means 7 which can specify that the look-ahead of only the operation (2) be stopped without allowing the look-ahead of the operation (1) to be stopped. It is necessary only that the numerical controller 8 be provided with only one of these means 5, 6 and 7.
There is a method for further designating the operating method by designating, for example, the range of variable numbers as specific examples of parameters, which include, for example:
Designation methods based on functions include, for example:
Thus, the parameters are set with significance, and some sets of these parameters are registered.
In Step A3, it is determined whether or not the look-ahead buffer that is provided for the numerical controller is full. If the look-ahead buffer is full, it is waited until the buffer ceases to be full (Step A3). Whether or not the look-ahead buffer is full can be determined by, for example, recognizing a pointer that is indicative of a position where the look-ahead buffer is stored with the block execution data. If it is concluded that the look-ahead buffer is not full, it is determined whether or not a flag F indicative of look-ahead stop is set to 1 (Step A4). If the flag is not 1 (that is, if the look-ahead is not stopped), the read block is analyzed (Step A5). The analysis in Step A5 includes the lexical analysis and the syntactic analysis. It is determined whether or not any look-ahead stop code of the type that suspends the block analysis is present in the block information that is analyzed in Step A5 (Step A6). If it is concluded in Step A6 that there is no look-ahead stop code of the type that suspends the block analysis, the analysis of the read block is continued to generate execution data (Step A7). The analysis in Step A7 is continued starting with the semantic analysis. The generated execution data is saved in the look-ahead buffer (Step A8). Then, the procedure returns to the beginning to read the next block.
If it is concluded in Step A6 that there is a look-ahead stop code of the type that suspends the block analysis, the analysis of the block that contains this code is suspended (Step A9). Then, the flag is set to 1 for look-ahead stop (Step A10). Since the block analysis is suspended, the procedure returns to a stage between Step A2 in which the program end is identified and Step A3 in which whether or not the look-ahead buffer is full is determined, lest the next block be read.
If it is concluded in Step A4 that the flag is 1, that is, the look-ahead is stopped, it is then determined whether or not the look-ahead buffer is empty, i.e. the execution of the execution data of a block immediately preceding the suspended block which has been stored in the look-ahead buffer is completed or not (Step A11). If it is determined in Step A11 that the look-ahead buffer is not empty, it is waited until the buffer is emptied. If it is concluded that the look-ahead buffer is empty, the analysis processing for the block of which the analysis is suspended in Step A9 is resumed and continued to generate execution data (Step A12). The analysis in Step A12 is continued starting with the semantic analysis. The generated execution data is saved in the look-ahead buffer (Step A13). Since the suspended block analysis processing is resumed and continued, the flag F is reset to 0 to cancel the look-ahead stop state, in order to enable the analysis of the next block (Step A14). Then, the procedure returns to the beginning to read the next block.
In Step B3, it is determined whether or not the look-ahead buffer that is provided for the numerical controller is full. If the look-ahead buffer is full, it is waited until the buffer ceases to be full (Step B3). Whether or not the look-ahead buffer is full can be determined by, for example, recognizing the pointer that is indicative of the position where the look-ahead buffer is stored with the block execution data. If it is concluded that the look-ahead buffer is not full, it is determined whether or not the flag F indicative of look-ahead stop is set to 1 (Step B4). If the flag is not 1 (that is, if the look-ahead is not stopped), the read block is analyzed (Step B5). The block analysis in Step B5 includes the lexical analysis and the macro analysis. It is determined whether or not any macro variable operation of the type for which the block analysis is to be suspended is present in the block information analyzed in Step B5 (Step B6). If it is concluded in Step B6 that there is no macro variable operation of the aforesaid type, the analysis of the read block is continued to generate execution data (Step B7). The analysis in Step B7 is continued starting with the macro execution. The generated execution data is saved in the look-ahead buffer (Step B8). Then, the procedure returns to the beginning to read the next block.
If it is concluded in Step A6 that there is a macro variable operation of the type to suspend the block analysis, the analysis of the block that contains the macro variable operation is suspended (Step B9). Then, the flag is set to 1 for look-ahead stop (Step B10). Since the block analysis is suspended, the procedure returns to a stage between Step B2 in which the program end is identified and Step B3 in which whether or not the look-ahead buffer is full is determined, lest the next block be read.
If it is concluded in Step B4 that the flag is 1, that is, the look-ahead is stopped, it is then determined whether or not the look-ahead buffer is empty (Step B11). If it is concluded in Step B11 that the look-ahead buffer is not empty, it is waited until the buffer is emptied. If it is concluded that the look-ahead buffer is empty, the analysis processing for the block of which the analysis is suspended in Step B9 is resumed and continued to generate execution data (Step B12). The analysis in Step B12 is continued starting with the macro execution, and execution processing is performed (Step B13). Since the suspended block analysis processing is resumed and continued, the flag F is reset to 0 to cancel the look-ahead stop state, thereby permitting look-ahead, in order to enable the analysis of the next block (Step B14). Then, the procedure returns to the beginning to read the next block.
The flowcharts of
In Step C3, it is determined whether or not the look-ahead buffer that is provided for the numerical controller is full. If the look-ahead buffer is full, it is waited until the buffer ceases to be full (Step C3). Whether or not the look-ahead buffer is full can be determined by, for example, recognizing a pointer that is indicative of a position where the look-ahead buffer is stored with the block execution data. If it is concluded that the look-ahead buffer is not full, it is determined whether or not a flag F indicative of look-ahead stop is set to 1 (Step C4). If the flag is not 1 (that is, if the look-ahead is not stopped), the read block is analyzed (Step C5). The analysis in Step C5 includes the lexical analysis and the syntactic analysis. It is determined whether or not any look-ahead stop code of the type that suspends the block analysis is present in the block information analyzed in Step C5 (Step C6). If it is concluded in Step C6 that there is no look-ahead stop code, the analysis of the read block is continued to generate execution data (Step C7). The generated execution data is saved in the look-ahead buffer (Step C8). Then, the procedure returns to the beginning to read the next block.
If it is concluded in Step C6 that there is a look-ahead stop code, it is determined whether or not the look-ahead stop code is of the type to suspend the block analysis (Step C9). The look-ahead code G900 is shown as being of the type that suspends the block analysis in the machining program example of
If it is concluded in Step C9 that the look-ahead suspension code, like M900, is not of the type that suspends the block analysis, the analysis of the block that contains the look-ahead stop code of this type is continued to generate execution data (Step C12). The obtained execution data is saved in the look-ahead buffer (Step C13). Then, it is waited until the buffer is emptied (Step C14), and the procedure returns to the beginning.
If it is concluded in Step C4 that the flag is 1, that is, the look-ahead is stopped, it is then determined whether or not the look-ahead buffer is empty (Step C15). If it is concluded in Step C15 that the look-ahead buffer is not empty, it is waited until the buffer is emptied. If it is concluded that the look-ahead buffer is empty, the analysis processing for the block of which the analysis is suspended in Step C10 is resumed and continued to generate execution data (Step C16). The generated execution data is saved in the look-ahead buffer (Step C17). Since the suspended block analysis processing is resumed and continued, the flag F is reset to 0 to cancel the look-ahead stop state, in order to enable the analysis of the next block (Step C18). Then, the procedure returns to the beginning to read the next block.
Number | Date | Country | Kind |
---|---|---|---|
2007-137888 | May 2007 | JP | national |