Abstract:
Peak detection is conducted by converting a continuous waveform into discrete samples. The discrete samples are evaluated to identify three points near a peak of the continuous waveform. After the three points near the peak are identified, they are stored in a discrete domain data structure which is used in conjunction with a table generated from a continuous transformation function in order to identify an accurate peak amplitude and time.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention is directed to precise waveform peak detection, and is more particularly directed to an apparatus and methodology which efficiently provides high accuracy peak amplitude and time identification for a wide bandwidth. 
     2. Description of Related Art 
     Analog peak detectors generally fall into two categories; very accurate with a narrow bandwidth or inaccurate with a wide bandwidth. At low frequencies (e.g., audio), it is possible to use operational amplifiers to build precision peak detectors. These configurations can be very accurate, but fall prey to narrow bandwidth limitations. Other analog designs have much wider bandwidths (up to a few MHz), but fall prey to inaccuracies that are due to non-linear gain functions which limit useful operation to a small amplitude range. Furthermore, their use is generally acceptable only when errors of several percent can be tolerated. 
     The alternate approach to analog peak detection is through digital analysis of waveforms. This involves the use of an analog-to-digital converter (ADC) that digitizes an input signal with an evaluation of the resulting discrete values conducted in order to identify signal peaks and their corresponding characteristics (i.e., amplitude and time of occurrence). One particular method consists of very high speed ADC sampling and subsequent digital magnitude comparisons. While this is a straightforward approach, typically the sample rate of an ADC is not fast enough to guarantee that a data point is taken at the exact time of the signal peak. Instead, a sample on either side of the peak is identified as the true peak, thereby resulting in a reported peak value which is somewhat smaller than the actual value. 
     For high frequency input signals, e.g. several MHZ, it is also difficult to obtain an ADC sample rate that is sufficient to provide high precision identification. For a simple sine wave input, the minimum required sample rate that provides an accuracy of 0.01% is 223 times the input frequency. Currently, the fastest single twelve bit ADC chip has a maximum sample rate of approximately 40 million samples per second (MSPS), which would limit the input frequency to 400 kHz if the sample error is to be less than 0.05%, or 4.0 MHZ for an error no larger than 1.0%. 
     It is possible to increase the effective sampling rate of an ADC by incorporating an interpolation circuit. With an interpolation circuit, additional samples are provided between the measured points. However, the drawback is that the input bandwidth must be limited to avoid inducing errors into the interpolated values. 
     Faster sampling rates may also be obtained by using ten bit, eight bit, or six bit ADCs. However, the accuracy is then limited by the resolution of the ADC. Generally, the nominal input signal is scaled to approximately two-thirds of full scale. At this input sampling rate, the error due to ADC quantization is 0.073% for a twelve bit ADC, 0.293% for a ten bit ADC, 1. 172% for an eight bit ADC, and 4.688% for a six bit ADC. Therefore, current ADC technology provides peak detection that is limited to low frequencies (less than about 1 MHZ) if good accuracy (better than about 0.5%) is required. Furthermore, at high sample rates, it is difficult to design a digital magnitude comparator which will adequately examine the ADC output for peak identification. In addition, this method provides a peak time which is only known to within one ADC sample interval, which is not accurate enough for some applications. 
     An additional ADC peak determination methodology consists of utilizing an ADC that is triggered to measure only at the input signal peaks. This method has the problem of generating an appropriate trigger signal. It is not possible to generate a trigger at the time of the peak, but rather a trigger is presented which is delayed by a fixed amount of time after the peak has occurred. This is due to the process selecting a peak based upon a detected decrease in amplitude. Therefore, the analog signal must be delayed without distortion and the delay must exactly equal the delay in the trigger circuit. However, it is very difficult to build a wide band analog delay which does not distort the input signal. In addition, it is also very difficult to match the delays of the trigger circuit and the analog delay. 
     The trigger circuit must detect the time of the peak with great accuracy. The delay from the input signal peak to the trigger output must also be very stable. Timing variation in the trigger circuit causes significant error in the recorded peak value. If a desired amplitude accuracy of 0.05% is desired, the differences in the time delay of the analog delay element and the trigger channel must be 5.03×10 -3  the input period. For example, with a one MHZ sine wave input, a timing accuracy of ±7.1 nanoseconds is required to maintain an amplitude accuracy of 0.1%. Furthermore, to determine the timing of the peaks requires additional circuitry (i.e., a digital time interval analyzer which measures the timing of a trigger output). 
     Based upon the foregoing, it is an object of the present invention to provide peak detection which has a high degree of accuracy for a wide bandwidth. Furthermore, it is an object of the present invention to provide the accurate and wide bandwidth peak detection using an apparatus and methodology which is relatively inexpensive to implement. 
     SUMMARY OF THE INVENTION 
     In accordance with the teachings of the present invention, a method for detecting a peak in a continuous waveform is provided. The method consists of representing the continuous waveform as discrete data, examining the discrete data to identify at least one discrete data peak. Storing in a discrete domain data structure having at least one record that identifies the discrete data peak and identifies at least two discrete data in a proximally adjacent neighborhood to the discrete data peak. Providing at least one continuous domain transformation process that defines a relationship between discrete data and continuous data, and using the at least one record to access the continuous domain transformation process to identify the peak in the continuous waveform. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     Other objects and advantages of the invention will become apparent upon reading the following detailed description and upon reference to the following drawings, in which: 
     FIG. 1 is a block diagram of the waveform peak detector of the preferred embodiment of the present invention; 
     FIG. 2 is a schematic illustrating additional details of the peak area locator in further detail; 
     FIG. 3 is a schematic illustrating additional details of the peak formatter in further detail; and 
     FIG. 4 is an illustration of three sampled points utilized to calculate the true peak with a least squares curve fit second order polynomial. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     The following description of the preferred embodiment is merely exemplary in nature and is in no way intended to limit the invention or its application or uses. 
     FIG. 1 shows the peak detector 20 according to the preferred embodiment of the present invention. An input waveform 22 is presented to an analog-to-digital converter (ADC) 24, which samples at a constant rate. In this particular embodiment, the ADC 24 is followed by a 2:1 interpolator circuit 26 which effectively doubles the effective sampling rate of the ADC 24. However, when the interpolator 26 is utilized, the input of the peak detector 20 must be restricted to frequencies below a threshold value, otherwise errors will be introduced due to the interpolation process. The data from the ADC 24 and interpolator 26 are presented to the peak area locator 28 which identifies three points nearest the peak of the input waveform 22. 
     After a peak has been located by the locator 28, the three data points and the time stamp corresponding to the second sample are formatted by the peak formatter 29. This digital circuit performs some basic mathematical operations and produces a single data word 30 which is transferred to memory 32. A processor 110 is provided which utilizes the data word 30 in order to perform an indexing operation in two pre-calculated tables. The peak amplitude table 114 contains the resulting values for determining the true amplitude of the peak (y peak  (Actual)), and the peak time table 112 has the resulting values for determining the true time of the peak (t peak  (Actual)). This configuration produces a very precise identification of the peak amplitude and time, while minimizing processing time. 
     FIG. 2 shows the peak area locator 28 in further detail. The three points near the peak are identified by this locator 28 through a sequential evaluation of the measured values provided by the ADC 24 and interpolator 26. In order to locate a series of three samples which are near a peak, the following four characteristics of three consecutive samples are sought: (1) the second value is greater than or equal to the first value; (2) the second value is greater than or equal to the third value; (3) the second value is greater than the currently latched peak value; and (4) all three values are greater than a threshold value. Only when these requirements are met will the three measurements be transferred to the peak formatter and ultimately to memory, for subsequent peak amplitude and time determination. 
     The peak area locator 28 has a time counter 34, data pipeline 36, and a peak detection block 38. There are actually two peak detection blocks, one for positive peak detection and another for negative peak detection. However, in order to maintain simplicity and clarity in this description, only the positive peak detection block 38 is shown. 
     The locator 28 receives the output from the 2:1 interpolator 26 and the ADC 24, with the output of the interpolator 26 representing the earlier of the two samples. The two samples are compared by comparator 40 and the larger of the two is selected by multiplexor 42 and passed to an intermediate data latch 44. The output of the intermediate data latch 44 is provided as one of the inputs to a three input multiplexor 46. The three input multiplexor 46 selects the value which is to be provided to the current peak latch 48. The other two inputs to this three input multiplexor 46 are one-half the value of the current peak amplitude, as provided by the divider 50, and the noise threshold input 52, which is a user selected value. 
     The divider 50 and noise threshold 52 inputs are used to prevent false triggering on noise. These two inputs provide both a fixed and variable threshold level, with the larger of the two values used as the limiting factor. 
     The comparison between the current peak value and the newly acquired value, as held by the intermediate data latch 44, and the comparison between one half the current peak value and the noise threshold 52, are conducted by comparators (54, 56), with the comparison results provided as input to the peak detector state machine 58. Based upon the comparison results, the peak detector state machine 58 provides the corresponding commands to the three input multiplexor 46, current peak latch 48, peak time stamp latch 60, peak +1 amplitude latch 62, and peak -1 amplitude latch 64, allowing the current peak data points and the associated peak time stamp to be updated when a larger peak is found. 
     The peak detector state machine 58 also analyzes the sign bits 65 of the two data points provided by the ADC 24 and interpolator 26 in order to determine if the input signal has crossed zero. When the signs differ between the two input values, the peak detector state machine 58 provides a strobe which indicates that the peak has been identified for the current interval, and that the peak amplitude and time are to be calculated with the three currently held data points. 
     FIG. 3 shows the digital circuit of the peak formatter 29 in further detail. The formatter 29 receives the three data samples from the peak area locator and calculates arguments of (y 2  -y 1 ) and (y 3  -y 2 ) which are subsequently used by the processor in a table look-up operation for the true peak time and amplitude. As can be seen, the formatter 29 receives both positive peak information 68 and the negative peak information 70. The peak formatter state machine 71 controls the processing of either the positive peak information 68 or negative peak information 70 based upon the mode select information 69 as received from the peak area locator. 
     The positive and negative peak information (68, 70) is initially stored in receipt latches (72, 73) that pass the data to four multiplexors (74, 76, 78, 80) which receive the peak time stamp, peak amplitude, peak +1  amplitude, and peak -1  amplitude. The state machine 71 provides the necessary commands to allow proper processing of either negative or positive peak information, which is then stored in four intermediate data latches (82, 84, 86, 88). 
     Three of the intermediate data latches (82, 84, 86, 88), holding the values for the peak -1 , peak +1 , and peak amplitude (i.e., y 1 , y 3  and y 2 ), are provided to two comparators (90, 94) in order to calculate the amplitude difference between the point nearest the peak (y 2 ) and the adjacent samples (y 1  and y 3 ). The results from the comparators (90, 94) are provided two difference latches (92, 96), which will hold the resulting values of (y 2  -y 1 ) and (y 3  -y 2 ). 
     Under the control of the state machine 71, the arguments contained in the difference latches (92, 96) and the single value of y 2  and peak time stamp held in final position data latches (97, 98), are subsequently formatted into a single data word by the two final stage multiplexors (100, 102), resulting differences data latch 104, and complete word data latch 106. The resulting word held by the complete word data latch 106 thereby has the second data sample time stamp, and values for (y 2  -y 1 ) and (y 3  -y 2 ), which is used for the subsequent table look-up operation. 
     The foregoing identification of the peak amplitude and time with the three selected points is based upon a least squares curve fit to a second order polynomial. Examination of the least squares fitted polynomial may then be used to find the time of the true peak. Specifically, this is done by identifying where the rate of change (i.e. differential of the corresponding second order polynomial) is zero. Once the time of the true peak is identified, the original second order polynomial may be used in order to determine the exact amplitude of the peak. Referring to FIG. 4, the peak calculations are based upon the fact that the three measured points (130, 132, 134) are fitted to a polynomial which describes the curve 136. 
     The polynomial which describes curve 136 is of the form: 
     
         y(t)=a.sub.1 t.sup.2 +a.sub.2 t+a.sub.3                    (1) 
    
     where: 
     y=signal amplitude 
     t=time, and 
     a 1 , a 2 , a 3  =constants. 
     The derivative of this polynomial has the form: 
     
         y&#39;(t)=2a.sub.1 t+a.sub.2                                   (2) 
    
     with the peak occurring when equation (2) is equal to zero or when: 
     
         t=-a.sub.2 /2a.sub.1                                       (3) 
    
     with the peak amplitude expressed as: 
     
         y.sub.peak =a.sub.3 -(a.sub.2.sup.2 /(4a.sub.1))           (4) 
    
     Therefore, in order to determine the peak amplitude and time, constants a 1 , a 2 , and a 3  must be determined. 
     The three constants may be determined by realizing that all three measured points must fit the polynomial equation of equation (1), or alternatively, that the following three equations must be satisfied: 
     
         y.sub.1 (t.sub.1)=a.sub.1 t.sub.1.sup.2 +a.sub.2 t.sub.1 +a.sub.3 (5) 
    
     
         y.sub.2 (t.sub.2)=a.sub.1 t.sub.2.sup.2 +a.sub.2 t.sub.2 +a.sub.3 (6) 
    
     
         y.sub.3 (t.sub.3)=a.sub.1 t.sub.3.sup.2 +a.sub.2 t.sub.2 +a.sub.3 (7) 
    
     Equations (5) through (7) can be expressed in matrix form as: 
     
         Y=Ta                                                       (8) 
    
     where: ##EQU1## As previously indicated, the waveform samples are taken by the ADC at a constant rate, therefore the measurements for the three points are equally spaced. This allows equation (8) to be greatly simplified by defining the time of the second sample t 2  to be 0, the time of the first sample t 1  to be -T, and the time of the third sample t 3  to be +T, where T is the ADC sample period. 
     Based upon these interval definitions, equation (8), in matrix form, becomes: ##EQU2## Equation (9) can be further simplified if the time interval is scaled such that T=1. With this, equation (9) simplifies to: ##EQU3## From equation (10), a 1 , a 2 , and a 3  may be calculated using numerical computation techniques. 
     Calculation of the peak amplitude and time directly from the foregoing equations is processor intensive when a large number of data points are involved. This is due to the evaluation of each equation requiring multiple additions, multiplications, and divisions. Therefore, in order to process a large quantity of data in an expedient and efficient manner, the preferred embodiment uses the previously described digital circuitry to perform a portion of the calculations, yielding index values which are then used to retrieve the resulting values from precalculated lookup tables. These lookup tables contain precalculated values which need only be calculated once (in this illustration, at the time of initialization). 
     Referring to FIG. 1, the peak formatter 29 generated values of (y 2  -y 1 ) and (y 3  -y 2 ) are used by the processor 110 as an index into the peak time table 112 and peak amplitude table 114, which were initialized with precalculated values. In the preferred embodiment, each table contains 220 entries with each entry being a two byte integer. This means that the two tables require a total of four megabytes of memory, and allows the processor 110 to perform time consuming calculations only once, thereby reducing the run time calculation time. 
     The use of (y 2  -y 1 ) and (y 3  -y 2 ) in order to determine the peak time and amplitude is based upon the fact that a 1 , a 2 , and a 3  can be expressed in terms of y 1 , y 2 , and y 3 . Specifically, equation (10) may be solved for a 1 , a 2 , and a 3  in terms of y 1 , y 2 , and y 3  using an augmented matrix or other computational technique. This results in: 
     
         a.sub.3 =y.sub.2                                           (11) 
    
     
         a.sub.2 =(y.sub.3 -y.sub.1)/2                              (12) 
    
     
         a.sub.1 =(y.sub.3 -2y.sub.2 +y.sub.1)/2                    (13) 
    
     If equations (11)-(13) are inserted into equations (2) and (3), the following results: 
     
         y.sub.peak =y.sub.2 +(y.sub.3 -y.sub.1).sup.2 /(8(2y.sup.2 -y.sub.3 -y.sub.1))                                                (14) 
    
     and 
     
         t.sub.peak =(y.sub.3 -y.sub.1)/((2(2y.sub.2 -y.sub.3 -y.sub.1)) (15) 
    
     where t peak  is the time offset (Δt) 144 from the second measured point 132 (t 2 ), which is in multiples of the constant sample period that is used to simplify equation 9 (as shown in FIG. 3). 
     In order to calculate the look-up tables, equations (14) and (15) are modified to use the arguments (y 2  -y 1 ) and (y 3  -y 2 ). Specifically, the following definitions are made: 
     
         A=(y.sub.2 -y.sub.1)                                       (16) 
    
     
         B=(y.sub.3 -y.sub.2)                                       (17) 
    
     which are inserted into equations (14) and (15) so that: 
     
         y.sub.peak =y.sub.2 +((A+B).sup.2 /8(A-B))                 (18) 
    
     and 
     
         t.sub.peak =(A+B)/((2(A-B))                                (19) 
    
     Therefore, at initialization, a Y offset  look-up table is generated with a value corresponding to the arguments of (y 2  -y 1 ) and (y 3  -y 2 ) based upon: 
     
         Y.sub.offset =(A+B).sup.2 /8(A-B)                          (20) 
    
     In addition, a t offset  look-up table is generated at initialization with the (y 2  -y 1 ) and (y 3  -y 2 ) arguments from: 
     
         t.sub.offset =(A+B)/((2(A-B))                              (21) 
    
     Referring to FIG. 3, it can be seen that with a value for y offset  143 and a value for t offset  144, in conjunction with the time stamp and amplitude of the second sample point 132, a highly accurate determination of the amplitude and time of the true peak 145 may be made. It should be understood that as a result of scaling equation (10) by the ADC sample period, the values produced by equations (15), (19), and (21) are multiples of the this sample period. 
     Those skilled in the art can now appreciate from the foregoing description that the broad teachings of the present invention can be implemented in a variety of forms. The principles provided here are readily adaptable for many applications, as peak detection is an important and prevalent component in many applications and analysis tools. Therefore, the true scope of the invention is vast, and other modifications will become apparent to the skilled practitioner upon a study of the drawings, specifications and following claims.