Numerical control unit for estimating movement parameters using a model
BACKGROUND OF THE INVENTION 
     The present invention relates to a process for a numerical control unit to estimate the mass, inertia, viscous friction coefficient and sliding (Coulomb) frictional force of a movable part, e.g. a table of a machine to be controlled. Incorporated herein by reference is the subject matter of Japanese priority application No. 2-93547 filed Apr. 9, 1990. 
     FIG. 8 is a block diagram illustrating a conventional numerical control unit. In FIG. 8, an interpolation processor 1 is used for entering machining information, e.g. a travel distance and traveling velocity, for each block of a machining program, and for outputting a travel increment per sampling or a position command value of a control axis. An acceleration/deceleration processor 2 receives the interpolation information, e.g. the travel increment per sampling or the position command value provided by the interpolation processor 1, and performs acceleration/deceleration processing for a primary delay circuit, for example, and outputs a position command value for a motor 105 or a travel increment per sampling. A servo controller 3 is responsive to the output of the acceleration/deceleration processor 2 and controls the positioning of the motor 105. The servo controller 3 comprises a position loop controller 101, a velocity loop controller 102, a current loop controller 103, a current detector 104 for detecting a motor current feedback value, the motor 105 for driving a movable part (not illustrated), a velocity detector 106 operatively connected to the movable part (not illustrated) or to the motor 105, and a position detector 107. 
     In operation, the interpolation processor 1 receives machining information, such as a travel distance and traveling velocity, for each block of the machining program and outputs to the acceleration/deceleration processor 2 a. travel increment per sampling or a position command value of the control axis. The acceleration/deceleration processor 2 receives the interpolation information, such as the travel increment per sampling or the position command value provided by the interpolation processor 1, performs acceleration/deceleration processing for a primary delay circuit having a preset time constant, for example, and outputs a position command value for the motor 105 or travel increments per sampling to the servo controller 3. The servo controller 3 controls the position of the movable part in response to the output of processor 2 by using in sequence the position loop control 101, the velocity loop control 102 and the current loop control 103 to generate operational inputs to the motor 105, in accordance with the position command value or the travel increment per sampling. In this conventional system, the movable part is controlled by using preset loop gains and compensation gains in the position loop control 101, the velocity loop control 102 and the current loop control 103. 
     In the conventional numerical control unit configured as mentioned above, the time constant of the acceleration/deceleration processor, as well as the loop gains of the position loop control 101, the velocity loop control 102 and the current loop control 103, and each compensation gain, are set while inertia, a viscous friction coefficient or sliding frictional force of the movable part of the machine to be controlled remain unknown or are identified merely as approximate values. In recent years, however, as higher machining speed and higher machining accuracy are demanded, it has become necessary to provide fast, accurate and stable positioning control. Nevertheless, since the conventional numerical control unit carries out positioning control of the movable part without precisely knowing the inertia, viscous friction coefficient and sliding frictional force of the movable part of the machine to be controlled, the acceleration/deceleration time constant, the position loop gain and the velocity loop gain, for example, of the servo controller must be manually adjusted by skilled operators. Even when such operators have a significant level of skill, they require a considerable amount of time to make such adjustments. 
     The machining of a workpiece having a projection with a curved profile offers a particularly difficult problem. In determining the appropriate machining adjustments when machining a projection which requires switching of circular arc quadrants, the mass and the frictional force of the movable part must be taken into consideration. An accurate offset during high-speed machining cannot be determined by the conventional numerical control unit because it can only compensate for that projection by using the acceleration parameter and the mass of the movable part. 
     SUMMARY OF THE INVENTION 
     It is, accordingly, an object of the present invention to overcome the disadvantages of the conventional process by providing a numerical control unit which will allow an estimation of the mass or inertia or viscous friction coefficient or sliding frictional force of a movable part of a machine. These parameters will permit the determination of an optimum value of gain and offset parameters for ensuring high accuracy and stability for rapid positioning control of the movable part of the machine. 
     The foregoing object is accomplished in three embodiments by providing a numerical control unit that will allow a determination of a current feedback value for a motor that drives a movable part, and an estimation of a movable part velocity and movable part acceleration. It also will allow the mass, viscous friction coefficient or sliding frictional force of the movable part to be calculated. The calculation is performed by using an expression that relates the mass or viscous friction coefficient or sliding frictional force to the motor current feedback value, the velocity and the acceleration when the movable part is replaced by a predetermined model. Furthermore, the calculation may be based on a multiple of the detected or estimated values of motor current feedback values, velocity and acceleration. 
     According to the present invention, by representing a dynamic characteristic of the movable part as a model in a spring mass system, for example, an expression of the relationship between the mass, viscous friction coefficient and sliding frictional force of the movable part can be obtained by a parameter estimation process such as a method of least squares. The inertia of the movable part can be determined from the mass parameter. 
    
    
     BRIEF DESCRIPTION OF THE EMBODIMENTS 
     FIG. 1 is a block diagram illustrating a numerical control unit according to a first embodiment of the present invention. 
     FIG. 2 is a flowchart illustrating operation of the numerical control unit according to the first embodiment of the present invention. 
     FIG. 3 is a diagram showing an example of a model of a movable part. 
     FIG. 4 is a block diagram illustrating a numerical control unit according to a second embodiment of the present invention. 
     FIG. 5 is a flowchart illustrating operation of the numerical control unit according to the second embodiment of the present invention. 
     FIG. 6 is a block diagram illustrating a numerical control unit according to a third embodiment of the present invention. 
     FIG. 7 is a flowchart illustrating operation of the numerical control unit according to the third embodiment of the present invention. 
     FIG. 8 is a block diagram showing a conventional numerical control unit. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     A first embodiment of the present invention may be described with reference to FIG. 1, where the components 1 to 3 and 101 to 107 designate identical part in the conventional unit and will not be described here. An acceleration detector 4 is responsive to the velocity feedback signal generated by velocity detector 106 and is operative to calculate the acceleration of the movable part. The acceleration detector has a memory 4a for storing a velocity value for the movable part, as provided by the velocity detector 106 during a sampling time, T. A subtractor 4b is used for determining a difference between the velocity value of the movable part previously detected and stored in the memory 4a, and that of the movable part provided by the velocity detector 106 at a subsequent predetermined time. A multiplier 4c is used for multiplying difference from subtractor 4b by 1/T. A storage medium 5 is used for sampling and storing the movable part velocity, the movable part acceleration and the motor current feedback values provided by the velocity detector 106, the acceleration detector 4 and the current detector 104, respectively, at predetermined points in time. A calculator 6 is operative to read from memory 5 a multiple of the movable part velocities, the movable part accelerations and the motor current feedback values and to calculate the mass (m), the viscous friction coefficient (c) and the sliding frictional force (fr) of the movable part using a parameter estimation process, e.g. a method of least squares. A second storage medium 7 is used for storing the mass, the viscous friction coefficient and the sliding frictional force of the movable part calculated by the calculator 6. 
     FIG. 3 indicates an example of representing a dynamic characteristic of the movable part as a model in a spring mass system. Variable x 1  indicates a value obtained by converting an angular value of a motor shaft into a traveling direction of the movable part, variable x 2  indicates a position of the movable part, m indicates the mass of the movable part, k indicates a spring constant between the movable part and the motor shaft, c indicates the viscous friction coefficient of the movable part, and fr indicates the sliding frictional force applied to the movable part. The value, x 1  is obtained by converting the mass (m), the viscous friction coefficient (c), the sliding frictional force (fr) of the movable part, and the angular value of the motor shaft into a traveling direction of the movable part. The relationship between x 1  and the position of the movable part, x 2 , is represented by the following equations of motion: 
     
         K(x.sub.2 -x.sub.1)=mx.sub.2 +cx.sub.2 +fr (if x.sub.2 &gt;0) 
    
     
         K(x.sub.2 -x.sub.1)=mx.sub.2 +cx.sub.2 -fr (if x.sub.2 &lt;0) 
    
     In the above equations, a value, x 1 , obtained by converting the rotary angular velocity of the motor shaft into the traveling direction of the movable part and a velocity, x 2 , of the movable part, can generally be approximated to a value, x 1 . This approximation is obtained by converting the rotary angular acceleration of the motor shaft into the traveling direction of the movable part and an acceleration, x 2 , of the movable part. The approximation is made on the assumption that x is a value that can be detected by the velocity detector 106 installed on the movable part or the motor and x is a value that can be output by the acceleration detector 4. The relationship may be summarized as follows: 
     
         x≈x.sub.1 ≈x.sub.2 
    
     
         x≈x.sub.1 ≈x.sub.2 
    
     Then, assuming that I is a value detected by the current detector 104, i.e. the motor current feedback value, the motor current feedback value I is proportional to a load torque applied to the motor and has the following relationship with the left portion, k (x 2  -x 1 ), of the equations of motion: 
     
         K.sub.T ×I=k (x.sub.2 -x.sub.1) 
    
     where K T  is a constant of proportion to force obtained by converting the motor current feedback value, I, and the motor load torque into the shaft direction. In this case, K (x 2  -x 1 ) is proportional to motor current. If the movable part is screw-driven: 
     K T  =(motor torque constant)×2×π÷(travel distance of the movable part per motor revolution) 
     Hence, when the movable part is represented by a model shown in FIG. 3, an expression of relationship among the mass (m), viscous friction coefficient (c), sliding frictional force (fr) of the movable part, the motor current feedback value, I, detected by the current detector 104, the velocity, x, of the movable part obtained by the velocity detector 106 and the acceleration, x, obtained by the acceleration detector 4 is as follows: 
     
         K.sub.T ×I≈mx+cx+fr (if x&gt;0) 
    
     
         K.sub.T ×I≈mx+cx-fr (if x&lt;0) 
    
     In operation, the interpolation processor enters machining information and drives the motor for driving the movable part of the servo controller 3 via the acceleration/deceleration processor 2. At this time, the storage 5 samples and stores the movable part velocities, accelerations and the motor current feedback values from the velocity detector 106, the acceleration detector 4 and the current detector 104, respectively, at a multiple of predetermined times. Then, the calculator 6 calculates the mass/viscous friction coefficient/coulomb frictional force of the movable part by a method of least squares, for example, indicated in the expression 1 and outputs results to the second storage 7. ##EQU1## where, K T  is a constant of proportion to force obtained by converting the motor current feedback value and the motor load torque into the shaft direction. If the movable part is driven from a ball screw, 
     K T  =(motor torque constant)×2×π÷(travel distance of the movable part per motor revolution) 
     Operation of the storage 5 and the calculator 6 may be described in more detail with reference to the flowchart in FIG. 2. Step 101 judges whether a particular time of day is among the predetermined sampling times. If it is not so predetermined, the operation progresses to step 102, which reads the velocity of the movable part at each sampling time from the velocity detector 106 and writes that value into the memory 4a of the acceleration detector 4. If the step 101 has judged that the sampling time is predetermined, the operation progresses to step 103, which reads the velocity of the movable part at the predetermined time and step 104 writes it into the storage 5. Then, step 105 reads the motor current feedback value at the predetermined time from the current detector 104, and step 106 writes it into the storage 5. At step 107, the subtractor 4b subtracts the velocity of the movable part written to the memory 4a at the previous sampling time, T, before the predetermined time at the step 102, from the velocity of the movable part read at the predetermined time at the step 103. At step 108, the multiplier 4c multiplies that result by 1/T to obtain the acceleration of the movable part and writes the result to the storage 5. Step 109 judges whether or not the velocities/accelerations of the movable part and the motor current feedback values have been stored a predetermined number of times, n. If the above values have been stored the predetermined number of times, the operation progresses to step 110. Otherwise, the execution returns to the step 101. Step 110 calculates the nine elements in the first term on the left-hand side of the expression 1 and three elements in a second term on a right-hand side thereof using a multiple, n, of the movable part velocities/accelerations and the motor current feedback values placed in the storage 5. Step 111 solves cubic simultaneous equations which have the second term on the left-hand side of the expression 1 as a variable by using the elements obtained at the step 110, calculates the mass, m, the viscous friction coefficient, c, and the frictional force, fr, of the movable part in the second term on the left-hand side, writes the result into the second storage 7, and terminates the processing. Where K T  in the first term on the right-hand side of the Expression 1 is a value obtained beforehand if a drive system for the motor and the movable part is determined, it is evident that the inertia of the movable part can be obtained from the mass, m, if the drive system for the movable part is determined. 
     Inertia may be obtained from the maximum torque and maximum current feedback value derived by accelerating/decelerating the motor 105 (movable part). If the acceleration/deceleration of processor 2 is the position loop gain 1/Tp of the servo at the primary-delay of the time constant Ts, the maximum torque Tmax (kg.cm) is represented by: ##EQU2## where, N=motor speed (rpm) 
     J L  =load inertia converted to the equivalent value at the motor shaft (kgf.cm.sec 2 ) 
     J M  =motor inertia (kgf.cm.sec 2 ) 
     The load torque T and current feedback I (AMPS) of the motor 105 is represented by: 
     
         T=K.sub.I I 
    
     where, K I  (kgf.cm/AMPS) is a torque constant. Therefore, the maximum current feedback value Imax at the time of acceleration is represented by: ##EQU3## By detecting the current feedback value at the acceleration time and obtaining the then maximum value Imax, the inertia (J I  +J M ) can be found. 
     A problem exists in that current feedback value includes a factor of frictional force. In addition, the maximum value Imax includes an error due to noise. For such reasons, the inertia cannot be obtained accurately. 
     The viscous frictional force and sliding frictional force also may be found. By moving the motor 105 (movable part) at various speeds Fi and detecting the then current feedback values Ii, the relationship between Fi and Ii is obtained. In fact, Ii must be detected in a stationary state wherein the relationship is not affected by acceleration speed during the acceleration/deceleration time. 
     Sliding frictional force f R  may be represented by: ##EQU4## where P (cm) is the distance traveled by the movable part per motor revolution and b is the current feedback value Ii when Fi is zero. 
     The coefficient of viscous friction C (kgf.sec/cm) can be found by: ##EQU5## 
     By finding the load inertia (including the motor inertia) J L  +J M  applied to the motor, the maximum torque at the acceleration/deceleration time is obtained by: ##EQU6## Generally, since the motor or servo amplifier has a limitation on the current that can be output, the acceleration/deceleration time constant Ts can be determined so that K I  T MAX  does not exceed the limit value. Namely, the optimum Ts can be found. 
     Using the viscous frictional force and sliding frictional force is straightforward. In a semi-closed loop system, etc., the machine cannot be positioned with high accuracy because it is deformed elastically by the frictional force of each machine area. Generally, the frictional force F R  and positioning error ε is represented by: 
     
         F.sub.R∝ε                                   (8) 
    
     Therefore, if the frictional force is known, the error ε can be found, and by compensating for ε, precision positioning can be effected. 
     A second embodiment of the present invention will now be described with reference to FIG. 4, where the numerals 1 to 7 and 101 to 107 are the same as those in FIG. 1 and will not be explained here. A velocity estimator 8 is used for estimating the velocity of the movable part, i.e. for entering a position command value per sampling that is an output of the acceleration/deceleration processor 2, estimating a feed rate of the movable part, and outputting an estimated velocity value of the movable part to the acceleration detector 4 and the storage 5. The velocity estimator 8 comprises a subtractor 8a, a multiplier 8b and an integrator 8c, including an adder for accumulating the estimated velocity values, and has discretely replaced a position loop control system of the servo controller. 
     The movable part is replaced by the model shown in FIG. 3, for example. FIG. 3 will not be described because it has already been explained in the first embodiment. 
     Operation of the second embodiment in FIG. 4 will now be described. The interpolation processor 1 enters machining information and drives the motor for driving the movable part of the servo controller 3 via the acceleration/deceleration processor 2. At this time, the velocity estimator 8 enters the position command value per sampling from the acceleration/deceleration processor 2, subtracts a calculated value of the movable part position at the preceding sampling time of day provided by the integrator 8c from the position command value, multiplies the subtraction result by a position loop gain, Kp, of the servo controller and a sampling time T, by means of the multiplier 8b to obtain the travel increment of the movable part per sampling, enters that result into the multiplier 8d, multiplies that result by 1/T, calculates the velocity of the movable part at each sampling time, and enters that result into the acceleration detector 4 and the storage 5 as the estimated velocity value of the movable part. Further, the velocity estimator 8 enters the result of the multiplier 8a into the integrator 8c and calculates the position of the movable part per sampling. The sampling storage 5 samples and accumulates the movable part velocities/acceleration and the motor current feedback values from the velocity detector 106, the acceleration detector 4 and the current detector 104, respectively, at a multiple of predetermined times. Then, the calculator 6 calculates the mass/viscous friction coefficient/ coulomb frictional force of the movable part as in FIG. 1 by the method of least squares, for example, indicated in the expression 1, and outputs the result to the second storage 7. 
     The operation will further be described according to the flowchart in FIG. 5. The interpolation processor 1 enters machining information and drives the motor for driving the movable part of the servo controller 3 via the acceleration/deceleration processor 2. At this time, the velocity estimator 8 enters the position command value per sampling from the acceleration/deceleration processor 2 at step 201 and subtracts the calculated value of the movable part position at the preceding sampling time provided by the integrator 8c from the position command value at step 202. At step 203, the velocity estimator 8 multiplies the subtraction result by the position loop gain, Kp, of the servo controller 3 and the sampling time of day, T, by means of the multiplier 8b to obtain the travel increment of the movable part per sampling, and at step 204, enters that result into the multiplier 8d and multiplies that result by 1/T to calculate the velocity of the movable part at each sampling time of day. At step 205, the velocity estimator 8 enters the result of the multiplier 8a into the integrator 8c and calculates the position of the movable part per sampling. Step 206 judges whether the corresponding sampling time is among the predetermined times. If it is not thus predetermined, the operation progresses to step 207, which reads the velocity of the movable part at each sampling time from the velocity estimator 8 and writes that value into the memory 4a of the acceleration detector 4. If the step 206 has judged that the sampling time is as predetermined, the operation progresses to step 208, which reads the velocity of the movable part from the velocity estimator 8 at the predetermined sampling time, and step 209 writes it into the storage 5. Then, step 210 reads the motor current feedback value at the predetermined time from the current detector 104 and step 211 writes that value into the storage 5. At step 212, the subtractor 4b subtracts the velocity of the movable part written to the memory 4a read at the sampling time, T, before the predetermined time at the step 207, from that of the movable part read at a predetermined time at the step 208. At step 213, the multiplier 4c multiplies that result by 1/T to obtain the acceleration of the movable part and writes the result to the storage 5. Step 214 judges whether or not the velocities/accelerations of the movable part and the motor current feedback values have been stored by the predetermined number of times, n. If the above values have been stored by the predetermined number of times, the operation progresses to the step 110. Otherwise, the execution returns to the step 201. The steps 110 and 111 are not described here because they have been explained in FIG. 2. 
     A third embodiment of the present invention will now be described in reference to FIG. 6. In FIG. 6, the structure identified by numerals 1 to 3, 5 to 7, and 101 to 107, are the same as those in FIG. 1 and they will not be described here. An estimator 9 for estimating the velocity and the acceleration of the movable part when the interpolation processor 1 outputs a travel increment command value, ΔX=R(sinωt-sinω(t-T)), or a position command value, X=R(sinωt), at a predetermined time, t, when the position command value is a sine wave with respect to the time, t, and also a velocity acceleration calculator for entering from the interpolation processor 1 at a time, t, assuming a start of interpolation as 0, estimating the velocity and the acceleration of the movable part at that time, t, and entering that result into the storage 5. 
     The movable part may be replaced by the model shown in FIG. 3, for example. FIG. 3 will not be described because it has already been explained in the second embodiment. 
     Operation of the third embodiment will now be described with reference to the flowchart in FIG. 7. At step 301, the interpolation processor 1 outputs to the acceleration/deceleration processor 2 per sampling time, t, the travel increment command value, ΔX=R(sinωt-sinω(t- T)), or the position command value, X=R (sinωt), at the predetermined time, t, when the position command value is a sine wave with respect to the time. Step 302 judges whether the corresponding sampling time is among the predetermined times. If it is not so predetermined, the operation returns to the step 301. If the step 302 has judged that the sampling time is as predetermined, the operation progresses to step 303, at which the velocity/acceleration calculator 9 receives from the interpolation processor 1 outputs to the acceleration/deceleration processor 2 the travel increment command value, ΔX=R(sinωt-sinω(t-T)), or the position command value, X-R(sinωt), by which the position command value will be a sine wave with respect to the time. At this time, if the acceleration/deceleration processor 2 is a primary delay circuit of time constant, Ts, and the position loop time constant of the servo controller 3 is TP (1/Kp), for example, the velocity, x, and the acceleration, x, of the movable part at a predetermined time, t 1 , can be obtained by expressions 9 and 10: 
     
         x=R&#39;·ω·cos(ωt.sub.1 -φ)  (9) 
    
     
         x=R&#39;·ω.sub.2 ·cos(ωt.sub.1 -φ) (10) 
    
     where, 
     R&#39;≈R(1-ω 2  (Ts 2  +Tp 2 )) 
     φ=tan -1  (Ts×ω)+tan -1  (Tp×ω) 
     R (mm): Travel amplitude 
     ω (rad/sec): Angular velocity 
     Ts (sec): Acceleration/deceleration time constant 
     Tp (sec): Position loop time constant 
     Step 304 assigns the time, t, received at the step 303 into t 1  in the expression 9 to calculate the velocity of the movable part, and step 305 writes that result to the storage 5. Step 306 assigns the time, t, received at the step 303 into t 1  in the expression 10 to calculate the acceleration of the movable part, and step 307 writes that result to the storage 5. Then, step 308 reads the motor feedback value at the predetermined time of day, t, from the current detector 104, and step 309 writes it into the storage 5. Step 310 judges whether or not the velocities/accelerations of the movable part and the motor current feedback values have been stored the predetermined number of times, n. If they have been stored the required number of times, the operation progresses to the step 110 and otherwise returns to the step 301. The operations at the steps 110 and 111 are omitted here because they are identical to those in FIG. 2. 
     In the above three embodiments, the mass (m) viscous friction coefficient (c), frictional force (fr) of the movable part are calculated by the calculator 6 after the detected or estimated values of the velocity/acceleration of the movable part and the detected values of the motor current feedback value have been stored in the storage 5 by the required number of times. It will be appreciated that part of the calculation procedure for the mass (m) viscous friction coefficient (c) frictional force (fr), of the movable part may be performed serially per sampling, e.g. the elements in the first term on the left and in the second term on the right of the expression 1 at the predetermined estimated values of the velocity/acceleration of the movable part, the detected values of the motor current feedback value, and the stored elements in the first term on the left and in the second term on the right of the expression 1. It will also be appreciated that the values of the mass (m) viscous friction coefficient (c) frictional force (fr), of the movable part may be estimated serially per sampling. 
     It will be apparent that the invention, as described above, achieves a numerical control unit which will provide the mass/viscous friction coefficient coulomb frictional force of the movable part required to automatically adjust the acceleration/deceleration time constants, position loop gain and velocity loop gain, for example, of the servo controller demanded for fast, precision and stable positioning control and to enhance accuracy of compensation of a projection, etc. occurring while switching circular arc quadrants by calculating the mass/viscous friction coefficient/coulomb frictional force of the movable part using the expression of relation between the mass/viscous friction coefficient/sliding frictional force of the movable part and the motor current feedback value/velocity/acceleration obtained by replacing the movable part with a presupposed model and a multiple of motor current feedback values/velocities/accelerations detected by the detection means at the predetermined times.