Apparatus for detecting discharge gap in electric discharge machining
BACKGROUND OF THE INVENTION 
     The present invention relates to an electric discharge machining apparatus and, more particularly, to an apparatus for detecting a discharge gap in the electric discharge apparatus. 
     In electric discharge machining, an intermittent DC voltage in the form of a pulse voltage is supplied between a machining electrode and a workpiece to thereby produce an electric discharge or an arc which is used to machine the workpiece to a desired depth and configuration. During the machining, the appearance of the electric discharge varies delicately in response to changes in the discharge gap between the machining electrode and the workpiece, even though the supplied DC voltage remains constant. As a result, the surface finish of the workpiece and the machining speed are undesirably varied. 
     For this reason, in actual machining, in order to obtain a uniform machining results and a desired machining speed, servocontrol is employed in which the discharge gap is measured by detecting a discharge voltage, and either the workpiece or the machining electrode is delicately controlled such that a desired discharge gap is maintained. One example of this kind of the servocontrol is shown in U.S. Pat. No. 4,339,650 to Tanaka et al, &#34;ELECTRIC DISCHARGE MACHINING APPARATUS&#34;. 
     To measure the discharge gap, it is known to detect a discharge initiating voltage (peak voltage) or an average value of the discharge voltage which is measured at the machining electrode. By such conventional detecting methods, however, it is not possible to effect accurate detection over a wide gap range. For instance, with the conventional method which employs the peak voltage, which is always equal to the value of the supplied pulse voltage itself in an area where the discharge gap is wide, that is, in a case where discharge occurs after a certain period of time elapses after the supply of the pulse voltage, it is not possible to detect any change in the actual discharge gap. Also with the method which employs the average value, on the other hand, although it is possible to effect approximate detection in the area where the discharge gap is wide, it is not possible to accurately detect the discharge gap where the discharge gap is narrow, that is, in a case where discharge occurs immediately after the supply of the pulse voltage. 
     SUMMARY OF THE INVENTION 
     Accordingly, it is a primary object of the present invention to provide an improved discharge gap detecting apparatus which is capable of accurately detecting and operating over a very wide range of discharge gaps. The wide gap range includes both narrow gaps where the discharge initiating voltage is smaller than the voltage of the applied pulse voltage and wide gaps where the electric discharge occurs a long time after the pulse voltage. Thus, the overall range of the controllable discharge gap is enlarged. 
     According to the present invention, there is provided a discharge gap detecting circuit for an electric discharge machining apparatus which comprises: a peak detector which receives a discharge voltage and detects a peak voltage of the discharge voltage, a waiting time detector which detects a waiting time period between a leading edge of a supplied pulse voltage and a start of discharge occurrence, and a computing circuit which computes the discharge gap by combining the peak voltage and the waiting time period. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 shows a block diagram of an embodiment of the present invention; and 
     FIGS. 2(a) to 2(f) are timing charts for explaining the operation of the embodiment shown in FIG. 1. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The present invention will be described below in reference to an embodiment illustrated in the accompanying drawings. FIG. 1 shows the positive end of a DC power supply PS (voltage Vp) for machining connected to a collector of a switching transistor TR 1 , while the negative end is grounded. An ON/OFF gate signal V G  is supplied to the base of the switching transistor TR 1 . From the emitter of the switching transistor TR 1 , an intermittent pulse voltage, such as shown in FIG. 2(a), is supplied to a machining electrode H through a resistor R 5 . On the other hand, the workpiece W is grounded. 
     When the discharge gap between the machining electrode H and the workpiece W changes in the manner shown in FIG. 2(b), the waveform of the discharge voltage between the machining electrode H and the workpiece W is as that shown in FIG. 2(c). In FIGS. 2(b) to 2(f), the notations (I), (II) and (III) in FIG. 2(a) represent situations where the discharge gap is so narrow that discharge occurs during the duration of the pulse voltage (IV) and (V) represent cases where the discharge gap is sufficiently wide so that discharge occurs at the time when certain periods of time T 1  and T 2  elapse after the end of the pulse voltage; and (VI) represents a case where the discharge gap is so wide that no discharge occurs. As described above, in the cases (I), (II) and (III), it is possible to accurately measure the discharge gap by detecting the peak voltage. In the cases (IV) and (V), however, the peak voltage is always equal to the value of the supplied pulse voltage. Therefore, it is impossible to measure the gap accurately. On the other hands, in any of these cases, particularly in the cases (I), (II) and (III), it is not possible to accurately measure the discharge gap by using an average value. 
     The discharge voltage between the machining electrode H and the workpiece W, that is, a primary machining gap signal V H , also appears across gap voltage detecting resistors R 1  and R 2 . From the node between the resistors R 1  and R 2 , a divided machining gap voltage B is obtained which is supplied to the base of a transistor TR 2 . The collector of the transistor TR 2  is connected to a voltage V C . The emitter of the transistor TR 2  is grounded through an analog switch AS 1  and is also connected through a resistor R 6  to one terminal of a capacitor C and an A/D converter AD 1 . The other terminal of the capacitor C is grounded. A switching signal S C , which causes the the emitter to connect to ground just before the supply of each pulse voltage, is supplied to the analog switch A S . 
     Accordingly, when the machining pulse voltage is intermittently supplied, the capacitor C is charged, during pulse voltage, to the peak voltage which is proportioned to and lies between the machining electrode H and the workpiece W, that is, the peak voltage of the discharge voltage. The peak analog voltage on the capacitor C is converted by the A/D converter AD 1  into a digital signal, which is supplied to a function circuit ROM 1 . On the other hand, the output voltage V P  from the DC power supply PS appears across resistors R 3  and R 4 . From the node between the resistors R 3  and R 4 , a voltage proportional to other voltage PS is supplied to an A/D converter AD 2 . A digital signal corresponding to the voltage of the power supply PS produced by the A/D converter AD 2  is supplied to the function circuit ROM 1 . Machining data S d  are also applied to the function circuit ROM 1 . Accordingly, various data, that is, the gap data detected by using the peak voltage from the A/D converter AD 1 , the data representing the voltage of the machining power supply PS, and the data S d  representing a machining condition are applied to the function circuit ROM 1 . 
     In the function circuit ROM 1 , the gap data are modified in accordance with the supply voltage and the machining condition, and the modified gap data are delivered as compensated gap data OUT 1 . Such function circuit can be easily realized by employing a read-only memory (ROM). FIG. 2(d) shows gap data detected by using the peak voltage. In each of the cases (I), (II) and (III), the data correctly represents the discharge gap. 
     The following is a description of gap-detecting by using a discharge waiting time. The discharge voltage B from the node between the resistors R 1  and R 2  is supplied to one input terminal of a comparator CP. The voltage V C  is divided by the resistors R 7  and R 8 , and the divided voltage V&#39; C  is supplied to the other input terminal of the comparator CP as a reference voltage. In this case, the voltage V&#39; C  is, as shown in FIG. 2(c), selected to have a value between the supplied voltage and a discharge maintaining voltage in which discharge is sustained. Accordingly, a pulse T W  having widths corresponding to a waiting time (T 1  and T 2  in FIG. 2(c), for example), which is the interval from the start of the supply of the voltage to the moment when discharge begins, is delivered from the comparator CP and supplied to a binary counter CT. 
     A clock signal and a reset signal S r  are supplied to the counter CT. In this case, the reset signal S r  is generated just before the supply of the pulse voltage. As a result, numerical data corresponding to the waiting time is delivered from the counter CT. The value from the counter CT is supplied to a function circuit ROM 2 , to which the machining data S d  is also applied. The function circuit ROM 2  is supplied with gap data obtained by using the waiting time and the data S d  representing the machining condition. The gap data from the counter CT is modified in accordance with the data S d  and the modified data is delivered as compensated gap data OUT 2 . FIG. 2(e) shows the gap data obtained by using the waiting time. As shown in FIG. 2(e), this data correctly represents a partial discharge gap which can not be detected by using the peak voltage. 
     The gap data OUT 2  from the function circuit ROM 2  in accordance with the discharge waiting time and the gap data OUT 1  from the function circuit ROM 1  in accordance with the peak value are added together by an adder FA. FIG. 2(f) shows gap data OUT 3  output from the adder FA. As shown in FIG. 2(f), the gap data OUT 3  correctly represents the actual discharge gap between the machining electrode H and the workpiece W. The gap data OUT 3  delivered from the adder FA is supplied to a drive control circuit DC. The drive control circuit DC controls the discharge gap between the machining electroce H and the workpiece W to maintain a predetermined gap in accordance with the gap data OUT 3 . It is to be noted that the drive control circuit DC is supplied with a machining instruction from a numerical control unit NC. The data S d  representing the machining condition which vary in accordance with the machining electrode H, the workpiece W, a machining fluid, etc. is also supplied from the numerical control unit NC. 
     As described above, according to the present invention, the discharge gap can be accurately detected over a wide range by combining gap data measurements based on peak voltage and other gap data based on waiting time. Thereby, the present invention effectively enlarges the controllable discharge gap range, so that a greatly increased machining speed is made possible.