discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] pll refout vs carriertracking


From: Charles Swiger
Subject: [Discuss-gnuradio] pll refout vs carriertracking
Date: Mon, 10 Jul 2006 15:27:25 -0400

All - Do I understand correctly that gr.pll_carriertracking_cc() is
supposed to downconvert to DC?  I don't see it doing that, and can't
see in the work functions where that magic would be accomplished.

Just want to make sure I'm building the most efficient graph possible.
I tried both in an existing AM detector with a 7.5KHz IF and both work
just the same with an external mixer. 


----------------------------------------------------------------
refout:

int
gr_pll_refout_cc::work (int noutput_items,
                   gr_vector_const_void_star &input_items,
                   gr_vector_void_star &output_items)
{
  const gr_complex *iptr = (gr_complex *) input_items[0];
  gr_complex *optr = (gr_complex *) output_items[0];

  float error;
  float t_imag, t_real;
  int   size = noutput_items;

  while (size-- > 0) {
    error = phase_detector(*iptr++,d_phase);

    d_freq = d_freq + d_beta * error;
    d_phase = mod_2pi(d_phase + d_freq + d_alpha * error);

    if (d_freq > d_max_freq)
      d_freq = d_max_freq;
    else if (d_freq < d_min_freq)
      d_freq = d_min_freq;
    gr_sincosf(d_phase,&t_imag,&t_real);
    *optr++ = gr_complex(t_real,t_imag);
  }
  return noutput_items;
}


-----------------------------------------------------------------
carriertracking:

int
gr_pll_carriertracking_cc::work (int noutput_items,
                                 gr_vector_const_void_star &input_items,
                                 gr_vector_void_star &output_items)
{
  const gr_complex *iptr = (gr_complex *) input_items[0];
  gr_complex *optr = (gr_complex *) output_items[0];

  float error;
  float t_imag, t_real;

  for (int i = 0; i < noutput_items; i++){
    error = phase_detector(iptr[i],d_phase);

    d_freq = d_freq + d_beta * error;
    d_phase = mod_2pi(d_phase + d_freq + d_alpha * error);

    if (d_freq > d_max_freq)
      d_freq = d_max_freq;
    else if (d_freq < d_min_freq)
      d_freq = d_min_freq;
    gr_sincosf(d_phase,&t_imag,&t_real);
    optr[i] = gr_complex(t_real,t_imag);
    d_locksig = d_locksig * (1.0 - d_alpha) + d_alpha*(iptr[i].real() *
t_real + iptr[i].imag() * t_imag);

    if ((d_squelch_enable) && !lock_detector())
      optr[i] = 0;
  }
  return noutput_items;
}






reply via email to

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