[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Squelch block, AGC function and scanner example

From: Martin Dvh
Subject: [Discuss-gnuradio] Squelch block, AGC function and scanner example
Date: Tue, 18 Jan 2005 20:36:07 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)


Is there a way to access the magnitude of the channel to setup a squelch function? How would that work with this chain of blocks? Is there another block that would go in the chain to zero the output if the I*I + Q*Q of the signal is below a threshold?

I also needed this to make a scanner-like application.
Since I couldn't find what I needed I build a squelch block myself.
I also built in an autothreshold function but that is not perfect yet and 
absolutely not optimized.
I didn't send this to the list because I don't think it is finisfed quality 
code yet.
But as I am also against reinventing the wheel I send it at the current status 
I hope it is of use.

The fast and/or slow average signal strengths which this block determines can 
also be used for an AGC function.

You can find sources for the squelch block at:

Or a patch which adds all of them and changes the neccesary makefile.am and 

I wrote an example fmscanner and amscanner which uses this squelch block.
You can find these at:

Below you find a brief description of what the block does and how to use it:
gr_make_squelch_cc (double sampling_freq,
                    float treshold,
                    float avg_time_fast,
                    float holdtime,
                    float unmutetime, bool autothreshold, float avg_time_slow)

sampling_freq:    sampling_freq
threshold: set the current singal magnitude threshold. The meaning of threshold is different if autothreshold is used. In that case threshold is the factor the magnitude of the signal has to be greater then the autothreshold.
avg_time_fast:    time in seconds used to determina average magnitude of signal
hold_time:        time to hold the output open after the signal has dropped 
below threshold
unmutetime:       unused at the moment
autothreshold: if set to true the algorithm uses a very slow average of the signal magnitude as threshold. If the surrent signal is above the current threshold the autothreshold is changed slower then if the signal is below the current threshold. This system is not working ideal yet.
                  if set to false a static hard threshold is used which has to 
be set by set_threshold(float threshold)
avg_time_slow:    unused at the moment

example with autothreshold:
slow average signal magnitude = 100.0
if threshold = 1.2 then the current signal strength has to be above 120.0 to 
open the output.

example without autothreshold:
if threshold=150.0 then the the current signal strength has to be aboce 150.0 
to open the output.

When the output is closed this block outputs zeros.

gr_squelch_cc_sptr gr_make_squelch_cc (  double         sampling_freq,
float threshold,
float   avg_time_fast,
float   holdtime,
float   unmutetime /*unused*/,
bool autothreshold,
float avg_time_slow /*unused*/);

class gr_squelch_cc : public gr_sync_block
  gr_squelch_cc (  double               sampling_freq,
float threshold,
float   avg_time_fast,
float   holdtime,
float   unmutetime /*unused*/,
bool autothreshold,
float avg_time_slow /*unused*/);
  bool get_hold() const { return d_hold; }
  bool get_mute() const { return d_mute; }
  double get_avg_signal_strength_fast () const { return 
d_avg_signal_strength_fast; }
  double get_d_avg_signal_strength_slow () const { return 
d_avg_signal_strength_slow; }
  double get_threshold () const { return d_threshold; }
  double get_current_threshold () const { return d_current_threshold; }
  void set_threshold (double threshold);
  //void set_current_threshold (double current_threshold; }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]