Method of discriminating present position region of a machine
BACKGROUND OF THE INVENTION 
     1. Technical Field 
     This invention relates to a method of discriminating the present position region of a machine. 
     2. Description of the Related Art 
     Conventionally a numerically controlled (hereafter referred to as &#34;NC&#34;) machine tool has a dog provided on a movable portion of the machine tool and a limit switch provided at a prescribed position on a stationary portion of the machine tool. When the dog trips the limit switch, a signal is generated that the movable portion of the machine has reached the prescribed position, whereupon a predetermined operation is executed. By way of example, in an operation for returning a movable portion such as a table to a reference point, the dog trips a deceleration limit switch in the vicinity of the reference point, whereupon an NC unit controlling the machine tool takes this as an indication that the table has reached the vicinity of the reference point and responds by providing a command for reducing the travelling velocity. Further, in a tool change operation, a tool rest is moved toward a tool change position. At the tool change position, a dog provided on the tool rest trips the limit switch, whereby the machine tool halts the tool rest at a stopping position and thereafter performs the tool change. 
     Thus, in the prior art, a dog and a limit switch are provided at appropriate locations and, when a prescribed limit switch is actuated, a predetermined operation is performed by the NC apparatus or the machine tool. This means that a dog and limit switch are essential, thereby increasing the number of component parts. Another disadvantage is that mounting and adjusting the dog and limit switch are troublesome operations. 
     SUMMARY OF THE INVENTION 
     An object of the present invention is to provide a novel method of discriminating the present position region of a machine, whereby a region at which a movable position resides can be discriminated without mounting a dog or limit switch. 
     A machine present position control region discrimination method according to the present invention, utilized by a numerical control system which performs numerical control of a movable portion of a machine tool, comprises the following steps: dividing a stroke along a controlled coordinate axis into n equal parts to partition the stroke into n regions, each having an interval length; assigning a region number to each region incrementing or decrementing a present position region number in dependence upon a travelling directon when an accumulated travelling distance of the movable portion of the machine exceeds a range bounded by zero and the interval length and delivering a present position region signal, which is indicative of the present position region number, from the NC control system to the machine. 
     According to the present invention, it is not necessary to provide a dog or limit switch as in the prior art, thereby providing an advantage in terms of cost. Moreover, complicated tasks such as mounting and positional adjustments are no longer required. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is an illustrative view depicting movement regions; 
     FIG. 2 is a block diagram of an NC apparatus capable of utilizing a method according to the present invention; and 
     FIG. 3 is a flowchart of a method according to the present invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     An embodiment of the present invention will now be described in detail with reference to the drawings. 
     FIG. 1 is an illustrative view of the range of movement of a machine tool having a full stroke of 1270 mm along a certain coordinate axis, e.g., the X axis the stroke being equally divided into 127 movement regions. The stroke in the negative direction from a reference point Pr is 50 mm, and the stroke in the positive direction in 1220 mm. Regions are defined with an interval length of 10 mm intervals. The region in the -50˜-40 mm interval is defined as a first region, that in the -40˜-30 mm interval a second region, and so on through the region in the 1210˜1220 mm interval, which is defined as a 127th region. 
     FIG. 2 is a block diagram of an NC apparatus for practicing the method of discriminating a present position region of a machine according to the present invention. FIG. 3 is a flowchart illustrating the method. 
     A controller main body 101, illustrated in FIG. 2, controls a tape reader 102 to temporarily store the entirety of a machining program from an NC tape 103 in a RAM 107, after which the controller reads the machining program out of the RAM 107 block by block to perform numerical control processing. Specifically, if the NC data is path data, the distance to be travelled may be defined as Xi, Yi (incremental values). Using feed velocities Fx and Fy, defined below, then the controller main body 101 performs the following operations: 
     
         ΔXi=Fx·ΔT                             (1) 
    
     
         ΔYi=Fy·ΔT                             (2) 
    
     to obtain travelling distances ΔXi, ΔYi along the respective X and Y axes during a predetermined period of time ΔT. These travelling distances are applied to pulse interpolators 104, 105, respectively. It should be noted that ΔT is a period of time preset as a parameter in a parameter memory 106. Fx and Fy and X- and Y-axis velocities, respectively, which are determined by the following equations: ##EQU1## where F is the feed velocity from the machining program. 
     When ΔXi, ΔYi are applied to the pulse interpolators 104, 105, pulse interpolation computations are performed. The pulse interpolators 104, 105 apply interpolated pulses Xp, Yp to X- and Y-axis servo units, which are not shown, thereby rotating servomotors to transport a movable portion such as a table or tool along a commanded path. When a number Nx of interpolated pulses Xp along the X axis and a number Ny of interpolated pulses Yp along the Y axis become equal to ΔXi, ΔYi, respectively, namely when the following is true: 
     
         Nx=ΔXi                                               (5) 
    
     
         Ny=ΔYi                                               (6) 
    
     the pulse interpolators deliver pulse distribution end signals DENX, DENY to the controller main body 101. As a result, the controller main body 101 accumulates ΔXi, ΔYi and determines whether or not the movable portion has arrived at a target position. If it has not, the controller computes subsequent items of travelling distance data ΔXi+1, ΔYi+1 from Eqs. (1) and (2) (normally, ΔXi+1=ΔXi, ΔYi+1=ΔYi), and applies these to the pulse interpolators 104, 105, respectively. This is followed by execution of similar processing. When the movable portion arrives at the target position along the commanded path, the controller main body 101 reads the next block of NC data out of the RAM 107 and executes NC processing on the basis of this NC data. 
     Meanwhile, as the NC processing is being executed, the controller main body 101, under the control of a control program, performs processing, described below, for discriminating the present position region of the controlled machine. This processing will be described with reference to the flowchart illustrated in FIG. 3. We will assume that the movable portion of the machine has been restored to the reference point Pr at the start of this processing by means of a well-known reference point return operation (step 1). In response to completion of the reference point return operation, a present position region number A stored in the RAM 107 shall be set to &#34;6&#34; (A=6), and a numerical value B indicating a position within the region shall be set to 0 (step 2). Though the following description shall be confined to the X axis, this is no way places a limitation upon the invention. Since the description could apply equally well to any other axis. 
     When path data or positioning data are read out of the RAM 107 and ΔXi is delivered to the pulse interpolator 104, the latter performs a pulse interpolation operation (step 3). When this operation is carried out, the controller main body 101 executes the following process steps, depending upon the direction of travel: 
     (a) If the direction of travel is positive (+X direction) (step 4), then, upon completion of travel over the distance ΔXi (DENX=&#34;1&#34;), the following operation is peformed (step 5): 
     
         B+ΔXi→B 
    
     (b) B representing the travelled distance accumulated in step 5, and a region interval length I, which is stored in the parameter memory 106, are compared in terms of magnitude (step 6). 
     (c) If B≧I is true, the following operation is performed: 
     
         A+1→A 
    
     to incement the region number A, as well as the following operation: 
     
         B-I→B 
    
     to obtain the position of the movable portion in the new region (step 7). 
     (d) The computed present position region number A is delivered to the machine through a data input/output unit 108 (step 8). If B&lt;I is true (step 6) and, the system again waits for ΔXi to be produced. When it is produced, steps 3 through 6 are repeated. 
     (e) Meanwhile, if the direction of travel is negative (-X direction), then the following operation is performed at the end of the interpolation for ΔXi (step 9): 
     
         B-ΔXi→B 
    
     (f) B and 0 are compared in magnitude. 
     (g) If B&lt;0 is true (step 10), then the following operation is performed: 
     
         A-1→A 
    
     to decrement the region number, as well as the following operation (step 11): 
     
         B+I→B 
    
     to obtain the position of the movable portion in the new region. 
     (h) The computed present position region number A is delivered to the machine through the data input/output unit 108 (step 8). If B≧0 is true (step 9), the system waits for ΔXi to be produced. When it is produced, steps 3, 4, 9 and 10 are repeated. 
     Though the foregoing description relates solely to the X axis, the present invention is not limited thereby. Regions can be discriminated in similar fashion with regard to the Y and Z axes as well. 
     The present invention is not only well-suited for application to numerically controlled machine tools but can also be used in any arrangement such as an electric discharge machine or laser cutter that requires verification of the operating position of a movable machine element.