AGC in receivers.
(Feb 16 2011)

AGC in "good old analog receivers" vs modern reeivers.

An analog radio uses IF filters to select a desired passband. When AGC is enabled, the gain of RF stages as well as IF stages is reduced by means of an AGC voltage.

The AGC voltage is derived from an AGC detector, usually a peak voltage detector at the output of the last IF stage.

When the signal level increases abruptly by several orders of magnitude, the IF stages saturate. That is a good thing, and saturation should not be very high above the normal signal level. If the level increase is caused by a new and much stronger signal on the frequency, saturation in the IF is RF clipping. It will not affect CW signals at all and it will do to SSB signals the same as good speech processing does. If the IF limiting limits the IF output e.g. 8 dB above the normal signal level, the AGC voltage will grow linearly with time (=slowly) and not exponentially (=fast) for strong signals. That means that a short but VERY strong pulse will not create a large AGC voltage.

Most digital systems seem to have been designed with the idea that clipping (including RF clipping) is a bad thing that must be avoided. Consequently the AGC voltage is immediately set to a level that reduces the gain for occasional interference pulses not to cause saturation even at the peak of the pulse.

The error in thinking is that the interference pulses should not be allowed to saturate (become distorted) while the real situation is that we would not want to hear them at all.

Surely it is not possible to know if a sudden increase in signal level is a short pulse (that we should allow to saturate, or even better gate out) or if it is the onset of a transmission at a much higher signal level. SDR and DSP designers tend to assume that a sudden increase is the onset of a transmission that should not be distorted. Consequently they allow the AGC voltage to increase immediately. In situations of bad QRN pulses one then has to select fast AGC to make the incorrectly high AGC voltage fall as quickly as possible. Some radios do not allow that and they are useless in locations with cow fences and similar situations.

In analog receivers the IF clipping which is always in place will make the AGC voltage grow slowly. A short pulse will thus never create a large AGC voltage so gain will not be turned down much.

Theory of the ideal AGC.

The most demanding case is for a linear receiver. That means SSB or CW mode where there is no detector. The RF signal is just shifted to a suitable audio frequency and everything outside the desired frequency range is removed with appropriate filters.

For a weak signal enthusiast the optimum solution is to disable AGC. The detection, interpretation of the meaning of the frequency shifted RF signal is done in the brains of the operator and a perfectly linear response of the receiver is then optimal. The operator would set a fixed gain maybe 12 dB below saturation of the audio. Any signal strong enough to saturate is a local signal that can be copied even if distorted (and it will be easy to reduce gain/enable AGC)

The HF contester is in a different situation. There is no time for anything. Signal levels may change abruptly but the operator wants to understand every single word. In this case a good AGC will make a big difference compared to conventional ones.

A good AGC should set the receiver gain to the desired level faster and more cleverly than the operator could do himself.

A short pulse should not be allowed to change the RF gain at all. The RF gain should not be allowed to increase very rapidly because the immediately increased gain would make the noise floor higher between syllables and make reception more difficult. The time constant for the AGC release should be set to fit the communication mode and propagation characteristics, not to make the AGC system forget mistakes (interference pulses) fast enough.

A good AGC should start with a peak detector. We want the peak power (key-down signal level) to get a desired amplitude in the loudspeakers. A peak detector will look for the largest amplitude within a time of something like 10/bw. The duration of a CW dot is 1/bw for a matched filter. The same time constant is good for SSB.

The AGC detector should not be allowed to immediately reduce the gain by the amount prescribed by the peak detector. A low pass filter is commonuly used to give an AGC rise time. By limiting the signal from the AGC detector to e.g. 4 times the current AGC voltage, one would get an input to the AGC rise time filter that would create an AGC voltage that would grow linearly with time. Without limitation short pulse but very big pulse could create a large AGC voltage voltage.

With a long enough AGC rise time a short pulse will have no effect on the AGC voltage because the AGC voltage will only grow linearly with the 4 times larger signal while the pulse might be 100dB (=100000 times) stronger. The growth rate for a big pulse would thus be reduced by a factor 25000. The attack time constant has to be made smaller to make the response to a regular transmission fast enough, but still the sensitivity to short and huge pulses would be dramatically reduced.

By only turning up the AGC voltage when a signal actually is present we can allow the AGC voltage to be turned down slowly. That improves copy of weak signals since it avoids the gain to become turned up between syllables.

In an analog radio there will be some RF clipping at the onset of a strong signal. In an SDR that is not necessary. In case the output from the AGC detector is higher than the regular AGC voltage one can use the output from the peak detector to control the gain for the duration of that condition.

Test files.

The theory above is vague. It originates from practical experiences however. In order to evaluate AGC systems and to find the optimum parameters for different SDR software I have created two similar AGC test files.
sim4.zip 17447925 bytes it will unpack to sim4.wav 26972204 bytes.
sim5.zip 18541320 bytes it will unpack to sim5.wav 28624982 bytes.
The sim4.wav file has a sampling rate of 96 kHz. It will run with Linrad, Winrad, WRplus, HDSDR and Rocky. Use sim2powersdr.exe to convert the sim4.wav file to the PowerSDR format with the command sim2powersdr sim4.wav" when logged to the directory where you have sim4.wav. The output file powersdr-sim4.wav will work in PowerSDR. For SpectraVue and SDR-RADIO, use sim2spectravue.exe when logged to the directory where you have sim4.wav. The output file spectravue-sim4.wav will work with SDR-Radio and SpectraVue.

The sim5.wav file has a sampling rate of 125 kHz. It will run with Linrad, Winrad, WRplus, HDSDR and perseus.exe. Use sim2excalibur.exe to convert the sim5.wav file to the Winradio G31DDC format with the command sim2excalibur sim5.wav" when logged to the directory where you have sim5.wav. The output file excalibur-sim5.ddc will work in Winradio G31DDC. For SpectraVue and SDR-RADIO, use sim2spectravue.exe when logged to the directory where you have sim5.wav. The output file spectravue-sim5.wav will work with SDR-Radio and SpectraVue. For QS1R, use sim2qs1r.exe when logged to the directory where you have sim5.wav. The output file qs1r-sim5.wav will work with SDRMAXIV and SpectraVue.

Test file contents.

The files have a normal noise floor with the rms noise about 120 dB below saturation in 1 Hz bandwidth. There are two strong signals that both are 20 dB below saturation. The two strong signals serve the purpose of simulating a crowded band where simple wideband noise blankers can not be used to eliminate pulses.

The test signal is an on-off keyed signal 80 dB below saturation. It is disturbed by short bursts of random noise with an interval of about 5 seconds. The test signal is interrupted by a two second two-tone transmission simulating a strong SSB signal that we want to hear undistorted. There is also a gap of about two seconds in the on-off keyed signal.

Figure 1 shows the sim4.wav file and figure 2 shows the sim5.wav file.




Figure 1 The sim4 test file played once in Linrad.





Figure 2 The sim5 test file played once in Linrad.

AGC in Linrad.

The AGC in Linrad was always intended to be insensitive to strong interference pulses. Before generating the test files presented on this page I did not really verify that the algorithm was doing what it was intended to do. Now, with the test files I know that it was not working as intended. Linrad-03.20 has therefore a significantly improved AGC for which the user can set three parameters in the baseband window.

A=Attack time
R=Release time
H=Hang time.
The AGC threshold can be set by use of the volume control, the red bar at the left side of the baseband graph.

One unit is a factor of two in the corresponding time constant. The AGC can be operated in different ways. Below are a couple of examples.

Slow AGC.

This audio file sim4-slow.mp3 (327600 bytes) is the loudspeaker output from Linrad running sim4.wav with timing parameters for comfortable listening, A=6, R=6, H=6. The volume is set for maximum which is not comfortable, but done here to demonstrate how the AGC works. Note that the gain is constant while the on-off signal is on but that it is turned up about 0.5 seconds after it has stopped. Figure 3 is the corresponding oscilloscope tracing.





Figure 3 Part of the output from sim4.wav with slow AGC. A=6, R=6, H=6.

There are strong pulses at T=12.2, 17.4 and 22.6 s in figure 3. The first pulse that occurs when there is no signal turns down the gain by about 6 dB for about 0.5 seconds. The last pulse that occurs while the on-off keying is running has a similar effect. The AGC only reduces the gain by about 6 dB for the on-off keyed signal. The pulse that comes while the two-tone signal is present affects gain very little, about 1.2 dB only. The AGC is comfortably slow for voice SSB however. With these settings the full gain recovery after the two-tone signal is 2.5 seconds. From 18.7 to about 21.2 on the time scale. The AGC voltage will stay constant and not bring up background noise between between words in a normal voice communication.

This audio file sim5-slow.mp3 (267120 bytes) is the loudspeaker output from Linrad running sim5.wav with timing parameters for comfortable listening, A=6, R=6, H=6. The volume is set for maximum which is not comfortable, but done here to demonstrate how the AGC works. Figure 3 is the corresponding oscilloscope tracing.





Figure 4 Part of the output from sim5.wav with slow AGC. A=6, R=6, H=6.

The two test files sim4.wav and sim5.wav give similar results in Linrad.

Medium AGC.

This audio file sim5-hang.mp3 (267288 bytes) is the output for the sim5.wav file with the AGC parameters A=6, R=3 and H=5. The release time constant is short, but the hang time is long enough for the noise floor not to rise between the key-downs in the on-off signal. The long attack time gives a strong suppression of short pulses.

Fast AGC.

The fastest possible AGC is with R=0 and H=0. It does not matter much what attack time one would select. A=0 is used in this file: sim5-fast.mp3 (267456 bytes) The fast AGC makes the loudspeaker level constant. The noise is brought to the same level as the key-down signal. Listening like this is not very comfortable.

By turning down the gain it is possible to use this kind of very fast AGC without loss of intelligibility. Strong signals may not sound so nice, in SSB one would hear amplified background noise for example. The gain control may be labeled RF gain, AGC threshold, or something else in other SDR software.

Here is the audio with A=0, R=0 and H=0 with reduced gain: sim5-fast-thr.mp3 (267120 bytes) Pulses are no problem and this kind of AGC is extremely simple to implement in software.

Final comments.

Most modern radios and SDR software, if not all (except Linrad), have to be used with fast AGC whenever there are strong pulses that can not be eliminated with the noise blanker. The receivers would otherwise become quiet for a far too long time after each interference pulse.

Analog receivers are known to behave much better and that is because they saturate in the IF and therefore a pulse 100 dB above the current level will not charge the AGC filter any more than a pulse e.g. 20 dB above the current level would do. (Assuming the IF headroom is 20 dB.)

There is no question that digital radios can be designed to behave much better than the best analog ones.

To SM 5 BSZ Main Page