# Simcenter Testing Solutions Gain, Range, and Quantization

2019-08-29T16:35:10.000-0400
Simcenter Testlab

## Details

 Attachments: Simcenter SCADAS Brochure.pdf (13 MB)

Have data that looks a bit fuzzy, with "bit noise" or stair steps as shown in Figure 1 below?

Figure 1: Data that has been poorly digitized has bit noise or "fuzziness".

This phenomenon occurs because the signal is not being digitized with an adequate amount of digital bits.  It is analogous to a digital picture taken with too few pixels.  This issue can be addressed by quantizing the signal with more bits using gain.

This article explains the relationship between gain, range, and quantization in data acquisition systems to avoid improperly digitizing a signal.  It has the following sections:

1. What is gain?
2. How is a signal gained?
3. Why gain a signal? What is quantization?
4. How to reduce quantization error?
5. Amplifying incoming signal
6. Simcenter Testlab: How to know if range is appropriate
7. Simcenter Testlab: How to set the range?

1. What is gain?

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

Equation 1: Gain

In Figure 2 below, the red curve is a 5 Volt sine wave. Applying a gain of 2 results in the green curve (a 10 Volt sine wave).

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

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

Gain can be expressed as a linear factor or in dB:

• Linear: The signal is multiplied by the factor.  For example, a gain of 100 means the signal is multiplied by 100.  For example, a incoming signal of 1 Volt will come out of the amplifier at 100 Volts with a linear gain of 100.
• dB: A gain in decibels (a ratio) is simply a different way of expressing the gain factor.  A gain of 10 dB means that a incoming signal of 20 dB will be output at 30 dB.  The dB factor is added to the incoming signal (expressed in dB).  In linear terms, a 10 dB gain on a voltage signal means it is multiplied by 3.16.

For more about decibels, see the knowledge article "Basics: What is a decibel (dB) anyway? Why is it used?".

2. 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 (Figure 3).

TIP33C Transistor

Figure 3: Fender Champion 20 Combo Guitar Amplifier

Simcenter SCADAS data acquisition hardware has adjustable analog gain amplifiers.  Generally speaking, it makes sense to gain an analog signal before it is digitized.

3. 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 (Figure 4).

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

As shown in Figure 4 above, the signal is split into discrete levels. Analog values at each point are put into the quantization level that they are closest to.

The difference between the analog amplitude value and the digital amplitude value is quantization error or quantization distortion. This is demonstrated in Figure 5 below.

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

So, if the digital bits had levels corresponding to 2.0 and 2.1, and the analog signal amplitude value was 2.03, the digitized signal would be put into the 2.0 level.

4. How to 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).

Equation 2: Range, bits, and bin size

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 +/- 10 Volts, the range of the graph to the bottom right is +/- 0.01 Volts as shown in Figure 6.

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

Note that +10 Volt to -10 Volt is often referred to as 10 Volt range, even though the total that the signal can vary is 20 Volts.

Take 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 Figure 7 below.

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

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 range of +/- 10V (20 V total) and 16 bits, the bin size will be 3.05x10-4.

Equation 3: Bin size for 16 bit data acquisition system with a +/- 10 Volt range (20 Volt total)

Note: A Simcenter SCADAS with 24 bits has 16,777,216 discrete levels, a lot more than a 16 bit system with 65,536 discrete levels!

Let’s see what happens when decreasing the bin size and re-processing the original signal (grey signal from Figure 4).  The result is shown in Figure 8:

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

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

Take an even more extreme case. With a 0.001V signal and a 16 bit system, there will only be six levels to discretize the signal (Figure 9).

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

Therefore, if the signal level is significantly less than the maximum range of the data acquisition, there is risk for large quantization errors.

5. Amplifying incoming signal

What can be done If the signal voltage being read in is significantly less than the voltage range of the hardware? It is possible to apply a gain to the incoming signal so the signal approaches the full range of the system.

For example, if a data acquisition system’s max range is 10 Volts, and  the signal is 0.1V, the system can apply a gain of 100 to amplify the signal to 10V. See the chart below (Figure 10) to see what gain values are applied to different incoming signal levels (assuming 10V max range).

Figure 10: 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.001 Volt sine wave was being read in. Now, let’s add a gain factor of 10000 to this sine wave to amplify the amplitude to 10 Volt. Now, because the full range of the system is utilized, there are 65536 levels to discretize the signal (Figure 11).

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

Gaining the incoming signal allows it to be properly digitized.

In Simcenter Testlab (formerly called LMS Test.Lab), this gain is applied behind the scenes. When looking at the signal graph after applying the appropriate ranges, it will still appear to be a 0.001 Volt sine wave. The signal displayed in the data acquisition system is divided by the gain, so it is shown at its original level.

Additionally, the full number of discrete levels will be available to quantize the signal (Figure 12).

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

So, even though the signal level does not appear to change, the gain is applied in the background to full use of the max range and bits available.

7. Simcenter Testlab: How to know if range is appropriate

Simcenter Testlab indicates whether or not the range/gain is set appropriately.

In the "Acquisition Setup" workbook, there is a range indication bar in the lower left corner as shown in Figure 13.

Figure 13: Range indicator bars in Simcenter Testlab.

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 indicates an overload

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

8. Simcenter Testlab: How to set the range?

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 14).

Figure 14: Range indicator bars in Simcenter Testlab.

To auto-set the ranges, click 1) start ranging, 2) hold level, and 3) set ranges. This is done while the test object is running in the desired measurement condition (Figure 15).

Figure 15: 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 overload. If the full range is used, the gain can be adjusted to be as low as possible to accommodate the signal range to avoid overloads and minimize quantization errors.

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

Figure 16: 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.

It’s that easy!