# The Automatic Gain Control: topology, behavior and use (I)

One of the most common topologies in electronic design is the Automatic Gain Control (AGC). In this post we will study what is its operating modes, its basic topology and its most common use. We will also make to its simulation in MatLab, using SIMULINK, understanding better its behavior.

LINEAR AMPLIFIERS

One of the most common blocks in an electronic system is the linear amplifier. This is a device where the output signal is directly proportional to the input. As the output level is greater than the input, the block increase the signal level, then it is an amplification. If the output level was lower than the input level, then we would speak of a level reduction or attenuation.

The linear amplifiers usually have a fixed gain, which is the proportionality constant between the input and the output signals, and a variable gain, where this ratio can be controlled an external control voltage vc.

$v_{out}(t)=g v_{in}(t)$
$v_{out}(t)=g(v_c(t)) v_{in}(t)$

This voltage is a variable that also depends on time, although under conditions of free control, done by the user, once the control value is chosen, this variable becomes stationary with time and the amplifier becomes fixed gain.

However, the input signals may have oscillations due to the propagation channel, and increase or decrease in value as a function of time. If the amplifier has a fixed gain, the output will follow lineary the input variations.

In general, conventional amplifiers usually have a fixed gain with an external regulation that can be controlled by the user. However, within communication systems there may be cases in which it is always necessary to ensure that the output takes a fixed value. And for this it is needed to use an Automatic Gain Control (AGC).

THE AUTOMATIC GAIN CONTROL

The AGC is a feedback system, which uses the output variable, taking a sample, and processes it properly generating a control voltage vc(t) that varies the output level, keeping it fixed against the input variations.

The typical AGC block diagram can be seen in the following figure

Fig. 1 – Block diagram for an AGC

It consists of a variable voltage amplifier, which is expressed by the formula seen in the previous section, an envelope detector, because the amplitude of the signal vout contains the information of the variation of the input signal, since vout is proportional a vin, a comparator, which compares the detected signal with a reference signal vref, which is the one that will govern the appropriate output level in vout and an integrating filter, which provides the control variable.

By varying vin at time t0, the VGA is in a steady state, behaving like a linear gain amplifier. This causes a variation in the output signal vout that follows the input vin. This variation is detected by the envelope detector, causing a change in the comparator output, which, when integrated, modifies the value of vc, adapting it so that vout is corrected and starts to match the value before the change.

It is a dynamic process: the vin and vout signals vary temporarily but keeping a stationary envelope level. For example, a pure sine wave has a constant envelope varying in [-1, 1] intervale

Fig. 2 – Sinewave

When a change in the envelope is detected at a certain time, the peak value of the amplitude changes and is detected by the detector, which initiates a temporary feedback process that does not affect the waveform, but does affect its amplitude.

Fig.3 – Change in the sinewave amplitude

CONTROL MECHANISMS IN AN AGC

Returning to the system in Fig. 1, where the VGA has a gain represented by the expression

$g(v_c(t))=g_o e^{-\alpha v_c(t)}$

In this expression the temporal domain is removed, because at this moment we are not interested in the temporal variation of vc, since if there is no variation in vin, vc remains stationary.

The input signal is the next

$v_{in}(t)=a \sin({\omega}t+{\theta})$

and the output signal is

$v_{out}(t)=g_o a e^{-\alpha \cdot v_c(t)} \sin({\omega}t+{\theta})$

This signal will pass through the envelope detector, the output of which is a signal that is proportional to the amplitude of the input signal, where k is the proportionality constant. Therefore, the output signal of the envelope detector will be

$v_e=k g_o a e^{-\alpha v_c(t)}$

This signal is passed through a logarithmic amplifier, since the dependence of vE on vc is exponential. Since the base is natural, we choose the natural logarithm as the logarithmic amplifier, and we can get an output voltage v2 whose expression is

$v_2=-{\alpha} v_c+\log(k g_o a)$

In this expression we can verify that k and g0 are constant values, and that a and vc are the ones that can vary with respect to time. If we now include the temporal variation of a, we will have that the expression is

$v_2=-{\alpha} v_c(t)+\log(k g_o a(t))$

Therefore a variation of a is compensated by a variation of vc so that v2 returns to the value before the change in a.

Making the comparison between the voltage v2(t) and vR, which is a fixed value and that will fix the output level on the amplifier, we have a signal v1 that has the following expression

$v_1 = - {\ alpha} v_c (t) + \ log (k g_o a (t) e ^ {- v_R})$

This signal is passed through a low-pass filter that integrates it, getting vC(t). If the filter has a transfer function h(t), what we do is a convolution of the signal v1 with h(t)

$v_c(t)=h(t)*v_1(t)$

And then

$v_1(t)+{\alpha} h(t)*v_1(t)=\log(k g_o a(t) e^{-v_R})$

In the temporal domain, convolution is a dynamic integral equation, so if we use the Laplace domain, we will transform that convolutional response to a response in the domain of the complex variable s, which is linear. Using this domain, the equation above is now

$V_1 (s) + {\alpha} H (s) V_1 (s) = \mathcal {L} [\log (k g_o a (t) e ^ {- v_R})]$

which is the Laplace transform. Studying the value of V1(s) if the output has a value an amplitude b

$v_ {out} (t) = b \sin ({\omega} t + {\theta})$

removing the dependency with k and with g0. Thus, making the same steps as in the previous case, we will have to

$v_1 (t) = \log (b (t) e ^ {- v_R})$

$V_1 (s) = \mathcal {L} [\log (b (t) e ^ {- v_R})]$

$(1 + {\alpha} H (s)) \mathcal {L} [\log (b (t) e ^ {- v_R})] = \mathcal {L} [\log (k g_o a (t ) e ^ {- v_R})]$

$\dfrac {\mathcal {L} [\log (b (t) e ^ {- v_R})]} {\mathcal {L} [\log (k g_o a (t) e ^ {- v_R}) ]} = \dfrac {1} {1 + {\alpha} H (s)}$

The first term is the quotient of two functions, one of them depends on the output amplitude and the other depends on the input amplitude. If we choose k · g0 = 1, we will get

$\dfrac {\mathcal{L}[\log(b(t) e^{-v_R})]}{\mathcal{L}[\log(a(t) e^{-v_R})]}=\dfrac {\mathcal{L}[\log(b(t))]}{\mathcal{L}[\log(a(t)]}=\dfrac {1}{1+{\alpha} H(s)}$

And being y(t) and x(t) voltage values, we can apply the dB definition, which is

$b_{dB}(t)=20 \log_{10}(b(t))$

$a_{dB}(t)=20 \log_{10}(a(t))$

and then

$\dfrac {\mathcal{L}[\log(b(t) e^{-v_R})]}{\mathcal{L}[\log(a(t) e^{-v_R})]}=\dfrac {\mathcal{L}[b_{dB}(t)]}{\mathcal{L}[a_{dB}(t)]}=\dfrac {B_{dB}(s)}{A_{dB}(s)}$

removing the temporary domain and turning the system into a totally linear system. Then we will have to

$\dfrac {B_{dB}}{A_{dB}}=\dfrac {1}{1+{\alpha} H(s)}$

being the transfer function in dB of the variation between the output and input amplitudes.

If the filter used is an integrating filter with a pole at the origin (low-pass filter), like this

$H(s)= \dfrac {C}{s}$

the expression will be

$\dfrac {B_{dB}}{A_{dB}}=\dfrac {1}{1+{\alpha} C}$

Now suppose that the input envelope AdB changes 1 dB, increasing or decreasing. The new envelope is A’dB(s), and the output envelope, B’dB(s). Then:

${A'}_{dB}(s)=A_{dB}(s) \pm 1$

And having

$\dfrac {B_{dB}}{A_{dB}}=\dfrac {{B'}_{dB}}{{A'}_{dB}}=\dfrac {1}{1+{\alpha} C}$

since feedback must always respond in the same way. Substituting the expression for the input variation in the previous expression we have

$\dfrac {B_{dB}}{A_{dB}}=\dfrac {{B'}_{dB}}{A_{dB}(s) \pm 1}=\dfrac {1}{1+{\alpha} C}$

Se we can calculate B’dB(s) multiplying by the transfer function

${B'}_{dB}(s)=\dfrac {s}{s+{\alpha} \cdot C} \cdot A_{dB}(s) \pm \dfrac {s}{s+{\alpha} C}$

And knowing that the first term is BdB(s), the expression will be the next

${B'}_{dB}(s)-B_{dB}(s)=\pm \dfrac {s}{s+{\alpha} C}=\pm 1 \mp \dfrac {{\alpha} C}{s+{\alpha} C}$

The above equation links the new envelope B’dB(s) with the former BdB(s). And being a transient response, applying the inverse transformation it is got

${B'}_{dB}(t)-B_{dB}(t)=\pm {\delta}(t) \mp {{\alpha} C e^{-{\alpha} C t}}$

Lt’s study this result: When 1 dB (instant t=0) is increased, the expresion is b’dB(t)–bdB(t)=+δ(t)=+1, because at t=0 the filter h(t) has not worked yet. Therefore, at this time the difference between the new and the initial envelope is 1 dB. When t is increasing, there is an decreasing exponential response due to the second term of the previous expression, ans when the time is increasing more, the difference between b’dB(t) and bdB(t) is decreasing (inicially b’dB(t)>bdB(t)) until both are equal.

Conversely, decreasing the input envelope 1dB, then b’dB(t)–bdB(t)=-δ(t)=-1, and the final envelope decreases this value for the same reason, and the operation is the inverse of the previous case.

From this it follows that when the input envelope rises or falls 1 dB, the output envelope, at the initial moment, tends to rise or fall following the variation of the input envelope, but when time passes, the output envelope stabilizes until it reaches the initial value ydB(t).

The AGC time response is α·C/e es τ=1/α·C, which is a constant time. When this constant is high, the AGC changes slowly, but being low, the AGC changes fastly. A compromise with the AGC response time is required in signals that also contain nominal variations for their content, such as analogue audio or video signals, so as not to confuse a level variation with a variation of that content.

CONCLUSION

In this entry we have been able to verify what is the theoretical behavior of the AGC block diagram, studying its response in the Laplace domain and in the temporal domain. We have reached a transfer relationship that allows us to relate the variations of the output signal to the input signal and how we can calculate the AGC response time, which we will have to include through the integrating filter and the study of the variation constant of the amplifier gain.

In the next post we will study this system using SIMULINK.

REFERENCES

1. Benjamin C. Kuo; “Automatic Control Systems”; 2nd ed.; Englewood Cliffs, NJ; Prentice Hall; 1975
2. Pere Matí i Puig; “Subsistemas de radiocomunicaciones analógicos”;Universitat Oberta de Catalunya;2010