Numerical control method and apparatus
BACKGROUND OF THE INVENTION 
     This invention relates to a numerical control method and apparatus and, more particularly, to a numerical control method and apparatus in which flawing and attendant loss of a workpiece can be prevented by establishing and then prestoring in memory the areas which a movable member is forbidden to enter, and by adopting an arrangement wherein movement of the movable member is halted instantaneously as soon as the movable member enters the forbidden area during a machining operation. 
     Numerically controlled machine tools possess a movable member such as a tool or a table which is transported by means of a ball screw, and such factors as the length of the ball screw determine the maximum area over which the movable member can be transported. Since the movable member may inadvertently be caused to exceed the boundary of said area (a phenomenon referred to as &#34;over-travel&#34;) by a programming error or malfunction, it is conventional practice to detect the overtravel as soon as it occurs and then bring the movable member to an emergency stop. To achieve such overtravel detection, it is customary to provide limit switches at the points of maximum stroke on the +X, -X and +Z, -Z sides of the area of allowable movement, and to provide a dog on the movable member, the arrangement being such that the dog presses against a limit switch when the movable member overtravels. The actuated limit switch produces a signal indicative of the overtravel event. 
     It is quite common in systems of the type described above to have a smaller area, within the area of allowable movement mentioned above, which the movable member is forbidden to enter. One example of such is the area defined within the final shape of the workpiece, that is, the final shape into which the workpiece is to be machined, referred to as the &#34;commanded shape&#34;. For a tool to penetrate this area to a very small degree would cause only a negligibly small drop off in cutting precision, but penetration beyond a predetermined amount would cause the tool to cut too deeply into the workpiece and render it useless as a final product. Wasting workpieces in this manner obviously represents poor economy since the materials are costly. 
     Another example of a forbidden area is that occupied by the chuck provided on a lathe. A tool caused to penetrate this area would strike the chuck and result in damage or breakage of both the tool and chuck. 
     Such inadvertent movement of a movable member as described above can be caused by a malfunction in the arithmetic unit of a numerical control device, by an error in an NC tape read operation, by operator error, or by failure in a servo system. The prior art has been conspicuously devoid of truly satisfactory means for detecting penetration of a tool into a forbidden area. For example, one expedient has been to attach a sensor or limit switch to the chuck in order to detect contact between it and the tool. However, attaching the sensor or limit switch to the chuck is a difficult operation, the chuck takes on a more complicated structure, and costs are raised. Still other defects encountered with this expedient are that it is difficult to change or redefine the forbidden areas, and that it is not possible to detect tool penetration of the area defined by the commanded shape, even if the sensors or the like are mounted on the chuck. 
     SUMMARY OF THE INVENTION 
     Accordingly, it is an object of the present invention to provide a numerical control method and apparatus for preventing damage to an expensive tool or workpiece caused by a malfunction in the arithmetic unit of a numerical control device, by an error in an NC tape read operation, by operator error, or by a failure in a servo system. 
     Another object of the present invention is to provide a numerical control method and apparatus for detecting, in a reliable and simple manner, the penetration of a movable member such as a tool into a forbidden area. 
     A further object of the present invention is to provide a numerical control method and apparatus which enable a forbidden area to be redefined with facility even when there is a modification in the final shape of a workpiece. 
     These and other objects and features of the present invention will be apparent from the following description taken in conjunction with the accompanying drawings, in which like reference characters designate the same or similar parts throughout the figures thereof. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is an illustrative view useful in describing the relationship between forbidden areas and the maximum area of allowable movement; 
     FIG. 2 is a block diagram for practicing the numerical control method of the present invention; 
     FIG. 3 is a block diagram of a simulator; 
     FIG. 4 is a block diagram of a current position checking circuit; 
     FIG. 5 is a block diagram of a discrimination circuit; 
     FIG. 6 is an illustrative view useful in describing how an area of allowable movement is divided into smaller sub-areas in accordance with the shape of forbidden areas; and 
     FIG. 7 is an illustrative view useful in describing a case where entry forbidden information is written into a memory in accordance with each of the small sub-areas shown in FIG. 6. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     Referring first to FIG. 1, OTA represents an overtravel area within which is defined an area of allowable movement MA. Within the area MA there are defined areas EPA 1 , EPA 2 , EPA 3  into which entry of a tool is forbidden. These three areas therefore are referred to as entry forbidden areas. The entry forbidden areas EPA 1 , EPA 2  define a shape approximating that of a chuck provided on a lathe. A tool, if it were to enter the areas EPA 1 , EPA 2 , would strike the chuck and inflict damage upon both itself and chuck. The entry forbidden area EPA 3  is decided by the commanded or final shape of the workpiece, that is, by the shape that would result by cutting the starting stock down to the allowable depth. If this area were penetrated by the tool, the workpiece would not be cut to the desired tolerance and would have to be rejected. 
     FIG. 2 is a block diagram of an apparatus for practicing the present invention. In the discussion that follows, movement will be described solely along the X-axis for the sake of simplicity. Therefore, the arrangement of FIG. 2 pertains to the X-axis only. A similar arrangement would be provided for each of the other controlled axes. 
     In FIG. 2, numeral 11 denotes a numerical control device containing a so-called pulse distributor for executing a pulse distribution operation on the basis of a move command in order to generate distributed pulses CP. A wellknown servo circuit 12, which receives the distributed pulses CP, includes an error register 12a for computing the difference between the distributed pulses CP and feedback pulses XFP (which will be described later), a DA converter 12b for producing an analog voltage corresponding to the difference computed by the error register 12a, and an amplifier 12c for amplifying the analog voltage. The amplified analog voltage from servo circuit 12 is applied to a DC motor 13, the motor being driven thereby so as to make the computed difference approach a value of zero. A ball screw 14 is driven by the DC motor 13 to transport a movable member, which is a table 15 in the present embodiment. A position sensor 16 such as a pulse coder is adapted to generate a single pulse for each prescribed increment of movement of the table 15. Each pulse serves as a feedback pulse XFP, which is applied to the input side of the error register 12a in the servo circuit 12. The distributed pulses from the numerical control device are applied also to a simulator 17. Ordinarily, the DC motor 13 exhibits a primary delay characteristic. In other words, rather than rotating immediately in response to each pulse CP produced by the numerical control device 11, the DC motor 13 rotates and &#34;follows up&#34; pulses CP after a predetermined delay. The simulator 17, which is adapted to simulate the servo system characteristics, generates simulation pulses SP, which appear at time intervals approximately the same as those of the feedback pulses XFB. The construction of the simulator 17 is shown in FIG. 3. 
     In FIG. 3, the simulator 17 is shown to include a reversible counter 17a which is adapted to count up the distributed pulses CP and to count down the simulation pulses SP, an accumulator 17b whose output is the simulation pulse train, an oscillator 17c for generating pulses P s  of a constant frequency, and an adding circuit 17d which adds the value of the count held in reversible counter 17a to the accumulated value in accumulator 17b each time the oscillator 17c generates a pulse. If we assume that accumulator 17b can hold n-number of bits, then an overflow pulse will be obtained from the accumulator when the accumulated value exceeds 2 n . The overflow pulses provided by the accumulator are the simulation pulses SP. Now, let the content of reversible counter 17a be e, let the pulse rate of the pulse generated by oscillator 17c be f o , and let the pulse rate of the distributed pulses CP and of the simulation pulses SP be F i  and F o , respectively. The relationships among these values may be expressed by the following equations: 
     
         de/dt=F.sub.1 -F.sub.o                                     (1) 
    
     
         F.sub.o =f.sub.o /2.sup.n ·e=k·e         (2) 
    
     From Eqs. (1) and (2), e and F o  may be written: 
     
         e=F.sub.i /k[1-exp (-kt)]                                  (3) 
    
     
         F.sub.o =F.sub.i [1-exp (-kt)]                             (4) 
    
     Thus, the simulator 17 is capable of simulating the primary delay characteristic of the servo system. 
     Returning to FIG. 2, the simulation pulses SP from the simulator 17 are applied to a current position checking circuit 18 whose other input is the train of feedback pulses XFP. The circuit 18 checks whether the table 15 has entered a forbidden area, or whether the difference between the simulation pulses SP and the feedback pulses XFP has exceeded a predetermined value ME. If the table has entered the forbidden area, or if said difference has exceeded the predetermined value ME, the current position checking circuit 18 issues an alarm signal ALM. Reference will now be had to FIG. 4 to describe the construction and operation of this circuit. 
     As illustrated in FIG. 4, the current position checking circuit 18 includes a reversible counter 18a for counting up the feedback pulses XFP and for counting down the simulation pulses SP, a comparator 18b for comparing the predetermined value ME and the content of reversible counter 18a, namely the difference ER between the feedback pulses XFB and the simulation pulses SP, and for producing a &#34;1&#34; logic level when ER is greater than ME (ER&gt;ME), a current position register 18c for storing the current position X p  of the table on the X-axis by having its content incremented or decremented by the feedback pulses XFB in accordance with the direction of table movement, a discrimination circuit 18d for determining, based on the current position (X p , Z p  of the table and on entry forbidden information, whether the current position of the table is within an entry forbidden area, and for producing a &#34;1&#34; logic level when such is indeed the case, and an OR gate 18e for delivering the alarm signal ALM, the inputs to the OR gate being the signals provided by the comparator 18b and by the discimination circuit 18d. In the foregoing, X p  is the current position of the table when projected on the X-axis, and Z p  the current position when projected on the Z-axis. 
     FIG. 5 is a block diagram showing the construction of the discrimination circuit 18d. Numeral 101 denotes a parameter storage device, in the form of a random access memory (RAM), for storing such parameters as rapid traverse speed, acceleration/deceleration constants, entry forbidden areas, etc. These parameters can be entered in a manual data input mode MDI, or directly from an NC tape TP. The parameters are written also into a non-volatile memory 102 such as a magnetic bubble memory; when the numerical control device is turned on, the parameter data from the non-volatile memory 102 is read into the parameter storage device and is applied to a processing unit 103. To understand the operation of this unit, reference should also be had to FIG. 6, which shows how an area of allowable movement is divided into smaller areas in accordance with the shape of entry forbidden areas. The inputs to the processing unit 103 from the parameter storage device are coordinate values P 1  (X, Z), P 2  (I, K), P 3  (X 1 , Z 1 ), P 4  (X 2 , Z 2 ) which specify the boundaries of entry forbidden areas. On the basis of these coordinate values, the processing unit 103 divides the total maximum area of allowable movement MA into 56 sub-areas 00, 01, . . . , 0F,. . . , 37 by making eight partitions along the Z-axis and seven partitions along the X-axis, and creates entry forbidden information for each of these sub-areas 00, 01, . . . , 0F, 11, 12, . . . , 37. The hatched portions of FIG. 6 indicate the entry forbidden areas. OTA represents an overtravel area, defined by the maximum stroke, and EPA 1 , EPA 2  represent first and second entry forbidden areas, respectively. 
     The entry forbidden information from the processing unit 103 is delivered to a write control circuit 104 which writes the information into a memory 105, each single bit of which corresponds to one of the sub-areas mentioned above. This can be understood with reference to FIG. 7 which shows how units of entry forbidden information are written into the memory locations corresponding to respective ones of the sub-areas. It will be appreciated that each bit of memory 104 is assigned to each one of the sub-areas, with a &#34;1&#34; being written into each bit constituting an entry forbidden area, and a &#34;0&#34; being written into each of the bits forming the sub-areas that lie outside the entry forbidden areas. Furthermore, 00, 01, . . . , 37 are hexadecimal numbers, and the hexadecimal numbers in FIG. 6 correspond to those in FIG. 7. The processing unit 103 performs an operation to determine which bit of memory 105 is being referred to on the basis of the current position of the table, this information being provided by X-axis and Z-axis current position counters 108, 109 that will be described in more detail below. A read control circuit 106 receives the output of memory 105. An address register 107 designates the storage locations of memory 105 into which the entry forbidden information is to be written, or from which this information is to be read. The current position counters 108, 109 mentioned above indicate the current position of the table along the X and Z axes by counting up or counting down, in accordance with the travelling direction of the movable member, feedback pulses XFP, ZFP, each of which is generated by a pulse coder or the like (not shown) for each prescribed increment of movement of the movable member. Instead of these feedback pulses XFP, ZFP, however, pulses distributed along the X and Z axes by a pulse distributor (not shown) can be applied to the current position counters 108, 109 to be counted up or counted down in a similar manner. The information read out of the memory 105 by the read control circuit 106 is applied to a checking circuit 110, which determines on the basis of this information as to whether the movable member (the table or a tool) has entered a forbidden area. 
     The arrangement of FIG. 5 operates as follows. First, assume that the movable member, such as a tool, is located at point AP (sub-area 11) in FIG. 6. When the tool is moving in the +X direction, the processing unit 103 compares the boundary value X 02  (which is equal to X 1 ) with the current tool position X p  and, when the tool is moving in the -X direction, the processing unit 103 compares the boundary value X 01  (which is equal to X) with the current position X p . Similarly, the processing unit 103 compares the boundary value Z 01  (=K) with the current tool position Z p , and the boundary value Z 00  with the current position Z p , for movement in the +Z and -Z directions, respectively. When a boundary value is exceeded in the X direction, the processing circuit 103, according to whether such movement is in the + or - direction, adds eight to or subtracts eight from the content (=11) of the address register 107 for specifying the current addresses of memory 105. Similarly, when a boundary value is exceeded in the Z direction, the processing circuit 103, according to whether such movement is in the + or - direction, adds one to, or substracts one from, the content of the address register 107. The result of the addition or substraction operation is set in the address register. For instance, if the tool exceeds the boundary value X 02  while travelling in the +X direction, the value &#34;19&#34; (namely 11+8 in hexadecimal notation) is set in address register 107, and if it exceeds the boundary value X 01  while travelling in the -X direction, the value &#34;09&#34; (namely 11-8 in hexadecimal notation) is set in address register 107. Similarly, the value &#34;12&#34; (11+ 1 in hexadecimal notation) is set in the address register when boundary value Z 01  is exceeded in the +Z direction. Thus the current address corresponding to the sub-area currently occupied by the tool is set in the address register 107. At the same time that the above operation is taking place, the processing unit 103 continues comparing the X- and Z-direction boundary values with X p  and Z p  in accordance with the direction of tool movement, thereby updating the content of the address register 107 whenever a boundary is exceeded. 
     Accordingly, when the tool is moved in the +Z direction and crosses the boundary Z 01 , &#34;12&#34; is set in the address register 107, so that the read control circuit 106 reads the &#34;1&#34; logic from the addressed location (shown by the hatched portion of FIG. 7) of memory 105. This &#34;1&#34; logic is applied to the checking circuit 110 which issues an alarm signal by recognizing, on the basis of the &#34;1&#34; logic, that the tool has entered the forbidden area EPA 2 . The arrangement is such that the alarm signal activates a lamp (not shown) on the numerical control device. When the tool is moved in the +X direction and crosses the boundary X 02 , &#34;19&#34; is set in the address register 107, so that a &#34;0&#34; is read out of the addressed location of memory 105. As stated previously, the processing unit 103 in this embodiment produces the entry forbidden information by using the coordinate values P 1  (X, Z), P 2  (I, K), P 3  (X 1 , Z 1 ), P 4  (X 2 , Z 2 ) which specify the boundaries of the entry forbidden areas, this information being stored in memory 105. It should be noted, however, that an arrangement can be adopted in which the boundaries are expressed by mathematical equations. Furthermore, the table 15 can be transported along a boundary in a dry-run mode instructed by the NC tape or by a manual data input (MDI), or by a jog feed operation, the table path traversed at such time serving as the boundary information input. 
     When defining a boundary for the final shape of the workpiece, the boundary should be so specified as to fall within said final shape by a prescribed tolerance. 
     The operation of the present invention will now be described with reference to FIG. 2. When a distributed pulse CP is generated by the pulse distributor in the numerical control device 11, the pulse is accumulated by the error register 12a in the servo circuit 12 and is also applied to the simulator 17. The content of error register 12a converted into an analog voltage by the DA converter 12b, is amplified by amplifier 12c and is then applied to the DC motor 13, which responds by rotating the ball screw 14 to transport the table 15 in the commanded direction. The position sensor 16 produces a single feedback pulse XFP for each prescribed increment of movement of the table 15, the feedback pulse entering the error register 12a to decrement its content by one step. The foregoing circuit elements construct a servo loop SL which keeps repeating the described operation, establishing a steady state in which the table 15 is transported at the commanded speed with a constant deviation value being maintained in error register 12a. As this operation proceeds, the series of distributed pulsed CP which have entered the simulator 17 are imparted with a primary delay characteristic by the simulator, the pulses emerging as the simulation pulses SP. As a result, the simulation pulses SP enter the reversible counter 18a in the current position checking circuit 18 of FIG. 4 with a characteristic which is identical with that of the feedback pulses FP, the content of the counter being downcounted by each pulse. On the other hand, the feedback pulses XFP enter the reversible counter 18a at its upcount input terminal, so that the counter is up-counted each time a feedback pulse XFP is generated. These feedback pulses XFP are applied also to the current position register 18c, whose content is updated stepwise in accordance with the direction of movement. The current position X p  of the table along the X-axis thus is stored in register 18c. 
     When the servo system is operating normally, the feedback pulses XFP and simulation pulses SP are generated at approximately the same time intervals, so the content ER (the difference between XFP and SP) of reversible counter 18a does not exceed the predetermined value ME. If an abnormality should develop in the servo system, however, the content ER of reversible counter 18a will increase excessively and surpass the value ME (i.e., ER&gt;ME). When the inequality ER&gt;ME is established, the comparator 18b produces a &#34;1&#34; logic level, causing the OR gate 18e to deliver the alarm signal ALM which halts the machine instantly. In other words, in accordance with the present invention, the table 15 is not permitted to move as commanded on the input side of the numerical control device 11 when a situation develops in which the content ER of reversible counter 18a exceeds the predetermined value ME, the alarm signal ALM being issued just as if the tool had entered a forbidden area. 
     In concurrence with the foregoing checking operation, the discrimination circuit 18d uses the entry forbidden information stored in memory 105 (FIG. 5) to determine whether the current position AP resides in an entry forbidden area. If the table 15 should happen to be moved erroneously by a malfunction in the arithmetic circuitry, by an error in the NC tape read operation, or by an error committed by the operator, and if this should cause penetration of a forbidden area, the discrimination circuit 18d immediately detects the event in the manner described, issuing the alarm signal ALM through the OR gate 18e, thereby to bring the machine to an emergency stop. 
     Thus, in accordance with the present invention as described above, the simulator is provided to enable detection of a servo system error, and entry forbidden areas are defined in accordance with the commanded shape of a workpiece. Such an arrangement permits machine tool operation to be halted before the workpiece can be damaged by extraordinary movement of a tool relative to the workpiece, as may be caused by a malfunction in an arithmetic or servo system, by operator error, or by an error in reading an NC tape. Preventing such damage results in fewer wasted workpieces. 
     Another advantage of the present invention is that forbidden areas can be simply established, and penetration of such areas by a movable member such as a tool is reliably detected, without the use of limit switches or sensors. Furthermore, according to the present invention, whether a forbidden area has been penetrated or not is discriminated by dividing an area of allowable movement into a multiplicity of smaller sub-areas, computing entry forbidden information for each sub-area, storing the results of the computations in a memory beforehand, and reading the information out of the memory in accordance with the current position of the movable member. By virtue of such a method it is unnecessary to execute, on a one-by-one basis, operations to determine whether a forbidden area has been penetrated by the movable member. This permits the discrimination operation to be conducted at a high speed without subjecting the processing circuitry to a heavy load. It is also very simple with the present invention to change and to set the forbidden areas. 
     The present invention has been described and illustrated above in connection with controlling the movement of a tool or table employed in a numerically controlled machine tool. It is obvious that the invention is not limited to such an arrangement, but that it can be applied to control the movement of a robot arm as well. Moreover, though the forbidden areas are rectangularly shaped in the described embodiment, it goes without saying that they can have a triangular or circular configuration. In addition, the forbidden areas which are defined can be made to overlap one another. 
     As many apparently widely different embodiments of the present invention can be made without departing from the spirit and scope thereof, it is to be understood that the invention is not limited to the specific embodiment thereof except as defined in the appended claims.