Showing results for 
Search instead for 
Do you mean 

Digital Signal Processing: Sampling Rates, Bandwidth, Spectral Lines, and more…

by Siemens Genius Siemens Genius ‎04-13-2017 03:33 PM - edited ‎07-11-2017 06:59 PM

Siemens_4221_Scadas-XS_0239.jpg

Digital Signal Processing (DSP): Sampling Rates, Bandwidth, Spectral Lines, and more…

 

During digital data acquisition, transducers output analog signals which must be digitized for a computer.  A computer cannot store continuous analog time waveforms like the transducers produce, so instead it breaks the signal into discrete ‘pieces’ or ‘samples’ to store them.

 

Data is recorded in the time domain, but often it is desired to perform a Fourier transform to view the data in the frequency domain. There are unique terms used when performing a Fourier transform on this digitized data, which are not always used in the analog case.  They are listed in Figure 1 below:

 

Figure 1: Time domain and frequency domain terms used in performing a digital Fourier transformFigure 1: Time domain and frequency domain terms used in performing a digital Fourier transformWhether viewing digital data in the time domain or in the frequency domain, understanding the relationship between these different terms affects the quality of the final analysis. 

 

Time Domain Terms

  • Sampling Rate (Fs) – Number of data samples acquired per second
  • Frame Size (T) – Amount of time data collected to perform a Fourier transform
  • Block Size (N) – Total number of data samples acquired during one frame

Frequency Domain Terms

  • Bandwidth (Fmax) – Highest frequency that is captured in the Fourier transform, equal to half the sampling rate
  • Spectral Lines (SL)– After Fourier transform, total number of frequency domain samples
  • Frequency Resolution (Δf) – Spacing between samples in the frequency domain

 

Sampling Rate (Fs)

Sampling rate (sometimes called sampling frequency or Fs) is the number of data points acquired per second. 

 

A sampling rate of 2000 samples/second means that 2000 discrete data points are acquired every second.  This can be referred to as 2000 Hertz sample frequency.

 

The sampling rate is important for determining the maximum amplitude and correct waveform of the signal as shown in Figure 2

 Figure 2: In the top graph, the 10 Hertz sine wave sampled at 1000 samples/second has correct amplitude and waveform. In the other plots, lower sample rates do not yield the correct amplitude nor shape of the sine waveFigure 2: In the top graph, the 10 Hertz sine wave sampled at 1000 samples/second has correct amplitude and waveform. In the other plots, lower sample rates do not yield the correct amplitude nor shape of the sine waveTo get close to the correct peak amplitude in the time domain, it is important to sample at least 10 times faster than the highest frequency of interest.  For a 100 Hertz sine wave, the minimum sampling rate would be 1000 samples per second. In practice, sampling even higher than 10x helps measure the amplitude correctly in the time domain.

 

It should be noted that obtaining the correct amplitude in the frequency domain only requires sampling twice the highest frequency of interest.  In practice, the anti-aliasing filter in most data acquisition systems makes the requirement 2.5 times the frequency of interest. The Bandwidth section contains more information about the anti-aliasing filter.

 

The inverse of sampling frequency (Fs) is the sampling interval or Δt.  It is the amount of time between data samples collected in the time domain as shown in Figure 3.

 Figure 3: Sampling frequency and sampling interval relationshipFigure 3: Sampling frequency and sampling interval relationship

The smaller the quantity Δt, the better the chance of measuring the true peak in the time domain.

 

key1.png

 

Block Size (N)

The block size (N) is the total number of time data points that are captured to perform a Fourier transform.  A block size of 2000 means that two thousand data points are acquired, then a Fourier transform is performed.

 

Frame Size (T)

The frame size is the total time (T) to acquire one block of data. The frame size is the block size divided by sample frequency as shown in Figure 4.

 

Figure 4: Frame size (T) equals block size (N) divided by sample frequency (Fs)Figure 4: Frame size (T) equals block size (N) divided by sample frequency (Fs)

For example, with a block size of 2000 data points and a sampling rate of 1000 samples per second, the total time to acquire a single data block is 2 seconds. It takes two seconds to collect 2000 data points.

 

The total time frame size is also equal to the block size times the time resolution (Figure 5).

 

Figure 5: Frame size (T) equals block size (N) time the time resolution (t)Figure 5: Frame size (T) equals block size (N) time the time resolution (t)

When performing averages on multiple blocks of data, the term total amount of time might be used in different ways (Figure 6) and should not be confused:

 

  • Total Time to Acquire One Block – The frame size (T) is the time to acquire one data block, for example, this could be two seconds
  • Total Time to Average – If five blocks of data (two seconds each) are to be averaged, the total time to acquire all five blocks (with no overlap) would be 10 seconds

 

Figure 6: Five averages of 2 second framesFigure 6: Five averages of 2 second frames

The 'Throughput Processing knowledge base article' further explains the interaction between frames and averages.

 

Bandwidth (Fmax)

The bandwidth (Fmax) is the maximum frequency that can be analyzed.  The bandwidth is half of the sampling frequency (Figure 7).  The Nyquist sampling criterion requires setting the sampling rate at least twice the maximum frequency of interest. 

 

Figure 7: Bandwidth, or the maximum frequency, is half the sample frequency (Fs)Figure 7: Bandwidth, or the maximum frequency, is half the sample frequency (Fs)

A bandwidth of 1000 Hertz means that the sampling frequency is set to 2000 samples/second.

 

In fact, even with a sampling rate of 2000 Hz, the actual usable bandwidth can be less than the theoretical limit of 1000 Hertz. This is because in many data acquisition systems, there is an anti-aliasing filter which starts reducing the amplitude of the signal starting at 80% of the bandwidth.

Figure 8 - At 80% of the bandwidth, a anti-aliasing filter starts reducing the amplitude of the incoming signals.  The 'Span' represents the frequency range without any anti-aliasing filter effects.Figure 8 - At 80% of the bandwidth, a anti-aliasing filter starts reducing the amplitude of the incoming signals. The 'Span' represents the frequency range without any anti-aliasing filter effects.

For a bandwidth of 1000 Hertz, the anti-aliasing filter reduces the bandwidth to 800 Hertz and below. The filter attenuates frequencies above 800 Hertz in this case.

 

In LMS Test.Lab, under ‘Tools -> Options -> General’, it is possible to view only the usable bandwidth by switching to ‘Span’ under ‘Frequency’ as shown in Figure 9.

 

Figure 9: Under ‘Tools -> Options -> General’ switch to ‘Span’ instead of ‘Bandwidth’ if desiredFigure 9: Under ‘Tools -> Options -> General’ switch to ‘Span’ instead of ‘Bandwidth’ if desired ‘Span’ represents the actual useable bandwidth, and the switching to the ‘Span’ setting makes all the LMS Test.Lab displays show only 80% of the bandwidth.

 

Spectral Lines (SL)

After performing a Fourier transform, the spectral lines (SL) are the total number of frequency domain data points.  This is analogous to N, the number of data points in the time domain. There are two data ‘values’ at each spectral line – an amplitude and a phase value as shown in Figure 10

  

Figure 10: At each frequency there is an amplitude (top graph) and phase (bottom graph)Figure 10: At each frequency there is an amplitude (top graph) and phase (bottom graph)

Note that while the Fourier Transform results in amplitude and phase, sometimes the frequency spectrum is converted to an autopower, which eliminates the phase.

 

The number of spectral lines is half the block size (Figure 11).

 Figure 11: Spectral lines equals half the block sizeFigure 11: Spectral lines equals half the block size

For a block size of 2000 data points, there are 1000 spectral lines.

 

Frequency Resolution

The frequency resolution (Δf) is the spacing between data points in frequency. The frequency resolution equals the bandwidth divided by the spectral lines as shown in Figure 12.
Figure 12: Frequency resolution equals bandwidth (Fmax) divided by spectral lines (SL)Figure 12: Frequency resolution equals bandwidth (Fmax) divided by spectral lines (SL)For example, a bandwidth of 16 Hertz with eight spectral lines, has a frequency resolution of 2.0 Hertz (Figure 13). 

 

Figure 13: Frequency resolution equals bandwidth (Fmax) divided by spectral lines (SL)Figure 13: Frequency resolution equals bandwidth (Fmax) divided by spectral lines (SL)The eight frequency domain spectral lines are spread evenly between 0 and 16 Hertz, which results in the 2.0 Hertz spacing on the frequency axis. Note that 0 Hertz is not included in the spectral line total.  The calculated value at zero Hertz represents a constant amplitude DC offset. For example, if a 1 Volt sine wave alternated around a 5 Volt offset, the offset value would be placed at zero Hertz, while the sine wave's 1 Volt amplitude would be placed at the spectral line corresponding to the sine wave's frequency.

 

Digital Signal Processing Relationships

Putting the above relationships together, the different digital signal processing parameters can be related to each other (Figure 14).

 

Figure 14: Digital signal processing relationshipsFigure 14: Digital signal processing relationships

This can be boiled down to one ‘golden equation’ of digital signal processing (Figure 15) which related frame size (T) and frequency resolution (Δf):

 

Figure 15: The ‘golden equation’ of digital signal processingFigure 15: The ‘golden equation’ of digital signal processingThis means that:

  • The finer the desired frequency resolution, the longer the acquisition time
  • The shorter the acquisition time, or frame size, the coarser the frequency resolution

The frequency resolution is important to accurately understand the signal being analyzed.  In Figure 16, two sine tones (100 Hertz and 101 Hertz) have been digitized, and a Fourier Transform performed. This was done with two different frequency resolutions: 1.0 Hertz and 0.5 Hertz.

  Figure 16: Left – Spectrum with 1.0 Hertz frequency resolution makes two separate tones appear as one peak.  Right - Spectrum with 0.5 Hertz frequency resolution makes two separate tones appear as two different peaks.Figure 16: Left – Spectrum with 1.0 Hertz frequency resolution makes two separate tones appear as one peak. Right - Spectrum with 0.5 Hertz frequency resolution makes two separate tones appear as two different peaks.

With the finer frequency resolution of 0.5 Hertz, rather than 1.0 Hertz, the spectrum shows two separate and distinct peaks.  The benefit of a finer frequency resolution is very obvious. This might beg the question, why not use the finest frequency resolution possible in all cases?

 

There is a tradeoff. Per the ‘golden equation’ the amount of time data per frame is higher as the frequency resolution is made finer (Figure 13).  This can cause requirements for long time data acquisition:

  • 10 Hz frequency resolution is desired, only 0.1 seconds of data is required
  • 1 Hertz frequency resolution requires 1 second of data
  • 0.1 Hertz frequency resolution requires 10 seconds of data
  • 0.01 Hertz frequency resolution requires 100 seconds of data!

In some situations, these long time acquisition requirements are not practical.  For example, a sports car may go from idle to full speed in just 4 seconds, making a 100 second acquisition, and the corresponding 0.01 frequency resolution, impossible.

 key2.png

 

 

LMS Test.Lab Settings

 

In LMS Test.Lab, depending on the software module, only some of these parameters may be settable by the user.  However, the digital signal processing relationships are still in effect. For example, when setting the bandwidth to 1024 Hz and spectral lines to 2048 as shown in Figure 17, several other parameters are automatically set.

 

Figure 17: LMS Test.Lab acquisition parametersFigure 17: LMS Test.Lab acquisition parametersFor these settings, the frame size is 2 seconds (inverse of frequency resolution).  The sampling frequency is 2048 samples per second, or 2048 Hertz.

 

Note: Why are the sampling rates and block sizes all powers of two? In the digital world, the Fast Fourier Transform (FFT) and the Discrete Fourier Transform (DFT) are computer algorithms used to perform a Fourier Transform.  The Fast Fourier Transform requires a block size that is a power of two (1024, 2048, 4096, etc.) and is computationally quicker than the DFT, which can use any number of data points. With today’s modern computers, the differences in speed are not as noticeable in the past.  But due to historical reasons many data acquisition systems still use power of two numbers.

 

Conclusions

 

Hopefully this article will be a useful reference for performing digital data acquisition.  Some of the key points discussed:

 

  • Sampling frequency (Fs) must be set properly to capture the correct amplitude:
    • High as possible to capture peak amplitude in time domain.  Should be set no lower than 10x the highest frequency of interest.
    • At least two times higher than the highest frequency of interest for the frequency domain.  This would be at least 2.5x higher if accounting for an anti-aliasing filter.
  • There is an inverse relationship (the ‘golden equation’) relating frequency resolution (Δf) and frame size time (T)

Questions? Contact us!

 

Related Links:

 

Contributors