# Patent

## Title
Method for full-digital random sampling

## Abstract

For the signal under acquisition which varies monotonically before and after the trigger time, a method for full-digital random sampling employs first sampled data before the trigger time and first sampled data after the trigger time to fit a curve, and obtains an intersection point of triggering level and the fitted curve, then, calculates the time interval between sampled data after the trigger time and the intersection point in the end, reconstructs the original signal, i.e. the signal under acquisition by a time interval of each acquisition. Thus, an analog trigger circuit and a time measurement circuit of conventional random sampling system can be eliminated, that simplifies the circuit design of data acquisition system and decreases its hardware complexity. Moreover, the higher sampling rate for the signal under acquisition is attained, and more waveform details are obtained.

## Background
FIELD OF THE INVENTION
This application claims priority under the Paris Convention to Chinese Patent Application No. 201410692582.4, Filed Nov. 26, 2014, the entirety of which is hereby incorporated by reference for all purposes as if fully set forth herein.
The present invention relates to the field of data acquisition, more particularly to a method for full-digital random sampling.
BACKGROUND OF THE INVENTION
Data acquisition technology have been widely applied to various fields, such as electronic measurement, communication, radar, aerospace and industry. With the development of technology and engineering application, the complexity of application system increases, and the frequency of the signal under acquisition (a continuous-time and continuous-amplitude analog signal, also called as input signal of DAS) is much higher than ever, that demands data acquisition system to raise its sampling rate. However, subject to the performance of analog-to-digital converter (ADC), it is rather difficult to dramatically enhance the real-time sampling rate of data acquisition system (DAS) to acquire enough waveform information of the signal under acquisition, some waveform information of the signal under acquisition will be lost, leading to the distortion of reconstructed signal. To solve the problem of the distortion of reconstructed signal, random sampling is employed to obtain ultrahigh sampling rate waveform information of periodic signal through multiple sampling.
Random sampling, belonging to non-real-time sampling, is an equivalent sampling, which uses the randomness of sampling signal relative to the signal under acquisition and triggering event to obtain high sampling rate through multiple acquisition and data merging. In practice, considering the randomness of the time interval between the trigger time and the first sampling time after the trigger, Random sampling uses high precise time interval measurement to obtain the time interval, and then reconstruct the original signal i.e. the signal under acquisition with higher sampling rate on basis of the time interval of each acquisition. The process of acquiring, storing and reconstructing of the signal under acquisition is shown in FIG. 1.
As shown in FIG. 1, random sampling employs sampling clock of period Ts (sampling rate of ADC) to acquire the sampled data of the signal under acquisition multiple times (supposing the number of acquisition times is N), and multiple pluralities of sampled data dij do are obtained, then stored in acquisition normal sequence (acquisition storage). Wherein, i is acquisition serial number and j is the sampled data sequence number. After the acquisition storage, there is reconstruction storage, the ith storage of sampled data is based on the time interval ti between trigger time Tri of the ith acquisition and the first sampling time after the trigger of the ith acquisition. The waveform of the original signal, i.e. the signal under acquisition will be reconstructed with sampled data of the reconstruction storage (waveform reconstruction).
Given the measurement resolution is Ts/M, equivalent sampling rate of reconstructed waveform is M times original sample rate, i.e. M/Ts. That makes the data acquisition system having much higher equivalent sampling rate, and the equivalent sampling rate is irrelevant to the sampling rate of ADC, but concerned only to the measurement accuracy of time interval ti, the higher equivalent sampling rate depends on the higher measurement accuracy of time interval ti.
FIG. 2 is a functional block diagram of the random sampling system in prior art.
The conventional random sampling is realized on the basis of analog circuits and logic devices. As shown in FIG. 2, the conventional random sampling system comprises signal conditioning circuit, analog trigger channel, analog-to-digital converter (ADC), field programmable gate array (FPGA), digital signal processor (DSP), sampling clock generator, time interval measurement module, etc.
After conditioned by signal conditioning circuit, the signal under acquisition is sampled and quantized by ADC, and then the sampled data SDATA and synchronous clock DCLK is sent to FPGA. At the same time, the trigger is also sent from analog trigger channel to the FPGA. Every time when acquisition begins, the FPGA opens the writing enable wen to store a section (pre-triggering depth) of pre-triggering sampled data to the FIFO of FPGA, then opens reading enable ren to maintain the volume of pre-triggering sampled data with pre-triggering depth, waiting for triggering event. When the triggering event (e.g. rising or falling edge of the signal under acquisition) comes, the analog trigger channel sends a trigger signal to FPGA, and then FPGA closes reading enable ren, and generates a measurement pulse based on the time interval ti between trigger time Tri of the ith acquisition and the first sampling time after the trigger of the ith acquisition. The measurement pulse is sent to the time interval measurement module for measuring. When the FIFO of FPGA attains sampled data up to the volume required, an acquisition is accomplished. FPGA closes writing enable wen, and calculates the corresponding address of the plurality of sampled data for back-end waveform display according to the result of time interval of the acquisition. The process of acquisition and time interval measurement is repeated multiple times, and multiple pluralities of sampled data are obtained. Each plurality of sampled data is stored according to the calculated corresponding address. The waveform reconstruction of data acquisition is realized based on stored sampled data. Considering the frequency irrelevance of the sampling clock and the signal under acquisition, the sampled data in FIFO can cover all locations after some time. As shown in lower part of FIG. 1, the signal under acquisition is completely reconstructed when displayed. The processes mentioned above are regulated by digital signal processor (DSP).
The aforementioned random sampling can solve the problem of high-frequency signal acquisition that cannot meet the Nyquist sampling theorem, but its hardware circuit is rather complicated. With regard to the signal under acquisition, which frequency is relatively not much higher comparing to the sampling clock, but required more specific waveform details, the random sampling mentioned above is dispensable.
SUMMARY OF THE INVENTION
The present invention aims to overcome the deficiencies of prior art and provides a method for full-digital random sampling to decrease the hardware complexity of data acquisition, and realize the data acquisition of signal with high sampling rate and more waveform details.
To achieve these objectives, in accordance with the present invention, a method for full-digital random sampling is provided, comprising the following steps:
(1) Random Sampling and Storing
acquiring the sampled data of signal under acquisition by the ADC of random sampling system, wherein, the signal under acquisition varies monotonically before and after the trigger time, and in the monotonic section, a sampled data can be obtained before and after the trigger time respectively;
sending the sampling command randomly by controller of data acquisition system to open the writing enable (wen) of the FIFO (First In First Out) for storing sampled data from the ADC;
when pre-triggering depth Lp of the FIFO is attained, opening the reading enable (ren) of the FIFO to maintain the volume of sampled data with depth Lp; meanwhile, detecting whether the sampled data is satisfied with the triggering condition, once satisfied, closing the reading enable (en) of the FIFO; and when the storage depth Ls of an acquisition is attained, closing the writing enable (wen) of the FIFO; by this moment, the range of sampled data in the FIFO is [dn−Lp+1,dn+Ls−Lp], where 1≦Lp≦Ls, the trigger is between the sampled data dn and dn+1, where n is the position of the first sampled data before the trigger and n+1 is the position of the first sampled data after the trigger;
(2) Curve Fitting and Trigger Relocating
fitting a curve on the basis of sampled data dn and dn+1, the intersection point TrL of triggering level AT and the fitted curve can be obtained, then calculating the time interval tL between sampled data dn+1 and the intersection point TrL:
(3) Waveform Reconstructing
according to step (1) and step (2), repeating the process of acquisition and time interval calculation, and multiple pluralities of sampled data dij and the time interval tLi of each acquisition are obtained, where i is the acquisition serial number, iεN, N is the number of acquisition, j is sampled data sequence number; then, interlacing the multiple pluralities of sampled data dij by ascending order of the time interval tLi and storing the interlaced multiple pluralities of sampled data dij; in the end, reconstructing the original signal i.e. the signal under acquisition with the interlaced multiple pluralities of sampled data dij.
The objectives of the present invention are realized as follows:
For the signal under acquisition which varies monotonically before and after the trigger time, the present invention, i.e. method for full-digital random sampling employs the first sampled data (dn) before the trigger time and the first sampled data (dn+1) after the trigger time to fit a curve, and obtains a intersection point TrL of triggering level AT and the fitted curve, then, calculates the time interval tL between sampled data dn+1 and the intersection point TrL, in the end, reconstructs the original signal. i.e. the signal under acquisition by the time interval tLi of each acquisition. Thus, an analog trigger circuit and a rime measurement circuit of conventional random sampling system can be eliminated, that simplifies the circuit design of data acquisition system and decreases its hardware complexity. Moreover, the higher sampling rate for the signal under acquisition is attained, and more waveform details are obtained.



BRIEF DESCRIPTION OF THE DRAWING
The above and other objectives, features and advantages of the present invention will be more apparent from the following detailed description taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a diagram of the acquiring, storing and reconstructing of the signal under acquisition in conventional random sampling;
FIG. 2 is a functional block diagram of conventional random sampling system;
FIG. 3 is a functional block diagram of a random sampling system in accordance with the present invention:
FIG. 4 is a diagram of digital triggering and storage controlling in accordance with the present invention;
FIG. 5 is a diagram of trigger relocating based on linear fitting in accordance with the present invention;
FIG. 6 is a diagram of trigger relocating based on sinusoidal fitting in accordance with the present invention:
FIG. 7 is a diagram of the processing of sampled data (the signal under acquisition is sinusoidal wave) in accordance with the present invention;
FIG. 8 is another diagram of the processing of sampled data (the signal under acquisition is square wave) in accordance with the present invention.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
Hereinafter, preferred embodiments of the present invention will be described with reference to the accompanying drawings. It should be noted that the similar modules are designated by similar reference numerals although they are illustrated in different drawings. Also, in the following description, a detailed description of known functions and configurations incorporated herein will be omitted when it may obscure the subject matter of the present invention.
Random sampling is a method that can enhance equivalent sampling rate effectively to obtain more details of a periodic signal. It repeatedly acquires the sampled data of a periodic signal at relatively lower sampling rate according to the irrelevance between the sampling clock and the signal under acquisition, and multiple pluralities of sampled data and the time interval of each acquisition are obtained. Then, it reconstructs the signal under acquisition with higher equivalent sampling rate according to the ordinal relations of the multiple pluralities of sampled data.
The present invention removes analog triggering channel and time interval measurement module from the conventional random sampling system, and uses digital signal processing (random sampling and storing, curve fitting and trigger relocating) to determine the ordinal relation of the multiple pluralities of sampled data for waveform reconstructing, in the end, reconstructs the original signal i.e. the signal under acquisition.
FIG. 3 is a functional block diagram of a random sampling system in accordance with the present invention.
In one embodiment, as shown in FIG. 3, after conditioned by signal conditioning circuit, the signal under acquisition is sampled and quantized by ADC, and then the sampled data SDATA and synchronous clock DCLK is sent to FPGA. The sampled data SDATA is stored and processed in FPGA or DSP, which comprises random sampling and storing, curve fitting and trigger relocating, and waveform reconstructing. Comparing to FIG. 1, the random sampling system in accordance with present invention has eliminated the analog trigger channel and time interval measurement module. While, a digital trigger controlling module is added before the sampled data storage to generate an effective triggering signal, and curve fitting and trigger relocating module is added after the sampled data storage to find the ordinal relation of the multiple pluralities of sampled data. In the end, the reconstructing of the signal under acquisition can be realized.
In accordance with the present invention, the method for full-digital random sampling comprises the following steps: random sampling and storing, curve fitting and trigger relocating, and waveform reconstructing.
1. Random Sampling and Storing
Random sampling and storing consists of digital trigger controlling and sampled data storage, digital trigger controlling provides an important basis for sampled data storing. The principle of random sampling and storing is shown in FIG. 4.
In one embodiment of present invention. As the controller of data acquisition system. DSP sends the sampling command randomly, to open the writing enable (wen) of the FIFO (First in First Out) for storing sampled data from the ADC.
When pre-triggering depth Lp of the FIFO is attained. DSP opens the reading enable (ren) of the FIFO to maintain the volume of sampled data with depth Lp; meanwhile, the digital trigger controlling module detects whether the sampled data is satisfied with the triggering condition. Assuming triggering level is AT and the triggering condition is a negative edge, so the criterion that sampled data dn and dn+1 is satisfied with the triggering condition is:

dn≧AT, and dn+1<AT  (1).

Similarly the triggering condition is a positive edge, the criterion that sampled data dn and dn+1 is satisfied with the triggering condition is:

dn≦AT, and dn+1>AT  (2).

Once satisfied, DSP closes the reading enable (ren) of the FIFO. And when the storage depth Ls of an acquisition is attained. DSP closes the writing enable (wen) of the FIFO. By this moment, the range of sampled data in the FIFO is [dn−Lp+1, dn+Ls−Lp], where 1≦Lp≦Ls. As shown in FIG. 4, the triggering condition is a negative edge, after searching and analyzing, the digital trigger controlling module can find that the trigger is between d3 and d4, where n=3, d3 is the first sampled data before the trigger, d4 is the first sampled data after the trigger, and the range of sampled data in the FIFO is [d4−Lp,d3+Ls−Lp].
With the process of random sampling and storing mentioned above, not only the stored sampled data are satisfied with the storage depth, but also the preliminary position of trigger is obtained. And that lays the groundwork for the back end processing of sampled data.
2. Curve Fitting and Trigger Relocating
After the preliminary position of trigger is obtained, the signal under acquisition can be restored as accurately as possible through curve fitting on the basis of sampled data dn and dn+1, the more accurate position of trigger can be obtained by trigger relocating. And that provides the parameter for reconstructing the signal under acquisition with higher equivalent sampling.
The way of curve fitting depends on the specific characteristics of the signal under acquisition. The common ways involve linear fitting and sinusoidal fitting. As shown in FIG. 5 and FIG. 6. The more accurate position of trigger in sampled data is obtained through curve fitting on the basis of the preliminary position of trigger shown in FIG. 4.
FIG. 5 shows a diagram of trigger relocating based on linear fitting. Sampled data d3 and d4 are connected by a straight line, a intersection point TrL of triggering level AT and the straight line, i.e. the fitted curve can be obtained. The time interval tL between sampled data d4 and the intersection point TrL is:




  
    
      
        
          
            t
            L
          
          =
          
            
              
                
                  A
                  T
                
                -
                
                  d
                  4
                
              
              
                
                  d
                  3
                
                -
                
                  d
                  4
                
              
            
            ·
            
              T
              s
            
          
        
        ;
      
    
    
      
        (
        3
        )
      
    
  




where Ts is the sampling period of the ADC.
FIG. 6 shows a diagram of trigger relocating based on sinusoidal fitting. The model function of sinusoidal signal is y=αx sin(2πt/Tx+Φx)+Ax, where αx, Tx, φx, Ax and y represent amplitude, period, initial phase, DC offset and the amplitude of time t respectively. According to the model function of sinusoidal signal a equation is obtained as follows:

dj=αx·sin(2π·tj/Tx+φx)+Ax  (4):

where dj is the jth sampled data, tj is jth sampling time. Thus a four-parameter sinusoidal fitting problem is obtained. According to parameter estimation method, we can get their estimated values ãx, {tilde over (T)}x, {tilde over (φ)}x and Ãx. Therefore, the waveform expression after sinusoidal curve fitting is:




  
    
      
        y
        =
        
          
            
              
                a
                ^
              
              x
            
            ·
            
              sin
              ⁡
              
                (
                
                  
                    2
                    ⁢
                    
                      π
                      ·
                      
                        t
                        /
                        
                          
                            T
                            ^
                          
                          x
                        
                      
                    
                  
                  +
                  
                    
                      φ
                      ^
                    
                    x
                  
                
                )
              
            
          
          +
          
            
              
                A
                ^
              
              x
            
            ⁢
            
              
            
            .
          
        
      
    
    
      
        (
        5
        )
      
    
  




And the time of intersection point TrL is




  
    
      t
      T
    
    =
    
      
        
          
            T
            ^
          
          x
        
        
          2
          ⁢
          π
        
      
      ⁢
      
        arcsin
        ⁡
        
          [
          
            
              (
              
                
                  A
                  T
                
                -
                
                  
                    A
                    ^
                  
                  x
                
              
              )
            
            /
            
              
                a
                ^
              
              x
            
          
          ]
        
      
    
  
  ,




thus the time interval tL between sampled data d4 and the intersection point TrL is:





  
    
      
        
          t
          L
        
        =
        
          
            
              3
              ⁢
              
                
              
              ⁢
              
                T
                x
              
            
            -
            
              t
              T
            
          
          =
          
            
              3
              ⁢
              
                
              
              ⁢
              
                T
                s
              
            
            -
            
              
                
                  
                    T
                    ^
                  
                  x
                
                
                  2
                  ⁢
                  π
                
              
              ⁢
              
                
                  arcsin
                  ⁡
                  
                    [
                    
                      
                        (
                        
                          
                            A
                            T
                          
                          -
                          
                            
                              A
                              ^
                            
                            x
                          
                        
                        )
                      
                      /
                      
                        
                          a
                          ^
                        
                        x
                      
                    
                    ]
                  
                
                .
              
            
          
        
      
    
    
      
        (
        6
        )
      
    
  




Two kind of curve fitting and trigger relocating based on linear curve fitting and sinusoidal curve fitting are analyzed above. However, in practice, the ways of curve fitting and trigger relocating are not limited to the said ways, and different curve fitting mode can be employed due to different characteristics of signal under acquisition, so as more accurate position of trigger can be obtained.
3. Waveform Reconstructing
Repeating the process of acquisition and time interval calculation, and multiple pluralities of sampled data dij and the time interval tLi of each acquisition are obtained. Therefore, we can reconstruct the signal under acquisition with higher equivalent sampling.
Supposing that equivalent sampling rate of reconstructed signal f0 is M times the sampling rate of ADC fs, the time resolution of reconstructed signal is Δt=Ts/M. Meanwhile, the digital trigger interval is divided into M subintervals [Δt·(k−1), Δt·k), where k=1, 2, . . . , M. Then, the position ki of the ith storage of sampled data meets the condition:

tLiε[Ts·(ki−1)/M,Ts·ki/M)  (7).

For example, if the time interval tLi of ith acquisition satisfies the equation (7), then the address of the plurality of sampled data are αj−M+ki, which is shown in FIG. 7, where ki=2. i.e. as a set of M successive addresses, the sample data in ith acquisition is stored in the 2nd address and so forth. Therefore, time intervals tLi are sorted by the ascending order so as to interlace and recombine the data dij from each acquisition successively.
FIG. 8 shows another diagram of the processing of sampled data. The signal under acquisition is square wave. The random sampling is similar to FIG. 7. The sampling rate is enhanced dramatically, and more accurate reconstructed signal is obtained.
After the aforementioned analysis, the key to present invention is the accuracy of trigger relocating and, in practice, it is determined by the accuracy of curve fitting. However, the accuracy of curve fitting is correlated with the jitter of sampling clock edge. Thus the data acquisition system needs sampling clock with lower jitter to acquire high resolution sampled data.
In the embodiment mentioned above, sinusoidal fitting and linear fitting are employed for trigger relocating, which has a significant effect on enhancing equivalent sampling rate when the signal under acquisition varies monotonically near the trigger. With regard to more complicated signal under acquisition, we should use more precise curve fitting method such as fuzzy matching, neural network, etc to enhance the accuracy of trigger relocating, in the end, to enhance the equivalent sampling rate.
SUMMARIZATION
The innovation of the present invention lies in: (i) overcoming the deficiencies of conventional random sampling in prior art by full-digital processing, i.e. high hardware performance and complicated structure: (ii) providing an effective way to relocate the trigger through curve fitting. The present invention is now applied only to the signal which vanes monotonically near the trigger, yet new research orientation on full-digital random sampling is exploited, and a new pathway on signal feature extraction for data postprocessing is proposed.
While illustrative embodiments of the invention have been described above, it is, of course, understand that various modifications will be apparent to those of ordinary skill in the art. Such modifications are within the spirit and scope of the invention, which is limited and defined only by the appended claims.

## Claims

1. A method for full-digital random sampling, the method comprising the following steps:
(1). Acquisition of Sampled Data
acquiring sampled data of a signal by an analog-to-digital converter (ADC) of a random sampling system, the signal under acquisition varying monotonically before and after a trigger time, and in a monotonic section of the signal, a sampled data can be obtained before and after the trigger time respectively;
sending a sampling command randomly by a controller of a data acquisition system to open a writing enable (wen) of a FIFO (First In First Out) for storing sampled data from the ADC;
when attaining a pre-triggering depth Lp of the FIFO:
opening a reading enable (ren) of the FIFO to maintain a volume of sampled data with depth Lp;
detecting whether the sampled data is satisfied with a triggering condition; and
if the sampled data satisfies the triggering condition, closing the reading enable (ren) of the FIFO; and

when attaining a storage depth Ls;
closing the writing enable (wen) of the FIFO such that a range of sampled data in the FIFO is [dn−Lp+1,dn+Ls−Lp], where 1≦Lp≦Ls, the trigger being between a sampled data dn and dn+1, where n is the position of a first sampled data before the trigger and n+1 is the position of the first sampled data after the trigger;


(2). Time Interval Calculation
fitting a curve based on the sampled data dn and dn+1, obtaining a intersection point TrL of a triggering level AT and the fitted curve, and calculating a time interval tL between sampled data dn+1 and the intersection point TrL;

(3). Waveform Reconstruction
according to step (1) and step (2), repeating the process of acquisition and time interval calculation, and obtaining multiple pluralities of sampled data dij and time intervals tLi of each acquisition, where i is a acquisition serial number, iεN, N is a number of acquisitions, j is sampled data sequence number;
interlacing the multiple pluralities of sampled data dij by ascending order of the time interval tLi, and storing the interlaced multiple pluralities of sampled data dij; and,
reconstructing the signal under acquisition with the interlaced multiple pluralities of sampled data dij.

2. The method for full-digital random sampling of claim 1, wherein the triggering level is AT, such that:
if the triggering condition is a negative edge, the criterion that sampled data dn and dn+1 satisfies the triggering condition is:


dn≦AT, and dn+1<AT; and


if the triggering condition is a positive edge, the criterion that sampled data dn and dn+1 satisfies the triggering condition is:


dn≦AT, and dn+1>AT.

3. The method for full-digital random sampling of claim 1, wherein the curve is fitted by a method of linear fitting or sinusoidal fitting.