# Gri_control_loop::set_frequency() Possible Error?

Hi,

I was looking at the gri_control_loop.cc file and notices the
set_frequency() function seemed a little odd. Here’s what it looked
like.

void
gri_control_loop::set_frequency(float freq)
{
if(freq > d_max_freq)
d_freq = d_min_freq;
else if(freq < d_min_freq)
d_freq = d_max_freq;
else
d_freq = freq;
}

This doesn’t seem logical to me. Shouldn’t the it be “d_freq =
d_max_freq”
in the if statement and “d_freq = d_min_freq” in the else if statement?
The frequency_limit() function has it the way I stated

void
gri_control_loop::frequency_limit()
{
if (d_freq > d_max_freq)
d_freq = d_max_freq;
else if (d_freq < d_min_freq)
d_freq = d_min_freq;
}

Regards,

Frederick

On Thu, Aug 16, 2012 at 7:11 PM, Frederick L. [email protected]
wrote:

else if(freq < d_min_freq)
gri_control_loop::frequency_limit()
{
if (d_freq > d_max_freq)
d_freq = d_max_freq;
else if (d_freq < d_min_freq)
d_freq = d_min_freq;
}

Regards,

Frederick

Frederick,

Yes, that it s a bit odd. It’s due to the historical nature of that
loop. We wanted the frequency to wrap around in some of the early
loops as opposed to just railing against the edges. I think the idea
is to let it keep searching in the bandwidth for a lock.

Now, that might not be the right answer. I’m not entirely sure what
is, though. If you just rail it against the max or min frequency,
you’re just sitting there doing nothing. Is that better or worse than
forcing it around to the other side? Frankly, if the frequency of the
signal that you are trying to track is outside of the loop, you’re
kind of hosed anyways. Would holding it stable at the max/min be more
appropriate?

Tom