Showing results for 
Search instead for 
Do you mean 

Gain, Range, and Quantization

by Siemens Experimenter Siemens Experimenter on ‎07-11-2016 08:31 AM - edited

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

gain example.jpg


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.


Quantization and bin size.jpg



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.


The original signal is the grey line and the quantized signal is the red line.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 .01V.


range graphs together.jpg



Let’s look at an example of a 10V system with 16 bits (current SCADAS systems are 24 bits). 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 bits to quantize the signal. See the graphic below.




Voltage Range vs. bits avaliable.jpg

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.


Quantization smaller bin.jpg


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 .001V signal and a 16 bit system, we will only have 6 levels to discretize the signal.



6 levels.jpg




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


So how can we reduce quantization error?

If the signal voltage being read in is significantly less than the max voltage of the signal, the system will apply a gain to your signal so the signal approaches the full range of your system. So if the system’s max range is 10V and you read in a .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).


Depending on how small your signal is, the system will gain the signal appropriately to maximize use of your range.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 .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.






But my signal isn’t 10V, its .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 .001V sine wave, but the full number of discrete levels will be available to quantize 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.



range indicators.jpg



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.

gain indicators bad.jpg



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





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

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!


Additional data acquistion links: