commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r3635 - in gnuradio/branches/developers/trondeau/digit


From: trondeau
Subject: [Commit-gnuradio] r3635 - in gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src: lib/general python/gnuradio/blksimpl
Date: Mon, 25 Sep 2006 12:06:52 -0600 (MDT)

Author: trondeau
Date: 2006-09-25 12:06:51 -0600 (Mon, 25 Sep 2006)
New Revision: 3635

Added:
   
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.cc
   
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.h
   
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.i
   
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.lo
Modified:
   
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/blksimpl/dbpsk.py
   
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/blksimpl/dqpsk.py
Log:
added yet _another_ agc loop with log reponse instead of linear -- with the 
files this time

Added: 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.cc
                           (rev 0)
+++ 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.cc
   2006-09-25 18:06:51 UTC (rev 3635)
@@ -0,0 +1,92 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_agc_log_cc.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+gr_agc_log_cc_sptr
+gr_make_agc_log_cc(float gain, float reference, float limit)
+{
+  return gr_agc_log_cc_sptr(new gr_agc_log_cc (gain, reference, limit));
+}
+
+gr_agc_log_cc::gr_agc_log_cc (float gain, float reference, float limit)
+  : gr_sync_block ("gr_agc_log_cc",
+                  gr_make_io_signature (1, 1, sizeof (gr_complex)),
+                  gr_make_io_signature (1, 2, sizeof (gr_complex))),
+    d_gain(gain), d_reference(reference), d_limit(limit),
+    d_v1(0), d_vx(10), d_loop_gain(1)
+{
+  fprintf(stdout, "reference = %f \t gain = %f\n", d_reference, d_gain);
+  set_history(2);
+}
+
+gr_agc_log_cc::~gr_agc_log_cc()
+{
+}
+
+inline static float
+sqrt_mag_squared(gr_complex x)
+{
+  return sqrt(x.real() * x.real() + x.imag() * x.imag());
+}
+
+int
+gr_agc_log_cc::work(int noutput_items,
+                gr_vector_const_void_star &input_items,
+                gr_vector_void_star &output_items)
+{
+  const gr_complex *in = (const gr_complex *) input_items[0];
+  gr_complex *out = (gr_complex *) output_items[0];
+  gr_complex *err = (gr_complex *) output_items[1];
+
+  float mag=0;
+  float alpha = 0.005;
+
+  bool write_err = output_items.size() >= 2;
+
+  for (int i = 0; i < noutput_items; i++){
+    out[i] = d_loop_gain * in[i];
+
+    mag = sqrt_mag_squared(out[i]);
+    if(mag == 0)
+      mag = 1e-5;
+    d_v1 = -log10(mag) + d_reference;
+    d_v1 = (d_gain * d_v1);
+
+    d_vx = (alpha*d_v1) + (1-alpha)*d_vx;
+    
+    d_loop_gain = pow(10, d_vx);
+    if((d_limit > 0.0) && (d_loop_gain > d_limit)) {
+      d_loop_gain = d_limit;
+    }
+    
+    if(write_err)
+      err[i] = gr_complex(mag, d_loop_gain);
+  }
+  return noutput_items;
+}

Added: 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.h
===================================================================
--- 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.h
                            (rev 0)
+++ 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.h
    2006-09-25 18:06:51 UTC (rev 3635)
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_AGC_LOG_CC_H
+#define INCLUDED_GR_AGC_LOG_CC_H
+
+#include <gr_sync_block.h>
+
+class gr_agc_log_cc;
+typedef boost::shared_ptr<gr_agc_log_cc> gr_agc_log_cc_sptr;
+
+gr_agc_log_cc_sptr
+gr_make_agc_log_cc(float gain, float reference = 1.0, float limit = 0.0);
+
+/*!
+ * \brief New exponential AGC loop
+ */
+class gr_agc_log_cc : public gr_sync_block
+{
+  friend gr_agc_log_cc_sptr 
+  gr_make_agc_log_cc(float gain, float reference, float limit);
+  
+  gr_agc_log_cc(float gain, float reference, float limit);
+
+ public:
+  ~gr_agc_log_cc();
+
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+
+ private:
+  float d_reference;
+  float d_gain;
+  float d_loop_gain;
+  float d_limit;
+  float d_v1, d_vx;
+
+};
+
+#endif /* INCLUDED_GR_AGC_LOG_CC_H */

Added: 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.i
===================================================================
--- 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.i
                            (rev 0)
+++ 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.i
    2006-09-25 18:06:51 UTC (rev 3635)
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,agc_log_cc);
+
+gr_agc_log_cc_sptr
+gr_make_agc_log_cc(float gain, float reference = 1.0, float limit = 0.0);
+
+class gr_agc_log_cc : public gr_sync_block
+{
+  gr_agc_log_cc(float gain, float reference, float limit);
+  
+ public:
+  ~gr_agc_log_cc();
+};

Added: 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.lo
===================================================================
--- 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.lo
                           (rev 0)
+++ 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/lib/general/gr_agc_log_cc.lo
   2006-09-25 18:06:51 UTC (rev 3635)
@@ -0,0 +1,12 @@
+# gr_agc_log_cc.lo - a libtool object file
+# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 
22:14:06)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object='.libs/gr_agc_log_cc.o'
+
+# Name of the non-PIC object.
+non_pic_object=none
+

Modified: 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/blksimpl/dbpsk.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/blksimpl/dbpsk.py
      2006-09-25 18:06:14 UTC (rev 3634)
+++ 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/blksimpl/dbpsk.py
      2006-09-25 18:06:51 UTC (rev 3635)
@@ -236,8 +236,10 @@
         # Automatic gain control
         scale = (1.0/16384.0)
         self.pre_scaler = gr.multiply_const_cc(scale)   # scale the signal 
from full-range to +-1
-        self.agc = gr.agc2_cc(6e-1, 6e-1, 1, 1, 1000)
-        
+        #self.agc = gr.agc2_cc(6e-1, 6e-1, 1, 1, 1000)
+        #self.agc = gr.feedforward_agc_cc(500, 1)
+        self.agc = gr.agc3_cc(0.5, 1)
+
         # Costas loop (carrier tracking)
         # FIXME: need to decide how to handle this more generally; do we pull 
it from higher layer?
         costas_order = 2
@@ -309,6 +311,8 @@
         print "Modulation logging turned on."
         self._fg.connect(self.agc,
                          gr.file_sink(gr.sizeof_gr_complex, "agc.dat"))
+        self._fg.connect((self.agc,1),
+                         gr.file_sink(gr.sizeof_gr_complex, "agc_err.dat"))
         self._fg.connect(self.costas_loop,
                          gr.file_sink(gr.sizeof_gr_complex, "costas_loop.dat"))
         self._fg.connect((self.costas_loop,1),

Modified: 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/blksimpl/dqpsk.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/blksimpl/dqpsk.py
      2006-09-25 18:06:14 UTC (rev 3634)
+++ 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-core/src/python/gnuradio/blksimpl/dqpsk.py
      2006-09-25 18:06:51 UTC (rev 3635)
@@ -234,7 +234,8 @@
         # Automatic gain control
         scale = (1.0/16384.0)
         self.pre_scaler = gr.multiply_const_cc(scale)   # scale the signal 
from full-range to +-1
-        self.agc = gr.agc2_cc(6e-1, 6e-1, 1, 1, 1000)
+        #self.agc = gr.agc2_cc(6e-1, 6e-1, 1, 1, 1000)
+        self.agc = gr.agc3_cc(0.5, 1)
        
         # Costas loop (carrier tracking)
         # FIXME: need to decide how to handle this more generally; do we pull 
it from higher layer?





reply via email to

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