diff options
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc | 20 | ||||
-rw-r--r-- | gnuradio-examples/grc/demod/pam_timing.grc | 646 | ||||
-rw-r--r-- | grc/blocks/gr_pfb_clock_sync.xml | 10 |
3 files changed, 541 insertions, 135 deletions
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc index b67efc52d..79779c91c 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc @@ -209,9 +209,12 @@ gr_pfb_clock_sync_ccf::general_work (int noutput_items, gr_complex *in = (gr_complex *) input_items[0]; gr_complex *out = (gr_complex *) output_items[0]; - float *err; - if(ninput_items.size() == 2) + float *err, *outrate, *outk; + if(output_items.size() > 2) { err = (float *) output_items[1]; + outrate = (float*)output_items[2]; + outk = (float*)output_items[3]; + } if (d_updated) { d_updated = false; @@ -230,9 +233,6 @@ gr_pfb_clock_sync_ccf::general_work (int noutput_items, out[i] = d_filters[filtnum]->filter(&in[count]); error = (out[i] * d_diff_filters[filtnum]->filter(&in[count])).real(); - if(ninput_items.size() == 2) - err[i] = error; - d_k = d_k + d_alpha*error + d_rate; d_rate = d_rate + d_beta*error; while(d_k >= d_nfilters) { @@ -247,8 +247,14 @@ gr_pfb_clock_sync_ccf::general_work (int noutput_items, i++; count += d_sps; - printf("error: %f k: %f rate: %f\n", - error, d_k, d_rate); + if(output_items.size() > 2) { + err[i] = error; + outrate[i] = d_rate; + outk[i] = d_k; + } + + //printf("error: %f k: %f rate: %f\n", + // error, d_k, d_rate); } // Set the start index at the next entrance to the work function diff --git a/gnuradio-examples/grc/demod/pam_timing.grc b/gnuradio-examples/grc/demod/pam_timing.grc index 989c795a9..8722714b8 100644 --- a/gnuradio-examples/grc/demod/pam_timing.grc +++ b/gnuradio-examples/grc/demod/pam_timing.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Tue Oct 6 14:19:10 2009</timestamp> + <timestamp>Tue Oct 6 18:00:19 2009</timestamp> <block> <key>options</key> <param> @@ -57,22 +57,38 @@ </param> </block> <block> - <key>variable</key> + <key>random_source_x</key> <param> <key>id</key> - <value>samp_rate</value> + <value>random_source_x_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>32000</value> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>2</value> + </param> + <param> + <key>num_samps</key> + <value>1000</value> + </param> + <param> + <key>repeat</key> + <value>True</value> </param> <param> <key>_coordinate</key> - <value>(128, 9)</value> + <value>(13, 80)</value> </param> <param> <key>_rotation</key> @@ -80,18 +96,26 @@ </param> </block> <block> - <key>gr_uchar_to_float</key> + <key>const_source_x</key> <param> <key>id</key> - <value>gr_uchar_to_float_0</value> + <value>const_source_x_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>const</key> + <value>-0.5</value> + </param> + <param> <key>_coordinate</key> - <value>(270, 115)</value> + <value>(179, 160)</value> </param> <param> <key>_rotation</key> @@ -99,18 +123,22 @@ </param> </block> <block> - <key>random_source_x</key> + <key>variable_slider</key> <param> <key>id</key> - <value>random_source_x_0</value> + <value>noise_amp</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>byte</value> + <key>label</key> + <value>noise_amp</value> + </param> + <param> + <key>value</key> + <value>0</value> </param> <param> <key>min</key> @@ -118,19 +146,148 @@ </param> <param> <key>max</key> - <value>2</value> + <value>1.0</value> </param> <param> - <key>num_samps</key> + <key>num_steps</key> <value>1000</value> </param> <param> - <key>repeat</key> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(600, -1)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_noise_source_x</key> + <param> + <key>id</key> + <value>gr_noise_source_x_0</value> + </param> + <param> + <key>_enabled</key> <value>True</value> </param> <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>noise_type</key> + <value>gr.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noise_amp</value> + </param> + <param> + <key>seed</key> + <value>42</value> + </param> + <param> <key>_coordinate</key> - <value>(13, 80)</value> + <value>(45, 497)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>root_raised_cosine_filter</key> + <param> + <key>id</key> + <value>root_raised_cosine_filter_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>interp_fir_filter_fff</value> + </param> + <param> + <key>decim</key> + <value>1</value> + </param> + <param> + <key>interp</key> + <value>spb</value> + </param> + <param> + <key>gain</key> + <value>2*spb</value> + </param> + <param> + <key>samp_rate</key> + <value>1.0</value> + </param> + <param> + <key>sym_rate</key> + <value>1./spb</value> + </param> + <param> + <key>alpha</key> + <value>0.35</value> + </param> + <param> + <key>ntaps</key> + <value>11*spb</value> + </param> + <param> + <key>_coordinate</key> + <value>(50, 295)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(375, 390)</value> </param> <param> <key>_rotation</key> @@ -141,7 +298,7 @@ <key>const_source_x</key> <param> <key>id</key> - <value>const_source_x_0</value> + <value>const_source_x_1</value> </param> <param> <key>_enabled</key> @@ -153,11 +310,11 @@ </param> <param> <key>const</key> - <value>-0.5</value> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(179, 160)</value> + <value>(36, 723)</value> </param> <param> <key>_rotation</key> @@ -165,7 +322,7 @@ </param> </block> <block> - <key>variable_chooser</key> + <key>variable</key> <param> <key>id</key> <value>spb</value> @@ -175,40 +332,58 @@ <value>True</value> </param> <param> - <key>label</key> - <value>Samples Per Bit</value> - </param> - <param> <key>value</key> <value>4</value> </param> <param> - <key>choices</key> - <value>[1, 2, 3, 4, 5, 6, 7, 8]</value> + <key>_coordinate</key> + <value>(34, 915)</value> </param> <param> - <key>labels</key> - <value>[]</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>type</key> - <value>drop_down</value> + <key>id</key> + <value>nfilts</value> </param> <param> - <key>style</key> - <value>wx.RA_HORIZONTAL</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>grid_pos</key> - <value></value> + <key>value</key> + <value>32</value> </param> <param> - <key>notebook</key> - <value></value> + <key>_coordinate</key> + <value>(31, 828)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>rrctaps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>firdes.root_raised_cosine(nfilts,1.0,0.25/nfilts, .35, 11*spb*nfilts)</value> </param> <param> <key>_coordinate</key> - <value>(0, 834)</value> + <value>(180, 935)</value> </param> <param> <key>_rotation</key> @@ -216,10 +391,10 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>wxgui_scopesink2_0</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> @@ -227,47 +402,92 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> - <key>title</key> - <value>Scope Plot</value> + <key>samples_per_second</key> + <value>samp_rate</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>v_scale</key> + <key>_coordinate</key> + <value>(757, 418)</value> + </param> + <param> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>gr_uchar_to_float</key> <param> - <key>t_scale</key> + <key>id</key> + <value>gr_uchar_to_float_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(261, 107)</value> + </param> + <param> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>gr_float_to_complex</key> <param> - <key>ac_couple</key> - <value>False</value> + <key>id</key> + <value>gr_float_to_complex_0</value> </param> <param> - <key>xy_mode</key> - <value>False</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>num_inputs</key> + <key>vlen</key> <value>1</value> </param> <param> - <key>grid_pos</key> - <value></value> + <key>_coordinate</key> + <value>(380, 553)</value> </param> <param> - <key>notebook</key> - <value></value> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_fractional_interpolator_xx</key> + <param> + <key>id</key> + <value>gr_fractional_interpolator_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>phase_shift</key> + <value>0.5</value> + </param> + <param> + <key>interp_ratio</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(750, 128)</value> + <value>(349, 662)</value> </param> <param> <key>_rotation</key> @@ -275,10 +495,33 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>variable</key> <param> <key>id</key> - <value>gr_add_xx_0</value> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>320000</value> + </param> + <param> + <key>_coordinate</key> + <value>(128, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0</value> </param> <param> <key>_enabled</key> @@ -286,19 +529,47 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>title</key> + <value>Scope Plot</value> </param> <param> - <key>vlen</key> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> <value>1</value> </param> <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> <key>_coordinate</key> - <value>(505, 128)</value> + <value>(789, 258)</value> </param> <param> <key>_rotation</key> @@ -309,7 +580,7 @@ <key>variable_slider</key> <param> <key>id</key> - <value>noise_amp</value> + <value>gain</value> </param> <param> <key>_enabled</key> @@ -317,7 +588,7 @@ </param> <param> <key>label</key> - <value>noise_amp</value> + <value>Gain</value> </param> <param> <key>value</key> @@ -329,7 +600,7 @@ </param> <param> <key>max</key> - <value>1.0</value> + <value>1</value> </param> <param> <key>num_steps</key> @@ -353,7 +624,7 @@ </param> <param> <key>_coordinate</key> - <value>(600, -1)</value> + <value>(757, -1)</value> </param> <param> <key>_rotation</key> @@ -361,10 +632,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>gr_add_xx</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>gr_add_xx_0</value> </param> <param> <key>_enabled</key> @@ -375,8 +646,8 @@ <value>float</value> </param> <param> - <key>samples_per_second</key> - <value>samp_rate</value> + <key>num_inputs</key> + <value>2</value> </param> <param> <key>vlen</key> @@ -384,7 +655,7 @@ </param> <param> <key>_coordinate</key> - <value>(561, 284)</value> + <value>(482, 130)</value> </param> <param> <key>_rotation</key> @@ -392,34 +663,34 @@ </param> </block> <block> - <key>gr_noise_source_x</key> + <key>notebook</key> <param> <key>id</key> - <value>gr_noise_source_x_0</value> + <value>notebook_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>style</key> + <value>wx.NB_TOP</value> </param> <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> + <key>labels</key> + <value>['error', 'phase', 'freq']</value> </param> <param> - <key>amp</key> - <value>noise_amp</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>seed</key> - <value>42</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(45, 497)</value> + <value>(851, 531)</value> </param> <param> <key>_rotation</key> @@ -427,10 +698,10 @@ </param> </block> <block> - <key>root_raised_cosine_filter</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>root_raised_cosine_filter_0</value> + <value>wxgui_scopesink2_0_0</value> </param> <param> <key>_enabled</key> @@ -438,39 +709,47 @@ </param> <param> <key>type</key> - <value>interp_fir_filter_fff</value> + <value>float</value> </param> <param> - <key>decim</key> - <value>1</value> + <key>title</key> + <value>Scope Plot</value> </param> <param> - <key>interp</key> - <value>spb</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>gain</key> - <value>2*spb</value> + <key>v_scale</key> + <value>0</value> </param> <param> - <key>samp_rate</key> - <value>1.0</value> + <key>t_scale</key> + <value>0</value> </param> <param> - <key>sym_rate</key> - <value>1./spb</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>alpha</key> - <value>0.35</value> + <key>xy_mode</key> + <value>False</value> </param> <param> - <key>ntaps</key> - <value>11*spb</value> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook_0,0</value> </param> <param> <key>_coordinate</key> - <value>(50, 295)</value> + <value>(798, 638)</value> </param> <param> <key>_rotation</key> @@ -478,10 +757,10 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>gr_add_xx_0_0</value> + <value>wxgui_scopesink2_0_0_0</value> </param> <param> <key>_enabled</key> @@ -492,16 +771,44 @@ <value>float</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>title</key> + <value>Scope Plot</value> </param> <param> - <key>vlen</key> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> <value>1</value> </param> <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook_0,1</value> + </param> + <param> <key>_coordinate</key> - <value>(374, 389)</value> + <value>(792, 777)</value> </param> <param> <key>_rotation</key> @@ -509,50 +816,97 @@ </param> </block> <block> - <key>root_raised_cosine_filter</key> + <key>gr_pfb_clock_sync_ccf</key> <param> <key>id</key> - <value>root_raised_cosine_filter_0_0</value> + <value>gr_pfb_clock_sync_ccf_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>interp_fir_filter_fff</value> + <key>sps</key> + <value>spb</value> </param> <param> - <key>decim</key> - <value>1</value> + <key>gain</key> + <value>gain</value> </param> <param> - <key>interp</key> - <value>1</value> + <key>taps</key> + <value>rrctaps</value> </param> <param> - <key>gain</key> - <value>1</value> + <key>filter_size</key> + <value>nfilts</value> + </param> + <param> + <key>init_phase</key> + <value>14</value> + </param> + <param> + <key>_coordinate</key> + <value>(341, 777)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0_0_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</value> </param> <param> <key>samp_rate</key> - <value>1.0</value> + <value>samp_rate</value> </param> <param> - <key>sym_rate</key> - <value>1./spb</value> + <key>v_scale</key> + <value>0</value> </param> <param> - <key>alpha</key> - <value>0.35</value> + <key>t_scale</key> + <value>0</value> </param> <param> - <key>ntaps</key> - <value>11*spb</value> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook_0,2</value> </param> <param> <key>_coordinate</key> - <value>(376, 598)</value> + <value>(797, 915)</value> </param> <param> <key>_rotation</key> @@ -603,14 +957,50 @@ </connection> <connection> <source_block_id>gr_add_xx_0_0</source_block_id> - <sink_block_id>root_raised_cosine_filter_0_0</sink_block_id> + <sink_block_id>gr_float_to_complex_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>root_raised_cosine_filter_0_0</source_block_id> + <source_block_id>const_source_x_1</source_block_id> + <sink_block_id>gr_float_to_complex_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_pfb_clock_sync_ccf_0</source_block_id> <sink_block_id>gr_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> + <connection> + <source_block_id>gr_pfb_clock_sync_ccf_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> + <source_key>1</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_float_to_complex_0</source_block_id> + <sink_block_id>gr_fractional_interpolator_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_fractional_interpolator_xx_0</source_block_id> + <sink_block_id>gr_pfb_clock_sync_ccf_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_pfb_clock_sync_ccf_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0_0</sink_block_id> + <source_key>3</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_pfb_clock_sync_ccf_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id> + <source_key>2</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> diff --git a/grc/blocks/gr_pfb_clock_sync.xml b/grc/blocks/gr_pfb_clock_sync.xml index 9e2f3fa9c..3a066c23c 100644 --- a/grc/blocks/gr_pfb_clock_sync.xml +++ b/grc/blocks/gr_pfb_clock_sync.xml @@ -50,4 +50,14 @@ <type>float</type> <optional>1</optional> </source> + <source> + <name>rate</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>phase</name> + <type>float</type> + <optional>1</optional> + </source> </block> |