diff options
-rw-r--r-- | gr-wxgui/grc/wxgui_constellationsink2.xml | 8 | ||||
-rw-r--r-- | gr-wxgui/src/python/const_window.py | 22 | ||||
-rw-r--r-- | gr-wxgui/src/python/constants.py | 1 | ||||
-rw-r--r-- | gr-wxgui/src/python/constsink_gl.py | 25 |
4 files changed, 29 insertions, 27 deletions
diff --git a/gr-wxgui/grc/wxgui_constellationsink2.xml b/gr-wxgui/grc/wxgui_constellationsink2.xml index c200790f9..f9df9d4ac 100644 --- a/gr-wxgui/grc/wxgui_constellationsink2.xml +++ b/gr-wxgui/grc/wxgui_constellationsink2.xml @@ -18,7 +18,7 @@ constsink_gl.const_sink_c( const_size=$const_size, M=$M, theta=$theta, - alpha=$alpha, + loop_bw=$loop_bw, fmax=$fmax, mu=$mu, gain_mu=$gain_mu, @@ -71,9 +71,9 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <type>real</type> </param> <param> - <name>Alpha</name> - <key>alpha</key> - <value>0.005</value> + <name>Loop Bandwidth</name> + <key>loop_bw</key> + <value>6.28/100.0</value> <type>real</type> </param> <param> diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py index f7c7caf07..2ad89b2a3 100644 --- a/gr-wxgui/src/python/const_window.py +++ b/gr-wxgui/src/python/const_window.py @@ -36,7 +36,7 @@ import forms # Constants ################################################## SLIDER_STEPS = 200 -ALPHA_MIN_EXP, ALPHA_MAX_EXP = -6, -0.301 +LOOP_BW_MIN_EXP, LOOP_BW_MAX_EXP = -6, 0.0 GAIN_MU_MIN_EXP, GAIN_MU_MAX_EXP = -6, -0.301 DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'const_rate', 5) DEFAULT_WIN_SIZE = (500, 400) @@ -70,19 +70,19 @@ class control_panel(wx.Panel): parent=self, label='Options', bold=True, orient=wx.VERTICAL, ) - #alpha + #loop_bw control_box.AddStretchSpacer() forms.text_box( - sizer=control_box, parent=self, label='Alpha', + sizer=control_box, parent=self, label='Loop Bandwidth', converter=forms.float_converter(), - ps=parent, key=ALPHA_KEY, + ps=parent, key=LOOP_BW_KEY, ) forms.log_slider( sizer=control_box, parent=self, - min_exp=ALPHA_MIN_EXP, - max_exp=ALPHA_MAX_EXP, + min_exp=LOOP_BW_MIN_EXP, + max_exp=LOOP_BW_MAX_EXP, num_steps=SLIDER_STEPS, - ps=parent, key=ALPHA_KEY, + ps=parent, key=LOOP_BW_KEY, ) #gain_mu control_box.AddStretchSpacer() @@ -127,8 +127,7 @@ class const_window(wx.Panel, pubsub.pubsub): size, title, msg_key, - alpha_key, - beta_key, + loop_bw_key, gain_mu_key, gain_omega_key, omega_key, @@ -137,8 +136,7 @@ class const_window(wx.Panel, pubsub.pubsub): pubsub.pubsub.__init__(self) #proxy the keys self.proxy(MSG_KEY, controller, msg_key) - self.proxy(ALPHA_KEY, controller, alpha_key) - self.proxy(BETA_KEY, controller, beta_key) + self.proxy(LOOP_BW_KEY, controller, loop_bw_key) self.proxy(GAIN_MU_KEY, controller, gain_mu_key) self.proxy(GAIN_OMEGA_KEY, controller, gain_omega_key) self.proxy(OMEGA_KEY, controller, omega_key) @@ -164,8 +162,6 @@ class const_window(wx.Panel, pubsub.pubsub): main_box.Add(self.control_panel, 0, wx.EXPAND) self.SetSizerAndFit(main_box) #alpha and gain mu 2nd orders - def set_beta(alpha): self[BETA_KEY] = .25*alpha**2 - self.subscribe(ALPHA_KEY, set_beta) def set_gain_omega(gain_mu): self[GAIN_OMEGA_KEY] = .25*gain_mu**2 self.subscribe(GAIN_MU_KEY, set_gain_omega) #register events diff --git a/gr-wxgui/src/python/constants.py b/gr-wxgui/src/python/constants.py index 070be0808..08cc6a634 100644 --- a/gr-wxgui/src/python/constants.py +++ b/gr-wxgui/src/python/constants.py @@ -73,3 +73,4 @@ NUM_BINS_KEY = 'num_bins' FRAME_SIZE_KEY = 'frame_size' CHANNEL_OPTIONS_KEY = 'channel_options' SHOW_CONTROL_PANEL_KEY = 'show_control_panel' +LOOP_BW_KEY = 'loop_bw' diff --git a/gr-wxgui/src/python/constsink_gl.py b/gr-wxgui/src/python/constsink_gl.py index 91bc65d9f..51434df68 100644 --- a/gr-wxgui/src/python/constsink_gl.py +++ b/gr-wxgui/src/python/constsink_gl.py @@ -27,6 +27,12 @@ import common from gnuradio import gr, blks2 from pubsub import pubsub from constants import * +import sys +try: + from gnuradio import digital +except ImportError: + sys.stderr.write("Error: could not import gnuradio.digital, please install gr-digitial.\n") + sys.exit(1) ################################################## # Constellation sink block (wrapper for old wxgui) @@ -47,7 +53,7 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): #mpsk recv params M=4, theta=0, - alpha=0.005, + loop_bw=6.28/100.0, fmax=0.06, mu=0.5, gain_mu=0.005, @@ -68,16 +74,18 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): vec_rate=frame_rate, vec_len=const_size, ) - beta = .25*alpha**2 #redundant, will be updated fmin = -fmax gain_omega = .25*gain_mu**2 #redundant, will be updated omega = 1 #set_sample_rate will update this # Costas frequency/phase recovery loop # Critically damped 2nd order PLL - self._costas = gr.costas_loop_cc(alpha, beta, fmax, fmin, M) + self._costas = digital.costas_loop_cc(loop_bw, M) # Timing recovery loop # Critically damped 2nd order DLL - self._retime = gr.clock_recovery_mm_cc(omega, gain_omega, mu, gain_mu, omega_limit) + self._retime = digital.clock_recovery_mm_cc(omega, + gain_omega, + mu, gain_mu, + omega_limit) #sync = gr.mpsk_receiver_cc( # M, #psk order # theta, @@ -97,10 +105,8 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): #controller def setter(p, k, x): p[k] = x self.controller = pubsub() - self.controller.subscribe(ALPHA_KEY, self._costas.set_alpha) - self.controller.publish(ALPHA_KEY, self._costas.alpha) - self.controller.subscribe(BETA_KEY, self._costas.set_beta) - self.controller.publish(BETA_KEY, self._costas.beta) + self.controller.subscribe(LOOP_BW_KEY, self._costas.set_loop_bandwidth) + self.controller.publish(LOOP_BW_KEY, self._costas.get_loop_bandwidth) self.controller.subscribe(GAIN_MU_KEY, self._retime.set_gain_mu) self.controller.publish(GAIN_MU_KEY, self._retime.gain_mu) self.controller.subscribe(OMEGA_KEY, self._retime.set_omega) @@ -121,8 +127,7 @@ class const_sink_c(gr.hier_block2, common.wxgui_hb): size=size, title=title, msg_key=MSG_KEY, - alpha_key=ALPHA_KEY, - beta_key=BETA_KEY, + loop_bw_key=LOOP_BW_KEY, gain_mu_key=GAIN_MU_KEY, gain_omega_key=GAIN_OMEGA_KEY, omega_key=OMEGA_KEY, |