Cancel
Showing results for 
Search instead for 
Did you mean: 

Gain, Range, and Quantization

Siemens Experimenter Siemens Experimenter
Siemens Experimenter

What is gain?

Gain (also known as the amplification factor) represents the relationship between the magnitude of the input signal and the magnitude of the output signal (see Equation 1).

 

equation 1.jpg

Below, the red curve is a 5V sine wave. After applying a gain of 2, we get the green curve (a 10V sine wave).

Figure 1: Left: A 5V signal (red). Right: A gain of 2 is applied to the 5V signal resulting in a 10V signal.Figure 1: Left: A 5V signal (red). Right: A gain of 2 is applied to the 5V signal resulting in a 10V signal.

 So, when a signal is gained the signal out has a larger amplitude than the signal in.

 

How is a signal gained?

Signals are gained by using an amplifier (amp). An amplifier is an electronic component that boosts electronic signals. Amplifiers come in many shapes, sizes, and types, but all exhibit the property of gain.

Below are two examples of amplifiers, a tiny transistor amplifier and a large guitar amplifier.

TIP33C TransistorTIP33C Transistor

Fender Champion 20 Combo Guitar AmplifierFender Champion 20 Combo Guitar Amplifier

 

 

Why gain a signal? What is quantization?

Gaining a signal helps to reduce quantization error and maximize the usage of a data acquisition system’s bits.

When measuring real-life quantities like pressure, temperature, and acceleration, transducers translate these real-life quantities into a voltage signal. This voltage signal is analog but is digitized during signal processing. During the analog to digital conversion, the amplitude of the analog signal is split into discrete levels; this is called quantization. The difference between the analog amplitude value and the digital amplitude value is quantization error or quantization distortion.

 

Figure 2: During digitization, the amplitude values are split into discrete levels. This is called quantization.Figure 2: During digitization, the amplitude values are split into discrete levels. This is called quantization.

 

 As you can see in the graph above, the signal is split into discrete levels. Analog values at each point are put into the quantization level that they are closest to. This is demonstrated in the graph below.

 

Figure 3: The original signal is the grey line and the quantized signal is the red line.Figure 3: The original signal is the grey line and the quantized signal is the red line.

So, if we had a level at 2.0 and a level at 2.1 and our analog amplitude value was 2.03 the digitized signal would be put into the 2.0 level.

 

How do we reduce quantization error?

To reduce quantization error, we need to reduce the bin size. Bin size is a function of the range and the number of bits of your system (see Equation 2).

 

 

Bin size equation.jpg

 

The number of bits is fixed for your data acquisition system. The range is the voltage range over which you are reading in your signal. For example, the range in the graph to the bottom left is 10V, the range of the graph to the bottom right is 0.01V.

 

Figure 4: The range in the left graph is 10V. The Range in the right graph is 0.01V.Figure 4: The range in the left graph is 10V. The Range in the right graph is 0.01V.

 

 Let’s look at an example of a 10V system with 16 bits (current SCADAS hardware are 24 bit systems). At the max voltage range (10V) there are 65536 discrete levels (2number of bits) to quantize the signal. But, at 1.25V there are only 8192 available bins to quantize the signal. See the graphic below.

 

 

 

Figure 5: The number of bins available to quantize the signal is dependent on the voltage.Figure 5: The number of bins available to quantize the signal is dependent on the voltage.

The maximum range is fixed for your data acquisition system. However, some systems allow you to reduce the range to more closely match the range of your signal. By setting the voltage range to be just larger than your signal range you are able to minimize your quantization error.

 

So, if a data acquisition system has a max range of 10V and 16 bits, the bin size will be 1.53x10-4.

 

bin size example.jpg

Note: if you have an LMS SCADAS with 24 bits you will have 16,777,216 discrete levels, a lot more than a 16 bit system with 65,536  discrete levels.

 

Let’s see what happens if we decrease the bin size and re-process our original signal (grey signal from Figure 2).

 

Figure 6: With smaller bin sizes, the quantization error is reduced.Figure 6: With smaller bin sizes, the quantization error is reduced.

 

Looking at the above graph, you can see that the smaller the bin size, the better the translation of the signal from analog to digital.

Let’s look at an even more extreme case. If we have a 0.001V signal and a 16 bit system, we will only have 6 levels to discretize the signal.

 

 

Figure 7: When the incoming signal range is significantly less than the maximum signal range, large quantization errors can occur.Figure 7: When the incoming signal range is significantly less than the maximum signal range, large quantization errors can occur.

 

 

Therefore, if the signal you are reading in is significantly less than the maximum range of your system you risk large quantization errors.

 

How can quantization error be reduced?

If the signal voltage being read in is significantly less than the voltage range of the hardware, it is possible for the system to apply a gain to the incoming signal so the signal approaches the full range of the system. So if the system’s max range is 10V and you read in a 0.1V signal, the system will apply a gain of 100 to amplify the signal to 10V. See the chart below to see what gain values are applied to different incoming signal levels (assuming 10V max range).

 

Figure 8: Depending on how small your signal is, the system will gain the signal appropriately to maximize use of your range.Figure 8: Depending on how small your signal is, the system will gain the signal appropriately to maximize use of your range.

 

So, let’s look at the same example in which a 0.001V sine wave was being read in. Now, let’s add a gain factor of 10000 to this sine wave to amplify the amplitude to 10V. Now, because we are utilizing the full range of the system we will have 65536 levels to discretize the signal.

 

Figure 9: Utilizing the full range allows for the maximum number of bins to discretize the signal.Figure 9: Utilizing the full range allows for the maximum number of bins to discretize the signal.

 

 But my signal isn’t 10V, its 0.001V!!

In Test.Lab, this gain is applied behind the scenes, so when looking at the graph after applying the appropriate ranges, it will still appear to be a 0.001V sine wave, but the full number of discrete levels will be available to quantize the signal.

 

 

Figure 10: Utilizing the full range allows for the maximum number of bins to discretize the signal.Figure 10: Utilizing the full range allows for the maximum number of bins to discretize the signal.

 

 

 So, even though it looks like your range didn’t change, the gain was applied in the background and your signal is now making full use of the max range and bits available.

 

How to know if range is appropriate:

Test.Lab will give you an indication of whether or not your range/gain is set appropriately.

In the acquisition set up workbook, there is a range indication bar in the lower left corner.

 

 

Figure 11: Range indicator bars in Test.Lab.Figure 11: Range indicator bars in Test.Lab.

 

 When the bar is white, the range is too large for the signal. Various shades of green indicate the range is set appropriately. Orange indicates the signal is close to the range limits. Red incidates you have overloaded.

This quick visual check ensures you get the most from your system!

 

How do I set the range of my signal?

If the bar is white, the range needs to be decreased. If the bar is red or orange, the range needs to be increased.

Figure 12: Range indicator bars in Test.Lab.Figure 12: Range indicator bars in Test.Lab.

 

 To auto-set the ranges, click 1) start ranging, 2) hold level, and 3) set ranges.

 

Figure 13: Autoranging sequence.Figure 13: Autoranging sequence.

 

This will set the gain to an appropriate level thus minimizing quantization errors.

 

NOTE: It is important to use the full range of the system when autoranging. If the full range of the system is not used, and an overload occurs, the system gain will only change by one increment. The adjustment by only one increment may not be enough to avoid another overalod. If the full range is used, the gain can be adjusted to be as low as possible to accomodate the signal range to avoid overloads and minimize quantization errors. 

 

Turn on "Use full range when autoranging" by pushing the "More..." button in Figure 13. 

Figure 14: Use full range when autoranging.Figure 14: Use full range when autoranging.

Remember, the range of the system doesn’t actually change, only the gain applied to the signal changes. The gain amplifies the signal to fit within the max range of the system.

d.png

 

It’s that easy!

 

Questions? Contact us!

 

Additional data acquistion links: 

 

Contributors