Adding alpha and beta gains to FLL constructor.
authorTom <trondeau@vt.edu>
Thu, 10 Dec 2009 05:12:51 +0000 (00:12 -0500)
committerTom <trondeau@vt.edu>
Thu, 10 Dec 2009 05:12:51 +0000 (00:12 -0500)
gnuradio-core/src/lib/general/gr_fll_band_edge_cc.cc
gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h
gnuradio-core/src/lib/general/gr_fll_band_edge_cc.i
grc/blocks/gr_fll_band_edge_cc.xml

index 946fc1e858e56dc3b8d01900665b3c4c17b95bdd..5ed9cf5f524019f5b7f814f1af10e772e3452f29 100644 (file)
 
 #define M_TWOPI (2*M_PI)
 
-gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (const std::vector<gr_complex> &taps)
+gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float alpha, float beta,
+                                                  const std::vector<gr_complex> &taps)
 {
-  return gr_fll_band_edge_cc_sptr (new gr_fll_band_edge_cc (taps));
+  return gr_fll_band_edge_cc_sptr (new gr_fll_band_edge_cc (alpha, beta,
+                                                           taps));
 }
 
 
-gr_fll_band_edge_cc::gr_fll_band_edge_cc (const std::vector<gr_complex> &taps)
+gr_fll_band_edge_cc::gr_fll_band_edge_cc (float alpha, float beta,
+                                         const std::vector<gr_complex> &taps)
   : gr_sync_block ("fll_band_edge_cc",
                   gr_make_io_signature (1, 1, sizeof(gr_complex)),
                   gr_make_io_signature (1, 1, sizeof(gr_complex))),
-    d_updated (false)
+    d_alpha(alpha), d_beta(beta), d_updated (false)
 {
-  d_alpha = 0.01;
-  d_beta = 0.25*d_alpha*d_alpha;
+  // base this on the number of samples per symbol
   d_max_freq = M_TWOPI * 0.25;
   d_min_freq = M_TWOPI * -0.5;
 
@@ -125,8 +127,7 @@ gr_fll_band_edge_cc::work (int noutput_items,
 
     out_upper = norm(d_filter_upper->filter(&out[i]));
     out_lower = norm(d_filter_lower->filter(&out[i]));
-    error = 0.1*(out_lower - out_upper);
-    printf("error: %f\n", out_upper);
+    error = out_lower - out_upper;
 
     d_freq = d_freq + d_beta * error;
     d_phase = d_phase + d_freq + d_alpha * error;
index 1c47167f884f5ceb249d17cea7576506b5115f3f..ca268859ac34db989dbacc87189c63cef4fc749f 100644 (file)
@@ -28,7 +28,8 @@
 
 class gr_fll_band_edge_cc;
 typedef boost::shared_ptr<gr_fll_band_edge_cc> gr_fll_band_edge_cc_sptr;
-gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (const std::vector<gr_complex> &taps);
+gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float alpha, float beta,
+                                                  const std::vector<gr_complex> &taps);
 
 class gr_fir_ccc;
 class gri_fft_complex;
@@ -47,7 +48,8 @@ class gr_fll_band_edge_cc : public gr_sync_block
    * Build the FLL
    * \param taps    (vector/list of gr_complex) The taps of the band-edge filter
    */
-  friend gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (const std::vector<gr_complex> &taps);
+  friend gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float alpha, float beta,
+                                                           const std::vector<gr_complex> &taps);
 
   float                   d_alpha;
   float                   d_beta;
@@ -66,7 +68,8 @@ class gr_fll_band_edge_cc : public gr_sync_block
    * Build the FLL
    * \param taps    (vector/list of gr_complex) The taps of the band-edge filter
    */
-  gr_fll_band_edge_cc(const std::vector<gr_complex> &taps);
+  gr_fll_band_edge_cc(float alpha, float beta,
+                     const std::vector<gr_complex> &taps);
 
 public:
   ~gr_fll_band_edge_cc ();
index a550bec4e437835d9fc9463b78c1e04ee6914ea8..9891d1405c9205557c2d82bcbfca27b20a1bf387 100644 (file)
 
 GR_SWIG_BLOCK_MAGIC(gr,fll_band_edge_cc);
 
-gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (const std::vector<gr_complex> &taps);
+gr_fll_band_edge_cc_sptr gr_make_fll_band_edge_cc (float alpha, float beta,
+                                                  const std::vector<gr_complex> &taps);
 
 class gr_fll_band_edge_cc : public gr_sync_block
 {
  private:
-  gr_fll_band_edge_cc (const std::vector<gr_complex> &taps);
+  gr_fll_band_edge_cc (float alpha, float beta,
+                      const std::vector<gr_complex> &taps);
 
  public:
   ~gr_fll_band_edge_cc ();
index 4fe2c03f12358cbc8e26dc4a71010279b068ce3b..dc4a650ea962cd1b1f608c43579c96c5e3d16d30 100644 (file)
@@ -8,7 +8,7 @@
        <name>FLL Band-Edge</name>
        <key>gr_fll_band_edge_cc</key>
        <import>from gnuradio import gr</import>
-       <make>gr.fll_band_edge_cc($taps)</make>
+       <make>gr.fll_band_edge_cc($alpha, $beta, $taps)</make>
        <callback>set_taps($taps)</callback>
 
        <param>
                </option>
        </param>
 
+       <param>
+               <name>Alpha</name>
+               <key>alpha</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Beta</name>
+               <key>beta</key>
+               <type>real</type>
+       </param>
        <param>
                <name>Taps</name>
                <key>taps</key>