diff options
513 files changed, 14868 insertions, 10868 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 47afd0511e..7706466c44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,6 +236,7 @@ add_subdirectory(gr-audio) add_subdirectory(gr-comedi) add_subdirectory(gr-analog) add_subdirectory(gr-digital) +add_subdirectory(gr-channels) add_subdirectory(gr-noaa) add_subdirectory(gr-pager) add_subdirectory(gr-qtgui) diff --git a/cmake/Packaging/Ubuntu-12.10.cmake b/cmake/Packaging/Ubuntu-12.10.cmake new file mode 100644 index 0000000000..702ce574f3 --- /dev/null +++ b/cmake/Packaging/Ubuntu-12.10.cmake @@ -0,0 +1,12 @@ +SET(PACKAGE_DEPENDS_GRUEL_RUNTIME "libboost-all-dev" "libc6") +SET(PACKAGE_DEPENDS_GRUEL_PYTHON "python" "python-numpy") +SET(PACKAGE_DEPENDS_CORE_RUNTIME "libfftw3-3") +SET(PACKAGE_DEPENDS_QTGUI_RUNTIME "libqtcore4" "libqwt6") +SET(PACKAGE_DEPENDS_QTGUI_PYTHON "python-qt4" "python-qwt5-qt4") +SET(PACKAGE_DEPENDS_GRC "python" "python-numpy" "python-gtk2" "python-lxml" "python-cheetah") +SET(PACKAGE_DEPENDS_WXGUI "python-wxgtk2.8") +SET(PACKAGE_DEPENDS_VIDEO_SDL_RUNTIME "libsdl1.2debian") +SET(PACKAGE_DEPENDS_UHD_RUNTIME "uhd") +SET(PACKAGE_DEPENDS_AUDIO_RUNTIME "libpulse0" "alsa-base" "libjack0") +SET(PACKAGE_DEPENDS_WAVELET_RUNTIME "libgsl0ldbl") +SET(PACKAGE_DEPENDS_WAVELET_PYTHON "python" "python-numpy") diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index 2826824647..15a56d0dec 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -62,7 +62,7 @@ done. A single source and sink are used with a FIR filter between them. \code - from gnuradio import gr, filter + from gnuradio import gr, filter, analog class my_topblock(gr.top_block): def __init__(self): @@ -71,7 +71,7 @@ them. amp = 1 taps = filter.firdes.low_pass(1, 1, 0.1, 0.01) - self.src = gr.noise_source_c(gr.GR_GAUSSIAN, amp) + self.src = analog.noise_source_c(gr.GR_GAUSSIAN, amp) self.flt = filter.fir_filter_ccf(1, taps) self.snk = gr.null_sink(gr.sizeof_gr_complex) @@ -203,19 +203,19 @@ running and processing data, performing the reconfiguration, and then restarting the graph by unlocking it. The following example code shows a graph that first adds two -gr_noise_source_c blocks and then replaces the gr_add_cc block with a +analog::noise_source_c blocks and then replaces the gr_add_cc block with a gr_sub_cc block to then subtract the sources. \code -from gnuradio import gr +from gnuradio import gr, analog import time class mytb(gr.top_block): def __init__(self): gr.top_block.__init__(self) - self.src0 = gr.noise_source_c(gr.GR_GAUSSIAN, 1) - self.src1 = gr.noise_source_c(gr.GR_GAUSSIAN, 1) + self.src0 = analog.noise_source_c(gr.GR_GAUSSIAN, 1) + self.src1 = analog.noise_source_c(gr.GR_GAUSSIAN, 1) self.add = gr.add_cc() self.sub = gr.sub_cc() self.head = gr.head(gr.sizeof_gr_complex, 1000000) @@ -262,15 +262,15 @@ The following example expands the previous example but sets and resets the max noutput_items both locally and globally. \code -from gnuradio import gr +from gnuradio import gr, analog import time class mytb(gr.top_block): def __init__(self): gr.top_block.__init__(self) - self.src0 = gr.noise_source_c(gr.GR_GAUSSIAN, 1) - self.src1 = gr.noise_source_c(gr.GR_GAUSSIAN, 1) + self.src0 = analog.noise_source_c(gr.GR_GAUSSIAN, 1) + self.src1 = analog.noise_source_c(gr.GR_GAUSSIAN, 1) self.add = gr.add_cc() self.sub = gr.sub_cc() self.head = gr.head(gr.sizeof_gr_complex, 1000000) diff --git a/docs/doxygen/other/pfb_intro.dox b/docs/doxygen/other/pfb_intro.dox index 429e8fe5b6..504ae87b87 100644 --- a/docs/doxygen/other/pfb_intro.dox +++ b/docs/doxygen/other/pfb_intro.dox @@ -64,9 +64,9 @@ defined to use a sample rate of \p filter_size times the signal's sampling rate. A helpful wrapper for the arbitrary resampler is found in -<b>gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py</b>, -which is exposed in Python as <b>blks2.pfb_arb_resampler_ccf</b> and -<b>blks2.pfb_arb_resampler_fff</b>. This block is set up so that the +<b>gr-filter/python/pfb.py</b>, +which is exposed in Python as <b>filter.pfb.arb_resampler_ccf</b> and +<b>filter.pfb.arb_resampler_fff</b>. This block is set up so that the user only needs to pass it the real number \p rate as the resampling rate. With just this information, this hierarchical block automatically creates a filter that fully passes the signal bandwidth diff --git a/docs/exploring-gnuradio/dial_tone.py b/docs/exploring-gnuradio/dial_tone.py index cabfa0864d..ba43c43bfc 100755 --- a/docs/exploring-gnuradio/dial_tone.py +++ b/docs/exploring-gnuradio/dial_tone.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,22 +22,23 @@ from gnuradio import gr from gnuradio import audio +from gnuradio import analog -def build_graph (): +def build_graph(): sampling_freq = 32000 ampl = 0.1 - tb = gr.top_block () - src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl) - dst = audio.sink (sampling_freq) - tb.connect (src0, (dst, 0)) - tb.connect (src1, (dst, 1)) + tb = gr.top_block() + src0 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, 350, ampl) + src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, 440, ampl) + dst = audio.sink(sampling_freq) + tb.connect(src0, (dst, 0)) + tb.connect(src1, (dst, 1)) return tb if __name__ == '__main__': - tb = build_graph () - tb.start () - raw_input ('Press Enter to quit: ') - tb.stop () + tb = build_graph() + tb.start() + raw_input('Press Enter to quit: ') + tb.stop() diff --git a/docs/exploring-gnuradio/dial_tone_example.xml b/docs/exploring-gnuradio/dial_tone_example.xml index 14ea68039e..5d193df776 100644 --- a/docs/exploring-gnuradio/dial_tone_example.xml +++ b/docs/exploring-gnuradio/dial_tone_example.xml @@ -5,24 +5,25 @@ from gnuradio import gr from gnuradio import audio +from gnuradio import analog def build_graph (): sampling_freq = 48000 ampl = 0.1 - fg = gr.flow_graph () - src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl) - dst = audio.sink (sampling_freq) - fg.connect ((src0, 0), (dst, 0)) - fg.connect ((src1, 0), (dst, 1)) + fg = gr.flow_graph() + src0 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, 350, ampl) + src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, 440, ampl) + dst = audio.sink(sampling_freq) + fg.connect((src0, 0), (dst, 0)) + fg.connect((src1, 0), (dst, 1)) return fg if __name__ == '__main__': - fg = build_graph () - fg.start () - raw_input ('Press Enter to quit: ') - fg.stop () + fg = build_graph() + fg.start() + raw_input('Press Enter to quit: ') + fg.stop() </programlisting> </example> diff --git a/docs/exploring-gnuradio/exploring-gnuradio.xml b/docs/exploring-gnuradio/exploring-gnuradio.xml index 286ca86095..5b70d4d0bf 100644 --- a/docs/exploring-gnuradio/exploring-gnuradio.xml +++ b/docs/exploring-gnuradio/exploring-gnuradio.xml @@ -180,7 +180,7 @@ right.</para> <para>We start by creating a flow graph to hold the blocks and connections between them. The two sine waves are generated by the -gr.sig_source_f calls. The f suffix indicates that the source produces +analog.sig_source_f calls. The f suffix indicates that the source produces floats. One sine wave is at 350 Hz, and the other is at 440 Hz. Together, they sound like the US dial tone.</para> diff --git a/docs/exploring-gnuradio/fm_demod.py b/docs/exploring-gnuradio/fm_demod.py index 0071fd751e..7b19cd826a 100755 --- a/docs/exploring-gnuradio/fm_demod.py +++ b/docs/exploring-gnuradio/fm_demod.py @@ -1,18 +1,19 @@ #!/usr/bin/env python from gnuradio import gr +from gnuradio import analog from gnuradio import audio from gnuradio import mc4020 import sys -def high_speed_adc (fg, input_rate): +def high_speed_adc(fg, input_rate): # return gr.file_source (gr.sizeof_short, "dummy.dat", False) - return mc4020.source (input_rate, mc4020.MCC_CH3_EN | mc4020.MCC_ALL_1V) + return mc4020.source(input_rate, mc4020.MCC_CH3_EN | mc4020.MCC_ALL_1V) # # return a gr.flow_graph # -def build_graph (freq1, freq2): +def build_graph(freq1, freq2): input_rate = 20e6 cfir_decimation = 125 audio_decimation = 5 @@ -20,35 +21,35 @@ def build_graph (freq1, freq2): quad_rate = input_rate / cfir_decimation audio_rate = quad_rate / audio_decimation - fg = gr.flow_graph () + fg = gr.flow_graph() # use high speed ADC as input source - src = high_speed_adc (fg, input_rate) + src = high_speed_adc(fg, input_rate) # compute FIR filter taps for channel selection channel_coeffs = \ - gr.firdes.low_pass (1.0, # gain - input_rate, # sampling rate - 250e3, # low pass cutoff freq - 8*100e3, # width of trans. band - gr.firdes.WIN_HAMMING) + filter.firdes.low_pass(1.0, # gain + input_rate, # sampling rate + 250e3, # low pass cutoff freq + 8*100e3, # width of trans. band + filter.firdes.WIN_HAMMING) # input: short; output: complex chan_filter1 = \ - gr.freq_xlating_fir_filter_scf (cfir_decimation, - channel_coeffs, - freq1, # 1st station freq - input_rate) + filter.freq_xlating_fir_filter_scf(cfir_decimation, + channel_coeffs, + freq1, # 1st station freq + input_rate) - (head1, tail1) = build_pipeline (fg, quad_rate, audio_decimation) + (head1, tail1) = build_pipeline(fg, quad_rate, audio_decimation) # sound card as final sink - audio_sink = audio.sink (int (audio_rate)) + audio_sink = audio.sink(int (audio_rate)) # now wire it all together - fg.connect (src, chan_filter1) - fg.connect (chan_filter1, head1) - fg.connect (tail1, (audio_sink, 0)) + fg.connect(src, chan_filter1) + fg.connect(chan_filter1, head1) + fg.connect(tail1, (audio_sink, 0)) # two stations at once? if freq2: @@ -57,20 +58,20 @@ def build_graph (freq1, freq2): # input: short; output: complex chan_filter2 = \ - gr.freq_xlating_fir_filter_scf (cfir_decimation, - channel_coeffs, - freq2, # 2nd station freq - input_rate) + filter.freq_xlating_fir_filter_scf(cfir_decimation, + channel_coeffs, + freq2, # 2nd station freq + input_rate) - (head2, tail2) = build_pipeline (fg, quad_rate, audio_decimation) + (head2, tail2) = build_pipeline(fg, quad_rate, audio_decimation) - fg.connect (src, chan_filter2) - fg.connect (chan_filter2, head2) - fg.connect (tail2, (audio_sink, 1)) + fg.connect(src, chan_filter2) + fg.connect(chan_filter2, head2) + fg.connect(tail2, (audio_sink, 1)) return fg -def build_pipeline (fg, quad_rate, audio_decimation): +def build_pipeline(fg, quad_rate, audio_decimation): '''Given a flow_graph, fg, construct a pipeline for demodulating a broadcast FM signal. The input is the downconverteed complex baseband @@ -84,67 +85,67 @@ def build_pipeline (fg, quad_rate, audio_decimation): volume = 1.0 # input: complex; output: float - fm_demod = gr.quadrature_demod_cf (volume*fm_demod_gain) + fm_demod = analog.quadrature_demod_cf(volume*fm_demod_gain) # compute FIR filter taps for audio filter width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - audio_rate/2 - width_of_transition_band, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0, # gain + quad_rate, # sampling rate + audio_rate/2 - width_of_transition_band, + width_of_transition_band, + filter.firdes.WIN_HAMMING) # input: float; output: float - audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) + audio_filter = filter.fir_filter_fff(audio_decimation, audiocoeffs) - fg.connect (fm_demod, audio_filter) + fg.connect(fm_demod, audio_filter) return ((fm_demod, 0), (audio_filter, 0)) -def main (args): - nargs = len (args) +def main(args): + nargs = len(args) if nargs == 1: - freq1 = float (args[0]) * 1e6 + freq1 = float(args[0]) * 1e6 freq2 = None elif nargs == 2: - freq1 = float (args[0]) * 1e6 - freq2 = float (args[1]) * 1e6 + freq1 = float(args[0]) * 1e6 + freq2 = float(args[1]) * 1e6 else: - sys.stderr.write ('usage: fm_demod freq1 [freq2]\n') - sys.exit (1) + sys.stderr.write('usage: fm_demod freq1 [freq2]\n') + sys.exit(1) # connect to RF front end - rf_front_end = gr.microtune_4937_eval_board () - if not rf_front_end.board_present_p (): + rf_front_end = gr.microtune_4937_eval_board() + if not rf_front_end.board_present_p(): raise IOError, 'RF front end not found' # set front end gain - rf_front_end.set_AGC (300) - IF_freq = rf_front_end.get_output_freq () + rf_front_end.set_AGC(300) + IF_freq = rf_front_end.get_output_freq() IF_freq = 5.75e6 if not freq2: # one station - rf_front_end.set_RF_freq (freq1) - fg = build_graph (IF_freq, None) + rf_front_end.set_RF_freq(freq1) + fg = build_graph(IF_freq, None) else: # two stations - if abs (freq1 - freq2) > 5.5e6: + if abs(freq1 - freq2) > 5.5e6: raise IOError, 'freqs too far apart' target_freq = (freq1 + freq2) / 2 - actual_freq = rf_front_end.set_RF_freq (target_freq) + actual_freq = rf_front_end.set_RF_freq(target_freq) #actual_freq = target_freq - fg = build_graph (IF_freq + freq1 - actual_freq, - IF_freq + freq2 - actual_freq) + fg = build_graph(IF_freq + freq1 - actual_freq, + IF_freq + freq2 - actual_freq) - fg.start () # fork thread(s) and return - raw_input ('Press Enter to quit: ') - fg.stop () + fg.start() # fork thread(s) and return + raw_input('Press Enter to quit: ') + fg.stop() if __name__ == '__main__': - main (sys.argv[1:]) + main(sys.argv[1:]) diff --git a/docs/exploring-gnuradio/fm_demod_example.xml b/docs/exploring-gnuradio/fm_demod_example.xml index b417da0a81..05c2ee163b 100644 --- a/docs/exploring-gnuradio/fm_demod_example.xml +++ b/docs/exploring-gnuradio/fm_demod_example.xml @@ -4,6 +4,8 @@ #!/usr/bin/env python from gnuradio import gr +from gnuradio import filter +from gnuradio import analog from gnuradio import audio from gnuradio import mc4020 import sys @@ -30,28 +32,28 @@ def build_graph (freq1, freq2): # compute FIR filter taps for channel selection channel_coeffs = \ - gr.firdes.low_pass (1.0, # gain - input_rate, # sampling rate - 250e3, # low pass cutoff freq - 8*100e3, # width of trans. band - gr.firdes.WIN_HAMMING) + filter.firdes.low_pass(1.0, # gain + input_rate, # sampling rate + 250e3, # low pass cutoff freq + 8*100e3, # width of trans. band + filter.firdes.WIN_HAMMING) # input: short; output: complex chan_filter1 = \ - gr.freq_xlating_fir_filter_scf (cfir_decimation, - channel_coeffs, - freq1, # 1st station freq - input_rate) + filter.freq_xlating_fir_filter_scf(cfir_decimation, + channel_coeffs, + freq1, # 1st station freq + input_rate) - (head1, tail1) = build_pipeline (fg, quad_rate, audio_decimation) + (head1, tail1) = build_pipeline(fg, quad_rate, audio_decimation) # sound card as final sink - audio_sink = audio.sink (int (audio_rate)) + audio_sink = audio.sink(int (audio_rate)) # now wire it all together - fg.connect (src, chan_filter1) - fg.connect (chan_filter1, head1) - fg.connect (tail1, (audio_sink, 0)) + fg.connect(src, chan_filter1) + fg.connect(chan_filter1, head1) + fg.connect(tail1, (audio_sink, 0)) return fg @@ -69,20 +71,20 @@ def build_pipeline (fg, quad_rate, audio_decimation): volume = 1.0 # input: complex; output: float - fm_demod = gr.quadrature_demod_cf (volume*fm_demod_gain) + fm_demod = analog.quadrature_demod_cf(volume*fm_demod_gain) # compute FIR filter taps for audio filter width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - audio_rate/2 - width_of_transition_band, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0, # gain + quad_rate, # sampling rate + audio_rate/2 - width_of_transition_band, + width_of_transition_band, + filter.firdes.WIN_HAMMING) # input: float; output: float - audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) + audio_filter = filter.fir_filter_fff(audio_decimation, audio_coeffs) - fg.connect (fm_demod, audio_filter) + fg.connect(fm_demod, audio_filter) return ((fm_demod, 0), (audio_filter, 0)) @@ -90,34 +92,34 @@ def main (args): nargs = len (args) if nargs == 1: # get station frequency from command line - freq1 = float (args[0]) * 1e6 + freq1 = float(args[0]) * 1e6 else: - sys.stderr.write ('usage: fm_demod freq\n') - sys.exit (1) + sys.stderr.write('usage: fm_demod freq\n') + sys.exit(1) # connect to RF front end - rf_front_end = gr.microtune_4937_eval_board () - if not rf_front_end.board_present_p (): + rf_front_end = gr.microtune_4937_eval_board() + if not rf_front_end.board_present_p(): raise IOError, 'RF front end not found' # set front end gain - rf_front_end.set_AGC (300) + rf_front_end.set_AGC(300) # determine the front end's "Intermediate Frequency" - IF_freq = rf_front_end.get_output_freq () # 5.75e6 + IF_freq = rf_front_end.get_output_freq() # 5.75e6 # Tell the front end to tune to freq1. # I.e., freq1 is translated down to the IF frequency - rf_front_end.set_RF_freq (freq1) + rf_front_end.set_RF_freq(freq1) # build the flow graph - fg = build_graph (IF_freq, None) + fg = build_graph(IF_freq, None) - fg.start () # fork thread(s) and return - raw_input ('Press Enter to quit: ') - fg.stop () + fg.start() # fork thread(s) and return + raw_input('Press Enter to quit: ') + fg.stop() if __name__ == '__main__': - main (sys.argv[1:]) + main(sys.argv[1:]) </programlisting> </example> diff --git a/docs/sphinx/source/blks2/blks.rst b/docs/sphinx/source/blks2/blks.rst index c28c7af0f8..6510169710 100644 --- a/docs/sphinx/source/blks2/blks.rst +++ b/docs/sphinx/source/blks2/blks.rst @@ -1,31 +1,9 @@ gnuradio.blks2: Signal Processing Blocks ======================================== -.. autopyblock:: gnuradio.blks2.am_demod_cf -.. autopyblock:: gnuradio.blks2.ctcss_gen_f -.. autopyblock:: gnuradio.blks2.demod_10k0a3e_cf -.. autopyblock:: gnuradio.blks2.demod_200kf3e_cf -.. autopyblock:: gnuradio.blks2.demod_20k0f3e_cf -.. autopyblock:: gnuradio.blks2.fm_demod_cf -.. autopyblock:: gnuradio.blks2.logpwrfft_c -.. autopyblock:: gnuradio.blks2.logpwrfft_f -.. autopyblock:: gnuradio.blks2.pfb_arb_resampler_ccf -.. autopyblock:: gnuradio.blks2.pfb_arb_resampler_fff -.. autopyblock:: gnuradio.blks2.pfb_channelizer_ccf -.. autopyblock:: gnuradio.blks2.pfb_decimator_ccf -.. autopyblock:: gnuradio.blks2.pfb_interpolator_ccf .. autopyblock:: gnuradio.blks2.rational_resampler_ccc .. autopyblock:: gnuradio.blks2.rational_resampler_ccf .. autopyblock:: gnuradio.blks2.rational_resampler_fff .. autopyblock:: gnuradio.blks2.analysis_filterbank -.. autopyblock:: gnuradio.blks2.fm_deemph -.. autopyblock:: gnuradio.blks2.fm_preemph -.. autopyblock:: gnuradio.blks2.nbfm_rx -.. autopyblock:: gnuradio.blks2.nbfm_tx .. autopyblock:: gnuradio.blks2.stream_to_vector_decimator -.. autopyblock:: gnuradio.blks2.standard_squelch .. autopyblock:: gnuradio.blks2.synthesis_filterbank -.. autopyblock:: gnuradio.blks2.wfm_rcv -.. autopyblock:: gnuradio.blks2.wfm_rcv_fmdet -.. autopyblock:: gnuradio.blks2.wfm_rcv_pll -.. autopyblock:: gnuradio.blks2.wfm_tx diff --git a/docs/sphinx/source/blks2/index.rst b/docs/sphinx/source/blks2/index.rst index 4df8e5a796..7a911d001b 100644 --- a/docs/sphinx/source/blks2/index.rst +++ b/docs/sphinx/source/blks2/index.rst @@ -8,35 +8,13 @@ Signal Processing Blocks .. autosummary:: :nosignatures: - - gnuradio.blks2.am_demod_cf - gnuradio.blks2.ctcss_gen_f - gnuradio.blks2.demod_10k0a3e_cf - gnuradio.blks2.demod_200kf3e_cf - gnuradio.blks2.demod_20k0f3e_cf - gnuradio.blks2.fm_demod_cf - gnuradio.blks2.logpwrfft_c - gnuradio.blks2.logpwrfft_f - gnuradio.blks2.pfb_arb_resampler_ccf - gnuradio.blks2.pfb_arb_resampler_fff - gnuradio.blks2.pfb_channelizer_ccf - gnuradio.blks2.pfb_decimator_ccf - gnuradio.blks2.pfb_interpolator_ccf + gnuradio.blks2.rational_resampler_ccc gnuradio.blks2.rational_resampler_ccf gnuradio.blks2.rational_resampler_fff gnuradio.blks2.analysis_filterbank - gnuradio.blks2.fm_deemph - gnuradio.blks2.fm_preemph - gnuradio.blks2.nbfm_rx - gnuradio.blks2.nbfm_tx gnuradio.blks2.stream_to_vector_decimator - gnuradio.blks2.standard_squelch gnuradio.blks2.synthesis_filterbank - gnuradio.blks2.wfm_rcv - gnuradio.blks2.wfm_rcv_fmdet - gnuradio.blks2.wfm_rcv_pll - gnuradio.blks2.wfm_tx Utility Functions ----------------- diff --git a/docs/sphinx/source/gr/demodulation_blk.rst b/docs/sphinx/source/gr/demodulation_blk.rst deleted file mode 100644 index 4f800b642b..0000000000 --- a/docs/sphinx/source/gr/demodulation_blk.rst +++ /dev/null @@ -1,4 +0,0 @@ -gnuradio.gr: Demodulation -========================= - -.. autooldblock:: gnuradio.gr.quadrature_demod_cf diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index 53ceba08e7..ec4671d545 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -23,14 +23,6 @@ Signal Sources gnuradio.gr.lfsr_32k_source_s gnuradio.gr.null_source - gnuradio.gr.noise_source_c - gnuradio.gr.noise_source_f - gnuradio.gr.noise_source_i - gnuradio.gr.noise_source_s - gnuradio.gr.sig_source_c - gnuradio.gr.sig_source_f - gnuradio.gr.sig_source_i - gnuradio.gr.sig_source_s gnuradio.gr.vector_source_b gnuradio.gr.vector_source_c gnuradio.gr.vector_source_f @@ -52,9 +44,6 @@ Signal Sinks gnuradio.gr.check_counting_s gnuradio.gr.check_lfsr_32k_s gnuradio.gr.null_sink - gnuradio.gr.probe_avg_mag_sqrd_c - gnuradio.gr.probe_avg_mag_sqrd_cf - gnuradio.gr.probe_avg_mag_sqrd_f gnuradio.gr.probe_signal_f gnuradio.gr.vector_sink_b gnuradio.gr.vector_sink_c @@ -182,24 +171,6 @@ Mathematics gnuradio.gr.xor_ii gnuradio.gr.xor_ss -Modulation -^^^^^^^^^^ - -.. autosummary:: - :nosignatures: - - gnuradio.gr.cpfsk_bc - gnuradio.gr.frequency_modulator_fc - gnuradio.gr.phase_modulator_fc - -Demodulation -^^^^^^^^^^^^ - -.. autosummary:: - :nosignatures: - - gnuradio.gr.quadrature_demod_cf - Information Coding and Decoding ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -215,9 +186,6 @@ Synchronization .. autosummary:: :nosignatures: - gnuradio.gr.pll_carriertracking_cc - gnuradio.gr.pll_freqdet_cf - gnuradio.gr.pll_refout_cc gnuradio.gr.simple_correlator Type Conversions @@ -255,18 +223,8 @@ Signal Level Control (AGC) .. autosummary:: :nosignatures: - gnuradio.gr.agc2_cc - gnuradio.gr.agc2_ff - gnuradio.gr.agc_cc - gnuradio.gr.agc_ff - gnuradio.gr.ctcss_squelch_ff - gnuradio.gr.dpll_bb - gnuradio.gr.feedforward_agc_cc gnuradio.gr.peak_detector2_fb - gnuradio.gr.pwr_squelch_cc - gnuradio.gr.pwr_squelch_ff gnuradio.gr.regenerate_bb - gnuradio.gr.simple_squelch_cc gnuradio.gr.mute_cc gnuradio.gr.mute_ff gnuradio.gr.mute_ii diff --git a/docs/sphinx/source/gr/level_blk.rst b/docs/sphinx/source/gr/level_blk.rst index d6c565c65d..0eacb67230 100644 --- a/docs/sphinx/source/gr/level_blk.rst +++ b/docs/sphinx/source/gr/level_blk.rst @@ -1,18 +1,9 @@ gnuradio.gr: Signal Level Control (AGC) ======================================= -.. autooldblock:: gnuradio.gr.agc2_cc -.. autooldblock:: gnuradio.gr.agc2_ff -.. autooldblock:: gnuradio.gr.agc_cc -.. autooldblock:: gnuradio.gr.agc_ff -.. autooldblock:: gnuradio.gr.ctcss_squelch_ff .. autooldblock:: gnuradio.gr.dpll_bb -.. autooldblock:: gnuradio.gr.feedforward_agc_cc .. autooldblock:: gnuradio.gr.peak_detector2_fb -.. autooldblock:: gnuradio.gr.pwr_squelch_cc -.. autooldblock:: gnuradio.gr.pwr_squelch_ff .. autooldblock:: gnuradio.gr.regenerate_bb -.. autooldblock:: gnuradio.gr.simple_squelch_cc .. autooldblock:: gnuradio.gr.mute_cc .. autooldblock:: gnuradio.gr.mute_ff .. autooldblock:: gnuradio.gr.mute_ii diff --git a/docs/sphinx/source/gr/modulation_blk.rst b/docs/sphinx/source/gr/modulation_blk.rst deleted file mode 100644 index 1fff4614ca..0000000000 --- a/docs/sphinx/source/gr/modulation_blk.rst +++ /dev/null @@ -1,6 +0,0 @@ -gnuradio.gr: Modulation -======================= - -.. autooldblock:: gnuradio.gr.cpfsk_bc -.. autooldblock:: gnuradio.gr.frequency_modulator_fc -.. autooldblock:: gnuradio.gr.phase_modulator_fc diff --git a/docs/sphinx/source/gr/sink_blk.rst b/docs/sphinx/source/gr/sink_blk.rst index 80b66370c5..5e396d895a 100644 --- a/docs/sphinx/source/gr/sink_blk.rst +++ b/docs/sphinx/source/gr/sink_blk.rst @@ -5,9 +5,6 @@ gnuradio.gr: Signal Sinks .. autooldblock:: gnuradio.gr.check_counting_s .. autooldblock:: gnuradio.gr.check_lfsr_32k_s .. autooldblock:: gnuradio.gr.null_sink -.. autooldblock:: gnuradio.gr.probe_avg_mag_sqrd_c -.. autooldblock:: gnuradio.gr.probe_avg_mag_sqrd_cf -.. autooldblock:: gnuradio.gr.probe_avg_mag_sqrd_f .. autooldblock:: gnuradio.gr.probe_signal_f .. autooldblock:: gnuradio.gr.vector_sink_b .. autooldblock:: gnuradio.gr.vector_sink_c diff --git a/docs/sphinx/source/gr/source_blk.rst b/docs/sphinx/source/gr/source_blk.rst index c3e30c17b7..8e9f67980c 100644 --- a/docs/sphinx/source/gr/source_blk.rst +++ b/docs/sphinx/source/gr/source_blk.rst @@ -3,14 +3,6 @@ gnuradio.gr: Signal Sources .. autooldblock:: gnuradio.gr.lfsr_32k_source_s .. autooldblock:: gnuradio.gr.null_source -.. autooldblock:: gnuradio.gr.noise_source_c -.. autooldblock:: gnuradio.gr.noise_source_f -.. autooldblock:: gnuradio.gr.noise_source_i -.. autooldblock:: gnuradio.gr.noise_source_s -.. autooldblock:: gnuradio.gr.sig_source_c -.. autooldblock:: gnuradio.gr.sig_source_f -.. autooldblock:: gnuradio.gr.sig_source_i -.. autooldblock:: gnuradio.gr.sig_source_s .. autooldblock:: gnuradio.gr.vector_source_b .. autooldblock:: gnuradio.gr.vector_source_c .. autooldblock:: gnuradio.gr.vector_source_f diff --git a/docs/sphinx/source/gr/sync_blk.rst b/docs/sphinx/source/gr/sync_blk.rst index b4875bdbdc..d5e3c3d7c5 100644 --- a/docs/sphinx/source/gr/sync_blk.rst +++ b/docs/sphinx/source/gr/sync_blk.rst @@ -1,7 +1,4 @@ gnuradio.gr: Synchronization ============================ -.. autooldblock:: gnuradio.gr.pll_carriertracking_cc -.. autooldblock:: gnuradio.gr.pll_freqdet_cf -.. autooldblock:: gnuradio.gr.pll_refout_cc .. autooldblock:: gnuradio.gr.simple_correlator diff --git a/gnuradio-core/src/examples/network/dial_tone_source.py b/gnuradio-core/src/examples/network/dial_tone_source.py index 232a06de80..8c826e2ad4 100755 --- a/gnuradio-core/src/examples/network/dial_tone_source.py +++ b/gnuradio-core/src/examples/network/dial_tone_source.py @@ -23,14 +23,20 @@ from gnuradio import gr from gnuradio.eng_option import eng_option from optparse import OptionParser +import sys + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("This example required gr-analog.\n") class dial_tone_source(gr.top_block): def __init__(self, host, port, pkt_size, sample_rate, eof): gr.top_block.__init__(self, "dial_tone_source") amplitude = 0.3 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, amplitude) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, amplitude) + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, amplitude) + src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, amplitude) add = gr.add_ff() # Throttle needed here to account for the other side's audio card sampling rate diff --git a/gnuradio-core/src/examples/tags/CMakeLists.txt b/gnuradio-core/src/examples/tags/CMakeLists.txt index 2d9dc20832..8975fd03aa 100644 --- a/gnuradio-core/src/examples/tags/CMakeLists.txt +++ b/gnuradio-core/src/examples/tags/CMakeLists.txt @@ -21,7 +21,6 @@ include(GrPython) GR_PYTHON_INSTALL(PROGRAMS test_file_tags.py - uhd_burst_detector.py DESTINATION ${GR_PKG_DATA_DIR}/examples/tags COMPONENT "core_python" ) diff --git a/gnuradio-core/src/lib/filter/qa_rotator.cc b/gnuradio-core/src/lib/filter/qa_rotator.cc new file mode 100644 index 0000000000..b722f32c43 --- /dev/null +++ b/gnuradio-core/src/lib/filter/qa_rotator.cc @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * Copyright 2002,2012 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 3, 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 <gruel/attributes.h> +#include <cppunit/TestAssert.h> +#include <qa_rotator.h> +#include <analog/rotator.h> +#include <stdio.h> +#include <cmath> +#include <gr_expj.h> + +namespace gr { + namespace analog { + + // error vector magnitude + __GR_ATTR_UNUSED static float + error_vector_mag(gr_complex a, gr_complex b) + { + return abs(a-b); + } + + void + qa_rotator::t1() + { + static const unsigned int N = 100000; + + rotator r; + + double phase_incr = 2*M_PI / 1003; + double phase = 0; + + // Old code: We increment then return the rotated value, thus we + // need to start one tick back + // r.set_phase(gr_complex(1,0) * conj(gr_expj(phase_incr))); + + r.set_phase(gr_complex(1,0)); + r.set_phase_incr(gr_expj(phase_incr)); + + for(unsigned i = 0; i < N; i++) { + gr_complex expected = gr_expj(phase); + gr_complex actual = r.rotate(gr_complex(1, 0)); + +#if 0 + float evm = error_vector_mag(expected, actual); + printf("[%6d] expected: (%8.6f, %8.6f) actual: (%8.6f, %8.6f) evm: %8.6f\n", + i, expected.real(), expected.imag(), actual.real(), actual.imag(), evm); +#endif + + CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected, actual, 0.0001); + + phase += phase_incr; + if(phase >= 2*M_PI) + phase -= 2*M_PI; + } + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/general/qa_gr_cpm.h b/gnuradio-core/src/lib/filter/qa_rotator.h index 2f46b42a78..a22e41ec26 100644 --- a/gnuradio-core/src/lib/general/qa_gr_cpm.h +++ b/gnuradio-core/src/lib/filter/qa_rotator.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010 Free Software Foundation, Inc. + * Copyright 2008,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,31 +19,27 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef _QA_GR_CPM_H -#define _QA_GR_CPM_H + +#ifndef _QA_ANALOG_ROTATOR_H_ +#define _QA_ANALOG_ROTATOR_H_ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> -class qa_gr_cpm : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE (qa_gr_cpm); - CPPUNIT_TEST (t1); - CPPUNIT_TEST (t2); - CPPUNIT_TEST (t3); - CPPUNIT_TEST (t4); - CPPUNIT_TEST (t5); - CPPUNIT_TEST_SUITE_END (); - - private: - void t1 (); - void t2 (); - void t3 (); - void t4 (); - void t5 (); +namespace gr { + namespace analog { -}; + class qa_rotator : public CppUnit::TestCase + { + CPPUNIT_TEST_SUITE(qa_rotator); + CPPUNIT_TEST(t1); + CPPUNIT_TEST_SUITE_END(); + private: + void t1(); + }; -#endif /* _QA_GR_CPM_H */ + } /* namespace analog */ +} /* namespace gr */ +#endif /* _QA_ANALOG_ROTATOR_H_ */ diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 7173246ea0..848d860a8f 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -97,7 +97,6 @@ list(APPEND gnuradio_core_sources list(APPEND test_gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/qa_general.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_circular_file.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_cpm.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_firdes.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_nco.cc @@ -127,10 +126,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gr_test_types.h ${CMAKE_CURRENT_SOURCE_DIR}/gr_vco.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_add_const_ss.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_char_to_float.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_debugger_hook.h @@ -139,7 +134,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_int.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h @@ -159,10 +153,6 @@ if(ENABLE_PYTHON) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/general.i ${CMAKE_CURRENT_SOURCE_DIR}/gr_constants.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_cc.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc_ff.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_cc.i - ${CMAKE_CURRENT_SOURCE_DIR}/gri_agc2_ff.i ${CMAKE_CURRENT_SOURCE_DIR}/gri_control_loop.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "core_swig" @@ -175,10 +165,6 @@ endif(ENABLE_PYTHON) set(gr_core_general_triple_threats complex_vec_test gr_add_ff - gr_agc_cc - gr_agc_ff - gr_agc2_cc - gr_agc2_ff gr_align_on_samplenumbers_ss gr_bin_statistics_f gr_char_to_float @@ -189,17 +175,12 @@ set(gr_core_general_triple_threats gr_complex_to_xxx gr_conjugate_cc gr_copy - gr_cpfsk_bc - gr_cpm - gr_ctcss_squelch_ff gr_decode_ccsds_27_fb - gr_dpll_bb gr_deinterleave gr_delay gr_encode_ccsds_27_bb gr_endian_swap gr_fake_channel_coder_pp - gr_feedforward_agc_cc gr_feval gr_firdes gr_float_to_char @@ -207,8 +188,6 @@ set(gr_core_general_triple_threats gr_float_to_int gr_float_to_short gr_float_to_uchar - gr_fmdet_cf - gr_frequency_modulator_fc gr_head gr_int_to_float gr_interleave @@ -229,18 +208,7 @@ set(gr_core_general_triple_threats gr_null_source gr_pa_2x2_phase_combiner gr_peak_detector2_fb - gr_phase_modulator_fc - gr_pll_carriertracking_cc - gr_pll_freqdet_cf - gr_pll_refout_cc gr_prefs - gr_probe_avg_mag_sqrd_c - gr_probe_avg_mag_sqrd_cf - gr_probe_avg_mag_sqrd_f - gr_pwr_squelch_cc - gr_pwr_squelch_ff - gr_quadrature_demod_cf - gr_rail_ff gr_regenerate_bb gr_remez gr_rms_cf @@ -249,10 +217,7 @@ set(gr_core_general_triple_threats gr_short_to_float gr_short_to_char gr_simple_correlator - gr_simple_squelch_cc gr_skiphead - gr_squelch_base_cc - gr_squelch_base_ff gr_stream_mux gr_stream_to_streams gr_stream_to_vector diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index b8d567b7cf..93c5d5ddb4 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. + * Copyright 2004-2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -28,7 +28,6 @@ #include <gr_null_source.h> #include <gr_head.h> #include <gr_skiphead.h> -#include <gr_quadrature_demod_cf.h> #include <gr_remez.h> #include <gr_float_to_complex.h> #include <gr_check_counting_s.h> @@ -48,8 +47,6 @@ #include <gr_char_to_float.h> #include <gr_char_to_short.h> #include <gr_uchar_to_float.h> -#include <gr_frequency_modulator_fc.h> -#include <gr_phase_modulator_fc.h> #include <gr_simple_correlator.h> #include <gr_align_on_samplenumbers_ss.h> #include <gr_complex_to_xxx.h> @@ -61,11 +58,6 @@ #include <gr_interleave.h> #include <gr_deinterleave.h> #include <gr_delay.h> -#include <gr_simple_squelch_cc.h> -#include <gr_agc_ff.h> -#include <gr_agc_cc.h> -#include <gr_agc2_ff.h> -#include <gr_agc2_cc.h> #include <gr_rms_cf.h> #include <gr_rms_ff.h> #include <gr_nlog10_ff.h> @@ -80,14 +72,6 @@ #include <gr_conjugate_cc.h> #include <gr_vco_f.h> #include <gr_threshold_ff.h> -#include <gr_dpll_bb.h> -#include <gr_fmdet_cf.h> -#include <gr_pll_freqdet_cf.h> -#include <gr_pll_refout_cc.h> -#include <gr_pll_carriertracking_cc.h> -#include <gr_probe_avg_mag_sqrd_c.h> -#include <gr_probe_avg_mag_sqrd_cf.h> -#include <gr_probe_avg_mag_sqrd_f.h> #include <gr_regenerate_bb.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> @@ -103,17 +87,11 @@ #include <gr_multiply_const_ff.h> #include <gr_multiply_conjugate_cc.h> #include <gr_feval.h> -#include <gr_pwr_squelch_cc.h> -#include <gr_pwr_squelch_ff.h> -#include <gr_ctcss_squelch_ff.h> -#include <gr_feedforward_agc_cc.h> #include <gr_bin_statistics_f.h> #include <gr_peak_detector2_fb.h> #include <gr_repeat.h> -#include <gr_cpfsk_bc.h> #include <gr_encode_ccsds_27_bb.h> #include <gr_decode_ccsds_27_fb.h> -#include <gr_rail_ff.h> #include <gr_stretch_ff.h> #include <gr_copy.h> #include <complex_vec_test.h> @@ -121,7 +99,6 @@ #include <gr_annotator_1to1.h> #include <gr_annotator_raw.h> #include <gr_burst_tagger.h> -#include <gr_cpm.h> #include <gr_vector_map.h> #include <gr_add_ff.h> #include <gr_tag_debug.h> @@ -133,7 +110,6 @@ %include "gr_null_source.i" %include "gr_head.i" %include "gr_skiphead.i" -%include "gr_quadrature_demod_cf.i" %include "gr_remez.i" %include "gr_float_to_complex.i" %include "gr_check_counting_s.i" @@ -153,8 +129,6 @@ %include "gr_char_to_float.i" %include "gr_char_to_short.i" %include "gr_uchar_to_float.i" -%include "gr_frequency_modulator_fc.i" -%include "gr_phase_modulator_fc.i" %include "gr_simple_correlator.i" %include "gr_align_on_samplenumbers_ss.i" %include "gr_complex_to_xxx.i" @@ -166,11 +140,6 @@ %include "gr_interleave.i" %include "gr_deinterleave.i" %include "gr_delay.i" -%include "gr_simple_squelch_cc.i" -%include "gr_agc_ff.i" -%include "gr_agc_cc.i" -%include "gr_agc2_ff.i" -%include "gr_agc2_cc.i" %include "gr_rms_cf.i" %include "gr_rms_ff.i" %include "gr_nlog10_ff.i" @@ -185,14 +154,6 @@ %include "gr_conjugate_cc.i" %include "gr_vco_f.i" %include "gr_threshold_ff.i" -%include "gr_dpll_bb.i" -%include "gr_fmdet_cf.i" -%include "gr_pll_freqdet_cf.i" -%include "gr_pll_refout_cc.i" -%include "gr_pll_carriertracking_cc.i" -%include "gr_probe_avg_mag_sqrd_c.i" -%include "gr_probe_avg_mag_sqrd_cf.i" -%include "gr_probe_avg_mag_sqrd_f.i" %include "gr_regenerate_bb.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" @@ -208,17 +169,11 @@ %include "gr_multiply_const_ff.i" %include "gr_multiply_conjugate_cc.i" %include "gr_feval.i" -%include "gr_pwr_squelch_cc.i" -%include "gr_pwr_squelch_ff.i" -%include "gr_ctcss_squelch_ff.i" -%include "gr_feedforward_agc_cc.i" %include "gr_bin_statistics_f.i" %include "gr_peak_detector2_fb.i" %include "gr_repeat.i" -%include "gr_cpfsk_bc.i" %include "gr_encode_ccsds_27_bb.i" %include "gr_decode_ccsds_27_fb.i" -%include "gr_rail_ff.i" %include "gr_stretch_ff.i" %include "gr_copy.i" %include "complex_vec_test.i" @@ -226,7 +181,6 @@ %include "gr_annotator_1to1.i" %include "gr_annotator_raw.i" %include "gr_burst_tagger.i" -%include "gr_cpm.i" %include "gr_vector_map.i" %include "gr_add_ff.i" %include "gr_tag_debug.i" diff --git a/gnuradio-core/src/lib/general/general_generated.i b/gnuradio-core/src/lib/general/general_generated.i index 43828e7f71..5671570a6f 100644 --- a/gnuradio-core/src/lib/general/general_generated.i +++ b/gnuradio-core/src/lib/general/general_generated.i @@ -38,10 +38,6 @@ #include <gr_mute_ff.h> #include <gr_mute_ii.h> #include <gr_mute_ss.h> -#include <gr_noise_source_c.h> -#include <gr_noise_source_f.h> -#include <gr_noise_source_i.h> -#include <gr_noise_source_s.h> #include <gr_packed_to_unpacked_bb.h> #include <gr_packed_to_unpacked_ii.h> #include <gr_packed_to_unpacked_ss.h> @@ -55,10 +51,6 @@ #include <gr_probe_signal_vi.h> #include <gr_probe_signal_vf.h> #include <gr_probe_signal_vc.h> -#include <gr_sig_source_c.h> -#include <gr_sig_source_f.h> -#include <gr_sig_source_i.h> -#include <gr_sig_source_s.h> #include <gr_sub_cc.h> #include <gr_sub_ff.h> #include <gr_sub_ii.h> @@ -114,10 +106,6 @@ %include <gr_mute_ff.i> %include <gr_mute_ii.i> %include <gr_mute_ss.i> -%include <gr_noise_source_c.i> -%include <gr_noise_source_f.i> -%include <gr_noise_source_i.i> -%include <gr_noise_source_s.i> %include <gr_packed_to_unpacked_bb.i> %include <gr_packed_to_unpacked_ii.i> %include <gr_packed_to_unpacked_ss.i> @@ -131,10 +119,6 @@ %include <gr_probe_signal_vi.i> %include <gr_probe_signal_vf.i> %include <gr_probe_signal_vc.i> -%include <gr_sig_source_c.i> -%include <gr_sig_source_f.i> -%include <gr_sig_source_i.i> -%include <gr_sig_source_s.i> %include <gr_sub_cc.i> %include <gr_sub_ff.i> %include <gr_sub_ii.i> diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.cc b/gnuradio-core/src/lib/general/gr_agc2_cc.cc deleted file mode 100644 index 5097babc9b..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 3, 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_agc2_cc.h> -#include <gr_io_signature.h> -#include <gri_agc2_cc.h> - -gr_agc2_cc_sptr -gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc2_cc (attack_rate, decay_rate, reference, gain, max_gain)); -} - -gr_agc2_cc::gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc2_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_agc2_cc (attack_rate, decay_rate, reference, gain, max_gain) -{ -} - -int -gr_agc2_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]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.h b/gnuradio-core/src/lib/general/gr_agc2_cc.h deleted file mode 100644 index 54bae1aae9..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- 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 3, 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_AGC2_CC_H -#define INCLUDED_GR_AGC2_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc2_cc.h> - -class gr_agc2_cc; -typedef boost::shared_ptr<gr_agc2_cc> gr_agc2_cc_sptr; - -GR_CORE_API gr_agc2_cc_sptr -gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gr_agc2_cc : public gr_sync_block, public gri_agc2_cc -{ - friend GR_CORE_API gr_agc2_cc_sptr gr_make_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); - gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_AGC2_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc2_cc.i b/gnuradio-core/src/lib/general/gr_agc2_cc.i deleted file mode 100644 index 6d7b221010..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_cc.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- 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 3, 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,agc2_cc) - -%include <gri_agc2_cc.i> - -gr_agc2_cc_sptr -gr_make_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc2_cc : public gr_sync_block , public gri_agc2_cc -{ - gr_agc2_cc (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.cc b/gnuradio-core/src/lib/general/gr_agc2_ff.cc deleted file mode 100644 index 792ee1c6be..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010 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 3, 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_agc2_ff.h> -#include <gr_io_signature.h> -#include <gri_agc2_ff.h> - -gr_agc2_ff_sptr -gr_make_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc2_ff (attack_rate, decay_rate, reference, - gain, max_gain)); -} - -gr_agc2_ff::gr_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc2_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))) - , gri_agc2_ff (attack_rate, decay_rate, reference, gain, max_gain) -{ -} - -int -gr_agc2_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.h b/gnuradio-core/src/lib/general/gr_agc2_ff.h deleted file mode 100644 index 48529948c0..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 3, 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_AGC2_FF_H -#define INCLUDED_GR_AGC2_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc2_ff.h> -class gr_agc2_ff; -typedef boost::shared_ptr<gr_agc2_ff> gr_agc2_ff_sptr; - -GR_CORE_API gr_agc2_ff_sptr -gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -/*! - * \brief high performance Automatic Gain Control class - * - * \ingroup level_blk - * Power is approximated by absolute value - */ - -class GR_CORE_API gr_agc2_ff : public gr_sync_block, public gri_agc2_ff -{ - friend GR_CORE_API gr_agc2_ff_sptr gr_make_agc2_ff (float attack_rate, float decay_rate, - float reference, float gain, float max_gain); - gr_agc2_ff (float attack_rate, float decay_rate, float reference, float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FLOAT_AGC2_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc2_ff.i b/gnuradio-core/src/lib/general/gr_agc2_ff.i deleted file mode 100644 index 646391aa7f..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc2_ff.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 3, 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,agc2_ff) - -%include <gri_agc2_ff.i> - -gr_agc2_ff_sptr -gr_make_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc2_ff : public gr_sync_block , public gri_agc2_ff -{ - gr_agc2_ff (float attack_rate, float decay_rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.cc b/gnuradio-core/src/lib/general/gr_agc_cc.cc deleted file mode 100644 index e98f3a303f..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 3, 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_cc.h> -#include <gr_io_signature.h> -#include <gri_agc_cc.h> - -gr_agc_cc_sptr -gr_make_agc_cc (float rate, float reference, - float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc_cc (rate, reference, gain, max_gain)); -} - -gr_agc_cc::gr_agc_cc (float rate, float reference, - float gain, float max_gain) - : gr_sync_block ("gr_agc_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_agc_cc (rate, reference, gain, max_gain) -{ -} - -int -gr_agc_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]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.h b/gnuradio-core/src/lib/general/gr_agc_cc.h deleted file mode 100644 index 9f35350dbd..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- 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 3, 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_CC_H -#define INCLUDED_GR_AGC_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc_cc.h> -class gr_agc_cc; -typedef boost::shared_ptr<gr_agc_cc> gr_agc_cc_sptr; - -GR_CORE_API gr_agc_cc_sptr -gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gr_agc_cc : public gr_sync_block, public gri_agc_cc -{ - friend GR_CORE_API gr_agc_cc_sptr gr_make_agc_cc (float rate, float reference, - float gain, float max_gain); - gr_agc_cc (float rate, float reference, - float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_agc_cc.i b/gnuradio-core/src/lib/general/gr_agc_cc.i deleted file mode 100644 index f942713b08..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_cc.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- 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 3, 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_cc) - -%include <gri_agc_cc.i> - -gr_agc_cc_sptr -gr_make_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -class gr_agc_cc : public gr_sync_block , public gri_agc_cc -{ - gr_agc_cc (float rate, float reference, - float gain, float max_gain); -}; diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.cc b/gnuradio-core/src/lib/general/gr_agc_ff.cc deleted file mode 100644 index 6050dc7f0a..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_ff.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010 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 3, 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_ff.h> -#include <gr_io_signature.h> -#include <gri_agc_ff.h> - -gr_agc_ff_sptr -gr_make_agc_ff (float rate, float reference, float gain, float max_gain) -{ - return gnuradio::get_initial_sptr(new gr_agc_ff (rate, reference, gain, max_gain)); -} - -gr_agc_ff::gr_agc_ff (float rate, float reference, float gain, float max_gain) - : gr_sync_block ("gr_agc_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))) - , gri_agc_ff (rate, reference, gain, max_gain) -{ -} - -int -gr_agc_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - scaleN (out, in, noutput_items); - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.h b/gnuradio-core/src/lib/general/gr_agc_ff.h deleted file mode 100644 index dc618213bb..0000000000 --- a/gnuradio-core/src/lib/general/gr_agc_ff.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 3, 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_FF_H -#define INCLUDED_GR_AGC_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_agc_ff.h> -class gr_agc_ff; -typedef boost::shared_ptr<gr_agc_ff> gr_agc_ff_sptr; - -GR_CORE_API gr_agc_ff_sptr -gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - -/*! - * \brief high performance Automatic Gain Control class - * \ingroup level_blk - * - * Power is approximated by absolute value - */ - -class GR_CORE_API gr_agc_ff : public gr_sync_block, public gri_agc_ff -{ - friend GR_CORE_API gr_agc_ff_sptr gr_make_agc_ff (float rate, float reference, - float gain, float max_gain); - gr_agc_ff (float rate, float reference, float gain, float max_gain); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FLOAT_AGC_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.h b/gnuradio-core/src/lib/general/gr_annotator_raw.h index 8a6c3f6c02..02d0619081 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.h +++ b/gnuradio-core/src/lib/general/gr_annotator_raw.h @@ -25,7 +25,7 @@ #include <gr_core_api.h> #include <gr_sync_block.h> -#include <gruel/pmt.h> +#include <gr_tags.h> #include <gruel/thread.h> class gr_annotator_raw; diff --git a/gnuradio-core/src/lib/general/gr_annotator_raw.i b/gnuradio-core/src/lib/general/gr_annotator_raw.i index 85777ef5d4..4a58fe7c79 100644 --- a/gnuradio-core/src/lib/general/gr_annotator_raw.i +++ b/gnuradio-core/src/lib/general/gr_annotator_raw.i @@ -22,5 +22,5 @@ GR_SWIG_BLOCK_MAGIC(gr,annotator_raw); -%include <pmt_swig.i> +%include <gr_tags.i> %include <gr_annotator_raw.h> diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc b/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc deleted file mode 100644 index 24f0edd5cb..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpfsk_bc.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 Free Software Foundation, Inc. - * - * 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 3, 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_cpfsk_bc.h> -#include <gr_io_signature.h> -#include <gr_expj.h> - -#define M_TWOPI (2*M_PI) - -gr_cpfsk_bc_sptr -gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym) -{ - return gnuradio::get_initial_sptr(new gr_cpfsk_bc(k, ampl, samples_per_sym)); -} - -gr_cpfsk_bc::gr_cpfsk_bc(float k, float ampl, int samples_per_sym) - : gr_sync_interpolator("cpfsk_bc", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(1, 1, sizeof(gr_complex)), - samples_per_sym) -{ - d_samples_per_sym = samples_per_sym; - d_freq = k*M_PI/samples_per_sym; - d_ampl = ampl; - d_phase = 0.0; -} - -gr_cpfsk_bc::~gr_cpfsk_bc() -{ -} - -int -gr_cpfsk_bc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *)input_items[0]; - gr_complex *out = (gr_complex *)output_items[0]; - - for (int i = 0; i < noutput_items/d_samples_per_sym; i++) { - for (int j = 0; j < d_samples_per_sym; j++) { - if (in[i] == 1) - d_phase += d_freq; - else - d_phase -= d_freq; - - while (d_phase > M_TWOPI) - d_phase -= M_TWOPI; - while (d_phase < -M_TWOPI) - d_phase += M_TWOPI; - - *out++ = gr_expj(d_phase)*d_ampl; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.h b/gnuradio-core/src/lib/general/gr_cpfsk_bc.h deleted file mode 100644 index 6ad2774b3a..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpfsk_bc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * 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 3, 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_CPFSK_BC_H -#define INCLUDED_GR_CPFSK_BC_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_cpfsk_bc; - -typedef boost::shared_ptr<gr_cpfsk_bc> gr_cpfsk_bc_sptr; - -GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); - -/*! - * \brief Perform continuous phase 2-level frequency shift keying modulation - * on an input stream of unpacked bits. - * \ingroup modulation_blk - * - * \param k modulation index - * \param ampl output amplitude - * \param samples_per_sym number of output samples per input bit - */ - -class GR_CORE_API gr_cpfsk_bc : public gr_sync_interpolator -{ -private: - friend GR_CORE_API gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); - - gr_cpfsk_bc(float k, float ampl, int samples_per_sym); - - int d_samples_per_sym; // Samples per symbol, square pulse - float d_freq; // Modulation index*pi/samples_per_sym - float d_ampl; // Output amplitude - float d_phase; // Current phase - - public: - ~gr_cpfsk_bc(); - - void set_amplitude(float amplitude) { d_ampl = amplitude; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_CPFSK_BC_H */ diff --git a/gnuradio-core/src/lib/general/gr_cpfsk_bc.i b/gnuradio-core/src/lib/general/gr_cpfsk_bc.i deleted file mode 100644 index b86dfb81bd..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpfsk_bc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 3, 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,cpfsk_bc); - -gr_cpfsk_bc_sptr gr_make_cpfsk_bc(float k, float ampl, int samples_per_sym); - -class gr_cpfsk_bc : public gr_sync_interpolator -{ -private: - gr_cpfsk_bc(float k, float ampl, int samples_per_sym); - -public: - void set_amplitude(float amplitude); -}; diff --git a/gnuradio-core/src/lib/general/gr_cpm.cc b/gnuradio-core/src/lib/general/gr_cpm.cc deleted file mode 100644 index 32ce6502dd..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpm.cc +++ /dev/null @@ -1,218 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * 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 3, 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. - */ - -// Calculate the taps for the CPM phase responses - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <cmath> -#include <cfloat> -#include <gr_cpm.h> - -//gives us erf on compilers without it -#include <boost/math/special_functions/erf.hpp> -namespace bm = boost::math; - -#ifndef M_TWOPI -# define M_TWOPI (2*M_PI) -#endif - -//! Normalised sinc function, sinc(x)=sin(pi*x)/pi*x -inline double -sinc(double x) -{ - if (x == 0) { - return 1.0; - } - - return sin(M_PI * x) / (M_PI * x); -} - - -//! Taps for L-RC CPM (Raised cosine of length L symbols) -std::vector<float> -generate_cpm_lrc_taps(unsigned samples_per_sym, unsigned L) -{ - std::vector<float> taps(samples_per_sym * L, 1.0/L/samples_per_sym); - for (unsigned i = 0; i < samples_per_sym * L; i++) { - taps[i] *= 1 - cos(M_TWOPI * i / L / samples_per_sym); - } - - return taps; -} - - -/*! Taps for L-SRC CPM (Spectral raised cosine of length L symbols). - * - * L-SRC has a time-continuous phase response function of - * - * g(t) = 1/LT * sinc(2t/LT) * cos(beta * 2pi t / LT) / (1 - (4beta / LT * t)^2) - * - * which is the Fourier transform of a cos-rolloff function with rolloff - * beta, and looks like a sinc-function, multiplied with a rolloff term. - * We return the main lobe of the sinc, i.e., everything between the - * zero crossings. - * The time-discrete IR is thus - * - * g(k) = 1/Ls * sinc(2k/Ls) * cos(beta * pi k / Ls) / (1 - (4beta / Ls * k)^2) - * where k = 0...Ls-1 - * and s = samples per symbol. - */ -std::vector<float> -generate_cpm_lsrc_taps(unsigned samples_per_sym, unsigned L, double beta) -{ - double Ls = (double) L * samples_per_sym; - std::vector<double> taps_d(L * samples_per_sym, 0.0); - std::vector<float> taps(L * samples_per_sym, 0.0); - - double sum = 0; - for (unsigned i = 0; i < samples_per_sym * L; i++) { - double k = i - Ls/2; // Causal to acausal - - taps_d[i] = 1.0 / Ls * sinc(2.0 * k / Ls); - - // For k = +/-Ls/4*beta, the rolloff term's cos-function becomes zero - // and the whole thing converges to PI/4 (to prove this, use de - // l'hopital's rule). - if (fabs(fabs(k) - Ls/4/beta) < 2*DBL_EPSILON) { - taps_d[i] *= M_PI_4; - } else { - double tmp = 4.0 * beta * k / Ls; - taps_d[i] *= cos(beta * M_TWOPI * k / Ls) / (1 - tmp * tmp); - } - sum += taps_d[i]; - } - for (unsigned i = 0; i < samples_per_sym * L; i++) { - taps[i] = (float) taps_d[i] / sum; - } - - return taps; -} - - -//! Taps for L-REC CPM (Rectangular pulse shape of length L symbols) -std::vector<float> -generate_cpm_lrec_taps(unsigned samples_per_sym, unsigned L) -{ - return std::vector<float>(samples_per_sym * L, 1.0/L/samples_per_sym); -} - - -//! Helper function for TFM -double tfm_g0(double k, double sps) -{ - if (fabs(k) < 2 * DBL_EPSILON) { - return 1.145393004159143; // 1 + pi^2/48 / sqrt(2) - } - - const double pi2_24 = 0.411233516712057; // pi^2/24 - double f = M_PI * k / sps; - return sinc(k/sps) - pi2_24 * (2 * sin(f) - 2*f*cos(f) - f*f*sin(f)) / (f*f*f); -} - - -//! Taps for TFM CPM (Tamed frequency modulation) -// -// See [2, Chapter 2.7.2]. -// -// [2]: Anderson, Aulin and Sundberg; Digital Phase Modulation -std::vector<float> -generate_cpm_tfm_taps(unsigned sps, unsigned L) -{ - unsigned causal_shift = sps * L / 2; - std::vector<double> taps_d(sps * L, 0.0); - std::vector<float> taps(sps * L, 0.0); - - double sum = 0; - for (unsigned i = 0; i < sps * L; i++) { - double k = (double)(((int)i) - ((int)causal_shift)); // Causal to acausal - - taps_d[i] = tfm_g0(k - sps, sps) + - 2 * tfm_g0(k, sps) + - tfm_g0(k + sps, sps); - sum += taps_d[i]; - } - for (unsigned i = 0; i < sps * L; i++) { - taps[i] = (float) taps_d[i] / sum; - } - - return taps; -} - - -//! Taps for Gaussian CPM. Phase response is truncated after \p L symbols. -// \p bt sets the 3dB-time-bandwidth product. -// -// Note: for h = 0.5, this is the phase response for GMSK. -// -// This C99-compatible formula for the taps is taken straight -// from [1, Chapter 9.2.3]. -// A version in Q-notation can be found in [2, Chapter 2.7.2]. -// -// [1]: Karl-Dirk Kammeyer; Nachrichtenübertragung, 4th Edition. -// [2]: Anderson, Aulin and Sundberg; Digital Phase Modulation -// -std::vector<float> -generate_cpm_gaussian_taps(unsigned samples_per_sym, unsigned L, double bt) -{ - double Ls = (double) L * samples_per_sym; - std::vector<double> taps_d(L * samples_per_sym, 0.0); - std::vector<float> taps(L * samples_per_sym, 0.0); - - // alpha = sqrt(2/ln(2)) * pi * BT - double alpha = 5.336446256636997 * bt; - for (unsigned i = 0; i < samples_per_sym * L; i++) { - double k = i - Ls/2; // Causal to acausal - taps_d[i] = (bm::erf(alpha * (k / samples_per_sym + 0.5)) - - bm::erf(alpha * (k / samples_per_sym - 0.5))) - * 0.5 / samples_per_sym; - taps[i] = (float) taps_d[i]; - } - - return taps; -} - - -std::vector<float> -gr_cpm::phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta) -{ - switch (type) { - case LRC: - return generate_cpm_lrc_taps(samples_per_sym, L); - - case LSRC: - return generate_cpm_lsrc_taps(samples_per_sym, L, beta); - - case LREC: - return generate_cpm_lrec_taps(samples_per_sym, L); - - case TFM: - return generate_cpm_tfm_taps(samples_per_sym, L); - - case GAUSSIAN: - return generate_cpm_gaussian_taps(samples_per_sym, L, beta); - - default: - return generate_cpm_lrec_taps(samples_per_sym, 1); - } -} - diff --git a/gnuradio-core/src/lib/general/gr_cpm.h b/gnuradio-core/src/lib/general/gr_cpm.h deleted file mode 100644 index ef2ff84142..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpm.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * 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 3, 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_CPM_H -#define INCLUDED_GR_CPM_H - -#include <gr_core_api.h> -#include <vector> - -class GR_CORE_API gr_cpm -{ - public: - enum cpm_type { - LRC, - LSRC, - LREC, - TFM, - GAUSSIAN, - GENERIC = 999 - }; - - /*! \brief Return the taps for an interpolating FIR filter (gr_interp_fir_filter_fff). - * - * These taps represent the phase response \f$g(k)\f$ for use in a CPM modulator, - * see also gr_cpmmod_bc. - * - * \param type The CPM type (Rectangular, Raised Cosine, Spectral Raised Cosine, - * Tamed FM or Gaussian). - * \param samples_per_sym Samples per symbol. - * \param L The length of the phase response in symbols. - * \param beta For Spectral Raised Cosine, this is the rolloff factor. For Gaussian - * phase responses, this the 3dB-time-bandwidth product. For all other - * cases, it is ignored. - * - * Output: returns a vector of length \a K = \p samples_per_sym x \p L. - * This can be used directly in an interpolating FIR filter such as - * gr_interp_fir_filter_fff with interpolation factor \p samples_per_sym. - * - * All phase responses are normalised s.t. \f$ \sum_{k=0}^{K-1} g(k) = 1\f$; this will cause - * a maximum phase change of \f$ h \cdot \pi\f$ between two symbols, where \a h is the - * modulation index. - * - * The following phase responses can be generated: - * - LREC: Rectangular phase response. - * - LRC: Raised cosine phase response, looks like 1 - cos(x). - * - LSRC: Spectral raised cosine. This requires a rolloff factor beta. - * The phase response is the Fourier transform of raised cosine - * function. - * - TFM: Tamed frequency modulation. This scheme minimizes phase change for - * rapidly varying input symbols. - * - GAUSSIAN: A Gaussian phase response. For a modulation index h = 1/2, this - * results in GMSK. - * - * A short description of all these phase responses can be found in [1]. - * - * [1]: Anderson, Aulin and Sundberg; Digital Phase Modulation - */ - static std::vector<float> - phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3); -}; - -#endif /* INCLUDED_GR_CPM_H */ - diff --git a/gnuradio-core/src/lib/general/gr_cpm.i b/gnuradio-core/src/lib/general/gr_cpm.i deleted file mode 100644 index 6c077687d5..0000000000 --- a/gnuradio-core/src/lib/general/gr_cpm.i +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- C++ -*- */ -/* - * Copyright 2010 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 3, 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. - */ - -%rename(cpm) gr_cpm; - -class gr_cpm -{ - public: - enum cpm_type { - LRC, - LSRC, - LREC, - TFM, - GAUSSIAN, - GENERIC = 999 - }; - - static std::vector<float> - phase_response(cpm_type type, unsigned samples_per_sym, unsigned L, double beta=0.3); -}; - diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc deleted file mode 100644 index d31763a6bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.cc +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010 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 3, 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_ctcss_squelch_ff.h> - -static float ctcss_tones[] = { - 67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8, - 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8, - 136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2, - 192.8, 203.5, 210.7, 218.1, 225.7, 233.6, 241.8, 250.3 -}; - -static int max_tone_index = 37; - -gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_ctcss_squelch_ff(rate, freq, level, len, ramp, gate)); -} - -int gr_ctcss_squelch_ff::find_tone(float freq) -{ - for (int i = 0; i <= max_tone_index; i++) - if (ctcss_tones[i] == freq) // FIXME: make almost equal - return i; - - return -1; -} - -gr_ctcss_squelch_ff::gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate) : - gr_squelch_base_ff("ctcss_squelch_ff", ramp, gate) -{ - d_freq = freq; - d_level = level; - - // Default is 100 ms detection time - if (len == 0) - d_len = (int)(rate/10.0); - else - d_len = len; - - int i = find_tone(freq); - - // Non-standard tones or edge tones get 2% guard band, otherwise - // guards are set at adjacent ctcss tone frequencies - float f_l, f_r; - if (i == -1 || i == 0) - f_l = freq*0.98; - else - f_l = ctcss_tones[i-1]; - - if (i == -1 || i == max_tone_index) - f_r = freq*1.02; - else - f_r = ctcss_tones[i+1]; - - d_goertzel_l = gri_goertzel(rate, d_len, f_l); - d_goertzel_c = gri_goertzel(rate, d_len, freq); - d_goertzel_r = gri_goertzel(rate, d_len, f_r); - - d_mute = true; -} - -std::vector<float> gr_ctcss_squelch_ff::squelch_range() const -{ - std::vector<float> r(3); - r[0] = 0.0; - r[1] = 1.0; - r[2] = (r[1]-r[0])/100; // step size - - return r; -} - -void gr_ctcss_squelch_ff::update_state(const float &in) -{ - d_goertzel_l.input(in); - d_goertzel_c.input(in); - d_goertzel_r.input(in); - - float d_out_l, d_out_c, d_out_r; - if (d_goertzel_c.ready()) { - d_out_l = abs(d_goertzel_l.output()); - d_out_c = abs(d_goertzel_c.output()); - d_out_r = abs(d_goertzel_r.output()); - - //printf("d_out_l=%f d_out_c=%f d_out_r=%f\n", d_out_l, d_out_c, d_out_r); - d_mute = (d_out_c < d_level || d_out_c < d_out_l || d_out_c < d_out_r); - } -} diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h b/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h deleted file mode 100644 index ef3d13ba7b..0000000000 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- 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 3, 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_CTCSS_SQUELCH_FF_H -#define INCLUDED_GR_CTCSS_SQUELCH_FF_H - -#include <gr_core_api.h> -#include <gr_squelch_base_ff.h> -#include <gri_goertzel.h> - -class gr_ctcss_squelch_ff; -typedef boost::shared_ptr<gr_ctcss_squelch_ff> gr_ctcss_squelch_ff_sptr; - -GR_CORE_API gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output if ctcss tone not present - * \ingroup level_blk - */ -class GR_CORE_API gr_ctcss_squelch_ff : public gr_squelch_base_ff -{ -private: - float d_freq; - float d_level; - int d_len; - bool d_mute; - - gri_goertzel d_goertzel_l; - gri_goertzel d_goertzel_c; - gri_goertzel d_goertzel_r; - - friend GR_CORE_API gr_ctcss_squelch_ff_sptr gr_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); - gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); - - int find_tone(float freq); - -protected: - virtual void update_state(const float &in); - virtual bool mute() const { return d_mute; } - -public: - std::vector<float> squelch_range() const; - float level() const { return d_level; } - void set_level(float level) { d_level = level; } - int len() const { return d_len; } -}; - -#endif /* INCLUDED_GR_CTCSS_SQUELCH_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.cc b/gnuradio-core/src/lib/general/gr_dpll_bb.cc deleted file mode 100644 index 1d5a0d4fda..0000000000 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2009,2010 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 3, 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_dpll_bb.h> -#include <gr_io_signature.h> -#include <cstdio> - -gr_dpll_bb_sptr -gr_make_dpll_bb (float period, float gain) -{ - return gnuradio::get_initial_sptr(new gr_dpll_bb (period, gain)); -} - -gr_dpll_bb::gr_dpll_bb (float period, float gain) - : gr_sync_block ("dpll_bb", - gr_make_io_signature (1, 1, sizeof (char)), - gr_make_io_signature (1, 1, sizeof (char))), - d_restart(0),d_pulse_phase(0) -{ - d_pulse_frequency = 1.0/period; - d_gain = gain; - d_decision_threshold = 1.0 - 0.5*d_pulse_frequency; -#if 1 - fprintf(stderr,"frequency = %f period = %f gain = %f threshold = %f\n", - d_pulse_frequency, - period, - d_gain, - d_decision_threshold); -#endif -} - -int -gr_dpll_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *iptr = (const char *) input_items[0]; - char *optr = (char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - optr[i]= 0; - if(iptr[i] == 1) { - if (d_restart == 0) { - d_pulse_phase = 1; - } else { - if (d_pulse_phase > 0.5) d_pulse_phase += d_gain*(1.0-d_pulse_phase); - else d_pulse_phase -= d_gain*d_pulse_phase; - } - d_restart = 3; - } - if (d_pulse_phase > d_decision_threshold) { - d_pulse_phase -= 1.0; - if (d_restart > 0) { - d_restart -= 1; - optr[i] = 1; - } - } - d_pulse_phase += d_pulse_frequency; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.h b/gnuradio-core/src/lib/general/gr_dpll_bb.h deleted file mode 100644 index a7df974fb4..0000000000 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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 3, 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_DPLL_BB_H -#define INCLUDED_GR_DPLL_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_dpll_bb; -typedef boost::shared_ptr<gr_dpll_bb> gr_dpll_bb_sptr; - -GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); - -/*! - * \brief Detect the peak of a signal - * \ingroup level_blk - * - * If a peak is detected, this block outputs a 1, - * or it outputs 0's. - */ -class GR_CORE_API gr_dpll_bb : public gr_sync_block -{ - friend GR_CORE_API gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); - - gr_dpll_bb (float period, float gain); - - private: - unsigned char d_restart; - float d_pulse_phase, d_pulse_frequency,d_gain,d_decision_threshold; - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc deleted file mode 100644 index 147b64e9bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.cc +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 3, 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_feedforward_agc_cc.h> -#include <gr_io_signature.h> -#include <stdexcept> - -gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference) -{ - return gnuradio::get_initial_sptr(new gr_feedforward_agc_cc (nsamples, reference)); -} - -gr_feedforward_agc_cc::gr_feedforward_agc_cc (int nsamples, float reference) - : gr_sync_block ("gr_feedforward_agc_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_nsamples(nsamples), d_reference(reference) -{ - if (nsamples < 1) - throw std::invalid_argument("gr_feedforward_agc_cc: nsamples must be >= 1"); - - set_history(nsamples); -} - -gr_feedforward_agc_cc::~gr_feedforward_agc_cc() -{ -} - -inline static float -mag_squared(gr_complex x) -{ - return x.real() * x.real() + x.imag() * x.imag(); -} - -// approximate sqrt(x^2 + y^2) -inline static float -envelope(gr_complex x) -{ - float r_abs = std::fabs(x.real()); - float i_abs = std::fabs(x.imag()); - - if (r_abs > i_abs) - return r_abs + 0.4 * i_abs; - else - return i_abs + 0.4 * r_abs; -} - -int -gr_feedforward_agc_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]; - int nsamples = d_nsamples; - float gain; - - for (int i = 0; i < noutput_items; i++){ - //float max_env = 1e-12; // avoid divide by zero - float max_env = 1e-4; // avoid divide by zero, indirectly set max gain - for (int j = 0; j < nsamples; j++) - max_env = std::max(max_env, envelope(in[i+j])); - gain = d_reference / max_env; - out[i] = gain * in[i]; - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h b/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h deleted file mode 100644 index 63e5e4c436..0000000000 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- 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 3, 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_FEEDFORWARD_AGC_CC_H -#define INCLUDED_GR_FEEDFORWARD_AGC_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_feedforward_agc_cc; -typedef boost::shared_ptr<gr_feedforward_agc_cc> gr_feedforward_agc_cc_sptr; - -GR_CORE_API gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0); - -/*! - * \brief Non-causal AGC which computes required gain based on max absolute value over nsamples - * \ingroup level_blk - */ -class GR_CORE_API gr_feedforward_agc_cc : public gr_sync_block -{ - friend GR_CORE_API gr_feedforward_agc_cc_sptr - gr_make_feedforward_agc_cc(int nsamples, float reference); - - int d_nsamples; - float d_reference; - - gr_feedforward_agc_cc(int nsamples, float reference); - - public: - ~gr_feedforward_agc_cc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FEEDFORWARD_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.cc b/gnuradio-core/src/lib/general/gr_fmdet_cf.cc deleted file mode 100644 index f020362920..0000000000 --- a/gnuradio-core/src/lib/general/gr_fmdet_cf.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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 3, 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_fmdet_cf.h> -#include <gr_io_signature.h> -#include <math.h> -#include <gr_math.h> - -#define M_TWOPI (2*M_PI) - -gr_fmdet_cf_sptr -gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl) -{ - return gnuradio::get_initial_sptr(new gr_fmdet_cf (samplerate, freq_low, freq_high, scl)); -} - -gr_fmdet_cf::gr_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl) - : gr_sync_block ("fmdet_cf", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (float))), - d_S1(0.1),d_S2(0.1), - d_S3(0.1),d_S4(0.1) -{ - const float h[]={0.003118678733, -0.012139843428, 0.027270898036, -0.051318579352, - 0.090406910552, -0.162926865366, 0.361885392563, 0.000000000000, - -0.361885392563, 0.162926865366, -0.090406910552, 0.051318579352, - -0.027270898036, 0.012139843428, -0.003118678733}; - - - - - float delta; - std::vector<float> taps(15); - - d_freqhi = freq_high; - d_freqlo = freq_low; - delta = (d_freqhi - d_freqlo); - d_scl = scl; - d_bias = 0.5*scl*(d_freqhi+d_freqlo)/delta; - for (int i=0;i<15;i++) taps[i] = h[i]; - // d_filter = gr_fir_util::create_gr_fir_ccf(taps); - -} - -int -gr_fmdet_cf::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]; - float *optr = (float *) output_items[0]; - // const gr_complex *scaleiptr = (gr_complex *) input_items[0]; - - int size = noutput_items; - - gr_complex Sdot,S0,S1=d_S1,S2=d_S2,S3=d_S3,S4=d_S4; - float d_8 = 8.0; - - while (size-- > 0) { - S0=*iptr++; - - - Sdot = d_scl * (-S0+d_8*S1-d_8*S1+S4); - - d_freq = (S2.real()*Sdot.imag()-S2.imag()*Sdot.real())/ - (S2.real()*S2.real()+S2.imag()*S2.imag()); - - S4=S3; - S3=S2; - S2=S1; - S1=S0; - - - *optr++ = d_freq-d_bias; - } - d_S1=S1; - d_S2=S2; - d_S3=S3; - d_S4=S4; - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.h b/gnuradio-core/src/lib/general/gr_fmdet_cf.h deleted file mode 100644 index f85630f2fb..0000000000 --- a/gnuradio-core/src/lib/general/gr_fmdet_cf.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 3, 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_FMDET_CF_H -#define INCLUDED_GR_FMDET_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_fmdet_cf; -typedef boost::shared_ptr<gr_fmdet_cf> gr_fmdet_cf_sptr; - -GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); - -class gr_fir_ccf; - - -/*! - * \brief Implements an IQ slope detector - * - * - * input: stream of complex; output: stream of floats - * - * This implements a limiting slope detector. The limiter is in the - * normalization by the magnitude of the sample - */ - -class GR_CORE_API gr_fmdet_cf : public gr_sync_block -{ - friend GR_CORE_API gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, - float freq_high, float scl); - - gr_complex d_S1,d_S2,d_S3,d_S4; - float d_freq,d_freqlo,d_freqhi,d_scl,d_bias; - gr_fir_ccf* d_filter; - gr_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_fmdet_cf.i b/gnuradio-core/src/lib/general/gr_fmdet_cf.i deleted file mode 100644 index 2db596b7a9..0000000000 --- a/gnuradio-core/src/lib/general/gr_fmdet_cf.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 3, 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,fmdet_cf) - -gr_fmdet_cf_sptr gr_make_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); - -class gr_fmdet_cf : public gr_sync_block -{ - private: - gr_fmdet_cf (float samplerate, float freq_low, float freq_high, float scl); -}; diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc deleted file mode 100644 index 5c4daec583..0000000000 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2011 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 3, 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_frequency_modulator_fc.h> -#include <gr_io_signature.h> -#include <gr_fxpt.h> -#include <math.h> -#include <boost/math/special_functions/trunc.hpp> - - -gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity) -{ - return gnuradio::get_initial_sptr(new gr_frequency_modulator_fc (sensitivity)); -} - -gr_frequency_modulator_fc::gr_frequency_modulator_fc (double sensitivity) - : gr_sync_block ("frequency_modulator_fc", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_sensitivity (sensitivity), d_phase (0) -{ -} - -int -gr_frequency_modulator_fc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - d_phase = d_phase + d_sensitivity * in[i]; - - while (d_phase > (float)(M_PI)) - d_phase -= (float)(2.0 * M_PI); - while (d_phase < (float)(-M_PI)) - d_phase += (float)(2.0 * M_PI); - - float oi, oq; - - gr_int32 angle = gr_fxpt::float_to_fixed (d_phase); - gr_fxpt::sincos (angle, &oq, &oi); - out[i] = gr_complex (oi, oq); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h deleted file mode 100644 index c680e96480..0000000000 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 3, 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_FREQUENCY_MODULATOR_FC_H -#define INCLUDED_GR_FREQUENCY_MODULATOR_FC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_frequency_modulator_fc; -typedef boost::shared_ptr<gr_frequency_modulator_fc> gr_frequency_modulator_fc_sptr; - -GR_CORE_API gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); - -/*! - * \brief Frequency modulator block - * \ingroup modulation_blk - * - * float input; complex baseband output - */ -class GR_CORE_API gr_frequency_modulator_fc : public gr_sync_block -{ - float d_sensitivity; - float d_phase; - - friend GR_CORE_API gr_frequency_modulator_fc_sptr - gr_make_frequency_modulator_fc (double sensitivity); - - gr_frequency_modulator_fc (double sensitivity); - - public: - void set_sensitivity(float sens) { d_sensitivity = sens; } - float sensitivity() const { return d_sensitivity; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FREQUENCY_MODULATOR_FC_H */ diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i deleted file mode 100644 index 9a740583b0..0000000000 --- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 3, 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,frequency_modulator_fc) - -gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity); - -class gr_frequency_modulator_fc : public gr_sync_block -{ - private: - gr_frequency_modulator_fc (double sensitivity); -public: - void set_sensitivity(float sens) { d_sensitivity = sens; } - float sensitivity() const { return d_sensitivity; } -}; diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc deleted file mode 100644 index fb05c85a52..0000000000 --- a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,2010 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 3, 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_phase_modulator_fc.h> -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> - - -gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity) -{ - return gnuradio::get_initial_sptr(new gr_phase_modulator_fc (sensitivity)); -} - -gr_phase_modulator_fc::gr_phase_modulator_fc (double sensitivity) - : gr_sync_block ("phase_modulator_fc", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_sensitivity (sensitivity), d_phase (0) -{ -} - -int -gr_phase_modulator_fc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - d_phase = d_sensitivity * in[i]; - float oi, oq; - gr_sincosf (d_phase, &oq, &oi); - out[i] = gr_complex (oi, oq); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h deleted file mode 100644 index 07f3b82d4c..0000000000 --- a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 3, 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_PHASE_MODULATOR_FC_H -#define INCLUDED_GR_PHASE_MODULATOR_FC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_phase_modulator_fc; -typedef boost::shared_ptr<gr_phase_modulator_fc> gr_phase_modulator_fc_sptr; - -GR_CORE_API gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); - -/*! - * \brief Phase modulator block - * \ingroup modulation_blk - * output=complex(cos(in*sensitivity),sin(in*sensitivity)) - */ -class GR_CORE_API gr_phase_modulator_fc : public gr_sync_block -{ - double d_sensitivity; - double d_phase; - - friend GR_CORE_API gr_phase_modulator_fc_sptr - gr_make_phase_modulator_fc (double sensitivity); - - gr_phase_modulator_fc (double sensitivity); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_PHASE_MODULATOR_FC_H */ diff --git a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i b/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i deleted file mode 100644 index c1816c647e..0000000000 --- a/gnuradio-core/src/lib/general/gr_phase_modulator_fc.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 3, 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,phase_modulator_fc) - -gr_phase_modulator_fc_sptr gr_make_phase_modulator_fc (double sensitivity); - -class gr_phase_modulator_fc : public gr_sync_block -{ - private: - gr_phase_modulator_fc (double sensitivity); -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc deleted file mode 100644 index b7b1291a3d..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010,2011 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 3, 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_pll_carriertracking_cc.h> -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_carriertracking_cc_sptr -gr_make_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_carriertracking_cc (loop_bw, max_freq, min_freq)); -} - -gr_pll_carriertracking_cc::gr_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq) - : gr_sync_block ("pll_carriertracking_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_control_loop(loop_bw, max_freq, min_freq), - d_locksig(0), d_lock_threshold(0), d_squelch_enable(false) -{ -} - -float -gr_pll_carriertracking_cc::mod_2pi (float in) -{ - if(in>M_PI) - return in-M_TWOPI; - else if(in<-M_PI) - return in+M_TWOPI; - else - return in; -} - -float -gr_pll_carriertracking_cc::phase_detector(gr_complex sample,float ref_phase) -{ - float sample_phase; - // sample_phase = atan2(sample.imag(),sample.real()); - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); - return mod_2pi(sample_phase-ref_phase); -} - -bool -gr_pll_carriertracking_cc::lock_detector(void) -{ - return (fabsf(d_locksig) > d_lock_threshold); -} - -bool -gr_pll_carriertracking_cc::squelch_enable(bool set_squelch) -{ - return d_squelch_enable = set_squelch; -} - -float -gr_pll_carriertracking_cc::set_lock_threshold(float threshold) -{ - return d_lock_threshold = threshold; -} - -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++){ - gr_sincosf(d_phase, &t_imag, &t_real); - optr[i] = iptr[i] * gr_complex(t_real, -t_imag); - - error = phase_detector(iptr[i],d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - - 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; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h deleted file mode 100644 index b3bc5ddd0c..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2011 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 3, 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_PLL_CARRIERTRACKING_CC_H -#define INCLUDED_GR_PLL_CARRIERTRACKING_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_carriertracking_cc; -typedef boost::shared_ptr<gr_pll_carriertracking_cc> gr_pll_carriertracking_cc_sptr; - -GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); -/*! - * \brief Implements a PLL which locks to the input frequency and outputs the - * input signal mixed with that carrier. - * \ingroup sync_blk - * - * input: stream of complex; output: stream of complex - * - * This PLL locks onto a [possibly noisy] reference carrier on - * the input and outputs that signal, downconverted to DC - * - * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. The loop bandwidth determins the lock range and should be set - * around pi/200 -- 2pi/100. - * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc - */ - -class GR_CORE_API gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_carriertracking_cc_sptr gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); - - float d_locksig,d_lock_threshold; - bool d_squelch_enable; - gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float mod_2pi (float in); - float phase_detector(gr_complex sample,float ref_phase); -public: - bool lock_detector(void); - bool squelch_enable(bool); - float set_lock_threshold(float); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i b/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i deleted file mode 100644 index a20adf7e20..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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 3, 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,pll_carriertracking_cc); - -gr_pll_carriertracking_cc_sptr -gr_make_pll_carriertracking_cc (float loop_bw, - float max_freq, - float min_freq); - -class gr_pll_carriertracking_cc : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_carriertracking_cc (float loop_bw, float max_freq, float min_freq); - public: - bool lock_detector(void); - bool squelch_enable(bool); - float set_lock_threshold(float); - -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc deleted file mode 100644 index f80f4ed07a..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2011 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 3, 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_pll_freqdet_cf.h> -#include <gr_io_signature.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_freqdet_cf_sptr -gr_make_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_freqdet_cf (loop_bw, max_freq, min_freq)); -} - -gr_pll_freqdet_cf::gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq) - : gr_sync_block ("pll_freqdet_cf", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (float))), - gri_control_loop(loop_bw, max_freq, min_freq) -{ -} - -float -gr_pll_freqdet_cf::mod_2pi (float in) -{ - if(in>M_PI) - return in-M_TWOPI; - else if(in<-M_PI) - return in+M_TWOPI; - else - return in; -} - -float -gr_pll_freqdet_cf::phase_detector(gr_complex sample,float ref_phase) -{ - float sample_phase; - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); - return mod_2pi(sample_phase-ref_phase); -} - -int -gr_pll_freqdet_cf::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]; - float *optr = (float *) output_items[0]; - - float error; - int size = noutput_items; - - while (size-- > 0) { - *optr++ = d_freq; - - error = phase_detector(*iptr++,d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h deleted file mode 100644 index 3dfc8d7093..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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 3, 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_PLL_FREQDET_CF_H -#define INCLUDED_GR_PLL_FREQDET_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_freqdet_cf; -typedef boost::shared_ptr<gr_pll_freqdet_cf> gr_pll_freqdet_cf_sptr; - -GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); -/*! - * \brief Implements a PLL which locks to the input frequency and outputs - * an estimate of that frequency. Useful for FM Demod. - * \ingroup sync_blk - * - * input: stream of complex; output: stream of floats - * - * This PLL locks onto a [possibly noisy] reference carrier on - * the input and outputs an estimate of that frequency in radians per sample. - * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. The loop bandwidth determins the lock range and should be set - * around pi/200 -- 2pi/100. - * \sa gr_pll_refout_cc, gr_pll_carriertracking_cc - */ - -class GR_CORE_API gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); - - float mod_2pi (float in); - gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float phase_detector(gr_complex sample,float ref_phase); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i b/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i deleted file mode 100644 index 87e515adb8..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_freqdet_cf.i +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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 3, 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,pll_freqdet_cf) - - gr_pll_freqdet_cf_sptr gr_make_pll_freqdet_cf (float loop_bw, - float max_freq, - float min_freq); - -class gr_pll_freqdet_cf : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_freqdet_cf (float loop_bw, float max_freq, float min_freq); -}; diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc b/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc deleted file mode 100644 index 9f95c3f64e..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010,2011 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 3, 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_pll_refout_cc.h> -#include <gr_io_signature.h> -#include <gr_sincos.h> -#include <math.h> -#include <gr_math.h> - -#ifndef M_TWOPI -#define M_TWOPI (2.0f*M_PI) -#endif - -gr_pll_refout_cc_sptr -gr_make_pll_refout_cc (float loop_bw, float max_freq, float min_freq) -{ - return gnuradio::get_initial_sptr(new gr_pll_refout_cc (loop_bw, max_freq, min_freq)); -} - -gr_pll_refout_cc::gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq) - : gr_sync_block ("pll_refout_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - gri_control_loop(loop_bw, max_freq, min_freq) -{ -} - -float -gr_pll_refout_cc::mod_2pi (float in) -{ - if(in>M_PI) - return in-M_TWOPI; - else if(in<-M_PI) - return in+M_TWOPI; - else - return in; -} - -float -gr_pll_refout_cc::phase_detector(gr_complex sample,float ref_phase) -{ - float sample_phase; - sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); - return mod_2pi(sample_phase-ref_phase); -} - -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) { - gr_sincosf(d_phase,&t_imag,&t_real); - *optr++ = gr_complex(t_real,t_imag); - - error = phase_detector(*iptr++,d_phase); - - advance_loop(error); - phase_wrap(); - frequency_limit(); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h b/gnuradio-core/src/lib/general/gr_pll_refout_cc.h deleted file mode 100644 index ef5cd31e27..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2011 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 3, 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_PLL_REFOUT_CC_H -#define INCLUDED_GR_PLL_REFOUT_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gri_control_loop.h> - -class gr_pll_refout_cc; -typedef boost::shared_ptr<gr_pll_refout_cc> gr_pll_refout_cc_sptr; - -GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); -/*! - * \brief Implements a PLL which locks to the input frequency and outputs a carrier - * \ingroup sync_blk - * - * input: stream of complex; output: stream of complex - * - * This PLL locks onto a [possibly noisy] reference carrier on - * the input and outputs a clean version which is phase and frequency - * aligned to it. - * - * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. The loop bandwidth determins the lock range and should be set - * around pi/200 -- 2pi/100. - * \sa gr_pll_freqdet_cf, gr_pll_carriertracking_cc - */ -class GR_CORE_API gr_pll_refout_cc : public gr_sync_block, public gri_control_loop -{ - friend GR_CORE_API gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); - - gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -private: - float mod_2pi (float in); - float phase_detector(gr_complex sample, float ref_phase); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i b/gnuradio-core/src/lib/general/gr_pll_refout_cc.i deleted file mode 100644 index 630c0444fa..0000000000 --- a/gnuradio-core/src/lib/general/gr_pll_refout_cc.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2011 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 3, 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,pll_refout_cc) - -gr_pll_refout_cc_sptr gr_make_pll_refout_cc (float loop_bw, - float max_freq, float min_freq); - -class gr_pll_refout_cc : public gr_sync_block, public gri_control_loop -{ - private: - gr_pll_refout_cc (float loop_bw, float max_freq, float min_freq); -}; diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc deleted file mode 100644 index 6430d2753d..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 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 3, 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_probe_avg_mag_sqrd_c.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_probe_avg_mag_sqrd_c_sptr -gr_make_probe_avg_mag_sqrd_c(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_c(threshold_db, alpha)); -} - -gr_probe_avg_mag_sqrd_c::gr_probe_avg_mag_sqrd_c (double threshold_db, double alpha) - : gr_sync_block ("probe_avg_mag_sqrd_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), - d_iir(alpha), d_unmuted(false), d_level(0) -{ - set_threshold (threshold_db); -} - -gr_probe_avg_mag_sqrd_c::~gr_probe_avg_mag_sqrd_c() -{ -} - - -int -gr_probe_avg_mag_sqrd_c::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]; - - for (int i = 0; i < noutput_items; i++){ - double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); - d_iir.filter(mag_sqrd); // computed for side effect: prev_output() - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - d_level = d_iir.prev_output(); - return noutput_items; -} - -double -gr_probe_avg_mag_sqrd_c::threshold() const -{ - return 10 * std::log10(d_threshold); -} - -void -gr_probe_avg_mag_sqrd_c::set_threshold(double decibels) -{ - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); -} - -void -gr_probe_avg_mag_sqrd_c::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h deleted file mode 100644 index 2811677cfc..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 3, 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_PROBE_AVG_MAG_SQRD_C_H -#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_probe_avg_mag_sqrd_c; -typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_c> gr_probe_avg_mag_sqrd_c_sptr; - -GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr -gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001); - -/*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * input: gr_complex - * - * Compute a running average of the magnitude squared of the the input. - * The level and indication as to whether the level exceeds threshold - * can be retrieved with the level and unmuted accessors. - */ -class GR_CORE_API gr_probe_avg_mag_sqrd_c : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - double d_level; - - friend GR_CORE_API gr_probe_avg_mag_sqrd_c_sptr - gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha); - - gr_probe_avg_mag_sqrd_c (double threshold_db, double alpha); - -public: - ~gr_probe_avg_mag_sqrd_c (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // ACCESSORS - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - - double threshold() const; - - // SETTERS - void set_alpha (double alpha); - void set_threshold (double decibels); -}; - -#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_C_H */ diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i deleted file mode 100644 index bce244c127..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_c.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 3, 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,probe_avg_mag_sqrd_c); - -gr_probe_avg_mag_sqrd_c_sptr -gr_make_probe_avg_mag_sqrd_c (double threshold_db, double alpha = 0.0001); - -class gr_probe_avg_mag_sqrd_c : public gr_sync_block -{ -public: - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - void set_alpha (double alpha); - void set_threshold (double decibels); - double threshold(); -}; diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc deleted file mode 100644 index b5946283b8..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.cc +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2010 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 3, 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_probe_avg_mag_sqrd_cf.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_probe_avg_mag_sqrd_cf_sptr -gr_make_probe_avg_mag_sqrd_cf(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_cf(threshold_db, alpha)); -} - -gr_probe_avg_mag_sqrd_cf::gr_probe_avg_mag_sqrd_cf (double threshold_db, double alpha) - : gr_sync_block ("probe_avg_mag_sqrd_cf", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(float))), - d_iir(alpha), d_unmuted(false), d_level(0) -{ - set_threshold (threshold_db); -} - -gr_probe_avg_mag_sqrd_cf::~gr_probe_avg_mag_sqrd_cf() -{ -} - - -int -gr_probe_avg_mag_sqrd_cf::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]; - float *out = (float *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - out[i] = d_iir.prev_output(); - double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); - d_iir.filter(mag_sqrd); // computed for side effect: prev_output() - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - d_level = d_iir.prev_output(); - return noutput_items; -} - -double -gr_probe_avg_mag_sqrd_cf::threshold() const -{ - return 10 * std::log10(d_threshold); -} - -void -gr_probe_avg_mag_sqrd_cf::set_threshold(double decibels) -{ - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); -} - -void -gr_probe_avg_mag_sqrd_cf::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h deleted file mode 100644 index bb5d1ebf91..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 3, 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_PROBE_AVG_MAG_SQRD_CF_H -#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_probe_avg_mag_sqrd_cf; -typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_cf> gr_probe_avg_mag_sqrd_cf_sptr; - -GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr -gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001); - -/*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * input: gr_complex - * output: gr_float - * - * Compute a running average of the magnitude squared of the the input. - * The level and indication as to whether the level exceeds threshold - * can be retrieved with the level and unmuted accessors. - * - */ -class GR_CORE_API gr_probe_avg_mag_sqrd_cf : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - double d_level; - - friend GR_CORE_API gr_probe_avg_mag_sqrd_cf_sptr - gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha); - - gr_probe_avg_mag_sqrd_cf (double threshold_db, double alpha); - -public: - ~gr_probe_avg_mag_sqrd_cf (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // ACCESSORS - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - - double threshold() const; - - // SETTERS - void set_alpha (double alpha); - void set_threshold (double decibels); -}; - -#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_CF_H */ diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i deleted file mode 100644 index bf76d973b7..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_cf.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 3, 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,probe_avg_mag_sqrd_cf); - -gr_probe_avg_mag_sqrd_cf_sptr -gr_make_probe_avg_mag_sqrd_cf (double threshold_db, double alpha = 0.0001); - -class gr_probe_avg_mag_sqrd_cf : public gr_sync_block -{ -public: - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - void set_alpha (double alpha); - void set_threshold (double decibels); - double threshold(); -}; diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc deleted file mode 100644 index 4ed40743fc..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 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 3, 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_probe_avg_mag_sqrd_f.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_probe_avg_mag_sqrd_f_sptr -gr_make_probe_avg_mag_sqrd_f(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_avg_mag_sqrd_f(threshold_db, alpha)); -} - -gr_probe_avg_mag_sqrd_f::gr_probe_avg_mag_sqrd_f (double threshold_db, double alpha) - : gr_sync_block ("probe_avg_mag_sqrd_f", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(0, 0, 0)), - d_iir(alpha), d_unmuted(false), d_level(0) -{ - set_threshold (threshold_db); -} - -gr_probe_avg_mag_sqrd_f::~gr_probe_avg_mag_sqrd_f() -{ -} - - -int -gr_probe_avg_mag_sqrd_f::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - - for (int i = 0; i < noutput_items; i++){ - double mag_sqrd = in[i]*in[i]; - d_iir.filter(mag_sqrd); // computed for side effect: prev_output() - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - d_level = d_iir.prev_output(); - return noutput_items; -} - -double -gr_probe_avg_mag_sqrd_f::threshold() const -{ - return 10 * std::log10(d_threshold); -} - -void -gr_probe_avg_mag_sqrd_f::set_threshold(double decibels) -{ - // convert to absolute threshold (mag sqrd) - d_threshold = std::pow(10.0, decibels/10); -} - -void -gr_probe_avg_mag_sqrd_f::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h deleted file mode 100644 index b2efcc64eb..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 3, 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_PROBE_AVG_MAG_SQRD_F_H -#define INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_probe_avg_mag_sqrd_f; -typedef boost::shared_ptr<gr_probe_avg_mag_sqrd_f> gr_probe_avg_mag_sqrd_f_sptr; - -GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr -gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001); - -/*! - * \brief compute avg magnitude squared. - * \ingroup sink_blk - * - * input: float - * - * Compute a running average of the magnitude squared of the the input. - * The level and indication as to whether the level exceeds threshold - * can be retrieved with the level and unmuted accessors. - */ -class GR_CORE_API gr_probe_avg_mag_sqrd_f : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - double d_level; - - friend GR_CORE_API gr_probe_avg_mag_sqrd_f_sptr - gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha); - - gr_probe_avg_mag_sqrd_f (double threshold_db, double alpha); - -public: - ~gr_probe_avg_mag_sqrd_f (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // ACCESSORS - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - - double threshold() const; - - // SETTERS - void set_alpha (double alpha); - void set_threshold (double decibels); -}; - -#endif /* INCLUDED_GR_PROBE_AVG_MAG_SQRD_F_H */ diff --git a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i b/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i deleted file mode 100644 index 1c63ae8e9d..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_avg_mag_sqrd_f.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 3, 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,probe_avg_mag_sqrd_f); - -gr_probe_avg_mag_sqrd_f_sptr -gr_make_probe_avg_mag_sqrd_f (double threshold_db, double alpha = 0.0001); - -class gr_probe_avg_mag_sqrd_f : public gr_sync_block -{ -public: - bool unmuted () const { return d_unmuted; } - double level () const { return d_level; } - double threshold() const; - void set_alpha (double alpha); - void set_threshold (double decibels); -}; diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc deleted file mode 100644 index 90eab13eba..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010 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 3, 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_pwr_squelch_cc.h> - -gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double threshold, double alpha, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_pwr_squelch_cc(threshold, alpha, ramp, gate)); -} - -gr_pwr_squelch_cc::gr_pwr_squelch_cc(double threshold, double alpha, int ramp, bool gate) : - gr_squelch_base_cc("pwr_squelch_cc", ramp, gate), - d_iir(alpha) -{ - set_threshold(threshold); -} - -std::vector<float> gr_pwr_squelch_cc::squelch_range() const -{ - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; -} - -void gr_pwr_squelch_cc::update_state(const gr_complex &in) -{ - d_pwr = d_iir.filter(in.real()*in.real()+in.imag()*in.imag()); -} diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h deleted file mode 100644 index b2b4624f58..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- 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 3, 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_PWR_SQUELCH_CC_H -#define INCLUDED_GR_PWR_SQUELCH_CC_H - -#include <gr_core_api.h> -#include <cmath> -#include <gr_squelch_base_cc.h> -#include <gr_single_pole_iir.h> - -class gr_pwr_squelch_cc; -typedef boost::shared_ptr<gr_pwr_squelch_cc> gr_pwr_squelch_cc_sptr; - -GR_CORE_API gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double db, double alpha = 0.0001, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output when input power below threshold - * \ingroup level_blk - */ -class GR_CORE_API gr_pwr_squelch_cc : public gr_squelch_base_cc -{ -private: - double d_threshold; - double d_pwr; - gr_single_pole_iir<double,double,double> d_iir; - - friend GR_CORE_API gr_pwr_squelch_cc_sptr gr_make_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); - gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); - -protected: - virtual void update_state(const gr_complex &in); - virtual bool mute() const { return d_pwr < d_threshold; } - -public: - std::vector<float> squelch_range() const; - - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } -}; - -#endif /* INCLUDED_GR_PWR_SQUELCH_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc deleted file mode 100644 index cfa867243d..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010 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 3, 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_pwr_squelch_ff.h> - -gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double threshold, double alpha, int ramp, bool gate) -{ - return gnuradio::get_initial_sptr(new gr_pwr_squelch_ff(threshold, alpha, ramp, gate)); -} - -gr_pwr_squelch_ff::gr_pwr_squelch_ff(double threshold, double alpha, int ramp, bool gate) : - gr_squelch_base_ff("pwr_squelch_ff", ramp, gate), - d_iir(alpha) -{ - set_threshold(threshold); -} - -std::vector<float> gr_pwr_squelch_ff::squelch_range() const -{ - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; -} - -void gr_pwr_squelch_ff::update_state(const float &in) -{ - d_pwr = d_iir.filter(in*in); -} diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h b/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h deleted file mode 100644 index d5148c4096..0000000000 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- 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 3, 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_PWR_SQUELCH_FF_H -#define INCLUDED_GR_PWR_SQUELCH_FF_H - -#include <gr_core_api.h> -#include <cmath> -#include <gr_squelch_base_ff.h> -#include <gr_single_pole_iir.h> - -class gr_pwr_squelch_ff; -typedef boost::shared_ptr<gr_pwr_squelch_ff> gr_pwr_squelch_ff_sptr; - -GR_CORE_API gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double db, double alpha = 0.0001, int ramp=0, bool gate=false); - -/*! - * \brief gate or zero output when input power below threshold - * \ingroup level_blk - */ -class GR_CORE_API gr_pwr_squelch_ff : public gr_squelch_base_ff -{ -private: - double d_threshold; - double d_pwr; - gr_single_pole_iir<double,double,double> d_iir; - - friend GR_CORE_API gr_pwr_squelch_ff_sptr gr_make_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); - gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); - -protected: - virtual void update_state(const float &in); - virtual bool mute() const { return d_pwr < d_threshold; } - -public: - std::vector<float> squelch_range() const; - - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } -}; - -#endif /* INCLUDED_GR_PWR_SQUELCH_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc deleted file mode 100644 index fa09582762..0000000000 --- a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005,2010 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 3, 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_quadrature_demod_cf.h> -#include <gr_io_signature.h> -#include <gr_math.h> - -gr_quadrature_demod_cf::gr_quadrature_demod_cf (float gain) - : gr_sync_block ("quadrature_demod_cf", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (float))), - d_gain (gain) -{ - set_history (2); // we need to look at the previous value -} - -gr_quadrature_demod_cf_sptr -gr_make_quadrature_demod_cf (float gain) -{ - return gnuradio::get_initial_sptr(new gr_quadrature_demod_cf (gain)); -} - -int -gr_quadrature_demod_cf::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *) input_items[0]; - float *out = (float *) output_items[0]; - in++; // ensure that in[-1] is valid - - for (int i = 0; i < noutput_items; i++){ - gr_complex product = in[i] * conj (in[i-1]); - // out[i] = d_gain * arg (product); - out[i] = d_gain * gr_fast_atan2f(imag(product), real(product)); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h b/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h deleted file mode 100644 index 9f5976c971..0000000000 --- a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 3, 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_QUADRATURE_DEMOD_CF_H -#define INCLUDED_GR_QUADRATURE_DEMOD_CF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_quadrature_demod_cf; -typedef boost::shared_ptr<gr_quadrature_demod_cf> gr_quadrature_demod_cf_sptr; -GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); - -/*! - * \brief quadrature demodulator: complex in, float out - * \ingroup demodulation_blk - * - * This can be used to demod FM, FSK, GMSK, etc. - * The input is complex baseband. - */ -class GR_CORE_API gr_quadrature_demod_cf : public gr_sync_block -{ - friend GR_CORE_API gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); - gr_quadrature_demod_cf (float gain); - - float d_gain; - - public: - void set_gain(float gain) { d_gain = gain; } - float gain() const { return d_gain; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_QUADRATURE_DEMOD_CF_H */ diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.cc b/gnuradio-core/src/lib/general/gr_rail_ff.cc deleted file mode 100644 index cd33c10d39..0000000000 --- a/gnuradio-core/src/lib/general/gr_rail_ff.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 3, 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_rail_ff.h> -#include <gr_io_signature.h> - -gr_rail_ff_sptr -gr_make_rail_ff(float lo, float hi) -{ - return gnuradio::get_initial_sptr(new gr_rail_ff(lo, hi)); -} - -gr_rail_ff::gr_rail_ff(float lo, float hi) - : gr_sync_block("rail_ff", - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))), - d_lo(lo), d_hi(hi) -{ -} - -int -gr_rail_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - if (in[i] < d_lo) - out[i] = d_lo; - else if (in[i] > d_hi) - out[i] = d_hi; - else - out[i] = in[i]; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.h b/gnuradio-core/src/lib/general/gr_rail_ff.h deleted file mode 100644 index 29db5b1fa1..0000000000 --- a/gnuradio-core/src/lib/general/gr_rail_ff.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 3, 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_RAIL_FF_H_ -# define INCLUDED_GR_RAIL_FF_H_ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief clips input values to min, max - * \ingroup misc - */ - -class gr_rail_ff; -typedef boost::shared_ptr<gr_rail_ff> gr_rail_ff_sptr; - -GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi); - -class GR_CORE_API gr_rail_ff : public gr_sync_block -{ - friend GR_CORE_API gr_rail_ff_sptr gr_make_rail_ff (float lo, float hi); - - float d_lo, d_hi; // the constant - gr_rail_ff(float lo, float hi); - - public: - float lo() const { return d_lo; } - void set_lo(float lo) { d_lo = lo; } - float hi() const { return d_hi; } - void set_hi(float hi) { d_hi = hi; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_rail_ff.i b/gnuradio-core/src/lib/general/gr_rail_ff.i deleted file mode 100644 index bdc453516e..0000000000 --- a/gnuradio-core/src/lib/general/gr_rail_ff.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 3, 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,rail_ff); - -gr_rail_ff_sptr gr_make_rail_ff(float lo, float hi); - -class gr_rail_ff : public gr_sync_block -{ -private: - gr_rail_ff(float lo, float hi); -}; diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc deleted file mode 100644 index 5d90a3da48..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010 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 3, 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_simple_squelch_cc.h> -#include <gr_io_signature.h> -#include <cmath> - -gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc(double threshold_db, double alpha) -{ - return gnuradio::get_initial_sptr(new gr_simple_squelch_cc(threshold_db, alpha)); -} - -gr_simple_squelch_cc::gr_simple_squelch_cc (double threshold_db, double alpha) - : gr_sync_block ("simple_squelch_cc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))), - d_iir(alpha), d_unmuted(false) -{ - set_threshold (threshold_db); -} - -gr_simple_squelch_cc::~gr_simple_squelch_cc() -{ -} - - -int -gr_simple_squelch_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]; - - for (int i = 0; i < noutput_items; i++){ - double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); - double f = d_iir.filter(mag_sqrd); - if (f >= d_threshold) - out[i] = in[i]; - else - out[i] = 0; - } - - d_unmuted = d_iir.prev_output() >= d_threshold; - return noutput_items; -} - -void -gr_simple_squelch_cc::set_threshold(double decibels) -{ - // convert to absolute threshold (mag squared) - d_threshold = std::pow(10.0, decibels/10); -} - -double -gr_simple_squelch_cc::threshold() const -{ - return 10 * log10(d_threshold); -} - -void -gr_simple_squelch_cc::set_alpha(double alpha) -{ - d_iir.set_taps(alpha); -} - -std::vector<float> -gr_simple_squelch_cc::squelch_range() const -{ - std::vector<float> r(3); - r[0] = -50.0; // min FIXME - r[1] = +50.0; // max FIXME - r[2] = (r[1] - r[0]) / 100; // step size - - return r; -} diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h deleted file mode 100644 index 4bf62c7ec6..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 3, 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_SIMPLE_SQUELCH_CC_H -#define INCLUDED_GR_SIMPLE_SQUELCH_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_single_pole_iir.h> - -class gr_simple_squelch_cc; -typedef boost::shared_ptr<gr_simple_squelch_cc> gr_simple_squelch_cc_sptr; - -GR_CORE_API gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001); - -/*! - * \brief simple squelch block based on average signal power and threshold in dB. - * \ingroup level_blk - */ -class GR_CORE_API gr_simple_squelch_cc : public gr_sync_block -{ - double d_threshold; - gr_single_pole_iir<double,double,double> d_iir; - bool d_unmuted; - - friend GR_CORE_API gr_simple_squelch_cc_sptr - gr_make_simple_squelch_cc (double threshold_db, double alpha); - - gr_simple_squelch_cc (double threshold_db, double alpha); - -public: - ~gr_simple_squelch_cc (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - bool unmuted () const { return d_unmuted; } - - void set_alpha (double alpha); - void set_threshold (double decibels); - - double threshold() const; - std::vector<float> squelch_range() const; - -}; - -#endif /* INCLUDED_GR_SIMPLE_SQUELCH_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i b/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i deleted file mode 100644 index 17b469e156..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_squelch_cc.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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 3, 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,simple_squelch_cc); - -gr_simple_squelch_cc_sptr -gr_make_simple_squelch_cc (double threshold_db, double alpha = 0.0001); - -class gr_simple_squelch_cc : public gr_sync_block -{ -public: - bool unmuted () const { return d_unmuted; } - void set_alpha (double alpha); - void set_threshold (double decibels); - - double threshold() const; - std::vector<float> squelch_range() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc b/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc deleted file mode 100644 index b32a0a6954..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 3, 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_squelch_base_cc.h> -#include <gr_io_signature.h> - -gr_squelch_base_cc::gr_squelch_base_cc(const char *name, int ramp, bool gate) : - gr_block(name, - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(1, 1, sizeof(gr_complex))) -{ - set_ramp(ramp); - set_gate(gate); - d_state = ST_MUTED; - d_envelope = d_ramp ? 0.0 : 1.0; - d_ramped = 0; -} - -int gr_squelch_base_cc::general_work(int noutput_items, - gr_vector_int &ninput_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]; - - int j = 0; - - for (int i = 0; i < noutput_items; i++) { - update_state(in[i]); - - // Adjust envelope based on current state - switch(d_state) { - case ST_MUTED: - if (!mute()) - d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted - break; - - case ST_UNMUTED: - if (mute()) - d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted - break; - - case ST_ATTACK: - d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if (d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere - d_state = ST_UNMUTED; - d_envelope = 1.0; - } - break; - - case ST_DECAY: - d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if (d_ramped == 0.0) - d_state = ST_MUTED; - break; - }; - - // If unmuted, copy input times envelope to output - // Otherwise, if not gating, copy zero to output - if (d_state != ST_MUTED) - out[j++] = in[i]*gr_complex(d_envelope, 0.0); - else - if (!d_gate) - out[j++] = 0.0; - } - - consume_each(noutput_items); // Use all the inputs - return j; // But only report outputs copied -} diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h b/gnuradio-core/src/lib/general/gr_squelch_base_cc.h deleted file mode 100644 index f1814473fb..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- 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 3, 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_SQUELCH_BASE_CC_H -#define INCLUDED_GR_SQUELCH_BASE_CC_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class GR_CORE_API gr_squelch_base_cc : public gr_block -{ -private: - int d_ramp; - int d_ramped; - bool d_gate; - double d_envelope; - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - -protected: - virtual void update_state(const gr_complex &sample) {}; - virtual bool mute() const { return false; }; - -public: - gr_squelch_base_cc(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - virtual std::vector<float> squelch_range() const = 0; - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SQUELCH_BASE_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc b/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc deleted file mode 100644 index 4bf8cff971..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 3, 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_squelch_base_ff.h> -#include <gr_io_signature.h> - -gr_squelch_base_ff::gr_squelch_base_ff(const char *name, int ramp, bool gate) : - gr_block(name, - gr_make_io_signature(1, 1, sizeof(float)), - gr_make_io_signature(1, 1, sizeof(float))) -{ - set_ramp(ramp); - set_gate(gate); - d_state = ST_MUTED; - d_envelope = d_ramp ? 0.0 : 1.0; - d_ramped = 0; -} - -int gr_squelch_base_ff::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - int j = 0; - - for (int i = 0; i < noutput_items; i++) { - update_state(in[i]); - - // Adjust envelope based on current state - switch(d_state) { - case ST_MUTED: - if (!mute()) - d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted - break; - - case ST_UNMUTED: - if (mute()) - d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted - break; - - case ST_ATTACK: - d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if (d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere - d_state = ST_UNMUTED; - d_envelope = 1.0; - } - break; - - case ST_DECAY: - d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed - if (d_ramped == 0.0) - d_state = ST_MUTED; - break; - }; - - // If unmuted, copy input times envelope to output - // Otherwise, if not gating, copy zero to output - if (d_state != ST_MUTED) - out[j++] = in[i]*d_envelope; - else - if (!d_gate) - out[j++] = 0.0; - } - - consume_each(noutput_items); // Use all the inputs - return j; // But only report outputs copied -} diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h b/gnuradio-core/src/lib/general/gr_squelch_base_ff.h deleted file mode 100644 index eb52635b45..0000000000 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- 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 3, 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_SQUELCH_BASE_FF_H -#define INCLUDED_GR_SQUELCH_BASE_FF_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class GR_CORE_API gr_squelch_base_ff : public gr_block -{ -private: - int d_ramp; - int d_ramped; - bool d_gate; - double d_envelope; - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; - -protected: - virtual void update_state(const float &sample) {}; - virtual bool mute() const { return false; }; - -public: - gr_squelch_base_ff(const char *name, int ramp, bool gate); - - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } - - virtual std::vector<float> squelch_range() const = 0; - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SQUELCH_BASE_FF_H */ diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.h b/gnuradio-core/src/lib/general/gri_agc2_cc.h deleted file mode 100644 index 55aa19b9ae..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_cc.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- 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 3, 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 _GRI_AGC2_CC_H_ -#define _GRI_AGC2_CC_H_ - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ -class GR_CORE_API gri_agc2_cc { - - public: - gri_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _attack_rate(attack_rate), _decay_rate(decay_rate), _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float decay_rate () const { return _decay_rate; } - float attack_rate () const { return _attack_rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_decay_rate (float rate) { _decay_rate = rate; } - void set_attack_rate (float rate) { _attack_rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - gr_complex scale (gr_complex input){ - gr_complex output = input * _gain; - - float tmp = -_reference + sqrt(output.real()*output.real() + - output.imag()*output.imag()); - float rate = _decay_rate; - if((tmp) > _gain) - rate = _attack_rate; - _gain -= tmp*rate; - -#if 0 - fprintf(stdout, "rate = %f\ttmp = %f\t gain = %f\n", rate, tmp, _gain); -#endif - - // Not sure about this; will blow up if _gain < 0 (happens when rates are too high), - // but is this the solution? - if (_gain < 0.0) - _gain = 10e-5; - - if (_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN (gr_complex output[], const gr_complex input[], unsigned n){ - for (unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _attack_rate; // attack rate for fast changing signals - float _decay_rate; // decay rate for slow changing signals - float _reference; // reference value - float _gain; // current gain - float _max_gain; // max allowable gain -}; - -#endif /* _GRI_AGC2_CC_H_ */ diff --git a/gnuradio-core/src/lib/general/gri_agc2_cc.i b/gnuradio-core/src/lib/general/gri_agc2_cc.i deleted file mode 100644 index 08716c6edc..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_cc.i +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- 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 3, 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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class with attack and decay rates - * - * For Power the absolute value of the complex number is used. - */ - - -class gri_agc2_cc { - - public: - gri_agc2_cc (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - float decay_rate (); - float attack_rate (); - float reference (); - float gain (); - float max_gain (); - void set_decay_rate (float rate); - void set_attack_rate (float rate); - void set_reference (float reference); - void set_gain (float gain); - void set_max_gain(float max_gain); - }; diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.h b/gnuradio-core/src/lib/general/gri_agc2_ff.h deleted file mode 100644 index a8b46bec5c..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_ff.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 3, 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 _GRI_AGC2_FF_H_ -#define _GRI_AGC2_FF_H_ - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class with attack and decay rate - * - * Power is approximated by absolute value - */ - -class GR_CORE_API gri_agc2_ff { - - public: - gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _attack_rate(attack_rate), _decay_rate(decay_rate), _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float attack_rate () const { return _attack_rate; } - float decay_rate () const { return _decay_rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain () const { return _max_gain; } - - void set_attack_rate (float rate) { _attack_rate = rate; } - void set_decay_rate (float rate) { _decay_rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain (float max_gain) { _max_gain = max_gain; } - - float scale (float input){ - float output = input * _gain; - - float tmp = (fabsf(output)) - _reference; - float rate = _decay_rate; - if(fabsf(tmp) > _gain) - rate = _attack_rate; - _gain -= tmp*rate; - -#if 0 - fprintf(stdout, "rate = %f\ttmp = %f\t gain = %f\n", rate, tmp, _gain); -#endif - - // Not sure about this - if (_gain < 0.0) - _gain = 10e-5; - - if (_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN (float output[], const float input[], unsigned n){ - for (unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _attack_rate; // attack_rate for fast changing signals - float _decay_rate; // decay rate for slow changing signals - float _reference; // reference value - float _gain; // current gain - float _max_gain; // maximum gain -}; - -#endif /* _GRI_AGC2_FF_H_ */ diff --git a/gnuradio-core/src/lib/general/gri_agc2_ff.i b/gnuradio-core/src/lib/general/gri_agc2_ff.i deleted file mode 100644 index 9f97d8f0dd..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc2_ff.i +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 3, 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. - */ - -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value - */ - - -class gri_agc2_ff { - - public: - gri_agc2_ff (float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, float gain = 1.0, float max_gain = 0.0); - float attack_rate (); - float decay_rate (); - float reference (); - float gain (); - float max_gain (); - void set_attack_rate (float rate); - void set_decay_rate (float rate); - void set_reference (float reference); - void set_gain (float gain); - void set_max_gain (float max_gain); - }; diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.h b/gnuradio-core/src/lib/general/gri_agc_cc.h deleted file mode 100644 index 90edc5dcd2..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_cc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- 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 3, 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_GRI_AGC_CC_H -#define INCLUDED_GRI_AGC_CC_H - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ - -class GR_CORE_API gri_agc_cc { - - public: - gri_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _rate(rate), _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float rate () const { return _rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_rate (float rate) { _rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - gr_complex scale (gr_complex input){ - gr_complex output = input * _gain; - - _gain += _rate * (_reference - sqrt(output.real()*output.real() + - output.imag()*output.imag())); - if (_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN (gr_complex output[], const gr_complex input[], unsigned n){ - for (unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _rate; // adjustment rate - float _reference; // reference value - float _gain; // current gain - float _max_gain; // max allowable gain -}; - -#endif /* INCLUDED_GRI_AGC_CC_H */ diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.h b/gnuradio-core/src/lib/general/gri_agc_ff.h deleted file mode 100644 index 1c233c7461..0000000000 --- a/gnuradio-core/src/lib/general/gri_agc_ff.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002,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 3, 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_GRI_AGC_FF_H -#define INCLUDED_GRI_AGC_FF_H - -#include <gr_core_api.h> -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value - */ -class GR_CORE_API gri_agc_ff { - - public: - gri_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain) {}; - - float rate () const { return _rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain () const { return _max_gain; } - - void set_rate (float rate) { _rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain (float max_gain) { _max_gain = max_gain; } - - float scale (float input){ - float output = input * _gain; - _gain += (_reference - fabsf (output)) * _rate; - if (_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN (float output[], const float input[], unsigned n){ - for (unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _rate; // adjustment rate - float _reference; // reference value - float _gain; // current gain - float _max_gain; // maximum gain -}; - -#endif /* INCLUDED_GRI_AGC_FF_H */ - diff --git a/gnuradio-core/src/lib/general/gri_control_loop.cc b/gnuradio-core/src/lib/general/gri_control_loop.cc index 5a93737f92..bb3c4a3263 100644 --- a/gnuradio-core/src/lib/general/gri_control_loop.cc +++ b/gnuradio-core/src/lib/general/gri_control_loop.cc @@ -144,6 +144,17 @@ gri_control_loop::set_phase(float phase) d_phase += M_TWOPI; } +void +gri_control_loop::set_max_freq(float freq) +{ + d_max_freq = freq; +} + +void +gri_control_loop::set_min_freq(float freq) +{ + d_min_freq = freq; +} /******************************************************************* GET FUNCTIONS @@ -185,3 +196,15 @@ gri_control_loop::get_phase() const { return d_phase; } + +float +gri_control_loop::get_max_freq() const +{ + return d_max_freq; +} + +float +gri_control_loop::get_min_freq() const +{ + return d_min_freq; +} diff --git a/gnuradio-core/src/lib/general/gri_control_loop.h b/gnuradio-core/src/lib/general/gri_control_loop.h index f10bc76be2..46aa6ae243 100644 --- a/gnuradio-core/src/lib/general/gri_control_loop.h +++ b/gnuradio-core/src/lib/general/gri_control_loop.h @@ -142,9 +142,9 @@ class GR_CORE_API gri_control_loop void set_beta(float beta); /*! - * \brief Set the Costas loop's frequency. + * \brief Set the control loop's frequency. * - * Set's the Costas Loop's frequency. While this is normally updated by the + * Set's the control loop's frequency. While this is normally updated by the * inner loop of the algorithm, it could be useful to manually initialize, * set, or reset this under certain circumstances. * @@ -154,9 +154,9 @@ class GR_CORE_API gri_control_loop void set_frequency(float freq); /*! - * \brief Set the Costas loop's phase. + * \brief Set the control loop's phase. * - * Set's the Costas Loop's phase. While this is normally updated by the + * Set's the control loop's phase. While this is normally updated by the * inner loop of the algorithm, it could be useful to manually initialize, * set, or reset this under certain circumstances. * @@ -165,6 +165,23 @@ class GR_CORE_API gri_control_loop */ void set_phase(float phase); + /*! + * \brief Set the control loop's maximum frequency. + * + * Set the maximum frequency the control loop can track. + * + * \param freq (float) new max frequency + */ + void set_max_freq(float freq); + + /*! + * \brief Set the control loop's minimum frequency. + * + * Set the minimum frequency the control loop can track. + * + * \param freq (float) new min frequency + */ + void set_min_freq(float freq); /******************************************************************* GET FUNCTIONS @@ -191,14 +208,24 @@ class GR_CORE_API gri_control_loop float get_beta() const; /*! - * \brief Get the Costas loop's frequency estimate + * \brief Get the control loop's frequency estimate */ float get_frequency() const; /*! - * \brief Get the Costas loop's phase estimate + * \brief Get the control loop's phase estimate */ float get_phase() const; + + /*! + * \brief Get the control loop's maximum frequency. + */ + float get_max_freq() const; + + /*! + * \brief Get the control loop's minimum frequency. + */ + float get_min_freq() const; }; #endif /* GRI_CONTROL_LOOP */ diff --git a/gnuradio-core/src/lib/general/gri_lfsr.h b/gnuradio-core/src/lib/general/gri_lfsr.h deleted file mode 100644 index d0ce3d850a..0000000000 --- a/gnuradio-core/src/lib/general/gri_lfsr.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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 3, 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_GRI_LFSR_H -#define INCLUDED_GRI_LFSR_H - -#include <gr_core_api.h> -#include <stdexcept> -#include <stdint.h> - -/*! - * \brief Fibonacci Linear Feedback Shift Register using specified polynomial mask - * \ingroup misc - * - * Generates a maximal length pseudo-random sequence of length 2^degree-1 - * - * Constructor: gri_lfsr(int mask, int seed, int reg_len); - * - * mask - polynomial coefficients representing the locations - * of feedback taps from a shift register which are xor'ed - * together to form the new high order bit. - * - * Some common masks might be: - * x^4 + x^3 + x^0 = 0x19 - * x^5 + x^3 + x^0 = 0x29 - * x^6 + x^5 + x^0 = 0x61 - * - * seed - the initialization vector placed into the register - * durring initialization. Low order bit corresponds - * to x^0 coefficient -- the first to be shifted as output. - * - * reg_len - specifies the length of the feedback shift register - * to be used. Durring each iteration, the register - * is rightshifted one and the new bit is placed in bit reg_len. - * reg_len should generally be at least order(mask) + 1 - * - * - * see http://en.wikipedia.org/wiki/Linear_feedback_shift_register - * for more explanation. - * - * - * - * next_bit() - Standard LFSR operation - * - * Perform one cycle of the LFSR. The output bit is taken from - * the shift register LSB. The shift register MSB is assigned from - * the modulo 2 sum of the masked shift register. - * - * next_bit_scramble(unsigned char input) - Scramble an input stream - * - * Perform one cycle of the LFSR. The output bit is taken from - * the shift register LSB. The shift register MSB is assigned from - * the modulo 2 sum of the masked shift register and the input LSB. - * - * next_bit_descramble(unsigned char input) - Descramble an input stream - * - * Perform one cycle of the LFSR. The output bit is taken from - * the modulo 2 sum of the masked shift register and the input LSB. - * The shift register MSB is assigned from the LSB of the input. - * - * See http://en.wikipedia.org/wiki/Scrambler for operation of these - * last two functions (see multiplicative scrambler.) - * - */ - -class /*GR_CORE_API*/ gri_lfsr -{ - private: - uint32_t d_shift_register; - uint32_t d_mask; - uint32_t d_seed; - uint32_t d_shift_register_length; // less than 32 - - static uint32_t - popCount(uint32_t x) - { - uint32_t r = x - ((x >> 1) & 033333333333) - - ((x >> 2) & 011111111111); - return ((r + (r >> 3)) & 030707070707) % 63; - } - - public: - - gri_lfsr(uint32_t mask, uint32_t seed, uint32_t reg_len) - : d_shift_register(seed), - d_mask(mask), - d_seed(seed), - d_shift_register_length(reg_len) - { - if (reg_len > 31) - throw std::invalid_argument("reg_len must be <= 31"); - } - - unsigned char next_bit() { - unsigned char output = d_shift_register & 1; - unsigned char newbit = popCount( d_shift_register & d_mask )%2; - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - unsigned char next_bit_scramble(unsigned char input) { - unsigned char output = d_shift_register & 1; - unsigned char newbit = (popCount( d_shift_register & d_mask )%2)^(input & 1); - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - unsigned char next_bit_descramble(unsigned char input) { - unsigned char output = (popCount( d_shift_register & d_mask )%2)^(input & 1); - unsigned char newbit = input & 1; - d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); - return output; - } - - /*! - * Reset shift register to initial seed value - */ - void reset() { d_shift_register = d_seed; } - - /*! - * Rotate the register through x number of bits - * where we are just throwing away the results to get queued up correctly - */ - void pre_shift(int num){ - for(int i=0; i<num; i++){ - next_bit(); - } - } - - int mask() const { return d_mask; } -}; - -#endif /* INCLUDED_GRI_LFSR_H */ diff --git a/gnuradio-core/src/lib/general/qa_general.cc b/gnuradio-core/src/lib/general/qa_general.cc index 61e5c159bd..75d59434d4 100644 --- a/gnuradio-core/src/lib/general/qa_general.cc +++ b/gnuradio-core/src/lib/general/qa_general.cc @@ -28,7 +28,6 @@ #include <qa_general.h> #include <qa_gr_firdes.h> #include <qa_gr_circular_file.h> -#include <qa_gr_cpm.h> #include <qa_gr_fxpt.h> #include <qa_gr_fxpt_nco.h> #include <qa_gr_fxpt_vco.h> @@ -41,7 +40,6 @@ qa_general::suite () s->addTest (qa_gr_firdes::suite ()); s->addTest (qa_gr_circular_file::suite ()); - s->addTest (qa_gr_cpm::suite ()); s->addTest (qa_gr_fxpt::suite ()); s->addTest (qa_gr_fxpt_nco::suite ()); s->addTest (qa_gr_fxpt_vco::suite ()); diff --git a/gnuradio-core/src/lib/general/qa_gr_cpm.cc b/gnuradio-core/src/lib/general/qa_gr_cpm.cc deleted file mode 100644 index ee3e2bdea0..0000000000 --- a/gnuradio-core/src/lib/general/qa_gr_cpm.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2010 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 3, 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. - */ - -#include <qa_gr_cpm.h> -#include <gr_cpm.h> -#include <cppunit/TestAssert.h> - -const double DELTA = 1e-5; -const int L = 5; -const int samples_per_sym = 4; -const float taps_lrc[20] = { - 0, 0.002447174185242, 0.009549150281253, 0.020610737385376, - 0.034549150281253, 0.050000000000000, 0.065450849718747, 0.079389262614624, - 0.090450849718747, 0.097552825814758, 0.100000000000000, 0.097552825814758, - 0.090450849718747, 0.079389262614624, 0.065450849718747, 0.050000000000000, - 0.034549150281253, 0.020610737385376, 0.009549150281253, 0.002447174185242 -}; - - -const float taps_lsrc[20] = { // beta = 0.2 - 0.000000000000000, 0.009062686687436, 0.019517618142920, 0.030875041875917, - 0.042552315421249, 0.053912556756416, 0.064308860403517, 0.073130584159352, - 0.079847961304114, 0.084051371489937, 0.085482007518284, 0.084051371489937, - 0.079847961304114, 0.073130584159352, 0.064308860403517, 0.053912556756416, - 0.042552315421249, 0.030875041875917, 0.019517618142920, 0.009062686687436 -}; - - -const float taps_tfm[20] = { - -0.003946522220317, -0.005147757690530, -0.003171631690177, 0.003959659609805, - 0.017498721302356, 0.037346982678383, 0.062251889790391, 0.087364237065604, - 0.110049050955117, 0.125677762224511, 0.132288693729399, 0.125677762224511, - 0.110049050955117, 0.087364237065604, 0.062251889790391, 0.037346982678383, - 0.017498721302356, 0.003959659609805, -0.003171631690177, -0.005147757690530 -}; - - -const float taps_gaussian[20] = { // BT = 0.3 - 0.000000743866524, 0.000009286258371, 0.000085441834550, 0.000581664421923, - 0.002945540765422, 0.011178079812344, 0.032117220937421, 0.070841188736816, - 0.122053715366673, 0.167389736919915, 0.185594670675172, 0.167389736919915, - 0.122053715366673, 0.070841188736816, 0.032117220937421, 0.011178079812344, - 0.002945540765422, 0.000581664421923, 0.000085441834550, 0.000009286258371 -}; - - -// Check LREC phase response -void -qa_gr_cpm::t1 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LREC, samples_per_sym, L)); - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], 0.05, DELTA); - } -} - - -// Check LRC phase response -void -qa_gr_cpm::t2 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LRC, samples_per_sym, L)); - float sum = 0; - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_lrc[i], DELTA); - sum += taps[i]; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); -} - - -// Check LSRC phase response -void -qa_gr_cpm::t3 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::LSRC, samples_per_sym, L, 0.2)); - float sum = 0; - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_lsrc[i], DELTA); - sum += taps[i]; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); -} - - -// Check the TFM phase response -void -qa_gr_cpm::t4 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::TFM, samples_per_sym, L)); - float sum = 0; - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_tfm[i], DELTA); - sum += taps[i]; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); -} - - -// Check the Gaussian phase response -void -qa_gr_cpm::t5 () -{ - std::vector<float> taps(gr_cpm::phase_response(gr_cpm::GAUSSIAN, samples_per_sym, L, 0.3)); - float sum = 0; - - for (int i = 0; i < L * samples_per_sym; i++) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(taps[i], taps_gaussian[i], DELTA); - sum += taps[i]; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(sum, 1.0, DELTA); -} - diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index ed49cf07e5..03f39d358d 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -84,8 +84,6 @@ endmacro(expand_h_cc_i) expand_h_cc_i(gr_vector_source_X b s i f c) expand_h_cc_i(gr_vector_insert_X b) expand_h_cc_i(gr_vector_sink_X b s i f c) -expand_h_cc_i(gr_noise_source_X s i f c) -expand_h_cc_i(gr_sig_source_X s i f c) expand_h_cc_i(gr_probe_signal_X b s i f c) expand_h_cc_i(gr_probe_signal_vX b s i f c) @@ -155,8 +153,6 @@ list(APPEND gnuradio_core_sources install(FILES ${generated_gengen_includes} ${CMAKE_CURRENT_SOURCE_DIR}/gr_endianness.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_noise_type.h - ${CMAKE_CURRENT_SOURCE_DIR}/gr_sig_source_waveform.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio COMPONENT "core_devel" ) diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 37d8944f5b..d04df6bda5 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -32,8 +32,6 @@ ss_signatures = ['s', 'i', 'f', 'c'] ss_roots = [ 'gr_vector_source_X', 'gr_vector_sink_X', - 'gr_noise_source_X', - 'gr_sig_source_X', 'gr_probe_signal_X', 'gr_probe_signal_vX' ] diff --git a/gnuradio-core/src/lib/gengen/gengen.i b/gnuradio-core/src/lib/gengen/gengen.i index d1895bfa83..7d8c27fe68 100644 --- a/gnuradio-core/src/lib/gengen/gengen.i +++ b/gnuradio-core/src/lib/gengen/gengen.i @@ -22,12 +22,8 @@ %{ #include "gr_endianness.h" -#include "gr_sig_source_waveform.h" -#include "gr_noise_type.h" %} %include "gr_endianness.i" -%include "gr_sig_source_waveform.h" -%include "gr_noise_type.h" %include "gengen_generated.i" diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t deleted file mode 100644 index 3078f6366e..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_X.cc.t +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 3, 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <stdexcept> - - -@NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed) -{ - return gnuradio::get_initial_sptr(new @NAME@ (type, ampl, seed)); -} - - -@NAME@::@NAME@ (gr_noise_type_t type, float ampl, long seed) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof (@TYPE@))), - d_type (type), - d_ampl (ampl), - d_rng (seed) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @TYPE@ *out = (@TYPE@ *) output_items[0]; - - switch (d_type){ -#if @IS_COMPLEX@ // complex? - - case GR_UNIFORM: - for (int i = 0; i < noutput_items; i++) - out[i] = gr_complex (d_ampl * ((d_rng.ran1 () * 2.0) - 1.0), - d_ampl * ((d_rng.ran1 () * 2.0) - 1.0)); - break; - - case GR_GAUSSIAN: - for (int i = 0; i < noutput_items; i++) - out[i] = d_ampl * d_rng.rayleigh_complex (); - break; - -#else // nope... - - case GR_UNIFORM: - for (int i = 0; i < noutput_items; i++) - out[i] = (@TYPE@)(d_ampl * ((d_rng.ran1 () * 2.0) - 1.0)); - break; - - case GR_GAUSSIAN: - for (int i = 0; i < noutput_items; i++) - out[i] = (@TYPE@)(d_ampl * d_rng.gasdev ()); - break; - - case GR_LAPLACIAN: - for (int i = 0; i < noutput_items; i++) - out[i] = (@TYPE@)(d_ampl * d_rng.laplacian ()); - break; - - case GR_IMPULSE: // FIXME changeable impulse settings - for (int i = 0; i < noutput_items; i++) - out[i] = (@TYPE@)(d_ampl * d_rng.impulse (9)); - break; -#endif - - default: - throw std::runtime_error ("invalid type"); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t deleted file mode 100644 index 31ffb2b169..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 3, 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_noise_type.h> -#include <gr_random.h> - - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! \brief Make a noise source - * \param type the random distribution to use (see gr_noise_type.h) - * \param ampl a scaling factor for the output - * \param seed seed for random generators. Note that for uniform and - * Gaussian distributions, this should be a negative number. - */ -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0); - -/*! - * \brief Random number source - * \ingroup source_blk - * - * \details - * Generate random values from different distributions. - * Currently, only Gaussian and uniform are enabled. - * - * \param type the random distribution to use (see gr_noise_type.h) - * \param ampl a scaling factor for the output - * \param seed seed for random generators. Note that for uniform and - * Gaussian distributions, this should be a negative number. - */ -class GR_CORE_API @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr - - gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed); - - gr_noise_type_t d_type; - float d_ampl; - gr_random d_rng; - - @NAME@ (gr_noise_type_t type, float ampl, long seed = 0); - - public: - void set_type (gr_noise_type_t type) { d_type = type; } - void set_amplitude (float ampl) { d_ampl = ampl; } - - gr_noise_type_t type () const { return d_type; } - float amplitude () const { return d_ampl; } - - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t deleted file mode 100644 index 6959eac824..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 3, 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <@NAME@.h> -#include <algorithm> -#include <gr_io_signature.h> -#include <stdexcept> -#include <algorithm> -#include <gr_complex.h> - - -@NAME@::@NAME@ (double sampling_freq, gr_waveform_t waveform, - double frequency, double ampl, @TYPE@ offset) - : gr_sync_block ("@BASE_NAME@", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof (@TYPE@))), - d_sampling_freq (sampling_freq), d_waveform (waveform), d_frequency (frequency), - d_ampl (ampl), d_offset (offset) -{ - d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq); -} - -@NAME@_sptr -gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, - double frequency, double ampl, @TYPE@ offset) -{ - return gnuradio::get_initial_sptr(new @NAME@ (sampling_freq, waveform, frequency, ampl, offset)); -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - @TYPE@ *optr = (@TYPE@ *) output_items[0]; - @TYPE@ t; - - switch (d_waveform){ - -#if @IS_COMPLEX@ // complex? - - case GR_CONST_WAVE: - t = (gr_complex) d_ampl + d_offset; - std::fill_n(optr, noutput_items, t); - break; - - case GR_SIN_WAVE: - case GR_COS_WAVE: - d_nco.sincos (optr, noutput_items, d_ampl); - if (d_offset == gr_complex(0,0)) - break; - - for (int i = 0; i < noutput_items; i++){ - optr[i] += d_offset; - } - break; - - /* Implements a real square wave high from -PI to 0. - * The imaginary square wave leads by 90 deg. - */ - case GR_SQR_WAVE: - for (int i = 0; i < noutput_items; i++){ - if (d_nco.get_phase() < -1*M_PI/2) - optr[i] = gr_complex(d_ampl, 0)+d_offset; - else if (d_nco.get_phase() < 0) - optr[i] = gr_complex(d_ampl, d_ampl)+d_offset; - else if (d_nco.get_phase() < M_PI/2) - optr[i] = gr_complex(0, d_ampl)+d_offset; - else - optr[i] = d_offset; - d_nco.step(); - } - break; - - /* Implements a real triangle wave rising from -PI to 0 and - * falling from 0 to PI. The imaginary triangle wave leads by 90 deg. - */ - case GR_TRI_WAVE: - for (int i = 0; i < noutput_items; i++){ - if (d_nco.get_phase() < -1*M_PI/2){ - optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl, - -1*d_ampl*d_nco.get_phase()/M_PI - d_ampl/2)+d_offset; - } - else if (d_nco.get_phase() < 0){ - optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl, - d_ampl*d_nco.get_phase()/M_PI + d_ampl/2)+d_offset; - } - else if (d_nco.get_phase() < M_PI/2){ - optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl, - d_ampl*d_nco.get_phase()/M_PI + d_ampl/2)+d_offset; - } - else{ - optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl, - -1*d_ampl*d_nco.get_phase()/M_PI + 3*d_ampl/2)+d_offset; - } - d_nco.step(); - } - break; - - /* Implements a real saw tooth wave rising from -PI to PI. - * The imaginary saw tooth wave leads by 90 deg. - */ - case GR_SAW_WAVE: - for (int i = 0; i < noutput_items; i++){ - if (d_nco.get_phase() < -1*M_PI/2){ - optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2, - d_ampl*d_nco.get_phase()/(2*M_PI) + 5*d_ampl/4)+d_offset; - } - else{ - optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2, - d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/4)+d_offset; - } - d_nco.step(); - } - break; - -#else // nope... - - case GR_CONST_WAVE: - t = (@TYPE@) d_ampl + d_offset; - std::fill_n(optr, noutput_items, t); - break; - - case GR_SIN_WAVE: - d_nco.sin (optr, noutput_items, d_ampl); - if (d_offset == 0) - break; - - for (int i = 0; i < noutput_items; i++){ - optr[i] += d_offset; - } - break; - - case GR_COS_WAVE: - d_nco.cos (optr, noutput_items, d_ampl); - if (d_offset == 0) - break; - - for (int i = 0; i < noutput_items; i++){ - optr[i] += d_offset; - } - break; - - /* The square wave is high from -PI to 0. */ - case GR_SQR_WAVE: - t = (@TYPE@) d_ampl + d_offset; - for (int i = 0; i < noutput_items; i++){ - if (d_nco.get_phase() < 0) - optr[i] = t; - else - optr[i] = d_offset; - d_nco.step(); - } - break; - - /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */ - case GR_TRI_WAVE: - for (int i = 0; i < noutput_items; i++){ - double t = d_ampl*d_nco.get_phase()/M_PI; - if (d_nco.get_phase() < 0) - optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset); - else - optr[i] = static_cast<@TYPE@>(-1*t + d_ampl + d_offset); - d_nco.step(); - } - break; - - /* The saw tooth wave rises from -PI to PI. */ - case GR_SAW_WAVE: - for (int i = 0; i < noutput_items; i++){ - t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2 + d_offset); - optr[i] = t; - d_nco.step(); - } - break; - -#endif - - default: - throw std::runtime_error ("gr_sig_source: invalid waveform"); - } - - return noutput_items; -} - -void -@NAME@::set_sampling_freq (double sampling_freq) -{ - d_sampling_freq = sampling_freq; - d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq); -} - -void -@NAME@::set_waveform (gr_waveform_t waveform) -{ - d_waveform = waveform; -} - -void -@NAME@::set_frequency (double frequency) -{ - d_frequency = frequency; - d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq); -} - -void -@NAME@::set_amplitude (double ampl) -{ - d_ampl = ampl; -} - -void -@NAME@::set_offset (@TYPE@ offset) -{ - d_offset = offset; -} - diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t deleted file mode 100644 index baa82dbe20..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_X.h.t +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 3, 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_sig_source_waveform.h> -#include <gr_fxpt_nco.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @NAME@_sptr; - -/*! - * \brief signal generator with @TYPE@ output. - * \ingroup source_blk - */ - -class GR_CORE_API @NAME@ : public gr_sync_block { - friend GR_CORE_API @NAME@_sptr - gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, - double frequency, double ampl, @TYPE@ offset); - - double d_sampling_freq; - gr_waveform_t d_waveform; - double d_frequency; - double d_ampl; - @TYPE@ d_offset; - gr_fxpt_nco d_nco; - - - @NAME@ (double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset); - - public: - virtual int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // ACCESSORS - double sampling_freq () const { return d_sampling_freq; } - gr_waveform_t waveform () const { return d_waveform; } - double frequency () const { return d_frequency; } - double amplitude () const { return d_ampl; } - @TYPE@ offset () const { return d_offset; } - - // MANIPULATORS - void set_sampling_freq (double sampling_freq); - void set_waveform (gr_waveform_t waveform); - void set_frequency (double frequency); - void set_amplitude (double ampl); - void set_offset (@TYPE@ offset); -}; - -GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset = 0); - - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t deleted file mode 100644 index 7bd85fcb81..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_X.i.t +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 3, 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@NAME@_sptr -gr_make_@BASE_NAME@ (double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset = 0); - - -class @NAME@ : public gr_sync_block { - private: - @NAME@ (double sampling_freq, gr_waveform_t waveform, - double wave_freq, double ampl, @TYPE@ offset); - - public: - - // ACCESSORS - double sampling_freq () const { return d_sampling_freq; } - gr_waveform_t waveform () const { return d_waveform; } - double frequency () const { return d_frequency; } - double amplitude () const { return d_ampl; } - @TYPE@ offset () const { return d_offset; } - - // MANIPULATORS - void set_sampling_freq (double sampling_freq); - void set_waveform (gr_waveform_t waveform); - void set_frequency (double frequency); - void set_amplitude (double ampl); - void set_offset (@TYPE@ offset); -}; diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h b/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h deleted file mode 100644 index 9fe233ba4a..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 3, 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_SIG_SOURCE_WAVEFORM_H -#define INCLUDED_GR_SIG_SOURCE_WAVEFORM_H - -typedef enum { - GR_CONST_WAVE = 100, GR_SIN_WAVE, GR_COS_WAVE, GR_SQR_WAVE, GR_TRI_WAVE, GR_SAW_WAVE -} gr_waveform_t; - -#endif /* INCLUDED_GR_SIG_SOURCE_WAVEFORM_H */ diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc index 4fa0a03232..d6b1065e32 100644 --- a/gnuradio-core/src/lib/runtime/qa_block_tags.cc +++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc @@ -33,7 +33,7 @@ #include <gr_annotator_1to1.h> #include <gr_keep_one_in_n.h> #include <gr_firdes.h> -#include <gruel/pmt.h> +#include <gr_tags.h> // ---------------------------------------------------------------- diff --git a/gnuradio-core/src/python/build_utils.py b/gnuradio-core/src/python/build_utils.py index cbf991aa56..cf58a97637 100644 --- a/gnuradio-core/src/python/build_utils.py +++ b/gnuradio-core/src/python/build_utils.py @@ -212,7 +212,7 @@ def standard_impl_dict2 (name, code3, package): d = {} d['NAME'] = name d['IMPL_NAME'] = name - d['BASE_NAME'] = name.rstrip("_impl") + d['BASE_NAME'] = name.rstrip("impl").rstrip("_") d['GUARD_NAME'] = 'INCLUDED_%s_%s_H' % (package.upper(), name.upper()) d['WARNING'] = 'WARNING: this file is machine generated. Edits will be overwritten' d['COPYRIGHT'] = copyright diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt index b8ec6c88c4..dae287ca3a 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt +++ b/gnuradio-core/src/python/gnuradio/blks2impl/CMakeLists.txt @@ -21,19 +21,9 @@ include(GrPython) GR_PYTHON_INSTALL(FILES __init__.py - am_demod.py filterbank.py - fm_demod.py - fm_emph.py - nbfm_rx.py - nbfm_tx.py rational_resampler.py - standard_squelch.py stream_to_vector_decimator.py - wfm_rcv.py - wfm_rcv_fmdet.py - wfm_rcv_pll.py - wfm_tx.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/blks2impl COMPONENT "core_python" ) diff --git a/gnuradio-core/src/python/gnuradio/gr/__init__.py b/gnuradio-core/src/python/gnuradio/gr/__init__.py index 525c06cf5d..3c16b3b74f 100644 --- a/gnuradio-core/src/python/gnuradio/gr/__init__.py +++ b/gnuradio-core/src/python/gnuradio/gr/__init__.py @@ -28,30 +28,11 @@ Core contents. # This is the main GNU Radio python module. # We pull the swig output and the other modules into the gnuradio.gr namespace -# Temporary workaround for ticket:181. -# Use leading underscores to avoid namespace pollution -import sys -_RTLD_GLOBAL = 0 -try: - from dl import RTLD_GLOBAL as _RTLD_GLOBAL -except ImportError: - try: - from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL - except ImportError: - pass - -if _RTLD_GLOBAL != 0: - _dlopenflags = sys.getdlopenflags() - sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) - from gnuradio_core import * from exceptions import * from hier_block2 import * from top_block import * -if _RTLD_GLOBAL != 0: - sys.setdlopenflags(_dlopenflags) # Restore original flags - # create a couple of aliases serial_to_parallel = stream_to_vector parallel_to_serial = vector_to_stream diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py deleted file mode 100755 index 122b169b7e..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 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 3, 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. -# - -from gnuradio import gr, gr_unittest -import math - -class test_sig_source (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_const_f (self): - tb = self.tb - expected_result = (1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5) - src1 = gr.sig_source_f (1e6, gr.GR_CONST_WAVE, 0, 1.5) - op = gr.head (gr.sizeof_float, 10) - dst1 = gr.vector_sink_f () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_const_i (self): - tb = self.tb - expected_result = (1, 1, 1, 1) - src1 = gr.sig_source_i (1e6, gr.GR_CONST_WAVE, 0, 1) - op = gr.head (gr.sizeof_int, 4) - dst1 = gr.vector_sink_i () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_sine_f (self): - tb = self.tb - sqrt2 = math.sqrt(2) / 2 - expected_result = (0, sqrt2, 1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0) - src1 = gr.sig_source_f (8, gr.GR_SIN_WAVE, 1.0, 1.0) - op = gr.head (gr.sizeof_float, 9) - dst1 = gr.vector_sink_f () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5) - - def test_cosine_f (self): - tb = self.tb - sqrt2 = math.sqrt(2) / 2 - expected_result = (1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0, sqrt2, 1) - src1 = gr.sig_source_f (8, gr.GR_COS_WAVE, 1.0, 1.0) - op = gr.head (gr.sizeof_float, 9) - dst1 = gr.vector_sink_f () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5) - - def test_sqr_c (self): - tb = self.tb #arg6 is a bit before -PI/2 - expected_result = (1j, 1j, 0, 0, 1, 1, 1+0j, 1+1j, 1j) - src1 = gr.sig_source_c (8, gr.GR_SQR_WAVE, 1.0, 1.0) - op = gr.head (gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_tri_c (self): - tb = self.tb - expected_result = (1+.5j, .75+.75j, .5+1j, .25+.75j, 0+.5j, .25+.25j, .5+0j, .75+.25j, 1+.5j) - src1 = gr.sig_source_c (8, gr.GR_TRI_WAVE, 1.0, 1.0) - op = gr.head (gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) - - def test_saw_c (self): - tb = self.tb - expected_result = (.5+.25j, .625+.375j, .75+.5j, .875+.625j, 0+.75j, .125+.875j, .25+1j, .375+.125j, .5+.25j) - src1 = gr.sig_source_c (8, gr.GR_SAW_WAVE, 1.0, 1.0) - op = gr.head (gr.sizeof_gr_complex, 9) - dst1 = gr.vector_sink_c () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) - - def test_sqr_f (self): - tb = self.tb - expected_result = (0, 0, 0, 0, 1, 1, 1, 1, 0) - src1 = gr.sig_source_f (8, gr.GR_SQR_WAVE, 1.0, 1.0) - op = gr.head (gr.sizeof_float, 9) - dst1 = gr.vector_sink_f () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertEqual (expected_result, dst_data) - - def test_tri_f (self): - tb = self.tb - expected_result = (1, .75, .5, .25, 0, .25, .5, .75, 1) - src1 = gr.sig_source_f (8, gr.GR_TRI_WAVE, 1.0, 1.0) - op = gr.head (gr.sizeof_float, 9) - dst1 = gr.vector_sink_f () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5) - - def test_saw_f (self): - tb = self.tb - expected_result = (.5, .625, .75, .875, 0, .125, .25, .375, .5) - src1 = gr.sig_source_f (8, gr.GR_SAW_WAVE, 1.0, 1.0) - op = gr.head (gr.sizeof_float, 9) - dst1 = gr.vector_sink_f () - tb.connect (src1, op) - tb.connect (op, dst1) - tb.run () - dst_data = dst1.data () - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5) - -if __name__ == '__main__': - gr_unittest.run(test_sig_source, "test_sig_source.xml") diff --git a/gnuradio-core/src/tests/test_buffers.py b/gnuradio-core/src/tests/test_buffers.py index b867c727c6..2664c136c6 100755 --- a/gnuradio-core/src/tests/test_buffers.py +++ b/gnuradio-core/src/tests/test_buffers.py @@ -25,9 +25,14 @@ from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser -import time +import time, math import sys +def sig_source_f(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.sin(2.*math.pi*freq*x), t) + return y + # Test script to test setting up the buffers using gr_test # For very large buffers it will fail when you hit the circbuf memory limit. # On linux this limit is shmmax, it will fail when it tries to create a buffer > shmmax. @@ -60,10 +65,11 @@ class my_graph(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 + nsamples=int(sample_rate * seconds) #1 seconds - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) + data = sig_source_f(sample_rate, 350, ampl, nsamples) + src0 = gr.vector_source_f(data) - nsamples=int(sample_rate * seconds) #1 seconds # gr.test (const std::string &name=std::string("gr_test"), # int min_inputs=1, int max_inputs=1, unsigned int sizeof_input_item=1, # int min_outputs=1, int max_outputs=1, unsigned int sizeof_output_item=1, @@ -93,9 +99,8 @@ class my_graph(gr.top_block): #unsigned int history=1,unsigned int output_multiple=1,double relative_rate=1.0, #bool fixed_rate=false dst = audio.sink (sample_rate, options.audio_output) - head= gr.head(gr.sizeof_float, nsamples) - self.connect (src0,test,head,(dst, 0)) + self.connect (src0,test,(dst, 0)) if __name__ == '__main__': diff --git a/gr-analog/CMakeLists.txt b/gr-analog/CMakeLists.txt index 4769ce7ac1..8186de0fa9 100644 --- a/gr-analog/CMakeLists.txt +++ b/gr-analog/CMakeLists.txt @@ -95,6 +95,7 @@ if(ENABLE_PYTHON) add_subdirectory(python) add_subdirectory(grc) add_subdirectory(examples) + add_subdirectory(examples/tags) endif(ENABLE_PYTHON) ######################################################################## diff --git a/gr-analog/examples/CMakeLists.txt b/gr-analog/examples/CMakeLists.txt index 9476009869..f0f55b50c8 100644 --- a/gr-analog/examples/CMakeLists.txt +++ b/gr-analog/examples/CMakeLists.txt @@ -21,6 +21,7 @@ include(GrPython) # Base stuff GR_PYTHON_INSTALL(PROGRAMS + fmtest.py DESTINATION ${GR_PKG_ANALOG_EXAMPLES_DIR} COMPONENT "analog_python" ) diff --git a/gr-filter/examples/fmtest.py b/gr-analog/examples/fmtest.py index 7b7489335b..ca02ee5729 100755 --- a/gr-filter/examples/fmtest.py +++ b/gr-analog/examples/fmtest.py @@ -20,7 +20,8 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, blks2, filter +from gnuradio import gr, filter +from gnuradio import analog import sys, math, time try: @@ -44,19 +45,19 @@ class fmtx(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_float), gr.io_signature(1, 1, gr.sizeof_gr_complex)) - fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6) + fmtx = analog.nbfm_tx(audio_rate, if_rate, max_dev=5e3, tau=75e-6) # Local oscillator - lo = gr.sig_source_c (if_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - lo_freq, #frequency - 1.0, # amplitude - 0) # DC Offset - mixer = gr.multiply_cc () + lo = analog.sig_source_c(if_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + lo_freq, # frequency + 1.0, # amplitude + 0) # DC Offset + mixer = gr.multiply_cc() - self.connect (self, fmtx, (mixer, 0)) - self.connect (lo, (mixer, 1)) - self.connect (mixer, self) + self.connect(self, fmtx, (mixer, 0)) + self.connect(lo, (mixer, 1)) + self.connect(mixer, self) class fmtest(gr.top_block): def __init__(self): @@ -74,9 +75,9 @@ class fmtest(gr.top_block): self._if_rate = 4*self._N*self._audio_rate # Create a signal source and frequency modulate it - self.sum = gr.add_cc () + self.sum = gr.add_cc() for n in xrange(self._N): - sig = gr.sig_source_f(self._audio_rate, gr.GR_SIN_WAVE, freq[n], 0.5) + sig = analog.sig_source_f(self._audio_rate, analog.GR_SIN_WAVE, freq[n], 0.5) fm = fmtx(f_lo[n], self._audio_rate, self._if_rate) self.connect(sig, fm) self.connect(fm, (self.sum, n)) @@ -111,8 +112,8 @@ class fmtest(gr.top_block): self.squelch = list() self.snks = list() for i in xrange(self._M): - self.fmdet.append(blks2.nbfm_rx(self._audio_rate, self._chan_rate)) - self.squelch.append(blks2.standard_squelch(self._audio_rate*10)) + self.fmdet.append(analog.nbfm_rx(self._audio_rate, self._chan_rate)) + self.squelch.append(analog.standard_squelch(self._audio_rate*10)) self.snks.append(gr.vector_sink_f()) self.connect((self.pfb, i), self.fmdet[i], self.squelch[i], self.snks[i]) diff --git a/gr-analog/examples/tags/CMakeLists.txt b/gr-analog/examples/tags/CMakeLists.txt new file mode 100644 index 0000000000..adeb655dea --- /dev/null +++ b/gr-analog/examples/tags/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright 2012 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 3, 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. + +include(GrPython) + +GR_PYTHON_INSTALL(PROGRAMS + uhd_burst_detector.py + DESTINATION ${GR_PKG_DATA_DIR}/examples/tags + COMPONENT "core_python" +) + diff --git a/gnuradio-core/src/examples/tags/uhd_burst_detector.py b/gr-analog/examples/tags/uhd_burst_detector.py index 512fc715d7..3be0fb8c2e 100755 --- a/gnuradio-core/src/examples/tags/uhd_burst_detector.py +++ b/gr-analog/examples/tags/uhd_burst_detector.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import eng_notation from gnuradio import gr +from gnuradio import filter, analog from gnuradio import uhd from gnuradio import window from gnuradio.eng_option import eng_option @@ -49,7 +50,7 @@ class uhd_burst_detector(gr.top_block): self.uhd_src.set_gain(self.gain, 0) taps = firdes.low_pass_2(1, 1, 0.4, 0.1, 60) - self.chanfilt = gr.fir_filter_ccc(10, taps) + self.chanfilt = filter.fir_filter_ccc(10, taps) self.tagger = gr.burst_tagger(gr.sizeof_gr_complex) # Dummy signaler to collect a burst on known periods @@ -58,11 +59,11 @@ class uhd_burst_detector(gr.top_block): # Energy detector to get signal burst ## use squelch to detect energy - self.det = gr.simple_squelch_cc(self.threshold, 0.01) + self.det = analog.simple_squelch_cc(self.threshold, 0.01) ## convert to mag squared (float) self.c2m = gr.complex_to_mag_squared() ## average to debounce - self.avg = gr.single_pole_iir_filter_ff(0.01) + self.avg = filter.single_pole_iir_filter_ff(0.01) ## rescale signal for conversion to short self.scale = gr.multiply_const_ff(2**16) ## signal input uses shorts diff --git a/grc/blocks/gr_agc2_xx.xml b/gr-analog/grc/analog_agc2_xx.xml index 55b20d4e82..e57666873b 100644 --- a/grc/blocks/gr_agc2_xx.xml +++ b/gr-analog/grc/analog_agc2_xx.xml @@ -6,14 +6,14 @@ --> <block> <name>AGC2</name> - <key>gr_agc2_xx</key> - <import>from gnuradio import gr</import> - <make>gr.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $max_gain)</make> - <callback>set_attack_rate($attack_rate)</callback> - <callback>set_decay_rate($decay_rate)</callback> - <callback>set_reference($reference)</callback> - <callback>set_gain($gain)</callback> - <callback>set_max_gain($max_gain)</callback> + <key>analog_agc2_xx</key> + <import>from gnuradio import analog</import> + <make>analog.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $max_gain)</make> + <callback>set_attack_rate($attack_rate)</callback> + <callback>set_decay_rate($decay_rate)</callback> + <callback>set_reference($reference)</callback> + <callback>set_gain($gain)</callback> + <callback>set_max_gain($max_gain)</callback> <param> <name>Type</name> <key>type</key> diff --git a/grc/blocks/gr_agc_xx.xml b/gr-analog/grc/analog_agc_xx.xml index c87d239edd..46797bff9a 100644 --- a/grc/blocks/gr_agc_xx.xml +++ b/gr-analog/grc/analog_agc_xx.xml @@ -6,9 +6,13 @@ --> <block> <name>AGC</name> - <key>gr_agc_xx</key> - <import>from gnuradio import gr</import> - <make>gr.agc_$(type.fcn)($rate, $reference, $gain, $max_gain)</make> + <key>analog_agc_xx</key> + <import>from gnuradio import analog</import> + <make>analog.agc_$(type.fcn)($rate, $reference, $gain, $max_gain)</make> + <callback>set_rate($rate)</callback> + <callback>set_reference($reference)</callback> + <callback>set_gain($gain)</callback> + <callback>set_max_gain($max_gain)</callback> <param> <name>Type</name> <key>type</key> diff --git a/gr-analog/grc/analog_block_tree.xml b/gr-analog/grc/analog_block_tree.xml index a924e8cdaa..5d2ab6512b 100644 --- a/gr-analog/grc/analog_block_tree.xml +++ b/gr-analog/grc/analog_block_tree.xml @@ -27,5 +27,40 @@ ################################################### --> <cat> - <name></name> <!-- Blank for Root Name --> + <name></name> <!-- Blank for Root Name --> + <cat> + <name>Level Controls</name> + <block>analog_agc_xx</block> + <block>analog_agc2_xx</block> + <block>analog_dpll_bb</block> + <block>analog_feedforward_agc_cc</block> + <block>analog_ctcss_squelch_ff</block> + <block>analog_pwr_squelch_xx</block> + <block>analog_simple_squelch_cc</block> + <block>analog_standard_squelch</block> + <block>analog_rail_ff</block> + </cat> + <cat> + <name>Modulators</name> + <block>analog_cpfsk_bc</block> + <block>analog_frequency_modulator_fc</block> + <block>analog_phase_modulator_fc</block> + <block>analog_quadrature_demod_cf</block> + </cat> + <cat> + <name>Sources</name> + <block>analog_sig_source_x</block> + <block>analog_const_source_x</block> + <block>analog_noise_source_x</block> + </cat> + <cat> + <name>Synchronizers</name> + <block>analog_pll_carriertracking_cc</block> + <block>analog_pll_freqdet_cf</block> + <block>analog_pll_refout_cc</block> + </cat> + <cat> + <name>Probes</name> + <block>analog_probe_avg_mag_sqrd_x</block> + </cat> </cat> diff --git a/grc/blocks/const_source_x.xml b/gr-analog/grc/analog_const_source_x.xml index fe8e56ec4a..de8c306264 100644 --- a/grc/blocks/const_source_x.xml +++ b/gr-analog/grc/analog_const_source_x.xml @@ -6,9 +6,9 @@ --> <block> <name>Constant Source</name> - <key>const_source_x</key> - <import>from gnuradio import gr</import> - <make>gr.sig_source_$(type.fcn)(0, gr.GR_CONST_WAVE, 0, 0, $const)</make> + <key>analog_const_source_x</key> + <import>from gnuradio import analog</import> + <make>analog.sig_source_$(type.fcn)(0, analog.GR_CONST_WAVE, 0, 0, $const)</make> <callback>set_offset($const)</callback> <param> <name>Output Type</name> diff --git a/grc/blocks/gr_cpfsk_bc.xml b/gr-analog/grc/analog_cpfsk_bc.xml index d5549d933f..7eb85a2ecf 100644 --- a/grc/blocks/gr_cpfsk_bc.xml +++ b/gr-analog/grc/analog_cpfsk_bc.xml @@ -6,9 +6,9 @@ --> <block> <name>CPFSK</name> - <key>gr_cpfsk_bc</key> - <import>from gnuradio import gr</import> - <make>gr.cpfsk_bc($k, $amplitude, $samples_per_symbol)</make> + <key>analog_cpfsk_bc</key> + <import>from gnuradio import analog</import> + <make>analog.cpfsk_bc($k, $amplitude, $samples_per_symbol)</make> <callback>set_amplitude($amplitude)</callback> <param> <name>K</name> diff --git a/grc/blocks/gr_ctcss_squelch_ff.xml b/gr-analog/grc/analog_ctcss_squelch_ff.xml index a34c75374c..9585835e21 100644 --- a/grc/blocks/gr_ctcss_squelch_ff.xml +++ b/gr-analog/grc/analog_ctcss_squelch_ff.xml @@ -28,9 +28,9 @@ --> <block> <name>CTCSS Squelch</name> - <key>gr_ctcss_squelch_ff</key> - <import>from gnuradio import gr</import> - <make>gr.ctcss_squelch_ff($rate, $freq, $level, $len, $ramp, $gate)</make> + <key>analog_ctcss_squelch_ff</key> + <import>from gnuradio import analog</import> + <make>analog.ctcss_squelch_ff($rate, $freq, $level, $len, $ramp, $gate)</make> <callback>set_level($level)</callback> <param> <name>Sampling Rate (Hz)</name> diff --git a/grc/blocks/gr_dpll_bb.xml b/gr-analog/grc/analog_dpll_bb.xml index 044d398ff1..65a489414d 100644 --- a/grc/blocks/gr_dpll_bb.xml +++ b/gr-analog/grc/analog_dpll_bb.xml @@ -6,9 +6,10 @@ --> <block> <name>Detect Peak</name> - <key>gr_dpll_bb</key> - <import>from gnuradio import gr</import> - <make>gr.dpll_bb($period, $gain)</make> + <key>analog_dpll_bb</key> + <import>from gnuradio import analog</import> + <make>analog.dpll_bb($period, $gain)</make> + <callback>set_gain($gain)</callback> <param> <name>Period</name> <key>period</key> diff --git a/gr-analog/grc/analog_feedforward_agc_cc.xml b/gr-analog/grc/analog_feedforward_agc_cc.xml new file mode 100644 index 0000000000..66d200a847 --- /dev/null +++ b/gr-analog/grc/analog_feedforward_agc_cc.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Feed Forward AGC +################################################### + --> +<block> + <name>Feed Forward AGC</name> + <key>analog_feedforward_agc_cc</key> + <import>from gnuradio import analog</import> + <make>analog.feedforward_agc_cc($num_samples, $reference)</make> + <param> + <name>Num Samples</name> + <key>num_samples</key> + <value>1024</value> + <type>int</type> + </param> + <param> + <name>Reference</name> + <key>reference</key> + <value>1.0</value> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>complex</type> + </sink> + <source> + <name>out</name> + <type>complex</type> + </source> +</block> diff --git a/grc/blocks/gr_frequency_modulator_fc.xml b/gr-analog/grc/analog_frequency_modulator_fc.xml index d5f8fcfe35..3b6cd159a1 100644 --- a/grc/blocks/gr_frequency_modulator_fc.xml +++ b/gr-analog/grc/analog_frequency_modulator_fc.xml @@ -6,9 +6,9 @@ --> <block> <name>Frequency Mod</name> - <key>gr_frequency_modulator_fc</key> - <import>from gnuradio import gr</import> - <make>gr.frequency_modulator_fc($sensitivity)</make> + <key>analog_frequency_modulator_fc</key> + <import>from gnuradio import analog</import> + <make>analog.frequency_modulator_fc($sensitivity)</make> <callback>set_sensitivity($sensitivity)</callback> <param> <name>Sensitivity</name> diff --git a/grc/blocks/gr_noise_source_x.xml b/gr-analog/grc/analog_noise_source_x.xml index 72daaaa209..5404e78960 100644 --- a/grc/blocks/gr_noise_source_x.xml +++ b/gr-analog/grc/analog_noise_source_x.xml @@ -6,9 +6,9 @@ --> <block> <name>Noise Source</name> - <key>gr_noise_source_x</key> - <import>from gnuradio import gr</import> - <make>gr.noise_source_$(type.fcn)($noise_type, $amp, $seed)</make> + <key>analog_noise_source_x</key> + <import>from gnuradio import analog</import> + <make>analog.noise_source_$(type.fcn)($noise_type, $amp, $seed)</make> <callback>set_type($noise_type)</callback> <callback>set_amplitude($amp)</callback> <param> @@ -39,23 +39,23 @@ <param> <name>Noise Type</name> <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> + <value>analog.GR_GAUSSIAN</value> <type>int</type> <option> <name>Uniform</name> - <key>gr.GR_UNIFORM</key> + <key>analog.GR_UNIFORM</key> </option> <option> <name>Gaussian</name> - <key>gr.GR_GAUSSIAN</key> + <key>analog.GR_GAUSSIAN</key> </option> <option> <name>Laplacian</name> - <key>gr.GR_LAPLACIAN</key> + <key>analog.GR_LAPLACIAN</key> </option> <option> <name>Impulse</name> - <key>gr.GR_IMPULSE</key> + <key>analog.GR_IMPULSE</key> </option> </param> <param> diff --git a/grc/blocks/gr_phase_modulator_fc.xml b/gr-analog/grc/analog_phase_modulator_fc.xml index 758c50863b..c13af769c9 100644 --- a/grc/blocks/gr_phase_modulator_fc.xml +++ b/gr-analog/grc/analog_phase_modulator_fc.xml @@ -6,9 +6,10 @@ --> <block> <name>Phase Mod</name> - <key>gr_phase_modulator_fc</key> - <import>from gnuradio import gr</import> - <make>gr.phase_modulator_fc($sensitivity)</make> + <key>analog_phase_modulator_fc</key> + <import>from gnuradio import analog</import> + <make>analog.phase_modulator_fc($sensitivity)</make> + <callback>set_sensitivity($sensitivity)</callback> <param> <name>Sensitivity</name> <key>sensitivity</key> diff --git a/grc/blocks/gr_pll_carriertracking_cc.xml b/gr-analog/grc/analog_pll_carriertracking_cc.xml index 27e6732482..95ec4b415b 100644 --- a/grc/blocks/gr_pll_carriertracking_cc.xml +++ b/gr-analog/grc/analog_pll_carriertracking_cc.xml @@ -6,10 +6,12 @@ --> <block> <name>PLL Carrier Tracking</name> - <key>gr_pll_carriertracking_cc</key> - <import>from gnuradio import gr</import> - <make>gr.pll_carriertracking_cc($w, $max_freq, $min_freq)</make> + <key>analog_pll_carriertracking_cc</key> + <import>from gnuradio import analog</import> + <make>analog.pll_carriertracking_cc($w, $max_freq, $min_freq)</make> <callback>set_loop_bandwidth($w)</callback> + <callback>set_max_freq($max_freq)</callback> + <callback>set_min_freq($min_freq)</callback> <param> <name>Loop Bandwidth</name> <key>w</key> diff --git a/grc/blocks/gr_pll_freqdet_cf.xml b/gr-analog/grc/analog_pll_freqdet_cf.xml index d6e4694f00..0d44c160bd 100644 --- a/grc/blocks/gr_pll_freqdet_cf.xml +++ b/gr-analog/grc/analog_pll_freqdet_cf.xml @@ -6,10 +6,12 @@ --> <block> <name>PLL Freq Det</name> - <key>gr_pll_freqdet_cf</key> - <import>from gnuradio import gr</import> - <make>gr.pll_freqdet_cf($w, $max_freq, $min_freq)</make> + <key>analog_pll_freqdet_cf</key> + <import>from gnuradio import analog</import> + <make>analog.pll_freqdet_cf($w, $max_freq, $min_freq)</make> <callback>set_loop_bandwidth($w)</callback> + <callback>set_max_freq($max_freq)</callback> + <callback>set_min_freq($min_freq)</callback> <param> <name>Loop Bandwidth</name> <key>w</key> diff --git a/grc/blocks/gr_pll_refout_cc.xml b/gr-analog/grc/analog_pll_refout_cc.xml index b231ddd19a..eb2d752b27 100644 --- a/grc/blocks/gr_pll_refout_cc.xml +++ b/gr-analog/grc/analog_pll_refout_cc.xml @@ -6,10 +6,12 @@ --> <block> <name>PLL Ref Out</name> - <key>gr_pll_refout_cc</key> - <import>from gnuradio import gr</import> - <make>gr.pll_refout_cc($w, $max_freq, $min_freq)</make> + <key>analog_pll_refout_cc</key> + <import>from gnuradio import analog</import> + <make>analog.pll_refout_cc($w, $max_freq, $min_freq)</make> <callback>set_loop_bandwidth($w)</callback> + <callback>set_max_freq($max_freq)</callback> + <callback>set_min_freq($min_freq)</callback> <param> <name>Loop Bandwidth</name> <key>w</key> diff --git a/grc/blocks/gr_probe_avg_mag_sqrd_x.xml b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml index 6bf706ae1c..b05ac6d0d1 100644 --- a/grc/blocks/gr_probe_avg_mag_sqrd_x.xml +++ b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml @@ -6,9 +6,9 @@ --> <block> <name>Probe Avg Mag^2</name> - <key>gr_probe_avg_mag_sqrd_x</key> - <import>from gnuradio import gr</import> - <make>gr.probe_avg_mag_sqrd_$(type)($threshold, $alpha)</make> + <key>analog_probe_avg_mag_sqrd_x</key> + <import>from gnuradio import analog</import> + <make>analog.probe_avg_mag_sqrd_$(type)($threshold, $alpha)</make> <callback>set_alpha($alpha)</callback> <callback>set_threshold($threshold)</callback> <param> diff --git a/grc/blocks/gr_pwr_squelch_xx.xml b/gr-analog/grc/analog_pwr_squelch_xx.xml index 08d6211770..32d9c0e947 100644 --- a/grc/blocks/gr_pwr_squelch_xx.xml +++ b/gr-analog/grc/analog_pwr_squelch_xx.xml @@ -6,9 +6,9 @@ --> <block> <name>Power Squelch</name> - <key>gr_pwr_squelch_xx</key> - <import>from gnuradio import gr</import> - <make>gr.pwr_squelch_$(type.fcn)($threshold, $alpha, $ramp, $gate)</make> + <key>analog_pwr_squelch_xx</key> + <import>from gnuradio import analog</import> + <make>analog.pwr_squelch_$(type.fcn)($threshold, $alpha, $ramp, $gate)</make> <callback>set_threshold($threshold)</callback> <callback>set_alpha($alpha)</callback> <param> diff --git a/grc/blocks/gr_quadrature_demod_cf.xml b/gr-analog/grc/analog_quadrature_demod_cf.xml index fad0b3879c..a60653135e 100644 --- a/grc/blocks/gr_quadrature_demod_cf.xml +++ b/gr-analog/grc/analog_quadrature_demod_cf.xml @@ -6,10 +6,10 @@ --> <block> <name>Quadrature Demod</name> - <key>gr_quadrature_demod_cf</key> - <import>from gnuradio import gr</import> - <make>gr.quadrature_demod_cf($gain)</make> - <callback>set_gain($gain)</callback> + <key>analog_quadrature_demod_cf</key> + <import>from gnuradio import analog</import> + <make>analog.quadrature_demod_cf($gain)</make> + <callback>set_gain($gain)</callback> <param> <name>Gain</name> <key>gain</key> diff --git a/gr-analog/grc/analog_rail_ff.xml b/gr-analog/grc/analog_rail_ff.xml new file mode 100644 index 0000000000..87dff09771 --- /dev/null +++ b/gr-analog/grc/analog_rail_ff.xml @@ -0,0 +1,54 @@ +<?xml version="1.0"?> +<!-- +# +# Copyright 2012 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 3, 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. +--> + +<!-- +################################################### +##Rail +################################################### + --> +<block> + <name>Rail</name> + <key>analog_rail_ff</key> + <import>from gnuradio import analog</import> + <make>analog.rail_ff($lo, $hi)</make> + <callback>set_lo($lo)</callback> + <callback>set_hi($hi)</callback> + <param> + <name>Low clipping</name> + <key>lo</key> + <type>real</type> + </param> + <param> + <name>Hi clipping</name> + <key>hi</key> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>float</type> + </sink> + <source> + <name>out</name> + <type>float</type> + </source> +</block> diff --git a/grc/blocks/gr_sig_source_x.xml b/gr-analog/grc/analog_sig_source_x.xml index 644cf52d0c..b2cd8ad433 100644 --- a/grc/blocks/gr_sig_source_x.xml +++ b/gr-analog/grc/analog_sig_source_x.xml @@ -6,9 +6,9 @@ --> <block> <name>Signal Source</name> - <key>gr_sig_source_x</key> - <import>from gnuradio import gr</import> - <make>gr.sig_source_$(type.fcn)($samp_rate, $waveform, $freq, $amp, $offset)</make> + <key>analog_sig_source_x</key> + <import>from gnuradio import analog</import> + <make>analog.sig_source_$(type.fcn)($samp_rate, $waveform, $freq, $amp, $offset)</make> <callback>set_sampling_freq($samp_rate)</callback> <callback>set_waveform($waveform)</callback> <callback>set_frequency($freq)</callback> @@ -52,31 +52,31 @@ <param> <name>Waveform</name> <key>waveform</key> - <value>gr.GR_COS_WAVE</value> + <value>analog.GR_COS_WAVE</value> <type>int</type> <option> <name>Constant</name> - <key>gr.GR_CONST_WAVE</key> + <key>analog.GR_CONST_WAVE</key> </option> <option> <name>Sine</name> - <key>gr.GR_SIN_WAVE</key> + <key>analog.GR_SIN_WAVE</key> </option> <option> <name>Cosine</name> - <key>gr.GR_COS_WAVE</key> + <key>analog.GR_COS_WAVE</key> </option> <option> <name>Square</name> - <key>gr.GR_SQR_WAVE</key> + <key>analog.GR_SQR_WAVE</key> </option> <option> <name>Triangle</name> - <key>gr.GR_TRI_WAVE</key> + <key>analog.GR_TRI_WAVE</key> </option> <option> <name>Saw Tooth</name> - <key>gr.GR_SAW_WAVE</key> + <key>analog.GR_SAW_WAVE</key> </option> </param> <param> diff --git a/grc/blocks/gr_simple_squelch_cc.xml b/gr-analog/grc/analog_simple_squelch_cc.xml index 5c0727f5f8..648921a149 100644 --- a/grc/blocks/gr_simple_squelch_cc.xml +++ b/gr-analog/grc/analog_simple_squelch_cc.xml @@ -6,9 +6,9 @@ --> <block> <name>Simple Squelch</name> - <key>gr_simple_squelch_cc</key> - <import>from gnuradio import gr</import> - <make>gr.simple_squelch_cc($threshold, $alpha)</make> + <key>analog_simple_squelch_cc</key> + <import>from gnuradio import analog</import> + <make>analog.simple_squelch_cc($threshold, $alpha)</make> <callback>set_threshold($threshold)</callback> <callback>set_alpha($alpha)</callback> <param> diff --git a/grc/blocks/blks2_standard_squelch.xml b/gr-analog/grc/analog_standard_squelch.xml index f0baeb6624..264c57ab56 100644 --- a/grc/blocks/blks2_standard_squelch.xml +++ b/gr-analog/grc/analog_standard_squelch.xml @@ -6,9 +6,9 @@ --> <block> <name>Standard Squelch</name> - <key>blks2_standard_squelch</key> - <import>from gnuradio import blks2</import> - <make>blks2.standard_squelch(audio_rate=$audio_rate) + <key>analog_standard_squelch</key> + <import>from gnuradio import analog</import> + <make>analog.standard_squelch(audio_rate=$audio_rate) self.$(id).set_threshold($threshold)</make> <callback>set_threshold($threshold)</callback> <param> diff --git a/gr-analog/include/analog/CMakeLists.txt b/gr-analog/include/analog/CMakeLists.txt index 0b5dd28e0d..33c4d55a79 100644 --- a/gr-analog/include/analog/CMakeLists.txt +++ b/gr-analog/include/analog/CMakeLists.txt @@ -64,7 +64,8 @@ endmacro(expand_h) ######################################################################## # Invoke macro to generate various sources ####################################################################### -#expand_h(block bf bc sf sc if ic) +expand_h(noise_source_X s i f c) +expand_h(sig_source_X s i f c) add_custom_target(analog_generated_includes DEPENDS ${generated_includes} @@ -77,6 +78,32 @@ install(FILES ${analog_generated_includes} api.h cpm.h + agc.h + agc2.h + squelch_base_ff.h + agc_cc.h + agc_ff.h + agc2_cc.h + agc2_ff.h + cpfsk_bc.h + ctcss_squelch_ff.h + dpll_bb.h + feedforward_agc_cc.h + fmdet_cf.h + frequency_modulator_fc.h + phase_modulator_fc.h + pll_carriertracking_cc.h + pll_freqdet_cf.h + pll_refout_cc.h + probe_avg_mag_sqrd_c.h + probe_avg_mag_sqrd_cf.h + probe_avg_mag_sqrd_f.h + pwr_squelch_cc.h + pwr_squelch_ff.h + quadrature_demod_cf.h + rail_ff.h + sig_source_waveform.h + simple_squelch_cc.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog COMPONENT "analog_devel" ) diff --git a/gr-analog/include/analog/agc.h b/gr-analog/include/analog/agc.h new file mode 100644 index 0000000000..92d777fa19 --- /dev/null +++ b/gr-analog/include/analog/agc.h @@ -0,0 +1,136 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_AGC_H +#define INCLUDED_ANALOG_AGC_H + +#include <analog/api.h> +#include <gr_complex.h> +#include <math.h> + +namespace gr { + namespace analog { + namespace kernel { + + /*! + * \brief high performance Automatic Gain Control class for complex signals. + * + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc_cc + { + public: + agc_cc(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0) + : _rate(rate), _reference(reference), + _gain(gain), _max_gain(max_gain) {}; + + virtual ~agc_cc() {}; + + float rate() const { return _rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_rate(float rate) { _rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + gr_complex scale(gr_complex input) + { + gr_complex output = input * _gain; + + _gain += _rate * (_reference - sqrt(output.real()*output.real() + + output.imag()*output.imag())); + if(_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(gr_complex output[], const gr_complex input[], unsigned n) + { + for(unsigned i = 0; i < n; i++) { + output[i] = scale (input[i]); + } + } + + protected: + float _rate; // adjustment rate + float _reference; // reference value + float _gain; // current gain + float _max_gain; // max allowable gain + }; + + /*! + * \brief high performance Automatic Gain Control class for float signals. + * + * Power is approximated by absolute value + */ + class ANALOG_API agc_ff + { + public: + agc_ff(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0) + : _rate(rate), _reference(reference), _gain(gain), + _max_gain(max_gain) {}; + + ~agc_ff() {}; + + float rate () const { return _rate; } + float reference () const { return _reference; } + float gain () const { return _gain; } + float max_gain () const { return _max_gain; } + + void set_rate (float rate) { _rate = rate; } + void set_reference (float reference) { _reference = reference; } + void set_gain (float gain) { _gain = gain; } + void set_max_gain (float max_gain) { _max_gain = max_gain; } + + float scale (float input) + { + float output = input * _gain; + _gain += (_reference - fabsf (output)) * _rate; + if(_max_gain > 0.0 && _gain > _max_gain) + _gain = _max_gain; + return output; + } + + void scaleN(float output[], const float input[], unsigned n) + { + for(unsigned i = 0; i < n; i++) + output[i] = scale (input[i]); + } + + protected: + float _rate; // adjustment rate + float _reference; // reference value + float _gain; // current gain + float _max_gain; // maximum gain + }; + + } /* namespace kernel */ + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC_H */ diff --git a/gr-analog/include/analog/agc2.h b/gr-analog/include/analog/agc2.h new file mode 100644 index 0000000000..75a203e9fc --- /dev/null +++ b/gr-analog/include/analog/agc2.h @@ -0,0 +1,160 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_AGC2_H +#define INCLUDED_ANALOG_AGC2_H + +#include <analog/api.h> +#include <gr_complex.h> +#include <math.h> + +namespace gr { + namespace analog { + namespace kernel { + + /*! + * \brief high performance Automatic Gain Control class + * + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc2_cc + { + public: + agc2_cc(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, float max_gain = 0.0) + : _attack_rate(attack_rate), _decay_rate(decay_rate), + _reference(reference), + _gain(gain), _max_gain(max_gain) {}; + + float decay_rate() const { return _decay_rate; } + float attack_rate() const { return _attack_rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_decay_rate(float rate) { _decay_rate = rate; } + void set_attack_rate(float rate) { _attack_rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + gr_complex scale(gr_complex input) + { + gr_complex output = input * _gain; + + float tmp = -_reference + sqrt(output.real()*output.real() + + output.imag()*output.imag()); + float rate = _decay_rate; + if((tmp) > _gain) { + rate = _attack_rate; + } + _gain -= tmp*rate; + + // Not sure about this; will blow up if _gain < 0 (happens + // when rates are too high), but is this the solution? + if(_gain < 0.0) + _gain = 10e-5; + + if(_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(gr_complex output[], const gr_complex input[], unsigned n) + { + for(unsigned i = 0; i < n; i++) + output[i] = scale (input[i]); + } + + protected: + float _attack_rate; // attack rate for fast changing signals + float _decay_rate; // decay rate for slow changing signals + float _reference; // reference value + float _gain; // current gain + float _max_gain; // max allowable gain + }; + + + class ANALOG_API agc2_ff + { + public: + agc2_ff(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, float max_gain = 0.0) + : _attack_rate(attack_rate), _decay_rate(decay_rate), + _reference(reference), + _gain(gain), _max_gain(max_gain) {}; + + float attack_rate() const { return _attack_rate; } + float decay_rate() const { return _decay_rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_attack_rate(float rate) { _attack_rate = rate; } + void set_decay_rate(float rate) { _decay_rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + float scale(float input) + { + float output = input * _gain; + + float tmp = (fabsf(output)) - _reference; + float rate = _decay_rate; + if(fabsf(tmp) > _gain) { + rate = _attack_rate; + } + _gain -= tmp*rate; + + // Not sure about this + if(_gain < 0.0) + _gain = 10e-5; + + if(_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(float output[], const float input[], unsigned n) + { + for(unsigned i = 0; i < n; i++) + output[i] = scale (input[i]); + } + + protected: + float _attack_rate; // attack_rate for fast changing signals + float _decay_rate; // decay rate for slow changing signals + float _reference; // reference value + float _gain; // current gain + float _max_gain; // maximum gain + }; + + } /* namespace kernel */ + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC2_H */ diff --git a/gr-analog/include/analog/agc2_cc.h b/gr-analog/include/analog/agc2_cc.h new file mode 100644 index 0000000000..c922ccd4da --- /dev/null +++ b/gr-analog/include/analog/agc2_cc.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_AGC2_CC_H +#define INCLUDED_ANALOG_AGC2_CC_H + +#include <analog/api.h> +#include <analog/agc2.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class + * \ingroup level_blk + * + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc2_cc : virtual public gr_sync_block + { + public: + // gr::analog::agc2_cc::sptr + typedef boost::shared_ptr<agc2_cc> sptr; + + static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + + virtual float attack_rate() const = 0; + virtual float decay_rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; + + virtual void set_attack_rate(float rate) = 0; + virtual void set_decay_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC2_CC_H */ diff --git a/gr-analog/include/analog/agc2_ff.h b/gr-analog/include/analog/agc2_ff.h new file mode 100644 index 0000000000..27dd6d92e5 --- /dev/null +++ b/gr-analog/include/analog/agc2_ff.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_AGC2_FF_H +#define INCLUDED_ANALOG_AGC2_FF_H + +#include <analog/api.h> +#include <analog/agc2.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class + * + * \ingroup level_blk + * Power is approximated by absolute value + */ + class ANALOG_API agc2_ff : virtual public gr_sync_block + { + public: + // gr::analog::agc2_ff::sptr + typedef boost::shared_ptr<agc2_ff> sptr; + + static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + + virtual float attack_rate() const = 0; + virtual float decay_rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; + + virtual void set_attack_rate(float rate) = 0; + virtual void set_decay_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC2_FF_H */ diff --git a/gr-analog/include/analog/agc_cc.h b/gr-analog/include/analog/agc_cc.h new file mode 100644 index 0000000000..b2b1a9b430 --- /dev/null +++ b/gr-analog/include/analog/agc_cc.h @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_AGC_CC_H +#define INCLUDED_ANALOG_AGC_CC_H + +#include <analog/api.h> +#include <analog/agc.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class + * \ingroup level_blk + * + * For Power the absolute value of the complex number is used. + */ + class ANALOG_API agc_cc : virtual public gr_sync_block + { + public: + // gr::analog::agc_cc::sptr + typedef boost::shared_ptr<agc_cc> sptr; + + static sptr make(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + + virtual float rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; + + virtual void set_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC_CC_H */ diff --git a/gr-analog/include/analog/agc_ff.h b/gr-analog/include/analog/agc_ff.h new file mode 100644 index 0000000000..30d1ae1fd9 --- /dev/null +++ b/gr-analog/include/analog/agc_ff.h @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_AGC_FF_H +#define INCLUDED_ANALOG_AGC_FF_H + +#include <analog/api.h> +#include <analog/agc.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief high performance Automatic Gain Control class + * \ingroup level_blk + * + * Power is approximated by absolute value + */ + class ANALOG_API agc_ff : virtual public gr_sync_block + { + public: + // gr::analog::agc_ff::sptr + typedef boost::shared_ptr<agc_ff> sptr; + + static sptr make(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + + virtual float rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; + + virtual void set_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC_FF_H */ diff --git a/gr-analog/include/analog/cpfsk_bc.h b/gr-analog/include/analog/cpfsk_bc.h new file mode 100644 index 0000000000..904730e2b5 --- /dev/null +++ b/gr-analog/include/analog/cpfsk_bc.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2012 Free Software Foundation, Inc. + * + * 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 3, 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_ANALOG_CPFSK_BC_H +#define INCLUDED_ANALOG_CPFSK_BC_H + +#include <analog/api.h> +#include <gr_sync_interpolator.h> + +namespace gr { + namespace analog { + + /*! + * \brief Perform continuous phase 2-level frequency shift keying modulation + * on an input stream of unpacked bits. + * \ingroup modulation_blk + */ + class ANALOG_API cpfsk_bc : virtual public gr_sync_interpolator + { + public: + // gr::analog::cpfsk_bc::sptr + typedef boost::shared_ptr<cpfsk_bc> sptr; + + /*! + * \brief Make a CPFSK block. + * + * \param k modulation index + * \param ampl output amplitude + * \param samples_per_sym number of output samples per input bit + */ + static sptr make(float k, float ampl, int samples_per_sym); + + virtual void set_amplitude(float amplitude) = 0; + virtual float amplitude() = 0; + virtual float freq() = 0; + virtual float phase() = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_CPFSK_BC_H */ diff --git a/gr-analog/include/analog/ctcss_squelch_ff.h b/gr-analog/include/analog/ctcss_squelch_ff.h new file mode 100644 index 0000000000..f880299173 --- /dev/null +++ b/gr-analog/include/analog/ctcss_squelch_ff.h @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_CTCSS_SQUELCH_FF_H +#define INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H + +#include <analog/api.h> +#include <analog/squelch_base_ff.h> +#include <gr_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief gate or zero output if ctcss tone not present + * \ingroup level_blk + */ + class ANALOG_API ctcss_squelch_ff : + public squelch_base_ff, virtual public gr_block + { + protected: + virtual void update_state(const float &in) = 0; + virtual bool mute() const = 0; + + public: + // gr::analog::ctcss_squelch_ff::sptr + typedef boost::shared_ptr<ctcss_squelch_ff> sptr; + + /*! + * \brief Make CTCSS tone squelch block. + */ + static sptr make(int rate, float freq, float level, + int len, int ramp, bool gate); + + virtual std::vector<float> squelch_range() const = 0; + virtual float level() const = 0; + virtual void set_level(float level) = 0; + virtual int len() const = 0; + + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H */ diff --git a/gr-analog/include/analog/dpll_bb.h b/gr-analog/include/analog/dpll_bb.h new file mode 100644 index 0000000000..78efb8fde9 --- /dev/null +++ b/gr-analog/include/analog/dpll_bb.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2012 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 3, 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_ANALOG_DPLL_BB_H +#define INCLUDED_ANALOG_DPLL_BB_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Detect the peak of a signal + * \ingroup level_blk + * + * If a peak is detected, this block outputs a 1, + * or it outputs 0's. + */ + class ANALOG_API dpll_bb : virtual public gr_sync_block + { + public: + // gr::analog::dpll_bb::sptr + typedef boost::shared_ptr<dpll_bb> sptr; + + static sptr make(float period, float gain); + + virtual void set_gain(float gain) = 0; + virtual void set_decision_threshold(float thresh) = 0; + + virtual float gain() const = 0; + virtual float freq() const = 0; + virtual float phase() const = 0; + virtual float decision_threshold() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_DPLL_BB_H */ diff --git a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i b/gr-analog/include/analog/feedforward_agc_cc.h index b160c5dfd7..9e259a4eba 100644 --- a/gnuradio-core/src/lib/general/gr_ctcss_squelch_ff.i +++ b/gr-analog/include/analog/feedforward_agc_cc.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,20 +20,29 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,ctcss_squelch_ff); +#ifndef INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_H +#define INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_H -%include gr_squelch_base_ff.i +#include <analog/api.h> +#include <gr_sync_block.h> -gr_ctcss_squelch_ff_sptr -gr_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false); +namespace gr { + namespace analog { -class gr_ctcss_squelch_ff : public gr_squelch_base_ff -{ - gr_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate); + /*! + * \brief Non-causal AGC which computes required gain based on max absolute value over nsamples + * \ingroup level_blk + */ + class ANALOG_API feedforward_agc_cc : virtual public gr_sync_block + { + public: + // gr::analog::feedforward_agc_cc::sptr + typedef boost::shared_ptr<feedforward_agc_cc> sptr; + + static sptr make(int nsamples, float reference); + }; + + } /* namespace analog */ +} /* namespace gr */ -public: - std::vector<float> squelch_range() const; - float level() const { return d_level; } - void set_level(float level) { d_level = level; } - int len() const { return d_len; } -}; +#endif /* INCLUDED_GR_FEEDFORWARD_AGC_CC_H */ diff --git a/gr-analog/include/analog/fmdet_cf.h b/gr-analog/include/analog/fmdet_cf.h new file mode 100644 index 0000000000..6878775e6c --- /dev/null +++ b/gr-analog/include/analog/fmdet_cf.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2012 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 3, 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_ANALOG_FMDET_CF_H +#define INCLUDED_ANALOG_FMDET_CF_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Implements an IQ slope detector + * + * input: stream of complex; output: stream of floats + * + * This implements a limiting slope detector. The limiter is in + * the normalization by the magnitude of the sample + */ + class ANALOG_API fmdet_cf : virtual public gr_sync_block + { + public: + // gr::analog::fmdet_cf::sptr + typedef boost::shared_ptr<fmdet_cf> sptr; + + /*! + * \brief Make FM detector block. + * + * \param samplerate sample rate of signal (is not used; to be removed) + * \param freq_low lowest frequency of signal (Hz) + * \param freq_high highest frequency of signal (Hz) + * \param scl scale factor + */ + static sptr make(float samplerate, float freq_low, + float freq_high, float scl); + + virtual void set_scale(float scl) = 0; + virtual void set_freq_range(float freq_low, float freq_high) = 0; + + virtual float freq() const = 0; + virtual float freq_high() const = 0; + virtual float freq_low() const = 0; + virtual float scale() const = 0; + virtual float bias() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_FMDET_CF_H */ diff --git a/gr-analog/include/analog/frequency_modulator_fc.h b/gr-analog/include/analog/frequency_modulator_fc.h new file mode 100644 index 0000000000..b163bac94d --- /dev/null +++ b/gr-analog/include/analog/frequency_modulator_fc.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 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 3, 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_ANALOOG_FREQUENCY_MODULATOR_FC_H +#define INCLUDED_ANALOOG_FREQUENCY_MODULATOR_FC_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Frequency modulator block + * \ingroup modulation_blk + * + * float input; complex baseband output + */ + class ANALOG_API frequency_modulator_fc : virtual public gr_sync_block + { + public: + // gr::analog::frequency_modulator_fc::sptr + typedef boost::shared_ptr<frequency_modulator_fc> sptr; + + static sptr make(double sensitivity); + + virtual void set_sensitivity(float sens) = 0; + virtual float sensitivity() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H */ diff --git a/gr-analog/include/analog/noise_source_X.h.t b/gr-analog/include/analog/noise_source_X.h.t new file mode 100644 index 0000000000..9d1be6fedf --- /dev/null +++ b/gr-analog/include/analog/noise_source_X.h.t @@ -0,0 +1,68 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 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 3, 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. + */ + +// @WARNING@ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <analog/api.h> +#include <analog/noise_type.h> +#include <gr_sync_block.h> +#include <gr_random.h> + +namespace gr { + namespace analog { + + /*! + * \brief Random number source + * \ingroup source_blk + * + * \details + * Generate random values from different distributions. + * Currently, only Gaussian and uniform are enabled. + */ + class ANALOG_API @BASE_NAME@ : virtual public gr_sync_block + { + public: + // gr::analog::@BASE_NAME@::sptr + typedef boost::shared_ptr<@BASE_NAME@> sptr; + + /*! \brief Make a noise source + * \param type the random distribution to use (see analog/noise_type.h) + * \param ampl a scaling factor for the output + * \param seed seed for random generators. Note that for uniform and + * Gaussian distributions, this should be a negative number. + */ + static sptr make(noise_type_t type, float ampl, long seed); + + virtual void set_type(noise_type_t type) = 0; + virtual void set_amplitude(float ampl) = 0; + + virtual noise_type_t type() const = 0; + virtual float amplitude() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i b/gr-analog/include/analog/noise_type.h index 4c9168e647..c3a2146b7e 100644 --- a/gnuradio-core/src/lib/general/gr_quadrature_demod_cf.i +++ b/gr-analog/include/analog/noise_type.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,15 +20,17 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC (gr, quadrature_demod_cf) +#ifndef INCLUDED_ANALOG_NOISE_TYPE_H +#define INCLUDED_ANALOG_NOISE_TYPE_H -gr_quadrature_demod_cf_sptr gr_make_quadrature_demod_cf (float gain); +namespace gr { + namespace analog { + + typedef enum { + GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE + } noise_type_t; -class gr_quadrature_demod_cf : public gr_sync_block -{ - gr_quadrature_demod_cf (float gain); + } /* namespace analog */ +} /* namespace gr */ -public: - void set_gain(float gain) { d_gain = gain; } - float gain() const { return d_gain; } -}; +#endif /* INCLUDED_ANALOG_NOISE_TYPE_H */ diff --git a/gr-analog/include/analog/phase_modulator_fc.h b/gr-analog/include/analog/phase_modulator_fc.h new file mode 100644 index 0000000000..409de7804b --- /dev/null +++ b/gr-analog/include/analog/phase_modulator_fc.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_PHASE_MODULATOR_FC_H +#define INCLUDED_ANALOG_PHASE_MODULATOR_FC_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Phase modulator block + * \ingroup modulation_blk + * + * output = complex(cos(in*sensitivity), sin(in*sensitivity)) + * + * Input stream 0: floats + * Ouput stream 0: complex + */ + class ANALOG_API phase_modulator_fc : virtual public gr_sync_block + { + public: + // gr::analog::phase_modulator_fc::sptr + typedef boost::shared_ptr<phase_modulator_fc> sptr; + + /* \brief Make a phase modulator block. + * + * \param sensitivity Phase change sensitivity of input amplitude. + */ + static sptr make(double sensitivity); + + virtual double sensitivity() const = 0; + virtual double phase() const = 0; + + virtual void set_sensitivity(double s) = 0; + virtual void set_phase(double p) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PHASE_MODULATOR_FC_H */ diff --git a/gr-analog/include/analog/pll_carriertracking_cc.h b/gr-analog/include/analog/pll_carriertracking_cc.h new file mode 100644 index 0000000000..3596429d49 --- /dev/null +++ b/gr-analog/include/analog/pll_carriertracking_cc.h @@ -0,0 +1,88 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2011,2012 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 3, 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_ANALOG_PLL_CARRIERTRACKING_CC_H +#define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Implements a PLL which locks to the input frequency and outputs the + * input signal mixed with that carrier. + * \ingroup sync_blk + * + * Input stream 0: complex + * Output stream 0: complex + * + * This PLL locks onto a [possibly noisy] reference carrier on the + * input and outputs that signal, downconverted to DC + * + * All settings max_freq and min_freq are in terms of radians per + * sample, NOT HERTZ. The loop bandwidth determins the lock range + * and should be set around pi/200 -- 2pi/100. \sa + * pll_freqdet_cf, pll_carriertracking_cc + */ + class ANALOG_API pll_carriertracking_cc : virtual public gr_sync_block + { + public: + // gr::analog::pll_carriertracking_cc::sptr + typedef boost::shared_ptr<pll_carriertracking_cc> sptr; + + /* \brief Make a carrier tracking PLL block. + * + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. + */ + static sptr make(float loop_bw, float max_freq, float min_freq); + + virtual bool lock_detector(void) = 0; + virtual bool squelch_enable(bool) = 0; + virtual float set_lock_threshold(float) = 0; + + virtual void set_loop_bandwidth(float bw) = 0; + virtual void set_damping_factor(float df) = 0; + virtual void set_alpha(float alpha) = 0; + virtual void set_beta(float beta) = 0; + virtual void set_frequency(float freq) = 0; + virtual void set_phase(float phase) = 0; + virtual void set_min_freq(float freq) = 0; + virtual void set_max_freq(float freq) = 0; + + virtual float get_loop_bandwidth() const = 0; + virtual float get_damping_factor() const = 0; + virtual float get_alpha() const = 0; + virtual float get_beta() const = 0; + virtual float get_frequency() const = 0; + virtual float get_phase() const = 0; + virtual float get_min_freq() const = 0; + virtual float get_max_freq() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H */ diff --git a/gr-analog/include/analog/pll_freqdet_cf.h b/gr-analog/include/analog/pll_freqdet_cf.h new file mode 100644 index 0000000000..613e85263f --- /dev/null +++ b/gr-analog/include/analog/pll_freqdet_cf.h @@ -0,0 +1,83 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2011 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 3, 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_ANALOG_PLL_FREQDET_CF_H +#define INCLUDED_ANALOG_PLL_FREQDET_CF_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Implements a PLL which locks to the input frequency and outputs + * an estimate of that frequency. Useful for FM Demod. + * \ingroup sync_blk + * + * Input stream 0: complex + * Output stream 0: float + * + * This PLL locks onto a [possibly noisy] reference carrier on + * the input and outputs an estimate of that frequency in radians per sample. + * All settings max_freq and min_freq are in terms of radians per sample, + * NOT HERTZ. The loop bandwidth determins the lock range and should be set + * around pi/200 -- 2pi/100. + * \sa pll_refout_cc, pll_carriertracking_cc + */ + class ANALOG_API pll_freqdet_cf : virtual public gr_sync_block + { + public: + // gr::analog::pll_freqdet_cf::sptr + typedef boost::shared_ptr<pll_freqdet_cf> sptr; + + /* \brief Make PLL block that outputs the tracked signal's frequency. + * + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. + */ + static sptr make(float loop_bw, float max_freq, float min_freq); + + virtual void set_loop_bandwidth(float bw) = 0; + virtual void set_damping_factor(float df) = 0; + virtual void set_alpha(float alpha) = 0; + virtual void set_beta(float beta) = 0; + virtual void set_frequency(float freq) = 0; + virtual void set_phase(float phase) = 0; + virtual void set_min_freq(float freq) = 0; + virtual void set_max_freq(float freq) = 0; + + virtual float get_loop_bandwidth() const = 0; + virtual float get_damping_factor() const = 0; + virtual float get_alpha() const = 0; + virtual float get_beta() const = 0; + virtual float get_frequency() const = 0; + virtual float get_phase() const = 0; + virtual float get_min_freq() const = 0; + virtual float get_max_freq() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_FREQDET_CF_H */ diff --git a/gr-analog/include/analog/pll_refout_cc.h b/gr-analog/include/analog/pll_refout_cc.h new file mode 100644 index 0000000000..a18d177e6e --- /dev/null +++ b/gr-analog/include/analog/pll_refout_cc.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2011,2012 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 3, 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_ANALOG_PLL_REFOUT_CC_H +#define INCLUDED_ANALOG_PLL_REFOUT_CC_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Implements a PLL which locks to the input frequency and outputs a carrier + * \ingroup sync_blk + * + * Input stream 0: complex + * Output stream 0: complex + * + * This PLL locks onto a [possibly noisy] reference carrier on the + * input and outputs a clean version which is phase and frequency + * aligned to it. + * + * All settings max_freq and min_freq are in terms of radians per + * sample, NOT HERTZ. The loop bandwidth determins the lock range + * and should be set around pi/200 -- 2pi/100. \sa + * pll_freqdet_cf, pll_carriertracking_cc + */ + class ANALOG_API pll_refout_cc : virtual public gr_sync_block + { + public: + // gr::analog::pll_refout_cc::sptr + typedef boost::shared_ptr<pll_refout_cc> sptr; + + /* \brief Make PLL block that outputs the tracked carrier signal. + * + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. + */ + static sptr make(float loop_bw, float max_freq, float min_freq); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_REFOUT_CC_H */ diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_c.h b/gr-analog/include/analog/probe_avg_mag_sqrd_c.h new file mode 100644 index 0000000000..9e62732a36 --- /dev/null +++ b/gr-analog/include/analog/probe_avg_mag_sqrd_c.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_PROBE_AVG_MAG_SQRD_C_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief compute avg magnitude squared. + * \ingroup sink_blk + * + * Input stream 0: complex + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ + class ANALOG_API probe_avg_mag_sqrd_c : virtual public gr_sync_block + { + public: + // gr::analog::probe_avg_mag_sqrd_c::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_c> sptr; + + /*! + * \brief Make a complex sink that computes avg magnitude squared. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. + */ + static sptr make(double threshold_db, double alpha = 0.0001); + + virtual bool unmuted() const = 0; + virtual double level() const = 0; + virtual double threshold() const = 0; + + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H */ diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_cf.h b/gr-analog/include/analog/probe_avg_mag_sqrd_cf.h new file mode 100644 index 0000000000..b18916ae9b --- /dev/null +++ b/gr-analog/include/analog/probe_avg_mag_sqrd_cf.h @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_PROBE_AVG_MAG_SQRD_CF_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief compute avg magnitude squared. + * \ingroup sink_blk + * + * Input stream 0: complex + * Output stream 0: float + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ + class ANALOG_API probe_avg_mag_sqrd_cf : virtual public gr_sync_block + { + public: + // gr::analog::probe_avg_mag_sqrd_cf::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_cf> sptr; + + /*! + * \brief Make a block that computes avg magnitude squared. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. + */ + static sptr make(double threshold_db, double alpha = 0.0001); + + virtual bool unmuted() const = 0; + virtual double level() const = 0; + virtual double threshold() const = 0; + + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H */ diff --git a/gr-analog/include/analog/probe_avg_mag_sqrd_f.h b/gr-analog/include/analog/probe_avg_mag_sqrd_f.h new file mode 100644 index 0000000000..fe9d27793f --- /dev/null +++ b/gr-analog/include/analog/probe_avg_mag_sqrd_f.h @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 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 3, 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_ANALOG_PROBE_AVG_MAG_SQRD_F_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief compute avg magnitude squared. + * \ingroup sink_blk + * + * input stream 0: float + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ + class ANALOG_API probe_avg_mag_sqrd_f : virtual public gr_sync_block + { + public: + // gr::analog::probe_avg_mag_sqrd_f::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_f> sptr; + + /*! + * \brief Make a float sink that computes avg magnitude squared. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. + */ + static sptr make(double threshold_db, double alpha = 0.0001); + + virtual bool unmuted() const = 0; + virtual double level() const = 0; + + virtual double threshold() const = 0; + + virtual void set_alpha (double alpha) = 0; + virtual void set_threshold (double decibels) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H */ diff --git a/gr-analog/include/analog/pwr_squelch_cc.h b/gr-analog/include/analog/pwr_squelch_cc.h new file mode 100644 index 0000000000..79364a86b5 --- /dev/null +++ b/gr-analog/include/analog/pwr_squelch_cc.h @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_PWR_SQUELCH_CC_H +#define INCLUDED_ANALOG_PWR_SQUELCH_CC_H + +#include <analog/api.h> +#include <analog/squelch_base_cc.h> +#include <cmath> + +namespace gr { + namespace analog { + + /*! + * \brief gate or zero output when input power below threshold + * \ingroup level_blk + */ + class ANALOG_API pwr_squelch_cc : + public squelch_base_cc, virtual public gr_block + { + protected: + virtual void update_state(const gr_complex &in) = 0; + virtual bool mute() const = 0; + + public: + // gr::analog::pwr_squelch_cc::sptr + typedef boost::shared_ptr<pwr_squelch_cc> sptr; + + /*! + * \brief Make power-based squelch block. + * + * \param db threshold (in dB) for power squelch + * \param alpha Gain of averaging filter + * \param ramp + * \param gate + */ + static sptr make(double db, double alpha=0.0001, + int ramp=0, bool gate=false); + + virtual std::vector<float> squelch_range() const = 0; + + virtual double threshold() const = 0; + virtual void set_threshold(double db) = 0; + virtual void set_alpha(double alpha) = 0; + + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PWR_SQUELCH_CC_H */ diff --git a/gr-analog/include/analog/pwr_squelch_ff.h b/gr-analog/include/analog/pwr_squelch_ff.h new file mode 100644 index 0000000000..6fdebec746 --- /dev/null +++ b/gr-analog/include/analog/pwr_squelch_ff.h @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_PWR_SQUELCH_FF_H +#define INCLUDED_ANALOG_PWR_SQUELCH_FF_H + +#include <analog/api.h> +#include <analog/squelch_base_ff.h> +#include <cmath> + +namespace gr { + namespace analog { + + /*! + * \brief gate or zero output when input power below threshold + * \ingroup level_blk + */ + class ANALOG_API pwr_squelch_ff : + public squelch_base_ff, virtual public gr_block + { + protected: + virtual void update_state(const float &in) = 0; + virtual bool mute() const = 0; + + public: + // gr::analog::pwr_squelch_ff::sptr + typedef boost::shared_ptr<pwr_squelch_ff> sptr; + + /*! + * \brief Make power-based squelch block. + * + * \param db threshold (in dB) for power squelch + * \param alpha Gain of averaging filter + * \param ramp + * \param gate + */ + static sptr make(double db, double alpha=0.0001, + int ramp=0, bool gate=false); + + virtual std::vector<float> squelch_range() const = 0; + + virtual double threshold() const = 0; + virtual void set_threshold(double db) = 0; + virtual void set_alpha(double alpha) = 0; + + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PWR_SQUELCH_FF_H */ diff --git a/gr-analog/include/analog/quadrature_demod_cf.h b/gr-analog/include/analog/quadrature_demod_cf.h new file mode 100644 index 0000000000..916d8b2ece --- /dev/null +++ b/gr-analog/include/analog/quadrature_demod_cf.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 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 3, 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_ANALOG_QUADRATURE_DEMOD_CF_H +#define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief quadrature demodulator: complex in, float out + * \ingroup demodulation_blk + * + * This can be used to demod FM, FSK, GMSK, etc. + * The input is complex baseband. + */ + class ANALOG_API quadrature_demod_cf : virtual public gr_sync_block + { + public: + // gr::analog::quadrature_demod_cf::sptr + typedef boost::shared_ptr<quadrature_demod_cf> sptr; + + static sptr make(float gain); + + virtual void set_gain(float gain) = 0; + virtual float gain() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H */ diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i b/gr-analog/include/analog/rail_ff.h index c8cafd7aac..e51b2fc935 100644 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_cc.i +++ b/gr-analog/include/analog/rail_ff.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2009 Free Software Foundation, Inc. + * Copyright 2004,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,23 +20,35 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,pwr_squelch_cc); +#ifndef INCLUDED_ANALOG_RAIL_FF_H +#define INCLUDED_ANALOG_RAIL_FF_H -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_squelch_base_cc.i" +#include <analog/api.h> +#include <gr_sync_block.h> -gr_pwr_squelch_cc_sptr -gr_make_pwr_squelch_cc(double db, double alpha=0.0001, int ramp=0, bool gate=false); +namespace gr { + namespace analog { + + /*! + * \brief clips input values to min, max + * \ingroup misc + */ + class ANALOG_API rail_ff : virtual public gr_sync_block + { + public: + // gr::analog::rail_ff::sptr + typedef boost::shared_ptr<rail_ff> sptr; -class gr_pwr_squelch_cc : public gr_squelch_base_cc -{ -private: - gr_pwr_squelch_cc(double db, double alpha, int ramp, bool gate); + static sptr make(float lo, float hi); -public: - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } - std::vector<float> squelch_range() const; -}; + virtual float lo() const = 0; + virtual float hi() const = 0; + + virtual void set_lo(float lo) = 0; + virtual void set_hi(float hi) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_RAIL_FF_H */ diff --git a/gr-analog/include/analog/sig_source_X.h.t b/gr-analog/include/analog/sig_source_X.h.t new file mode 100644 index 0000000000..2915c2abe9 --- /dev/null +++ b/gr-analog/include/analog/sig_source_X.h.t @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 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 3, 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. + */ + +/* @WARNING@ */ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <analog/api.h> +#include <analog/sig_source_waveform.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief signal generator with @TYPE@ output. + * \ingroup source_blk + */ + class ANALOG_API @BASE_NAME@ : virtual public gr_sync_block + { + public: + // gr::analog::@BASE_NAME@::sptr + typedef boost::shared_ptr<@BASE_NAME@> sptr; + + /*! + * \brief Make a signal source block. + * + * \param sampling_freq Sampling rate of signal. + * \param waveform wavetform type. + * \param wave_freq Frequency of waveform (relative to sampling_freq). + * \param ampl Signal amplitude. + * \param offset offset of signal. + */ + static sptr make(double sampling_freq, + gr::analog::gr_waveform_t waveform, + double wave_freq, + double ampl, @TYPE@ offset = 0); + + virtual double sampling_freq() const = 0; + virtual gr::analog::gr_waveform_t waveform() const = 0; + virtual double frequency() const = 0; + virtual double amplitude() const = 0; + virtual @TYPE@ offset() const = 0; + + virtual void set_sampling_freq(double sampling_freq) = 0; + virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0; + virtual void set_frequency(double frequency) = 0; + virtual void set_amplitude(double ampl) = 0; + virtual void set_offset(@TYPE@ offset) = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/general/gr_agc_ff.i b/gr-analog/include/analog/sig_source_waveform.h index 03c571e1a4..3a9edb8f37 100644 --- a/gnuradio-core/src/lib/general/gr_agc_ff.i +++ b/gr-analog/include/analog/sig_source_waveform.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2006 Free Software Foundation, Inc. + * Copyright 2004,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,15 +20,22 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,agc_ff) +#ifndef INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H +#define INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H -%include <gri_agc_ff.i> +namespace gr { + namespace analog { -gr_agc_ff_sptr -gr_make_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); + typedef enum { + GR_CONST_WAVE = 100, + GR_SIN_WAVE, + GR_COS_WAVE, + GR_SQR_WAVE, + GR_TRI_WAVE, + GR_SAW_WAVE + } gr_waveform_t; -class gr_agc_ff : public gr_sync_block , public gri_agc_ff -{ - gr_agc_ff (float rate, float reference, float gain, float max_gain); -}; + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H */ diff --git a/gr-analog/include/analog/simple_squelch_cc.h b/gr-analog/include/analog/simple_squelch_cc.h new file mode 100644 index 0000000000..1e12646e4e --- /dev/null +++ b/gr-analog/include/analog/simple_squelch_cc.h @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 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 3, 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_ANALOG_SIMPLE_SQUELCH_CC_H +#define INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief simple squelch block based on average signal power and threshold in dB. + * \ingroup level_blk + */ + class ANALOG_API simple_squelch_cc : virtual public gr_sync_block + { + public: + // gr::analog::simple_squelch_cc::sptr + typedef boost::shared_ptr<simple_squelch_cc> sptr; + + /*! + * \brief Make a simple squelch block. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. + */ + static sptr make(double threshold_db, double alpha); + + virtual bool unmuted() const = 0; + + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + + virtual double threshold() const = 0; + virtual std::vector<float> squelch_range() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H */ diff --git a/gnuradio-core/src/lib/general/gri_agc_cc.i b/gr-analog/include/analog/sincos.h index d3dd9b61bc..38b9d96da0 100644 --- a/gnuradio-core/src/lib/general/gri_agc_cc.i +++ b/gr-analog/include/analog/sincos.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2002,2004,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,22 +20,19 @@ * Boston, MA 02110-1301, USA. */ -#include <math.h> +#ifndef INCLUDED_ANALOG_SINCOS_H +#define INCLUDED_ANALOG_SINCOS_H -/*! - * \brief high performance Automatic Gain Control class - * - * For Power the absolute value of the complex number is used. - */ +#include <analog/api.h> + +namespace gr { + namespace analog { + // compute sine and cosine at the same time + ANALOG_API void sincos(double x, double *sin, double *cos); + ANALOG_API void sincosf(float x, float *sin, float *cos); -class gri_agc_cc { + } /* namespace analog */ +} /* namespace gr */ - public: - gri_agc_cc (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); - float rate (); - float reference (); - float gain (); - float max_gain (); - }; +#endif /* INCLUDED_ANALOG_SINCOS_H */ diff --git a/gr-analog/include/analog/squelch_base_cc.h b/gr-analog/include/analog/squelch_base_cc.h new file mode 100644 index 0000000000..11476e7e88 --- /dev/null +++ b/gr-analog/include/analog/squelch_base_cc.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_SQUELCH_BASE_CC_H +#define INCLUDED_ANALOG_SQUELCH_BASE_CC_H + +#include <analog/api.h> +#include <gr_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief basic squelch block; to be subclassed for other squelches. + * \ingroup level_blk + */ + class ANALOG_API squelch_base_cc : virtual public gr_block + { + protected: + virtual void update_state(const gr_complex &sample) = 0; + virtual bool mute() const = 0; + + public: + squelch_base_cc() {}; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + + virtual std::vector<float> squelch_range() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SQUELCH_BASE_CC_H */ diff --git a/gr-analog/include/analog/squelch_base_ff.h b/gr-analog/include/analog/squelch_base_ff.h new file mode 100644 index 0000000000..2ce1f1a65a --- /dev/null +++ b/gr-analog/include/analog/squelch_base_ff.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_SQUELCH_BASE_FF_H +#define INCLUDED_ANALOG_SQUELCH_BASE_FF_H + +#include <analog/api.h> +#include <gr_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief basic squelch block; to be subclassed for other squelches. + * \ingroup level_blk + */ + class ANALOG_API squelch_base_ff : virtual public gr_block + { + protected: + virtual void update_state(const float &sample) = 0; + virtual bool mute() const = 0; + + public: + squelch_base_ff() {}; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + + virtual std::vector<float> squelch_range() const = 0; + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SQUELCH_BASE_FF_H */ diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index f18c84274d..04a8645417 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -27,6 +27,8 @@ include_directories( ${GR_FFT_INCLUDE_DIRS} ${GR_FILTER_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/../include + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} ) include_directories(${Boost_INCLUDE_DIRS}) @@ -96,7 +98,8 @@ endmacro(expand_cc) ######################################################################## # Invoke macro to generate various sources ######################################################################## -#expand_cc(block bf bc sf sc if ic) +expand_cc(noise_source_X_impl s i f c) +expand_cc(sig_source_X_impl s i f c) ######################################################################## # Setup library @@ -104,6 +107,31 @@ endmacro(expand_cc) list(APPEND analog_sources ${generated_sources} cpm.cc + squelch_base_cc_impl.cc + squelch_base_ff_impl.cc + agc_cc_impl.cc + agc_ff_impl.cc + agc2_cc_impl.cc + agc2_ff_impl.cc + cpfsk_bc_impl.cc + ctcss_squelch_ff_impl.cc + dpll_bb_impl.cc + feedforward_agc_cc_impl.cc + fmdet_cf_impl.cc + frequency_modulator_fc_impl.cc + phase_modulator_fc_impl.cc + pll_carriertracking_cc_impl.cc + pll_freqdet_cf_impl.cc + pll_refout_cc_impl.cc + probe_avg_mag_sqrd_c_impl.cc + probe_avg_mag_sqrd_cf_impl.cc + probe_avg_mag_sqrd_f_impl.cc + pwr_squelch_cc_impl.cc + pwr_squelch_ff_impl.cc + quadrature_demod_cf_impl.cc + rail_ff_impl.cc + simple_squelch_cc_impl.cc + sincos.cc ) list(APPEND analog_libs @@ -117,3 +145,40 @@ add_library(gnuradio-analog SHARED ${analog_sources}) target_link_libraries(gnuradio-analog ${analog_libs}) GR_LIBRARY_FOO(gnuradio-analog RUNTIME_COMPONENT "analog_runtime" DEVEL_COMPONENT "analog_devel") add_dependencies(gnuradio-analog analog_generated_includes analog_generated_swigs gnuradio-filter) + + +######################################################################## +# QA C++ Code for gr-filter +######################################################################## +if(ENABLE_TESTING) + include(GrTest) + + include_directories(${CPPUNIT_INCLUDE_DIRS}) + link_directories(${CPPUNIT_LIBRARY_DIRS}) + + list(APPEND test_gr_analog_sources + ${CMAKE_CURRENT_SOURCE_DIR}/test_gr_analog.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_analog.cc + ${CMAKE_CURRENT_SOURCE_DIR}/qa_sincos.cc + ) + + add_executable(test-gr-analog ${test_gr_analog_sources}) + + target_link_libraries( + test-gr-analog + gnuradio-core + gnuradio-analog + ${Boost_LIBRARIES} + ${CPPUNIT_LIBRARIES} + ) + + GR_ADD_TEST(test_gr_analog test-gr-analog) +endif(ENABLE_TESTING) + +CHECK_CXX_SOURCE_COMPILES(" + #define _GNU_SOURCE + #include <math.h> + int main(){double x, sin, cos; sincos(x, &sin, &cos); return 0;} + " HAVE_SINCOS +) +GR_ADD_COND_DEF(HAVE_SINCOS) diff --git a/gr-analog/lib/agc2_cc_impl.cc b/gr-analog/lib/agc2_cc_impl.cc new file mode 100644 index 0000000000..2ef18e5ab8 --- /dev/null +++ b/gr-analog/lib/agc2_cc_impl.cc @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2010,2012 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 3, 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 "agc2_cc_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace analog { + + agc2_cc::sptr + agc2_cc::make(float attack_rate, float decay_rate, + float reference, + float gain, float max_gain) + { + return gnuradio::get_initial_sptr + (new agc2_cc_impl(attack_rate, decay_rate, + reference, gain, max_gain)); + } + + agc2_cc_impl::agc2_cc_impl(float attack_rate, float decay_rate, + float reference, + float gain, float max_gain) + : gr_sync_block("agc2_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + kernel::agc2_cc(attack_rate, decay_rate, + reference, gain, max_gain) + { + } + + agc2_cc_impl::~agc2_cc_impl() + { + } + + int + agc2_cc_impl::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]; + scaleN(out, in, noutput_items); + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/agc2_cc_impl.h b/gr-analog/lib/agc2_cc_impl.h new file mode 100644 index 0000000000..98afc668a0 --- /dev/null +++ b/gr-analog/lib/agc2_cc_impl.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_AGC2_IMPL_CC_H +#define INCLUDED_ANALOG_AGC2_IMPL_CC_H + +#include <analog/agc2_cc.h> + +namespace gr { + namespace analog { + + class agc2_cc_impl : public agc2_cc, kernel::agc2_cc + { + public: + agc2_cc_impl(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + ~agc2_cc_impl(); + + float attack_rate() const { return kernel::agc2_cc::attack_rate(); } + float decay_rate() const { return kernel::agc2_cc::decay_rate(); } + float reference() const { return kernel::agc2_cc::reference(); } + float gain() const { return kernel::agc2_cc::gain(); } + float max_gain() const { return kernel::agc2_cc::max_gain(); } + + void set_attack_rate(float rate) { kernel::agc2_cc::set_attack_rate(rate); } + void set_decay_rate(float rate) { kernel::agc2_cc::set_decay_rate(rate); } + void set_reference(float reference) { kernel::agc2_cc::set_reference(reference); } + void set_gain(float gain) { kernel::agc2_cc::set_gain(gain); } + void set_max_gain(float max_gain) { kernel::agc2_cc::set_max_gain(max_gain); } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC2_CC_IMPL_H */ diff --git a/gr-analog/lib/agc2_ff_impl.cc b/gr-analog/lib/agc2_ff_impl.cc new file mode 100644 index 0000000000..e0cdd6c44b --- /dev/null +++ b/gr-analog/lib/agc2_ff_impl.cc @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2010,2012 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 3, 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 "agc2_ff_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace analog { + + agc2_ff::sptr + agc2_ff::make(float attack_rate, float decay_rate, + float reference, + float gain, float max_gain) + { + return gnuradio::get_initial_sptr + (new agc2_ff_impl(attack_rate, decay_rate, + reference, + gain, max_gain)); + } + + agc2_ff_impl::~agc2_ff_impl() + { + } + + agc2_ff_impl::agc2_ff_impl(float attack_rate, float decay_rate, + float reference, + float gain, float max_gain) + : gr_sync_block("agc2_ff", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(float))) + , kernel::agc2_ff(attack_rate, decay_rate, + reference, gain, max_gain) + { + } + + int + agc2_ff_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float*)input_items[0]; + float *out = (float*)output_items[0]; + scaleN(out, in, noutput_items); + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/agc2_ff_impl.h b/gr-analog/lib/agc2_ff_impl.h new file mode 100644 index 0000000000..df33c8e446 --- /dev/null +++ b/gr-analog/lib/agc2_ff_impl.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_AGC2_FF_IMPL_H +#define INCLUDED_ANALOG_AGC2_FF_IMPL_H + +#include <analog/agc2_ff.h> + +namespace gr { + namespace analog { + + class agc2_ff_impl : public agc2_ff, kernel::agc2_ff + { + public: + agc2_ff_impl(float attack_rate = 1e-1, float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + ~agc2_ff_impl(); + + float attack_rate() const { return kernel::agc2_ff::attack_rate(); } + float decay_rate() const { return kernel::agc2_ff::decay_rate(); } + float reference() const { return kernel::agc2_ff::reference(); } + float gain() const { return kernel::agc2_ff::gain(); } + float max_gain() const { return kernel::agc2_ff::max_gain(); } + + void set_attack_rate(float rate) { kernel::agc2_ff::set_attack_rate(rate); } + void set_decay_rate(float rate) { kernel::agc2_ff::set_decay_rate(rate); } + void set_reference(float reference) { kernel::agc2_ff::set_reference(reference); } + void set_gain(float gain) { kernel::agc2_ff::set_gain(gain); } + void set_max_gain(float max_gain) { kernel::agc2_ff::set_max_gain(max_gain); } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC2_IMPL_FF_H */ diff --git a/gr-analog/lib/agc_cc_impl.cc b/gr-analog/lib/agc_cc_impl.cc new file mode 100644 index 0000000000..81e1f67f8d --- /dev/null +++ b/gr-analog/lib/agc_cc_impl.cc @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2010,2012 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 3, 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 "agc_cc_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace analog { + + agc_cc::sptr + agc_cc::make(float rate, float reference, + float gain, float max_gain) + { + return gnuradio::get_initial_sptr + (new agc_cc_impl(rate, reference, gain, max_gain)); + } + + agc_cc_impl::agc_cc_impl(float rate, float reference, + float gain, float max_gain) + : gr_sync_block("agc_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + kernel::agc_cc(rate, reference, gain, max_gain) + { + } + + agc_cc_impl::~agc_cc_impl() + { + } + + int + agc_cc_impl::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]; + scaleN(out, in, noutput_items); + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/agc_cc_impl.h b/gr-analog/lib/agc_cc_impl.h new file mode 100644 index 0000000000..822f46ef27 --- /dev/null +++ b/gr-analog/lib/agc_cc_impl.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_AGC_CC_IMPL_H +#define INCLUDED_ANALOG_AGC_CC_IMPL_H + +#include <analog/agc_cc.h> + +namespace gr { + namespace analog { + + class agc_cc_impl : public agc_cc, kernel::agc_cc + { + public: + agc_cc_impl(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + ~agc_cc_impl(); + + float rate() const { return kernel::agc_cc::rate(); } + float reference() const { return kernel::agc_cc::reference(); } + float gain() const { return kernel::agc_cc::gain(); } + float max_gain() const { return kernel::agc_cc::max_gain(); } + + void set_rate(float rate) { kernel::agc_cc::set_rate(rate); } + void set_reference(float reference) { kernel::agc_cc::set_reference(reference); } + void set_gain(float gain) { kernel::agc_cc::set_gain(gain); } + void set_max_gain(float max_gain) { kernel::agc_cc::set_max_gain(max_gain); } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC_CC_IMPL_H */ diff --git a/gr-analog/lib/agc_ff_impl.cc b/gr-analog/lib/agc_ff_impl.cc new file mode 100644 index 0000000000..a80b90c12d --- /dev/null +++ b/gr-analog/lib/agc_ff_impl.cc @@ -0,0 +1,64 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2010,2012 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 3, 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 "agc_ff_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace analog { + + agc_ff::sptr + agc_ff::make(float rate, float reference, float gain, float max_gain) + { + return gnuradio::get_initial_sptr + (new agc_ff_impl(rate, reference, gain, max_gain)); + } + + agc_ff_impl::agc_ff_impl(float rate, float reference, float gain, float max_gain) + : gr_sync_block("agc_ff", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(float))), + kernel::agc_ff(rate, reference, gain, max_gain) + { + } + + agc_ff_impl::~agc_ff_impl() + { + } + + int + agc_ff_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float*)input_items[0]; + float *out = (float*)output_items[0]; + scaleN(out, in, noutput_items); + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/agc_ff_impl.h b/gr-analog/lib/agc_ff_impl.h new file mode 100644 index 0000000000..e309cca1be --- /dev/null +++ b/gr-analog/lib/agc_ff_impl.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_AGC_FF_IMPL_H +#define INCLUDED_ANALOG_AGC_FF_IMPL_H + +#include <analog/agc_ff.h> + +namespace gr { + namespace analog { + + class agc_ff_impl : public agc_ff, kernel::agc_ff + { + public: + agc_ff_impl(float rate = 1e-4, float reference = 1.0, + float gain = 1.0, float max_gain = 0.0); + ~agc_ff_impl(); + + float rate() const { return kernel::agc_ff::rate(); } + float reference() const { return kernel::agc_ff::reference(); } + float gain() const { return kernel::agc_ff::gain(); } + float max_gain() const { return kernel::agc_ff::max_gain(); } + + void set_rate(float rate) { kernel::agc_ff::set_rate(rate); } + void set_reference(float reference) { kernel::agc_ff::set_reference(reference); } + void set_gain(float gain) { kernel::agc_ff::set_gain(gain); } + void set_max_gain(float max_gain) { kernel::agc_ff::set_max_gain(max_gain); } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_AGC_FF_IMPL_H */ diff --git a/gr-analog/lib/cpfsk_bc_impl.cc b/gr-analog/lib/cpfsk_bc_impl.cc new file mode 100644 index 0000000000..1b7f25f6cf --- /dev/null +++ b/gr-analog/lib/cpfsk_bc_impl.cc @@ -0,0 +1,86 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2010,2012 Free Software Foundation, Inc. + * + * 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 3, 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 "cpfsk_bc_impl.h" +#include <gr_io_signature.h> +#include <gr_expj.h> + +namespace gr { + namespace analog { + +#define M_TWOPI (2*M_PI) + + cpfsk_bc::sptr + cpfsk_bc::make(float k, float ampl, int samples_per_sym) + { + return gnuradio::get_initial_sptr + (new cpfsk_bc_impl(k, ampl, samples_per_sym)); + } + + cpfsk_bc_impl::cpfsk_bc_impl(float k, float ampl, int samples_per_sym) + : gr_sync_interpolator("cpfsk_bc", + gr_make_io_signature(1, 1, sizeof(char)), + gr_make_io_signature(1, 1, sizeof(gr_complex)), + samples_per_sym) + { + d_samples_per_sym = samples_per_sym; + d_freq = k*M_PI/samples_per_sym; + d_ampl = ampl; + d_phase = 0.0; + } + + cpfsk_bc_impl::~cpfsk_bc_impl() + { + } + + int + cpfsk_bc_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const char *in = (const char*)input_items[0]; + gr_complex *out = (gr_complex*)output_items[0]; + + for(int i = 0; i < noutput_items/d_samples_per_sym; i++) { + for(int j = 0; j < d_samples_per_sym; j++) { + if(in[i] == 1) + d_phase += d_freq; + else + d_phase -= d_freq; + + while(d_phase > M_TWOPI) + d_phase -= M_TWOPI; + while(d_phase < -M_TWOPI) + d_phase += M_TWOPI; + + *out++ = gr_expj(d_phase)*d_ampl; + } + } + + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ + diff --git a/gr-analog/lib/cpfsk_bc_impl.h b/gr-analog/lib/cpfsk_bc_impl.h new file mode 100644 index 0000000000..9f6ec2c7fe --- /dev/null +++ b/gr-analog/lib/cpfsk_bc_impl.h @@ -0,0 +1,54 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2012 Free Software Foundation, Inc. + * + * 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 3, 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_ANALOG_CPFSK_BC_IMPL_H +#define INCLUDED_ANALOG_CPFSK_BC_IMPL_H + +#include <analog/cpfsk_bc.h> + +namespace gr { + namespace analog { + + class cpfsk_bc_impl : public cpfsk_bc + { + private: + int d_samples_per_sym; // Samples per symbol, square pulse + float d_freq; // Modulation index*pi/samples_per_sym + float d_ampl; // Output amplitude + float d_phase; // Current phase + + public: + cpfsk_bc_impl(float k, float ampl, int samples_per_sym); + ~cpfsk_bc_impl(); + + void set_amplitude(float amplitude) { d_ampl = amplitude; } + float amplitude() { return d_ampl; } + float freq() { return d_freq; } + float phase() { return d_phase; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_CPFSK_BC_IMPL_H */ diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.cc b/gr-analog/lib/ctcss_squelch_ff_impl.cc new file mode 100644 index 0000000000..db49b4f6ee --- /dev/null +++ b/gr-analog/lib/ctcss_squelch_ff_impl.cc @@ -0,0 +1,130 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2010,2012 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 3, 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 "ctcss_squelch_ff_impl.h" + +namespace gr { + namespace analog { + + static float ctcss_tones[] = { + 67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8, + 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8, + 136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2, + 192.8, 203.5, 210.7, 218.1, 225.7, 233.6, 241.8, 250.3 + }; + + static int max_tone_index = 37; + + ctcss_squelch_ff::sptr + ctcss_squelch_ff::make(int rate, float freq, float level, + int len, int ramp, bool gate) + { + return gnuradio::get_initial_sptr(new ctcss_squelch_ff_impl + (rate, freq, level, len, ramp, gate)); + } + + int + ctcss_squelch_ff_impl::find_tone(float freq) + { + for(int i = 0; i <= max_tone_index; i++) + if(ctcss_tones[i] == freq) // FIXME: make almost equal + return i; + return -1; + } + + ctcss_squelch_ff_impl::ctcss_squelch_ff_impl(int rate, float freq, float level, + int len, int ramp, bool gate) + : gr_block("ctcss_squelch_ff", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(float))), + squelch_base_ff_impl("ctcss_squelch_ff", ramp, gate) + { + d_freq = freq; + d_level = level; + + // Default is 100 ms detection time + if(len == 0) + d_len = (int)(rate/10.0); + else + d_len = len; + + int i = find_tone(freq); + + // Non-standard tones or edge tones get 2% guard band, otherwise + // guards are set at adjacent ctcss tone frequencies + float f_l, f_r; + if(i == -1 || i == 0) + f_l = freq*0.98; + else + f_l = ctcss_tones[i-1]; + + if(i == -1 || i == max_tone_index) + f_r = freq*1.02; + else + f_r = ctcss_tones[i+1]; + + d_goertzel_l = fft::goertzel(rate, d_len, f_l); + d_goertzel_c = fft::goertzel(rate, d_len, freq); + d_goertzel_r = fft::goertzel(rate, d_len, f_r); + + d_mute = true; + } + + ctcss_squelch_ff_impl::~ctcss_squelch_ff_impl() + { + } + + std::vector<float> + ctcss_squelch_ff_impl::squelch_range() const + { + std::vector<float> r(3); + r[0] = 0.0; + r[1] = 1.0; + r[2] = (r[1]-r[0])/100; // step size + + return r; + } + + void + ctcss_squelch_ff_impl::update_state(const float &in) + { + d_goertzel_l.input(in); + d_goertzel_c.input(in); + d_goertzel_r.input(in); + + float d_out_l, d_out_c, d_out_r; + if(d_goertzel_c.ready()) { + d_out_l = abs(d_goertzel_l.output()); + d_out_c = abs(d_goertzel_c.output()); + d_out_r = abs(d_goertzel_r.output()); + + //printf("d_out_l=%f d_out_c=%f d_out_r=%f\n", d_out_l, d_out_c, d_out_r); + d_mute = (d_out_c < d_level || d_out_c < d_out_l || d_out_c < d_out_r); + } + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/ctcss_squelch_ff_impl.h b/gr-analog/lib/ctcss_squelch_ff_impl.h new file mode 100644 index 0000000000..0827fbafe3 --- /dev/null +++ b/gr-analog/lib/ctcss_squelch_ff_impl.h @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_CTCSS_SQUELCH_FF_IMPL_H +#define INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H + +#include <analog/ctcss_squelch_ff.h> +#include "squelch_base_ff_impl.h" +#include <fft/goertzel.h> + +namespace gr { + namespace analog { + + class ctcss_squelch_ff_impl : public ctcss_squelch_ff, squelch_base_ff_impl + { + private: + float d_freq; + float d_level; + int d_len; + bool d_mute; + + fft::goertzel d_goertzel_l; + fft::goertzel d_goertzel_c; + fft::goertzel d_goertzel_r; + + int find_tone(float freq); + + protected: + virtual void update_state(const float &in); + virtual bool mute() const { return d_mute; } + + public: + ctcss_squelch_ff_impl(int rate, float freq, float level, + int len, int ramp, bool gate); + ~ctcss_squelch_ff_impl(); + + std::vector<float> squelch_range() const; + float level() const { return d_level; } + void set_level(float level) { d_level = level; } + int len() const { return d_len; } + + int ramp() const { return squelch_base_ff_impl::ramp(); } + void set_ramp(int ramp) { squelch_base_ff_impl::set_ramp(ramp); } + bool gate() const { return squelch_base_ff_impl::gate(); } + void set_gate(bool gate) { squelch_base_ff_impl::set_gate(gate); } + bool unmuted() const { return squelch_base_ff_impl::unmuted(); } + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + return squelch_base_ff_impl::general_work(noutput_items, + ninput_items, + input_items, + output_items); + } + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_CTCSS_SQUELCH_FF_IMPL_H */ diff --git a/gr-analog/lib/dpll_bb_impl.cc b/gr-analog/lib/dpll_bb_impl.cc new file mode 100644 index 0000000000..a199b66b4e --- /dev/null +++ b/gr-analog/lib/dpll_bb_impl.cc @@ -0,0 +1,98 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2009,2010 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 3, 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 "dpll_bb_impl.h" +#include <gr_io_signature.h> +#include <cstdio> + +namespace gr { + namespace analog { + + dpll_bb::sptr + dpll_bb::make(float period, float gain) + { + return gnuradio::get_initial_sptr + (new dpll_bb_impl(period, gain)); + } + + dpll_bb_impl::dpll_bb_impl(float period, float gain) + : gr_sync_block("dpll_bb", + gr_make_io_signature(1, 1, sizeof(char)), + gr_make_io_signature(1, 1, sizeof(char))), + d_restart(0), d_pulse_phase(0) + { + d_pulse_frequency = 1.0/period; + d_gain = gain; + d_decision_threshold = 1.0 - 0.5*d_pulse_frequency; +#if 0 + fprintf(stderr,"frequency = %f period = %f gain = %f threshold = %f\n", + d_pulse_frequency, + period, + d_gain, + d_decision_threshold); +#endif + } + + dpll_bb_impl::~dpll_bb_impl() + { + } + + int + dpll_bb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const char *iptr = (const char*)input_items[0]; + char *optr = (char*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + optr[i]= 0; + if(iptr[i] == 1) { + if(d_restart == 0) { + d_pulse_phase = 1; + } + else { + if(d_pulse_phase > 0.5) + d_pulse_phase += d_gain*(1.0-d_pulse_phase); + else + d_pulse_phase -= d_gain*d_pulse_phase; + } + d_restart = 3; + } + if(d_pulse_phase > d_decision_threshold) { + d_pulse_phase -= 1.0; + if(d_restart > 0) { + d_restart -= 1; + optr[i] = 1; + } + } + d_pulse_phase += d_pulse_frequency; + } + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/dpll_bb_impl.h b/gr-analog/lib/dpll_bb_impl.h new file mode 100644 index 0000000000..a1d8b77097 --- /dev/null +++ b/gr-analog/lib/dpll_bb_impl.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2012 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 3, 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_ANALOG_DPLL_BB_IMPL_H +#define INCLUDED_ANALOG_DPLL_BB_IMPL_H + +#include <analog/dpll_bb.h> + +namespace gr { + namespace analog { + + class dpll_bb_impl : public dpll_bb + { + private: + unsigned char d_restart; + float d_pulse_phase, d_pulse_frequency; + float d_gain, d_decision_threshold; + + public: + dpll_bb_impl(float period, float gain); + ~dpll_bb_impl(); + + void set_gain(float gain) { d_gain = gain; } + void set_decision_threshold(float thresh) { d_decision_threshold = thresh; } + + float gain() const { return d_gain; } + float freq() const { return d_pulse_frequency; } + float phase() const { return d_pulse_phase; } + float decision_threshold() const { return d_decision_threshold; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_DPLL_BB_IMPL_H */ diff --git a/gr-analog/lib/feedforward_agc_cc_impl.cc b/gr-analog/lib/feedforward_agc_cc_impl.cc new file mode 100644 index 0000000000..4796fdfc5b --- /dev/null +++ b/gr-analog/lib/feedforward_agc_cc_impl.cc @@ -0,0 +1,99 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2010,2012 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 3, 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 "feedforward_agc_cc_impl.h" +#include <gr_io_signature.h> +#include <stdexcept> + +namespace gr { + namespace analog { + + feedforward_agc_cc::sptr + feedforward_agc_cc::make(int nsamples, float reference) + { + return gnuradio::get_initial_sptr + (new feedforward_agc_cc_impl(nsamples, reference)); + } + + feedforward_agc_cc_impl::feedforward_agc_cc_impl(int nsamples, float reference) + : gr_sync_block("feedforward_agc_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + d_nsamples(nsamples), d_reference(reference) + { + if(nsamples < 1) + throw std::invalid_argument("feedforward_agc_cc_impl: nsamples must be >= 1"); + + set_history(nsamples); + } + + feedforward_agc_cc_impl::~feedforward_agc_cc_impl() + { + } + + inline static float + mag_squared(gr_complex x) + { + return x.real() * x.real() + x.imag() * x.imag(); + } + + // approximate sqrt(x^2 + y^2) + inline static float + envelope(gr_complex x) + { + float r_abs = std::fabs(x.real()); + float i_abs = std::fabs(x.imag()); + + if(r_abs > i_abs) + return r_abs + 0.4 * i_abs; + else + return i_abs + 0.4 * r_abs; + } + + int + feedforward_agc_cc_impl::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]; + int nsamples = d_nsamples; + float gain; + + for(int i = 0; i < noutput_items; i++) { + //float max_env = 1e-12; // avoid divide by zero + float max_env = 1e-4; // avoid divide by zero, indirectly set max gain + for(int j = 0; j < nsamples; j++) { + max_env = std::max(max_env, envelope(in[i+j])); + } + gain = d_reference / max_env; + out[i] = gain * in[i]; + } + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_ff.i b/gr-analog/lib/feedforward_agc_cc_impl.h index a4e5c7115c..60c7acadaf 100644 --- a/gnuradio-core/src/lib/general/gr_squelch_base_ff.i +++ b/gr-analog/lib/feedforward_agc_cc_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,21 +20,30 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_block.h> +#ifndef INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_IMPL_H +#define INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_IMPL_H -class gr_squelch_base_ff : public gr_block -{ -private: - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; +#include <analog/feedforward_agc_cc.h> -public: - gr_squelch_base_ff(const char *name, int ramp, bool gate); +namespace gr { + namespace analog { - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } + class feedforward_agc_cc_impl : public feedforward_agc_cc + { + private: + int d_nsamples; + float d_reference; - virtual std::vector<float> squelch_range() const = 0; -}; + public: + feedforward_agc_cc_impl(int nsamples, float reference); + ~feedforward_agc_cc_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_FEEDFORWARD_AGC_CC_IMPL_H */ diff --git a/gr-analog/lib/fmdet_cf_impl.cc b/gr-analog/lib/fmdet_cf_impl.cc new file mode 100644 index 0000000000..d3a58966b6 --- /dev/null +++ b/gr-analog/lib/fmdet_cf_impl.cc @@ -0,0 +1,129 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2010,2012 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 3, 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 "fmdet_cf_impl.h" +#include <gr_io_signature.h> +#include <gr_math.h> + +namespace gr { + namespace analog { + +#define M_TWOPI (2*M_PI) + + fmdet_cf::sptr + fmdet_cf::make(float samplerate, float freq_low, + float freq_high, float scl) + { + return gnuradio::get_initial_sptr + (new fmdet_cf_impl(samplerate, freq_low, freq_high, scl)); + } + + fmdet_cf_impl::fmdet_cf_impl(float samplerate, float freq_low, + float freq_high, float scl) + : gr_sync_block("fmdet_cf", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(float))), + d_S1(0.1), d_S2(0.1), + d_S3(0.1), d_S4(0.1) + { + const float h[] = { 0.003118678733, -0.012139843428, 0.027270898036, + -0.051318579352, 0.090406910552, -0.162926865366, + 0.361885392563, 0.000000000000, -0.361885392563, + 0.162926865366, -0.090406910552, 0.051318579352, + -0.027270898036, 0.012139843428, -0.003118678733}; + + //std::vector<float> taps(15); + + d_freq = 0; + d_freqhi = freq_high; + d_freqlo = freq_low; + set_scale(scl); + + //for(int i = 0; i < 15; i++) { + //taps[i] = h[i]; + //} + // d_filter = gr_fir_util::create_gr_fir_ccf(taps); + } + + fmdet_cf_impl::~fmdet_cf_impl() + { + } + + void + fmdet_cf_impl::set_scale(float scl) + { + float delta = d_freqhi - d_freqlo; + d_scl = scl; + d_bias = 0.5*scl*(d_freqhi + d_freqlo) / delta; + } + + void + fmdet_cf_impl::set_freq_range(float freq_low, float freq_high) + { + d_freqhi = freq_high; + d_freqlo = freq_low; + set_scale(d_scl); + } + + int + fmdet_cf_impl::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]; + float *optr = (float*)output_items[0]; + //const gr_complex *scaleiptr = (gr_complex*)input_items[0]; + + int size = noutput_items; + + gr_complex Sdot, S0; + gr_complex S1=d_S1, S2=d_S2, S3=d_S3, S4=d_S4; + float d_8 = 8.0; + + while(size-- > 0) { + S0 = *iptr++; + + Sdot = d_scl * (-S0+d_8*S1-d_8*S1+S4); + + d_freq = (S2.real()*Sdot.imag()-S2.imag()*Sdot.real()) / + (S2.real()*S2.real()+S2.imag()*S2.imag()); + + S4 = S3; + S3 = S2; + S2 = S1; + S1 = S0; + + *optr++ = d_freq-d_bias; + } + d_S1 = S1; + d_S2 = S2; + d_S3 = S3; + d_S4 = S4; + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/fmdet_cf_impl.h b/gr-analog/lib/fmdet_cf_impl.h new file mode 100644 index 0000000000..01fce09dd2 --- /dev/null +++ b/gr-analog/lib/fmdet_cf_impl.h @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008, 2012 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 3, 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_ANALOG_FMDET_CF_IMPL_H +#define INCLUDED_ANALOG_FMDET_CF_IMPL_H + +#include <analog/fmdet_cf.h> +//#include <filter/fir_filter.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + class fmdet_cf_impl : public fmdet_cf + { + private: + gr_complex d_S1, d_S2, d_S3, d_S4; + float d_freq, d_freqlo, d_freqhi, d_scl, d_bias; + //kernel::fir_filter_ccf* d_filter; + + public: + fmdet_cf_impl(float samplerate, float freq_low, + float freq_high, float scl); + ~fmdet_cf_impl(); + + void set_scale(float scl); + void set_freq_range(float freq_low, float freq_high); + + float freq() const { return d_freq; } + float freq_high() const { return d_freqhi; } + float freq_low() const { return d_freqlo; } + float scale() const { return d_scl; } + float bias() const { return d_bias; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_FMDET_CF_IMPL_H */ diff --git a/gr-analog/lib/frequency_modulator_fc_impl.cc b/gr-analog/lib/frequency_modulator_fc_impl.cc new file mode 100644 index 0000000000..2da7ee15f1 --- /dev/null +++ b/gr-analog/lib/frequency_modulator_fc_impl.cc @@ -0,0 +1,82 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010-2012 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 3, 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 "frequency_modulator_fc_impl.h" +#include <gr_io_signature.h> +#include <gr_fxpt.h> +#include <math.h> +#include <boost/math/special_functions/trunc.hpp> + +namespace gr { + namespace analog { + + frequency_modulator_fc::sptr + frequency_modulator_fc::make(double sensitivity) + { + return gnuradio::get_initial_sptr + (new frequency_modulator_fc_impl(sensitivity)); + } + + frequency_modulator_fc_impl::frequency_modulator_fc_impl(double sensitivity) + : gr_sync_block("frequency_modulator_fc", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + d_sensitivity(sensitivity), d_phase(0) + { + } + + frequency_modulator_fc_impl::~frequency_modulator_fc_impl() + { + } + + int + frequency_modulator_fc_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float*)input_items[0]; + gr_complex *out = (gr_complex*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + d_phase = d_phase + d_sensitivity * in[i]; + + while(d_phase > (float)(M_PI)) + d_phase -= (float)(2.0 * M_PI); + while(d_phase < (float)(-M_PI)) + d_phase += (float)(2.0 * M_PI); + + float oi, oq; + + gr_int32 angle = gr_fxpt::float_to_fixed (d_phase); + gr_fxpt::sincos(angle, &oq, &oi); + out[i] = gr_complex(oi, oq); + } + + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/frequency_modulator_fc_impl.h b/gr-analog/lib/frequency_modulator_fc_impl.h new file mode 100644 index 0000000000..36512f5164 --- /dev/null +++ b/gr-analog/lib/frequency_modulator_fc_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 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 3, 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_ANALOG_FREQUENCY_MODULATOR_FC_IMPL_H +#define INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_IMPL_H + +#include <analog/frequency_modulator_fc.h> + +namespace gr { + namespace analog { + + class frequency_modulator_fc_impl : public frequency_modulator_fc + { + private: + float d_sensitivity; + float d_phase; + + public: + frequency_modulator_fc_impl(double sensitivity); + ~frequency_modulator_fc_impl(); + + void set_sensitivity(float sens) { d_sensitivity = sens; } + float sensitivity() const { return d_sensitivity; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_IMPL_H */ diff --git a/gr-analog/lib/noise_source_X_impl.cc.t b/gr-analog/lib/noise_source_X_impl.cc.t new file mode 100644 index 0000000000..35dda9c5d4 --- /dev/null +++ b/gr-analog/lib/noise_source_X_impl.cc.t @@ -0,0 +1,116 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2012 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 3, 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. + */ + +/* @WARNING@ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "@IMPL_NAME@.h" +#include <gr_io_signature.h> +#include <stdexcept> + +namespace gr { + namespace analog { + + @BASE_NAME@::sptr + @BASE_NAME@::make(noise_type_t type, float ampl, long seed) + { + return gnuradio::get_initial_sptr + (new @IMPL_NAME@(type, ampl, seed)); + } + + @IMPL_NAME@::@IMPL_NAME@(noise_type_t type, float ampl, long seed) + : gr_sync_block("@BASE_NAME@", + gr_make_io_signature(0, 0, 0), + gr_make_io_signature(1, 1, sizeof(@TYPE@))), + d_type(type), + d_ampl(ampl), + d_rng(seed) + { + } + + @IMPL_NAME@::~@IMPL_NAME@() + { + } + + int + @IMPL_NAME@::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + @TYPE@ *out = (@TYPE@*)output_items[0]; + + switch(d_type) { +#if @IS_COMPLEX@ // complex? + + case GR_UNIFORM: + for(int i = 0; i < noutput_items; i++) { + out[i] = gr_complex(d_ampl * ((d_rng.ran1() * 2.0) - 1.0), + d_ampl * ((d_rng.ran1() * 2.0) - 1.0)); + } + break; + + case GR_GAUSSIAN: + for(int i = 0; i < noutput_items; i++) { + out[i] = d_ampl * d_rng.rayleigh_complex(); + } + break; + +#else // nope... + + case GR_UNIFORM: + for(int i = 0; i < noutput_items; i++) { + out[i] = (@TYPE@)(d_ampl * ((d_rng.ran1() * 2.0) - 1.0)); + } + break; + + case GR_GAUSSIAN: + for(int i = 0; i < noutput_items; i++) { + out[i] = (@TYPE@)(d_ampl * d_rng.gasdev()); + } + break; + + case GR_LAPLACIAN: + for(int i = 0; i < noutput_items; i++) { + out[i] = (@TYPE@)(d_ampl * d_rng.laplacian()); + } + break; + + case GR_IMPULSE: // FIXME changeable impulse settings + for(int i = 0; i < noutput_items; i++) { + out[i] = (@TYPE@)(d_ampl * d_rng.impulse(9)); + } + break; +#endif + + default: + throw std::runtime_error("invalid type"); + } + + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ + diff --git a/gr-analog/lib/noise_source_X_impl.h.t b/gr-analog/lib/noise_source_X_impl.h.t new file mode 100644 index 0000000000..8bcc1dfde3 --- /dev/null +++ b/gr-analog/lib/noise_source_X_impl.h.t @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 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 3, 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. + */ + +/* @WARNING@ */ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <analog/@BASE_NAME@.h> +#include <gr_random.h> + +namespace gr { + namespace analog { + + class @IMPL_NAME@ : public @BASE_NAME@ + { + noise_type_t d_type; + float d_ampl; + gr_random d_rng; + + public: + @IMPL_NAME@(noise_type_t type, float ampl, long seed = 0); + ~@IMPL_NAME@(); + + void set_type(noise_type_t type) { d_type = type; } + void set_amplitude(float ampl) { d_ampl = ampl; } + + noise_type_t type() const { return d_type; } + float amplitude() const { return d_ampl; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace filter */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/lib/phase_modulator_fc_impl.cc b/gr-analog/lib/phase_modulator_fc_impl.cc new file mode 100644 index 0000000000..9e9e73f8ce --- /dev/null +++ b/gr-analog/lib/phase_modulator_fc_impl.cc @@ -0,0 +1,73 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2010,2012 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 3, 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 "phase_modulator_fc_impl.h" +#include <gr_io_signature.h> +#include <gr_sincos.h> +#include <math.h> + +namespace gr { + namespace analog { + + phase_modulator_fc::sptr + phase_modulator_fc::make(double sensitivity) + { + return gnuradio::get_initial_sptr + (new phase_modulator_fc_impl(sensitivity)); + } + + phase_modulator_fc_impl::phase_modulator_fc_impl(double sensitivity) + : gr_sync_block("phase_modulator_fc", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + d_sensitivity(sensitivity), d_phase(0) + { + } + + phase_modulator_fc_impl::~phase_modulator_fc_impl() + { + } + + int + phase_modulator_fc_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float*)input_items[0]; + gr_complex *out = (gr_complex*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + d_phase = d_sensitivity * in[i]; + float oi, oq; + gr_sincosf(d_phase, &oq, &oi); + out[i] = gr_complex(oi, oq); + } + + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/phase_modulator_fc_impl.h b/gr-analog/lib/phase_modulator_fc_impl.h new file mode 100644 index 0000000000..ac10bc891f --- /dev/null +++ b/gr-analog/lib/phase_modulator_fc_impl.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_PHASE_MODULATOR_FC_IMPL_H +#define INCLUDED_ANALOG_PHASE_MODULATOR_FC_IMPL_H + +#include <analog/phase_modulator_fc.h> + +namespace gr { + namespace analog { + + class phase_modulator_fc_impl : public phase_modulator_fc + { + private: + double d_sensitivity; + double d_phase; + + public: + phase_modulator_fc_impl(double sensitivity); + ~phase_modulator_fc_impl(); + + double sensitivity() const { return d_sensitivity; } + double phase() const { return d_phase; } + + void set_sensitivity(double s) { d_sensitivity = s; } + void set_phase(double p) { d_phase = p; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PHASE_MODULATOR_FC_IMPL_H */ diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc new file mode 100644 index 0000000000..c53e0f4332 --- /dev/null +++ b/gr-analog/lib/pll_carriertracking_cc_impl.cc @@ -0,0 +1,228 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2010-2012 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 3, 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 "pll_carriertracking_cc_impl.h" +#include <gr_io_signature.h> +#include <gr_sincos.h> +#include <math.h> +#include <gr_math.h> + +namespace gr { + namespace analog { + +#ifndef M_TWOPI +#define M_TWOPI (2.0f*M_PI) +#endif + + pll_carriertracking_cc::sptr + pll_carriertracking_cc::make(float loop_bw, float max_freq, float min_freq) + { + return gnuradio::get_initial_sptr + (new pll_carriertracking_cc_impl(loop_bw, max_freq, min_freq)); + } + + pll_carriertracking_cc_impl::pll_carriertracking_cc_impl(float loop_bw, + float max_freq, + float min_freq) + : gr_sync_block("pll_carriertracking_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + gri_control_loop(loop_bw, max_freq, min_freq), + d_locksig(0), d_lock_threshold(0), d_squelch_enable(false) + { + } + + pll_carriertracking_cc_impl::~pll_carriertracking_cc_impl() + { + } + + float + pll_carriertracking_cc_impl::mod_2pi(float in) + { + if(in>M_PI) + return in-M_TWOPI; + else if(in<-M_PI) + return in+M_TWOPI; + else + return in; + } + + float + pll_carriertracking_cc_impl::phase_detector(gr_complex sample, float ref_phase) + { + float sample_phase; + // sample_phase = atan2(sample.imag(),sample.real()); + sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); + return mod_2pi(sample_phase-ref_phase); + } + + bool + pll_carriertracking_cc_impl::lock_detector(void) + { + return (fabsf(d_locksig) > d_lock_threshold); + } + + bool + pll_carriertracking_cc_impl::squelch_enable(bool set_squelch) + { + return d_squelch_enable = set_squelch; + } + + float + pll_carriertracking_cc_impl::set_lock_threshold(float threshold) + { + return d_lock_threshold = threshold; + } + + int + pll_carriertracking_cc_impl::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++) { + gr_sincosf(d_phase, &t_imag, &t_real); + optr[i] = iptr[i] * gr_complex(t_real, -t_imag); + + error = phase_detector(iptr[i], d_phase); + + advance_loop(error); + phase_wrap(); + frequency_limit(); + + 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; + } + + void + pll_carriertracking_cc_impl::set_loop_bandwidth(float bw) + { + gri_control_loop::set_loop_bandwidth(bw); + } + + void + pll_carriertracking_cc_impl::set_damping_factor(float df) + { + gri_control_loop::set_damping_factor(df); + } + + void + pll_carriertracking_cc_impl::set_alpha(float alpha) + { + gri_control_loop::set_alpha(alpha); + } + + void + pll_carriertracking_cc_impl::set_beta(float beta) + { + gri_control_loop::set_beta(beta); + } + + void + pll_carriertracking_cc_impl::set_frequency(float freq) + { + gri_control_loop::set_frequency(freq); + } + + void + pll_carriertracking_cc_impl::set_phase(float phase) + { + gri_control_loop::set_phase(phase); + } + + void + pll_carriertracking_cc_impl::set_min_freq(float freq) + { + gri_control_loop::set_min_freq(freq); + } + + void + pll_carriertracking_cc_impl::set_max_freq(float freq) + { + gri_control_loop::set_max_freq(freq); + } + + + float + pll_carriertracking_cc_impl::get_loop_bandwidth() const + { + return gri_control_loop::get_loop_bandwidth(); + } + + float + pll_carriertracking_cc_impl::get_damping_factor() const + { + return gri_control_loop::get_damping_factor(); + } + + float + pll_carriertracking_cc_impl::get_alpha() const + { + return gri_control_loop::get_alpha(); + } + + float + pll_carriertracking_cc_impl::get_beta() const + { + return gri_control_loop::get_beta(); + } + + float + pll_carriertracking_cc_impl::get_frequency() const + { + return gri_control_loop::get_frequency(); + } + + float + pll_carriertracking_cc_impl::get_phase() const + { + return gri_control_loop::get_phase(); + } + + float + pll_carriertracking_cc_impl::get_min_freq() const + { + return gri_control_loop::get_min_freq(); + } + + float + pll_carriertracking_cc_impl::get_max_freq() const + { + return gri_control_loop::get_max_freq(); + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.h b/gr-analog/lib/pll_carriertracking_cc_impl.h new file mode 100644 index 0000000000..d67223db82 --- /dev/null +++ b/gr-analog/lib/pll_carriertracking_cc_impl.h @@ -0,0 +1,76 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2011,2012 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 3, 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_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H +#define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H + +#include <analog/pll_carriertracking_cc.h> +#include <gri_control_loop.h> + +namespace gr { + namespace analog { + + class pll_carriertracking_cc_impl + : public pll_carriertracking_cc, public gri_control_loop + { + private: + float d_locksig,d_lock_threshold; + bool d_squelch_enable; + + float mod_2pi(float in); + float phase_detector(gr_complex sample,float ref_phase); + + public: + pll_carriertracking_cc_impl(float loop_bw, float max_freq, float min_freq); + ~pll_carriertracking_cc_impl(); + + bool lock_detector(void); + bool squelch_enable(bool); + float set_lock_threshold(float); + + void set_loop_bandwidth(float bw); + void set_damping_factor(float df); + void set_alpha(float alpha); + void set_beta(float beta); + void set_frequency(float freq); + void set_phase(float phase); + void set_min_freq(float freq); + void set_max_freq(float freq); + + float get_loop_bandwidth() const; + float get_damping_factor() const; + float get_alpha() const; + float get_beta() const; + float get_frequency() const; + float get_phase() const; + float get_min_freq() const; + float get_max_freq() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H */ diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc new file mode 100644 index 0000000000..27e8d02aa4 --- /dev/null +++ b/gr-analog/lib/pll_freqdet_cf_impl.cc @@ -0,0 +1,198 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2011 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 3, 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 "pll_freqdet_cf_impl.h" +#include <gr_io_signature.h> +#include <math.h> +#include <gr_math.h> + +namespace gr { + namespace analog { + +#ifndef M_TWOPI +#define M_TWOPI (2.0f*M_PI) +#endif + + pll_freqdet_cf::sptr + pll_freqdet_cf::make(float loop_bw, float max_freq, float min_freq) + { + return gnuradio::get_initial_sptr + (new pll_freqdet_cf_impl(loop_bw, max_freq, min_freq)); + } + + pll_freqdet_cf_impl::pll_freqdet_cf_impl(float loop_bw, float max_freq, float min_freq) + : gr_sync_block("pll_freqdet_cf", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(float))), + gri_control_loop(loop_bw, max_freq, min_freq) + { + } + + pll_freqdet_cf_impl::~pll_freqdet_cf_impl() + { + } + + float + pll_freqdet_cf_impl::mod_2pi(float in) + { + if(in > M_PI) + return in - M_TWOPI; + else if(in < -M_PI) + return in + M_TWOPI; + else + return in; + } + + float + pll_freqdet_cf_impl::phase_detector(gr_complex sample, float ref_phase) + { + float sample_phase; + sample_phase = gr_fast_atan2f(sample.imag(), sample.real()); + return mod_2pi(sample_phase - ref_phase); + } + + int + pll_freqdet_cf_impl::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]; + float *optr = (float*)output_items[0]; + + float error; + int size = noutput_items; + + while(size-- > 0) { + *optr++ = d_freq; + + error = phase_detector(*iptr++, d_phase); + + advance_loop(error); + phase_wrap(); + frequency_limit(); + } + return noutput_items; + } + + void + pll_freqdet_cf_impl::set_loop_bandwidth(float bw) + { + gri_control_loop::set_loop_bandwidth(bw); + } + + void + pll_freqdet_cf_impl::set_damping_factor(float df) + { + gri_control_loop::set_damping_factor(df); + } + + void + pll_freqdet_cf_impl::set_alpha(float alpha) + { + gri_control_loop::set_alpha(alpha); + } + + void + pll_freqdet_cf_impl::set_beta(float beta) + { + gri_control_loop::set_beta(beta); + } + + void + pll_freqdet_cf_impl::set_frequency(float freq) + { + gri_control_loop::set_frequency(freq); + } + + void + pll_freqdet_cf_impl::set_phase(float phase) + { + gri_control_loop::set_phase(phase); + } + + void + pll_freqdet_cf_impl::set_min_freq(float freq) + { + gri_control_loop::set_min_freq(freq); + } + + void + pll_freqdet_cf_impl::set_max_freq(float freq) + { + gri_control_loop::set_max_freq(freq); + } + + + float + pll_freqdet_cf_impl::get_loop_bandwidth() const + { + return gri_control_loop::get_loop_bandwidth(); + } + + float + pll_freqdet_cf_impl::get_damping_factor() const + { + return gri_control_loop::get_damping_factor(); + } + + float + pll_freqdet_cf_impl::get_alpha() const + { + return gri_control_loop::get_alpha(); + } + + float + pll_freqdet_cf_impl::get_beta() const + { + return gri_control_loop::get_beta(); + } + + float + pll_freqdet_cf_impl::get_frequency() const + { + return gri_control_loop::get_frequency(); + } + + float + pll_freqdet_cf_impl::get_phase() const + { + return gri_control_loop::get_phase(); + } + + float + pll_freqdet_cf_impl::get_min_freq() const + { + return gri_control_loop::get_min_freq(); + } + + float + pll_freqdet_cf_impl::get_max_freq() const + { + return gri_control_loop::get_max_freq(); + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/pll_freqdet_cf_impl.h b/gr-analog/lib/pll_freqdet_cf_impl.h new file mode 100644 index 0000000000..7acf53ebbf --- /dev/null +++ b/gr-analog/lib/pll_freqdet_cf_impl.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2011,2012 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 3, 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_ANALOG_PLL_FREQDET_CF_IMPL_H +#define INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H + +#include <analog/pll_freqdet_cf.h> +#include <gri_control_loop.h> + +namespace gr { + namespace analog { + + class pll_freqdet_cf_impl : + public pll_freqdet_cf, public gri_control_loop + { + private: + float phase_detector(gr_complex sample,float ref_phase); + + public: + pll_freqdet_cf_impl(float loop_bw, float max_freq, float min_freq); + ~pll_freqdet_cf_impl(); + + float mod_2pi(float in); + + void set_loop_bandwidth(float bw); + void set_damping_factor(float df); + void set_alpha(float alpha); + void set_beta(float beta); + void set_frequency(float freq); + void set_phase(float phase); + void set_min_freq(float freq); + void set_max_freq(float freq); + + float get_loop_bandwidth() const; + float get_damping_factor() const; + float get_alpha() const; + float get_beta() const; + float get_frequency() const; + float get_phase() const; + float get_min_freq() const; + float get_max_freq() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H */ diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc new file mode 100644 index 0000000000..b94e3660a3 --- /dev/null +++ b/gr-analog/lib/pll_refout_cc_impl.cc @@ -0,0 +1,201 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010-2012 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 3, 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 "pll_refout_cc_impl.h" +#include <gr_io_signature.h> +#include <gr_sincos.h> +#include <math.h> +#include <gr_math.h> + +namespace gr { + namespace analog { + +#ifndef M_TWOPI +#define M_TWOPI (2.0f*M_PI) +#endif + + pll_refout_cc::sptr + pll_refout_cc::make(float loop_bw, float max_freq, float min_freq) + { + return gnuradio::get_initial_sptr + (new pll_refout_cc_impl(loop_bw, max_freq, min_freq)); + } + + pll_refout_cc_impl::pll_refout_cc_impl(float loop_bw, float max_freq, float min_freq) + : gr_sync_block("pll_refout_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + gri_control_loop(loop_bw, max_freq, min_freq) + { + } + + pll_refout_cc_impl::~pll_refout_cc_impl() + { + } + + float + pll_refout_cc_impl::mod_2pi(float in) + { + if(in > M_PI) + return in - M_TWOPI; + else if(in < -M_PI) + return in+ M_TWOPI; + else + return in; + } + + float + pll_refout_cc_impl::phase_detector(gr_complex sample,float ref_phase) + { + float sample_phase; + sample_phase = gr_fast_atan2f(sample.imag(),sample.real()); + return mod_2pi(sample_phase-ref_phase); + } + + int + pll_refout_cc_impl::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) { + gr_sincosf(d_phase,&t_imag,&t_real); + *optr++ = gr_complex(t_real,t_imag); + + error = phase_detector(*iptr++,d_phase); + + advance_loop(error); + phase_wrap(); + frequency_limit(); + } + return noutput_items; + } + + void + pll_refout_cc_impl::set_loop_bandwidth(float bw) + { + gri_control_loop::set_loop_bandwidth(bw); + } + + void + pll_refout_cc_impl::set_damping_factor(float df) + { + gri_control_loop::set_damping_factor(df); + } + + void + pll_refout_cc_impl::set_alpha(float alpha) + { + gri_control_loop::set_alpha(alpha); + } + + void + pll_refout_cc_impl::set_beta(float beta) + { + gri_control_loop::set_beta(beta); + } + + void + pll_refout_cc_impl::set_frequency(float freq) + { + gri_control_loop::set_frequency(freq); + } + + void + pll_refout_cc_impl::set_phase(float phase) + { + gri_control_loop::set_phase(phase); + } + + void + pll_refout_cc_impl::set_min_freq(float freq) + { + gri_control_loop::set_min_freq(freq); + } + + void + pll_refout_cc_impl::set_max_freq(float freq) + { + gri_control_loop::set_max_freq(freq); + } + + + float + pll_refout_cc_impl::get_loop_bandwidth() const + { + return gri_control_loop::get_loop_bandwidth(); + } + + float + pll_refout_cc_impl::get_damping_factor() const + { + return gri_control_loop::get_damping_factor(); + } + + float + pll_refout_cc_impl::get_alpha() const + { + return gri_control_loop::get_alpha(); + } + + float + pll_refout_cc_impl::get_beta() const + { + return gri_control_loop::get_beta(); + } + + float + pll_refout_cc_impl::get_frequency() const + { + return gri_control_loop::get_frequency(); + } + + float + pll_refout_cc_impl::get_phase() const + { + return gri_control_loop::get_phase(); + } + + float + pll_refout_cc_impl::get_min_freq() const + { + return gri_control_loop::get_min_freq(); + } + + float + pll_refout_cc_impl::get_max_freq() const + { + return gri_control_loop::get_max_freq(); + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/pll_refout_cc_impl.h b/gr-analog/lib/pll_refout_cc_impl.h new file mode 100644 index 0000000000..9e8ae286b1 --- /dev/null +++ b/gr-analog/lib/pll_refout_cc_impl.h @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2011,2012 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 3, 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_ANALOG_PLL_REFOUT_CC_IMPL_H +#define INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H + +#include <analog/pll_refout_cc.h> +#include <gri_control_loop.h> + +namespace gr { + namespace analog { + + class pll_refout_cc_impl + : public pll_refout_cc, public gri_control_loop + { + private: + float mod_2pi (float in); + float phase_detector(gr_complex sample, float ref_phase); + + public: + pll_refout_cc_impl(float loop_bw, float max_freq, float min_freq); + ~pll_refout_cc_impl(); + + void set_loop_bandwidth(float bw); + void set_damping_factor(float df); + void set_alpha(float alpha); + void set_beta(float beta); + void set_frequency(float freq); + void set_phase(float phase); + void set_min_freq(float freq); + void set_max_freq(float freq); + + float get_loop_bandwidth() const; + float get_damping_factor() const; + float get_alpha() const; + float get_beta() const; + float get_frequency() const; + float get_phase() const; + float get_min_freq() const; + float get_max_freq() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc new file mode 100644 index 0000000000..291809bb24 --- /dev/null +++ b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.cc @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2010,2012 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 3, 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 "probe_avg_mag_sqrd_c_impl.h" +#include <gr_io_signature.h> +#include <cmath> + +namespace gr { + namespace analog { + + probe_avg_mag_sqrd_c::sptr + probe_avg_mag_sqrd_c::make(double threshold_db, double alpha) + { + return gnuradio::get_initial_sptr + (new probe_avg_mag_sqrd_c_impl(threshold_db, alpha)); + } + + probe_avg_mag_sqrd_c_impl::probe_avg_mag_sqrd_c_impl(double threshold_db, double alpha) + : gr_sync_block("probe_avg_mag_sqrd_c", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(0, 0, 0)), + d_unmuted(false), d_level(0), d_iir(alpha) + { + set_threshold(threshold_db); + } + + probe_avg_mag_sqrd_c_impl::~probe_avg_mag_sqrd_c_impl() + { + } + + int + probe_avg_mag_sqrd_c_impl::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]; + + for(int i = 0; i < noutput_items; i++) { + double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); + d_iir.filter(mag_sqrd); // computed for side effect: prev_output() + } + + d_unmuted = d_iir.prev_output() >= d_threshold; + d_level = d_iir.prev_output(); + return noutput_items; + } + + double + probe_avg_mag_sqrd_c_impl::threshold() const + { + return 10 * std::log10(d_threshold); + } + + void + probe_avg_mag_sqrd_c_impl::set_threshold(double decibels) + { + // convert to absolute threshold (mag squared) + d_threshold = std::pow(10.0, decibels/10); + } + + void + probe_avg_mag_sqrd_c_impl::set_alpha(double alpha) + { + d_iir.set_taps(alpha); + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h new file mode 100644 index 0000000000..0a2685357a --- /dev/null +++ b/gr-analog/lib/probe_avg_mag_sqrd_c_impl.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_PROBE_AVG_MAG_SQRD_C_IMPL_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_IMPL_H + +#include <analog/probe_avg_mag_sqrd_c.h> +#include <filter/single_pole_iir.h> + +namespace gr { + namespace analog { + + class probe_avg_mag_sqrd_c_impl : public probe_avg_mag_sqrd_c + { + private: + double d_threshold; + bool d_unmuted; + double d_level; + filter::single_pole_iir<double,double,double> d_iir; + + public: + probe_avg_mag_sqrd_c_impl(double threshold_db, double alpha = 0.0001); + ~probe_avg_mag_sqrd_c_impl(); + + bool unmuted() const { return d_unmuted; } + double level() const { return d_level; } + + double threshold() const; + + void set_alpha(double alpha); + void set_threshold(double decibels); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_IMPL_H */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc new file mode 100644 index 0000000000..ceaf5dbf01 --- /dev/null +++ b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.cc @@ -0,0 +1,93 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2007,2010,2012 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 3, 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 "probe_avg_mag_sqrd_cf_impl.h" +#include <gr_io_signature.h> +#include <cmath> + +namespace gr { + namespace analog { + + probe_avg_mag_sqrd_cf::sptr + probe_avg_mag_sqrd_cf::make(double threshold_db, double alpha) + { + return gnuradio::get_initial_sptr + (new probe_avg_mag_sqrd_cf_impl(threshold_db, alpha)); + } + + probe_avg_mag_sqrd_cf_impl::probe_avg_mag_sqrd_cf_impl(double threshold_db, double alpha) + : gr_sync_block("probe_avg_mag_sqrd_cf", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(float))), + d_unmuted(false), d_level(0), d_iir(alpha) + { + set_threshold(threshold_db); + } + + probe_avg_mag_sqrd_cf_impl::~probe_avg_mag_sqrd_cf_impl() + { + } + + int + probe_avg_mag_sqrd_cf_impl::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]; + float *out = (float*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + out[i] = d_iir.prev_output(); + double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); + d_iir.filter(mag_sqrd); // computed for side effect: prev_output() + } + + d_unmuted = d_iir.prev_output() >= d_threshold; + d_level = d_iir.prev_output(); + return noutput_items; + } + + double + probe_avg_mag_sqrd_cf_impl::threshold() const + { + return 10 * std::log10(d_threshold); + } + + void + probe_avg_mag_sqrd_cf_impl::set_threshold(double decibels) + { + // convert to absolute threshold (mag squared) + d_threshold = std::pow(10.0, decibels/10); + } + + void + probe_avg_mag_sqrd_cf_impl::set_alpha(double alpha) + { + d_iir.set_taps(alpha); + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h new file mode 100644 index 0000000000..9cd8f8d4c3 --- /dev/null +++ b/gr-analog/lib/probe_avg_mag_sqrd_cf_impl.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2006,2012 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 3, 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_ANALOG_PROBE_AVG_MAG_SQRD_CF_IMPL_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_IMPL_H + +#include <analog/probe_avg_mag_sqrd_cf.h> +#include <filter/single_pole_iir.h> + +namespace gr { + namespace analog { + + class probe_avg_mag_sqrd_cf_impl : public probe_avg_mag_sqrd_cf + { + private: + double d_threshold; + bool d_unmuted; + double d_level; + filter::single_pole_iir<double,double,double> d_iir; + + public: + probe_avg_mag_sqrd_cf_impl(double threshold_db, double alpha); + ~probe_avg_mag_sqrd_cf_impl(); + + bool unmuted() const { return d_unmuted; } + double level() const { return d_level; } + + double threshold() const; + + void set_alpha(double alpha); + void set_threshold(double decibels); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_IMPL_H */ diff --git a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc new file mode 100644 index 0000000000..4ac7ef06bd --- /dev/null +++ b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.cc @@ -0,0 +1,92 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2010,2012 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 3, 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 "probe_avg_mag_sqrd_f_impl.h" +#include <gr_io_signature.h> +#include <cmath> + +namespace gr { + namespace analog { + + probe_avg_mag_sqrd_f::sptr + probe_avg_mag_sqrd_f::make(double threshold_db, double alpha) + { + return gnuradio::get_initial_sptr + (new probe_avg_mag_sqrd_f_impl(threshold_db, alpha)); + } + + probe_avg_mag_sqrd_f_impl::probe_avg_mag_sqrd_f_impl(double threshold_db, double alpha) + : gr_sync_block("probe_avg_mag_sqrd_f", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(0, 0, 0)), + d_unmuted(false), d_level(0), d_iir(alpha) + { + set_threshold(threshold_db); + } + + probe_avg_mag_sqrd_f_impl::~probe_avg_mag_sqrd_f_impl() + { + } + + int + probe_avg_mag_sqrd_f_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float*)input_items[0]; + + for(int i = 0; i < noutput_items; i++) { + double mag_sqrd = in[i]*in[i]; + d_iir.filter(mag_sqrd); // computed for side effect: prev_output() + } + + d_unmuted = d_iir.prev_output() >= d_threshold; + d_level = d_iir.prev_output(); + return noutput_items; + } + + double + probe_avg_mag_sqrd_f_impl::threshold() const + { + return 10 * std::log10(d_threshold); + } + + void + probe_avg_mag_sqrd_f_impl::set_threshold(double decibels) + { + // convert to absolute threshold (mag sqrd) + d_threshold = std::pow(10.0, decibels/10); + } + + void + probe_avg_mag_sqrd_f_impl::set_alpha(double alpha) + { + d_iir.set_taps(alpha); + } + + } /* namespace analog */ +} /* namespace gr */ + diff --git a/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h new file mode 100644 index 0000000000..ba879763c2 --- /dev/null +++ b/gr-analog/lib/probe_avg_mag_sqrd_f_impl.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 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 3, 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_ANALOG_PROBE_AVG_MAG_SQRD_F_IMPL_H +#define INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_IMPL_H + +#include <analog/probe_avg_mag_sqrd_f.h> +#include <filter/single_pole_iir.h> + +namespace gr { + namespace analog { + + class probe_avg_mag_sqrd_f_impl : public probe_avg_mag_sqrd_f + { + private: + double d_threshold; + bool d_unmuted; + double d_level; + filter::single_pole_iir<double,double,double> d_iir; + + public: + probe_avg_mag_sqrd_f_impl(double threshold_db, double alpha); + ~probe_avg_mag_sqrd_f_impl(); + + bool unmuted() const { return d_unmuted; } + double level() const { return d_level; } + + double threshold() const; + + void set_alpha(double alpha); + void set_threshold(double decibels); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_IMPL_H */ diff --git a/gr-analog/lib/pwr_squelch_cc_impl.cc b/gr-analog/lib/pwr_squelch_cc_impl.cc new file mode 100644 index 0000000000..1bfba6846f --- /dev/null +++ b/gr-analog/lib/pwr_squelch_cc_impl.cc @@ -0,0 +1,73 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2010,2012 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 3, 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 "pwr_squelch_cc_impl.h" + +namespace gr { + namespace analog { + + pwr_squelch_cc::sptr + pwr_squelch_cc::make(double threshold, double alpha, + int ramp, bool gate) + { + return gnuradio::get_initial_sptr + (new pwr_squelch_cc_impl(threshold, alpha, ramp, gate)); + } + + pwr_squelch_cc_impl::pwr_squelch_cc_impl(double threshold, double alpha, + int ramp, bool gate) + : gr_block("pwr_squelch_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + squelch_base_cc_impl("pwr_squelch_cc", ramp, gate), + d_iir(alpha) + { + set_threshold(threshold); + } + + pwr_squelch_cc_impl::~pwr_squelch_cc_impl() + { + } + + std::vector<float> + pwr_squelch_cc_impl::squelch_range() const + { + std::vector<float> r(3); + r[0] = -50.0; // min FIXME + r[1] = +50.0; // max FIXME + r[2] = (r[1] - r[0]) / 100; // step size + + return r; + } + + void + pwr_squelch_cc_impl::update_state(const gr_complex &in) + { + d_pwr = d_iir.filter(in.real()*in.real()+in.imag()*in.imag()); + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/pwr_squelch_cc_impl.h b/gr-analog/lib/pwr_squelch_cc_impl.h new file mode 100644 index 0000000000..72df0f3d2d --- /dev/null +++ b/gr-analog/lib/pwr_squelch_cc_impl.h @@ -0,0 +1,78 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_PWR_SQUELCH_CC_IMPL_H +#define INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H + +#include <analog/pwr_squelch_cc.h> +#include "squelch_base_cc_impl.h" +#include <filter/single_pole_iir.h> +#include <cmath> + +namespace gr { + namespace analog { + + class ANALOG_API pwr_squelch_cc_impl : + public pwr_squelch_cc, squelch_base_cc_impl + { + private: + double d_threshold; + double d_pwr; + filter::single_pole_iir<double,double,double> d_iir; + + protected: + virtual void update_state(const gr_complex &in); + virtual bool mute() const { return d_pwr < d_threshold; } + + public: + pwr_squelch_cc_impl(double db, double alpha=0.0001, + int ramp=0, bool gate=false); + ~pwr_squelch_cc_impl(); + + std::vector<float> squelch_range() const; + + double threshold() const { return 10*log10(d_threshold); } + void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } + void set_alpha(double alpha) { d_iir.set_taps(alpha); } + + int ramp() const { return squelch_base_cc_impl::ramp(); } + void set_ramp(int ramp) { squelch_base_cc_impl::set_ramp(ramp); } + bool gate() const { return squelch_base_cc_impl::gate(); } + void set_gate(bool gate) { squelch_base_cc_impl::set_gate(gate); } + bool unmuted() const { return squelch_base_cc_impl::unmuted(); } + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + return squelch_base_cc_impl::general_work(noutput_items, + ninput_items, + input_items, + output_items); + } + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PWR_SQUELCH_CC_IMPL_H */ diff --git a/gr-analog/lib/pwr_squelch_ff_impl.cc b/gr-analog/lib/pwr_squelch_ff_impl.cc new file mode 100644 index 0000000000..c6bb6af903 --- /dev/null +++ b/gr-analog/lib/pwr_squelch_ff_impl.cc @@ -0,0 +1,73 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2010,2012 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 3, 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 "pwr_squelch_ff_impl.h" + +namespace gr { + namespace analog { + + pwr_squelch_ff::sptr + pwr_squelch_ff::make(double threshold, double alpha, + int ramp, bool gate) + { + return gnuradio::get_initial_sptr + (new pwr_squelch_ff_impl(threshold, alpha, ramp, gate)); + } + + pwr_squelch_ff_impl::pwr_squelch_ff_impl(double threshold, double alpha, + int ramp, bool gate) + : gr_block("pwr_squelch_ff", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(float))), + squelch_base_ff_impl("pwr_squelch_ff", ramp, gate), + d_iir(alpha) + { + set_threshold(threshold); + } + + pwr_squelch_ff_impl::~pwr_squelch_ff_impl() + { + } + + std::vector<float> + pwr_squelch_ff_impl::squelch_range() const + { + std::vector<float> r(3); + r[0] = -50.0; // min FIXME + r[1] = +50.0; // max FIXME + r[2] = (r[1] - r[0]) / 100; // step size + + return r; + } + + void + pwr_squelch_ff_impl::update_state(const float &in) + { + d_pwr = d_iir.filter(in*in); + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/pwr_squelch_ff_impl.h b/gr-analog/lib/pwr_squelch_ff_impl.h new file mode 100644 index 0000000000..96d959b4dd --- /dev/null +++ b/gr-analog/lib/pwr_squelch_ff_impl.h @@ -0,0 +1,78 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_ANALOG_PWR_SQUELCH_FF_IMPL_H +#define INCLUDED_ANALOG_PWR_SQUELCH_FF_IMPL_H + +#include <analog/pwr_squelch_ff.h> +#include "squelch_base_ff_impl.h" +#include <filter/single_pole_iir.h> +#include <cmath> + +namespace gr { + namespace analog { + + class ANALOG_API pwr_squelch_ff_impl : + public pwr_squelch_ff, squelch_base_ff_impl + { + private: + double d_threshold; + double d_pwr; + filter::single_pole_iir<double,double,double> d_iir; + + protected: + virtual void update_state(const float &in); + virtual bool mute() const { return d_pwr < d_threshold; } + + public: + pwr_squelch_ff_impl(double db, double alpha=0.0001, + int ramp=0, bool gate=false); + ~pwr_squelch_ff_impl(); + + std::vector<float> squelch_range() const; + + double threshold() const { return 10*log10(d_threshold); } + void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } + void set_alpha(double alpha) { d_iir.set_taps(alpha); } + + int ramp() const { return squelch_base_ff_impl::ramp(); } + void set_ramp(int ramp) { squelch_base_ff_impl::set_ramp(ramp); } + bool gate() const { return squelch_base_ff_impl::gate(); } + void set_gate(bool gate) { squelch_base_ff_impl::set_gate(gate); } + bool unmuted() const { return squelch_base_ff_impl::unmuted(); } + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + return squelch_base_ff_impl::general_work(noutput_items, + ninput_items, + input_items, + output_items); + } + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_PWR_SQUELCH_FF_IMPL_H */ diff --git a/gnuradio-core/src/lib/general/gri_agc_ff.i b/gr-analog/lib/qa_analog.cc index df4acf7af8..f1e3a45e27 100644 --- a/gnuradio-core/src/lib/general/gri_agc_ff.i +++ b/gr-analog/lib/qa_analog.cc @@ -1,6 +1,5 @@ -/* -*- c++ -*- */ /* - * Copyright 2005,2006 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,17 +19,22 @@ * Boston, MA 02110-1301, USA. */ -#include <math.h> - -/*! - * \brief high performance Automatic Gain Control class - * - * Power is approximated by absolute value +/* + * This class gathers together all the test cases for the gr-analog + * directory into a single test suite. As you create new test cases, + * add them here. */ -class gri_agc_ff { +#include <qa_analog.h> +#include <qa_sincos.h> +#include <qa_rotator.h> + +CppUnit::TestSuite * +qa_gr_analog::suite() +{ + CppUnit::TestSuite *s = new CppUnit::TestSuite("gr-analog"); + + s->addTest(gr::analog::qa_sincos::suite()); - public: - gri_agc_ff (float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0); -}; + return s; +} diff --git a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i b/gr-analog/lib/qa_analog.h index 1fd5a2c26d..458861cc91 100644 --- a/gnuradio-core/src/lib/general/gr_feedforward_agc_cc.i +++ b/gr-analog/lib/qa_analog.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,15 +20,19 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,feedforward_agc_cc); +#ifndef _QA_GR_ANALOG_H_ +#define _QA_GR_ANALOG_H_ -gr_feedforward_agc_cc_sptr -gr_make_feedforward_agc_cc(int nsamples, float reference = 1.0); +#include <gruel/attributes.h> +#include <cppunit/TestSuite.h> -class gr_feedforward_agc_cc : public gr_sync_block -{ - gr_feedforward_agc_cc(int nsamples, float reference); +//! collect all the tests for the gr-analog directory +class __GR_ATTR_EXPORT qa_gr_analog { public: - ~gr_feedforward_agc_cc(); + //! return suite of tests for all of gr-analog directory + static CppUnit::TestSuite *suite(); }; + + +#endif /* _QA_GR_ANALOG_H_ */ diff --git a/gr-analog/lib/qa_sincos.cc b/gr-analog/lib/qa_sincos.cc new file mode 100644 index 0000000000..62642c1171 --- /dev/null +++ b/gr-analog/lib/qa_sincos.cc @@ -0,0 +1,75 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 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 3, 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 <qa_sincos.h> +#include <analog/sincos.h> +#include <gruel/attributes.h> +#include <cppunit/TestAssert.h> +#include <cmath> + +namespace gr { + namespace analog { + + void + qa_sincos::t1() + { + static const unsigned int N = 1000; + double c_sin, c_cos; + double gr_sin, gr_cos; + + for(unsigned i = 0; i < N; i++) { + double x = i/100.0; + c_sin = sin(x); + c_cos = cos(x); + + analog::sincos(x, &gr_sin, &gr_cos); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); + CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); + } + } + + void + qa_sincos::t2() + { + static const unsigned int N = 1000; + float c_sin, c_cos; + float gr_sin, gr_cos; + + for(unsigned i = 0; i < N; i++) { + float x = i/100.0; + c_sin = sinf(x); + c_cos = cosf(x); + + analog::sincosf(x, &gr_sin, &gr_cos); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(c_sin, gr_sin, 0.0001); + CPPUNIT_ASSERT_DOUBLES_EQUAL(c_cos, gr_cos, 0.0001); + } + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t b/gr-analog/lib/qa_sincos.h index df27ab79b6..f18e879dd8 100644 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t +++ b/gr-analog/lib/qa_sincos.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,21 +20,28 @@ * Boston, MA 02110-1301, USA. */ -// @WARNING@ +#ifndef _QA_ANALOG_SINCOS_H_ +#define _QA_ANALOG_SINCOS_H_ -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/TestCase.h> -@NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0); +namespace gr { + namespace analog { -class @NAME@ : public gr_block { - private: - @NAME@ (gr_noise_type_t type, float ampl, long seed = 0); + class qa_sincos : public CppUnit::TestCase + { + CPPUNIT_TEST_SUITE(qa_sincos); + CPPUNIT_TEST(t1); + CPPUNIT_TEST(t2); + CPPUNIT_TEST_SUITE_END(); - public: - void set_type (gr_noise_type_t type) { d_type = type; } - void set_amplitude (float ampl) { d_ampl = ampl; } + private: + void t1(); + void t2(); + }; - gr_noise_type_t type () const { return d_type; } - float amplitude () const { return d_ampl; } -}; + } /* namespace analog */ +} /* namespace gr */ + +#endif /* _QA_ANALOG_SINCOS_H_ */ diff --git a/gr-analog/lib/quadrature_demod_cf_impl.cc b/gr-analog/lib/quadrature_demod_cf_impl.cc new file mode 100644 index 0000000000..9490ba6bed --- /dev/null +++ b/gr-analog/lib/quadrature_demod_cf_impl.cc @@ -0,0 +1,72 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2005,2010,2012 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 3, 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 "quadrature_demod_cf_impl.h" +#include <gr_io_signature.h> +#include <gr_math.h> + +namespace gr { + namespace analog { + + quadrature_demod_cf::sptr + quadrature_demod_cf::make(float gain) + { + return gnuradio::get_initial_sptr + (new quadrature_demod_cf_impl(gain)); + } + + quadrature_demod_cf_impl::quadrature_demod_cf_impl(float gain) + : gr_sync_block("quadrature_demod_cf", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(float))), + d_gain(gain) + { + set_history(2); // we need to look at the previous value + } + + quadrature_demod_cf_impl::~quadrature_demod_cf_impl() + { + } + + int + quadrature_demod_cf_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + gr_complex *in = (gr_complex*)input_items[0]; + float *out = (float*)output_items[0]; + in++; // ensure that in[-1] is valid + + for(int i = 0; i < noutput_items; i++) { + gr_complex product = in[i] * conj(in[i-1]); + out[i] = d_gain * gr_fast_atan2f(imag(product), real(product)); + } + + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i b/gr-analog/lib/quadrature_demod_cf_impl.h index 2682f27586..72beb23316 100644 --- a/gnuradio-core/src/lib/general/gr_pwr_squelch_ff.i +++ b/gr-analog/lib/quadrature_demod_cf_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2009 Free Software Foundation, Inc. + * Copyright 2004,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,23 +20,32 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,pwr_squelch_ff); +#ifndef INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_IMPL_H +#define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_IMPL_H -// retrieve info on the base class, without generating wrappers since -// the base class has a pure virual method. -%import "gr_squelch_base_ff.i" +#include <analog/quadrature_demod_cf.h> -gr_pwr_squelch_ff_sptr -gr_make_pwr_squelch_ff(double db, double alpha=0.0001, int ramp=0, bool gate=false); +namespace gr { + namespace analog { + + class quadrature_demod_cf_impl : public quadrature_demod_cf + { + private: + float d_gain; -class gr_pwr_squelch_ff : public gr_squelch_base_ff -{ -private: - gr_pwr_squelch_ff(double db, double alpha, int ramp, bool gate); + public: + quadrature_demod_cf_impl(float gain); + ~quadrature_demod_cf_impl(); -public: - double threshold() const { return 10*log10(d_threshold); } - void set_threshold(double db) { d_threshold = std::pow(10.0, db/10); } - void set_alpha(double alpha) { d_iir.set_taps(alpha); } - std::vector<float> squelch_range() const; -}; + void set_gain(float gain) { d_gain = gain; } + float gain() const { return d_gain; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_IMPL_H */ diff --git a/gr-analog/lib/rail_ff_impl.cc b/gr-analog/lib/rail_ff_impl.cc new file mode 100644 index 0000000000..106c6353ae --- /dev/null +++ b/gr-analog/lib/rail_ff_impl.cc @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2012 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 3, 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 "rail_ff_impl.h" +#include <gr_io_signature.h> +#include <gr_math.h> + +namespace gr { + namespace analog { + + rail_ff::sptr + rail_ff::make(float lo, float hi) + { + return gnuradio::get_initial_sptr + (new rail_ff_impl(lo, hi)); + } + + rail_ff_impl::rail_ff_impl(float lo, float hi) + : gr_sync_block("rail_ff", + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(float))), + d_lo(lo), d_hi(hi) + { + set_clipping(); + } + + rail_ff_impl::~rail_ff_impl() + { + } + + void + rail_ff_impl::set_lo(float lo) + { + d_lo = lo; + set_clipping(); + } + + void + rail_ff_impl::set_hi(float hi) + { + d_hi = hi; + set_clipping(); + } + + void + rail_ff_impl::set_clipping() + { + d_mid = (d_lo + d_hi)/2; + d_clip = d_hi - d_mid; + } + + int + rail_ff_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float*)input_items[0]; + float *out = (float*)output_items[0]; + + for(int i = 0; i < noutput_items; i++) { + out[i] = d_mid + gr_branchless_clip(in[i] - d_mid, d_clip); + } + + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/rail_ff_impl.h b/gr-analog/lib/rail_ff_impl.h new file mode 100644 index 0000000000..436b10b412 --- /dev/null +++ b/gr-analog/lib/rail_ff_impl.h @@ -0,0 +1,57 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 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 3, 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_ANALOG_RAIL_FF_IMPL_H +#define INCLUDED_ANALOG_RAIL_FF_IMPL_H + +#include <analog/rail_ff.h> + +namespace gr { + namespace analog { + + class rail_ff_impl : public rail_ff + { + private: + float d_lo, d_hi; + float d_mid, d_clip; + + void set_clipping(); + + public: + rail_ff_impl(float lo, float hi); + ~rail_ff_impl(); + + float lo() const { return d_lo; } + float hi() const { return d_hi; } + + void set_lo(float lo); + void set_hi(float hi); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_RAIL_FF_IMPL_H */ diff --git a/gr-analog/lib/sig_source_X_impl.cc.t b/gr-analog/lib/sig_source_X_impl.cc.t new file mode 100644 index 0000000000..ad8b7e4b0c --- /dev/null +++ b/gr-analog/lib/sig_source_X_impl.cc.t @@ -0,0 +1,253 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2012 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 3, 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. + */ + +/* @WARNING@ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "@IMPL_NAME@.h" +#include <algorithm> +#include <gr_io_signature.h> +#include <stdexcept> +#include <algorithm> +#include <gr_complex.h> + +namespace gr { + namespace analog { + + @BASE_NAME@::sptr + @BASE_NAME@::make(double sampling_freq, gr_waveform_t waveform, + double frequency, double ampl, @TYPE@ offset) + { + return gnuradio::get_initial_sptr + (new @IMPL_NAME@(sampling_freq, waveform, frequency, ampl, offset)); + } + + @IMPL_NAME@::@IMPL_NAME@(double sampling_freq, gr_waveform_t waveform, + double frequency, double ampl, @TYPE@ offset) + : gr_sync_block("@BASE_NAME@", + gr_make_io_signature(0, 0, 0), + gr_make_io_signature(1, 1, sizeof(@TYPE@))), + d_sampling_freq(sampling_freq), d_waveform(waveform), + d_frequency(frequency), d_ampl(ampl), d_offset(offset) + { + d_nco.set_freq(2 * M_PI * d_frequency / d_sampling_freq); + } + + @IMPL_NAME@::~@IMPL_NAME@() + { + } + + int + @IMPL_NAME@::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + @TYPE@ *optr = (@TYPE@*)output_items[0]; + @TYPE@ t; + + switch(d_waveform) { + +#if @IS_COMPLEX@ // complex? + + case GR_CONST_WAVE: + t = (gr_complex) d_ampl + d_offset; + std::fill_n(optr, noutput_items, t); + break; + + case GR_SIN_WAVE: + case GR_COS_WAVE: + d_nco.sincos(optr, noutput_items, d_ampl); + if(d_offset == gr_complex(0,0)) + break; + + for(int i = 0; i < noutput_items; i++) { + optr[i] += d_offset; + } + break; + + /* Implements a real square wave high from -PI to 0. + * The imaginary square wave leads by 90 deg. + */ + case GR_SQR_WAVE: + for(int i = 0; i < noutput_items; i++) { + if(d_nco.get_phase() < -1*M_PI/2) + optr[i] = gr_complex(d_ampl, 0) + d_offset; + else if(d_nco.get_phase() < 0) + optr[i] = gr_complex(d_ampl, d_ampl) + d_offset; + else if(d_nco.get_phase() < M_PI/2) + optr[i] = gr_complex(0, d_ampl) + d_offset; + else + optr[i] = d_offset; + d_nco.step(); + } + break; + + /* Implements a real triangle wave rising from -PI to 0 and + * falling from 0 to PI. The imaginary triangle wave leads by + * 90 deg. + */ + case GR_TRI_WAVE: + for(int i = 0; i < noutput_items; i++) { + if(d_nco.get_phase() < -1*M_PI/2){ + optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl, + -1*d_ampl*d_nco.get_phase()/M_PI - d_ampl/2) + d_offset; + } + else if(d_nco.get_phase() < 0) { + optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl, + d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset; + } + else if(d_nco.get_phase() < M_PI/2) { + optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl, + d_ampl*d_nco.get_phase()/M_PI + d_ampl/2) + d_offset; + } + else { + optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl, + -1*d_ampl*d_nco.get_phase()/M_PI + 3*d_ampl/2) + d_offset; + } + d_nco.step(); + } + break; + + /* Implements a real saw tooth wave rising from -PI to PI. + * The imaginary saw tooth wave leads by 90 deg. + */ + case GR_SAW_WAVE: + for(int i = 0; i < noutput_items; i++) { + if(d_nco.get_phase() < -1*M_PI/2) { + optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2, + d_ampl*d_nco.get_phase()/(2*M_PI) + 5*d_ampl/4) + d_offset; + } + else { + optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2, + d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/4) + d_offset; + } + d_nco.step(); + } + break; + +#else // nope... + + case GR_CONST_WAVE: + t = (@TYPE@)d_ampl + d_offset; + std::fill_n(optr, noutput_items, t); + break; + + case GR_SIN_WAVE: + d_nco.sin(optr, noutput_items, d_ampl); + if(d_offset == 0) + break; + + for(int i = 0; i < noutput_items; i++) { + optr[i] += d_offset; + } + break; + + case GR_COS_WAVE: + d_nco.cos(optr, noutput_items, d_ampl); + if(d_offset == 0) + break; + + for(int i = 0; i < noutput_items; i++) { + optr[i] += d_offset; + } + break; + + /* The square wave is high from -PI to 0. */ + case GR_SQR_WAVE: + t = (@TYPE@)d_ampl + d_offset; + for(int i = 0; i < noutput_items; i++) { + if(d_nco.get_phase() < 0) + optr[i] = t; + else + optr[i] = d_offset; + d_nco.step(); + } + break; + + /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */ + case GR_TRI_WAVE: + for(int i = 0; i < noutput_items; i++) { + double t = d_ampl*d_nco.get_phase()/M_PI; + if (d_nco.get_phase() < 0) + optr[i] = static_cast<@TYPE@>(t + d_ampl + d_offset); + else + optr[i] = static_cast<@TYPE@>(-1*t + d_ampl + d_offset); + d_nco.step(); + } + break; + + /* The saw tooth wave rises from -PI to PI. */ + case GR_SAW_WAVE: + for(int i = 0; i < noutput_items; i++) { + t = static_cast<@TYPE@>(d_ampl*d_nco.get_phase()/(2*M_PI) + + d_ampl/2 + d_offset); + optr[i] = t; + d_nco.step(); + } + break; + +#endif + + default: + throw std::runtime_error("analog::sig_source: invalid waveform"); + } + + return noutput_items; + } + + void + @NAME@::set_sampling_freq(double sampling_freq) + { + d_sampling_freq = sampling_freq; + d_nco.set_freq (2 * M_PI * d_frequency / d_sampling_freq); + } + + void + @NAME@::set_waveform(gr_waveform_t waveform) + { + d_waveform = waveform; + } + + void + @NAME@::set_frequency(double frequency) + { + d_frequency = frequency; + d_nco.set_freq(2 * M_PI * d_frequency / d_sampling_freq); + } + + void + @NAME@::set_amplitude(double ampl) + { + d_ampl = ampl; + } + + void + @NAME@::set_offset(@TYPE@ offset) + { + d_offset = offset; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/sig_source_X_impl.h.t b/gr-analog/lib/sig_source_X_impl.h.t new file mode 100644 index 0000000000..50f1791270 --- /dev/null +++ b/gr-analog/lib/sig_source_X_impl.h.t @@ -0,0 +1,70 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012 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 3, 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. + */ + +/* @WARNING@ */ + +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <analog/@BASE_NAME@.h> +#include <gr_sync_block.h> +#include <gr_fxpt_nco.h> + +namespace gr { + namespace analog { + + class @IMPL_NAME@ : public @BASE_NAME@ + { + private: + double d_sampling_freq; + gr_waveform_t d_waveform; + double d_frequency; + double d_ampl; + @TYPE@ d_offset; + gr_fxpt_nco d_nco; + + public: + @IMPL_NAME@(double sampling_freq, gr_waveform_t waveform, + double wave_freq, double ampl, @TYPE@ offset = 0); + ~@IMPL_NAME@(); + + virtual int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + double sampling_freq() const { return d_sampling_freq; } + gr_waveform_t waveform() const { return d_waveform; } + double frequency() const { return d_frequency; } + double amplitude() const { return d_ampl; } + @TYPE@ offset() const { return d_offset; } + + void set_sampling_freq(double sampling_freq); + void set_waveform(gr_waveform_t waveform); + void set_frequency(double frequency); + void set_amplitude(double ampl); + void set_offset(@TYPE@ offset); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* @GUARD_NAME@ */ diff --git a/gr-analog/lib/simple_squelch_cc_impl.cc b/gr-analog/lib/simple_squelch_cc_impl.cc new file mode 100644 index 0000000000..02ccc535da --- /dev/null +++ b/gr-analog/lib/simple_squelch_cc_impl.cc @@ -0,0 +1,106 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2010,2012 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 3, 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 "simple_squelch_cc_impl.h" +#include <gr_io_signature.h> +#include <cmath> + +namespace gr { + namespace analog { + + simple_squelch_cc::sptr + simple_squelch_cc::make(double threshold_db, double alpha) + { + return gnuradio::get_initial_sptr + (new simple_squelch_cc_impl(threshold_db, alpha)); + } + + simple_squelch_cc_impl::simple_squelch_cc_impl(double threshold_db, double alpha) + : gr_sync_block("simple_squelch_cc", + gr_make_io_signature(1, 1, sizeof(gr_complex)), + gr_make_io_signature(1, 1, sizeof(gr_complex))), + d_unmuted(false), d_iir(alpha) + { + set_threshold(threshold_db); + } + + simple_squelch_cc_impl::~simple_squelch_cc_impl() + { + } + + void + simple_squelch_cc_impl::set_threshold(double decibels) + { + // convert to absolute threshold (mag squared) + d_threshold = std::pow(10.0, decibels/10); + } + + double + simple_squelch_cc_impl::threshold() const + { + return 10 * log10(d_threshold); + } + + void + simple_squelch_cc_impl::set_alpha(double alpha) + { + d_iir.set_taps(alpha); + } + + std::vector<float> + simple_squelch_cc_impl::squelch_range() const + { + std::vector<float> r(3); + r[0] = -50.0; // min FIXME + r[1] = +50.0; // max FIXME + r[2] = (r[1] - r[0]) / 100; // step size + + return r; + } + + int + simple_squelch_cc_impl::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]; + + for(int i = 0; i < noutput_items; i++) { + double mag_sqrd = in[i].real()*in[i].real() + in[i].imag()*in[i].imag(); + double f = d_iir.filter(mag_sqrd); + if(f >= d_threshold) + out[i] = in[i]; + else + out[i] = 0; + } + + d_unmuted = d_iir.prev_output() >= d_threshold; + return noutput_items; + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/simple_squelch_cc_impl.h b/gr-analog/lib/simple_squelch_cc_impl.h new file mode 100644 index 0000000000..ba11de91e7 --- /dev/null +++ b/gr-analog/lib/simple_squelch_cc_impl.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2012 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 3, 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_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H +#define INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H + +#include <analog/simple_squelch_cc.h> +#include <filter/single_pole_iir.h> + +namespace gr { + namespace analog { + + class simple_squelch_cc_impl : public simple_squelch_cc + { + private: + double d_threshold; + bool d_unmuted; + filter::single_pole_iir<double,double,double> d_iir; + + public: + simple_squelch_cc_impl(double threshold_db, double alpha); + ~simple_squelch_cc_impl(); + + bool unmuted() const { return d_unmuted; } + + void set_alpha(double alpha); + void set_threshold(double decibels); + + double threshold() const; + std::vector<float> squelch_range() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_IMPL_H */ diff --git a/gr-analog/lib/sincos.cc b/gr-analog/lib/sincos.cc new file mode 100644 index 0000000000..14ceeb3a29 --- /dev/null +++ b/gr-analog/lib/sincos.cc @@ -0,0 +1,89 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2010,2012 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 3, 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 + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE // ask for GNU extensions if available +#endif + +#include <analog/sincos.h> +#include <math.h> + +namespace gr { + namespace analog { + +// ---------------------------------------------------------------- + +#if defined (HAVE_SINCOS) + + void + sincos(double x, double *sinx, double *cosx) + { + ::sincos(x, sinx, cosx); + } + +#else + + void + sincos(double x, double *sinx, double *cosx) + { + *sinx = sin(x); + *cosx = cos(x); + } + +#endif + +// ---------------------------------------------------------------- + +#if defined (HAVE_SINCOSF) + + void + sincosf(float x, float *sinx, float *cosx) + { + sincosf(x, sinx, cosx); + } + +#elif defined (HAVE_SINF) && defined (HAVE_COSF) + + void + sincosf(float x, float *sinx, float *cosx) + { + *sinx = sinf(x); + *cosx = cosf(x); + } + +#else + + void + sincosf(float x, float *sinx, float *cosx) + { + *sinx = sin(x); + *cosx = cos(x); + } + +#endif + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/squelch_base_cc_impl.cc b/gr-analog/lib/squelch_base_cc_impl.cc new file mode 100644 index 0000000000..cba7b30dba --- /dev/null +++ b/gr-analog/lib/squelch_base_cc_impl.cc @@ -0,0 +1,140 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2012 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 3, 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 "squelch_base_cc_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace analog { + + squelch_base_cc_impl::squelch_base_cc_impl(const char *name, int ramp, bool gate) + : gr_block(name, + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(float))) + { + set_ramp(ramp); + set_gate(gate); + d_state = ST_MUTED; + d_envelope = d_ramp ? 0.0 : 1.0; + d_ramped = 0; + } + + squelch_base_cc_impl::~squelch_base_cc_impl() + { + } + + int + squelch_base_cc_impl::ramp() const + { + return d_ramp; + } + + void + squelch_base_cc_impl::set_ramp(int ramp) + { + d_ramp = ramp; + } + + bool + squelch_base_cc_impl::gate() const + { + return d_gate; + } + + void + squelch_base_cc_impl::set_gate(bool gate) + { + d_gate = gate; + } + + bool + squelch_base_cc_impl::unmuted() const + { + return (d_state == ST_UNMUTED || d_state == ST_ATTACK); + } + + int + squelch_base_cc_impl::general_work(int noutput_items, + gr_vector_int &ninput_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]; + + int j = 0; + + for(int i = 0; i < noutput_items; i++) { + update_state(in[i]); + + // Adjust envelope based on current state + switch(d_state) { + case ST_MUTED: + if(!mute()) { + d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted + } + break; + + case ST_UNMUTED: + if(mute()) { + d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted + } + break; + + case ST_ATTACK: + d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed + if(d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere + d_state = ST_UNMUTED; + d_envelope = 1.0; + } + break; + + case ST_DECAY: + d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed + if(d_ramped == 0.0) { + d_state = ST_MUTED; + } + break; + }; + + // If unmuted, copy input times envelope to output + // Otherwise, if not gating, copy zero to output + if(d_state != ST_MUTED) { + out[j++] = in[i]*gr_complex(d_envelope, 0.0); + } + else { + if(!d_gate) { + out[j++] = 0.0; + } + } + } + + consume_each(noutput_items); // Use all the inputs + return j; // But only report outputs copied + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/squelch_base_cc_impl.h b/gr-analog/lib/squelch_base_cc_impl.h new file mode 100644 index 0000000000..19dccaa101 --- /dev/null +++ b/gr-analog/lib/squelch_base_cc_impl.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_SQUELCH_BASE_CC_IMPL_H +#define INCLUDED_GR_SQUELCH_BASE_CC_IMPL_H + +#include <analog/squelch_base_cc.h> + +namespace gr { + namespace analog { + + class squelch_base_cc_impl : public squelch_base_cc + { + private: + int d_ramp; + int d_ramped; + bool d_gate; + double d_envelope; + enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; + + protected: + virtual void update_state(const gr_complex &sample) {}; + virtual bool mute() const { return false; }; + + public: + squelch_base_cc_impl(const char *name, int ramp, bool gate); + ~squelch_base_cc_impl(); + + int ramp() const; + void set_ramp(int ramp); + bool gate() const; + void set_gate(bool gate); + bool unmuted() const; + + virtual std::vector<float> squelch_range() const = 0; + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SQUELCH_BASE_IMPL_FF_H */ diff --git a/gr-analog/lib/squelch_base_ff_impl.cc b/gr-analog/lib/squelch_base_ff_impl.cc new file mode 100644 index 0000000000..f9f07d36da --- /dev/null +++ b/gr-analog/lib/squelch_base_ff_impl.cc @@ -0,0 +1,140 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2006,2012 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 3, 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 "squelch_base_ff_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace analog { + + squelch_base_ff_impl::squelch_base_ff_impl(const char *name, int ramp, bool gate) + : gr_block(name, + gr_make_io_signature(1, 1, sizeof(float)), + gr_make_io_signature(1, 1, sizeof(float))) + { + set_ramp(ramp); + set_gate(gate); + d_state = ST_MUTED; + d_envelope = d_ramp ? 0.0 : 1.0; + d_ramped = 0; + } + + squelch_base_ff_impl::~squelch_base_ff_impl() + { + } + + int + squelch_base_ff_impl::ramp() const + { + return d_ramp; + } + + void + squelch_base_ff_impl::set_ramp(int ramp) + { + d_ramp = ramp; + } + + bool + squelch_base_ff_impl::gate() const + { + return d_gate; + } + + void + squelch_base_ff_impl::set_gate(bool gate) + { + d_gate = gate; + } + + bool + squelch_base_ff_impl::unmuted() const + { + return (d_state == ST_UNMUTED || d_state == ST_ATTACK); + } + + int + squelch_base_ff_impl::general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float *) input_items[0]; + float *out = (float *) output_items[0]; + + int j = 0; + + for(int i = 0; i < noutput_items; i++) { + update_state(in[i]); + + // Adjust envelope based on current state + switch(d_state) { + case ST_MUTED: + if(!mute()) + // If not ramping, go straight to unmuted + d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; + break; + + case ST_UNMUTED: + if(mute()) + // If not ramping, go straight to muted + d_state = d_ramp ? ST_DECAY : ST_MUTED; + break; + + case ST_ATTACK: + // FIXME: precalculate window for speed + d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; + + // use >= in case d_ramp is set to lower value elsewhere + if(d_ramped >= d_ramp) { + d_state = ST_UNMUTED; + d_envelope = 1.0; + } + break; + + case ST_DECAY: + // FIXME: precalculate window for speed + d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; + if(d_ramped == 0.0) + d_state = ST_MUTED; + break; + }; + + // If unmuted, copy input times envelope to output + // Otherwise, if not gating, copy zero to output + if(d_state != ST_MUTED) + out[j++] = in[i]*d_envelope; + else + if(!d_gate) + out[j++] = 0.0; + } + + consume_each(noutput_items); // Use all the inputs + return j; // But only report outputs copied + } + + } /* namespace analog */ +} /* namespace gr */ diff --git a/gr-analog/lib/squelch_base_ff_impl.h b/gr-analog/lib/squelch_base_ff_impl.h new file mode 100644 index 0000000000..22659be746 --- /dev/null +++ b/gr-analog/lib/squelch_base_ff_impl.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- */ +/* + * Copyright 2006,2012 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 3, 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_SQUELCH_BASE_FF_IMPL_H +#define INCLUDED_GR_SQUELCH_BASE_FF_IMPL_H + +#include <analog/squelch_base_ff.h> + +namespace gr { + namespace analog { + + class squelch_base_ff_impl : public squelch_base_ff + { + private: + int d_ramp; + int d_ramped; + bool d_gate; + double d_envelope; + enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; + + protected: + virtual void update_state(const float &sample) {}; + virtual bool mute() const { return false; }; + + public: + squelch_base_ff_impl(const char *name, int ramp, bool gate); + ~squelch_base_ff_impl(); + + int ramp() const; + void set_ramp(int ramp); + bool gate() const; + void set_gate(bool gate); + bool unmuted() const; + + virtual std::vector<float> squelch_range() const = 0; + + int general_work(int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace analog */ +} /* namespace gr */ + +#endif /* INCLUDED_ANALOG_SQUELCH_BASE_IMPL_FF_H */ diff --git a/gnuradio-core/src/lib/general/gr_squelch_base_cc.i b/gr-analog/lib/test_gr_analog.cc index 6501b7d2bf..00d6242699 100644 --- a/gnuradio-core/src/lib/general/gr_squelch_base_cc.i +++ b/gr-analog/lib/test_gr_analog.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,21 +20,24 @@ * Boston, MA 02110-1301, USA. */ -#include <gr_block.h> +#include <cppunit/TextTestRunner.h> +#include <cppunit/XmlOutputter.h> -class gr_squelch_base_cc : public gr_block +#include <gr_unittests.h> +#include "qa_analog.h" +#include <iostream> + +int +main (int argc, char **argv) { -private: - enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state; + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(get_unittest_path("gr_analog.xml").c_str()); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); -public: - gr_squelch_base_cc(const char *name, int ramp, bool gate); + runner.addTest(qa_gr_analog::suite()); + runner.setOutputter(xmlout); - int ramp() const { return d_ramp; } - void set_ramp(int ramp) { d_ramp = ramp; } - bool gate() const { return d_gate; } - void set_gate(bool gate) { d_gate = gate; } - bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); } + bool was_successful = runner.run("", false); - virtual std::vector<float> squelch_range() const = 0; -}; + return was_successful ? 0 : 1; +} diff --git a/gr-analog/python/CMakeLists.txt b/gr-analog/python/CMakeLists.txt index 08570eea33..f42ee20086 100644 --- a/gr-analog/python/CMakeLists.txt +++ b/gr-analog/python/CMakeLists.txt @@ -25,6 +25,16 @@ include(GrPython) GR_PYTHON_INSTALL( FILES __init__.py + am_demod.py + fm_demod.py + fm_emph.py + nbfm_rx.py + nbfm_tx.py + standard_squelch.py + wfm_rcv.py + wfm_rcv_fmdet.py + wfm_rcv_pll.py + wfm_tx.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/analog COMPONENT "analog_python" ) diff --git a/gr-analog/python/__init__.py b/gr-analog/python/__init__.py index fc345028b9..a5ab5715d7 100644 --- a/gr-analog/python/__init__.py +++ b/gr-analog/python/__init__.py @@ -25,3 +25,14 @@ Blocks and utilities for analog modulation and demodulation. # The presence of this file turns this directory into a Python package from analog_swig import * + +from am_demod import * +from fm_demod import * +from fm_emph import * +from nbfm_rx import * +from nbfm_tx import * +from standard_squelch import * +from wfm_rcv import * +from wfm_rcv_fmdet import * +from wfm_rcv_pll import * +from wfm_tx import * diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py b/gr-analog/python/am_demod.py index 6420348be3..2730aa2622 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/am_demod.py +++ b/gr-analog/python/am_demod.py @@ -1,5 +1,5 @@ # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,7 +19,8 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir +from gnuradio import gr +from gnuradio import filter class am_demod_cf(gr.hier_block2): """ @@ -44,13 +45,13 @@ class am_demod_cf(gr.hier_block2): MAG = gr.complex_to_mag() DCR = gr.add_const_ff(-1.0) - audio_taps = optfir.low_pass(0.5, # Filter gain - channel_rate, # Sample rate - audio_pass, # Audio passband - audio_stop, # Audio stopband - 0.1, # Passband ripple - 60) # Stopband attenuation - LPF = gr.fir_filter_fff(audio_decim, audio_taps) + audio_taps = filter.optfir.low_pass(0.5, # Filter gain + channel_rate, # Sample rate + audio_pass, # Audio passband + audio_stop, # Audio stopband + 0.1, # Passband ripple + 60) # Stopband attenuation + LPF = filter.fir_filter_fff(audio_decim, audio_taps) self.connect(self, MAG, DCR, LPF, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py b/gr-analog/python/fm_demod.py index cc93d5b45c..1976a076ca 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/fm_demod.py +++ b/gr-analog/python/fm_demod.py @@ -1,5 +1,5 @@ # -# Copyright 2006,2007 Free Software Foundation, Inc. +# Copyright 2006,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,10 +19,15 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir -from gnuradio.blks2impl.fm_emph import fm_deemph +from gnuradio import gr, filter +from fm_emph import fm_deemph from math import pi +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog + class fm_demod_cf(gr.hier_block2): """ Generalized FM demodulation block with deemphasis and audio @@ -49,15 +54,15 @@ class fm_demod_cf(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_float)) # Output signature k = channel_rate/(2*pi*deviation) - QUAD = gr.quadrature_demod_cf(k) + QUAD = analog.quadrature_demod_cf(k) - audio_taps = optfir.low_pass(gain, # Filter gain - channel_rate, # Sample rate - audio_pass, # Audio passband - audio_stop, # Audio stopband - 0.1, # Passband ripple - 60) # Stopband attenuation - LPF = gr.fir_filter_fff(audio_decim, audio_taps) + audio_taps = filter.optfir.low_pass(gain, # Filter gain + channel_rate, # Sample rate + audio_pass, # Audio passband + audio_stop, # Audio stopband + 0.1, # Passband ripple + 60) # Stopband attenuation + LPF = filter.fir_filter_fff(audio_decim, audio_taps) if tau is not None: DEEMPH = fm_deemph(channel_rate, tau) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py b/gr-analog/python/fm_emph.py index 080ebe151f..2821f6e3cd 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/fm_emph.py +++ b/gr-analog/python/fm_emph.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,6 @@ from gnuradio import gr, filter import math - # # 1 # H(s) = ------- @@ -53,7 +52,7 @@ class fm_deemph(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_float)) # Output signature w_p = 1/tau - w_pp = math.tan (w_p / (fs * 2)) # prewarped analog freq + w_pp = math.tan(w_p / (fs * 2)) # prewarped analog freq a1 = (w_pp - 1)/(w_pp + 1) b0 = w_pp/(1 + w_pp) @@ -66,7 +65,7 @@ class fm_deemph(gr.hier_block2): print "btaps =", btaps print "ataps =", ataps global plot1 - plot1 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True) + plot1 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True) deemph = filter.iir_filter_ffd(btaps, ataps) self.connect(self, deemph, self) @@ -145,7 +144,7 @@ class fm_preemph(gr.hier_block2): print "btaps =", btaps print "ataps =", ataps global plot2 - plot2 = gru.gnuplot_freqz (gru.freqz (btaps, ataps), fs, True) + plot2 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True) preemph = filter.iir_filter_ffd(btaps, ataps) self.connect(self, preemph, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py b/gr-analog/python/nbfm_rx.py index 40eb255e1e..b2c86db70f 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_rx.py +++ b/gr-analog/python/nbfm_rx.py @@ -1,5 +1,5 @@ # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,9 +20,14 @@ # import math -from gnuradio import gr, optfir -from gnuradio.blks2impl.fm_emph import fm_deemph -#from gnuradio.blks2impl.standard_squelch import standard_squelch +from gnuradio import gr +from gnuradio import filter +from fm_emph import fm_deemph + +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog class nbfm_rx(gr.hier_block2): def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3): @@ -59,27 +64,27 @@ class nbfm_rx(gr.hier_block2): raise ValueError, "quad_rate is not an integer multiple of audio_rate" squelch_threshold = 20 # dB - #self.squelch = gr.simple_squelch_cc(squelch_threshold, 0.001) + #self.squelch = analog.simple_squelch_cc(squelch_threshold, 0.001) # FM Demodulator input: complex; output: float k = quad_rate/(2*math.pi*max_dev) - self.quad_demod = gr.quadrature_demod_cf(k) + self.quad_demod = analog.quadrature_demod_cf(k) # FM Deemphasis IIR filter - self.deemph = fm_deemph (quad_rate, tau=tau) + self.deemph = fm_deemph(quad_rate, tau=tau) # compute FIR taps for audio filter audio_decim = quad_rate // audio_rate - audio_taps = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - 2.7e3, # Audio LPF cutoff - 0.5e3, # Transition band - gr.firdes.WIN_HAMMING) # filter type + audio_taps = filter.firdes.low_pass(1.0, # gain + quad_rate, # sampling rate + 2.7e3, # Audio LPF cutoff + 0.5e3, # Transition band + filter.firdes.WIN_HAMMING) # filter type print "len(audio_taps) =", len(audio_taps) # Decimating audio filter # input: float; output: float; taps: float - self.audio_filter = gr.fir_filter_fff(audio_decim, audio_taps) + self.audio_filter = filter.fir_filter_fff(audio_decim, audio_taps) self.connect(self, self.quad_demod, self.deemph, self.audio_filter, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py b/gr-analog/python/nbfm_tx.py index 75e96f2374..eed5bc08d0 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/nbfm_tx.py +++ b/gr-analog/python/nbfm_tx.py @@ -1,5 +1,5 @@ # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,10 +20,13 @@ # import math -from gnuradio import gr, optfir, filter -from gnuradio.blks2impl.fm_emph import fm_preemph +from gnuradio import gr, filter +from fm_emph import fm_preemph -#from gnuradio import ctcss +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog class nbfm_tx(gr.hier_block2): def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3): @@ -58,23 +61,23 @@ class nbfm_tx(gr.hier_block2): if do_interp: interp_factor = quad_rate / audio_rate - interp_taps = optfir.low_pass (interp_factor, # gain - quad_rate, # Fs - 4500, # passband cutoff - 7000, # stopband cutoff - 0.1, # passband ripple dB - 40) # stopband atten dB + interp_taps = filter.optfir.low_pass(interp_factor, # gain + quad_rate, # Fs + 4500, # passband cutoff + 7000, # stopband cutoff + 0.1, # passband ripple dB + 40) # stopband atten dB #print "len(interp_taps) =", len(interp_taps) self.interpolator = filter.interp_fir_filter_fff (interp_factor, interp_taps) - self.preemph = fm_preemph (quad_rate, tau=tau) + self.preemph = fm_preemph(quad_rate, tau=tau) k = 2 * math.pi * max_dev / quad_rate - self.modulator = gr.frequency_modulator_fc (k) + self.modulator = analog.frequency_modulator_fc(k) if do_interp: - self.connect (self, self.interpolator, self.preemph, self.modulator, self) + self.connect(self, self.interpolator, self.preemph, self.modulator, self) else: self.connect(self, self.preemph, self.modulator, self) @@ -85,5 +88,5 @@ class ctcss_gen_f(gr.hier_block2): gr.io_signature(0, 0, 0), # Input signature gr.io_signature(1, 1, gr.sizeof_float)) # Output signature - self.plgen = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, tone_freq, 0.1, 0.0) + self.plgen = analog.sig_source_f(sample_rate, gr.GR_SIN_WAVE, tone_freq, 0.1, 0.0) self.connect(self.plgen, self) diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py b/gr-analog/python/qa_agc.py index 9fd633576e..2733ed3fae 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_agc.py +++ b/gr-analog/python/qa_agc.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, gr_unittest +import analog_swig as analog import math test_output = False @@ -34,6 +35,19 @@ class test_agc (gr_unittest.TestCase): self.tb = None + def test_001_sets(self): + agc = analog.agc_cc(1e-3, 1, 1, 1000) + + agc.set_rate(1) + agc.set_reference(1.1) + agc.set_gain(1.1) + agc.set_max_gain(100) + + self.assertAlmostEqual(agc.rate(), 1) + self.assertAlmostEqual(agc.reference(), 1.1) + self.assertAlmostEqual(agc.gain(), 1.1) + self.assertAlmostEqual(agc.max_gain(), 100) + def test_001(self): ''' Test the complex AGC loop (single rate input) ''' tb = self.tb @@ -91,23 +105,36 @@ class test_agc (gr_unittest.TestCase): (1.26766037940979-0.92100900411605835j)) sampling_freq = 100 - src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100.0) - dst1 = gr.vector_sink_c () - head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) + src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, + sampling_freq * 0.10, 100.0) + dst1 = gr.vector_sink_c() + head = gr.head(gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) - agc = gr.agc_cc(1e-3, 1, 1, 1000) + agc = analog.agc_cc(1e-3, 1, 1, 1000) - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) + tb.connect(src1, head) + tb.connect(head, agc) + tb.connect(agc, dst1) if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc_cc.dat")) + tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc_cc.dat")) - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) + tb.run() + dst_data = dst1.data() + self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) + + def test_002_sets(self): + agc = analog.agc_ff(1e-3, 1, 1, 1000) + + agc.set_rate(1) + agc.set_reference(1.1) + agc.set_gain(1.1) + agc.set_max_gain(100) + + self.assertAlmostEqual(agc.rate(), 1) + self.assertAlmostEqual(agc.reference(), 1.1) + self.assertAlmostEqual(agc.gain(), 1.1) + self.assertAlmostEqual(agc.max_gain(), 100) def test_002(self): ''' Test the floating point AGC loop (single rate input) ''' @@ -166,12 +193,12 @@ class test_agc (gr_unittest.TestCase): -3.3931560516357422) sampling_freq = 100 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100.0) + src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, + sampling_freq * 0.10, 100.0) dst1 = gr.vector_sink_f () head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10)) - agc = gr.agc_ff(1e-3, 1, 1, 1000) + agc = analog.agc_ff(1e-3, 1, 1, 1000) tb.connect (src1, head) tb.connect (head, agc) @@ -184,6 +211,21 @@ class test_agc (gr_unittest.TestCase): dst_data = dst1.data () self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4) + def test_003_sets(self): + agc = analog.agc2_cc(1e-3, 1e-1, 1, 1, 1000) + + agc.set_attack_rate(1) + agc.set_decay_rate(2) + agc.set_reference(1.1) + agc.set_gain(1.1) + agc.set_max_gain(100) + + self.assertAlmostEqual(agc.attack_rate(), 1) + self.assertAlmostEqual(agc.decay_rate(), 2) + self.assertAlmostEqual(agc.reference(), 1.1) + self.assertAlmostEqual(agc.gain(), 1.1) + self.assertAlmostEqual(agc.max_gain(), 100) + def test_003(self): ''' Test the complex AGC loop (attack and decay rate inputs) ''' tb = self.tb @@ -241,23 +283,38 @@ class test_agc (gr_unittest.TestCase): (0.80901449918746948-0.5877833366394043j)) sampling_freq = 100 - src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_c () - head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) + src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, + sampling_freq * 0.10, 100) + dst1 = gr.vector_sink_c() + head = gr.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10)) - agc = gr.agc2_cc(1e-2, 1e-3, 1, 1, 1000) + agc = analog.agc2_cc(1e-2, 1e-3, 1, 1, 1000) - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) + tb.connect(src1, head) + tb.connect(head, agc) + tb.connect(agc, dst1) if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) + tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) + tb.run() + dst_data = dst1.data() + self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) + + def test_004_sets(self): + agc = analog.agc2_ff(1e-3, 1e-1, 1, 1, 1000) + + agc.set_attack_rate(1) + agc.set_decay_rate(2) + agc.set_reference(1.1) + agc.set_gain(1.1) + agc.set_max_gain(100) + + self.assertAlmostEqual(agc.attack_rate(), 1) + self.assertAlmostEqual(agc.decay_rate(), 2) + self.assertAlmostEqual(agc.reference(), 1.1) + self.assertAlmostEqual(agc.gain(), 1.1) + self.assertAlmostEqual(agc.max_gain(), 100) def test_004(self): ''' Test the floating point AGC loop (attack and decay rate inputs) ''' @@ -316,23 +373,23 @@ class test_agc (gr_unittest.TestCase): -0.61937344074249268) sampling_freq = 100 - src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_f () - head = gr.head (gr.sizeof_float, int (5*sampling_freq * 0.10)) + src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, + sampling_freq * 0.10, 100) + dst1 = gr.vector_sink_f() + head = gr.head(gr.sizeof_float, int(5*sampling_freq * 0.10)) - agc = gr.agc2_ff(1e-2, 1e-3, 1, 1, 1000) + agc = analog.agc2_ff(1e-2, 1e-3, 1, 1, 1000) - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) + tb.connect(src1, head) + tb.connect(head, agc) + tb.connect(agc, dst1) if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_float, "test_agc2_ff.dat")) + tb.connect(agc, gr.file_sink(gr.sizeof_float, "test_agc2_ff.dat")) - tb.run () - dst_data = dst1.data () - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4) + tb.run() + dst_data = dst1.data() + self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 4) def test_005(self): @@ -392,41 +449,46 @@ class test_agc (gr_unittest.TestCase): (0.80901449918746948-0.5877833366394043j)) sampling_freq = 100 - src1 = gr.sig_source_c (sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 100) - dst1 = gr.vector_sink_c () - head = gr.head (gr.sizeof_gr_complex, int (5*sampling_freq * 0.10)) + src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, + sampling_freq * 0.10, 100) + dst1 = gr.vector_sink_c() + head = gr.head(gr.sizeof_gr_complex, int(5*sampling_freq * 0.10)) - agc = gr.agc2_cc(1e-2, 1e-3, 1, 1, 1000) + agc = analog.agc2_cc(1e-2, 1e-3, 1, 1, 1000) - tb.connect (src1, head) - tb.connect (head, agc) - tb.connect (agc, dst1) + tb.connect(src1, head) + tb.connect(head, agc) + tb.connect(agc, dst1) if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) - - tb.run () - dst_data = dst1.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) + tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) + tb.run() + dst_data = dst1.data() + self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) - def test_100(self): # FIXME needs work + def test_100(self): ''' Test complex feedforward agc with constant input ''' - input_data = 16*(0.0,) + 64*(1.0,) + 64*(0.0,) - expected_result = () + + length = 8 + gain = 2 + + input_data = 8*(0.0,) + 24*(1.0,) + 24*(0.0,) + expected_result = (8+length-1)*(0.0,) + 24*(gain*1.0,) + (0,) src = gr.vector_source_c(input_data) - agc = gr.feedforward_agc_cc(16, 2.0) - dst = gr.vector_sink_c () - self.tb.connect (src, agc, dst) + agc = analog.feedforward_agc_cc(8, 2.0) + dst = gr.vector_sink_c() + self.tb.connect(src, agc, dst) if test_output == True: - self.tb.connect (agc, gr.file_sink(gr.sizeof_gr_complex, "test_feedforward_cc.dat")) + self.tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, + "test_feedforward_cc.dat")) + + self.tb.run() + dst_data = dst.data()[0:len(expected_result)] - self.tb.run () - dst_data = dst.data () - #self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) + self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) if __name__ == '__main__': diff --git a/gr-analog/python/qa_cpfsk.py b/gr-analog/python/qa_cpfsk.py new file mode 100755 index 0000000000..decf94ea3f --- /dev/null +++ b/gr-analog/python/qa_cpfsk.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog +import math + +class test_cpfsk_bc(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_cpfsk_bc_001(self): + # Test set/gets + + op = analog.cpfsk_bc(2, 1, 2) + + op.set_amplitude(2) + a = op.amplitude() + self.assertEqual(2, a) + + freq = 2*math.pi/2.0 + f = op.freq() + self.assertAlmostEqual(freq, f, 5) + + p = op.phase() + self.assertEqual(0, p) + + def test_cpfsk_bc_002(self): + src_data = 10*[0, 1] + expected_result = map(lambda x: complex(2*x-1,0), src_data) + + src = gr.vector_source_b(src_data) + op = analog.cpfsk_bc(2, 1, 2) + dst = gr.vector_sink_c() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + result_data = dst.data()[0:len(expected_result)] + self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4) + +if __name__ == '__main__': + gr_unittest.run(test_cpfsk_bc, "test_cpfsk_bc.xml") + diff --git a/gr-analog/python/qa_ctcss_squelch.py b/gr-analog/python/qa_ctcss_squelch.py new file mode 100755 index 0000000000..08d3dbfef8 --- /dev/null +++ b/gr-analog/python/qa_ctcss_squelch.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog + +class test_ctcss_squelch(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_ctcss_squelch_001(self): + # Test set/gets + + rate = 1 + rate2 = 2 + freq = 100 + level = 0.5 + length = 1 + ramp = 1 + ramp2 = 2 + gate = True + gate2 = False + + op = analog.ctcss_squelch_ff(rate, freq, level, + length, ramp, gate) + + op.set_ramp(ramp2) + r = op.ramp() + self.assertEqual(ramp2, r) + + op.set_gate(gate2) + g = op.gate() + self.assertEqual(gate2, g) + + def test_ctcss_squelch_002(self): + # Test runtime, gate=True + rate = 1 + freq = 100 + level = 0.0 + length = 1 + ramp = 1 + gate = True + + src_data = map(lambda x: float(x)/10.0, range(1, 40)) + expected_result = src_data + expected_result[0] = 0 + + src = gr.vector_source_f(src_data) + op = analog.ctcss_squelch_ff(rate, freq, level, + length, ramp, gate) + dst = gr.vector_sink_f() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + result_data = dst.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) + + def test_ctcss_squelch_003(self): + # Test runtime, gate=False + rate = 1 + freq = 100 + level = 0.5 + length = 1 + ramp = 1 + gate = False + + src_data = map(lambda x: float(x)/10.0, range(1, 40)) + src = gr.vector_source_f(src_data) + op = analog.ctcss_squelch_ff(rate, freq, level, + length, ramp, gate) + dst = gr.vector_sink_f() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + expected_result = src_data + expected_result[0:5] = [0, 0, 0, 0, 0] + + result_data = dst.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) + +if __name__ == '__main__': + gr_unittest.run(test_ctcss_squelch, "test_ctcss_squelch.xml") + diff --git a/gr-analog/python/qa_dpll.py b/gr-analog/python/qa_dpll.py new file mode 100755 index 0000000000..3ef8a6e285 --- /dev/null +++ b/gr-analog/python/qa_dpll.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog +import math + +class test_dpll_bb(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_dpll_bb_001(self): + # Test set/gets + + period = 1.0 + gain = 0.1 + op = analog.dpll_bb(period, gain) + + op.set_gain(0.2) + g = op.gain() + self.assertAlmostEqual(g, 0.2) + + f = op.freq() + self.assertEqual(1/period, f) + + d0 = 1.0 - 0.5*f; + d1 = op.decision_threshold() + self.assertAlmostEqual(d0, d1) + + p = op.phase() + self.assertEqual(0, p) + + def test_dpll_bb_002(self): + period = 4 + gain = 0.1 + + src_data = 10*((period-1)*[0,] + [1,]) + expected_result = src_data + + src = gr.vector_source_b(src_data) + op = analog.dpll_bb(period, gain) + dst = gr.vector_sink_b() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + result_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4) + +if __name__ == '__main__': + gr_unittest.run(test_dpll_bb, "test_dpll_bb.xml") + diff --git a/gr-analog/python/qa_fmdet.py b/gr-analog/python/qa_fmdet.py new file mode 100755 index 0000000000..a76ac1d247 --- /dev/null +++ b/gr-analog/python/qa_fmdet.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog +import math + +class test_fmdet_cf(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_fmdet_cf_001(self): + # Test set/gets + + fh1 = 10 + fh2 = 20 + fl1 = 1 + fl2 = 2 + scale1 = 3 + scale2 = 4 + op = analog.fmdet_cf(1, fl1, fh1, scale1) + + op.set_freq_range(fl2, fh2) + lo = op.freq_low() + hi = op.freq_high() + f = op.freq() + self.assertEqual(fl2, lo) + self.assertEqual(fh2, hi) + self.assertEqual(0, f) + + op.set_scale(scale2) + s = op.scale() + b = op.bias() + eb = 0.5*scale2*(hi + lo) / (hi - lo); + self.assertEqual(scale2, s) + self.assertAlmostEqual(eb, b) + + # FIXME: This passes QA, but the it's only based off what the + # block is saying, not what the values should actually be. + def est_fmdet_cf_002(self): + N = 100 + src = analog.sig_source_c(1, analog.GR_SIN_WAVE, 0.2, 1) + head = gr.head(gr.sizeof_gr_complex, N) + op = analog.fmdet_cf(1, 0.1, 0.3, 0.1) + dst = gr.vector_sink_f() + + self.tb.connect(src, head, op) + self.tb.connect(op, dst) + self.tb.run() + + result_data = dst.data()[4:N] + expected_result = (100-4)*[-0.21755,] + self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) + +if __name__ == '__main__': + gr_unittest.run(test_fmdet_cf, "test_fmdet_cf.xml") + diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py b/gr-analog/python/qa_frequency_modulator.py index 23459fff3f..b673b3275c 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_frequency_modulator.py +++ b/gr-analog/python/qa_frequency_modulator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010 Free Software Foundation, Inc. +# Copyright 2004,2007,2010,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,35 +21,35 @@ # from gnuradio import gr, gr_unittest +import analog_swig as analog import math def sincos(x): return math.cos(x) + math.sin(x) * 1j -class test_frequency_modulator (gr_unittest.TestCase): +class test_frequency_modulator(gr_unittest.TestCase): - def setUp (self): - self.tb = gr.top_block () + def setUp(self): + self.tb = gr.top_block() - def tearDown (self): + def tearDown(self): self.tb = None - def test_fm_001 (self): + def test_fm_001(self): pi = math.pi sensitivity = pi/4 src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0) running_sum = (pi/16, 3*pi/16, pi/4, 3*pi/16, pi/16, 0) - expected_result = tuple ([sincos (x) for x in running_sum]) - src = gr.vector_source_f (src_data) - op = gr.frequency_modulator_fc (sensitivity) - dst = gr.vector_sink_c () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5) - + expected_result = tuple([sincos(x) for x in running_sum]) + src = gr.vector_source_f(src_data) + op = analog.frequency_modulator_fc(sensitivity) + dst = gr.vector_sink_c() + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + result_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5) if __name__ == '__main__': gr_unittest.run(test_frequency_modulator, "test_frequency_modulator.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py b/gr-analog/python/qa_noise.py index e875191507..dd94fc231f 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_noise.py +++ b/gr-analog/python/qa_noise.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2007,2010 Free Software Foundation, Inc. +# Copyright 2007,2010,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, gr_unittest +import analog_swig as analog class test_noise_source(gr_unittest.TestCase): @@ -32,13 +33,13 @@ class test_noise_source(gr_unittest.TestCase): def test_001(self): # Just confirm that we can instantiate a noise source - op = gr.noise_source_f(gr.GR_GAUSSIAN, 10, 10) + op = analog.noise_source_f(analog.GR_GAUSSIAN, 10, 10) def test_002(self): # Test get methods - set_type = gr.GR_GAUSSIAN + set_type = analog.GR_GAUSSIAN set_ampl = 10 - op = gr.noise_source_f(set_type, set_ampl, 10) + op = analog.noise_source_f(set_type, set_ampl, 10) get_type = op.type() get_ampl = op.amplitude() diff --git a/gr-analog/python/qa_phase_modulator.py b/gr-analog/python/qa_phase_modulator.py new file mode 100755 index 0000000000..a9c8c84597 --- /dev/null +++ b/gr-analog/python/qa_phase_modulator.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog +import math + +def sincos(x): + return math.cos(x) + math.sin(x) * 1j + + +class test_phase_modulator(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_fm_001(self): + pi = math.pi + sensitivity = pi/4 + src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0) + expected_result = tuple([sincos(sensitivity*x) for x in src_data]) + + src = gr.vector_source_f(src_data) + op = analog.phase_modulator_fc(sensitivity) + dst = gr.vector_sink_c() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + result_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5) + +if __name__ == '__main__': + gr_unittest.run(test_phase_modulator, "test_phase_modulator.xml") + diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py b/gr-analog/python/qa_pll_carriertracking.py index 8964db53db..e383639d49 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_carriertracking.py +++ b/gr-analog/python/qa_pll_carriertracking.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2011 Free Software Foundation, Inc. +# Copyright 2004,2007,2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,9 +21,10 @@ # from gnuradio import gr, gr_unittest +import analog_swig as analog import math -class test_pll_carriertracking (gr_unittest.TestCase): +class test_pll_carriertracking(gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() @@ -31,7 +32,7 @@ class test_pll_carriertracking (gr_unittest.TestCase): def tearDown (self): self.tb = None - def test_pll_carriertracking (self): + def test_pll_carriertracking(self): expected_result = ((1.00000238419+7.21919457547e-09j), (0.998025715351+0.062790453434j), (0.992777824402+0.119947694242j), @@ -140,17 +141,17 @@ class test_pll_carriertracking (gr_unittest.TestCase): maxf = 1 minf = -1 - src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = gr.pll_carriertracking_cc(loop_bw, maxf, minf) - head = gr.head (gr.sizeof_gr_complex, int (freq)) - dst = gr.vector_sink_c () + src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0) + pll = analog.pll_carriertracking_cc(loop_bw, maxf, minf) + head = gr.head(gr.sizeof_gr_complex, int (freq)) + dst = gr.vector_sink_c() - self.tb.connect (src, pll, head) - self.tb.connect (head, dst) + self.tb.connect(src, pll, head) + self.tb.connect(head, dst) - self.tb.run () - dst_data = dst.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5) + self.tb.run() + dst_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5) if __name__ == '__main__': gr_unittest.run(test_pll_carriertracking, "test_pll_carriertracking.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py b/gr-analog/python/qa_pll_freqdet.py index 219e9b84b6..cc8757c965 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_freqdet.py +++ b/gr-analog/python/qa_pll_freqdet.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2010,2011 Free Software Foundation, Inc. +# Copyright 2004,2007,2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,9 +21,10 @@ # from gnuradio import gr, gr_unittest +import analog_swig as analog import math -class test_pll_freqdet (gr_unittest.TestCase): +class test_pll_freqdet(gr_unittest.TestCase): def setUp (self): self.tb = gr.top_block() @@ -31,7 +32,7 @@ class test_pll_freqdet (gr_unittest.TestCase): def tearDown (self): self.tb = None - def test_pll_freqdet (self): + def test_pll_freqdet(self): expected_result = (0.0, 4.33888922882e-08, 0.367369994515, @@ -140,21 +141,21 @@ class test_pll_freqdet (gr_unittest.TestCase): maxf = 1 minf = -1 - src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = gr.pll_freqdet_cf(loop_bw, maxf, minf) - head = gr.head (gr.sizeof_float, int (freq)) - dst = gr.vector_sink_f () + src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0) + pll = analog.pll_freqdet_cf(loop_bw, maxf, minf) + head = gr.head(gr.sizeof_float, int (freq)) + dst = gr.vector_sink_f() - self.tb.connect (src, pll, head) - self.tb.connect (head, dst) + self.tb.connect(src, pll, head) + self.tb.connect(head, dst) - self.tb.run () - dst_data = dst.data () + self.tb.run() + dst_data = dst.data() # convert it from normalized frequency to absolute frequency (Hz) dst_data = [i*(sampling_freq/(2*math.pi)) for i in dst_data] - self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 3) + self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 3) if __name__ == '__main__': gr_unittest.run(test_pll_freqdet, "test_pll_freqdet.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py b/gr-analog/python/qa_pll_refout.py index f319f63814..c63136bc0c 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pll_refout.py +++ b/gr-analog/python/qa_pll_refout.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2010 Free Software Foundation, Inc. +# Copyright 2004,2010,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,17 +21,18 @@ # from gnuradio import gr, gr_unittest +import analog_swig as analog import math -class test_pll_refout (gr_unittest.TestCase): +class test_pll_refout(gr_unittest.TestCase): - def setUp (self): + def setUp(self): self.tb = gr.top_block() - def tearDown (self): + def tearDown(self): self.tb = None - def test_pll_refout (self): + def test_pll_refout(self): expected_result = ((1+0j), (1+6.4087357643e-10j), (0.999985277653+0.00542619498447j), @@ -140,17 +141,17 @@ class test_pll_refout (gr_unittest.TestCase): maxf = 1 minf = -1 - src = gr.sig_source_c (sampling_freq, gr.GR_COS_WAVE, freq, 1.0) - pll = gr.pll_refout_cc(loop_bw, maxf, minf) - head = gr.head (gr.sizeof_gr_complex, int (freq)) - dst = gr.vector_sink_c () + src = analog.sig_source_c(sampling_freq, analog.GR_COS_WAVE, freq, 1.0) + pll = analog.pll_refout_cc(loop_bw, maxf, minf) + head = gr.head(gr.sizeof_gr_complex, int (freq)) + dst = gr.vector_sink_c() - self.tb.connect (src, pll, head) - self.tb.connect (head, dst) + self.tb.connect(src, pll, head) + self.tb.connect(head, dst) - self.tb.run () - dst_data = dst.data () - self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 4) + self.tb.run() + dst_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) if __name__ == '__main__': gr_unittest.run(test_pll_refout, "test_pll_refout.xml") diff --git a/gr-analog/python/qa_probe_avg_mag_sqrd.py b/gr-analog/python/qa_probe_avg_mag_sqrd.py new file mode 100755 index 0000000000..5c6c97e450 --- /dev/null +++ b/gr-analog/python/qa_probe_avg_mag_sqrd.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog +import math + +def avg_mag_sqrd_c(x, alpha): + y = [0,] + for xi in x: + tmp = alpha*(xi.real*xi.real + xi.imag*xi.imag) + (1-alpha)*y[-1] + y.append(tmp) + return y + +def avg_mag_sqrd_f(x, alpha): + y = [0,] + for xi in x: + tmp = alpha*(xi*xi) + (1-alpha)*y[-1] + y.append(tmp) + return y + +class test_probe_avg_mag_sqrd(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_c_001(self): + alpha = 0.0001 + src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, + 6.0+6.0j, 7.0+7.0j, 8.0+8.0j, 9.0+9.0j, 10.0+10.0j] + expected_result = avg_mag_sqrd_c(src_data, alpha)[-1] + + src = gr.vector_source_c(src_data) + op = analog.probe_avg_mag_sqrd_c(0, alpha) + + self.tb.connect(src, op) + self.tb.run() + + result_data = op.level() + self.assertAlmostEqual(expected_result, result_data, 5) + + def test_cf_002(self): + alpha = 0.0001 + src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, + 6.0+6.0j, 7.0+7.0j, 8.0+8.0j, 9.0+9.0j, 10.0+10.0j] + expected_result = avg_mag_sqrd_c(src_data, alpha)[0:-1] + + src = gr.vector_source_c(src_data) + op = analog.probe_avg_mag_sqrd_cf(0, alpha) + dst = gr.vector_sink_f() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + result_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5) + + def test_f_003(self): + alpha = 0.0001 + src_data = [1.0, 2.0, 3.0, 4.0, 5.0, + 6.0, 7.0, 8.0, 9.0, 10.0] + expected_result = avg_mag_sqrd_f(src_data, alpha)[-1] + + src = gr.vector_source_f(src_data) + op = analog.probe_avg_mag_sqrd_f(0, alpha) + + self.tb.connect(src, op) + self.tb.run() + + result_data = op.level() + self.assertAlmostEqual(expected_result, result_data, 5) + +if __name__ == '__main__': + gr_unittest.run(test_probe_avg_mag_sqrd, "test_probe_avg_mag_sqrd.xml") + diff --git a/gr-analog/python/qa_pwr_squelch.py b/gr-analog/python/qa_pwr_squelch.py new file mode 100755 index 0000000000..dd42c7fb90 --- /dev/null +++ b/gr-analog/python/qa_pwr_squelch.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog + +class test_pwr_squelch(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_pwr_squelch_001(self): + # Test set/gets + + alpha = 0.0001 + + thr1 = 10 + thr2 = 20 + ramp = 1 + ramp2 = 2 + gate = True + gate2 = False + + op = analog.pwr_squelch_cc(thr1, alpha, ramp, gate) + + op.set_threshold(thr2) + t = op.threshold() + self.assertEqual(thr2, t) + + op.set_ramp(ramp2) + r = op.ramp() + self.assertEqual(ramp2, r) + + op.set_gate(gate2) + g = op.gate() + self.assertEqual(gate2, g) + + def test_pwr_squelch_002(self): + # Test runtime, gate=True + alpha = 0.0001 + thr = -25 + + src_data = map(lambda x: float(x)/10.0, range(1, 40)) + src = gr.vector_source_c(src_data) + op = analog.pwr_squelch_cc(thr, alpha) + dst = gr.vector_sink_c() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + expected_result = src_data + expected_result[0:20] = 20*[0,] + + result_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4) + + def test_pwr_squelch_003(self): + # Test set/gets + + alpha = 0.0001 + + thr1 = 10 + thr2 = 20 + ramp = 1 + ramp2 = 2 + gate = True + gate2 = False + + op = analog.pwr_squelch_ff(thr1, alpha, ramp, gate) + + op.set_threshold(thr2) + t = op.threshold() + self.assertEqual(thr2, t) + + op.set_ramp(ramp2) + r = op.ramp() + self.assertEqual(ramp2, r) + + op.set_gate(gate2) + g = op.gate() + self.assertEqual(gate2, g) + + + def test_pwr_squelch_004(self): + alpha = 0.0001 + thr = -25 + + src_data = map(lambda x: float(x)/10.0, range(1, 40)) + src = gr.vector_source_f(src_data) + op = analog.pwr_squelch_ff(thr, alpha) + dst = gr.vector_sink_f() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + expected_result = src_data + expected_result[0:20] = 20*[0,] + + result_data = dst.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) + +if __name__ == '__main__': + gr_unittest.run(test_pwr_squelch, "test_pwr_squelch.xml") + diff --git a/gr-analog/python/qa_quadrature_demod.py b/gr-analog/python/qa_quadrature_demod.py new file mode 100755 index 0000000000..e38ea72a7d --- /dev/null +++ b/gr-analog/python/qa_quadrature_demod.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog +import cmath + +class test_quadrature_demod(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_quad_demod_001(self): + f = 1000.0 + fs = 8000.0 + + src_data = [] + for i in xrange(200): + ti = i/fs + src_data.append(cmath.exp(2j*cmath.pi*f*ti)) + + # f/fs is a quarter turn per sample. + # Set the gain based on this to get 1 out. + gain = 1.0/(cmath.pi/4) + + expected_result = [0,] + 199*[1.0] + + src = gr.vector_source_c(src_data) + op = analog.quadrature_demod_cf(gain) + dst = gr.vector_sink_f() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + result_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, result_data, 5) + +if __name__ == '__main__': + gr_unittest.run(test_quadrature_demod, "test_quadrature_demod.xml") + diff --git a/gr-analog/python/qa_rail_ff.py b/gr-analog/python/qa_rail_ff.py new file mode 100755 index 0000000000..5bcf01c6b7 --- /dev/null +++ b/gr-analog/python/qa_rail_ff.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog + +def clip(x, lo, hi): + if(x < lo): + return lo + elif(x > hi): + return hi + else: + return x + +class test_rail(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_rail_001(self): + # Test set/gets + + hi1 = 1 + hi2 = 2 + lo1 = -1 + lo2 = -2 + + op = analog.rail_ff(lo1, hi1) + + op.set_hi(hi2) + h = op.hi() + self.assertEqual(hi2, h) + + op.set_lo(lo2) + l = op.lo() + self.assertEqual(lo2, l) + + def test_rail_002(self): + lo = -0.75 + hi = 0.90 + src_data = [-2, -1, -0.5, -0.25, 0, 0.25, 0.5, 1, 2] + expected_result = map(lambda x: clip(x, lo, hi), src_data) + + src = gr.vector_source_f(src_data) + op = analog.rail_ff(lo, hi) + dst = gr.vector_sink_f() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + result_data = dst.data() + self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4) + +if __name__ == '__main__': + gr_unittest.run(test_rail, "test_rail.xml") + diff --git a/gr-analog/python/qa_sig_source.py b/gr-analog/python/qa_sig_source.py new file mode 100755 index 0000000000..bc48333ed1 --- /dev/null +++ b/gr-analog/python/qa_sig_source.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python +# +# Copyright 2004,2007,2010,2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog +import math + +class test_sig_source(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_const_f(self): + tb = self.tb + expected_result = (1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5) + src1 = analog.sig_source_f(1e6, analog.GR_CONST_WAVE, 0, 1.5) + op = gr.head(gr.sizeof_float, 10) + dst1 = gr.vector_sink_f() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_const_i(self): + tb = self.tb + expected_result = (1, 1, 1, 1) + src1 = analog.sig_source_i(1e6, analog.GR_CONST_WAVE, 0, 1) + op = gr.head(gr.sizeof_int, 4) + dst1 = gr.vector_sink_i() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_sine_f(self): + tb = self.tb + sqrt2 = math.sqrt(2) / 2 + expected_result = (0, sqrt2, 1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0) + src1 = analog.sig_source_f(8, analog.GR_SIN_WAVE, 1.0, 1.0) + op = gr.head(gr.sizeof_float, 9) + dst1 = gr.vector_sink_f() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) + + def test_cosine_f(self): + tb = self.tb + sqrt2 = math.sqrt(2) / 2 + expected_result = (1, sqrt2, 0, -sqrt2, -1, -sqrt2, 0, sqrt2, 1) + src1 = analog.sig_source_f(8, analog.GR_COS_WAVE, 1.0, 1.0) + op = gr.head(gr.sizeof_float, 9) + dst1 = gr.vector_sink_f() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) + + def test_sqr_c(self): + tb = self.tb #arg6 is a bit before -PI/2 + expected_result = (1j, 1j, 0, 0, 1, 1, 1+0j, 1+1j, 1j) + src1 = analog.sig_source_c(8, analog.GR_SQR_WAVE, 1.0, 1.0) + op = gr.head(gr.sizeof_gr_complex, 9) + dst1 = gr.vector_sink_c() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_tri_c(self): + tb = self.tb + expected_result = (1+.5j, .75+.75j, .5+1j, .25+.75j, 0+.5j, + .25+.25j, .5+0j, .75+.25j, 1+.5j) + src1 = analog.sig_source_c(8, analog.GR_TRI_WAVE, 1.0, 1.0) + op = gr.head(gr.sizeof_gr_complex, 9) + dst1 = gr.vector_sink_c() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5) + + def test_saw_c(self): + tb = self.tb + expected_result = (.5+.25j, .625+.375j, .75+.5j, .875+.625j, + 0+.75j, .125+.875j, .25+1j, .375+.125j, .5+.25j) + src1 = analog.sig_source_c(8, analog.GR_SAW_WAVE, 1.0, 1.0) + op = gr.head(gr.sizeof_gr_complex, 9) + dst1 = gr.vector_sink_c() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 5) + + def test_sqr_f(self): + tb = self.tb + expected_result = (0, 0, 0, 0, 1, 1, 1, 1, 0) + src1 = analog.sig_source_f(8, analog.GR_SQR_WAVE, 1.0, 1.0) + op = gr.head(gr.sizeof_float, 9) + dst1 = gr.vector_sink_f() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertEqual(expected_result, dst_data) + + def test_tri_f(self): + tb = self.tb + expected_result = (1, .75, .5, .25, 0, .25, .5, .75, 1) + src1 = analog.sig_source_f(8, analog.GR_TRI_WAVE, 1.0, 1.0) + op = gr.head(gr.sizeof_float, 9) + dst1 = gr.vector_sink_f() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) + + def test_saw_f(self): + tb = self.tb + expected_result = (.5, .625, .75, .875, 0, .125, .25, .375, .5) + src1 = analog.sig_source_f(8, analog.GR_SAW_WAVE, 1.0, 1.0) + op = gr.head(gr.sizeof_float, 9) + dst1 = gr.vector_sink_f() + tb.connect(src1, op) + tb.connect(op, dst1) + tb.run() + dst_data = dst1.data() + self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 5) + +if __name__ == '__main__': + gr_unittest.run(test_sig_source, "test_sig_source.xml") diff --git a/gr-analog/python/qa_simple_squelch.py b/gr-analog/python/qa_simple_squelch.py new file mode 100755 index 0000000000..9fa112864f --- /dev/null +++ b/gr-analog/python/qa_simple_squelch.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import analog_swig as analog + +class test_simple_squelch(gr_unittest.TestCase): + + def setUp(self): + self.tb = gr.top_block() + + def tearDown(self): + self.tb = None + + def test_simple_squelch_001(self): + # Test set/gets + + alpha = 0.0001 + + thr1 = 10 + thr2 = 20 + + op = analog.simple_squelch_cc(thr1, alpha) + + op.set_threshold(thr2) + t = op.threshold() + self.assertEqual(thr2, t) + + def test_simple_squelch_002(self): + alpha = 0.0001 + thr = -25 + + src_data = map(lambda x: float(x)/10.0, range(1, 40)) + src = gr.vector_source_c(src_data) + op = analog.simple_squelch_cc(thr, alpha) + dst = gr.vector_sink_c() + + self.tb.connect(src, op) + self.tb.connect(op, dst) + self.tb.run() + + expected_result = src_data + expected_result[0:20] = 20*[0,] + + result_data = dst.data() + self.assertComplexTuplesAlmostEqual(expected_result, result_data, 4) + +if __name__ == '__main__': + gr_unittest.run(test_simple_squelch, "test_simple_squelch.xml") + diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py b/gr-analog/python/standard_squelch.py index bd7fb535ae..986397a48e 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/standard_squelch.py +++ b/gr-analog/python/standard_squelch.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,8 @@ # import math -from gnuradio import gr, optfir +from gnuradio import gr +from gnuradio import filter class standard_squelch(gr.hier_block2): def __init__(self, audio_rate): @@ -30,41 +31,41 @@ class standard_squelch(gr.hier_block2): self.input_node = gr.add_const_ff(0) # FIXME kludge - self.low_iir = gr.iir_filter_ffd((0.0193,0,-0.0193),(1,1.9524,-0.9615)) + self.low_iir = filter.iir_filter_ffd((0.0193,0,-0.0193),(1,1.9524,-0.9615)) self.low_square = gr.multiply_ff() - self.low_smooth = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) # 100ms time constant + self.low_smooth = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) # 100ms time constant - self.hi_iir = gr.iir_filter_ffd((0.0193,0,-0.0193),(1,1.3597,-0.9615)) + self.hi_iir = filter.iir_filter_ffd((0.0193,0,-0.0193),(1,1.3597,-0.9615)) self.hi_square = gr.multiply_ff() - self.hi_smooth = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) + self.hi_smooth = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) self.sub = gr.sub_ff(); self.add = gr.add_ff(); self.gate = gr.threshold_ff(0.3,0.43,0) - self.squelch_lpf = gr.single_pole_iir_filter_ff(1/(0.01*audio_rate)) + self.squelch_lpf = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) self.div = gr.divide_ff() self.squelch_mult = gr.multiply_ff() - self.connect (self, self.input_node) - self.connect (self.input_node, (self.squelch_mult, 0)) + self.connect(self, self.input_node) + self.connect(self.input_node, (self.squelch_mult, 0)) - self.connect (self.input_node,self.low_iir) - self.connect (self.low_iir,(self.low_square,0)) - self.connect (self.low_iir,(self.low_square,1)) - self.connect (self.low_square,self.low_smooth,(self.sub,0)) - self.connect (self.low_smooth, (self.add,0)) + self.connect(self.input_node,self.low_iir) + self.connect(self.low_iir,(self.low_square,0)) + self.connect(self.low_iir,(self.low_square,1)) + self.connect(self.low_square,self.low_smooth,(self.sub,0)) + self.connect(self.low_smooth, (self.add,0)) - self.connect (self.input_node,self.hi_iir) - self.connect (self.hi_iir,(self.hi_square,0)) - self.connect (self.hi_iir,(self.hi_square,1)) - self.connect (self.hi_square,self.hi_smooth,(self.sub,1)) - self.connect (self.hi_smooth, (self.add,1)) + self.connect(self.input_node,self.hi_iir) + self.connect(self.hi_iir,(self.hi_square,0)) + self.connect(self.hi_iir,(self.hi_square,1)) + self.connect(self.hi_square,self.hi_smooth,(self.sub,1)) + self.connect(self.hi_smooth, (self.add,1)) - self.connect (self.sub, (self.div, 0)) - self.connect (self.add, (self.div, 1)) - self.connect (self.div, self.gate, self.squelch_lpf, (self.squelch_mult,1)) - self.connect (self.squelch_mult, self) + self.connect(self.sub, (self.div, 0)) + self.connect(self.add, (self.div, 1)) + self.connect(self.div, self.gate, self.squelch_lpf, (self.squelch_mult,1)) + self.connect(self.squelch_mult, self) def set_threshold(self, threshold): self.gate.set_hi(threshold) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py b/gr-analog/python/wfm_rcv.py index fe4fdd1a6a..d35d219275 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv.py +++ b/gr-analog/python/wfm_rcv.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,10 +19,15 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr -from gnuradio.blks2impl.fm_emph import fm_deemph +from gnuradio import gr, filter +from fm_emph import fm_deemph import math +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog + class wfm_rcv(gr.hier_block2): def __init__ (self, quad_rate, audio_decimation): """ @@ -50,19 +55,19 @@ class wfm_rcv(gr.hier_block2): # if they need to. E.g., to plot its output. # # input: complex; output: float - self.fm_demod = gr.quadrature_demod_cf (fm_demod_gain) + self.fm_demod = analog.quadrature_demod_cf(fm_demod_gain) # input: float; output: float - self.deemph = fm_deemph (audio_rate) + self.deemph = fm_deemph(audio_rate) # compute FIR filter taps for audio filter width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0, # gain - quad_rate, # sampling rate - audio_rate/2 - width_of_transition_band, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0, # gain + quad_rate, # sampling rate + audio_rate/2 - width_of_transition_band, + width_of_transition_band, + filter.firdes.WIN_HAMMING) # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) + self.audio_filter = filter.fir_filter_fff(audio_decimation, audio_coeffs) self.connect (self, self.fm_demod, self.audio_filter, self.deemph, self) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py b/gr-analog/python/wfm_rcv_fmdet.py index 24c710a494..0fc9de1b88 100755..100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_fmdet.py +++ b/gr-analog/python/wfm_rcv_fmdet.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006 Free Software Foundation, Inc. +# Copyright 2005,2006,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,10 +19,15 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr -from gnuradio.blks2impl.fm_emph import fm_deemph +from gnuradio import gr, filter +from fm_emph import fm_deemph import math +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog + class wfm_rcv_fmdet(gr.hier_block2): def __init__ (self, demod_rate, audio_decimation): """ @@ -48,22 +53,22 @@ class wfm_rcv_fmdet(gr.hier_block2): # # input: complex; output: float - self.fm_demod = gr.fmdet_cf (demod_rate, lowfreq, highfreq, 0.05) + self.fm_demod = analog.fmdet_cf(demod_rate, lowfreq, highfreq, 0.05) # input: float; output: float - self.deemph_Left = fm_deemph (audio_rate) - self.deemph_Right = fm_deemph (audio_rate) + self.deemph_Left = fm_deemph(audio_rate) + self.deemph_Right = fm_deemph(audio_rate) # compute FIR filter taps for audio filter width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0 , # gain - demod_rate, # sampling rate - 15000 , - width_of_transition_band, - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0 , # gain + demod_rate, # sampling rate + 15000 , + width_of_transition_band, + filter.firdes.WIN_HAMMING) # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) + self.audio_filter = filter.fir_filter_fff(audio_decimation, audio_coeffs) if 1: # Pick off the stereo carrier/2 with this filter. It # attenuated 10 dB so apply 10 dB gain We pick off the @@ -72,12 +77,13 @@ class wfm_rcv_fmdet(gr.hier_block2): ## NOTE THIS WAS HACKED TO OFFSET INSERTION LOSS DUE TO ## DEEMPHASIS - stereo_carrier_filter_coeffs = gr.firdes.complex_band_pass(10.0, - demod_rate, - -19020, - -18980, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_carrier_filter_coeffs = \ + filter.firdes.complex_band_pass(10.0, + demod_rate, + -19020, + -18980, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo carrier filter = ",len(stereo_carrier_filter_coeffs) #print "stereo carrier filter ", stereo_carrier_filter_coeffs @@ -87,37 +93,41 @@ class wfm_rcv_fmdet(gr.hier_block2): # Left-Right audio. It is attenuated 10 dB so apply 10 dB # gain - stereo_dsbsc_filter_coeffs = gr.firdes.complex_band_pass(20.0, - demod_rate, - 38000-15000/2, - 38000+15000/2, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_dsbsc_filter_coeffs = \ + filter.firdes.complex_band_pass(20.0, + demod_rate, + 38000-15000/2, + 38000+15000/2, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs # construct overlap add filter system from coefficients # for stereo carrier - self.stereo_carrier_filter = gr.fir_filter_fcc(audio_decimation, - stereo_carrier_filter_coeffs) + self.stereo_carrier_filter = \ + filter.fir_filter_fcc(audio_decimation, + stereo_carrier_filter_coeffs) # carrier is twice the picked off carrier so arrange to do # a commplex multiply self.stereo_carrier_generator = gr.multiply_cc(); # Pick off the rds signal - stereo_rds_filter_coeffs = gr.firdes.complex_band_pass(30.0, - demod_rate, - 57000 - 1500, - 57000 + 1500, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_rds_filter_coeffs = \ + filter.firdes.complex_band_pass(30.0, + demod_rate, + 57000 - 1500, + 57000 + 1500, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs # construct overlap add filter system from coefficients for stereo carrier - self.rds_signal_filter = gr.fir_filter_fcc(audio_decimation, - stereo_rds_filter_coeffs) + self.rds_signal_filter = \ + filter.fir_filter_fcc(audio_decimation, + stereo_rds_filter_coeffs) self.rds_carrier_generator = gr.multiply_cc(); self.rds_signal_generator = gr.multiply_cc(); self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex); @@ -125,9 +135,9 @@ class wfm_rcv_fmdet(gr.hier_block2): loop_bw = 2*math.pi/100.0 max_freq = -2.0*math.pi*18990/audio_rate; min_freq = -2.0*math.pi*19010/audio_rate; - self.stereo_carrier_pll_recovery = gr.pll_refout_cc(loop_bw, - max_freq, - min_freq); + self.stereo_carrier_pll_recovery = analog.pll_refout_cc(loop_bw, + max_freq, + min_freq); #self.stereo_carrier_pll_recovery.squelch_enable(False) ##pll_refout does not have squelch yet, so disabled for @@ -145,54 +155,55 @@ class wfm_rcv_fmdet(gr.hier_block2): self.Make_Left = gr.add_ff(); self.Make_Right = gr.sub_ff(); - self.stereo_dsbsc_filter = gr.fir_filter_fcc(audio_decimation, - stereo_dsbsc_filter_coeffs) + self.stereo_dsbsc_filter = \ + filter.fir_filter_fcc(audio_decimation, + stereo_dsbsc_filter_coeffs) if 1: # send the real signal to complex filter to pick off the # carrier and then to one side of a multiplier - self.connect (self, self.fm_demod, self.stereo_carrier_filter, - self.stereo_carrier_pll_recovery, - (self.stereo_carrier_generator,0)) + self.connect(self, self.fm_demod, self.stereo_carrier_filter, + self.stereo_carrier_pll_recovery, + (self.stereo_carrier_generator,0)) # send the already filtered carrier to the otherside of the carrier # the resulting signal from this multiplier is the carrier # with correct phase but at -38000 Hz. - self.connect (self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) + self.connect(self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) # send the new carrier to one side of the mixer (multiplier) - self.connect (self.stereo_carrier_generator, (self.stereo_basebander,0)) + self.connect(self.stereo_carrier_generator, (self.stereo_basebander,0)) # send the demphasized audio to the DSBSC pick off filter, the complex # DSBSC signal at +38000 Hz is sent to the other side of the mixer/multiplier # the result is BASEBANDED DSBSC with phase zero! - self.connect (self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) + self.connect(self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) # Pick off the real part since the imaginary is # theoretically zero and then to one side of a summer - self.connect (self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) + self.connect(self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) #take the same real part of the DSBSC baseband signal and #send it to negative side of a subtracter - self.connect (self.LmR_real,(self.Make_Right,1)) + self.connect(self.LmR_real,(self.Make_Right,1)) # Make rds carrier by taking the squared pilot tone and # multiplying by pilot tone - self.connect (self.stereo_basebander,(self.rds_carrier_generator,0)) - self.connect (self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) + self.connect(self.stereo_basebander,(self.rds_carrier_generator,0)) + self.connect(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) # take signal, filter off rds, send into mixer 0 channel - self.connect (self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) + self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) # take rds_carrier_generator output and send into mixer 1 # channel - self.connect (self.rds_carrier_generator,(self.rds_signal_generator,1)) + self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1)) # send basebanded rds signal and send into "processor" # which for now is a null sink - self.connect (self.rds_signal_generator,self_rds_signal_processor) + self.connect(self.rds_signal_generator,self_rds_signal_processor) if 1: diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py b/gr-analog/python/wfm_rcv_pll.py index 0b8706bf27..c26dfb4928 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_rcv_pll.py +++ b/gr-analog/python/wfm_rcv_pll.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006 Free Software Foundation, Inc. +# Copyright 2005,2006,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,12 +19,17 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr -from gnuradio.blks2impl.fm_emph import fm_deemph +from gnuradio import gr, filter +from fm_emph import fm_deemph import math +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog + class wfm_rcv_pll(gr.hier_block2): - def __init__ (self, demod_rate, audio_decimation): + def __init__(self, demod_rate, audio_decimation): """ Hierarchical block for demodulating a broadcast FM signal. @@ -48,32 +53,33 @@ class wfm_rcv_pll(gr.hier_block2): # input: complex; output: float loop_bw = 2*math.pi/100.0 max_freq = 2.0*math.pi*90e3/demod_rate - self.fm_demod = gr.pll_freqdet_cf (loop_bw, max_freq,-max_freq) + self.fm_demod = analog.pll_freqdet_cf(loop_bw, max_freq,-max_freq) # input: float; output: float - self.deemph_Left = fm_deemph (audio_rate) - self.deemph_Right = fm_deemph (audio_rate) + self.deemph_Left = fm_deemph(audio_rate) + self.deemph_Right = fm_deemph(audio_rate) # compute FIR filter taps for audio filter width_of_transition_band = audio_rate / 32 - audio_coeffs = gr.firdes.low_pass (1.0 , # gain - demod_rate, # sampling rate - 15000 , - width_of_transition_band, - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0 , # gain + demod_rate, # sampling rate + 15000 , + width_of_transition_band, + filter.firdes.WIN_HAMMING) # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) + self.audio_filter = filter.fir_filter_fff(audio_decimation, audio_coeffs) if 1: # Pick off the stereo carrier/2 with this filter. It attenuated 10 dB so apply 10 dB gain # We pick off the negative frequency half because we want to base band by it! ## NOTE THIS WAS HACKED TO OFFSET INSERTION LOSS DUE TO DEEMPHASIS - stereo_carrier_filter_coeffs = gr.firdes.complex_band_pass(10.0, - demod_rate, - -19020, - -18980, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_carrier_filter_coeffs = \ + filter.firdes.complex_band_pass(10.0, + demod_rate, + -19020, + -18980, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo carrier filter = ",len(stereo_carrier_filter_coeffs) #print "stereo carrier filter ", stereo_carrier_filter_coeffs @@ -81,17 +87,19 @@ class wfm_rcv_pll(gr.hier_block2): # Pick off the double side band suppressed carrier Left-Right audio. It is attenuated 10 dB so apply 10 dB gain - stereo_dsbsc_filter_coeffs = gr.firdes.complex_band_pass(20.0, - demod_rate, - 38000-15000/2, - 38000+15000/2, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_dsbsc_filter_coeffs = \ + filter.firdes.complex_band_pass(20.0, + demod_rate, + 38000-15000/2, + 38000+15000/2, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs # construct overlap add filter system from coefficients for stereo carrier - self.stereo_carrier_filter = gr.fir_filter_fcc(audio_decimation, stereo_carrier_filter_coeffs) + self.stereo_carrier_filter = \ + filter.fir_filter_fcc(audio_decimation, stereo_carrier_filter_coeffs) # carrier is twice the picked off carrier so arrange to do a commplex multiply @@ -99,37 +107,32 @@ class wfm_rcv_pll(gr.hier_block2): # Pick off the rds signal - stereo_rds_filter_coeffs = gr.firdes.complex_band_pass(30.0, - demod_rate, - 57000 - 1500, - 57000 + 1500, - width_of_transition_band, - gr.firdes.WIN_HAMMING) + stereo_rds_filter_coeffs = \ + filter.firdes.complex_band_pass(30.0, + demod_rate, + 57000 - 1500, + 57000 + 1500, + width_of_transition_band, + filter.firdes.WIN_HAMMING) #print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs) #print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs # construct overlap add filter system from coefficients for stereo carrier - self.rds_signal_filter = gr.fir_filter_fcc(audio_decimation, stereo_rds_filter_coeffs) - - - - - + self.rds_signal_filter = \ + filter.fir_filter_fcc(audio_decimation, stereo_rds_filter_coeffs) self.rds_carrier_generator = gr.multiply_cc(); self.rds_signal_generator = gr.multiply_cc(); self_rds_signal_processor = gr.null_sink(gr.sizeof_gr_complex); - - loop_bw = 2*math.pi/100.0 max_freq = -2.0*math.pi*18990/audio_rate; min_freq = -2.0*math.pi*19010/audio_rate; - self.stereo_carrier_pll_recovery = gr.pll_refout_cc(loop_bw, max_freq, min_freq); + self.stereo_carrier_pll_recovery = \ + analog.pll_refout_cc(loop_bw, max_freq, min_freq); #self.stereo_carrier_pll_recovery.squelch_enable(False) #pll_refout does not have squelch yet, so disabled for now - # set up mixer (multiplier) to get the L-R signal at baseband self.stereo_basebander = gr.multiply_cc(); @@ -140,38 +143,39 @@ class wfm_rcv_pll(gr.hier_block2): self.Make_Left = gr.add_ff(); self.Make_Right = gr.sub_ff(); - self.stereo_dsbsc_filter = gr.fir_filter_fcc(audio_decimation, stereo_dsbsc_filter_coeffs) - + self.stereo_dsbsc_filter = \ + filter.fir_filter_fcc(audio_decimation, stereo_dsbsc_filter_coeffs) if 1: # send the real signal to complex filter to pick off the carrier and then to one side of a multiplier - self.connect (self, self.fm_demod,self.stereo_carrier_filter,self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,0)) + self.connect(self, self.fm_demod, self.stereo_carrier_filter, + self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,0)) # send the already filtered carrier to the otherside of the carrier - self.connect (self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) + self.connect(self.stereo_carrier_pll_recovery, (self.stereo_carrier_generator,1)) # the resulting signal from this multiplier is the carrier with correct phase but at -38000 Hz. # send the new carrier to one side of the mixer (multiplier) - self.connect (self.stereo_carrier_generator, (self.stereo_basebander,0)) + self.connect(self.stereo_carrier_generator, (self.stereo_basebander,0)) # send the demphasized audio to the DSBSC pick off filter, the complex # DSBSC signal at +38000 Hz is sent to the other side of the mixer/multiplier - self.connect (self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) + self.connect(self.fm_demod,self.stereo_dsbsc_filter, (self.stereo_basebander,1)) # the result is BASEBANDED DSBSC with phase zero! # Pick off the real part since the imaginary is theoretically zero and then to one side of a summer - self.connect (self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) + self.connect(self.stereo_basebander, self.LmR_real, (self.Make_Left,0)) #take the same real part of the DSBSC baseband signal and send it to negative side of a subtracter - self.connect (self.LmR_real,(self.Make_Right,1)) + self.connect(self.LmR_real,(self.Make_Right,1)) # Make rds carrier by taking the squared pilot tone and multiplying by pilot tone - self.connect (self.stereo_basebander,(self.rds_carrier_generator,0)) - self.connect (self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) + self.connect(self.stereo_basebander,(self.rds_carrier_generator,0)) + self.connect(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1)) # take signal, filter off rds, send into mixer 0 channel - self.connect (self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) + self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0)) # take rds_carrier_generator output and send into mixer 1 channel - self.connect (self.rds_carrier_generator,(self.rds_signal_generator,1)) + self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1)) # send basebanded rds signal and send into "processor" which for now is a null sink - self.connect (self.rds_signal_generator,self_rds_signal_processor) + self.connect(self.rds_signal_generator,self_rds_signal_processor) if 1: diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py b/gr-analog/python/wfm_tx.py index e7547d6524..be662310db 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/wfm_tx.py +++ b/gr-analog/python/wfm_tx.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,8 +20,14 @@ # import math -from gnuradio import gr, optfir -from gnuradio.blks2impl.fm_emph import fm_preemph +from gnuradio import gr +from gnuradio import filter +from fm_emph import fm_preemph + +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog class wfm_tx(gr.hier_block2): def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=75e3): @@ -55,22 +61,22 @@ class wfm_tx(gr.hier_block2): if do_interp: interp_factor = quad_rate / audio_rate - interp_taps = optfir.low_pass (interp_factor, # gain - quad_rate, # Fs - 16000, # passband cutoff - 18000, # stopband cutoff - 0.1, # passband ripple dB - 40) # stopband atten dB + interp_taps = filter.optfir.low_pass(interp_factor, # gain + quad_rate, # Fs + 16000, # passband cutoff + 18000, # stopband cutoff + 0.1, # passband ripple dB + 40) # stopband atten dB print "len(interp_taps) =", len(interp_taps) - self.interpolator = gr.interp_fir_filter_fff (interp_factor, interp_taps) + self.interpolator = filter.interp_fir_filter_fff (interp_factor, interp_taps) - self.preemph = fm_preemph (quad_rate, tau=tau) + self.preemph = fm_preemph(quad_rate, tau=tau) k = 2 * math.pi * max_dev / quad_rate - self.modulator = gr.frequency_modulator_fc (k) + self.modulator = analog.frequency_modulator_fc (k) if do_interp: - self.connect (self, self.interpolator, self.preemph, self.modulator, self) + self.connect(self, self.interpolator, self.preemph, self.modulator, self) else: self.connect(self, self.preemph, self.modulator, self) diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i index 0ce6854ca1..5171af09bb 100644 --- a/gr-analog/swig/analog_swig.i +++ b/gr-analog/swig/analog_swig.i @@ -22,14 +22,114 @@ #define ANALOG_API %include "gnuradio.i" +%include "stdint.i" //load generated python docstrings %include "analog_swig_doc.i" %{ #include "analog/cpm.h" +#include "analog/noise_type.h" +#include "analog/agc_cc.h" +#include "analog/agc_ff.h" +#include "analog/agc2_cc.h" +#include "analog/agc2_ff.h" +#include "analog/cpfsk_bc.h" +#include "analog/ctcss_squelch_ff.h" +#include "analog/dpll_bb.h" +#include "analog/feedforward_agc_cc.h" +#include "analog/fmdet_cf.h" +#include "analog/frequency_modulator_fc.h" +#include "analog/noise_source_s.h" +#include "analog/noise_source_i.h" +#include "analog/noise_source_f.h" +#include "analog/noise_source_c.h" +#include "analog/phase_modulator_fc.h" +#include "analog/pll_carriertracking_cc.h" +#include "analog/pll_freqdet_cf.h" +#include "analog/pll_refout_cc.h" +#include "analog/probe_avg_mag_sqrd_c.h" +#include "analog/probe_avg_mag_sqrd_cf.h" +#include "analog/probe_avg_mag_sqrd_f.h" +#include "analog/pwr_squelch_cc.h" +#include "analog/pwr_squelch_ff.h" +#include "analog/quadrature_demod_cf.h" +#include "analog/rail_ff.h" +#include "analog/sincos.h" +#include "analog/sig_source_s.h" +#include "analog/sig_source_i.h" +#include "analog/sig_source_f.h" +#include "analog/sig_source_c.h" +#include "analog/sig_source_waveform.h" +#include "analog/simple_squelch_cc.h" +#include "analog/squelch_base_cc.h" +#include "analog/squelch_base_ff.h" %} %include "analog/cpm.h" +%include "analog/noise_type.h" +%include "analog/agc_cc.h" +%include "analog/agc_ff.h" +%include "analog/agc2_cc.h" +%include "analog/agc2_ff.h" +%include "analog/cpfsk_bc.h" +%include "analog/ctcss_squelch_ff.h" +%include "analog/dpll_bb.h" +%include "analog/feedforward_agc_cc.h" +%include "analog/fmdet_cf.h" +%include "analog/frequency_modulator_fc.h" +%include "analog/noise_source_s.h" +%include "analog/noise_source_i.h" +%include "analog/noise_source_f.h" +%include "analog/noise_source_c.h" +%include "analog/phase_modulator_fc.h" +%include "analog/pll_carriertracking_cc.h" +%include "analog/pll_freqdet_cf.h" +%include "analog/pll_refout_cc.h" +%include "analog/probe_avg_mag_sqrd_c.h" +%include "analog/probe_avg_mag_sqrd_cf.h" +%include "analog/probe_avg_mag_sqrd_f.h" +%include "analog/pwr_squelch_cc.h" +%include "analog/pwr_squelch_ff.h" +%include "analog/quadrature_demod_cf.h" +%include "analog/rail_ff.h" +%include "analog/sincos.h" +%include "analog/sig_source_s.h" +%include "analog/sig_source_i.h" +%include "analog/sig_source_f.h" +%include "analog/sig_source_c.h" +%include "analog/sig_source_waveform.h" +%include "analog/simple_squelch_cc.h" +%include "analog/squelch_base_cc.h" +%include "analog/squelch_base_ff.h" -//GR_SWIG_BLOCK_MAGIC2(); +GR_SWIG_BLOCK_MAGIC2(analog, agc_cc); +GR_SWIG_BLOCK_MAGIC2(analog, agc_ff); +GR_SWIG_BLOCK_MAGIC2(analog, agc2_cc); +GR_SWIG_BLOCK_MAGIC2(analog, agc2_ff); +GR_SWIG_BLOCK_MAGIC2(analog, cpfsk_bc); +GR_SWIG_BLOCK_MAGIC2(analog, ctcss_squelch_ff); +GR_SWIG_BLOCK_MAGIC2(analog, dpll_bb); +GR_SWIG_BLOCK_MAGIC2(analog, feedforward_agc_cc); +GR_SWIG_BLOCK_MAGIC2(analog, fmdet_cf); +GR_SWIG_BLOCK_MAGIC2(analog, frequency_modulator_fc); +GR_SWIG_BLOCK_MAGIC2(analog, noise_source_s); +GR_SWIG_BLOCK_MAGIC2(analog, noise_source_i); +GR_SWIG_BLOCK_MAGIC2(analog, noise_source_f); +GR_SWIG_BLOCK_MAGIC2(analog, noise_source_c); +GR_SWIG_BLOCK_MAGIC2(analog, phase_modulator_fc); +GR_SWIG_BLOCK_MAGIC2(analog, pll_carriertracking_cc); +GR_SWIG_BLOCK_MAGIC2(analog, pll_freqdet_cf); +GR_SWIG_BLOCK_MAGIC2(analog, pll_refout_cc); +GR_SWIG_BLOCK_MAGIC2(analog, probe_avg_mag_sqrd_c); +GR_SWIG_BLOCK_MAGIC2(analog, probe_avg_mag_sqrd_cf); +GR_SWIG_BLOCK_MAGIC2(analog, probe_avg_mag_sqrd_f); +GR_SWIG_BLOCK_MAGIC2(analog, pwr_squelch_cc); +GR_SWIG_BLOCK_MAGIC2(analog, pwr_squelch_ff); +GR_SWIG_BLOCK_MAGIC2(analog, quadrature_demod_cf); +GR_SWIG_BLOCK_MAGIC2(analog, rail_ff); +GR_SWIG_BLOCK_MAGIC2(analog, sig_source_s); +GR_SWIG_BLOCK_MAGIC2(analog, sig_source_i); +GR_SWIG_BLOCK_MAGIC2(analog, sig_source_f); +GR_SWIG_BLOCK_MAGIC2(analog, sig_source_c); +GR_SWIG_BLOCK_MAGIC2(analog, simple_squelch_cc); diff --git a/gr-atsc/CMakeLists.txt b/gr-atsc/CMakeLists.txt index 3cb9b39de8..c9a033fc1a 100644 --- a/gr-atsc/CMakeLists.txt +++ b/gr-atsc/CMakeLists.txt @@ -31,6 +31,7 @@ GR_REGISTER_COMPONENT("gr-atsc" ENABLE_GR_ATSC ENABLE_GR_CORE ENABLE_GR_FFT ENABLE_GR_FILTER + ENABLE_GR_ANALOG ) GR_SET_GLOBAL(GR_ATSC_INCLUDE_DIRS diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt index 386a8792db..6fc588b8a3 100644 --- a/gr-atsc/src/lib/CMakeLists.txt +++ b/gr-atsc/src/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011-212 Free Software Foundation, Inc. +# Copyright 2011-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ include_directories( ${GNURADIO_CORE_INCLUDE_DIRS} ${GR_FILTER_INCLUDE_DIRS} + ${GR_ANALOG_INCLUDE_DIRS} ${GR_ATSC_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) @@ -97,6 +98,7 @@ list(APPEND gr_atsc_sources list(APPEND atsc_libs gnuradio-filter + gnuradio-analog gnuradio-core ${Boost_LIBRARIES} ) diff --git a/gr-atsc/src/lib/atsc_fpll.h b/gr-atsc/src/lib/atsc_fpll.h index 0474b8f766..13099b045d 100644 --- a/gr-atsc/src/lib/atsc_fpll.h +++ b/gr-atsc/src/lib/atsc_fpll.h @@ -25,11 +25,13 @@ #include <atsc_api.h> #include <gr_sync_block.h> #include <gr_nco.h> -#include <gr_single_pole_iir.h> -#include <gri_agc_ff.h> +#include <filter/single_pole_iir.h> +#include <analog/agc.h> #include <stdio.h> #include <atsci_diag_output.h> +using namespace gr; + class atsc_fpll; typedef boost::shared_ptr<atsc_fpll> atsc_fpll_sptr; @@ -68,9 +70,9 @@ public: double initial_phase; bool debug_no_update; gr_nco<float,float> nco; - gri_agc_ff agc; // automatic gain control - gr_single_pole_iir<float,float,float> afci; - gr_single_pole_iir<float,float,float> afcq; + analog::kernel::agc_ff agc; // automatic gain control + filter::single_pole_iir<float,float,float> afci; + filter::single_pole_iir<float,float,float> afcq; }; diff --git a/gr-audio/CMakeLists.txt b/gr-audio/CMakeLists.txt index 35fd7fc23d..b264222444 100644 --- a/gr-audio/CMakeLists.txt +++ b/gr-audio/CMakeLists.txt @@ -87,7 +87,6 @@ CPACK_COMPONENT("audio_swig" add_subdirectory(include) add_subdirectory(lib) add_subdirectory(doc) -add_subdirectory(examples/c++) if(ENABLE_PYTHON) add_subdirectory(swig) add_subdirectory(grc) @@ -95,6 +94,10 @@ if(ENABLE_PYTHON) add_subdirectory(examples/grc) endif(ENABLE_PYTHON) +if(ENABLE_GR_ANALOG) + add_subdirectory(examples/c++) +endif(ENABLE_GR_ANALOG) + ######################################################################## # Create Pkg Config File ######################################################################## diff --git a/gr-audio/examples/c++/CMakeLists.txt b/gr-audio/examples/c++/CMakeLists.txt index f0d45817cb..6f3eda2730 100644 --- a/gr-audio/examples/c++/CMakeLists.txt +++ b/gr-audio/examples/c++/CMakeLists.txt @@ -19,8 +19,9 @@ include_directories(${GR_AUDIO_INCLUDE_DIRS}) include_directories(${GNURADIO_CORE_INCLUDE_DIRS}) +include_directories(${GR_ANALOG_INCLUDE_DIRS}) add_executable(dial_tone dial_tone.cc) -target_link_libraries(dial_tone gnuradio-audio) +target_link_libraries(dial_tone gnuradio-audio gnuradio-analog) INSTALL(TARGETS dial_tone diff --git a/gr-audio/examples/c++/dial_tone.cc b/gr-audio/examples/c++/dial_tone.cc index 4cd0ff59cf..801ff35f2e 100644 --- a/gr-audio/examples/c++/dial_tone.cc +++ b/gr-audio/examples/c++/dial_tone.cc @@ -38,9 +38,11 @@ // Include header files for each block used in flowgraph #include <gr_top_block.h> -#include <gr_sig_source_f.h> +#include <analog/sig_source_f.h> #include <gr_audio_sink.h> +using namespace gr; + int main(int argc, char **argv) { int rate = 48000; // Audio card sample rate @@ -52,8 +54,8 @@ int main(int argc, char **argv) gr_top_block_sptr tb = gr_make_top_block("dial_tone"); // Construct a real-valued signal source for each tone, at given sample rate - gr_sig_source_f_sptr src0 = gr_make_sig_source_f(rate, GR_SIN_WAVE, 350, ampl); - gr_sig_source_f_sptr src1 = gr_make_sig_source_f(rate, GR_SIN_WAVE, 440, ampl); + analog::sig_source_f::sptr src0 = analog::sig_source_f::make(rate, analog::GR_SIN_WAVE, 350, ampl); + analog::sig_source_f::sptr src1 = analog::sig_source_f::make(rate, analog::GR_SIN_WAVE, 440, ampl); // Construct an audio sink to accept audio tones audio_sink::sptr sink = audio_make_sink(rate); diff --git a/gr-audio/examples/grc/cvsd_sweep.grc b/gr-audio/examples/grc/cvsd_sweep.grc index b645b747ab..b5735ddf0f 100644 --- a/gr-audio/examples/grc/cvsd_sweep.grc +++ b/gr-audio/examples/grc/cvsd_sweep.grc @@ -1,50 +1,59 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sat Sep 19 20:30:08 2009</timestamp> + <timestamp>Sat Nov 10 15:10:11 2012</timestamp> <block> - <key>import</key> + <key>options</key> <param> <key>id</key> - <value>import_0</value> + <value>cvsd_sweep</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>import</key> - <value>import math</value> + <key>title</key> + <value>CVSD Vocoder Test</value> </param> <param> - <key>_coordinate</key> - <value>(157, 11)</value> + <key>author</key> + <value></value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>description</key> + <value></value> </param> - </block> - <block> - <key>vocoder_cvsd_decode_bf</key> <param> - <key>id</key> - <value>vocoder_cvsd_decode_bf_0</value> + <key>window_size</key> + <value>1280, 1024</value> </param> <param> - <key>_enabled</key> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> <value>True</value> </param> <param> - <key>resample</key> - <value>resample</value> + <key>max_nouts</key> + <value>0</value> </param> <param> - <key>bw</key> - <value>bw</value> + <key>realtime_scheduling</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(887, 340)</value> + <value>(10, 10)</value> </param> <param> <key>_rotation</key> @@ -52,42 +61,22 @@ </param> </block> <block> - <key>gr_sig_source_x</key> + <key>import</key> <param> <key>id</key> - <value>tri_source</value> + <value>import_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_TRI_WAVE</value> - </param> - <param> - <key>freq</key> - <value>0.05</value> - </param> - <param> - <key>amp</key> - <value>0.5</value> - </param> - <param> - <key>offset</key> - <value>0</value> + <key>import</key> + <value>import math</value> </param> <param> <key>_coordinate</key> - <value>(44, 316)</value> + <value>(157, 11)</value> </param> <param> <key>_rotation</key> @@ -95,30 +84,26 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>vocoder_cvsd_decode_bf</key> <param> <key>id</key> - <value>throttle</value> + <value>vocoder_cvsd_decode_bf_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>audio_rate</value> + <key>resample</key> + <value>resample</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>bw</key> + <value>bw</value> </param> <param> <key>_coordinate</key> - <value>(238, 348)</value> + <value>(887, 340)</value> </param> <param> <key>_rotation</key> @@ -206,6 +191,10 @@ <value>gr.GR_MSB_FIRST</value> </param> <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(648, 415)</value> </param> @@ -225,6 +214,14 @@ <value>True</value> </param> <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(676, 483)</value> </param> @@ -435,6 +432,14 @@ <value>0</value> </param> <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> <key>grid_pos</key> <value>0, 0, 1, 1</value> </param> @@ -443,6 +448,10 @@ <value>displays, 0</value> </param> <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> <value>(415, 97)</value> </param> @@ -478,6 +487,10 @@ <value>0</value> </param> <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> <key>t_scale</key> <value>0</value> </param> @@ -494,6 +507,10 @@ <value>1</value> </param> <param> + <key>win_size</key> + <value></value> + </param> + <param> <key>grid_pos</key> <value>1, 0, 1, 1</value> </param> @@ -502,87 +519,16 @@ <value>displays, 0</value> </param> <param> - <key>_coordinate</key> - <value>(414, 425)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>enc_fft</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Encoded Spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>audio_rate*resample</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>8</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> </param> <param> - <key>notebook</key> - <value>displays, 1</value> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(610, 551)</value> + <value>(414, 425)</value> </param> <param> <key>_rotation</key> @@ -616,6 +562,10 @@ <value>0.5</value> </param> <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> <key>t_scale</key> <value>20.0/(audio_rate*resample)</value> </param> @@ -632,6 +582,10 @@ <value>1</value> </param> <param> + <key>win_size</key> + <value></value> + </param> + <param> <key>grid_pos</key> <value>0, 0, 1, 1</value> </param> @@ -640,6 +594,14 @@ <value>displays, 1</value> </param> <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> + </param> + <param> <key>_coordinate</key> <value>(858, 591)</value> </param> @@ -711,6 +673,14 @@ <value>0</value> </param> <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> <key>grid_pos</key> <value>0, 0, 1, 1</value> </param> @@ -719,6 +689,10 @@ <value>displays, 2</value> </param> <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> <value>(891, 98)</value> </param> @@ -754,6 +728,10 @@ <value>0</value> </param> <param> + <key>v_offset</key> + <value>0</value> + </param> + <param> <key>t_scale</key> <value>0</value> </param> @@ -770,6 +748,10 @@ <value>1</value> </param> <param> + <key>win_size</key> + <value></value> + </param> + <param> <key>grid_pos</key> <value>1, 0, 1, 1</value> </param> @@ -778,6 +760,14 @@ <value>displays, 2</value> </param> <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> + </param> + <param> <key>_coordinate</key> <value>(889, 422)</value> </param> @@ -787,56 +777,170 @@ </param> </block> <block> - <key>options</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>cvsd_sweep</value> + <value>throttle</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>title</key> - <value>CVSD Vocoder Test</value> + <key>type</key> + <value>float</value> </param> <param> - <key>author</key> - <value></value> + <key>samples_per_second</key> + <value>audio_rate</value> </param> <param> - <key>description</key> - <value></value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>window_size</key> - <value>1280, 1024</value> + <key>_coordinate</key> + <value>(238, 348)</value> </param> <param> - <key>generate_options</key> - <value>wx_gui</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>analog_sig_source_x</key> <param> - <key>category</key> - <value>Custom</value> + <key>id</key> + <value>analog_sig_source_x_0</value> </param> <param> - <key>run</key> + <key>_enabled</key> <value>True</value> </param> <param> - <key>realtime_scheduling</key> - <value></value> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samp_rate</key> + <value>audio_rate</value> + </param> + <param> + <key>waveform</key> + <value>analog.GR_TRI_WAVE</value> + </param> + <param> + <key>freq</key> + <value>0.05</value> + </param> + <param> + <key>amp</key> + <value>0.5</value> + </param> + <param> + <key>offset</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(10, 10)</value> + <value>(29, 316)</value> </param> <param> <key>_rotation</key> <value>0</value> </param> </block> + <block> + <key>wxgui_fftsink2</key> + <param> + <key>id</key> + <value>enc_fft</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Encoded Spectrum</value> + </param> + <param> + <key>samp_rate</key> + <value>audio_rate*resample</value> + </param> + <param> + <key>baseband_freq</key> + <value>0</value> + </param> + <param> + <key>y_per_div</key> + <value>10</value> + </param> + <param> + <key>y_divs</key> + <value>8</value> + </param> + <param> + <key>ref_level</key> + <value>10</value> + </param> + <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>30</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>False</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 1</value> + </param> + <param> + <key>notebook</key> + <value>displays, 1</value> + </param> + <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> + <key>_coordinate</key> + <value>(610, 559)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> <connection> <source_block_id>vco</source_block_id> <sink_block_id>orig_fft</sink_block_id> @@ -844,12 +948,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>tri_source</source_block_id> - <sink_block_id>throttle</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>throttle</source_block_id> <sink_block_id>vco</sink_block_id> <source_key>0</source_key> @@ -915,4 +1013,10 @@ <source_key>0</source_key> <sink_key>0</sink_key> </connection> + <connection> + <source_block_id>analog_sig_source_x_0</source_block_id> + <sink_block_id>throttle</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> diff --git a/gr-audio/examples/grc/dial_tone.grc b/gr-audio/examples/grc/dial_tone.grc index ac8cbef279..557edbd441 100644 --- a/gr-audio/examples/grc/dial_tone.grc +++ b/gr-audio/examples/grc/dial_tone.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jul 24 14:27:48 2008</timestamp> + <timestamp>Sat Nov 10 15:10:08 2012</timestamp> <block> <key>options</key> <param> @@ -36,39 +36,24 @@ <value>Custom</value> </param> <param> - <key>_coordinate</key> - <value>(10, 10)</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</value> + <key>run_options</key> + <value>prompt</value> </param> <param> - <key>_enabled</key> + <key>run</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>max_nouts</key> + <value>0</value> </param> <param> - <key>num_inputs</key> - <value>3</value> - </param> - <param> - <key>vlen</key> - <value>1</value> + <key>realtime_scheduling</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(513, 277)</value> + <value>(10, 10)</value> </param> <param> <key>_rotation</key> @@ -91,7 +76,7 @@ </param> <param> <key>device_name</key> - <value/> + <value></value> </param> <param> <key>ok_to_block</key> @@ -111,34 +96,54 @@ </param> </block> <block> - <key>gr_noise_source_x</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_noise_source_x</value> + <value>ampl</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>label</key> + <value>Volume</value> </param> <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> + <key>value</key> + <value>.4</value> </param> <param> - <key>amp</key> - <value>noise</value> + <key>min</key> + <value>0</value> </param> <param> - <key>seed</key> - <value>42</value> + <key>max</key> + <value>.5</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value>0, 0, 1, 2</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(238, 380)</value> + <value>(634, 413)</value> </param> <param> <key>_rotation</key> @@ -146,42 +151,54 @@ </param> </block> <block> - <key>gr_sig_source_x</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_sig_source_x</value> + <value>noise</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>label</key> + <value>Noise</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>value</key> + <value>.005</value> </param> <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> + <key>min</key> + <value>0</value> </param> <param> - <key>freq</key> - <value>440</value> + <key>max</key> + <value>.2</value> </param> <param> - <key>amp</key> - <value>ampl</value> + <key>num_steps</key> + <value>100</value> </param> <param> - <key>offset</key> - <value>0</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 1, 2</value> + </param> + <param> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(240, 208)</value> + <value>(443, 412)</value> </param> <param> <key>_rotation</key> @@ -189,42 +206,53 @@ </param> </block> <block> - <key>gr_sig_source_x</key> + <key>variable</key> <param> <key>id</key> - <value>gr_sig_source_x0</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> + <key>value</key> + <value>32000</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>_coordinate</key> + <value>(11, 171)</value> </param> <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>gr_add_xx</key> <param> - <key>freq</key> - <value>350</value> + <key>id</key> + <value>gr_add_xx</value> </param> <param> - <key>amp</key> - <value>ampl</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>offset</key> - <value>0</value> + <key>type</key> + <value>float</value> + </param> + <param> + <key>num_inputs</key> + <value>3</value> + </param> + <param> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(240, 38)</value> + <value>(513, 277)</value> </param> <param> <key>_rotation</key> @@ -232,46 +260,42 @@ </param> </block> <block> - <key>variable_slider</key> + <key>analog_sig_source_x</key> <param> <key>id</key> - <value>ampl</value> + <value>analog_sig_source_x_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Volume</value> - </param> - <param> - <key>value</key> - <value>.4</value> + <key>type</key> + <value>float</value> </param> <param> - <key>min</key> - <value>0</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>max</key> - <value>.5</value> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> </param> <param> - <key>num_steps</key> - <value>100</value> + <key>freq</key> + <value>350</value> </param> <param> - <key>slider_type</key> - <value>horizontal</value> + <key>amp</key> + <value>ampl</value> </param> <param> - <key>grid_pos</key> - <value>0, 0, 1, 2</value> + <key>offset</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(634, 413)</value> + <value>(251, 100)</value> </param> <param> <key>_rotation</key> @@ -279,46 +303,42 @@ </param> </block> <block> - <key>variable_slider</key> + <key>analog_sig_source_x</key> <param> <key>id</key> - <value>noise</value> + <value>analog_sig_source_x_1</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Noise</value> - </param> - <param> - <key>value</key> - <value>.005</value> + <key>type</key> + <value>float</value> </param> <param> - <key>min</key> - <value>0</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>max</key> - <value>.2</value> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> </param> <param> - <key>num_steps</key> - <value>100</value> + <key>freq</key> + <value>440</value> </param> <param> - <key>slider_type</key> - <value>horizontal</value> + <key>amp</key> + <value>ampl</value> </param> <param> - <key>grid_pos</key> - <value>1, 0, 1, 2</value> + <key>offset</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(443, 412)</value> + <value>(250, 214)</value> </param> <param> <key>_rotation</key> @@ -326,22 +346,34 @@ </param> </block> <block> - <key>variable</key> + <key>analog_noise_source_x</key> <param> <key>id</key> - <value>samp_rate</value> + <value>analog_noise_source_x_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>32000</value> + <key>type</key> + <value>float</value> + </param> + <param> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noise</value> + </param> + <param> + <key>seed</key> + <value>-42</value> </param> <param> <key>_coordinate</key> - <value>(11, 171)</value> + <value>(245, 342)</value> </param> <param> <key>_rotation</key> @@ -349,27 +381,27 @@ </param> </block> <connection> - <source_block_id>gr_sig_source_x0</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> + <source_block_id>gr_add_xx</source_block_id> + <sink_block_id>audio_sink</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_sig_source_x</source_block_id> + <source_block_id>analog_sig_source_x_0</source_block_id> <sink_block_id>gr_add_xx</sink_block_id> <source_key>0</source_key> - <sink_key>1</sink_key> + <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_noise_source_x</source_block_id> + <source_block_id>analog_sig_source_x_1</source_block_id> <sink_block_id>gr_add_xx</sink_block_id> <source_key>0</source_key> - <sink_key>2</sink_key> + <sink_key>1</sink_key> </connection> <connection> - <source_block_id>gr_add_xx</source_block_id> - <sink_block_id>audio_sink</sink_block_id> + <source_block_id>analog_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx</sink_block_id> <source_key>0</source_key> - <sink_key>0</sink_key> + <sink_key>2</sink_key> </connection> </flow_graph> diff --git a/gr-audio/examples/python/dial_tone.py b/gr-audio/examples/python/dial_tone.py index 5661d13d48..c55d0d38dd 100755 --- a/gr-audio/examples/python/dial_tone.py +++ b/gr-audio/examples/python/dial_tone.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,12 @@ from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + class my_top_block(gr.top_block): def __init__(self): @@ -35,7 +41,7 @@ class my_top_block(gr.top_block): help="pcm output device name. E.g., hw:0,0 or /dev/dsp") parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, help="set sample rate to RATE (48000)") - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 @@ -43,12 +49,11 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) - dst = audio.sink (sample_rate, options.audio_output) - self.connect (src0, (dst, 0)) - self.connect (src1, (dst, 1)) - + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, ampl) + src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl) + dst = audio.sink(sample_rate, options.audio_output) + self.connect(src0, (dst, 0)) + self.connect(src1, (dst, 1)) if __name__ == '__main__': try: diff --git a/gr-audio/examples/python/dial_tone_daemon.py b/gr-audio/examples/python/dial_tone_daemon.py index b25baebee2..e4dbd95321 100755 --- a/gr-audio/examples/python/dial_tone_daemon.py +++ b/gr-audio/examples/python/dial_tone_daemon.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,6 +26,12 @@ from gnuradio.eng_option import eng_option from optparse import OptionParser import os +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + class my_top_block(gr.top_block): def __init__(self): @@ -36,7 +42,7 @@ class my_top_block(gr.top_block): help="pcm output device name. E.g., hw:0,0 or /dev/dsp") parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, help="set sample rate to RATE (48000)") - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 @@ -44,12 +50,11 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) - dst = audio.sink (sample_rate, options.audio_output) - self.connect (src0, (dst, 0)) - self.connect (src1, (dst, 1)) - + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, ampl) + src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl) + dst = audio.sink(sample_rate, options.audio_output) + self.connect(src0, (dst, 0)) + self.connect(src1, (dst, 1)) if __name__ == '__main__': pid = gru.daemonize() diff --git a/gr-audio/examples/python/dial_tone_wav.py b/gr-audio/examples/python/dial_tone_wav.py index c06af55b70..4d8d6b4019 100755 --- a/gr-audio/examples/python/dial_tone_wav.py +++ b/gr-audio/examples/python/dial_tone_wav.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,6 +26,12 @@ from gnuradio import gr from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + class my_top_block(gr.top_block): def __init__(self): @@ -45,8 +51,8 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, ampl) + src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl) head0 = gr.head(gr.sizeof_float, int(options.samples)) head1 = gr.head(gr.sizeof_float, int(options.samples)) dst = gr.wavfile_sink(args[0], 2, int(options.sample_rate), 16) diff --git a/gr-audio/examples/python/mono_tone.py b/gr-audio/examples/python/mono_tone.py index bce486e4ab..ad73d62327 100755 --- a/gr-audio/examples/python/mono_tone.py +++ b/gr-audio/examples/python/mono_tone.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,12 @@ from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + #import os #print os.getpid() #raw_input('Attach gdb and press Enter: ') @@ -50,11 +56,11 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 650, ampl) + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 650, ampl) - dst = audio.sink (sample_rate, - options.audio_output, - options.ok_to_block) + dst = audio.sink(sample_rate, + options.audio_output, + options.ok_to_block) self.connect (src0, (dst, 0)) diff --git a/gr-audio/examples/python/multi_tone.py b/gr-audio/examples/python/multi_tone.py index 00c213b634..6232cbef52 100755 --- a/gr-audio/examples/python/multi_tone.py +++ b/gr-audio/examples/python/multi_tone.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2006,2007 Free Software Foundation, Inc. +# Copyright 2004,2006,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,12 @@ from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + #import os #print os.getpid() #raw_input('Attach gdb and press Enter: ') @@ -43,7 +49,7 @@ class my_top_block(gr.top_block): help="set maximum channels to use") parser.add_option("-D", "--dont-block", action="store_false", default=True, dest="ok_to_block") - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 @@ -69,19 +75,19 @@ class my_top_block(gr.top_block): # progression = (7, 11, 1, 5) progression = (7, 11, 1, 5, 9) - dst = audio.sink (sample_rate, - options.audio_output, - options.ok_to_block) + dst = audio.sink(sample_rate, + options.audio_output, + options.ok_to_block) max_chan = dst.input_signature().max_streams() if (max_chan == -1) or (max_chan > limit_channels): max_chan = limit_channels - for i in range (max_chan): - quo, rem = divmod (i, len (progression)) + for i in range(max_chan): + quo, rem = divmod(i, len (progression)) freq = base * ratios[progression[rem]] * (quo + 1) - src = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, freq, ampl) - self.connect (src, (dst, i)) + src = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, freq, ampl) + self.connect(src, (dst, i)) if __name__ == '__main__': try: diff --git a/gr-audio/examples/python/test_resampler.py b/gr-audio/examples/python/test_resampler.py index db7f79fba0..93be86086b 100755 --- a/gr-audio/examples/python/test_resampler.py +++ b/gr-audio/examples/python/test_resampler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,11 @@ from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) class my_top_block(gr.top_block): @@ -38,7 +43,7 @@ class my_top_block(gr.top_block): help="set input sample rate to RATE (%default)") parser.add_option("-o", "--output-rate", type="eng_float", default=48000, help="set output sample rate to RATE (%default)") - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 @@ -53,11 +58,10 @@ class my_top_block(gr.top_block): print "decim =", decim ampl = 0.1 - src0 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 650, ampl) + src0 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 650, ampl) rr = blks2.rational_resampler_fff(interp, decim) - dst = audio.sink (output_rate, options.audio_output) - self.connect (src0, rr, (dst, 0)) - + dst = audio.sink(output_rate, options.audio_output) + self.connect(src0, rr, (dst, 0)) if __name__ == '__main__': try: diff --git a/gr-blocks/CMakeLists.txt b/gr-blocks/CMakeLists.txt index 9c81ba6bf9..bbc498c4c0 100644 --- a/gr-blocks/CMakeLists.txt +++ b/gr-blocks/CMakeLists.txt @@ -34,6 +34,7 @@ GR_REGISTER_COMPONENT("gr-blocks" ENABLE_GR_BLOCKS GR_SET_GLOBAL(GR_BLOCKS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_BINARY_DIR}/include ) ######################################################################## diff --git a/gr-blocks/python/CMakeLists.txt b/gr-blocks/python/CMakeLists.txt index a7f0e741ad..5044e2320f 100644 --- a/gr-blocks/python/CMakeLists.txt +++ b/gr-blocks/python/CMakeLists.txt @@ -42,6 +42,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-blocks/swig ) set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-blocks) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-channels/CMakeLists.txt b/gr-channels/CMakeLists.txt new file mode 100644 index 0000000000..54eb23fb0f --- /dev/null +++ b/gr-channels/CMakeLists.txt @@ -0,0 +1,111 @@ +# Copyright 2012 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 3, 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. + +######################################################################## +# Setup dependencies +######################################################################## +include(GrBoost) + +######################################################################## +# Register component +######################################################################## +include(GrComponent) + +GR_REGISTER_COMPONENT("gr-channels" ENABLE_GR_CHANNELS + ENABLE_GRUEL + ENABLE_VOLK + Boost_FOUND + ENABLE_GR_CORE + ENABLE_GR_FFT + ENABLE_GR_FILTER + ENABLE_GR_ANALOG +) + +GR_SET_GLOBAL(GR_CHANNELS_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR}/lib + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +######################################################################## +# Begin conditional configuration +######################################################################## +if(ENABLE_GR_CHANNELS) + +######################################################################## +# Setup CPack components +######################################################################## +include(GrPackage) +CPACK_SET(CPACK_COMPONENT_GROUP_CHANNELS_DESCRIPTION "GNU Radio Channel Model Blocks") + +CPACK_COMPONENT("channels_runtime" + GROUP "Channel Models" + DISPLAY_NAME "Runtime" + DESCRIPTION "Runtime" + DEPENDS "core_runtime" +) + +CPACK_COMPONENT("channels_devel" + GROUP "Channel Models" + DISPLAY_NAME "Development" + DESCRIPTION "C++ headers, package config, import libraries" + DEPENDS "core_devel" +) + +CPACK_COMPONENT("channels_python" + GROUP "Channel Models" + DISPLAY_NAME "Python" + DESCRIPTION "Python modules for runtime; GRC xml files" + DEPENDS "core_python;channels_runtime" +) + +CPACK_COMPONENT("channels_swig" + GROUP "Channel Models" + DISPLAY_NAME "SWIG" + DESCRIPTION "SWIG development .i files" + DEPENDS "core_swig;channels_python;channels_devel" +) + +######################################################################## +# Add subdirectories +######################################################################## +add_subdirectory(include/channels) +add_subdirectory(lib) +if(ENABLE_PYTHON) + add_subdirectory(swig) + add_subdirectory(python) + add_subdirectory(grc) +endif(ENABLE_PYTHON) +#add_subdirectory(examples) +add_subdirectory(doc) + +######################################################################## +# Create Pkg Config File +######################################################################## +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-channels.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-channels.pc +@ONLY) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-channels.pc + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig + COMPONENT "channels_devel" +) + +endif(ENABLE_GR_CHANNELS) diff --git a/gr-channels/doc/CMakeLists.txt b/gr-channels/doc/CMakeLists.txt new file mode 100644 index 0000000000..53f878c215 --- /dev/null +++ b/gr-channels/doc/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright 2012 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 3, 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. + +install( + FILES README.channels + DESTINATION ${GR_PKG_DOC_DIR} +) diff --git a/gr-channels/doc/README.channels b/gr-channels/doc/README.channels new file mode 100644 index 0000000000..2488266a0b --- /dev/null +++ b/gr-channels/doc/README.channels @@ -0,0 +1,13 @@ +This is the gr-channels package. It contains signal processing blocks to +simulate channel models. + +The Python namespace is in gnuradio.channels, which would be normally +imported as: + + from gnuradio import channels + +See the Doxygen documentation for details about the blocks available +in this package. A quick listing of the details can be found in Python +after importing by using: + + help(channels) diff --git a/gr-channels/doc/channels.dox b/gr-channels/doc/channels.dox new file mode 100644 index 0000000000..c4440b45b0 --- /dev/null +++ b/gr-channels/doc/channels.dox @@ -0,0 +1,23 @@ +/*! \page page_channels Channel Model Blocks + +\section Introduction + +This is the gr-channels package. It contains signal processing blocks to +simulate channel models. + +The Python namespace is in gnuradio.channels, which would be normally +imported as: + +\code + from gnuradio import channels +\endcode + +See the Doxygen documentation for details about the blocks available +in this package. A quick listing of the details can be found in Python +after importing by using: + +\code + help(channels) +\endcode + +*/ diff --git a/gr-channels/gnuradio-channels.pc.in b/gr-channels/gnuradio-channels.pc.in new file mode 100644 index 0000000000..9e6192db2b --- /dev/null +++ b/gr-channels/gnuradio-channels.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: gnuradio-channels +Description: GNU Radio's channel model blocks +Requires: gnuradio-core gnuradio-filter +Version: @LIBVER@ +Libs: -L${libdir} -lgnuradio-channels -lgnuradio-filter +Cflags: -I${includedir} diff --git a/gr-channels/grc/CMakeLists.txt b/gr-channels/grc/CMakeLists.txt new file mode 100644 index 0000000000..9e77fcc4ef --- /dev/null +++ b/gr-channels/grc/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright 2012 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 3, 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. + +install(FILES + channels_block_tree.xml + channels_channel_model.xml + DESTINATION ${GRC_BLOCKS_DIR} + COMPONENT "channels_python" +) diff --git a/gr-channels/grc/channels_block_tree.xml b/gr-channels/grc/channels_block_tree.xml new file mode 100644 index 0000000000..587eebb6e9 --- /dev/null +++ b/gr-channels/grc/channels_block_tree.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> + +<!-- + Copyright 2012 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 3, 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. +--> + +<!-- +################################################### +##Block Tree for GR Channel Model blocks. +################################################### + --> +<cat> + <name></name> <!-- Blank for Root Name --> + <cat> + <name>Channel Models</name> + <block>channels_channel_model</block> + </cat> +</cat> diff --git a/gr-filter/grc/filter_channel_model.xml b/gr-channels/grc/channels_channel_model.xml index 6d780974a2..fa881a10b5 100644 --- a/gr-filter/grc/filter_channel_model.xml +++ b/gr-channels/grc/channels_channel_model.xml @@ -6,10 +6,10 @@ --> <block> <name>Channel Model</name> - <key>channel_model</key> - <import>from gnuradio import filter</import> + <key>channels_channel_model</key> + <import>from gnuradio import channels</import> <import>from gnuradio.filter import firdes</import> - <make>filter.channel_model( + <make>channels.channel_model( noise_voltage=$noise_voltage, frequency_offset=$freq_offset, epsilon=$epsilon, diff --git a/gr-channels/include/channels/CMakeLists.txt b/gr-channels/include/channels/CMakeLists.txt new file mode 100644 index 0000000000..a913b96819 --- /dev/null +++ b/gr-channels/include/channels/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright 2012 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 3, 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. + +######################################################################## +# Install header files +######################################################################## +install(FILES + api.h + channel_model.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/channels + COMPONENT "channels_devel" +) + diff --git a/gnuradio-core/src/lib/general/gr_dpll_bb.i b/gr-channels/include/channels/api.h index f31a873743..41e65ca7cd 100644 --- a/gnuradio-core/src/lib/general/gr_dpll_bb.i +++ b/gr-channels/include/channels/api.h @@ -1,6 +1,5 @@ -/* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,12 +19,15 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,dpll_bb) +#ifndef INCLUDED_CHANNELS_API_H +#define INCLUDED_CHANNELS_API_H - gr_dpll_bb_sptr gr_make_dpll_bb (float period, float gain); +#include <gruel/attributes.h> -class gr_dpll_bb : public gr_sync_block -{ - private: - gr_dpll_bb (float period, float gain); -}; +#ifdef gnuradio_channels_EXPORTS +# define CHANNELS_API __GR_ATTR_EXPORT +#else +# define CHANNELS_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_CHANNELS_API_H */ diff --git a/gr-filter/include/filter/channel_model.h b/gr-channels/include/channels/channel_model.h index 2e808de8e5..e509933af0 100644 --- a/gr-filter/include/filter/channel_model.h +++ b/gr-channels/include/channels/channel_model.h @@ -20,15 +20,15 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_FILTER_CHANNEL_MODEL_H -#define INCLUDED_FILTER_CHANNEL_MODEL_H +#ifndef INCLUDED_CHANNELS_CHANNEL_MODEL_H +#define INCLUDED_CHANNELS_CHANNEL_MODEL_H -#include <filter/api.h> +#include <channels/api.h> #include <gr_hier_block2.h> #include <gr_types.h> namespace gr { - namespace filter { + namespace channels { /*! * \brief channel simulator @@ -44,10 +44,10 @@ namespace gr { * Multipath can be approximated in this model by using a FIR * filter representation of a multipath delay profile.. */ - class FILTER_API channel_model : virtual public gr_hier_block2 + class CHANNELS_API channel_model : virtual public gr_hier_block2 { public: - // gr::filter::channel_model::sptr + // gr::channels::channel_model::sptr typedef boost::shared_ptr<channel_model> sptr; /*! \brief Build the channel simulator. @@ -68,7 +68,7 @@ namespace gr { double frequency_offset=0.0, double epsilon=1.0, const std::vector<gr_complex> &taps=std::vector<gr_complex>(1,1), - double noise_seed=3021); + double noise_seed=0); virtual void set_noise_voltage(double noise_voltage) = 0; virtual void set_frequency_offset(double frequency_offset) = 0; @@ -81,7 +81,7 @@ namespace gr { virtual double timing_offset() const = 0; }; - } /* namespace filter */ + } /* namespace channels */ } /* namespace gr */ -#endif /* INCLUDED_FILTER_CHANNEL_MODEL_H */ +#endif /* INCLUDED_CHANNELS_CHANNEL_MODEL_H */ diff --git a/gr-channels/lib/CMakeLists.txt b/gr-channels/lib/CMakeLists.txt new file mode 100644 index 0000000000..ec3a8b3572 --- /dev/null +++ b/gr-channels/lib/CMakeLists.txt @@ -0,0 +1,57 @@ +# Copyright 2012 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 3, 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. + +######################################################################## +# Setup the include and linker paths +######################################################################## +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_BLOCKS_INCLUDE_DIRS} + ${GR_FILTER_INCLUDE_DIRS} + ${GR_ANALOG_INCLUDE_DIRS} + ${GR_CHANNELS_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} +) + +link_directories(${Boost_LIBRARY_DIRS}) + +######################################################################## +# Setup library +######################################################################## +list(APPEND channels_sources + channel_model_impl.cc +) + +list(APPEND channels_libs + volk + gnuradio-core + gnuradio-filter + gnuradio-analog + gnuradio-blocks + ${Boost_LIBRARIES} +) + +add_library(gnuradio-channels SHARED ${channels_sources}) +target_link_libraries(gnuradio-channels ${channels_libs}) +GR_LIBRARY_FOO(gnuradio-channels RUNTIME_COMPONENT "channels_runtime" DEVEL_COMPONENT "channels_devel") +add_dependencies(gnuradio-channels + channels_generated_includes channels_generated_swigs + gnuradio-core gnuradio-filter gnuradio-analog gnuradio-blocks) diff --git a/gr-filter/lib/channel_model_impl.cc b/gr-channels/lib/channel_model_impl.cc index 88732d95d3..a9ed06eb53 100644 --- a/gr-filter/lib/channel_model_impl.cc +++ b/gr-channels/lib/channel_model_impl.cc @@ -25,7 +25,7 @@ #include <iostream> namespace gr { - namespace filter { + namespace channels { channel_model::sptr channel_model::make(double noise_voltage, @@ -57,14 +57,16 @@ namespace gr { d_taps.push_back(0); } - d_timing_offset = fractional_interpolator_cc::make(0, epsilon); + d_timing_offset = filter::fractional_interpolator_cc::make(0, epsilon); - d_multipath = fir_filter_ccc::make(1, d_taps); + d_multipath = filter::fir_filter_ccc::make(1, d_taps); - d_noise_adder = gr_make_add_cc(); - d_noise = gr_make_noise_source_c(GR_GAUSSIAN, noise_voltage, noise_seed); - d_freq_offset = gr_make_sig_source_c(1, GR_SIN_WAVE, frequency_offset, 1.0, 0.0); - d_mixer_offset = gr_make_multiply_cc(); + d_noise_adder = blocks::add_cc::make(); + d_noise = analog::noise_source_c::make(analog::GR_GAUSSIAN, + noise_voltage, noise_seed); + d_freq_offset = analog::sig_source_c::make(1, analog::GR_SIN_WAVE, + frequency_offset, 1.0, 0.0); + d_mixer_offset = blocks::multiply_cc::make(); connect(self(), 0, d_timing_offset, 0); connect(d_timing_offset, 0, d_multipath, 0); @@ -131,5 +133,5 @@ namespace gr { return d_timing_offset->interp_ratio(); } - } /* namespace filter */ + } /* namespace channels */ } /* namespace gr */ diff --git a/gr-filter/lib/channel_model_impl.h b/gr-channels/lib/channel_model_impl.h index 95a63d7904..03408dad64 100644 --- a/gr-filter/lib/channel_model_impl.h +++ b/gr-channels/lib/channel_model_impl.h @@ -20,31 +20,32 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H -#define INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H +#ifndef INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H +#define INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H #include <gr_top_block.h> -#include <gr_sig_source_c.h> -#include <gr_add_cc.h> -#include <gr_multiply_cc.h> -#include <gr_noise_source_c.h> -#include <filter/channel_model.h> +#include <blocks/add_cc.h> +#include <blocks/multiply_cc.h> +#include <analog/sig_source_c.h> +#include <analog/noise_source_c.h> +#include <channels/channel_model.h> #include <filter/fractional_interpolator_cc.h> #include <filter/fir_filter_ccc.h> namespace gr { - namespace filter { + namespace channels { - class FILTER_API channel_model_impl : public channel_model + class CHANNELS_API channel_model_impl : public channel_model { private: - gr_sig_source_c_sptr d_freq_offset; - gr_add_cc_sptr d_noise_adder; - gr_noise_source_c_sptr d_noise; - gr_multiply_cc_sptr d_mixer_offset; + blocks::add_cc::sptr d_noise_adder; + blocks::multiply_cc::sptr d_mixer_offset; - fractional_interpolator_cc::sptr d_timing_offset; - fir_filter_ccc::sptr d_multipath; + analog::sig_source_c::sptr d_freq_offset; + analog::noise_source_c::sptr d_noise; + + filter::fractional_interpolator_cc::sptr d_timing_offset; + filter::fir_filter_ccc::sptr d_multipath; std::vector<gr_complex> d_taps; @@ -68,7 +69,7 @@ namespace gr { double timing_offset() const; }; - } /* namespace filter */ + } /* namespace channels */ } /* namespace gr */ -#endif /* INCLUDED_FILTER_CHANNEL_MODEL_IMPL_H */ +#endif /* INCLUDED_CHANNELS_CHANNEL_MODEL_IMPL_H */ diff --git a/gr-channels/python/CMakeLists.txt b/gr-channels/python/CMakeLists.txt new file mode 100644 index 0000000000..b394b32392 --- /dev/null +++ b/gr-channels/python/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright 2012 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 3, 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. + +######################################################################## +include(GrPython) + +GR_PYTHON_INSTALL( + FILES + __init__.py + DESTINATION ${GR_PYTHON_DIR}/gnuradio/channels + COMPONENT "channels_python" +) + +######################################################################## +# Handle the unit tests +######################################################################## +if(ENABLE_TESTING) +include(GrTest) +file(GLOB py_qa_test_files "qa_*.py") +foreach(py_qa_test_file ${py_qa_test_files}) + get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE) + set(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gnuradio-core/src/python + ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig + ${CMAKE_BINARY_DIR}/gr-channels/python + ${CMAKE_BINARY_DIR}/gr-channels/swig + ${CMAKE_BINARY_DIR}/gr-analog/python + ${CMAKE_BINARY_DIR}/gr-analog/swig + ) + set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-channels) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) +endforeach(py_qa_test_file) +endif(ENABLE_TESTING) diff --git a/gr-channels/python/__init__.py b/gr-channels/python/__init__.py new file mode 100644 index 0000000000..da50a05fc4 --- /dev/null +++ b/gr-channels/python/__init__.py @@ -0,0 +1,27 @@ +# +# Copyright 2012 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 3, 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. +# + +''' +This is the gr-channels package. This package provides GNU Radio +processing blocks for channel models and related functions. +''' + +from channels_swig import * diff --git a/gr-filter/python/qa_channel_model.py b/gr-channels/python/qa_channel_model.py index 7f1c61b4e3..0a99477097 100755 --- a/gr-filter/python/qa_channel_model.py +++ b/gr-channels/python/qa_channel_model.py @@ -21,7 +21,8 @@ # from gnuradio import gr, gr_unittest -import filter_swig as filter +import analog_swig as analog +import channels_swig as channels import math class test_channel_model(gr_unittest.TestCase): @@ -37,9 +38,9 @@ class test_channel_model(gr_unittest.TestCase): fs = 1000 # baseband sampling rate freq = 100 - signal = gr.sig_source_c(fs, gr.GR_SIN_WAVE, freq, 1) + signal = analog.sig_source_c(fs, analog.GR_SIN_WAVE, freq, 1) head = gr.head(gr.sizeof_gr_complex, N) - op = filter.channel_model(0.0, 0.0, 1.0, [1,], 0) + op = channels.channel_model(0.0, 0.0, 1.0, [1,], 0) snk = gr.vector_sink_c() snk1 = gr.vector_sink_c() diff --git a/gr-channels/swig/CMakeLists.txt b/gr-channels/swig/CMakeLists.txt new file mode 100644 index 0000000000..e28d952e7a --- /dev/null +++ b/gr-channels/swig/CMakeLists.txt @@ -0,0 +1,53 @@ +# Copyright 2012 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 3, 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. + +######################################################################## +# Setup swig generation +######################################################################## +include(GrPython) +include(GrSwig) + +set(GR_SWIG_TARGET_DEPS core_swig) + +set(GR_SWIG_INCLUDE_DIRS + ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} + ${GR_FILTER_INCLUDE_DIRS} + ${GR_CHANNELS_INCLUDE_DIRS} +) + +set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/channels_swig_doc.i) +set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include/channels) + +set(GR_SWIG_LIBRARIES gnuradio-channels) + +GR_SWIG_MAKE(channels_swig channels_swig.i) + +GR_SWIG_INSTALL( + TARGETS channels_swig + DESTINATION ${GR_PYTHON_DIR}/gnuradio/channels + COMPONENT "channels_python" +) + +install( + FILES + channels_swig.i + ${CMAKE_CURRENT_BINARY_DIR}/channels_swig_doc.i + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig + COMPONENT "channels_swig" +) diff --git a/gnuradio-core/src/lib/gengen/gr_noise_type.h b/gr-channels/swig/channels_swig.i index d2aba9b0c7..364f8d0fbd 100644 --- a/gnuradio-core/src/lib/gengen/gr_noise_type.h +++ b/gr-channels/swig/channels_swig.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,11 +20,17 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_NOISE_TYPE_H -#define INCLUDED_GR_NOISE_TYPE_H +#define CHANNELS_API -typedef enum { - GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE -} gr_noise_type_t; +%include "gnuradio.i" -#endif /* INCLUDED_GR_NOISE_TYPE_H */ +//load generated python docstrings +%include "channels_swig_doc.i" + +%{ +#include "channels/channel_model.h" +%} + +%include "channels/channel_model.h" + +GR_SWIG_BLOCK_MAGIC2(channels, channel_model); diff --git a/gr-comedi/src/CMakeLists.txt b/gr-comedi/src/CMakeLists.txt index 5291e4d905..8c4834115b 100644 --- a/gr-comedi/src/CMakeLists.txt +++ b/gr-comedi/src/CMakeLists.txt @@ -110,6 +110,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-comedi/src ) set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-comedi) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING AND ENABLE_PYTHON) diff --git a/gr-digital/CMakeLists.txt b/gr-digital/CMakeLists.txt index 34ce8975be..c2d7524505 100644 --- a/gr-digital/CMakeLists.txt +++ b/gr-digital/CMakeLists.txt @@ -32,6 +32,7 @@ GR_REGISTER_COMPONENT("gr-digital" ENABLE_GR_DIGITAL ENABLE_GR_CORE ENABLE_GR_FFT ENABLE_GR_FILTER + ENABLE_GR_ANALOG ) GR_SET_GLOBAL(GR_DIGITAL_INCLUDE_DIRS diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py index 2d95a1345f..8ff43b7b92 100755 --- a/gr-digital/examples/berawgn.py +++ b/gr-digital/examples/berawgn.py @@ -36,6 +36,7 @@ magnitude below what you chose for N_BITS. import math import numpy from gnuradio import gr, digital +from gnuradio import analog try: from scipy.special import erfc @@ -92,9 +93,9 @@ class BERAWGNSimu(gr.top_block): src = gr.vector_source_b(data, False) mod = digital.chunks_to_symbols_bc((self.const.points()), 1) add = gr.add_vcc() - noise = gr.noise_source_c(gr.GR_GAUSSIAN, - self.EbN0_to_noise_voltage(EbN0), - RAND_SEED) + noise = analog.noise_source_c(analog.GR_GAUSSIAN, + self.EbN0_to_noise_voltage(EbN0), + RAND_SEED) demod = digital.constellation_decoder_cb(self.const.base()) ber = BitErrors(self.const.bits_per_symbol()) self.sink = gr.vector_sink_f() diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc index f41b9cf79b..3097aa8fa5 100644 --- a/gr-digital/examples/demod/ber_simulation.grc +++ b/gr-digital/examples/demod/ber_simulation.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Mon Jul 16 21:09:12 2012</timestamp> + <timestamp>Sat Nov 10 15:31:44 2012</timestamp> <block> <key>options</key> <param> @@ -354,41 +354,6 @@ </param> </block> <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>1.0 / math.sqrt(2.0 * const.bits_per_symbol() * 10**(EbN0/10))</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(16, 224)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable_slider</key> <param> <key>id</key> @@ -522,6 +487,29 @@ </param> </block> <block> + <key>digital_constellation_decoder_cb</key> + <param> + <key>id</key> + <value>digital_constellation_decoder_cb_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>constellation</key> + <value>const.base()</value> + </param> + <param> + <key>_coordinate</key> + <value>(622, 164)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> <key>gr_add_xx</key> <param> <key>id</key> @@ -553,22 +541,34 @@ </param> </block> <block> - <key>digital_constellation_decoder_cb</key> + <key>analog_noise_source_x</key> <param> <key>id</key> - <value>digital_constellation_decoder_cb_0</value> + <value>analog_noise_source_x_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>constellation</key> - <value>const.base()</value> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>1.0/math.sqrt(2.0 * const.bits_per_symbol() * 10*(EbN0/10))</value> + </param> + <param> + <key>seed</key> + <value>-42</value> </param> <param> <key>_coordinate</key> - <value>(622, 164)</value> + <value>(16, 224)</value> </param> <param> <key>_rotation</key> @@ -588,12 +588,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_noise_source_x</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> <source_block_id>random_source_x</source_block_id> <sink_block_id>gr_throttle</sink_block_id> <source_key>0</source_key> @@ -629,4 +623,10 @@ <source_key>0</source_key> <sink_key>0</sink_key> </connection> + <connection> + <source_block_id>analog_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> </flow_graph> diff --git a/gr-digital/examples/demod/dpsk_loopback.grc b/gr-digital/examples/demod/dpsk_loopback.grc index c9867bea20..7a6b2d293f 100644 --- a/gr-digital/examples/demod/dpsk_loopback.grc +++ b/gr-digital/examples/demod/dpsk_loopback.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jul 5 16:26:53 2012</timestamp> + <timestamp>Sat Nov 10 15:13:23 2012</timestamp> <block> <key>options</key> <param> @@ -139,10 +139,10 @@ </param> </block> <block> - <key>gr_sig_source_x</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>gr_sig_source_x_0</value> + <value>gr_throttle_0_0</value> </param> <param> <key>_enabled</key> @@ -153,28 +153,16 @@ <value>float</value> </param> <param> - <key>samp_rate</key> + <key>samples_per_second</key> <value>samp_rate</value> </param> <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> + <key>vlen</key> <value>1</value> </param> <param> - <key>offset</key> - <value>0</value> - </param> - <param> <key>_coordinate</key> - <value>(184, 9)</value> + <value>(381, 51)</value> </param> <param> <key>_rotation</key> @@ -182,10 +170,10 @@ </param> </block> <block> - <key>digital_dxpsk_mod</key> + <key>blks2_packet_encoder</key> <param> <key>id</key> - <value>digital_dxpsk_mod_1</value> + <value>blks2_packet_encoder_0</value> </param> <param> <key>_enabled</key> @@ -193,62 +181,31 @@ </param> <param> <key>type</key> - <value>dbpsk</value> + <value>float</value> </param> <param> <key>samples_per_symbol</key> <value>2</value> </param> <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(745, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> + <key>bits_per_symbol</key> + <value>1</value> </param> - </block> - <block> - <key>gr_throttle</key> <param> - <key>id</key> - <value>gr_throttle_0_0</value> + <key>access_code</key> + <value></value> </param> <param> - <key>_enabled</key> + <key>pad_for_usrp</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> + <key>payload_length</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(358, 39)</value> + <value>(598, 19)</value> </param> <param> <key>_rotation</key> @@ -256,10 +213,10 @@ </param> </block> <block> - <key>blks2_packet_encoder</key> + <key>digital_dxpsk_mod</key> <param> <key>id</key> - <value>blks2_packet_encoder_0</value> + <value>digital_dxpsk_mod_1</value> </param> <param> <key>_enabled</key> @@ -267,31 +224,31 @@ </param> <param> <key>type</key> - <value>float</value> + <value>dbpsk</value> </param> <param> <key>samples_per_symbol</key> <value>2</value> </param> <param> - <key>bits_per_symbol</key> - <value>1</value> + <key>excess_bw</key> + <value>0.35</value> </param> <param> - <key>access_code</key> - <value></value> + <key>mod_code</key> + <value>"gray"</value> </param> <param> - <key>pad_for_usrp</key> - <value>True</value> + <key>verbose</key> + <value>False</value> </param> <param> - <key>payload_length</key> - <value>0</value> + <key>log</key> + <value>False</value> </param> <param> <key>_coordinate</key> - <value>(541, 9)</value> + <value>(806, 27)</value> </param> <param> <key>_rotation</key> @@ -333,12 +290,8 @@ <value>6.28/100.0</value> </param> <param> - <key>omega_relative_limit</key> - <value>0.005</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> + <key>mod_code</key> + <value>"gray"</value> </param> <param> <key>verbose</key> @@ -354,38 +307,7 @@ </param> <param> <key>_coordinate</key> - <value>(746, 135)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>blks2_packet_decoder</key> - <param> - <key>id</key> - <value>blks2_packet_decoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>threshold</key> - <value>-1</value> - </param> - <param> - <key>_coordinate</key> - <value>(545, 187)</value> + <value>(745, 139)</value> </param> <param> <key>_rotation</key> @@ -460,7 +382,81 @@ </param> <param> <key>_coordinate</key> - <value>(184, 165)</value> + <value>(184, 163)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>analog_sig_source_x</key> + <param> + <key>id</key> + <value>analog_sig_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> + </param> + <param> + <key>freq</key> + <value>freq</value> + </param> + <param> + <key>amp</key> + <value>1</value> + </param> + <param> + <key>offset</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(190, 19)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blks2_packet_decoder</key> + <param> + <key>id</key> + <value>blks2_packet_decoder_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>access_code</key> + <value></value> + </param> + <param> + <key>threshold</key> + <value>-1</value> + </param> + <param> + <key>_coordinate</key> + <value>(545, 187)</value> </param> <param> <key>_rotation</key> @@ -498,7 +494,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> + <source_block_id>analog_sig_source_x_0</source_block_id> <sink_block_id>gr_throttle_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-digital/examples/demod/gfsk_loopback.grc b/gr-digital/examples/demod/gfsk_loopback.grc index 364314aa9a..51f5ade77a 100644 --- a/gr-digital/examples/demod/gfsk_loopback.grc +++ b/gr-digital/examples/demod/gfsk_loopback.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Mon Aug 20 19:52:22 2012</timestamp> + <timestamp>Tue Nov 6 20:52:00 2012</timestamp> <block> <key>options</key> <param> @@ -61,37 +61,6 @@ </param> </block> <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(413, 50)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable</key> <param> <key>id</key> @@ -138,49 +107,6 @@ </param> </block> <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> - <value>1</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(215, 18)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable</key> <param> <key>id</key> @@ -281,10 +207,18 @@ <value>1024</value> </param> <param> - <key>bw</key> + <key>srate</key> <value>samp_rate</value> </param> <param> + <key>ymin</key> + <value>-1</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> <key>nconnections</key> <value>1</value> </param> @@ -302,10 +236,10 @@ </param> </block> <block> - <key>qtgui_time_sink_x</key> + <key>blks2_packet_encoder</key> <param> <key>id</key> - <value>qtgui_time_sink_x_1_0</value> + <value>blks2_packet_encoder_0</value> </param> <param> <key>_enabled</key> @@ -316,28 +250,28 @@ <value>float</value> </param> <param> - <key>name</key> - <value>QT GUI Plot</value> + <key>samples_per_symbol</key> + <value>sps</value> </param> <param> - <key>size</key> - <value>1024</value> + <key>bits_per_symbol</key> + <value>1</value> </param> <param> - <key>bw</key> - <value>samp_rate</value> + <key>access_code</key> + <value></value> </param> <param> - <key>nconnections</key> - <value>1</value> + <key>pad_for_usrp</key> + <value>True</value> </param> <param> - <key>gui_hint</key> - <value></value> + <key>payload_length</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(888, 386)</value> + <value>(237, 261)</value> </param> <param> <key>_rotation</key> @@ -345,38 +279,30 @@ </param> </block> <block> - <key>digital_gfsk_mod</key> + <key>blks2_packet_decoder</key> <param> <key>id</key> - <value>digital_gfsk_mod_0</value> + <value>blks2_packet_decoder_0</value> </param> <param> <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>sensitivity</key> - <value>fm_sensitivity</value> + <value>True</value> </param> <param> - <key>bt</key> - <value>0.35</value> + <key>type</key> + <value>float</value> </param> <param> - <key>verbose</key> - <value>False</value> + <key>access_code</key> + <value></value> </param> <param> - <key>log</key> - <value>False</value> + <key>threshold</key> + <value>-1</value> </param> <param> <key>_coordinate</key> - <value>(456, 277)</value> + <value>(720, 130)</value> </param> <param> <key>_rotation</key> @@ -384,50 +310,30 @@ </param> </block> <block> - <key>digital_gfsk_demod</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>digital_gfsk_demod_0</value> + <value>gr_throttle_0_0</value> </param> <param> <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>sensitivity</key> - <value>fm_sensitivity</value> - </param> - <param> - <key>gain_mu</key> - <value>0.175</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>0.005</value> + <value>True</value> </param> <param> - <key>freq_error</key> - <value>0.0</value> + <key>type</key> + <value>float</value> </param> <param> - <key>verbose</key> - <value>False</value> + <key>samples_per_second</key> + <value>samp_rate</value> </param> <param> - <key>log</key> - <value>False</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(670, 253)</value> + <value>(413, 50)</value> </param> <param> <key>_rotation</key> @@ -435,10 +341,10 @@ </param> </block> <block> - <key>blks2_packet_encoder</key> + <key>analog_sig_source_x</key> <param> <key>id</key> - <value>blks2_packet_encoder_0</value> + <value>analog_sig_source_x_0</value> </param> <param> <key>_enabled</key> @@ -449,28 +355,28 @@ <value>float</value> </param> <param> - <key>samples_per_symbol</key> - <value>sps</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>bits_per_symbol</key> - <value>1</value> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> </param> <param> - <key>access_code</key> - <value></value> + <key>freq</key> + <value>freq</value> </param> <param> - <key>pad_for_usrp</key> - <value>True</value> + <key>amp</key> + <value>1</value> </param> <param> - <key>payload_length</key> + <key>offset</key> <value>0</value> </param> <param> <key>_coordinate</key> - <value>(237, 261)</value> + <value>(214, 18)</value> </param> <param> <key>_rotation</key> @@ -478,10 +384,10 @@ </param> </block> <block> - <key>digital_gmsk_mod</key> + <key>digital_gfsk_demod</key> <param> <key>id</key> - <value>digital_gmsk_mod_0</value> + <value>digital_gfsk_demod_0</value> </param> <param> <key>_enabled</key> @@ -489,11 +395,27 @@ </param> <param> <key>samples_per_symbol</key> - <value>2</value> + <value>sps</value> </param> <param> - <key>bt</key> - <value>0.35</value> + <key>sensitivity</key> + <value>fm_sensitivity</value> + </param> + <param> + <key>gain_mu</key> + <value>0.175</value> + </param> + <param> + <key>mu</key> + <value>0.5</value> + </param> + <param> + <key>omega_relative_limit</key> + <value>0.005</value> + </param> + <param> + <key>freq_error</key> + <value>0.0</value> </param> <param> <key>verbose</key> @@ -505,7 +427,7 @@ </param> <param> <key>_coordinate</key> - <value>(342, 457)</value> + <value>(670, 253)</value> </param> <param> <key>_rotation</key> @@ -513,22 +435,38 @@ </param> </block> <block> - <key>gr_quadrature_demod_cf</key> + <key>digital_gfsk_mod</key> <param> <key>id</key> - <value>gr_quadrature_demod_cf_0</value> + <value>digital_gfsk_mod_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>gain</key> - <value>1</value> + <key>samples_per_symbol</key> + <value>sps</value> + </param> + <param> + <key>sensitivity</key> + <value>fm_sensitivity</value> + </param> + <param> + <key>bt</key> + <value>0.35</value> + </param> + <param> + <key>verbose</key> + <value>False</value> + </param> + <param> + <key>log</key> + <value>False</value> </param> <param> <key>_coordinate</key> - <value>(679, 402)</value> + <value>(456, 277)</value> </param> <param> <key>_rotation</key> @@ -536,10 +474,10 @@ </param> </block> <block> - <key>blks2_packet_decoder</key> + <key>qtgui_time_sink_x</key> <param> <key>id</key> - <value>blks2_packet_decoder_0</value> + <value>qtgui_time_sink_x_1_0</value> </param> <param> <key>_enabled</key> @@ -550,63 +488,59 @@ <value>float</value> </param> <param> - <key>access_code</key> - <value></value> + <key>name</key> + <value>QT GUI Plot</value> </param> <param> - <key>threshold</key> - <value>-1</value> + <key>size</key> + <value>1024</value> </param> <param> - <key>_coordinate</key> - <value>(720, 130)</value> + <key>srate</key> + <value>samp_rate</value> </param> <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_gmsk_demod</key> - <param> - <key>id</key> - <value>digital_gmsk_demod_0</value> + <key>ymin</key> + <value>-1</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>ymax</key> + <value>1</value> </param> <param> - <key>samples_per_symbol</key> - <value>2</value> + <key>nconnections</key> + <value>1</value> </param> <param> - <key>gain_mu</key> - <value>0.175</value> + <key>gui_hint</key> + <value></value> </param> <param> - <key>mu</key> - <value>0.5</value> + <key>_coordinate</key> + <value>(888, 386)</value> </param> <param> - <key>omega_relative_limit</key> - <value>0.005</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>analog_quadrature_demod_cf</key> <param> - <key>freq_error</key> - <value>0.0</value> + <key>id</key> + <value>analog_quadrature_demod_cf_0</value> </param> <param> - <key>verbose</key> - <value>False</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>log</key> - <value>False</value> + <key>gain</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(622, 498)</value> + <value>(673, 403)</value> </param> <param> <key>_rotation</key> @@ -614,12 +548,6 @@ </param> </block> <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>blks2_packet_encoder_0</source_block_id> <sink_block_id>digital_gfsk_mod_0</sink_block_id> <source_key>0</source_key> @@ -632,12 +560,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>digital_gfsk_mod_0</source_block_id> - <sink_block_id>gr_quadrature_demod_cf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>digital_gfsk_demod_0</source_block_id> <sink_block_id>blks2_packet_decoder_0</sink_block_id> <source_key>0</source_key> @@ -656,32 +578,20 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_quadrature_demod_cf_0</source_block_id> - <sink_block_id>qtgui_time_sink_x_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_packet_encoder_0</source_block_id> - <sink_block_id>digital_gmsk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_gmsk_mod_0</source_block_id> - <sink_block_id>digital_gmsk_demod_0</sink_block_id> + <source_block_id>analog_sig_source_x_0</source_block_id> + <sink_block_id>gr_throttle_0_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>digital_gmsk_mod_0</source_block_id> - <sink_block_id>gr_quadrature_demod_cf_0</sink_block_id> + <source_block_id>digital_gfsk_mod_0</source_block_id> + <sink_block_id>analog_quadrature_demod_cf_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>digital_gmsk_demod_0</source_block_id> - <sink_block_id>blks2_packet_decoder_0</sink_block_id> + <source_block_id>analog_quadrature_demod_cf_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_1_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/demod/gmsk_loopback.grc b/gr-digital/examples/demod/gmsk_loopback.grc index 84912ac58b..c4361fbed8 100644 --- a/gr-digital/examples/demod/gmsk_loopback.grc +++ b/gr-digital/examples/demod/gmsk_loopback.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Mon Aug 20 19:53:13 2012</timestamp> + <timestamp>Tue Nov 6 20:49:18 2012</timestamp> <block> <key>options</key> <param> @@ -61,37 +61,6 @@ </param> </block> <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(413, 50)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable</key> <param> <key>id</key> @@ -138,49 +107,6 @@ </param> </block> <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> - <value>1</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(215, 18)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable</key> <param> <key>id</key> @@ -281,10 +207,18 @@ <value>1024</value> </param> <param> - <key>bw</key> + <key>srate</key> <value>samp_rate</value> </param> <param> + <key>ymin</key> + <value>-1</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> <key>nconnections</key> <value>1</value> </param> @@ -302,10 +236,10 @@ </param> </block> <block> - <key>qtgui_time_sink_x</key> + <key>blks2_packet_encoder</key> <param> <key>id</key> - <value>qtgui_time_sink_x_1_0</value> + <value>blks2_packet_encoder_0</value> </param> <param> <key>_enabled</key> @@ -316,28 +250,28 @@ <value>float</value> </param> <param> - <key>name</key> - <value>QT GUI Plot</value> + <key>samples_per_symbol</key> + <value>sps</value> </param> <param> - <key>size</key> - <value>1024</value> + <key>bits_per_symbol</key> + <value>1</value> </param> <param> - <key>bw</key> - <value>samp_rate</value> + <key>access_code</key> + <value></value> </param> <param> - <key>nconnections</key> - <value>1</value> + <key>pad_for_usrp</key> + <value>True</value> </param> <param> - <key>gui_hint</key> - <value></value> + <key>payload_length</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(888, 386)</value> + <value>(237, 261)</value> </param> <param> <key>_rotation</key> @@ -345,10 +279,10 @@ </param> </block> <block> - <key>blks2_packet_encoder</key> + <key>blks2_packet_decoder</key> <param> <key>id</key> - <value>blks2_packet_encoder_0</value> + <value>blks2_packet_decoder_0</value> </param> <param> <key>_enabled</key> @@ -359,28 +293,63 @@ <value>float</value> </param> <param> - <key>samples_per_symbol</key> - <value>sps</value> + <key>access_code</key> + <value></value> </param> <param> - <key>bits_per_symbol</key> - <value>1</value> + <key>threshold</key> + <value>-1</value> </param> <param> - <key>access_code</key> - <value></value> + <key>_coordinate</key> + <value>(720, 130)</value> </param> <param> - <key>pad_for_usrp</key> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_gmsk_demod</key> + <param> + <key>id</key> + <value>digital_gmsk_demod_0</value> + </param> + <param> + <key>_enabled</key> <value>True</value> </param> <param> - <key>payload_length</key> - <value>0</value> + <key>samples_per_symbol</key> + <value>2</value> + </param> + <param> + <key>gain_mu</key> + <value>0.175</value> + </param> + <param> + <key>mu</key> + <value>0.5</value> + </param> + <param> + <key>omega_relative_limit</key> + <value>0.005</value> + </param> + <param> + <key>freq_error</key> + <value>0.0</value> + </param> + <param> + <key>verbose</key> + <value>False</value> + </param> + <param> + <key>log</key> + <value>False</value> </param> <param> <key>_coordinate</key> - <value>(237, 261)</value> + <value>(666, 261)</value> </param> <param> <key>_rotation</key> @@ -388,22 +357,30 @@ </param> </block> <block> - <key>gr_quadrature_demod_cf</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>gr_quadrature_demod_cf_0</value> + <value>gr_throttle_0_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>gain</key> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> <value>1</value> </param> <param> <key>_coordinate</key> - <value>(679, 402)</value> + <value>(413, 50)</value> </param> <param> <key>_rotation</key> @@ -411,10 +388,10 @@ </param> </block> <block> - <key>blks2_packet_decoder</key> + <key>analog_sig_source_x</key> <param> <key>id</key> - <value>blks2_packet_decoder_0</value> + <value>analog_sig_source_x_0</value> </param> <param> <key>_enabled</key> @@ -425,16 +402,28 @@ <value>float</value> </param> <param> - <key>access_code</key> - <value></value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>threshold</key> - <value>-1</value> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> + </param> + <param> + <key>freq</key> + <value>freq</value> + </param> + <param> + <key>amp</key> + <value>1</value> + </param> + <param> + <key>offset</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(720, 130)</value> + <value>(210, 18)</value> </param> <param> <key>_rotation</key> @@ -442,34 +431,50 @@ </param> </block> <block> - <key>digital_gmsk_mod</key> + <key>qtgui_time_sink_x</key> <param> <key>id</key> - <value>digital_gmsk_mod_0</value> + <value>qtgui_time_sink_x_1_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>samples_per_symbol</key> - <value>2</value> + <key>type</key> + <value>float</value> </param> <param> - <key>bt</key> - <value>0.35</value> + <key>name</key> + <value>QT GUI Plot</value> </param> <param> - <key>verbose</key> - <value>False</value> + <key>size</key> + <value>1024</value> </param> <param> - <key>log</key> - <value>False</value> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>ymin</key> + <value>-1</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>gui_hint</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(446, 285)</value> + <value>(888, 386)</value> </param> <param> <key>_rotation</key> @@ -477,10 +482,10 @@ </param> </block> <block> - <key>digital_gmsk_demod</key> + <key>digital_gmsk_mod</key> <param> <key>id</key> - <value>digital_gmsk_demod_0</value> + <value>digital_gmsk_mod_0</value> </param> <param> <key>_enabled</key> @@ -491,32 +496,43 @@ <value>2</value> </param> <param> - <key>gain_mu</key> - <value>0.175</value> + <key>bt</key> + <value>0.35</value> </param> <param> - <key>mu</key> - <value>0.5</value> + <key>verbose</key> + <value>False</value> </param> <param> - <key>omega_relative_limit</key> - <value>0.005</value> + <key>log</key> + <value>False</value> </param> <param> - <key>freq_error</key> - <value>0.0</value> + <key>_coordinate</key> + <value>(446, 285)</value> </param> <param> - <key>verbose</key> - <value>False</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>analog_quadrature_demod_cf</key> <param> - <key>log</key> - <value>False</value> + <key>id</key> + <value>analog_quadrature_demod_cf_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>gain</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(666, 261)</value> + <value>(675, 402)</value> </param> <param> <key>_rotation</key> @@ -524,12 +540,6 @@ </param> </block> <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_throttle_0_0</source_block_id> <sink_block_id>blks2_packet_encoder_0</sink_block_id> <source_key>0</source_key> @@ -542,12 +552,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_quadrature_demod_cf_0</source_block_id> - <sink_block_id>qtgui_time_sink_x_1_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>blks2_packet_encoder_0</source_block_id> <sink_block_id>digital_gmsk_mod_0</sink_block_id> <source_key>0</source_key> @@ -560,14 +564,26 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>digital_gmsk_mod_0</source_block_id> - <sink_block_id>gr_quadrature_demod_cf_0</sink_block_id> + <source_block_id>digital_gmsk_demod_0</source_block_id> + <sink_block_id>blks2_packet_decoder_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>digital_gmsk_demod_0</source_block_id> - <sink_block_id>blks2_packet_decoder_0</sink_block_id> + <source_block_id>analog_sig_source_x_0</source_block_id> + <sink_block_id>gr_throttle_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_quadrature_demod_cf_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_1_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_gmsk_mod_0</source_block_id> + <sink_block_id>analog_quadrature_demod_cf_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py index 8f2e544fdb..0ee0058059 100755 --- a/gr-digital/examples/narrowband/benchmark_add_channel.py +++ b/gr-digital/examples/narrowband/benchmark_add_channel.py @@ -43,8 +43,9 @@ class my_top_block(gr.top_block): self.src = gr.file_source(gr.sizeof_gr_complex, ifile) #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) + self.channel = filter.channel_model(noise_voltage, frequency_offset, - time_offset, noise_seed=random.randint(0,100000)) + time_offset, noise_seed=-random.randint(0,100000)) self.phase = gr.multiply_const_cc(complex(math.cos(phase_offset), math.sin(phase_offset))) self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile) diff --git a/gr-digital/examples/narrowband/receive_path.py b/gr-digital/examples/narrowband/receive_path.py index 308f955645..a1a07b5f26 100644 --- a/gr-digital/examples/narrowband/receive_path.py +++ b/gr-digital/examples/narrowband/receive_path.py @@ -23,6 +23,7 @@ from gnuradio import gr, gru, filter from gnuradio import eng_notation from gnuradio import digital +from gnuradio import analog import copy import sys @@ -78,7 +79,7 @@ class receive_path(gr.hier_block2): # Carrier Sensing Blocks alpha = 0.001 thresh = 30 # in dB, will have to adjust - self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha) + self.probe = analog.probe_avg_mag_sqrd_c(thresh,alpha) # Display some information about the setup if self._verbose: diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py index 100caff8ea..079f8cb9b9 100755 --- a/gr-digital/examples/narrowband/rx_voice.py +++ b/gr-digital/examples/narrowband/rx_voice.py @@ -20,7 +20,8 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, blks2, audio, uhd +from gnuradio import gr, audio, uhd +from gnuradio import filter from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -75,7 +76,7 @@ class my_top_block(gr.top_block): audio_rate = self.audio_tx.sample_rate usrp_rate = self.source.get_sample_rate() rrate = audio_rate / usrp_rate - self.resampler = blks2.pfb_arb_resampler_ccf(rrate) + self.resampler = filter.pfb.arb_resampler_ccf(rrate) self.connect(self.source, self.resampler, self.rxpath) diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py index 77862e753f..5c7a3ae501 100755 --- a/gr-digital/examples/ofdm/benchmark_add_channel.py +++ b/gr-digital/examples/ofdm/benchmark_add_channel.py @@ -45,8 +45,9 @@ class my_top_block(gr.top_block): self.src = gr.file_source(gr.sizeof_gr_complex, ifile) #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) + self.channel = filter.channel_model(noise_voltage, frequency_offset, - time_offset, noise_seed=random.randint(0,100000)) + time_offset, noise_seed=-random.randint(0,100000)) self.phase = gr.multiply_const_cc(complex(math.cos(phase_offset), math.sin(phase_offset))) self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile) diff --git a/gr-digital/examples/ofdm/receive_path.py b/gr-digital/examples/ofdm/receive_path.py index b5094ac24d..2a6813f8f9 100644 --- a/gr-digital/examples/ofdm/receive_path.py +++ b/gr-digital/examples/ofdm/receive_path.py @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import eng_notation from gnuradio import digital +from gnuradio import analog import copy import sys @@ -51,7 +52,7 @@ class receive_path(gr.hier_block2): # Carrier Sensing Blocks alpha = 0.001 thresh = 30 # in dB, will have to adjust - self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha) + self.probe = analog.probe_avg_mag_sqrd_c(thresh,alpha) self.connect(self, self.ofdm_rx) self.connect(self.ofdm_rx, self.probe) diff --git a/gr-digital/grc/digital_constellation_receiver_cb.xml b/gr-digital/grc/digital_constellation_receiver_cb.xml index 36c8e1b309..ffda8b85bb 100644 --- a/gr-digital/grc/digital_constellation_receiver_cb.xml +++ b/gr-digital/grc/digital_constellation_receiver_cb.xml @@ -37,4 +37,24 @@ <name>out</name> <type>byte</type> </source> + <source> + <name>error</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>phase</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>frequency</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>symbol</name> + <type>complex</type> + <optional>1</optional> + </source> </block> diff --git a/gr-digital/include/digital/CMakeLists.txt b/gr-digital/include/digital/CMakeLists.txt index d8e17546ed..1a5869b3cd 100644 --- a/gr-digital/include/digital/CMakeLists.txt +++ b/gr-digital/include/digital/CMakeLists.txt @@ -78,6 +78,7 @@ install(FILES api.h constellation.h crc32.h + lfsr.h glfsr.h mpsk_snr_est.h simple_framer_sync.h diff --git a/gr-digital/include/digital/constellation.h b/gr-digital/include/digital/constellation.h index 4e0bff2fb3..330ed03131 100644 --- a/gr-digital/include/digital/constellation.h +++ b/gr-digital/include/digital/constellation.h @@ -126,6 +126,9 @@ namespace gr { unsigned int d_rotational_symmetry; unsigned int d_dimensionality; unsigned int d_arity; + //! The factor by which the user given constellation points were + //! scaled by to achieve an average amplitude of 1. + float d_scalefactor; float get_distance(unsigned int index, const gr_complex *sample); unsigned int get_closest_point(const gr_complex *sample); diff --git a/gr-digital/include/digital/cpmmod_bc.h b/gr-digital/include/digital/cpmmod_bc.h index f65ca8059f..7d91915cdd 100644 --- a/gr-digital/include/digital/cpmmod_bc.h +++ b/gr-digital/include/digital/cpmmod_bc.h @@ -25,7 +25,7 @@ #include <digital/api.h> #include <gr_hier_block2.h> -#include <gr_cpm.h> +#include <analog/cpm.h> namespace gr { namespace digital { @@ -71,7 +71,7 @@ namespace gr { * \param beta For LSRC, this is the rolloff factor. For Gaussian * pulses, this is the 3 dB time-bandwidth product. */ - static sptr make(gr_cpm::cpm_type type, float h, + static sptr make(analog::cpm::cpm_type type, float h, int samples_per_sym, int L, double beta=0.3); diff --git a/gr-digital/include/digital/lfsr.h b/gr-digital/include/digital/lfsr.h new file mode 100644 index 0000000000..2319961257 --- /dev/null +++ b/gr-digital/include/digital/lfsr.h @@ -0,0 +1,162 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2010,2012 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 3, 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_DIGITAL_LFSR_H +#define INCLUDED_DIGITAL_LFSR_H + +#include <digital/api.h> +#include <stdexcept> +#include <stdint.h> + +namespace gr { + namespace digital { + + /*! + * \brief Fibonacci Linear Feedback Shift Register using specified + * polynomial mask + * \ingroup misc + * + * Generates a maximal length pseudo-random sequence of length + * 2^degree-1 + * + * Constructor: digital::lfsr(int mask, int seed, int reg_len); + * + * \param mask - polynomial coefficients representing the + * locations of feedback taps from a shift register + * which are xor'ed together to form the new high + * order bit. + * + * Some common masks might be: + * x^4 + x^3 + x^0 = 0x19 + * x^5 + x^3 + x^0 = 0x29 + * x^6 + x^5 + x^0 = 0x61 + * + * \param seed - the initialization vector placed into the + * register durring initialization. Low order bit + * corresponds to x^0 coefficient -- the first to be + * shifted as output. + * + * \param reg_len - specifies the length of the feedback shift + * register to be used. Durring each iteration, the + * register is rightshifted one and the new bit is + * placed in bit reg_len. reg_len should generally be + * at least order(mask) + 1 + * + * + * see http://en.wikipedia.org/wiki/Linear_feedback_shift_register + * for more explanation. + * + * next_bit() - Standard LFSR operation + * + * Perform one cycle of the LFSR. The output bit is taken from + * the shift register LSB. The shift register MSB is assigned from + * the modulo 2 sum of the masked shift register. + * + * next_bit_scramble(unsigned char input) - Scramble an input stream + * + * Perform one cycle of the LFSR. The output bit is taken from + * the shift register LSB. The shift register MSB is assigned from + * the modulo 2 sum of the masked shift register and the input LSB. + * + * next_bit_descramble(unsigned char input) - Descramble an input stream + * + * Perform one cycle of the LFSR. The output bit is taken from + * the modulo 2 sum of the masked shift register and the input LSB. + * The shift register MSB is assigned from the LSB of the input. + * + * See http://en.wikipedia.org/wiki/Scrambler for operation of these + * last two functions (see multiplicative scrambler.) + */ + class lfsr + { + private: + uint32_t d_shift_register; + uint32_t d_mask; + uint32_t d_seed; + uint32_t d_shift_register_length; // less than 32 + + static uint32_t + popCount(uint32_t x) + { + uint32_t r = x - ((x >> 1) & 033333333333) + - ((x >> 2) & 011111111111); + return ((r + (r >> 3)) & 030707070707) % 63; + } + + public: + lfsr(uint32_t mask, uint32_t seed, uint32_t reg_len) + : d_shift_register(seed), + d_mask(mask), + d_seed(seed), + d_shift_register_length(reg_len) + { + if(reg_len > 31) + throw std::invalid_argument("reg_len must be <= 31"); + } + + unsigned char next_bit() + { + unsigned char output = d_shift_register & 1; + unsigned char newbit = popCount( d_shift_register & d_mask )%2; + d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); + return output; + } + + unsigned char next_bit_scramble(unsigned char input) + { + unsigned char output = d_shift_register & 1; + unsigned char newbit = (popCount( d_shift_register & d_mask )%2)^(input & 1); + d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); + return output; + } + + unsigned char next_bit_descramble(unsigned char input) + { + unsigned char output = (popCount( d_shift_register & d_mask )%2)^(input & 1); + unsigned char newbit = input & 1; + d_shift_register = ((d_shift_register>>1) | (newbit<<d_shift_register_length)); + return output; + } + + /*! + * Reset shift register to initial seed value + */ + void reset() { d_shift_register = d_seed; } + + /*! + * Rotate the register through x number of bits + * where we are just throwing away the results to get queued up correctly + */ + void pre_shift(int num) + { + for(int i=0; i<num; i++) { + next_bit(); + } + } + + int mask() const { return d_mask; } + }; + + } /* namespace digital */ +} /* namespace gr */ + +#endif /* INCLUDED_DIGITAL_LFSR_H */ diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index c95f78000d..650ccf8038 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -23,6 +23,7 @@ include_directories( ${VOLK_INCLUDE_DIRS} ${GNURADIO_CORE_INCLUDE_DIRS} + ${GR_ANALOG_INCLUDE_DIRS} ${GR_DIGITAL_INCLUDE_DIRS} ${GR_FFT_INCLUDE_DIRS} ${GR_FILTER_INCLUDE_DIRS} @@ -157,4 +158,6 @@ list(APPEND digital_libs add_library(gnuradio-digital SHARED ${digital_sources}) target_link_libraries(gnuradio-digital ${digital_libs}) GR_LIBRARY_FOO(gnuradio-digital RUNTIME_COMPONENT "digital_runtime" DEVEL_COMPONENT "digital_devel") -add_dependencies(gnuradio-digital digital_generated_includes digital_generated_swigs gnuradio-filter) +add_dependencies(gnuradio-digital + digital_generated_includes digital_generated_swigs + gnuradio-filter gnuradio-analog) diff --git a/gr-digital/lib/additive_scrambler_bb_impl.h b/gr-digital/lib/additive_scrambler_bb_impl.h index e2dfbc342b..5a4c2f5025 100644 --- a/gr-digital/lib/additive_scrambler_bb_impl.h +++ b/gr-digital/lib/additive_scrambler_bb_impl.h @@ -24,7 +24,7 @@ #define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H #include <digital/additive_scrambler_bb.h> -#include <gri_lfsr.h> +#include <digital/lfsr.h> namespace gr { namespace digital { @@ -33,7 +33,7 @@ namespace gr { : public additive_scrambler_bb { private: - gri_lfsr d_lfsr; + digital::lfsr d_lfsr; int d_count; int d_bits; int d_len; diff --git a/gr-digital/lib/constellation.cc b/gr-digital/lib/constellation.cc index e73b2c8a43..9eee1cc501 100644 --- a/gr-digital/lib/constellation.cc +++ b/gr-digital/lib/constellation.cc @@ -50,9 +50,20 @@ namespace gr { d_rotational_symmetry(rotational_symmetry), d_dimensionality(dimensionality) { + // Scale constellation points so that average magnitude is 1. + float summed_mag = 0; + unsigned int constsize = d_constellation.size(); + for (unsigned int i=0; i<constsize; i++) { + gr_complex c = d_constellation[i]; + summed_mag += sqrt(c.real()*c.real() + c.imag()*c.imag()); + } + d_scalefactor = constsize/summed_mag; + for (unsigned int i=0; i<constsize; i++) { + d_constellation[i] = d_constellation[i]*d_scalefactor; + } if(pre_diff_code.size() == 0) d_apply_pre_diff_code = false; - else if(pre_diff_code.size() != constell.size()) + else if(pre_diff_code.size() != constsize) throw std::runtime_error("The constellation and pre-diff code must be of the same length."); else d_apply_pre_diff_code = true; @@ -318,6 +329,8 @@ namespace gr { n_real_sectors(real_sectors), n_imag_sectors(imag_sectors), d_width_real_sectors(width_real_sectors), d_width_imag_sectors(width_imag_sectors) { + d_width_real_sectors *= d_scalefactor; + d_width_imag_sectors *= d_scalefactor; find_sector_values(); } diff --git a/gr-digital/lib/constellation_receiver_cb_impl.cc b/gr-digital/lib/constellation_receiver_cb_impl.cc index f01e15ea8b..c3203e9079 100644 --- a/gr-digital/lib/constellation_receiver_cb_impl.cc +++ b/gr-digital/lib/constellation_receiver_cb_impl.cc @@ -47,13 +47,13 @@ namespace gr { fmin, fmax)); } - static int ios[] = {sizeof(char), sizeof(float), sizeof(float), sizeof(float)}; + static int ios[] = {sizeof(char), sizeof(float), sizeof(float), sizeof(float), sizeof(gr_complex)}; static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); constellation_receiver_cb_impl::constellation_receiver_cb_impl(constellation_sptr constellation, float loop_bw, float fmin, float fmax) : gr_block("constellation_receiver_cb", gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signaturev(1, 4, iosig)), + gr_make_io_signaturev(1, 5, iosig)), gri_control_loop(loop_bw, fmax, fmin), d_constellation(constellation), d_current_const_point(0) @@ -97,10 +97,12 @@ namespace gr { gr_complex sample, nco; float *out_err = 0, *out_phase = 0, *out_freq = 0; - if(output_items.size() == 4) { + gr_complex *out_symbol; + if(output_items.size() == 5) { out_err = (float*)output_items[1]; out_phase = (float*)output_items[2]; out_freq = (float*)output_items[3]; + out_symbol = (gr_complex*)output_items[4]; } while((i < noutput_items) && (i < ninput_items[0])) { @@ -113,10 +115,11 @@ namespace gr { out[i] = sym_value; - if(output_items.size() == 4) { + if(output_items.size() == 5) { out_err[i] = phase_error; out_phase[i] = d_phase; out_freq[i] = d_freq; + out_symbol[i] = sample; } i++; } diff --git a/gr-digital/lib/cpmmod_bc_impl.cc b/gr-digital/lib/cpmmod_bc_impl.cc index 044090d59a..d6c3a29a29 100644 --- a/gr-digital/lib/cpmmod_bc_impl.cc +++ b/gr-digital/lib/cpmmod_bc_impl.cc @@ -29,13 +29,13 @@ namespace gr { namespace digital { cpmmod_bc::sptr - cpmmod_bc::make(gr_cpm::cpm_type type, float h, + cpmmod_bc::make(analog::cpm::cpm_type type, float h, int samples_per_sym, int L, double beta) { return gnuradio::get_initial_sptr (new cpmmod_bc_impl("cpmmod_bc", - (gr_cpm::cpm_type)type, + (analog::cpm::cpm_type)type, h, samples_per_sym, L, beta)); } @@ -46,30 +46,30 @@ namespace gr { { return gnuradio::get_initial_sptr (new cpmmod_bc_impl("gmskmod_bc", - gr_cpm::GAUSSIAN, 0.5, + analog::cpm::GAUSSIAN, 0.5, samples_per_sym, L, beta)); } cpmmod_bc_impl::cpmmod_bc_impl(const std::string &name, - gr_cpm::cpm_type type, float h, + analog::cpm::cpm_type type, float h, int samples_per_sym, int L, double beta) : gr_hier_block2(name, gr_make_io_signature(1, 1, sizeof(char)), gr_make_io_signature2(1, 1, sizeof(gr_complex), sizeof(float))), d_type(type), d_index(h), d_sps(samples_per_sym), d_length(L), d_beta(beta), - d_taps(gr_cpm::phase_response(type, samples_per_sym, L, beta)), + d_taps(analog::cpm::phase_response(type, samples_per_sym, L, beta)), d_char_to_float(gr_make_char_to_float()), - d_pulse_shaper(gr::filter::interp_fir_filter_fff::make(samples_per_sym, d_taps)), - d_fm(gr_make_frequency_modulator_fc(M_PI * h)) + d_pulse_shaper(filter::interp_fir_filter_fff::make(samples_per_sym, d_taps)), + d_fm(analog::frequency_modulator_fc::make(M_PI * h)) { switch(type) { - case gr_cpm::LRC: - case gr_cpm::LSRC: - case gr_cpm::LREC: - case gr_cpm::TFM: - case gr_cpm::GAUSSIAN: + case analog::cpm::LRC: + case analog::cpm::LSRC: + case analog::cpm::LREC: + case analog::cpm::TFM: + case analog::cpm::GAUSSIAN: break; default: diff --git a/gr-digital/lib/cpmmod_bc_impl.h b/gr-digital/lib/cpmmod_bc_impl.h index d27853e301..3051e49df9 100644 --- a/gr-digital/lib/cpmmod_bc_impl.h +++ b/gr-digital/lib/cpmmod_bc_impl.h @@ -25,8 +25,7 @@ #include <digital/cpmmod_bc.h> #include <gr_char_to_float.h> -#include <gr_frequency_modulator_fc.h> -#include <gr_cpm.h> +#include <analog/frequency_modulator_fc.h> #include <filter/interp_fir_filter_fff.h> namespace gr { @@ -45,11 +44,11 @@ namespace gr { std::vector<float> d_taps; gr_char_to_float_sptr d_char_to_float; gr::filter::interp_fir_filter_fff::sptr d_pulse_shaper; - gr_frequency_modulator_fc_sptr d_fm; + analog::frequency_modulator_fc::sptr d_fm; public: cpmmod_bc_impl(const std::string &name, - gr_cpm::cpm_type type, float h, + analog::cpm::cpm_type type, float h, int samples_per_sym, int L, double beta=0.3); ~cpmmod_bc_impl(); diff --git a/gr-digital/lib/descrambler_bb_impl.h b/gr-digital/lib/descrambler_bb_impl.h index 920182304a..4f07b7c329 100644 --- a/gr-digital/lib/descrambler_bb_impl.h +++ b/gr-digital/lib/descrambler_bb_impl.h @@ -24,7 +24,7 @@ #define INCLUDED_GR_DESCRAMBLER_BB_IMPL_H #include <digital/descrambler_bb.h> -#include <gri_lfsr.h> +#include <digital/lfsr.h> namespace gr { namespace digital { @@ -32,7 +32,7 @@ namespace gr { class descrambler_bb_impl : public descrambler_bb { private: - gri_lfsr d_lfsr; + digital::lfsr d_lfsr; public: descrambler_bb_impl(int mask, int seed, int len); diff --git a/gr-digital/lib/scrambler_bb_impl.h b/gr-digital/lib/scrambler_bb_impl.h index 4a93901c92..8525e7ef5c 100644 --- a/gr-digital/lib/scrambler_bb_impl.h +++ b/gr-digital/lib/scrambler_bb_impl.h @@ -25,7 +25,7 @@ #include <digital/scrambler_bb.h> #include <gr_sync_block.h> -#include <gri_lfsr.h> +#include <digital/lfsr.h> namespace gr { namespace digital { @@ -33,7 +33,7 @@ namespace gr { class scrambler_bb_impl : public scrambler_bb { private: - gri_lfsr d_lfsr; + digital::lfsr d_lfsr; public: scrambler_bb_impl(int mask, int seed, int len); diff --git a/gr-digital/python/CMakeLists.txt b/gr-digital/python/CMakeLists.txt index fdb5acd819..4ea656e29c 100644 --- a/gr-digital/python/CMakeLists.txt +++ b/gr-digital/python/CMakeLists.txt @@ -73,6 +73,8 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-digital/swig ${CMAKE_BINARY_DIR}/gr-filter/python ${CMAKE_BINARY_DIR}/gr-filter/swig + ${CMAKE_BINARY_DIR}/gr-analog/python + ${CMAKE_BINARY_DIR}/gr-analog/swig ) set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-digital) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) diff --git a/gr-digital/python/cpm.py b/gr-digital/python/cpm.py index a2c9f2f0e0..1929a73d30 100644 --- a/gr-digital/python/cpm.py +++ b/gr-digital/python/cpm.py @@ -25,6 +25,7 @@ # See gnuradio-examples/python/digital for examples from gnuradio import gr, filter +from gnuradio import analog from math import pi import numpy @@ -126,7 +127,7 @@ class cpm_mod(gr.hier_block2): if cpm_type == 0: # CPFSK self.taps= (1.0/self._symbols_per_pulse/2,) * self.ntaps elif cpm_type == 1: # GMSK - gaussian_taps = gr.firdes.gaussian( + gaussian_taps = filter.firdes.gaussian( 1.0/2, # gain samples_per_symbol, # symbol_rate bt, # bandwidth * symbol time @@ -145,7 +146,7 @@ class cpm_mod(gr.hier_block2): self.filter = filter.pfb.arb_resampler_fff(samples_per_symbol, self.taps) # FM modulation - self.fmmod = gr.frequency_modulator_fc(sensitivity) + self.fmmod = analog.frequency_modulator_fc(sensitivity) if verbose: self._print_verbage() diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py index 855249dc63..b71118ebcb 100644 --- a/gr-digital/python/generic_mod_demod.py +++ b/gr-digital/python/generic_mod_demod.py @@ -36,6 +36,11 @@ try: except ImportError: import filter_swig as filter +try: + from gnuradio import analog +except ImportError: + import analog_swig as analog + # default values (used in __init__ and add_options) _def_samples_per_symbol = 2 _def_excess_bw = 0.35 @@ -264,7 +269,7 @@ class generic_demod(gr.hier_block2): ntaps = 11 * int(self._samples_per_symbol*nfilts) # Automatic gain control - self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) + self.agc = analog.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) # Frequency correction fll_ntaps = 55 diff --git a/gr-digital/python/gfsk.py b/gr-digital/python/gfsk.py index 09f12ebc30..c69dd4d7d8 100644 --- a/gr-digital/python/gfsk.py +++ b/gr-digital/python/gfsk.py @@ -2,7 +2,7 @@ # GFSK modulation and demodulation. # # -# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# Copyright 2005-2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,7 @@ # See gnuradio-examples/python/digital for examples from gnuradio import gr +from gnuradio import analog import modulation_utils import digital_swig as digital from math import pi @@ -102,7 +103,7 @@ class gfsk_mod(gr.hier_block2): # Form Gaussian filter # Generate Gaussian response (Needs to be convolved with window below). - self.gaussian_taps = gr.firdes.gaussian( + self.gaussian_taps = filter.firdes.gaussian( 1.0, # gain samples_per_symbol, # symbol_rate bt, # bandwidth * symbol time @@ -114,7 +115,7 @@ class gfsk_mod(gr.hier_block2): self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, self.taps) # FM modulation - self.fmmod = gr.frequency_modulator_fc(sensitivity) + self.fmmod = frequency.frequency_modulator_fc(sensitivity) # small amount of output attenuation to prevent clipping USRP sink self.amp = gr.multiply_const_cc(0.999) @@ -230,7 +231,7 @@ class gfsk_demod(gr.hier_block2): # Demodulate FM #sensitivity = (pi / 2) / samples_per_symbol - self.fmdemod = gr.quadrature_demod_cf(1.0 / sensitivity) + self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity) # the clock recovery block tracks the symbol clock and resamples as needed. # the output of the block is a stream of soft symbols (float) diff --git a/gr-digital/python/gmsk.py b/gr-digital/python/gmsk.py index e7853dd0af..c0f5c439aa 100644 --- a/gr-digital/python/gmsk.py +++ b/gr-digital/python/gmsk.py @@ -2,7 +2,7 @@ # GMSK modulation and demodulation. # # -# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# Copyright 2005-2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,7 @@ # See gnuradio-examples/python/digital for examples from gnuradio import gr +from gnuradio import analog import modulation_utils import digital_swig as digital from math import pi @@ -101,7 +102,7 @@ class gmsk_mod(gr.hier_block2): # Form Gaussian filter # Generate Gaussian response (Needs to be convolved with window below). - self.gaussian_taps = gr.firdes.gaussian( + self.gaussian_taps = filter.firdes.gaussian( 1, # gain samples_per_symbol, # symbol_rate bt, # bandwidth * symbol time @@ -113,7 +114,7 @@ class gmsk_mod(gr.hier_block2): self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, self.taps) # FM modulation - self.fmmod = gr.frequency_modulator_fc(sensitivity) + self.fmmod = analog.frequency_modulator_fc(sensitivity) if verbose: self._print_verbage() @@ -220,7 +221,7 @@ class gmsk_demod(gr.hier_block2): # Demodulate FM sensitivity = (pi / 2) / samples_per_symbol - self.fmdemod = gr.quadrature_demod_cf(1.0 / sensitivity) + self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity) # the clock recovery block tracks the symbol clock and resamples as needed. # the output of the block is a stream of soft symbols (float) diff --git a/gr-digital/python/ofdm_receiver.py b/gr-digital/python/ofdm_receiver.py index 1dc3cdf7cd..ace64a8089 100644 --- a/gr-digital/python/ofdm_receiver.py +++ b/gr-digital/python/ofdm_receiver.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright 2006-2008 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ import math from numpy import fft from gnuradio import gr +from gnuradio import analog import digital_swig as digital from ofdm_sync_pn import ofdm_sync_pn @@ -119,7 +120,7 @@ class ofdm_receiver(gr.hier_block2): # Set up blocks - self.nco = gr.frequency_modulator_fc(nco_sensitivity) # generate a signal proportional to frequency error of sync block + self.nco = analog.frequency_modulator_fc(nco_sensitivity) # generate a signal proportional to frequency error of sync block self.sigmix = gr.multiply_cc() self.sampler = digital.ofdm_sampler(fft_length, fft_length+cp_length) self.fft_demod = gr.fft_vcc(fft_length, True, win, True) diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py index 750337a119..9d6f4c6427 100755 --- a/gr-digital/python/qa_constellation.py +++ b/gr-digital/python/qa_constellation.py @@ -23,7 +23,7 @@ import random from cmath import exp, pi, log -from gnuradio import gr, gr_unittest, blks2 +from gnuradio import gr, gr_unittest from utils import mod_codes import digital_swig as digital diff --git a/gr-digital/python/qa_constellation_receiver.py b/gr-digital/python/qa_constellation_receiver.py index 871df2da28..6da3fc1066 100755 --- a/gr-digital/python/qa_constellation_receiver.py +++ b/gr-digital/python/qa_constellation_receiver.py @@ -22,10 +22,11 @@ import random -from gnuradio import gr, blks2, gr_unittest +from gnuradio import gr, gr_unittest from utils import mod_codes, alignment import packet_utils import filter_swig as filter +import analog_swig as analog from generic_mod_demod import generic_mod, generic_demod from qa_constellation import tested_constellations, twod_constell @@ -38,7 +39,7 @@ SEED = 1239 # TESTING PARAMETERS # The number of symbols to test with. # We need this many to let the frequency recovery block converge. -DATA_LENGTH = 2000 +DATA_LENGTH = 1000 # Test fails if fraction of output that is correct is less than this. REQ_CORRECT = 0.7 @@ -51,6 +52,28 @@ TIMING_OFFSET = 1.0 FREQ_BW = 2*math.pi/100.0 PHASE_BW = 2*math.pi/100.0 +class channel_model(gr.hier_block2): + def __init__(self, noise_voltage, freq, timing): + gr.hier_block2.__init__(self, "channel_model", + gr.io_signature(1, 1, gr.sizeof_gr_complex), + gr.io_signature(1, 1, gr.sizeof_gr_complex)) + + + timing_offset = filter.fractional_interpolator_cc(0, timing) + noise_adder = gr.add_cc() + noise = analog.noise_source_c(analog.GR_GAUSSIAN, + noise_voltage, 0) + freq_offset = analog.sig_source_c(1, analog.GR_SIN_WAVE, + freq, 1.0, 0.0) + mixer_offset = gr.multiply_cc(); + + self.connect(self, timing_offset) + self.connect(timing_offset, (mixer_offset,0)) + self.connect(freq_offset, (mixer_offset,1)) + self.connect(mixer_offset, (noise_adder,1)) + self.connect(noise, (noise_adder,0)) + self.connect(noise_adder, self) + class test_constellation_receiver(gr_unittest.TestCase): @@ -131,9 +154,9 @@ class rec_test_tb(gr.top_block): mod = generic_mod(constellation, differential=differential) # Channel if freq_offset: - channel = filter.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET) + channel = channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET) else: - channel = filter.channel_model(NOISE_VOLTAGE, 0, TIMING_OFFSET) + channel = channel_model(NOISE_VOLTAGE, 0, TIMING_OFFSET) # Receiver Blocks if freq_offset: demod = generic_demod(constellation, differential=differential, diff --git a/gr-digital/python/qa_cpm.py b/gr-digital/python/qa_cpm.py index 2221d16b6f..bfeb2bcdd4 100755 --- a/gr-digital/python/qa_cpm.py +++ b/gr-digital/python/qa_cpm.py @@ -22,6 +22,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital +import analog_swig as analog import numpy class test_cpm(gr_unittest.TestCase): @@ -51,16 +52,16 @@ class test_cpm(gr_unittest.TestCase): msg="Phase shift was not correct for CPM method " + name) def test_001_lrec(self): - self.do_check_phase_shift(gr.cpm.LRC, 'LREC') + self.do_check_phase_shift(analog.cpm.LRC, 'LREC') def test_001_lrc(self): - self.do_check_phase_shift(gr.cpm.LRC, 'LRC') + self.do_check_phase_shift(analog.cpm.LRC, 'LRC') def test_001_lsrc(self): - self.do_check_phase_shift(gr.cpm.LSRC, 'LSRC') + self.do_check_phase_shift(analog.cpm.LSRC, 'LSRC') def test_001_ltfm(self): - self.do_check_phase_shift(gr.cpm.TFM, 'TFM') + self.do_check_phase_shift(analog.cpm.TFM, 'TFM') def test_001_lgmsk(self): sps = 2 @@ -82,7 +83,7 @@ class test_cpm(gr_unittest.TestCase): msg="Phase shift was not correct for GMSK") def test_phase_response(self): - phase_response = gr.cpm.phase_response(gr.cpm.LREC, 2, 4) + phase_response = analog.cpm.phase_response(analog.cpm.LREC, 2, 4) self.assertAlmostEqual(numpy.sum(phase_response), 1) diff --git a/gr-digital/python/qa_fll_band_edge.py b/gr-digital/python/qa_fll_band_edge.py index a4269931f5..1e699bbdd4 100755 --- a/gr-digital/python/qa_fll_band_edge.py +++ b/gr-digital/python/qa_fll_band_edge.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ from gnuradio import gr, gr_unittest import digital_swig as digital import filter_swig as filter +import analog_swig as analog import random, math class test_fll_band_edge_cc(gr_unittest.TestCase): @@ -40,7 +41,7 @@ class test_fll_band_edge_cc(gr_unittest.TestCase): ntaps = 45 # Create pulse shape filter - rrc_taps = gr.firdes.root_raised_cosine( + rrc_taps = filter.firdes.root_raised_cosine( sps, sps, 1.0, rolloff, ntaps) # The frequency offset to correct @@ -53,7 +54,7 @@ class test_fll_band_edge_cc(gr_unittest.TestCase): self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps) # Mix symbols with a complex sinusoid to spin them - self.nco = gr.sig_source_c(1, gr.GR_SIN_WAVE, foffset, 1) + self.nco = analog.sig_source_c(1, analog.GR_SIN_WAVE, foffset, 1) self.mix = gr.multiply_cc() # FLL will despin the symbols to an arbitrary phase diff --git a/gr-digital/python/qa_lfsr.py b/gr-digital/python/qa_lfsr.py new file mode 100755 index 0000000000..d70c466ca7 --- /dev/null +++ b/gr-digital/python/qa_lfsr.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# +# Copyright 2012 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 3, 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. +# + +from gnuradio import gr, gr_unittest +import digital_swig as digital +import math + + +class test_lfsr(gr_unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + def test_lfsr_001(self): + reglen = 8 + l = digital.lfsr(1, 1, reglen) + + result_data = [] + for i in xrange(4*(reglen+1)): + result_data.append(l.next_bit()) + + expected_result = 4*([1,] + reglen*[0,]) + self.assertFloatTuplesAlmostEqual(expected_result, result_data, 5) + +if __name__ == '__main__': + gr_unittest.run(test_lfsr, "test_lfsr.xml") + diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt index 299fd1c1d9..5ec34008aa 100644 --- a/gr-digital/swig/CMakeLists.txt +++ b/gr-digital/swig/CMakeLists.txt @@ -24,6 +24,7 @@ include(GrPython) include(GrSwig) set(GR_SWIG_INCLUDE_DIRS + ${GR_ANALOG_INCLUDE_DIRS} ${GR_DIGITAL_INCLUDE_DIRS} ${GR_FILTER_INCLUDE_DIRS} ${GNURADIO_CORE_SWIG_INCLUDE_DIRS} @@ -32,7 +33,7 @@ set(GR_SWIG_INCLUDE_DIRS set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/digital_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib) -set(GR_SWIG_LIBRARIES gnuradio-digital gnuradio-filter) +set(GR_SWIG_LIBRARIES gnuradio-digital gnuradio-filter gnuradio-analog) GR_SWIG_MAKE(digital_swig digital_swig.i) diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i index 3783da75ea..9cb78dd0dc 100644 --- a/gr-digital/swig/digital_swig.i +++ b/gr-digital/swig/digital_swig.i @@ -20,13 +20,15 @@ */ #define DIGITAL_API +#define ANALOG_API %include "gnuradio.i" +%include "stdint.i" //load generated python docstrings %include "digital_swig_doc.i" -%include "gr_cpm.h" +%include "analog/cpm.h" %include "gri_control_loop.h" @@ -36,6 +38,7 @@ %{ #include "digital/metric_type.h" #include "digital/mpsk_snr_est.h" +#include "digital/lfsr.h" #include "digital/additive_scrambler_bb.h" #include "digital/binary_slicer_fb.h" #include "digital/chunks_to_symbols_bf.h" @@ -86,6 +89,7 @@ %include "digital/metric_type.h" %include "digital/mpsk_snr_est.h" +%include "digital/lfsr.h" %include "digital/additive_scrambler_bb.h" %include "digital/binary_slicer_fb.h" %include "digital/chunks_to_symbols_bf.h" diff --git a/gr-fcd/CMakeLists.txt b/gr-fcd/CMakeLists.txt index 1185b3a32d..ff61ce28c6 100644 --- a/gr-fcd/CMakeLists.txt +++ b/gr-fcd/CMakeLists.txt @@ -110,9 +110,12 @@ if(ENABLE_PYTHON) add_subdirectory(grc) add_subdirectory(examples/grc) endif(ENABLE_PYTHON) -add_subdirectory(examples/c++) add_subdirectory(doc) +if(ENABLE_GR_ANALOG) + add_subdirectory(examples/c++) +endif(ENABLE_GR_ANALOG) + ######################################################################## # Create Pkg Config File ######################################################################## diff --git a/gr-fcd/examples/c++/CMakeLists.txt b/gr-fcd/examples/c++/CMakeLists.txt index adad7338cf..1bbeb5953e 100644 --- a/gr-fcd/examples/c++/CMakeLists.txt +++ b/gr-fcd/examples/c++/CMakeLists.txt @@ -21,9 +21,10 @@ include_directories(${GR_FCD_INCLUDE_DIRS}) include_directories(${GNURADIO_CORE_INCLUDE_DIRS}) include_directories(${GR_FILTER_INCLUDE_DIRS}) include_directories(${GR_AUDIO_INCLUDE_DIRS}) +include_directories(${GR_ANALOG_INCLUDE_DIRS}) add_executable(fcd_nfm_rx fcd_nfm_rx.cc) -target_link_libraries(fcd_nfm_rx gnuradio-fcd gnuradio-filter) +target_link_libraries(fcd_nfm_rx gnuradio-fcd gnuradio-filter gnuradio-analog) INSTALL(TARGETS fcd_nfm_rx diff --git a/gr-fcd/examples/c++/fcd_nfm_rx.cc b/gr-fcd/examples/c++/fcd_nfm_rx.cc index 61417018a6..a0eee134d0 100644 --- a/gr-fcd/examples/c++/fcd_nfm_rx.cc +++ b/gr-fcd/examples/c++/fcd_nfm_rx.cc @@ -35,7 +35,7 @@ #include <gr_top_block.h> #include <filter/firdes.h> #include <filter/fir_filter_ccf.h> -#include <gr_quadrature_demod_cf.h> +#include <analog/quadrature_demod_cf.h> #include <gr_audio_sink.h> #include <fcd_source_c.h> @@ -43,7 +43,7 @@ #include <iostream> #include <boost/program_options.hpp> - +using namespace gr; namespace po = boost::program_options; int main(int argc, char **argv) @@ -85,12 +85,13 @@ int main(int argc, char **argv) fcd->set_lna_gain(gain); // Low pass filter - std::vector<float> taps = gr::filter::firdes::low_pass(1.0, 96000, 5000.0, 1000.0); - gr::filter::fir_filter_ccf::sptr filter = gr::filter::fir_filter_ccf::make (2, taps); + std::vector<float> taps = filter::firdes::low_pass(1.0, 96000, 5000.0, 1000.0); + filter::fir_filter_ccf::sptr filter = filter::fir_filter_ccf::make (2, taps); // FM demodulator // gain = sample_rate / (2*pi*max_dev) - gr_quadrature_demod_cf_sptr demod = gr_make_quadrature_demod_cf (rate/(2.0*pi*5000.0)); + analog::quadrature_demod_cf::sptr demod = \ + analog::quadrature_demod_cf::make(rate/(2.0*pi*5000.0)); // Audio sink audio_sink::sptr sink = audio_make_sink(rate); diff --git a/gr-fcd/examples/grc/fcd_nfm_rx.grc b/gr-fcd/examples/grc/fcd_nfm_rx.grc index 9dac3fcb85..98d06d9ef1 100644 --- a/gr-fcd/examples/grc/fcd_nfm_rx.grc +++ b/gr-fcd/examples/grc/fcd_nfm_rx.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sun May 8 18:05:32 2011</timestamp> + <timestamp>Tue Nov 6 12:24:50 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -375,10 +379,10 @@ </param> </block> <block> - <key>low_pass_filter</key> + <key>gr_multiply_const_vxx</key> <param> <key>id</key> - <value>low_pass_filter</value> + <value>gr_multiply_const_vxx_1</value> </param> <param> <key>_enabled</key> @@ -386,43 +390,19 @@ </param> <param> <key>type</key> - <value>fir_filter_ccf</value> - </param> - <param> - <key>decim</key> - <value>1</value> + <value>float</value> </param> <param> - <key>interp</key> - <value>1</value> + <key>const</key> + <value>af_gain</value> </param> <param> - <key>gain</key> + <key>vlen</key> <value>1</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>cutoff_freq</key> - <value>width/2</value> - </param> - <param> - <key>width</key> - <value>trans</value> - </param> - <param> - <key>win</key> - <value>firdes.WIN_HAMMING</value> - </param> - <param> - <key>beta</key> - <value>6.76</value> - </param> - <param> <key>_coordinate</key> - <value>(742, 258)</value> + <value>(674, 507)</value> </param> <param> <key>_rotation</key> @@ -430,26 +410,34 @@ </param> </block> <block> - <key>gr_simple_squelch_cc</key> + <key>audio_sink</key> <param> <key>id</key> - <value>gr_simple_squelch_cc_0</value> + <value>audio_sink</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>threshold</key> - <value>sql_lev</value> + <key>samp_rate</key> + <value>48000</value> </param> <param> - <key>alpha</key> - <value>1</value> + <key>device_name</key> + <value></value> + </param> + <param> + <key>ok_to_block</key> + <value>True</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> </param> <param> <key>_coordinate</key> - <value>(226, 499)</value> + <value>(882, 511)</value> </param> <param> <key>_rotation</key> @@ -457,34 +445,22 @@ </param> </block> <block> - <key>blks2_nbfm_rx</key> + <key>variable</key> <param> <key>id</key> - <value>nbfm_normal</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>audio_rate</key> - <value>48000</value> - </param> - <param> - <key>quad_rate</key> + <key>value</key> <value>96000</value> </param> <param> - <key>tau</key> - <value>75e-6</value> - </param> - <param> - <key>max_dev</key> - <value>5e3</value> - </param> - <param> <key>_coordinate</key> - <value>(441, 483)</value> + <value>(210, 12)</value> </param> <param> <key>_rotation</key> @@ -492,65 +468,54 @@ </param> </block> <block> - <key>gr_multiply_const_vxx</key> + <key>variable_slider</key> <param> <key>id</key> - <value>gr_multiply_const_vxx_1</value> + <value>sql_lev</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>const</key> - <value>af_gain</value> + <key>label</key> + <value>SQL</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>value</key> + <value>-100</value> </param> <param> - <key>_coordinate</key> - <value>(674, 507)</value> + <key>min</key> + <value>-100</value> </param> <param> - <key>_rotation</key> + <key>max</key> <value>0</value> </param> - </block> - <block> - <key>audio_sink</key> <param> - <key>id</key> - <value>audio_sink</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> + <key>num_steps</key> + <value>500</value> </param> <param> - <key>samp_rate</key> - <value>48000</value> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> </param> <param> - <key>device_name</key> - <value></value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>ok_to_block</key> - <value>True</value> + <key>grid_pos</key> + <value>7,2,1,1</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(882, 511)</value> + <value>(328, 728)</value> </param> <param> <key>_rotation</key> @@ -561,7 +526,7 @@ <key>variable</key> <param> <key>id</key> - <value>samp_rate</value> + <value>xlate_filter_taps</value> </param> <param> <key>_enabled</key> @@ -569,11 +534,11 @@ </param> <param> <key>value</key> - <value>96000</value> + <value>firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)</value> </param> <param> <key>_coordinate</key> - <value>(210, 12)</value> + <value>(428, 294)</value> </param> <param> <key>_rotation</key> @@ -581,78 +546,85 @@ </param> </block> <block> - <key>wxgui_fftsink2</key> + <key>variable_chooser</key> <param> <key>id</key> - <value>fftsink</value> + <value>display_selector</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>label</key> + <value>Spectrum</value> </param> <param> - <key>title</key> - <value></value> + <key>value</key> + <value>0</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>choices</key> + <value>[0, 1]</value> </param> <param> - <key>baseband_freq</key> - <value>rx_freq*display_selector</value> + <key>labels</key> + <value>['Baseband','RF']</value> </param> <param> - <key>y_per_div</key> - <value>10</value> + <key>type</key> + <value>drop_down</value> </param> <param> - <key>y_divs</key> - <value>10</value> + <key>style</key> + <value>wx.RA_HORIZONTAL</value> </param> <param> - <key>ref_level</key> - <value>0</value> + <key>grid_pos</key> + <value>5,0,1,1</value> </param> <param> - <key>ref_scale</key> - <value>1.0</value> + <key>notebook</key> + <value></value> </param> <param> - <key>fft_size</key> - <value>512</value> + <key>_coordinate</key> + <value>(481, 728)</value> </param> <param> - <key>fft_rate</key> - <value>15</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable_text_box</key> <param> - <key>peak_hold</key> - <value>False</value> + <key>id</key> + <value>freq</value> </param> <param> - <key>average</key> + <key>_enabled</key> <value>True</value> </param> <param> - <key>avg_alpha</key> - <value>0.5</value> + <key>label</key> + <value>FCD Freq</value> </param> <param> - <key>win</key> - <value>None</value> + <key>value</key> + <value>144470000</value> </param> <param> - <key>win_size</key> - <value>800,300</value> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>formatter</key> + <value>None</value> </param> <param> <key>grid_pos</key> - <value>0,0,5,4</value> + <value>5,1,1,1</value> </param> <param> <key>notebook</key> @@ -660,7 +632,7 @@ </param> <param> <key>_coordinate</key> - <value>(742, 24)</value> + <value>(339, 9)</value> </param> <param> <key>_rotation</key> @@ -671,7 +643,7 @@ <key>variable_slider</key> <param> <key>id</key> - <value>sql_lev</value> + <value>rf_gain</value> </param> <param> <key>_enabled</key> @@ -679,23 +651,23 @@ </param> <param> <key>label</key> - <value>SQL</value> + <value>RF</value> </param> <param> <key>value</key> - <value>-100</value> + <value>20</value> </param> <param> <key>min</key> - <value>-100</value> + <value>-5</value> </param> <param> <key>max</key> - <value>0</value> + <value>30</value> </param> <param> <key>num_steps</key> - <value>500</value> + <value>35</value> </param> <param> <key>style</key> @@ -707,7 +679,7 @@ </param> <param> <key>grid_pos</key> - <value>7,2,1,1</value> + <value>7,1,1,1</value> </param> <param> <key>notebook</key> @@ -715,7 +687,7 @@ </param> <param> <key>_coordinate</key> - <value>(328, 728)</value> + <value>(11, 725)</value> </param> <param> <key>_rotation</key> @@ -723,22 +695,54 @@ </param> </block> <block> - <key>variable</key> + <key>fcd_source_c</key> <param> <key>id</key> - <value>xlate_filter_taps</value> + <value>fcd_source_c_1</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)</value> + <key>device_name</key> + <value>hw:1</value> + </param> + <param> + <key>freq</key> + <value>freq</value> + </param> + <param> + <key>lna</key> + <value>rf_gain</value> + </param> + <param> + <key>mixer</key> + <value>+12</value> + </param> + <param> + <key>ppm</key> + <value>-120</value> + </param> + <param> + <key>dci</key> + <value>0.0</value> + </param> + <param> + <key>dcq</key> + <value>0.0</value> + </param> + <param> + <key>iq_phase</key> + <value>0.0</value> + </param> + <param> + <key>iq_gain</key> + <value>1.0</value> </param> <param> <key>_coordinate</key> - <value>(428, 294)</value> + <value>(165, 157)</value> </param> <param> <key>_rotation</key> @@ -746,93 +750,90 @@ </param> </block> <block> - <key>variable_chooser</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>display_selector</value> + <value>fftsink</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Spectrum</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>value</key> - <value>0</value> + <key>title</key> + <value></value> </param> <param> - <key>choices</key> - <value>[0, 1]</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>labels</key> - <value>['Baseband','RF']</value> + <key>baseband_freq</key> + <value>rx_freq*display_selector</value> </param> <param> - <key>type</key> - <value>drop_down</value> + <key>y_per_div</key> + <value>10</value> </param> <param> - <key>style</key> - <value>wx.RA_HORIZONTAL</value> + <key>y_divs</key> + <value>10</value> </param> <param> - <key>grid_pos</key> - <value>5,0,1,1</value> + <key>ref_level</key> + <value>0</value> </param> <param> - <key>notebook</key> - <value></value> + <key>ref_scale</key> + <value>1.0</value> </param> <param> - <key>_coordinate</key> - <value>(481, 728)</value> + <key>fft_size</key> + <value>512</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>fft_rate</key> + <value>15</value> </param> - </block> - <block> - <key>variable_text_box</key> <param> - <key>id</key> - <value>freq</value> + <key>peak_hold</key> + <value>False</value> </param> <param> - <key>_enabled</key> + <key>average</key> <value>True</value> </param> <param> - <key>label</key> - <value>FCD Freq</value> - </param> - <param> - <key>value</key> - <value>144470000</value> + <key>avg_alpha</key> + <value>0.5</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>win</key> + <value>None</value> </param> <param> - <key>formatter</key> - <value>None</value> + <key>win_size</key> + <value>800,300</value> </param> <param> <key>grid_pos</key> - <value>5,1,1,1</value> + <value>0,0,5,4</value> </param> <param> <key>notebook</key> <value></value> </param> <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> - <value>(339, 9)</value> + <value>(742, 24)</value> </param> <param> <key>_rotation</key> @@ -840,10 +841,10 @@ </param> </block> <block> - <key>gr_freq_xlating_fir_filter_xxx</key> + <key>freq_xlating_fir_filter_xxx</key> <param> <key>id</key> - <value>xlating_fir_filter</value> + <value>freq_xlating_fir_filter_xxx_0</value> </param> <param> <key>_enabled</key> @@ -871,7 +872,7 @@ </param> <param> <key>_coordinate</key> - <value>(433, 189)</value> + <value>(422, 173)</value> </param> <param> <key>_rotation</key> @@ -879,105 +880,116 @@ </param> </block> <block> - <key>variable_slider</key> + <key>blks2_nbfm_rx</key> <param> <key>id</key> - <value>rf_gain</value> + <value>nbfm_normal</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>RF</value> + <key>audio_rate</key> + <value>48000</value> </param> <param> - <key>value</key> - <value>20</value> + <key>quad_rate</key> + <value>96000</value> </param> <param> - <key>min</key> - <value>-5</value> + <key>tau</key> + <value>75e-6</value> </param> <param> - <key>max</key> - <value>30</value> + <key>max_dev</key> + <value>5e3</value> </param> <param> - <key>num_steps</key> - <value>35</value> + <key>_coordinate</key> + <value>(441, 483)</value> </param> <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>low_pass_filter</key> <param> - <key>converver</key> - <value>float_converter</value> + <key>id</key> + <value>low_pass_filter</value> </param> <param> - <key>grid_pos</key> - <value>7,1,1,1</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>notebook</key> - <value></value> + <key>type</key> + <value>fir_filter_ccf</value> </param> <param> - <key>_coordinate</key> - <value>(11, 725)</value> + <key>decim</key> + <value>1</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>interp</key> + <value>1</value> </param> - </block> - <block> - <key>fcd_source_c</key> <param> - <key>id</key> - <value>fcd_source_c_1</value> + <key>gain</key> + <value>1</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>device_name</key> - <value>hw:1</value> + <key>cutoff_freq</key> + <value>width/2</value> </param> <param> - <key>freq</key> - <value>freq</value> + <key>width</key> + <value>trans</value> </param> <param> - <key>lna</key> - <value>rf_gain</value> + <key>win</key> + <value>firdes.WIN_HAMMING</value> </param> <param> - <key>ppm</key> - <value>-120</value> + <key>beta</key> + <value>6.76</value> </param> <param> - <key>dci</key> - <value>0.0</value> + <key>_coordinate</key> + <value>(742, 258)</value> </param> <param> - <key>dcq</key> - <value>0.0</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>analog_simple_squelch_cc</key> <param> - <key>iq_phase</key> - <value>0.0</value> + <key>id</key> + <value>analog_simple_squelch_cc_0</value> </param> <param> - <key>iq_gain</key> - <value>1.0</value> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>threshold</key> + <value>sql_lev</value> + </param> + <param> + <key>alpha</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(165, 157)</value> + <value>(227, 499)</value> </param> <param> <key>_rotation</key> @@ -985,50 +997,50 @@ </param> </block> <connection> - <source_block_id>xlating_fir_filter</source_block_id> - <sink_block_id>fftsink</sink_block_id> + <source_block_id>gr_multiply_const_vxx_1</source_block_id> + <sink_block_id>audio_sink</sink_block_id> <source_key>0</source_key> - <sink_key>0</sink_key> + <sink_key>1</sink_key> </connection> <connection> - <source_block_id>xlating_fir_filter</source_block_id> - <sink_block_id>low_pass_filter</sink_block_id> + <source_block_id>gr_multiply_const_vxx_1</source_block_id> + <sink_block_id>audio_sink</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>low_pass_filter</source_block_id> - <sink_block_id>gr_simple_squelch_cc_0</sink_block_id> + <source_block_id>nbfm_normal</source_block_id> + <sink_block_id>gr_multiply_const_vxx_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_multiply_const_vxx_1</source_block_id> - <sink_block_id>audio_sink</sink_block_id> + <source_block_id>fcd_source_c_1</source_block_id> + <sink_block_id>freq_xlating_fir_filter_xxx_0</sink_block_id> <source_key>0</source_key> - <sink_key>1</sink_key> + <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_multiply_const_vxx_1</source_block_id> - <sink_block_id>audio_sink</sink_block_id> + <source_block_id>freq_xlating_fir_filter_xxx_0</source_block_id> + <sink_block_id>fftsink</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_simple_squelch_cc_0</source_block_id> - <sink_block_id>nbfm_normal</sink_block_id> + <source_block_id>freq_xlating_fir_filter_xxx_0</source_block_id> + <sink_block_id>low_pass_filter</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>nbfm_normal</source_block_id> - <sink_block_id>gr_multiply_const_vxx_1</sink_block_id> + <source_block_id>analog_simple_squelch_cc_0</source_block_id> + <sink_block_id>nbfm_normal</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>fcd_source_c_1</source_block_id> - <sink_block_id>xlating_fir_filter</sink_block_id> + <source_block_id>low_pass_filter</source_block_id> + <sink_block_id>analog_simple_squelch_cc_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-fcd/python/CMakeLists.txt b/gr-fcd/python/CMakeLists.txt index 55233d256e..9e59e643f2 100644 --- a/gr-fcd/python/CMakeLists.txt +++ b/gr-fcd/python/CMakeLists.txt @@ -42,6 +42,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-fcd/swig ) set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-audio gnuradio-fcd) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-fft/lib/fft_vfc_fftw.cc b/gr-fft/lib/fft_vfc_fftw.cc index 8f9b127e5b..890dac7be7 100644 --- a/gr-fft/lib/fft_vfc_fftw.cc +++ b/gr-fft/lib/fft_vfc_fftw.cc @@ -45,7 +45,7 @@ namespace gr { const std::vector<float> &window, int nthreads) : gr_sync_block("fft_vfc_fftw", - gr_make_io_signature(1, 1, fft_size * sizeof(gr_complex)), + gr_make_io_signature(1, 1, fft_size * sizeof(float)), gr_make_io_signature(1, 1, fft_size * sizeof(gr_complex))), d_fft_size(fft_size), d_forward(forward) { diff --git a/gr-fft/python/CMakeLists.txt b/gr-fft/python/CMakeLists.txt index 3cca444f9a..c994b1a6ae 100644 --- a/gr-fft/python/CMakeLists.txt +++ b/gr-fft/python/CMakeLists.txt @@ -43,6 +43,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-fft/swig ) set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-fft) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-filter/apps/gr_filter_design b/gr-filter/apps/gr_filter_design index cc21ea5e76..6de52f4cb9 100755 --- a/gr-filter/apps/gr_filter_design +++ b/gr-filter/apps/gr_filter_design @@ -2,7 +2,8 @@ import sys, os, re, csv from optparse import OptionParser -from gnuradio import gr, blks2, eng_notation +from gnuradio import gr, eng_notation +from gnuradio import filter try: import scipy @@ -477,8 +478,8 @@ class gr_plot_filter(QtGui.QMainWindow): if(ret): try: - taps = blks2.optfir.low_pass(gain, fs, pb, sb, - ripple, atten) + taps = filter.optfir.low_pass(gain, fs, pb, sb, + ripple, atten) except RuntimeError, e: reply = QtGui.QMessageBox.information(self, "Filter did not converge", e.args[0], "&Ok") @@ -508,8 +509,8 @@ class gr_plot_filter(QtGui.QMainWindow): sb1 = pb1 - tb sb2 = pb2 + tb try: - taps = blks2.optfir.band_pass(gain, fs, sb1, pb1, pb2, sb2, - ripple, atten) + taps = filter.optfir.band_pass(gain, fs, sb1, pb1, pb2, sb2, + ripple, atten) except RuntimeError, e: reply = QtGui.QMessageBox.information(self, "Filter did not converge", e.args[0], "&Ok") @@ -541,8 +542,8 @@ class gr_plot_filter(QtGui.QMainWindow): sb1 = pb1 - tb sb2 = pb2 + tb try: - taps = blks2.optfir.complex_band_pass(gain, fs, sb1, pb1, pb2, sb2, - ripple, atten) + taps = filter.optfir.complex_band_pass(gain, fs, sb1, pb1, pb2, sb2, + ripple, atten) except RuntimeError, e: reply = QtGui.QMessageBox.information(self, "Filter did not converge", e.args[0], "&Ok") @@ -573,8 +574,8 @@ class gr_plot_filter(QtGui.QMainWindow): pb1 = sb1 - tb pb2 = sb2 + tb try: - taps = blks2.optfir.band_reject(gain, fs, pb1, sb1, sb2, pb2, - ripple, atten) + taps = filter.optfir.band_reject(gain, fs, pb1, sb1, sb2, pb2, + ripple, atten) except RuntimeError, e: reply = QtGui.QMessageBox.information(self, "Filter did not converge", e.args[0], "&Ok") @@ -601,8 +602,8 @@ class gr_plot_filter(QtGui.QMainWindow): if(r): try: - taps = blks2.optfir.high_pass(gain, fs, sb, pb, - atten, ripple) + taps = filter.optfir.high_pass(gain, fs, sb, pb, + atten, ripple) except RuntimeError, e: reply = QtGui.QMessageBox.information(self, "Filter did not converge", e.args[0], "&Ok") diff --git a/gr-filter/examples/CMakeLists.txt b/gr-filter/examples/CMakeLists.txt index d94e5c16e1..a3901b60f3 100644 --- a/gr-filter/examples/CMakeLists.txt +++ b/gr-filter/examples/CMakeLists.txt @@ -27,7 +27,6 @@ GR_PYTHON_INSTALL(PROGRAMS fft_filter_ccc.py fir_filter_ccc.py fir_filter_fff.py - fmtest.py interpolate.py reconstruction.py resampler.py diff --git a/gr-filter/examples/channelize.py b/gr-filter/examples/channelize.py index 1f784d9b06..1745b3f7af 100755 --- a/gr-filter/examples/channelize.py +++ b/gr-filter/examples/channelize.py @@ -20,22 +20,28 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, blks2 +from gnuradio import gr from gnuradio import filter import sys, time try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + +try: import scipy from scipy import fftpack except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." + sys.stderr.write("Error: Program requires scipy (see: www.scipy.org).\n") sys.exit(1) try: import pylab from pylab import mlab except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.stderr.write("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).\n") sys.exit(1) class pfb_top_block(gr.top_block): @@ -66,7 +72,7 @@ class pfb_top_block(gr.top_block): freqs = [-70, -50, -30, -10, 10, 20, 40, 60, 80] for i in xrange(len(freqs)): f = freqs[i] + (M/2-M+i+1)*self._fs - self.signals.append(gr.sig_source_c(self._ifs, gr.GR_SIN_WAVE, f, 1)) + self.signals.append(analog.sig_source_c(self._ifs, analog.GR_SIN_WAVE, f, 1)) self.connect(self.signals[i], (self.add,i)) self.head = gr.head(gr.sizeof_gr_complex, self._N) diff --git a/gr-filter/examples/chirp_channelize.py b/gr-filter/examples/chirp_channelize.py index 3638c55d1a..e52a44dde4 100755 --- a/gr-filter/examples/chirp_channelize.py +++ b/gr-filter/examples/chirp_channelize.py @@ -20,22 +20,28 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, blks2 +from gnuradio import gr from gnuradio import filter import sys, time try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + +try: import scipy from scipy import fftpack except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." + sys.stderr.write("Error: Program requires scipy (see: www.scipy.org).\n") sys.exit(1) try: import pylab from pylab import mlab except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.stderr.write("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).\n") sys.exit(1) class pfb_top_block(gr.top_block): @@ -59,7 +65,7 @@ class pfb_top_block(gr.top_block): repeated = True if(repeated): - self.vco_input = gr.sig_source_f(self._fs, gr.GR_SIN_WAVE, 0.25, 110) + self.vco_input = analog.sig_source_f(self._fs, analog.GR_SIN_WAVE, 0.25, 110) else: amp = 100 data = scipy.arange(0, amp, amp/float(self._N)) diff --git a/gr-filter/examples/decimate.py b/gr-filter/examples/decimate.py index 7f1f03d8f2..4a7a5eb155 100755 --- a/gr-filter/examples/decimate.py +++ b/gr-filter/examples/decimate.py @@ -25,17 +25,23 @@ from gnuradio import filter import sys, time try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + +try: import scipy from scipy import fftpack except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." + sys.stderr.write("Error: Program requires scipy (see: www.scipy.org).\n") sys.exit(1) try: import pylab from pylab import mlab except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.stderr.write("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).\n") sys.exit(1) class pfb_top_block(gr.top_block): @@ -65,7 +71,7 @@ class pfb_top_block(gr.top_block): self.add = gr.add_cc() freqs = [10, 20, 2040] for i in xrange(len(freqs)): - self.signals.append(gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freqs[i], 1)) + self.signals.append(analog.sig_source_c(self._fs, analog.GR_SIN_WAVE, freqs[i], 1)) self.connect(self.signals[i], (self.add,i)) self.head = gr.head(gr.sizeof_gr_complex, self._N) diff --git a/gr-filter/examples/fft_filter_ccc.py b/gr-filter/examples/fft_filter_ccc.py index 45e241a6f6..676e7d9f16 100755 --- a/gr-filter/examples/fft_filter_ccc.py +++ b/gr-filter/examples/fft_filter_ccc.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from gnuradio import gr, filter +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -33,7 +34,7 @@ class example_fft_filter_ccc(gr.top_block): self._tw, self._at) print "Num. Taps: ", len(taps) - self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1) + self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1) self.head = gr.head(gr.sizeof_gr_complex, self._nsamps) self.filt0 = filter.fft_filter_ccc(self._decim, taps) diff --git a/gr-filter/examples/fir_filter_ccc.py b/gr-filter/examples/fir_filter_ccc.py index baa05eeb7c..6e68fc0af7 100755 --- a/gr-filter/examples/fir_filter_ccc.py +++ b/gr-filter/examples/fir_filter_ccc.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from gnuradio import gr, filter +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -30,7 +31,7 @@ class example_fir_filter_ccc(gr.top_block): taps = filter.firdes.low_pass_2(1, self._fs, self._bw, self._tw, self._at) print "Num. Taps: ", len(taps) - self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1) + self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1) self.head = gr.head(gr.sizeof_gr_complex, self._nsamps) self.filt0 = filter.fir_filter_ccc(self._decim, taps) diff --git a/gr-filter/examples/fir_filter_fff.py b/gr-filter/examples/fir_filter_fff.py index 48769f00df..a1a8ab9573 100755 --- a/gr-filter/examples/fir_filter_fff.py +++ b/gr-filter/examples/fir_filter_fff.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from gnuradio import gr, filter +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -30,7 +31,7 @@ class example_fir_filter_fff(gr.top_block): taps = filter.firdes.low_pass_2(1, self._fs, self._bw, self._tw, self._at) print "Num. Taps: ", len(taps) - self.src = gr.noise_source_f(gr.GR_GAUSSIAN, 1) + self.src = analog.noise_source_f(analog.GR_GAUSSIAN, 1) self.head = gr.head(gr.sizeof_float, self._nsamps) self.filt0 = filter.fir_filter_fff(self._decim, taps) diff --git a/gr-filter/examples/interpolate.py b/gr-filter/examples/interpolate.py index 56d78d597b..45f4b3f801 100755 --- a/gr-filter/examples/interpolate.py +++ b/gr-filter/examples/interpolate.py @@ -25,17 +25,23 @@ from gnuradio import filter import sys, time try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + +try: import scipy from scipy import fftpack except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." + sys.stderr.write("Error: Program requires scipy (see: www.scipy.org).\n") sys.exit(1) try: import pylab from pylab import mlab except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.stderr.write("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).\n") sys.exit(1) class pfb_top_block(gr.top_block): @@ -78,8 +84,8 @@ class pfb_top_block(gr.top_block): print "Taps per channel: ", tpc # Create a couple of signals at different frequencies - self.signal1 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq1, 0.5) - self.signal2 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq2, 0.5) + self.signal1 = analog.sig_source_c(self._fs, analog.GR_SIN_WAVE, freq1, 0.5) + self.signal2 = analog.sig_source_c(self._fs, analog.GR_SIN_WAVE, freq2, 0.5) self.signal = gr.add_cc() self.head = gr.head(gr.sizeof_gr_complex, self._N) diff --git a/gr-filter/examples/reconstruction.py b/gr-filter/examples/reconstruction.py index f4908006fc..75c224e79c 100755 --- a/gr-filter/examples/reconstruction.py +++ b/gr-filter/examples/reconstruction.py @@ -24,6 +24,12 @@ from gnuradio import gr, digital from gnuradio import filter try: + from gnuradio import channels +except ImportError: + print "Error: Program requires gr-channels." + sys.exit(1) + +try: import scipy from scipy import fftpack except ImportError: diff --git a/gr-filter/examples/resampler.py b/gr-filter/examples/resampler.py index 395e095cbd..5efb435631 100755 --- a/gr-filter/examples/resampler.py +++ b/gr-filter/examples/resampler.py @@ -25,15 +25,21 @@ from gnuradio import filter import sys try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + +try: import scipy except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." + sys.stderr.write("Error: Program requires scipy (see: www.scipy.org).\n") sys.exit(1) try: import pylab except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.stderr.write("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).\n") sys.exit(1) class mytb(gr.top_block): @@ -46,8 +52,8 @@ class mytb(gr.top_block): # Creating our own taps taps = gr.firdes.low_pass_2(32, 32, 0.25, 0.1, 80) - self.src = gr.sig_source_c(fs_in, gr.GR_SIN_WAVE, fc, 1) - #self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1) + self.src = analog.sig_source_c(fs_in, analog.GR_SIN_WAVE, fc, 1) + #self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1) self.head = gr.head(gr.sizeof_gr_complex, N) # A resampler with our taps diff --git a/gr-filter/examples/resampler_demo.grc b/gr-filter/examples/resampler_demo.grc index b3991ac198..7616d0bccd 100644 --- a/gr-filter/examples/resampler_demo.grc +++ b/gr-filter/examples/resampler_demo.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Tue Jun 19 21:31:30 2012</timestamp> + <timestamp>Sat Nov 10 14:47:16 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -57,22 +61,22 @@ </param> </block> <block> - <key>import</key> + <key>variable</key> <param> <key>id</key> - <value>import_0</value> + <value>rs_taps</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>import</key> - <value>import math</value> + <key>value</key> + <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value> </param> <param> <key>_coordinate</key> - <value>(11, 59)</value> + <value>(273, 154)</value> </param> <param> <key>_rotation</key> @@ -83,7 +87,7 @@ <key>variable</key> <param> <key>id</key> - <value>rs_taps</value> + <value>nphases</value> </param> <param> <key>_enabled</key> @@ -91,11 +95,11 @@ </param> <param> <key>value</key> - <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value> + <value>32</value> </param> <param> <key>_coordinate</key> - <value>(273, 154)</value> + <value>(185, 153)</value> </param> <param> <key>_rotation</key> @@ -103,61 +107,42 @@ </param> </block> <block> - <key>gr_add_const_vxx</key> + <key>variable_static_text</key> <param> <key>id</key> - <value>adder</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>const</key> - <value>-1.0</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(227, 303)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> + <key>label</key> + <value>Sample Rate</value> </param> - </block> - <block> - <key>gr_throttle</key> <param> - <key>id</key> - <value>throttle</value> + <key>value</key> + <value>44100</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>type</key> - <value>float</value> + <key>formatter</key> + <value>None</value> </param> <param> - <key>samples_per_second</key> - <value>samp_rate</value> + <key>grid_pos</key> + <value>0, 0, 1, 1</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>notebook</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(227, 493)</value> + <value>(179, 14)</value> </param> <param> <key>_rotation</key> @@ -165,78 +150,77 @@ </param> </block> <block> - <key>wxgui_fftsink2</key> + <key>variable_static_text</key> <param> <key>id</key> - <value>orig_fft</value> + <value>new_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Original Spectrum</value> + <key>label</key> + <value>Resampled Rate</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>value</key> + <value>48000</value> </param> <param> - <key>baseband_freq</key> - <value>0</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>y_per_div</key> - <value>10</value> + <key>formatter</key> + <value>None</value> </param> <param> - <key>y_divs</key> - <value>10</value> + <key>grid_pos</key> + <value>0, 1, 1, 1</value> </param> <param> - <key>ref_level</key> - <value>30</value> + <key>notebook</key> + <value></value> </param> <param> - <key>ref_scale</key> - <value>2.0</value> + <key>_coordinate</key> + <value>(328, 15)</value> </param> <param> - <key>fft_size</key> - <value>1024</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable_static_text</key> <param> - <key>fft_rate</key> - <value>30</value> + <key>id</key> + <value>frac_bw</value> </param> <param> - <key>peak_hold</key> - <value>False</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>average</key> - <value>False</value> + <key>label</key> + <value>Fractional Bandwidth</value> </param> <param> - <key>avg_alpha</key> - <value>0</value> + <key>value</key> + <value>0.45</value> </param> <param> - <key>win</key> - <value>None</value> + <key>converver</key> + <value>float_converter</value> </param> <param> - <key>win_size</key> - <value></value> + <key>formatter</key> + <value>lambda x: "%0.2f"%x</value> </param> <param> <key>grid_pos</key> - <value>1, 0, 1, 3</value> + <value>0,2,1,1</value> </param> <param> <key>notebook</key> @@ -244,18 +228,18 @@ </param> <param> <key>_coordinate</key> - <value>(409, 289)</value> + <value>(473, 14)</value> </param> <param> <key>_rotation</key> - <value>180</value> + <value>0</value> </param> </block> <block> - <key>gr_sig_source_x</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>tri_source</value> + <value>throttle</value> </param> <param> <key>_enabled</key> @@ -266,28 +250,16 @@ <value>float</value> </param> <param> - <key>samp_rate</key> + <key>samples_per_second</key> <value>samp_rate</value> </param> <param> - <key>waveform</key> - <value>gr.GR_TRI_WAVE</value> - </param> - <param> - <key>freq</key> - <value>0.05</value> - </param> - <param> - <key>amp</key> - <value>2.0</value> - </param> - <param> - <key>offset</key> - <value>0</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(21, 271)</value> + <value>(227, 493)</value> </param> <param> <key>_rotation</key> @@ -295,65 +267,61 @@ </param> </block> <block> - <key>variable</key> + <key>pfb_arb_resampler_xxx</key> <param> <key>id</key> - <value>nphases</value> + <value>pfb_arb_resampler_xxx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>_coordinate</key> - <value>(185, 153)</value> + <key>type</key> + <value>ccf</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>rrate</key> + <value>float(new_rate)/samp_rate</value> </param> - </block> - <block> - <key>variable_static_text</key> <param> - <key>id</key> - <value>samp_rate</value> + <key>taps</key> + <value>rs_taps</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>nfilts</key> + <value>nphases</value> </param> <param> - <key>label</key> - <value>Sample Rate</value> + <key>atten</key> + <value>100</value> </param> <param> - <key>value</key> - <value>44100</value> + <key>_coordinate</key> + <value>(649, 469)</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>analog_frequency_modulator_fc</key> <param> - <key>formatter</key> - <value>None</value> + <key>id</key> + <value>analog_frequency_modulator_fc_0</value> </param> <param> - <key>grid_pos</key> - <value>0, 0, 1, 1</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>notebook</key> - <value></value> + <key>sensitivity</key> + <value>math.pi</value> </param> <param> <key>_coordinate</key> - <value>(179, 14)</value> + <value>(429, 501)</value> </param> <param> <key>_rotation</key> @@ -361,112 +329,94 @@ </param> </block> <block> - <key>variable_static_text</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>new_rate</value> + <value>orig_fft</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Resampled Rate</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>value</key> - <value>48000</value> + <key>title</key> + <value>Original Spectrum</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>formatter</key> - <value>None</value> + <key>baseband_freq</key> + <value>0</value> </param> <param> - <key>grid_pos</key> - <value>0, 1, 1, 1</value> + <key>y_per_div</key> + <value>10</value> </param> <param> - <key>notebook</key> - <value></value> + <key>y_divs</key> + <value>10</value> </param> <param> - <key>_coordinate</key> - <value>(328, 15)</value> + <key>ref_level</key> + <value>30</value> </param> <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>frac_bw</value> + <key>ref_scale</key> + <value>2.0</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>fft_size</key> + <value>1024</value> </param> <param> - <key>label</key> - <value>Fractional Bandwidth</value> + <key>fft_rate</key> + <value>30</value> </param> <param> - <key>value</key> - <value>0.45</value> + <key>peak_hold</key> + <value>False</value> </param> <param> - <key>converver</key> - <value>float_converter</value> + <key>average</key> + <value>False</value> </param> <param> - <key>formatter</key> - <value>lambda x: "%0.2f"%x</value> + <key>avg_alpha</key> + <value>0</value> </param> <param> - <key>grid_pos</key> - <value>0,2,1,1</value> + <key>win</key> + <value>None</value> </param> <param> - <key>notebook</key> + <key>win_size</key> <value></value> </param> <param> - <key>_coordinate</key> - <value>(473, 14)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_frequency_modulator_fc</key> - <param> - <key>id</key> - <value>fm_mod</value> + <key>grid_pos</key> + <value>1, 0, 1, 3</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>notebook</key> + <value></value> </param> <param> - <key>sensitivity</key> - <value>math.pi</value> + <key>freqvar</key> + <value>None</value> </param> <param> <key>_coordinate</key> - <value>(411, 493)</value> + <value>(414, 279)</value> </param> <param> <key>_rotation</key> - <value>0</value> + <value>180</value> </param> </block> <block> @@ -548,8 +498,12 @@ <value></value> </param> <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> - <value>(640, 256)</value> + <value>(645, 241)</value> </param> <param> <key>_rotation</key> @@ -557,10 +511,10 @@ </param> </block> <block> - <key>pfb_arb_resampler_xxx</key> + <key>gr_add_const_vxx</key> <param> <key>id</key> - <value>pfb_arb_resampler_xxx_0</value> + <value>adder</value> </param> <param> <key>_enabled</key> @@ -568,35 +522,91 @@ </param> <param> <key>type</key> - <value>ccf</value> + <value>float</value> </param> <param> - <key>rrate</key> - <value>float(new_rate)/samp_rate</value> + <key>const</key> + <value>-1.0</value> </param> <param> - <key>taps</key> - <value>rs_taps</value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>nfilts</key> - <value>nphases</value> + <key>_coordinate</key> + <value>(227, 303)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>analog_sig_source_x</key> + <param> + <key>id</key> + <value>analog_sig_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>waveform</key> + <value>analog.GR_TRI_WAVE</value> + </param> + <param> + <key>freq</key> + <value>0.05</value> + </param> + <param> + <key>amp</key> + <value>2</value> + </param> + <param> + <key>offset</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(649, 469)</value> + <value>(36, 271)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>import</key> + <param> + <key>id</key> + <value>import_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>import</key> + <value>import math</value> + </param> + <param> + <key>_coordinate</key> + <value>(11, 75)</value> </param> <param> <key>_rotation</key> <value>0</value> </param> </block> - <connection> - <source_block_id>tri_source</source_block_id> - <sink_block_id>adder</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> <connection> <source_block_id>adder</source_block_id> <sink_block_id>throttle</sink_block_id> @@ -604,26 +614,32 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>fm_mod</source_block_id> - <sink_block_id>orig_fft</sink_block_id> + <source_block_id>pfb_arb_resampler_xxx_0</source_block_id> + <sink_block_id>resamp_fft</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>throttle</source_block_id> - <sink_block_id>fm_mod</sink_block_id> + <sink_block_id>analog_frequency_modulator_fc_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>fm_mod</source_block_id> + <source_block_id>analog_frequency_modulator_fc_0</source_block_id> <sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>pfb_arb_resampler_xxx_0</source_block_id> - <sink_block_id>resamp_fft</sink_block_id> + <source_block_id>analog_frequency_modulator_fc_0</source_block_id> + <sink_block_id>orig_fft</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_sig_source_x_0</source_block_id> + <sink_block_id>adder</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-filter/examples/synth_filter.py b/gr-filter/examples/synth_filter.py index a5b6fdf4cb..505141614a 100755 --- a/gr-filter/examples/synth_filter.py +++ b/gr-filter/examples/synth_filter.py @@ -25,15 +25,21 @@ from gnuradio import filter import sys try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + +try: import scipy except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." + sys.stderr.write("Error: Program requires scipy (see: www.scipy.org).\n") sys.exit(1) try: import pylab except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.stderr.write("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).\n") sys.exit(1) def main(): @@ -45,7 +51,7 @@ def main(): sigs = list() for fi in freqs: - s = gr.sig_source_c(fs, gr.GR_SIN_WAVE, fi, 1) + s = analog.sig_source_c(fs, analog.GR_SIN_WAVE, fi, 1) sigs.append(s) taps = filter.firdes.low_pass_2(len(freqs), fs, diff --git a/gr-filter/examples/synth_to_chan.py b/gr-filter/examples/synth_to_chan.py index b5f4c958ef..bd39a17e59 100755 --- a/gr-filter/examples/synth_to_chan.py +++ b/gr-filter/examples/synth_to_chan.py @@ -25,15 +25,21 @@ from gnuradio import filter import sys try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + +try: import scipy except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." + sys.stderr.write("Error: Program requires scipy (see: www.scipy.org).\n") sys.exit(1) try: import pylab except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." + sys.stderr.write("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).\n") sys.exit(1) def main(): @@ -46,8 +52,8 @@ def main(): sigs = list() fmtx = list() for fi in freqs: - s = gr.sig_source_f(fs, gr.GR_SIN_WAVE, fi, 1) - fm = blks2.nbfm_tx (fs, 4*fs, max_dev=10000, tau=75e-6) + s = analog.sig_source_f(fs, gr.GR_SIN_WAVE, fi, 1) + fm = analog.nbfm_tx(fs, 4*fs, max_dev=10000, tau=75e-6) sigs.append(s) fmtx.append(fm) @@ -62,7 +68,7 @@ def main(): noise_level = 0.01 head = gr.head(gr.sizeof_gr_complex, N) - noise = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level) + noise = analog.noise_source_c(gr.GR_GAUSSIAN, noise_level) addnoise = gr.add_cc() snk_synth = gr.vector_sink_c() diff --git a/gr-filter/grc/CMakeLists.txt b/gr-filter/grc/CMakeLists.txt index 0940f1c73c..1ca23d560e 100644 --- a/gr-filter/grc/CMakeLists.txt +++ b/gr-filter/grc/CMakeLists.txt @@ -35,7 +35,6 @@ install(FILES filter_pfb_synthesizer.xml filter_rational_resampler_base_xxx.xml filter_single_pole_iir_filter_xx.xml - filter_channel_model.xml filter_low_pass_filter.xml filter_high_pass_filter.xml filter_band_pass_filter.xml diff --git a/gr-filter/grc/filter_block_tree.xml b/gr-filter/grc/filter_block_tree.xml index 976833abb8..9b72dcf605 100644 --- a/gr-filter/grc/filter_block_tree.xml +++ b/gr-filter/grc/filter_block_tree.xml @@ -53,6 +53,5 @@ <block>pfb_synthesizer_ccf</block> <block>rational_resampler_base_xxx</block> <block>single_pole_iir_filter_xx</block> - <block>channel_model</block> </cat> </cat> diff --git a/gr-filter/include/filter/CMakeLists.txt b/gr-filter/include/filter/CMakeLists.txt index 536b74b54e..9070a7489f 100644 --- a/gr-filter/include/filter/CMakeLists.txt +++ b/gr-filter/include/filter/CMakeLists.txt @@ -110,7 +110,6 @@ install(FILES pfb_synthesizer_ccf.h single_pole_iir_filter_cc.h single_pole_iir_filter_ff.h - channel_model.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/filter COMPONENT "filter_devel" ) diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt index c47528046a..3b4bf9f178 100644 --- a/gr-filter/lib/CMakeLists.txt +++ b/gr-filter/lib/CMakeLists.txt @@ -137,7 +137,6 @@ list(APPEND filter_sources pfb_synthesizer_ccf_impl.cc single_pole_iir_filter_cc_impl.cc single_pole_iir_filter_ff_impl.cc - channel_model_impl.cc ) list(APPEND filter_libs diff --git a/gr-filter/python/CMakeLists.txt b/gr-filter/python/CMakeLists.txt index 07f03fac4c..65664dad1c 100644 --- a/gr-filter/python/CMakeLists.txt +++ b/gr-filter/python/CMakeLists.txt @@ -45,6 +45,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-filter/swig ) set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-filter) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-filter/python/qa_filter_delay_fc.py b/gr-filter/python/qa_filter_delay_fc.py index 57b063e7b5..420d6fb05f 100755 --- a/gr-filter/python/qa_filter_delay_fc.py +++ b/gr-filter/python/qa_filter_delay_fc.py @@ -24,6 +24,16 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import math +def sin_source_f(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.sin(2.*math.pi*freq*x), t) + return y + +def cos_source_f(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.cos(2.*math.pi*freq*x), t) + return y + class test_filter_delay_fc(gr_unittest.TestCase): def setUp(self): @@ -102,18 +112,17 @@ class test_filter_delay_fc(gr_unittest.TestCase): sampling_freq = 100 ntaps = 51 - src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - head = gr.head(gr.sizeof_float, int(ntaps + sampling_freq * 0.10)) + N = int(ntaps + sampling_freq * 0.10) + data = sin_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) + src1 = gr.vector_source_f(data) dst2 = gr.vector_sink_c() # calculate taps taps = filter.firdes_hilbert(ntaps) hd = filter.filter_delay_fc(taps) - tb.connect(src1, head) - tb.connect(head, hd) - tb.connect(hd,dst2) + tb.connect(src1, hd) + tb.connect(hd, dst2) tb.run() @@ -194,19 +203,17 @@ class test_filter_delay_fc(gr_unittest.TestCase): sampling_freq = 100 ntaps = 51 - src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - head = gr.head(gr.sizeof_float, int(ntaps + sampling_freq * 0.10)) + N = int(ntaps + sampling_freq * 0.10) + data = sin_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) + src1 = gr.vector_source_f(data) dst2 = gr.vector_sink_c() - # calculate taps taps = filter.firdes_hilbert(ntaps) hd = filter.filter_delay_fc(taps) - tb.connect(src1, head) - tb.connect(head, (hd,0)) - tb.connect(head, (hd,1)) + tb.connect(src1, (hd,0)) + tb.connect(src1, (hd,1)) tb.connect(hd,dst2) tb.run() @@ -287,23 +294,20 @@ class test_filter_delay_fc(gr_unittest.TestCase): sampling_freq = 100 ntaps = 51 + N = int(ntaps + sampling_freq * 0.10) - src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE,sampling_freq * 0.10, 1.0) - src2 = gr.sig_source_f(sampling_freq, gr.GR_COS_WAVE,sampling_freq * 0.10, 1.0) - - head1 = gr.head(gr.sizeof_float, int(ntaps + sampling_freq * 0.10)) - head2 = gr.head(gr.sizeof_float, int(ntaps + sampling_freq * 0.10)) + data1 = sin_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) + data2 = cos_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) + src1 = gr.vector_source_f(data1) + src2 = gr.vector_source_f(data2) taps = filter.firdes_hilbert(ntaps) hd = filter.filter_delay_fc(taps) dst2 = gr.vector_sink_c() - tb.connect(src1, head1) - tb.connect(src2, head2) - - tb.connect(head1, (hd,0)) - tb.connect(head2, (hd,1)) + tb.connect(src1, (hd,0)) + tb.connect(src2, (hd,1)) tb.connect(hd, dst2) tb.run() diff --git a/gr-filter/python/qa_fractional_interpolator.py b/gr-filter/python/qa_fractional_interpolator.py index 9e0f685d80..ab4cc4cf9a 100755 --- a/gr-filter/python/qa_fractional_interpolator.py +++ b/gr-filter/python/qa_fractional_interpolator.py @@ -24,6 +24,17 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import math +def sig_source_f(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.sin(2.*math.pi*freq*x), t) + return y + +def sig_source_c(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.cos(2.*math.pi*freq*x) + \ + 1j*math.sin(2.*math.pi*freq*x), t) + return y + class test_fractional_resampler(gr_unittest.TestCase): def setUp(self): @@ -38,12 +49,12 @@ class test_fractional_resampler(gr_unittest.TestCase): rrate = 1.123 # resampling rate freq = 10 - signal = gr.sig_source_f(fs, gr.GR_SIN_WAVE, freq, 1) - head = gr.head(gr.sizeof_float, N) + data = sig_source_f(fs, freq, 1, N) + signal = gr.vector_source_f(data) op = filter.fractional_interpolator_ff(0, rrate) snk = gr.vector_sink_f() - self.tb.connect(signal, head, op, snk) + self.tb.connect(signal, op, snk) self.tb.run() Ntest = 5000 @@ -64,12 +75,12 @@ class test_fractional_resampler(gr_unittest.TestCase): rrate = 1.123 # resampling rate freq = 10 - signal = gr.sig_source_c(fs, gr.GR_SIN_WAVE, freq, 1) - head = gr.head(gr.sizeof_gr_complex, N) + data = sig_source_c(fs, freq, 1, N) + signal = gr.vector_source_c(data) op = filter.fractional_interpolator_cc(0.0, rrate) snk = gr.vector_sink_c() - self.tb.connect(signal, head, op, snk) + self.tb.connect(signal, op, snk) self.tb.run() Ntest = 5000 diff --git a/gr-filter/python/qa_hilbert.py b/gr-filter/python/qa_hilbert.py index b460b6438f..c3522ed192 100755 --- a/gr-filter/python/qa_hilbert.py +++ b/gr-filter/python/qa_hilbert.py @@ -24,6 +24,11 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import math +def sig_source_f(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.sin(2.*math.pi*freq*x), t) + return y + class test_hilbert(gr_unittest.TestCase): def setUp(self): @@ -99,15 +104,14 @@ class test_hilbert(gr_unittest.TestCase): (0.5877838134765625 +0.80908381938934326j), (3.218399768911695e-08 +1.0000815391540527j)) + + N = int(ntaps + sampling_freq * 0.10) + data = sig_source_f(sampling_freq, sampling_freq * 0.10, 1.0, N) + src1 = gr.vector_source_f(data) - src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE, - sampling_freq * 0.10, 1.0) - - head = gr.head(gr.sizeof_float, int (ntaps + sampling_freq * 0.10)) hilb = filter.hilbert_fc(ntaps) dst1 = gr.vector_sink_c() - tb.connect(src1, head) - tb.connect(head, hilb) + tb.connect(src1, hilb) tb.connect(hilb, dst1) tb.run() dst_data = dst1.data() diff --git a/gr-filter/python/qa_pfb_arb_resampler.py b/gr-filter/python/qa_pfb_arb_resampler.py index a4e22f4c02..98272013ef 100755 --- a/gr-filter/python/qa_pfb_arb_resampler.py +++ b/gr-filter/python/qa_pfb_arb_resampler.py @@ -24,6 +24,17 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import math +def sig_source_c(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.cos(2.*math.pi*freq*x) + \ + 1j*math.sin(2.*math.pi*freq*x), t) + return y + +def sig_source_f(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.sin(2.*math.pi*freq*x), t) + return y + class test_pfb_arb_resampler(gr_unittest.TestCase): def setUp(self): @@ -43,12 +54,12 @@ class test_pfb_arb_resampler(gr_unittest.TestCase): window=filter.firdes.WIN_BLACKMAN_hARRIS) freq = 100 - signal = gr.sig_source_f(fs, gr.GR_SIN_WAVE, freq, 1) - head = gr.head(gr.sizeof_float, N) + data = sig_source_f(fs, freq, 1, N) + signal = gr.vector_source_f(data) pfb = filter.pfb_arb_resampler_fff(rrate, taps) snk = gr.vector_sink_f() - self.tb.connect(signal, head, pfb, snk) + self.tb.connect(signal, pfb, snk) self.tb.run() Ntest = 50 @@ -72,12 +83,12 @@ class test_pfb_arb_resampler(gr_unittest.TestCase): window=filter.firdes.WIN_BLACKMAN_hARRIS) freq = 100 - signal = gr.sig_source_c(fs, gr.GR_SIN_WAVE, freq, 1) - head = gr.head(gr.sizeof_gr_complex, N) + data = sig_source_c(fs, freq, 1, N) + signal = gr.vector_source_c(data) pfb = filter.pfb_arb_resampler_ccf(rrate, taps) snk = gr.vector_sink_c() - self.tb.connect(signal, head, pfb, snk) + self.tb.connect(signal, pfb, snk) self.tb.run() Ntest = 50 diff --git a/gr-filter/python/qa_pfb_channelizer.py b/gr-filter/python/qa_pfb_channelizer.py index c0ed8327df..e9a4d446e7 100755 --- a/gr-filter/python/qa_pfb_channelizer.py +++ b/gr-filter/python/qa_pfb_channelizer.py @@ -24,6 +24,12 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import math +def sig_source_c(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.cos(2.*math.pi*freq*x) + \ + 1j*math.sin(2.*math.pi*freq*x), t) + return y + class test_pfb_channelizer(gr_unittest.TestCase): def setUp(self): @@ -47,14 +53,14 @@ class test_pfb_channelizer(gr_unittest.TestCase): freqs = [-200, -100, 0, 100, 200] for i in xrange(len(freqs)): f = freqs[i] + (M/2-M+i+1)*fs - signals.append(gr.sig_source_c(ifs, gr.GR_SIN_WAVE, f, 1)) + data = sig_source_c(ifs, f, 1, N) + signals.append(gr.vector_source_c(data)) self.tb.connect(signals[i], (add,i)) - head = gr.head(gr.sizeof_gr_complex, N) s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, M) pfb = filter.pfb_channelizer_ccf(M, taps, 1) - self.tb.connect(add, head, s2ss) + self.tb.connect(add, s2ss) snks = list() for i in xrange(M): diff --git a/gr-filter/python/qa_pfb_decimator.py b/gr-filter/python/qa_pfb_decimator.py index 063845f638..c4448de4b5 100755 --- a/gr-filter/python/qa_pfb_decimator.py +++ b/gr-filter/python/qa_pfb_decimator.py @@ -24,6 +24,12 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import math +def sig_source_c(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.cos(2.*math.pi*freq*x) + \ + 1j*math.sin(2.*math.pi*freq*x), t) + return y + class test_pfb_decimator(gr_unittest.TestCase): def setUp(self): @@ -48,7 +54,8 @@ class test_pfb_decimator(gr_unittest.TestCase): freqs = [-200, -100, 0, 100, 200] for i in xrange(len(freqs)): f = freqs[i] + (M/2-M+i+1)*fs - signals.append(gr.sig_source_c(ifs, gr.GR_SIN_WAVE, f, 1)) + data = sig_source_c(ifs, f, 1, N) + signals.append(gr.vector_source_c(data)) self.tb.connect(signals[i], (add,i)) head = gr.head(gr.sizeof_gr_complex, N) @@ -85,23 +92,23 @@ class test_pfb_decimator(gr_unittest.TestCase): channel = 1 # Extract channel 0 taps = filter.firdes.low_pass_2(1, ifs, fs/2, fs/10, - attenuation_dB=80, - window=filter.firdes.WIN_BLACKMAN_hARRIS) + attenuation_dB=80, + window=filter.firdes.WIN_BLACKMAN_hARRIS) signals = list() add = gr.add_cc() freqs = [-200, -100, 0, 100, 200] for i in xrange(len(freqs)): f = freqs[i] + (M/2-M+i+1)*fs - signals.append(gr.sig_source_c(ifs, gr.GR_SIN_WAVE, f, 1)) + data = sig_source_c(ifs, f, 1, N) + signals.append(gr.vector_source_c(data)) self.tb.connect(signals[i], (add,i)) - head = gr.head(gr.sizeof_gr_complex, N) s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, M) pfb = filter.pfb_decimator_ccf(M, taps, channel) snk = gr.vector_sink_c() - self.tb.connect(add, head, s2ss) + self.tb.connect(add, s2ss) for i in xrange(M): self.tb.connect((s2ss,i), (pfb,i)) self.tb.connect(pfb, snk) @@ -114,9 +121,9 @@ class test_pfb_decimator(gr_unittest.TestCase): # Create known data as complex sinusoids for the baseband freq # of the extracted channel is due to decimator output order. - phase = 6.15746 + phase = 6.1575 expected_data = map(lambda x: math.cos(2.*math.pi*freqs[3]*x+phase) + \ - 1j*math.sin(2.*math.pi*freqs[3]*x+phase), t) + 1j*math.sin(2.*math.pi*freqs[3]*x+phase), t) dst_data = snk.data() self.assertComplexTuplesAlmostEqual(expected_data[-Ntest:], dst_data[-Ntest:], 4) diff --git a/gr-filter/python/qa_pfb_interpolator.py b/gr-filter/python/qa_pfb_interpolator.py index 5b84b7c642..ffaeee3f68 100755 --- a/gr-filter/python/qa_pfb_interpolator.py +++ b/gr-filter/python/qa_pfb_interpolator.py @@ -24,6 +24,12 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import math +def sig_source_c(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.cos(2.*math.pi*freq*x) + \ + 1j*math.sin(2.*math.pi*freq*x), t) + return y + class test_pfb_interpolator(gr_unittest.TestCase): def setUp(self): @@ -43,12 +49,12 @@ class test_pfb_interpolator(gr_unittest.TestCase): window=filter.firdes.WIN_BLACKMAN_hARRIS) freq = 100 - signal = gr.sig_source_c(fs, gr.GR_COS_WAVE, freq, 1) - head = gr.head(gr.sizeof_gr_complex, N) + data = sig_source_c(fs, freq, 1, N) + signal = gr.vector_source_c(data) pfb = filter.pfb_interpolator_ccf(M, taps) snk = gr.vector_sink_c() - self.tb.connect(signal, head, pfb) + self.tb.connect(signal, pfb) self.tb.connect(pfb, snk) self.tb.run() diff --git a/gr-filter/python/qa_pfb_synthesizer.py b/gr-filter/python/qa_pfb_synthesizer.py index e8164d2683..2da02b58d3 100755 --- a/gr-filter/python/qa_pfb_synthesizer.py +++ b/gr-filter/python/qa_pfb_synthesizer.py @@ -24,6 +24,12 @@ from gnuradio import gr, gr_unittest import filter_swig as filter import math +def sig_source_c(samp_rate, freq, amp, N): + t = map(lambda x: float(x)/samp_rate, xrange(N)) + y = map(lambda x: math.cos(2.*math.pi*freq*x) + \ + 1j*math.sin(2.*math.pi*freq*x), t) + return y + class test_pfb_synthesizer(gr_unittest.TestCase): def setUp(self): @@ -45,16 +51,16 @@ class test_pfb_synthesizer(gr_unittest.TestCase): signals = list() freqs = [0, 100, 200, -200, -100] for i in xrange(len(freqs)): - signals.append(gr.sig_source_c(fs, gr.GR_SIN_WAVE, freqs[i], 1)) + data = sig_source_c(fs, freqs[i], 1, N) + signals.append(gr.vector_source_c(data)) - head = gr.head(gr.sizeof_gr_complex, N) pfb = filter.pfb_synthesizer_ccf(M, taps) snk = gr.vector_sink_c() for i in xrange(M): self.tb.connect(signals[i], (pfb,i)) - self.tb.connect(pfb, head, snk) + self.tb.connect(pfb, snk) self.tb.run() diff --git a/gr-filter/swig/filter_swig.i b/gr-filter/swig/filter_swig.i index 05b84d4d69..bb4eab381a 100644 --- a/gr-filter/swig/filter_swig.i +++ b/gr-filter/swig/filter_swig.i @@ -73,7 +73,6 @@ #include "filter/rational_resampler_base_scc.h" #include "filter/single_pole_iir_filter_cc.h" #include "filter/single_pole_iir_filter_ff.h" -#include "filter/channel_model.h" %} %include "filter/firdes.h" @@ -121,7 +120,6 @@ %include "filter/rational_resampler_base_scc.h" %include "filter/single_pole_iir_filter_cc.h" %include "filter/single_pole_iir_filter_ff.h" -%include "filter/channel_model.h" GR_SWIG_BLOCK_MAGIC2(filter, adaptive_fir_ccc); GR_SWIG_BLOCK_MAGIC2(filter, adaptive_fir_ccf); @@ -166,4 +164,3 @@ GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fsf); GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_scc); GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_cc); GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_ff); -GR_SWIG_BLOCK_MAGIC2(filter, channel_model); diff --git a/gr-howto-write-a-block/apps/howto_square_qt.grc b/gr-howto-write-a-block/apps/howto_square_qt.grc index 7e963f92b5..6281c3a310 100644 --- a/gr-howto-write-a-block/apps/howto_square_qt.grc +++ b/gr-howto-write-a-block/apps/howto_square_qt.grc @@ -1,66 +1,59 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sun Sep 30 13:32:48 2012</timestamp> + <timestamp>Sat Nov 10 15:23:43 2012</timestamp> <block> - <key>variable</key> + <key>options</key> <param> <key>id</key> - <value>samp_rate</value> + <value>howto_square_qt</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>32000</value> - </param> - <param> - <key>_coordinate</key> - <value>(183, 12)</value> + <key>title</key> + <value></value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>author</key> + <value></value> </param> - </block> - <block> - <key>gr_sig_source_x</key> <param> - <key>id</key> - <value>gr_sig_source_x_0</value> + <key>description</key> + <value></value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>window_size</key> + <value>1280, 1024</value> </param> <param> - <key>type</key> - <value>float</value> + <key>generate_options</key> + <value>qt_gui</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>category</key> + <value>Custom</value> </param> <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> + <key>run_options</key> + <value>prompt</value> </param> <param> - <key>freq</key> - <value>1000</value> + <key>run</key> + <value>True</value> </param> <param> - <key>amp</key> - <value>1</value> + <key>max_nouts</key> + <value>0</value> </param> <param> - <key>offset</key> - <value>0</value> + <key>realtime_scheduling</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(19, 98)</value> + <value>(10, 10)</value> </param> <param> <key>_rotation</key> @@ -68,30 +61,22 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>variable</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> + <key>value</key> + <value>32000</value> </param> <param> <key>_coordinate</key> - <value>(212, 130)</value> + <value>(183, 12)</value> </param> <param> <key>_rotation</key> @@ -159,10 +144,18 @@ <value>1024</value> </param> <param> - <key>bw</key> + <key>srate</key> <value>samp_rate</value> </param> <param> + <key>ymin</key> + <value>-1</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> <key>nconnections</key> <value>3</value> </param> @@ -180,58 +173,73 @@ </param> </block> <block> - <key>options</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>howto_square_qt</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>title</key> - <value></value> + <key>type</key> + <value>float</value> </param> <param> - <key>author</key> - <value></value> + <key>samples_per_second</key> + <value>samp_rate</value> </param> <param> - <key>description</key> - <value></value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>window_size</key> - <value>1280, 1024</value> + <key>_coordinate</key> + <value>(212, 130)</value> </param> <param> - <key>generate_options</key> - <value>qt_gui</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>analog_sig_source_x</key> <param> - <key>category</key> - <value>Custom</value> + <key>id</key> + <value>analog_sig_source_x_0</value> </param> <param> - <key>run_options</key> - <value>prompt</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>run</key> - <value>True</value> + <key>type</key> + <value>float</value> </param> <param> - <key>max_nouts</key> - <value>0</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>realtime_scheduling</key> - <value></value> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> + </param> + <param> + <key>freq</key> + <value>1000</value> + </param> + <param> + <key>amp</key> + <value>1</value> + </param> + <param> + <key>offset</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(10, 10)</value> + <value>(15, 98)</value> </param> <param> <key>_rotation</key> @@ -257,12 +265,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_sig_source_x_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_throttle_0</source_block_id> <sink_block_id>qtgui_time_sink_x_0</sink_block_id> <source_key>0</source_key> @@ -274,4 +276,10 @@ <source_key>0</source_key> <sink_key>2</sink_key> </connection> + <connection> + <source_block_id>analog_sig_source_x_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> diff --git a/gr-howto-write-a-block/apps/howto_square_qt.py b/gr-howto-write-a-block/apps/howto_square_qt.py index 1a3e6874c4..986f1c7585 100755 --- a/gr-howto-write-a-block/apps/howto_square_qt.py +++ b/gr-howto-write-a-block/apps/howto_square_qt.py @@ -2,10 +2,11 @@ ################################################## # Gnuradio Python Flow Graph # Title: Howto Square Qt -# Generated: Sun Sep 30 13:32:52 2012 +# Generated: Sat Nov 10 15:23:43 2012 ################################################## from PyQt4 import Qt +from gnuradio import analog from gnuradio import eng_notation from gnuradio import gr from gnuradio import qtgui @@ -49,16 +50,17 @@ class howto_square_qt(gr.top_block, Qt.QWidget): ################################################## self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size - samp_rate, #bw + samp_rate, #samp_rate "QT GUI Plot", #name 3 #number of inputs ) + self.qtgui_time_sink_x_0.set_y_axis(-1, 1) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.howto_square_ff_0 = howto.square_ff() self.howto_square2_ff_0 = howto.square2_ff() self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate) - self.gr_sig_source_x_0 = gr.sig_source_f(samp_rate, gr.GR_COS_WAVE, 1000, 1, 0) + self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0) ################################################## # Connections @@ -66,9 +68,9 @@ class howto_square_qt(gr.top_block, Qt.QWidget): self.connect((self.howto_square2_ff_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.gr_throttle_0, 0), (self.howto_square2_ff_0, 0)) self.connect((self.gr_throttle_0, 0), (self.howto_square_ff_0, 0)) - self.connect((self.gr_sig_source_x_0, 0), (self.gr_throttle_0, 0)) self.connect((self.gr_throttle_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.howto_square_ff_0, 0), (self.qtgui_time_sink_x_0, 2)) + self.connect((self.analog_sig_source_x_0, 0), (self.gr_throttle_0, 0)) # QT sink close method reimplementation def closeEvent(self, event): @@ -81,7 +83,8 @@ class howto_square_qt(gr.top_block, Qt.QWidget): def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate - self.gr_sig_source_x_0.set_sampling_freq(self.samp_rate) + self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate) + self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") diff --git a/gr-howto-write-a-block/python/__init__.py b/gr-howto-write-a-block/python/__init__.py index 575cbfc222..2bd27cb313 100644 --- a/gr-howto-write-a-block/python/__init__.py +++ b/gr-howto-write-a-block/python/__init__.py @@ -23,32 +23,8 @@ This is the GNU Radio HOWTO module. Place your Python package description here (python/__init__.py). ''' -# ---------------------------------------------------------------- -# Temporary workaround for ticket:181 (swig+python problem) -import sys -_RTLD_GLOBAL = 0 -try: - from dl import RTLD_GLOBAL as _RTLD_GLOBAL -except ImportError: - try: - from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL - except ImportError: - pass - -if _RTLD_GLOBAL != 0: - _dlopenflags = sys.getdlopenflags() - sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) -# ---------------------------------------------------------------- - - # import swig generated symbols into the howto namespace from howto_swig import * # import any pure python here # - -# ---------------------------------------------------------------- -# Tail of workaround -if _RTLD_GLOBAL != 0: - sys.setdlopenflags(_dlopenflags) # Restore original flags -# ---------------------------------------------------------------- diff --git a/gr-pager/CMakeLists.txt b/gr-pager/CMakeLists.txt index 8454448595..b11c2f4a28 100644 --- a/gr-pager/CMakeLists.txt +++ b/gr-pager/CMakeLists.txt @@ -29,6 +29,7 @@ include(GrComponent) GR_REGISTER_COMPONENT("gr-pager" ENABLE_GR_PAGER Boost_FOUND ENABLE_GR_CORE + ENABLE_GR_ANALOG ) GR_SET_GLOBAL(GR_PAGER_INCLUDE_DIRS diff --git a/gr-pager/python/CMakeLists.txt b/gr-pager/python/CMakeLists.txt index c0e1b1be13..7afe81b03d 100644 --- a/gr-pager/python/CMakeLists.txt +++ b/gr-pager/python/CMakeLists.txt @@ -44,6 +44,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-pager/swig ) set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-pager) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-pager/python/flex_demod.py b/gr-pager/python/flex_demod.py index 4146695f87..853348e4b0 100644 --- a/gr-pager/python/flex_demod.py +++ b/gr-pager/python/flex_demod.py @@ -19,7 +19,8 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, gru, optfir, blks2 +from gnuradio import gr, gru, blks2 +from gnuradio import analog from math import pi import pager_swig @@ -38,7 +39,7 @@ class flex_demod(gr.hier_block2): gr.io_signature(0,0,0)) k = 25000/(2*pi*1600) # 4800 Hz max deviation - quad = gr.quadrature_demod_cf(k) + quad = analog.quadrature_demod_cf(k) self.connect(self, quad) rsamp = blks2.rational_resampler_fff(16, 25) diff --git a/gr-qtgui/apps/gr_constellation_plot b/gr-qtgui/apps/gr_constellation_plot index 66d227ecc9..02805a8fd1 100755 --- a/gr-qtgui/apps/gr_constellation_plot +++ b/gr-qtgui/apps/gr_constellation_plot @@ -86,7 +86,7 @@ class my_top_block(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.skip) diff --git a/gr-qtgui/apps/gr_psd_plot_b b/gr-qtgui/apps/gr_psd_plot_b index e3e86a271f..283bf2950c 100755 --- a/gr-qtgui/apps/gr_psd_plot_b +++ b/gr-qtgui/apps/gr_psd_plot_b @@ -95,7 +95,7 @@ class my_top_block(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.cnvrt[0], self.skip) diff --git a/gr-qtgui/apps/gr_psd_plot_c b/gr-qtgui/apps/gr_psd_plot_c index faa0fc60a4..0f7f4b9bef 100755 --- a/gr-qtgui/apps/gr_psd_plot_c +++ b/gr-qtgui/apps/gr_psd_plot_c @@ -92,7 +92,7 @@ class my_top_block(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.skip) diff --git a/gr-qtgui/apps/gr_psd_plot_f b/gr-qtgui/apps/gr_psd_plot_f index 326618f848..973f7b29d9 100755 --- a/gr-qtgui/apps/gr_psd_plot_f +++ b/gr-qtgui/apps/gr_psd_plot_f @@ -92,7 +92,7 @@ class my_top_block(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.skip) diff --git a/gr-qtgui/apps/gr_psd_plot_i b/gr-qtgui/apps/gr_psd_plot_i index a0264ac1c9..022f4ee755 100755 --- a/gr-qtgui/apps/gr_psd_plot_i +++ b/gr-qtgui/apps/gr_psd_plot_i @@ -95,7 +95,7 @@ class my_top_block(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.cnvrt[0], self.skip) diff --git a/gr-qtgui/apps/gr_psd_plot_s b/gr-qtgui/apps/gr_psd_plot_s index 6852cf7d0f..905d8fde60 100755 --- a/gr-qtgui/apps/gr_psd_plot_s +++ b/gr-qtgui/apps/gr_psd_plot_s @@ -95,7 +95,7 @@ class my_top_block(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.cnvrt[0], self.skip) diff --git a/gr-qtgui/apps/gr_time_plot_b b/gr-qtgui/apps/gr_time_plot_b index 90043c91f6..3ac583eef3 100755 --- a/gr-qtgui/apps/gr_time_plot_b +++ b/gr-qtgui/apps/gr_time_plot_b @@ -89,7 +89,7 @@ class gr_time_plot_f(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.cnvrt[0], self.skip) diff --git a/gr-qtgui/apps/gr_time_plot_c b/gr-qtgui/apps/gr_time_plot_c index 858bbce240..2f27623e54 100755 --- a/gr-qtgui/apps/gr_time_plot_c +++ b/gr-qtgui/apps/gr_time_plot_c @@ -86,8 +86,8 @@ class my_top_block(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "Re{{{0}}}".format(fname)) - self.gui_snk.set_title(n+1, "Im{{{0}}}".format(fname)) + self.gui_snk.set_line_label(n, "Re{{{0}}}".format(fname)) + self.gui_snk.set_line_label(n+1, "Im{{{0}}}".format(fname)) n += 2 self.connect(self.srcs[0], self.skip) diff --git a/gr-qtgui/apps/gr_time_plot_f b/gr-qtgui/apps/gr_time_plot_f index 30834aca7a..e4f4b8d436 100755 --- a/gr-qtgui/apps/gr_time_plot_f +++ b/gr-qtgui/apps/gr_time_plot_f @@ -86,7 +86,7 @@ class gr_time_plot_f(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.skip) diff --git a/gr-qtgui/apps/gr_time_plot_i b/gr-qtgui/apps/gr_time_plot_i index 202fc32793..f9765db672 100755 --- a/gr-qtgui/apps/gr_time_plot_i +++ b/gr-qtgui/apps/gr_time_plot_i @@ -89,7 +89,7 @@ class gr_time_plot_f(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.cnvrt[0], self.skip) diff --git a/gr-qtgui/apps/gr_time_plot_s b/gr-qtgui/apps/gr_time_plot_s index 6788284833..43b098dbdb 100755 --- a/gr-qtgui/apps/gr_time_plot_s +++ b/gr-qtgui/apps/gr_time_plot_s @@ -89,7 +89,7 @@ class gr_time_plot_f(gr.top_block): # Set default labels based on file names fname = f.split("/")[-1] - self.gui_snk.set_title(n, "{0}".format(fname)) + self.gui_snk.set_line_label(n, "{0}".format(fname)) n += 1 self.connect(self.srcs[0], self.cnvrt[0], self.skip) diff --git a/gr-qtgui/apps/grc_qt_example.grc b/gr-qtgui/apps/grc_qt_example.grc index 170cd546ad..a0c9a0b6ae 100644 --- a/gr-qtgui/apps/grc_qt_example.grc +++ b/gr-qtgui/apps/grc_qt_example.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sun Apr 10 16:49:13 2011</timestamp> + <timestamp>Sat Nov 10 14:58:46 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -80,37 +84,6 @@ </param> </block> <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(511, 96)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable_qtgui_range</key> <param> <key>id</key> @@ -166,49 +139,6 @@ </param> </block> <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> - <value>amp</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(295, 64)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable_qtgui_range</key> <param> <key>id</key> @@ -319,10 +249,41 @@ </param> </block> <block> - <key>gr_channel_model</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>gr_channel_model_0</value> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(511, 96)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>channels_channel_model</key> + <param> + <key>id</key> + <value>channels_channel_model_0</value> </param> <param> <key>_enabled</key> @@ -346,11 +307,11 @@ </param> <param> <key>seed</key> - <value>42</value> + <value>-42</value> </param> <param> <key>_coordinate</key> - <value>(727, 64)</value> + <value>(724, 64)</value> </param> <param> <key>_rotation</key> @@ -392,6 +353,10 @@ <value>samp_rate</value> </param> <param> + <key>rate</key> + <value>10</value> + </param> + <param> <key>plotfreq</key> <value>True</value> </param> @@ -412,8 +377,55 @@ <value></value> </param> <param> + <key>freqchangevar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> - <value>(958, 72)</value> + <value>(958, 64)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>analog_sig_source_x</key> + <param> + <key>id</key> + <value>analog_sig_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> + </param> + <param> + <key>freq</key> + <value>freq</value> + </param> + <param> + <key>amp</key> + <value>amp</value> + </param> + <param> + <key>offset</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(297, 64)</value> </param> <param> <key>_rotation</key> @@ -421,20 +433,20 @@ </param> </block> <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> + <source_block_id>analog_sig_source_x_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_throttle_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> + <source_block_id>channels_channel_model_0</source_block_id> + <sink_block_id>qtgui_sink_x_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>qtgui_sink_x_0</sink_block_id> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>channels_channel_model_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-qtgui/apps/plot_form.py b/gr-qtgui/apps/plot_form.py index 2fb19d72b8..f6841811a8 100644 --- a/gr-qtgui/apps/plot_form.py +++ b/gr-qtgui/apps/plot_form.py @@ -60,10 +60,29 @@ class dialog_box(QtGui.QWidget): self.update_points) self.layout = QtGui.QGridLayout(self) - self.layout.addWidget(top_block.get_gui(), 0,0,1,2) - self.layout.addLayout(self.start_form, 1,0,1,1) - self.layout.addLayout(self.end_form, 1,1,1,1) + self.layout.addWidget(top_block.get_gui(), 1,0,1,2) + self.layout.addLayout(self.start_form, 2,0,1,1) + self.layout.addLayout(self.end_form, 2,1,1,1) + # Create a save action + self.save_act = QtGui.QAction("Save", self) + self.save_act.setShortcut(QtGui.QKeySequence.Save) + self.connect(self.save_act, QtCore.SIGNAL("triggered()"), + self.save_figure) + + # Create an exit action + self.exit_act = QtGui.QAction("Exit", self) + self.exit_act.setShortcut(QtGui.QKeySequence.Close) + self.connect(self.exit_act, QtCore.SIGNAL("triggered()"), + self.close) + + # Create a menu for the window + self.menu = QtGui.QToolBar("Menu", self) + self.menu.addAction(self.save_act) + self.menu.addAction(self.exit_act) + + self.layout.addWidget(self.menu, 0,0,1,2) + self.resize(800, 500) def update_points(self): @@ -80,3 +99,29 @@ class dialog_box(QtGui.QWidget): self.top_block.reset(newstart, newnsamps) self._start = newstart self._end = newend + + def save_figure(self): + qpix = QtGui.QPixmap.grabWidget(self.top_block.pyWin) + types = "JPEG file (*.jpg);;" + \ + "Portable Network Graphics file (*.png);;" + \ + "Bitmap file (*.bmp);;" + \ + "TIFF file (*.tiff)" + filebox = QtGui.QFileDialog(self, "Save Image", "./", types) + filebox.setViewMode(QtGui.QFileDialog.Detail) + if(filebox.exec_()): + filename = filebox.selectedFiles()[0] + filetype = filebox.selectedNameFilter() + else: + return + + if(filetype.contains(".jpg")): + qpix.save(filename, "JPEG"); + elif(filetype.contains(".png")): + qpix.save(filename, "PNG"); + elif(filetype.contains(".bmp")): + qpix.save(filename, "BMP"); + elif(filetype.contains(".tiff")): + qpix.save(filename, "TIFF"); + else: + qpix.save(filename, "JPEG"); + diff --git a/gr-qtgui/examples/pyqt_const_c.py b/gr-qtgui/examples/pyqt_const_c.py index 125124ebc5..cf81aa120f 100755 --- a/gr-qtgui/examples/pyqt_const_c.py +++ b/gr-qtgui/examples/pyqt_const_c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,7 +28,13 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.exit(1) + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) class dialog_box(QtGui.QWidget): @@ -139,8 +145,8 @@ class my_top_block(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) - src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.5, 0) - src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.5, 0) + src1 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f1, 0.5, 0) + src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.5, 0) src = gr.add_cc() channel = filter.channel_model(0.001) thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) diff --git a/gr-qtgui/examples/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py index 9857aa774d..294964479a 100755 --- a/gr-qtgui/examples/pyqt_example_c.py +++ b/gr-qtgui/examples/pyqt_example_c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,7 +28,13 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.exit(1) + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) class dialog_box(QtGui.QWidget): @@ -143,12 +149,12 @@ class my_top_block(gr.top_block): ss.close() self.qapp.setStyleSheet(sstext) - src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) - src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src1 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) + src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = gr.add_cc() channel = filter.channel_model(0.001) thr = gr.throttle(gr.sizeof_gr_complex, 100*fftsize) - self.snk1 = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + self.snk1 = qtgui.sink_c(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Signal Example", True, True, True, False) diff --git a/gr-qtgui/examples/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py index d00011f403..d2b3d0eb26 100755 --- a/gr-qtgui/examples/pyqt_example_f.py +++ b/gr-qtgui/examples/pyqt_example_f.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,7 +28,13 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.exit(1) + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) class dialog_box(QtGui.QWidget): @@ -139,11 +145,11 @@ class my_top_block(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) - src1 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) - src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) + src2 = analg.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = gr.add_ff() thr = gr.throttle(gr.sizeof_float, 100*fftsize) - noise = gr.noise_source_f(gr.GR_GAUSSIAN, 0.001) + noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001) add = gr.add_ff() self.snk1 = qtgui.sink_f(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, diff --git a/gr-qtgui/examples/pyqt_freq_c.py b/gr-qtgui/examples/pyqt_freq_c.py index 6102e980e6..5f891f8935 100755 --- a/gr-qtgui/examples/pyqt_freq_c.py +++ b/gr-qtgui/examples/pyqt_freq_c.py @@ -28,7 +28,13 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.exit(1) + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) class dialog_box(QtGui.QWidget): @@ -143,12 +149,12 @@ class my_top_block(gr.top_block): ss.close() self.qapp.setStyleSheet(sstext) - src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) - src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src1 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) + src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = gr.add_cc() channel = filter.channel_model(0.01) thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) - self.snk1 = qtgui.freq_sink_c(npts, gr.firdes.WIN_BLACKMAN_hARRIS, + self.snk1 = qtgui.freq_sink_c(npts, analog.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Freq Example", 3) diff --git a/gr-qtgui/examples/pyqt_freq_f.py b/gr-qtgui/examples/pyqt_freq_f.py index fb7a9f93c6..d276d11106 100755 --- a/gr-qtgui/examples/pyqt_freq_f.py +++ b/gr-qtgui/examples/pyqt_freq_f.py @@ -28,9 +28,16 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") sys.exit(1) +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + + class dialog_box(QtGui.QWidget): def __init__(self, display, control): QtGui.QWidget.__init__(self, None) @@ -139,11 +146,11 @@ class my_top_block(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) - src1 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) - src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) + src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = gr.add_ff() thr = gr.throttle(gr.sizeof_float, 100*npts) - self.snk1 = qtgui.freq_sink_f(npts, gr.firdes.WIN_BLACKMAN_hARRIS, + self.snk1 = qtgui.freq_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Real freq Example", 3) diff --git a/gr-qtgui/examples/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py index 4967f72595..ba5980a050 100755 --- a/gr-qtgui/examples/pyqt_time_c.py +++ b/gr-qtgui/examples/pyqt_time_c.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,7 +28,13 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.exit(1) + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) class dialog_box(QtGui.QWidget): @@ -143,8 +149,8 @@ class my_top_block(gr.top_block): ss.close() self.qapp.setStyleSheet(sstext) - src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) - src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src1 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) + src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = gr.add_cc() channel = filter.channel_model(0.01) thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) @@ -169,14 +175,14 @@ class my_top_block(gr.top_block): pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) # Example of using signal/slot to set the title of a curve - pyWin.connect(pyWin, QtCore.SIGNAL("setTitle(int, QString)"), - pyWin, QtCore.SLOT("setTitle(int, QString)")) - pyWin.emit(QtCore.SIGNAL("setTitle(int, QString)"), 0, "Re{sum}") - self.snk1.set_title(1, "Im{Sum}") - #self.snk1.set_title(2, "Re{src1}") - #self.snk1.set_title(3, "Im{src1}") - #self.snk1.set_title(4, "Re{src2}") - #self.snk1.set_title(5, "Im{src2}") + pyWin.connect(pyWin, QtCore.SIGNAL("setLineLabel(int, QString)"), + pyWin, QtCore.SLOT("setLineLabel(int, QString)")) + pyWin.emit(QtCore.SIGNAL("setLineLabel(int, QString)"), 0, "Re{sum}") + self.snk1.set_line_label(1, "Im{Sum}") + #self.snk1.set_line_label(2, "Re{src1}") + #self.snk1.set_line_label(3, "Im{src1}") + #self.snk1.set_line_label(4, "Re{src2}") + #self.snk1.set_line_label(5, "Im{src2}") # Can also set the color of a curve #self.snk1.set_color(5, "blue") diff --git a/gr-qtgui/examples/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py index 464d8939b0..d7119dcb93 100755 --- a/gr-qtgui/examples/pyqt_time_f.py +++ b/gr-qtgui/examples/pyqt_time_f.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,7 +28,13 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.exit(1) + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) class dialog_box(QtGui.QWidget): @@ -139,11 +145,11 @@ class my_top_block(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) - src1 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) - src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) + src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = gr.add_ff() thr = gr.throttle(gr.sizeof_float, 100*npts) - noise = gr.noise_source_f(gr.GR_GAUSSIAN, 0.001) + noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001) add = gr.add_ff() self.snk1 = qtgui.time_sink_f(npts, Rs, "Complex Time Example", 3) @@ -168,11 +174,11 @@ class my_top_block(gr.top_block): pyWin = sip.wrapinstance(pyQt, QtGui.QWidget) # Example of using signal/slot to set the title of a curve - pyWin.connect(pyWin, QtCore.SIGNAL("setTitle(int, QString)"), - pyWin, QtCore.SLOT("setTitle(int, QString)")) - pyWin.emit(QtCore.SIGNAL("setTitle(int, QString)"), 0, "sum") - self.snk1.set_title(1, "src1") - self.snk1.set_title(2, "src2") + pyWin.connect(pyWin, QtCore.SIGNAL("setLineLabel(int, QString)"), + pyWin, QtCore.SLOT("setLineLabel(int, QString)")) + pyWin.emit(QtCore.SIGNAL("setLineLabel(int, QString)"), 0, "sum") + self.snk1.set_line_label(1, "src1") + self.snk1.set_line_label(2, "src2") # Can also set the color of a curve #self.snk1.set_color(5, "blue") diff --git a/gr-qtgui/examples/pyqt_waterfall_c.py b/gr-qtgui/examples/pyqt_waterfall_c.py index 3b65c5eb5c..eb7e731dfd 100755 --- a/gr-qtgui/examples/pyqt_waterfall_c.py +++ b/gr-qtgui/examples/pyqt_waterfall_c.py @@ -28,7 +28,13 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.exit(1) + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) class dialog_box(QtGui.QWidget): @@ -143,12 +149,12 @@ class my_top_block(gr.top_block): ss.close() self.qapp.setStyleSheet(sstext) - src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) - src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src1 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) + src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = gr.add_cc() channel = filter.channel_model(0.01) thr = gr.throttle(gr.sizeof_gr_complex, 100*npts) - self.snk1 = qtgui.waterfall_sink_c(npts, gr.firdes.WIN_BLACKMAN_hARRIS, + self.snk1 = qtgui.waterfall_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Complex Waterfall Example") diff --git a/gr-qtgui/examples/pyqt_waterfall_f.py b/gr-qtgui/examples/pyqt_waterfall_f.py index 29ae259e5f..ff79924843 100755 --- a/gr-qtgui/examples/pyqt_waterfall_f.py +++ b/gr-qtgui/examples/pyqt_waterfall_f.py @@ -28,7 +28,13 @@ try: from PyQt4 import QtGui, QtCore import sip except ImportError: - print "Error: Program requires PyQt4 and gr-qtgui." + sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n") + sys.exit(1) + +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) class dialog_box(QtGui.QWidget): @@ -139,11 +145,11 @@ class my_top_block(gr.top_block): self.qapp = QtGui.QApplication(sys.argv) - src1 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0) - src2 = gr.sig_source_f(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0) + src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0) + src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0) src = gr.add_ff() thr = gr.throttle(gr.sizeof_float, 100*npts) - self.snk1 = qtgui.waterfall_sink_f(npts, gr.firdes.WIN_BLACKMAN_hARRIS, + self.snk1 = qtgui.waterfall_sink_f(npts, filter.firdes.WIN_BLACKMAN_hARRIS, 0, Rs, "Real Waterfall Example") diff --git a/gr-qtgui/grc/qtgui_const_sink_x.xml b/gr-qtgui/grc/qtgui_const_sink_x.xml index 536237d164..31b13fe136 100644 --- a/gr-qtgui/grc/qtgui_const_sink_x.xml +++ b/gr-qtgui/grc/qtgui_const_sink_x.xml @@ -16,6 +16,8 @@ qtgui.$(type.fcn)( $name, \#name $nconnections \#number of inputs ) +self.$(id).set_y_axis($ymin, $ymax) +self.$(id).set_x_axis($xmin, $xmax) self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget) $(gui_hint()($win))</make> <callback>set_resize($width, $height)</callback> @@ -43,6 +45,34 @@ $(gui_hint()($win))</make> <type>int</type> </param> <param> + <name>Y min</name> + <key>ymin</key> + <value>-2</value> + <type>real</type> + <hide>part</hide> + </param> + <param> + <name>Y max</name> + <key>ymax</key> + <value>2</value> + <type>real</type> + <hide>part</hide> + </param> + <param> + <name>X min</name> + <key>xmin</key> + <value>-2</value> + <type>real</type> + <hide>part</hide> + </param> + <param> + <name>X max</name> + <key>xmax</key> + <value>2</value> + <type>real</type> + <hide>part</hide> + </param> + <param> <name>Number of Inputs</name> <key>nconnections</key> <value>1</value> diff --git a/gr-qtgui/grc/qtgui_freq_sink_x.xml b/gr-qtgui/grc/qtgui_freq_sink_x.xml index 69ce5f4e68..0844a7cbc9 100644 --- a/gr-qtgui/grc/qtgui_freq_sink_x.xml +++ b/gr-qtgui/grc/qtgui_freq_sink_x.xml @@ -20,6 +20,7 @@ qtgui.$(type.fcn)( $name, \#name $nconnections \#number of inputs ) +self.$(id).set_y_axis($ymin, $ymax) self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget) $(gui_hint()($win))</make> <callback>set_frequency_range($fc, $bw)</callback> @@ -96,6 +97,20 @@ $(gui_hint()($win))</make> <type>real</type> </param> <param> + <name>Y min</name> + <key>ymin</key> + <value>-140</value> + <type>real</type> + <hide>part</hide> + </param> + <param> + <name>Y max</name> + <key>ymax</key> + <value>10</value> + <type>real</type> + <hide>part</hide> + </param> + <param> <name>Number of Inputs</name> <key>nconnections</key> <value>1</value> diff --git a/gr-qtgui/grc/qtgui_time_sink_x.xml b/gr-qtgui/grc/qtgui_time_sink_x.xml index 17b2cfd016..7b15aa840a 100644 --- a/gr-qtgui/grc/qtgui_time_sink_x.xml +++ b/gr-qtgui/grc/qtgui_time_sink_x.xml @@ -14,16 +14,19 @@ <make>#set $win = 'self._%s_win'%$id qtgui.$(type.fcn)( $size, \#size - $bw, \#bw + $srate, \#samp_rate $name, \#name $nconnections \#number of inputs ) +self.$(id).set_y_axis($ymin, $ymax) self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget) $(gui_hint()($win))</make> <callback>set_time_domain_axis($min, $max)</callback> <callback>set_update_time($t)</callback> <callback>set_title($which, $title)</callback> <callback>set_color($which, $color)</callback> + <callback>set_y_axis($ymin, $ymax)</callback> + <callback>set_samp_rate($srate)</callback> <param> <name>Type</name> <key>type</key> @@ -45,12 +48,26 @@ $(gui_hint()($win))</make> <type>int</type> </param> <param> - <name>Bandwidth (Hz)</name> - <key>bw</key> + <name>Sample Rate</name> + <key>srate</key> <value>samp_rate</value> <type>real</type> </param> <param> + <name>Y min</name> + <key>ymin</key> + <value>-1</value> + <type>real</type> + <hide>part</hide> + </param> + <param> + <name>Y max</name> + <key>ymax</key> + <value>1</value> + <type>real</type> + <hide>part</hide> + </param> + <param> <name>Number of Inputs</name> <key>nconnections</key> <value>1</value> diff --git a/gr-qtgui/include/qtgui/const_sink_c.h b/gr-qtgui/include/qtgui/const_sink_c.h index 48da4b9fa1..dece60f196 100644 --- a/gr-qtgui/include/qtgui/const_sink_c.h +++ b/gr-qtgui/include/qtgui/const_sink_c.h @@ -62,9 +62,13 @@ namespace gr { virtual void exec_() = 0; virtual PyObject* pyqwidget() = 0; + virtual void set_y_axis(double min, double max) = 0; + virtual void set_x_axis(double min, double max) = 0; + virtual void set_update_time(double t) = 0; - virtual void set_title(int which, const std::string &title) = 0; - virtual void set_color(int which, const std::string &color) = 0; + virtual void set_title(const std::string &title) = 0; + virtual void set_line_label(int which, const std::string &label) = 0; + virtual void set_line_color(int which, const std::string &color) = 0; virtual void set_line_width(int which, int width) = 0; virtual void set_line_style(int which, Qt::PenStyle style) = 0; virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0; @@ -72,6 +76,9 @@ namespace gr { virtual void set_size(int width, int height) = 0; + virtual int nsamps() const = 0; + virtual void reset() = 0; + QApplication *d_qApplication; }; diff --git a/gr-qtgui/include/qtgui/freq_sink_c.h b/gr-qtgui/include/qtgui/freq_sink_c.h index 2bef9035e8..07728e2abe 100644 --- a/gr-qtgui/include/qtgui/freq_sink_c.h +++ b/gr-qtgui/include/qtgui/freq_sink_c.h @@ -75,17 +75,20 @@ namespace gr { virtual float fft_average() const = 0; virtual void set_frequency_range(const double centerfreq, const double bandwidth) = 0; - virtual void set_fft_power_db(double min, double max) = 0; + virtual void set_y_axis(double min, double max) = 0; virtual void set_update_time(double t) = 0; - virtual void set_title(int which, const std::string &title) = 0; - virtual void set_color(int which, const std::string &color) = 0; + virtual void set_title(const std::string &title) = 0; + virtual void set_line_label(int which, const std::string &label) = 0; + virtual void set_line_color(int which, const std::string &color) = 0; virtual void set_line_width(int which, int width) = 0; virtual void set_line_style(int which, Qt::PenStyle style) = 0; virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0; virtual void set_size(int width, int height) = 0; + virtual void reset() = 0; + QApplication *d_qApplication; }; diff --git a/gr-qtgui/include/qtgui/freq_sink_f.h b/gr-qtgui/include/qtgui/freq_sink_f.h index 51c4ac10a1..0ed81c62b2 100644 --- a/gr-qtgui/include/qtgui/freq_sink_f.h +++ b/gr-qtgui/include/qtgui/freq_sink_f.h @@ -75,17 +75,20 @@ namespace gr { virtual float fft_average() const = 0; virtual void set_frequency_range(const double centerfreq, const double bandwidth) = 0; - virtual void set_fft_power_db(double min, double max) = 0; + virtual void set_y_axis(double min, double max) = 0; virtual void set_update_time(double t) = 0; - virtual void set_title(int which, const std::string &title) = 0; - virtual void set_color(int which, const std::string &color) = 0; + virtual void set_title(const std::string &title) = 0; + virtual void set_line_label(int which, const std::string &label) = 0; + virtual void set_line_color(int which, const std::string &color) = 0; virtual void set_line_width(int which, int width) = 0; virtual void set_line_style(int which, Qt::PenStyle style) = 0; virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0; virtual void set_size(int width, int height) = 0; + virtual void reset() = 0; + QApplication *d_qApplication; }; diff --git a/gr-qtgui/include/qtgui/time_sink_c.h b/gr-qtgui/include/qtgui/time_sink_c.h index 17176e65f9..ba31ae2fc8 100644 --- a/gr-qtgui/include/qtgui/time_sink_c.h +++ b/gr-qtgui/include/qtgui/time_sink_c.h @@ -54,12 +54,12 @@ namespace gr { * \brief Build complex time sink * * \param size number of points to plot at once - * \param bw bandwidth of signal (used to set x-axis labels) + * \param samp_rate sample rate (used to set x-axis labels) * \param name title for the plot * \param nconnections number of signals connected to sink * \param parent a QWidget parent object, if any */ - static sptr make(int size, double bw, + static sptr make(int size, double samp_rate, const std::string &name, int nconnections, QWidget *parent=NULL); @@ -67,17 +67,22 @@ namespace gr { virtual void exec_() = 0; virtual PyObject* pyqwidget() = 0; - virtual void set_time_domain_axis(double min, double max) = 0; + virtual void set_y_axis(double min, double max) = 0; virtual void set_update_time(double t) = 0; - virtual void set_title(int which, const std::string &title) = 0; - virtual void set_color(int which, const std::string &color) = 0; + virtual void set_title(const std::string &title) = 0; + virtual void set_line_label(int which, const std::string &label) = 0; + virtual void set_line_color(int which, const std::string &color) = 0; virtual void set_line_width(int which, int width) = 0; virtual void set_line_style(int which, Qt::PenStyle style) = 0; virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0; virtual void set_nsamps(const int newsize) = 0; + virtual void set_samp_rate(const double samp_rate) = 0; virtual void set_size(int width, int height) = 0; + virtual int nsamps() const = 0; + virtual void reset() = 0; + QApplication *d_qApplication; }; diff --git a/gr-qtgui/include/qtgui/time_sink_f.h b/gr-qtgui/include/qtgui/time_sink_f.h index df6ba9f554..6ab10f117e 100644 --- a/gr-qtgui/include/qtgui/time_sink_f.h +++ b/gr-qtgui/include/qtgui/time_sink_f.h @@ -52,12 +52,12 @@ namespace gr { * \brief Build floating point time sink * * \param size number of points to plot at once - * \param bw bandwidth of signal (used to set x-axis labels) + * \param samp_rate sample rate (used to set x-axis labels) * \param name title for the plot * \param nconnections number of signals connected to sink * \param parent a QWidget parent object, if any */ - static sptr make(int size, double bw, + static sptr make(int size, double samp_rate, const std::string &name, int nconnections, QWidget *parent=NULL); @@ -65,17 +65,22 @@ namespace gr { virtual void exec_() = 0; virtual PyObject* pyqwidget() = 0; - virtual void set_time_domain_axis(double min, double max) = 0; + virtual void set_y_axis(double min, double max) = 0; virtual void set_update_time(double t) = 0; - virtual void set_title(int which, const std::string &title) = 0; - virtual void set_color(int which, const std::string &color) = 0; + virtual void set_title(const std::string &title) = 0; + virtual void set_line_label(int which, const std::string &line) = 0; + virtual void set_line_color(int which, const std::string &color) = 0; virtual void set_line_width(int which, int width) = 0; virtual void set_line_style(int which, Qt::PenStyle style) = 0; virtual void set_line_marker(int which, QwtSymbol::Style marker) = 0; virtual void set_nsamps(const int newsize) = 0; + virtual void set_samp_rate(const double samp_rate) = 0; virtual void set_size(int width, int height) = 0; + virtual int nsamps() const = 0; + virtual void reset() = 0; + QApplication *d_qApplication; }; diff --git a/gr-qtgui/include/qtgui/waterfall_sink_c.h b/gr-qtgui/include/qtgui/waterfall_sink_c.h index 838d50f44d..cb1589f993 100644 --- a/gr-qtgui/include/qtgui/waterfall_sink_c.h +++ b/gr-qtgui/include/qtgui/waterfall_sink_c.h @@ -84,7 +84,8 @@ namespace gr { virtual void set_update_time(double t) = 0; virtual void set_title(const std::string &title) = 0; - virtual void set_color(const std::string &color) = 0; + virtual void set_line_label(const std::string &line) = 0; + virtual void set_line_color(const std::string &color) = 0; virtual void set_line_width(int width) = 0; virtual void set_line_style(Qt::PenStyle style) = 0; virtual void set_line_marker(QwtSymbol::Style marker) = 0; diff --git a/gr-qtgui/include/qtgui/waterfall_sink_f.h b/gr-qtgui/include/qtgui/waterfall_sink_f.h index 0ee38256c3..355b5e45f2 100644 --- a/gr-qtgui/include/qtgui/waterfall_sink_f.h +++ b/gr-qtgui/include/qtgui/waterfall_sink_f.h @@ -83,7 +83,8 @@ namespace gr { virtual void set_update_time(double t) = 0; virtual void set_title(const std::string &title) = 0; - virtual void set_color(const std::string &color) = 0; + virtual void set_line_label(const std::string &line) = 0; + virtual void set_line_color(const std::string &color) = 0; virtual void set_line_width(int width) = 0; virtual void set_line_style(Qt::PenStyle style) = 0; virtual void set_line_marker(QwtSymbol::Style marker) = 0; diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc index 5bc89f83fa..51000cab17 100644 --- a/gr-qtgui/lib/ConstellationDisplayPlot.cc +++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc @@ -65,14 +65,6 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(int nplots, QWidget* parent) _numPoints = 1024; _penSize = 5; - setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); - set_xaxis(-2.0, 2.0); - setAxisTitle(QwtPlot::xBottom, "In-phase"); - - setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); - set_yaxis(-2.0, 2.0); - setAxisTitle(QwtPlot::yLeft, "Quadrature"); - _zoomer = new ConstellationDisplayZoomer(canvas()); #if QWT_VERSION < 0x060000 @@ -88,6 +80,15 @@ ConstellationDisplayPlot::ConstellationDisplayPlot(int nplots, QWidget* parent) _zoomer->setRubberBandPen(c); _zoomer->setTrackerPen(c); + setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); + set_xaxis(-2.0, 2.0); + setAxisTitle(QwtPlot::xBottom, "In-phase"); + + setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); + set_yaxis(-2.0, 2.0); + setAxisTitle(QwtPlot::yLeft, "Quadrature"); + updateAxes(); + QList<QColor> colors; colors << QColor(Qt::blue) << QColor(Qt::red) << QColor(Qt::green) << QColor(Qt::black) << QColor(Qt::cyan) << QColor(Qt::magenta) @@ -135,13 +136,13 @@ ConstellationDisplayPlot::~ConstellationDisplayPlot() void ConstellationDisplayPlot::set_xaxis(double min, double max) { - setAxisScale(QwtPlot::xBottom, min, max); + setXaxis(min, max); } void ConstellationDisplayPlot::set_yaxis(double min, double max) { - setAxisScale(QwtPlot::yLeft, min, max); + setYaxis(min, max); } void diff --git a/gr-qtgui/lib/DisplayPlot.cc b/gr-qtgui/lib/DisplayPlot.cc index 2b982b77d2..0b422ee1ca 100644 --- a/gr-qtgui/lib/DisplayPlot.cc +++ b/gr-qtgui/lib/DisplayPlot.cc @@ -107,19 +107,19 @@ DisplayPlot::setXaxis(double min, double max) } void -DisplayPlot::setTitle(int which, QString title) +DisplayPlot::setLineLabel(int which, QString label) { - _plot_curve[which]->setTitle(title); + _plot_curve[which]->setTitle(label); } QString -DisplayPlot::title(int which) +DisplayPlot::lineLabel(int which) { return _plot_curve[which]->title().text(); } void -DisplayPlot::setColor(int which, QColor color) +DisplayPlot::setLineColor(int which, QString color) { if (which < _nplots) { // Set the color of the pen @@ -144,7 +144,7 @@ DisplayPlot::setColor(int which, QColor color) } QColor -DisplayPlot::getColor(int which) const { +DisplayPlot::getLineColor(int which) const { // If that plot doesn't exist then return black. if (which < _nplots) return _plot_curve[which]->pen().color(); @@ -154,7 +154,7 @@ DisplayPlot::getColor(int which) const { // Use a preprocessor macro to create a bunch of hooks for Q_PROPERTY and hence the stylesheet. #define SETUPLINE(i, im1) \ void DisplayPlot::setLineColor ## i (QColor c) {setColor(im1, c);} \ - const QColor DisplayPlot::getLineColor ## i () const {return getColor(im1);} \ + const QColor DisplayPlot::getLineColor ## i () const {return getLineColor(im1);} \ void DisplayPlot::setLineWidth ## i (int width) {setLineWidth(im1, width);} \ int DisplayPlot::getLineWidth ## i () const {return getLineWidth(im1);} \ void DisplayPlot::setLineStyle ## i (Qt::PenStyle ps) {setLineStyle(im1, ps);} \ diff --git a/gr-qtgui/lib/DisplayPlot.h b/gr-qtgui/lib/DisplayPlot.h index fa8c14e764..934794680d 100644 --- a/gr-qtgui/lib/DisplayPlot.h +++ b/gr-qtgui/lib/DisplayPlot.h @@ -178,10 +178,10 @@ public: public slots: void setYaxis(double min, double max); void setXaxis(double min, double max); - void setTitle(int which, QString title); + void setLineLabel(int which, QString label); + void setLineColor(int which, QString color); - void setColor(int which, QColor color); - QColor getColor(int which) const; + QColor getLineColor(int which) const; void setLineWidth(int which, int width); int getLineWidth(int which) const; void setLineStyle(int which, Qt::PenStyle style); @@ -251,7 +251,7 @@ public slots: void setStop(bool on); - QString title(int which); + QString lineLabel(int which); void resizeSlot(QSize *s); diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc index a2894a5042..0fdba579c8 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc @@ -221,7 +221,7 @@ FrequencyDisplayPlot::~FrequencyDisplayPlot() } void -FrequencyDisplayPlot::set_yaxis(double min, double max) +FrequencyDisplayPlot::setYaxis(double min, double max) { // Get the new max/min values for the plot _minYAxis = min; diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h index fa153986b8..679ebf1cc4 100644 --- a/gr-qtgui/lib/FrequencyDisplayPlot.h +++ b/gr-qtgui/lib/FrequencyDisplayPlot.h @@ -72,7 +72,7 @@ public: void replot(); - void set_yaxis(double min, double max); + void setYaxis(double min, double max); void SetTraceColour (QColor); void SetBGColour (QColor c); diff --git a/gr-qtgui/lib/const_sink_c_impl.cc b/gr-qtgui/lib/const_sink_c_impl.cc index b504f7121d..547530c823 100644 --- a/gr-qtgui/lib/const_sink_c_impl.cc +++ b/gr-qtgui/lib/const_sink_c_impl.cc @@ -44,9 +44,9 @@ namespace gr { } const_sink_c_impl::const_sink_c_impl(int size, - const std::string &name, - int nconnections, - QWidget *parent) + const std::string &name, + int nconnections, + QWidget *parent) : gr_sync_block("const_sink_c", gr_make_io_signature(nconnections, nconnections, sizeof(gr_complex)), gr_make_io_signature(0, 0, 0)), @@ -94,7 +94,7 @@ namespace gr { } d_main_gui = new ConstellationDisplayForm(d_nconnections, d_parent); - d_main_gui->SetNPoints(d_size); + d_main_gui->setNPoints(d_size); // initialize update time to 10 times a second set_update_time(0.1); d_last_time = 0; @@ -121,6 +121,18 @@ namespace gr { } void + const_sink_c_impl::set_y_axis(double min, double max) + { + d_main_gui->setYaxis(min, max); + } + + void + const_sink_c_impl::set_x_axis(double min, double max) + { + d_main_gui->setXaxis(min, max); + } + + void const_sink_c_impl::set_update_time(double t) { //convert update time to ticks @@ -130,15 +142,21 @@ namespace gr { } void - const_sink_c_impl::set_title(int which, const std::string &title) + const_sink_c_impl::set_title(const std::string &title) { - d_main_gui->setTitle(which, title.c_str()); + d_main_gui->setTitle(title.c_str()); } void - const_sink_c_impl::set_color(int which, const std::string &color) + const_sink_c_impl::set_line_label(int which, const std::string &label) { - d_main_gui->setColor(which, color.c_str()); + d_main_gui->setLineLabel(which, label.c_str()); + } + + void + const_sink_c_impl::set_line_color(int which, const std::string &color) + { + d_main_gui->setLineColor(which, color.c_str()); } void @@ -187,18 +205,30 @@ namespace gr { d_size = newsize; d_index = 0; - d_main_gui->SetNPoints(d_size); + d_main_gui->setNPoints(d_size); } } void const_sink_c_impl::npoints_resize() { - int newsize = d_main_gui->GetNPoints(); + int newsize = d_main_gui->getNPoints(); set_nsamps(newsize); } int + const_sink_c_impl::nsamps() const + { + return d_size; + } + + void + const_sink_c_impl::reset() + { + d_index = 0; + } + + int const_sink_c_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) diff --git a/gr-qtgui/lib/const_sink_c_impl.h b/gr-qtgui/lib/const_sink_c_impl.h index a17a8793b4..8bb2344c9f 100644 --- a/gr-qtgui/lib/const_sink_c_impl.h +++ b/gr-qtgui/lib/const_sink_c_impl.h @@ -65,9 +65,13 @@ namespace gr { QWidget* qwidget(); PyObject* pyqwidget(); + void set_y_axis(double min, double max); + void set_x_axis(double min, double max); + void set_update_time(double t); - void set_title(int which, const std::string &title); - void set_color(int which, const std::string &color); + void set_title(const std::string &title); + void set_line_label(int which, const std::string &label); + void set_line_color(int which, const std::string &color); void set_line_width(int which, int width); void set_line_style(int which, Qt::PenStyle style); void set_line_marker(int which, QwtSymbol::Style marker); @@ -75,6 +79,9 @@ namespace gr { void set_size(int width, int height); + int nsamps() const; + void reset(); + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/gr-qtgui/lib/constellationdisplayform.cc b/gr-qtgui/lib/constellationdisplayform.cc index 98375ebaed..5f742de991 100644 --- a/gr-qtgui/lib/constellationdisplayform.cc +++ b/gr-qtgui/lib/constellationdisplayform.cc @@ -39,7 +39,7 @@ ConstellationDisplayForm::ConstellationDisplayForm(int nplots, QWidget* parent) NPointsMenu *nptsmenu = new NPointsMenu(this); _menu->addAction(nptsmenu); connect(nptsmenu, SIGNAL(whichTrigger(int)), - this, SLOT(SetNPoints(const int))); + this, SLOT(setNPoints(const int))); Reset(); @@ -84,13 +84,25 @@ ConstellationDisplayForm::customEvent(QEvent * e) } int -ConstellationDisplayForm::GetNPoints() const +ConstellationDisplayForm::getNPoints() const { return d_npoints; } void -ConstellationDisplayForm::SetNPoints(const int npoints) +ConstellationDisplayForm::setNPoints(const int npoints) { d_npoints = npoints; } + +void +ConstellationDisplayForm::setYaxis(double min, double max) +{ + getPlot()->set_yaxis(min, max); +} + +void +ConstellationDisplayForm::setXaxis(double min, double max) +{ + getPlot()->set_xaxis(min, max); +} diff --git a/gr-qtgui/lib/constellationdisplayform.h b/gr-qtgui/lib/constellationdisplayform.h index 6832bd44cc..d9715d3dd9 100644 --- a/gr-qtgui/lib/constellationdisplayform.h +++ b/gr-qtgui/lib/constellationdisplayform.h @@ -40,13 +40,14 @@ public: ConstellationDisplayPlot* getPlot(); - int GetNPoints() const; + int getNPoints() const; public slots: void customEvent(QEvent * e); - void SetNPoints(const int); + void setNPoints(const int); - // add set x/y axis + void setYaxis(double min, double max); + void setXaxis(double min, double max); private slots: void newData(const QEvent*); diff --git a/gr-qtgui/lib/displayform.cc b/gr-qtgui/lib/displayform.cc index 08ced9c913..e2475cb95e 100644 --- a/gr-qtgui/lib/displayform.cc +++ b/gr-qtgui/lib/displayform.cc @@ -22,6 +22,8 @@ #include <displayform.h> #include <iostream> +#include <QPixmap> +#include <QFileDialog> DisplayForm::DisplayForm(int nplots, QWidget* parent) : QWidget(parent), _nplots(nplots), _systemSpecifiedFlag(false) @@ -58,11 +60,11 @@ DisplayForm::DisplayForm(int nplots, QWidget* parent) _marker_alpha_menu.push_back(new MarkerAlphaMenu(i, this)); connect(_line_title_act[i], SIGNAL(whichTrigger(int, const QString&)), - this, SLOT(setTitle(int, const QString&))); + this, SLOT(setLineLabel(int, const QString&))); for(int j = 0; j < _line_color_menu[i]->getNumActions(); j++) { connect(_line_color_menu[i], SIGNAL(whichTrigger(int, const QString&)), - this, SLOT(setColor(int, const QString&))); + this, SLOT(setLineColor(int, const QString&))); } for(int j = 0; j < _line_width_menu[i]->getNumActions(); j++) { @@ -95,6 +97,12 @@ DisplayForm::DisplayForm(int nplots, QWidget* parent) _menu->addMenu(_lines_menu[i]); } + + _save_act = new QAction("Save", this); + _save_act->setStatusTip(tr("Save Figure")); + connect(_save_act, SIGNAL(triggered()), this, SLOT(saveFigure())); + _menu->addAction(_save_act); + Reset(); // Create a timer to update plots at the specified rate @@ -145,7 +153,7 @@ DisplayForm::mousePressEvent( QMouseEvent * e) // Update the line titles if changed externally for(int i = 0; i < _nplots; i++) { - _lines_menu[i]->setTitle(_displayPlot->title(i)); + _lines_menu[i]->setTitle(_displayPlot->lineLabel(i)); } _menu->exec(e->globalPos()); } @@ -185,16 +193,22 @@ DisplayForm::setUpdateTime(double t) } void -DisplayForm::setTitle(int which, const QString &title) +DisplayForm::setTitle(const QString &title) +{ + _displayPlot->setTitle(title); +} + +void +DisplayForm::setLineLabel(int which, const QString &label) { - _displayPlot->setTitle(which, title); + _displayPlot->setLineLabel(which, label); } void -DisplayForm::setColor(int which, const QString &color) +DisplayForm::setLineColor(int which, const QString &color) { QColor c = QColor(color); - _displayPlot->setColor(which, c); + _displayPlot->setLineColor(which, c); _displayPlot->replot(); } @@ -273,3 +287,40 @@ DisplayForm::setGrid() else setGrid(false); } + +void +DisplayForm::saveFigure() +{ + QPixmap qpix = QPixmap::grabWidget(this); + + QString types = QString(tr("JPEG file (*.jpg);;Portable Network Graphics file (*.png);;Bitmap file (*.bmp);;TIFF file (*.tiff)")); + + QString filename, filetype; + QFileDialog *filebox = new QFileDialog(0, "Save Image", "./", types); + filebox->setViewMode(QFileDialog::Detail); + if(filebox->exec()) { + filename = filebox->selectedFiles()[0]; + filetype = filebox->selectedNameFilter(); + } + else { + return; + } + + if(filetype.contains(".jpg")) { + qpix.save(filename, "JPEG"); + } + else if(filetype.contains(".png")) { + qpix.save(filename, "PNG"); + } + else if(filetype.contains(".bmp")) { + qpix.save(filename, "BMP"); + } + else if(filetype.contains(".tiff")) { + qpix.save(filename, "TIFF"); + } + else { + qpix.save(filename, "JPEG"); + } + + delete filebox; +} diff --git a/gr-qtgui/lib/displayform.h b/gr-qtgui/lib/displayform.h index c14b734d44..99b0e714f4 100644 --- a/gr-qtgui/lib/displayform.h +++ b/gr-qtgui/lib/displayform.h @@ -53,8 +53,9 @@ public slots: void setUpdateTime(double t); - void setTitle(int which, const QString &title); - void setColor(int which, const QString &color); + void setTitle(const QString &title); + void setLineLabel(int which, const QString &label); + void setLineColor(int which, const QString &color); void setLineWidth(int which, int width); void setLineStyle(int which, Qt::PenStyle style); void setLineMarker(int which, QwtSymbol::Style style); @@ -66,6 +67,8 @@ public slots: void setGrid(bool on); void setGrid(); + void saveFigure(); + private slots: virtual void newData(const QEvent*) = 0; void updateGuiTimer(); @@ -99,6 +102,8 @@ protected: QList<LineMarkerMenu*> _line_marker_menu; QList<MarkerAlphaMenu*> _marker_alpha_menu; + QAction *_save_act; + QTimer *d_displayTimer; double d_update_time; }; diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc index cf5c989c09..e495dfcc25 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.cc +++ b/gr-qtgui/lib/freq_sink_c_impl.cc @@ -115,9 +115,9 @@ namespace gr { } d_main_gui = new FreqDisplayForm(d_nconnections, d_parent); - d_main_gui->SetFFTSize(d_fftsize); - d_main_gui->SetFFTWindowType(d_wintype); - d_main_gui->SetFrequencyRange(d_center_freq, + d_main_gui->setFFTSize(d_fftsize); + d_main_gui->setFFTWindowType(d_wintype); + d_main_gui->setFrequencyRange(d_center_freq, d_center_freq - d_bandwidth/2.0, d_center_freq + d_bandwidth/2.0); @@ -150,7 +150,7 @@ namespace gr { freq_sink_c_impl::set_fft_size(const int fftsize) { d_fftsize = fftsize; - d_main_gui->SetFFTSize(fftsize); + d_main_gui->setFFTSize(fftsize); } int @@ -163,7 +163,7 @@ namespace gr { freq_sink_c_impl::set_fft_average(const float fftavg) { d_fftavg = fftavg; - d_main_gui->SetFFTAverage(fftavg); + d_main_gui->setFFTAverage(fftavg); } float @@ -178,15 +178,15 @@ namespace gr { { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->SetFrequencyRange(d_center_freq, + d_main_gui->setFrequencyRange(d_center_freq, -d_bandwidth/2.0, d_bandwidth/2.0); } void - freq_sink_c_impl::set_fft_power_db(double min, double max) + freq_sink_c_impl::set_y_axis(double min, double max) { - d_main_gui->SetFrequencyAxis(min, max); + d_main_gui->setYaxis(min, max); } void @@ -199,15 +199,21 @@ namespace gr { } void - freq_sink_c_impl::set_title(int which, const std::string &title) + freq_sink_c_impl::set_title(const std::string &title) { - d_main_gui->setTitle(which, title.c_str()); + d_main_gui->setTitle(title.c_str()); } void - freq_sink_c_impl::set_color(int which, const std::string &color) + freq_sink_c_impl::set_line_label(int which, const std::string &label) { - d_main_gui->setColor(which, color.c_str()); + d_main_gui->setLineLabel(which, label.c_str()); + } + + void + freq_sink_c_impl::set_line_color(int which, const std::string &color) + { + d_main_gui->setLineColor(which, color.c_str()); } void @@ -235,6 +241,12 @@ namespace gr { } void + freq_sink_c_impl::reset() + { + d_index = 0; + } + + void freq_sink_c_impl::fft(float *data_out, const gr_complex *data_in, int size) { if(d_window.size()) { @@ -263,7 +275,7 @@ namespace gr { freq_sink_c_impl::windowreset() { filter::firdes::win_type newwintype; - newwintype = d_main_gui->GetFFTWindowType(); + newwintype = d_main_gui->getFFTWindowType(); if(d_wintype != newwintype) { d_wintype = newwintype; buildwindow(); @@ -284,8 +296,8 @@ namespace gr { { gruel::scoped_lock lock(d_mutex); - int newfftsize = d_main_gui->GetFFTSize(); - d_fftavg = d_main_gui->GetFFTAverage(); + int newfftsize = d_main_gui->getFFTSize(); + d_fftavg = d_main_gui->getFFTAverage(); if(newfftsize != d_fftsize) { // Resize residbuf and replace data diff --git a/gr-qtgui/lib/freq_sink_c_impl.h b/gr-qtgui/lib/freq_sink_c_impl.h index 106e50497d..d162ab03bd 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.h +++ b/gr-qtgui/lib/freq_sink_c_impl.h @@ -88,17 +88,20 @@ namespace gr { float fft_average() const; void set_frequency_range(const double centerfreq, const double bandwidth); - void set_fft_power_db(double min, double max); + void set_y_axis(double min, double max); void set_update_time(double t); - void set_title(int which, const std::string &title); - void set_color(int which, const std::string &color); + void set_title(const std::string &title); + void set_line_label(int which, const std::string &label); + void set_line_color(int which, const std::string &color); void set_line_width(int which, int width); void set_line_style(int which, Qt::PenStyle style); void set_line_marker(int which, QwtSymbol::Style marker); void set_size(int width, int height); + void reset(); + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc index 2cf43e9994..c9ec1f52aa 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.cc +++ b/gr-qtgui/lib/freq_sink_f_impl.cc @@ -115,9 +115,9 @@ namespace gr { } d_main_gui = new FreqDisplayForm(d_nconnections, d_parent); - d_main_gui->SetFFTSize(d_fftsize); - d_main_gui->SetFFTWindowType(d_wintype); - d_main_gui->SetFrequencyRange(d_center_freq, + d_main_gui->setFFTSize(d_fftsize); + d_main_gui->setFFTWindowType(d_wintype); + d_main_gui->setFrequencyRange(d_center_freq, d_center_freq - d_bandwidth/2.0, d_center_freq + d_bandwidth/2.0); @@ -150,7 +150,7 @@ namespace gr { freq_sink_f_impl::set_fft_size(const int fftsize) { d_fftsize = fftsize; - d_main_gui->SetFFTSize(fftsize); + d_main_gui->setFFTSize(fftsize); } int @@ -163,7 +163,7 @@ namespace gr { freq_sink_f_impl::set_fft_average(const float fftavg) { d_fftavg = fftavg; - d_main_gui->SetFFTAverage(fftavg); + d_main_gui->setFFTAverage(fftavg); } float @@ -178,15 +178,15 @@ namespace gr { { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->SetFrequencyRange(d_center_freq, + d_main_gui->setFrequencyRange(d_center_freq, -d_bandwidth/2.0, d_bandwidth/2.0); } void - freq_sink_f_impl::set_fft_power_db(double min, double max) + freq_sink_f_impl::set_y_axis(double min, double max) { - d_main_gui->SetFrequencyAxis(min, max); + d_main_gui->setYaxis(min, max); } void @@ -199,15 +199,21 @@ namespace gr { } void - freq_sink_f_impl::set_title(int which, const std::string &title) + freq_sink_f_impl::set_title(const std::string &title) { - d_main_gui->setTitle(which, title.c_str()); + d_main_gui->setTitle(title.c_str()); } void - freq_sink_f_impl::set_color(int which, const std::string &color) + freq_sink_f_impl::set_line_label(int which, const std::string &label) { - d_main_gui->setColor(which, color.c_str()); + d_main_gui->setLineLabel(which, label.c_str()); + } + + void + freq_sink_f_impl::set_line_color(int which, const std::string &color) + { + d_main_gui->setLineColor(which, color.c_str()); } void @@ -236,6 +242,12 @@ namespace gr { } void + freq_sink_f_impl::reset() + { + d_index = 0; + } + + void freq_sink_f_impl::fft(float *data_out, const float *data_in, int size) { // float to complex conversion @@ -267,7 +279,7 @@ namespace gr { gruel::scoped_lock lock(d_mutex); filter::firdes::win_type newwintype; - newwintype = d_main_gui->GetFFTWindowType(); + newwintype = d_main_gui->getFFTWindowType(); if(d_wintype != newwintype) { d_wintype = newwintype; buildwindow(); @@ -288,8 +300,8 @@ namespace gr { { gruel::scoped_lock lock(d_mutex); - int newfftsize = d_main_gui->GetFFTSize(); - d_fftavg = d_main_gui->GetFFTAverage(); + int newfftsize = d_main_gui->getFFTSize(); + d_fftavg = d_main_gui->getFFTAverage(); if(newfftsize != d_fftsize) { // Resize residbuf and replace data diff --git a/gr-qtgui/lib/freq_sink_f_impl.h b/gr-qtgui/lib/freq_sink_f_impl.h index a358953629..ffb2c4bf59 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.h +++ b/gr-qtgui/lib/freq_sink_f_impl.h @@ -88,17 +88,20 @@ namespace gr { float fft_average() const; void set_frequency_range(const double centerfreq, const double bandwidth); - void set_fft_power_db(double min, double max); + void set_y_axis(double min, double max); void set_update_time(double t); - void set_title(int which, const std::string &title); - void set_color(int which, const std::string &color); + void set_title(const std::string &title); + void set_line_label(int which, const std::string &label); + void set_line_color(int which, const std::string &color); void set_line_width(int which, int width); void set_line_style(int which, Qt::PenStyle style); void set_line_marker(int which, QwtSymbol::Style marker); void set_size(int width, int height); + void reset(); + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/gr-qtgui/lib/freqdisplayform.cc b/gr-qtgui/lib/freqdisplayform.cc index 6f12fe5090..410bb4a048 100644 --- a/gr-qtgui/lib/freqdisplayform.cc +++ b/gr-qtgui/lib/freqdisplayform.cc @@ -47,11 +47,11 @@ FreqDisplayForm::FreqDisplayForm(int nplots, QWidget* parent) _menu->addMenu(avgmenu); _menu->addMenu(winmenu); connect(sizemenu, SIGNAL(whichTrigger(int)), - this, SLOT(SetFFTSize(const int))); + this, SLOT(setFFTSize(const int))); connect(avgmenu, SIGNAL(whichTrigger(float)), - this, SLOT(SetFFTAverage(const float))); + this, SLOT(setFFTAverage(const float))); connect(winmenu, SIGNAL(whichTrigger(gr::filter::firdes::win_type)), - this, SLOT(SetFFTWindowType(const gr::filter::firdes::win_type))); + this, SLOT(setFFTWindowType(const gr::filter::firdes::win_type))); Reset(); @@ -93,44 +93,44 @@ FreqDisplayForm::customEvent( QEvent * e) } int -FreqDisplayForm::GetFFTSize() const +FreqDisplayForm::getFFTSize() const { return _fftsize; } float -FreqDisplayForm::GetFFTAverage() const +FreqDisplayForm::getFFTAverage() const { return _fftavg; } gr::filter::firdes::win_type -FreqDisplayForm::GetFFTWindowType() const +FreqDisplayForm::getFFTWindowType() const { return _fftwintype; } void -FreqDisplayForm::SetFFTSize(const int newsize) +FreqDisplayForm::setFFTSize(const int newsize) { _fftsize = newsize; } void -FreqDisplayForm::SetFFTAverage(const float newavg) +FreqDisplayForm::setFFTAverage(const float newavg) { _fftavg = newavg; getPlot()->replot(); } void -FreqDisplayForm::SetFFTWindowType(const gr::filter::firdes::win_type newwin) +FreqDisplayForm::setFFTWindowType(const gr::filter::firdes::win_type newwin) { _fftwintype = newwin; } void -FreqDisplayForm::SetFrequencyRange(const double newCenterFrequency, +FreqDisplayForm::setFrequencyRange(const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency) { @@ -156,7 +156,7 @@ FreqDisplayForm::SetFrequencyRange(const double newCenterFrequency, } void -FreqDisplayForm::SetFrequencyAxis(double min, double max) +FreqDisplayForm::setYaxis(double min, double max) { - getPlot()->set_yaxis(min, max); + getPlot()->setYaxis(min, max); } diff --git a/gr-qtgui/lib/freqdisplayform.h b/gr-qtgui/lib/freqdisplayform.h index ffce317c4f..4a7fc7d2e5 100644 --- a/gr-qtgui/lib/freqdisplayform.h +++ b/gr-qtgui/lib/freqdisplayform.h @@ -41,21 +41,21 @@ class FreqDisplayForm : public DisplayForm FrequencyDisplayPlot* getPlot(); - int GetFFTSize() const; - float GetFFTAverage() const; - gr::filter::firdes::win_type GetFFTWindowType() const; + int getFFTSize() const; + float getFFTAverage() const; + gr::filter::firdes::win_type getFFTWindowType() const; public slots: void customEvent(QEvent *e); - void SetFFTSize(const int); - void SetFFTAverage(const float); - void SetFFTWindowType(const gr::filter::firdes::win_type); + void setFFTSize(const int); + void setFFTAverage(const float); + void setFFTWindowType(const gr::filter::firdes::win_type); - void SetFrequencyRange(const double newCenterFrequency, + void setFrequencyRange(const double newCenterFrequency, const double newStartFrequency, const double newStopFrequency); - void SetFrequencyAxis(double min, double max); + void setYaxis(double min, double max); private slots: void newData(const QEvent *updateEvent); diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc index 6de6caa1b1..93853cead1 100644 --- a/gr-qtgui/lib/spectrumdisplayform.cc +++ b/gr-qtgui/lib/spectrumdisplayform.cc @@ -43,8 +43,8 @@ SpectrumDisplayForm::SpectrumDisplayForm(QWidget* parent) _averagedValues = new double[_numRealDataPoints]; _historyVector = new std::vector<double*>; - _timeDomainDisplayPlot->setTitle(0, "real"); - _timeDomainDisplayPlot->setTitle(1, "imag"); + _timeDomainDisplayPlot->setLineLabel(0, "real"); + _timeDomainDisplayPlot->setLineLabel(1, "imag"); AvgLineEdit->setRange(0, 500); // Set range of Average box value from 0 to 500 MinHoldCheckBox_toggled( false ); @@ -729,7 +729,7 @@ SpectrumDisplayForm::SetConstellationPenSize(int size) void SpectrumDisplayForm::SetFrequencyAxis(double min, double max) { - _frequencyDisplayPlot->set_yaxis(min, max); + _frequencyDisplayPlot->setYaxis(min, max); } void diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc index 83ab76eb6e..c8efb63721 100644 --- a/gr-qtgui/lib/time_sink_c_impl.cc +++ b/gr-qtgui/lib/time_sink_c_impl.cc @@ -34,23 +34,23 @@ namespace gr { namespace qtgui { time_sink_c::sptr - time_sink_c::make(int size, double bw, + time_sink_c::make(int size, double samp_rate, const std::string &name, int nconnections, QWidget *parent) { return gnuradio::get_initial_sptr - (new time_sink_c_impl(size, bw, name, nconnections, parent)); + (new time_sink_c_impl(size, samp_rate, name, nconnections, parent)); } - time_sink_c_impl::time_sink_c_impl(int size, double bw, + time_sink_c_impl::time_sink_c_impl(int size, double samp_rate, const std::string &name, int nconnections, QWidget *parent) : gr_sync_block("time_sink_c", gr_make_io_signature(nconnections, nconnections, sizeof(gr_complex)), gr_make_io_signature(0, 0, 0)), - d_size(size), d_bandwidth(bw), d_name(name), + d_size(size), d_samp_rate(samp_rate), d_name(name), d_nconnections(2*nconnections), d_parent(parent) { d_main_gui = NULL; @@ -91,7 +91,8 @@ namespace gr { } d_main_gui = new TimeDisplayForm(d_nconnections, d_parent); - d_main_gui->SetNPoints(d_size); + d_main_gui->setNPoints(d_size); + d_main_gui->setSampleRate(d_samp_rate); // initialize update time to 10 times a second set_update_time(0.1); @@ -119,9 +120,9 @@ namespace gr { } void - time_sink_c_impl::set_time_domain_axis(double min, double max) + time_sink_c_impl::set_y_axis(double min, double max) { - d_main_gui->setTimeDomainAxis(min, max); + d_main_gui->setYaxis(min, max); } void @@ -134,15 +135,21 @@ namespace gr { } void - time_sink_c_impl::set_title(int which, const std::string &title) + time_sink_c_impl::set_title(const std::string &title) { - d_main_gui->setTitle(which, title.c_str()); + d_main_gui->setTitle(title.c_str()); } void - time_sink_c_impl::set_color(int which, const std::string &color) + time_sink_c_impl::set_line_label(int which, const std::string &label) { - d_main_gui->setColor(which, color.c_str()); + d_main_gui->setLineLabel(which, label.c_str()); + } + + void + time_sink_c_impl::set_line_color(int which, const std::string &color) + { + d_main_gui->setLineColor(which, color.c_str()); } void @@ -188,18 +195,38 @@ namespace gr { d_size = newsize; d_index = 0; - d_main_gui->SetNPoints(d_size); + d_main_gui->setNPoints(d_size); } } void + time_sink_c_impl::set_samp_rate(const double samp_rate) + { + gruel::scoped_lock lock(d_mutex); + d_samp_rate = samp_rate; + d_main_gui->setSampleRate(d_samp_rate); + } + + void time_sink_c_impl::npoints_resize() { - int newsize = d_main_gui->GetNPoints(); + int newsize = d_main_gui->getNPoints(); set_nsamps(newsize); } int + time_sink_c_impl::nsamps() const + { + return d_size; + } + + void + time_sink_c_impl::reset() + { + d_index = 0; + } + + int time_sink_c_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) diff --git a/gr-qtgui/lib/time_sink_c_impl.h b/gr-qtgui/lib/time_sink_c_impl.h index 0cace14890..66980dd79e 100644 --- a/gr-qtgui/lib/time_sink_c_impl.h +++ b/gr-qtgui/lib/time_sink_c_impl.h @@ -39,7 +39,7 @@ namespace gr { gruel::mutex d_mutex; int d_size; - double d_bandwidth; + double d_samp_rate; std::string d_name; int d_nconnections; @@ -55,7 +55,7 @@ namespace gr { void npoints_resize(); public: - time_sink_c_impl(int size, double bw, + time_sink_c_impl(int size, double samp_rate, const std::string &name, int nconnections, QWidget *parent=NULL); @@ -65,17 +65,23 @@ namespace gr { QWidget* qwidget(); PyObject* pyqwidget(); - void set_time_domain_axis(double min, double max); + void set_y_axis(double min, double max); void set_update_time(double t); - void set_title(int which, const std::string &title); - void set_color(int which, const std::string &color); + void set_title(const std::string &title); + void set_line_label(int which, const std::string &label); + void set_line_color(int which, const std::string &color); void set_line_width(int which, int width); void set_line_style(int which, Qt::PenStyle style); void set_line_marker(int which, QwtSymbol::Style marker); void set_nsamps(const int size); + void set_samp_rate(const double samp_rate); void set_size(int width, int height); + int nsamps() const; + + void reset(); + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc index 4b965b648c..562da3ef86 100644 --- a/gr-qtgui/lib/time_sink_f_impl.cc +++ b/gr-qtgui/lib/time_sink_f_impl.cc @@ -34,23 +34,23 @@ namespace gr { namespace qtgui { time_sink_f::sptr - time_sink_f::make(int size, double bw, + time_sink_f::make(int size, double samp_rate, const std::string &name, int nconnections, QWidget *parent) { return gnuradio::get_initial_sptr - (new time_sink_f_impl(size, bw, name, nconnections, parent)); + (new time_sink_f_impl(size, samp_rate, name, nconnections, parent)); } - time_sink_f_impl::time_sink_f_impl(int size, double bw, + time_sink_f_impl::time_sink_f_impl(int size, double samp_rate, const std::string &name, int nconnections, QWidget *parent) : gr_sync_block("time_sink_f", gr_make_io_signature(nconnections, nconnections, sizeof(float)), gr_make_io_signature(0, 0, 0)), - d_size(size), d_bandwidth(bw), d_name(name), + d_size(size), d_samp_rate(samp_rate), d_name(name), d_nconnections(nconnections), d_parent(parent) { d_main_gui = NULL; @@ -91,7 +91,8 @@ namespace gr { } d_main_gui = new TimeDisplayForm(d_nconnections, d_parent); - d_main_gui->SetNPoints(d_size); + d_main_gui->setNPoints(d_size); + d_main_gui->setSampleRate(d_samp_rate); // initialize update time to 10 times a second set_update_time(0.1); @@ -119,9 +120,9 @@ namespace gr { } void - time_sink_f_impl::set_time_domain_axis(double min, double max) + time_sink_f_impl::set_y_axis(double min, double max) { - d_main_gui->setTimeDomainAxis(min, max); + d_main_gui->setYaxis(min, max); } void @@ -134,15 +135,21 @@ namespace gr { } void - time_sink_f_impl::set_title(int which, const std::string &title) + time_sink_f_impl::set_title(const std::string &title) { - d_main_gui->setTitle(which, title.c_str()); + d_main_gui->setTitle(title.c_str()); } void - time_sink_f_impl::set_color(int which, const std::string &color) + time_sink_f_impl::set_line_label(int which, const std::string &label) { - d_main_gui->setColor(which, color.c_str()); + d_main_gui->setLineLabel(which, label.c_str()); + } + + void + time_sink_f_impl::set_line_color(int which, const std::string &color) + { + d_main_gui->setLineColor(which, color.c_str()); } void @@ -188,17 +195,37 @@ namespace gr { d_size = newsize; d_index = 0; - d_main_gui->SetNPoints(d_size); + d_main_gui->setNPoints(d_size); } } void + time_sink_f_impl::set_samp_rate(const double samp_rate) + { + gruel::scoped_lock lock(d_mutex); + d_samp_rate = samp_rate; + d_main_gui->setSampleRate(d_samp_rate); + } + + int + time_sink_f_impl::nsamps() const + { + return d_size; + } + + void time_sink_f_impl::npoints_resize() { - int newsize = d_main_gui->GetNPoints(); + int newsize = d_main_gui->getNPoints(); set_nsamps(newsize); } + void + time_sink_f_impl::reset() + { + d_index = 0; + } + int time_sink_f_impl::work(int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-qtgui/lib/time_sink_f_impl.h b/gr-qtgui/lib/time_sink_f_impl.h index 69c07fbdab..dd1dd6f699 100644 --- a/gr-qtgui/lib/time_sink_f_impl.h +++ b/gr-qtgui/lib/time_sink_f_impl.h @@ -39,7 +39,7 @@ namespace gr { gruel::mutex d_mutex; int d_size; - double d_bandwidth; + double d_samp_rate; std::string d_name; int d_nconnections; @@ -55,7 +55,7 @@ namespace gr { void npoints_resize(); public: - time_sink_f_impl(int size, double bw, + time_sink_f_impl(int size, double samp_rate, const std::string &name, int nconnections, QWidget *parent=NULL); @@ -65,17 +65,23 @@ namespace gr { QWidget* qwidget(); PyObject* pyqwidget(); - void set_time_domain_axis(double min, double max); + void set_y_axis(double min, double max); void set_update_time(double t); - void set_title(int which, const std::string &title); - void set_color(int which, const std::string &color); + void set_title(const std::string &title); + void set_line_label(int which, const std::string &label); + void set_line_color(int which, const std::string &color); void set_line_width(int which, int width); void set_line_style(int which, Qt::PenStyle style); void set_line_marker(int which, QwtSymbol::Style marker); void set_nsamps(const int newsize); + void set_samp_rate(const double samp_rate); void set_size(int width, int height); + int nsamps() const; + + void reset(); + int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); diff --git a/gr-qtgui/lib/timedisplayform.cc b/gr-qtgui/lib/timedisplayform.cc index 3d94d20094..e3c7f8a60b 100644 --- a/gr-qtgui/lib/timedisplayform.cc +++ b/gr-qtgui/lib/timedisplayform.cc @@ -39,7 +39,7 @@ TimeDisplayForm::TimeDisplayForm(int nplots, QWidget* parent) NPointsMenu *nptsmenu = new NPointsMenu(this); _menu->addAction(nptsmenu); connect(nptsmenu, SIGNAL(whichTrigger(int)), - this, SLOT(SetNPoints(const int))); + this, SLOT(setNPoints(const int))); Reset(); @@ -82,41 +82,36 @@ TimeDisplayForm::customEvent(QEvent * e) } void -TimeDisplayForm::setFrequencyRange(const double newCenterFrequency, - const double newStartFrequency, - const double newStopFrequency) +TimeDisplayForm::setSampleRate(const double samprate) { - double fdiff = std::max(fabs(newStartFrequency), fabs(newStopFrequency)); - - if(fdiff > 0) { + if(samprate > 0) { std::string strtime[4] = {"sec", "ms", "us", "ns"}; - double units10 = floor(log10(fdiff)); + double units10 = floor(log10(samprate)); double units3 = std::max(floor(units10 / 3.0), 0.0); double units = pow(10, (units10-fmod(units10, 3.0))); int iunit = static_cast<int>(units3); - _startFrequency = newStartFrequency; - _stopFrequency = newStopFrequency; - - getPlot()->SetSampleRate(_stopFrequency - _startFrequency, - units, strtime[iunit]); + getPlot()->SetSampleRate(samprate, units, strtime[iunit]); + } + else { + throw std::runtime_error("TimeDisplayForm: samprate must be > 0.\n"); } } void -TimeDisplayForm::setTimeDomainAxis(double min, double max) +TimeDisplayForm::setYaxis(double min, double max) { getPlot()->setYaxis(min, max); } int -TimeDisplayForm::GetNPoints() const +TimeDisplayForm::getNPoints() const { return d_npoints; } void -TimeDisplayForm::SetNPoints(const int npoints) +TimeDisplayForm::setNPoints(const int npoints) { d_npoints = npoints; } diff --git a/gr-qtgui/lib/timedisplayform.h b/gr-qtgui/lib/timedisplayform.h index 806fc4053f..df8803c145 100644 --- a/gr-qtgui/lib/timedisplayform.h +++ b/gr-qtgui/lib/timedisplayform.h @@ -40,16 +40,14 @@ class TimeDisplayForm : public DisplayForm TimeDomainDisplayPlot* getPlot(); - int GetNPoints() const; + int getNPoints() const; public slots: void customEvent(QEvent * e); - void setFrequencyRange(const double newCenterFrequency, - const double newStartFrequency, - const double newStopFrequency); - void setTimeDomainAxis(double min, double max); - void SetNPoints(const int); + void setSampleRate(const double samprate); + void setYaxis(double min, double max); + void setNPoints(const int); private slots: void newData(const QEvent*); diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc b/gr-qtgui/lib/waterfall_sink_c_impl.cc index 0611d37974..7659394e77 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc @@ -191,13 +191,19 @@ namespace gr { void waterfall_sink_c_impl::set_title(const std::string &title) { - d_main_gui->setTitle(0, title.c_str()); + d_main_gui->setTitle(title.c_str()); } void - waterfall_sink_c_impl::set_color(const std::string &color) + waterfall_sink_c_impl::set_line_label(const std::string &label) { - d_main_gui->setColor(0, color.c_str()); + d_main_gui->setLineLabel(0, label.c_str()); + } + + void + waterfall_sink_c_impl::set_line_color(const std::string &color) + { + d_main_gui->setLineColor(0, color.c_str()); } void diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.h b/gr-qtgui/lib/waterfall_sink_c_impl.h index b51b1e66eb..ea9ae9736b 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.h +++ b/gr-qtgui/lib/waterfall_sink_c_impl.h @@ -88,7 +88,8 @@ namespace gr { void set_update_time(double t); void set_title(const std::string &title); - void set_color(const std::string &color); + void set_line_label(const std::string &label); + void set_line_color(const std::string &color); void set_line_width(int width); void set_line_style(Qt::PenStyle style); void set_line_marker(QwtSymbol::Style marker); diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc b/gr-qtgui/lib/waterfall_sink_f_impl.cc index 3fdb2b795a..0e8a4dd3da 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc @@ -191,13 +191,19 @@ namespace gr { void waterfall_sink_f_impl::set_title(const std::string &title) { - d_main_gui->setTitle(0, title.c_str()); + d_main_gui->setTitle(title.c_str()); } void - waterfall_sink_f_impl::set_color(const std::string &color) + waterfall_sink_f_impl::set_line_label(const std::string &label) { - d_main_gui->setColor(0, color.c_str()); + d_main_gui->setLineLabel(0, label.c_str()); + } + + void + waterfall_sink_f_impl::set_line_color(const std::string &color) + { + d_main_gui->setLineColor(0, color.c_str()); } void diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.h b/gr-qtgui/lib/waterfall_sink_f_impl.h index 684e1dfb03..f0c4badb60 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.h +++ b/gr-qtgui/lib/waterfall_sink_f_impl.h @@ -89,7 +89,8 @@ namespace gr { void set_update_time(double t); void set_title(const std::string &title); - void set_color(const std::string &color); + void set_line_label(const std::string &label); + void set_line_color(const std::string &color); void set_line_width(int width); void set_line_style(Qt::PenStyle style); void set_line_marker(QwtSymbol::Style marker); diff --git a/gr-qtgui/python/CMakeLists.txt b/gr-qtgui/python/CMakeLists.txt index e3fd602ef2..e57338073c 100644 --- a/gr-qtgui/python/CMakeLists.txt +++ b/gr-qtgui/python/CMakeLists.txt @@ -41,6 +41,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-qtgui/swig ) set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-qtgui) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-shd/CMakeLists.txt b/gr-shd/CMakeLists.txt index 7dad30cd80..0269abdec0 100644 --- a/gr-shd/CMakeLists.txt +++ b/gr-shd/CMakeLists.txt @@ -53,6 +53,7 @@ GR_REGISTER_COMPONENT("gr-shd" ENABLE_GR_SHD Boost_FOUND SHD_FOUND ENABLE_GR_CORE + ENABLE_GR_ANALOG ) GR_SET_GLOBAL(GR_SHD_INCLUDE_DIRS diff --git a/gr-shd/apps/shd_siggen b/gr-shd/apps/shd_siggen index 9629d80d29..ad44ef4a93 100755 --- a/gr-shd/apps/shd_siggen +++ b/gr-shd/apps/shd_siggen @@ -27,6 +27,7 @@ outputs single precision complex float values or complex short values """ from gnuradio import gr, eng_notation +from gnuradio import analog from gnuradio import shd from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -39,8 +40,9 @@ class shd_siggen(gr.top_block): def __init__(self, options): gr.top_block.__init__(self) - self._src = gr.sig_source_c(options.samp_rate, gr.GR_SIN_WAVE, - 200, 1) + self._src = analog.sig_source_c(options.samp_rate, + analog.GR_SIN_WAVE, + 200, 1) self._snk = shd.smini_sink(device_addr=options.address, io_type=shd.io_type.COMPLEX_FLOAT32, diff --git a/gr-trellis/doc/gr-trellis.xml b/gr-trellis/doc/gr-trellis.xml index 58aa74d409..314fb2e05f 100644 --- a/gr-trellis/doc/gr-trellis.xml +++ b/gr-trellis/doc/gr-trellis.xml @@ -598,7 +598,7 @@ r_k=(rk1,rk2,...,rkD). <programlisting> 22 # CHANNEL 23 add = gr.add_ff() - 24 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + 24 noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) </programlisting> @@ -815,7 +815,7 @@ The modulated symbols are filtered by the ISI channel and AWGN with appropriate 28 # CHANNEL 29 isi = gr.fir_filter_fff(1,channel) 30 add = gr.add_ff() - 31 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + 31 noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) </programlisting> diff --git a/gr-trellis/doc/test_tcm.py b/gr-trellis/doc/test_tcm.py index 3a285e27a2..181ba643d6 100644 --- a/gr-trellis/doc/test_tcm.py +++ b/gr-trellis/doc/test_tcm.py @@ -9,6 +9,12 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): tb = gr.top_block () @@ -21,7 +27,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi diff --git a/gr-trellis/doc/test_tcm.py.xml b/gr-trellis/doc/test_tcm.py.xml index a4c541e38a..4122fafff8 100644 --- a/gr-trellis/doc/test_tcm.py.xml +++ b/gr-trellis/doc/test_tcm.py.xml @@ -4,7 +4,7 @@ 2 3 from gnuradio import gr 4 from gnuradio import audio - 5 from gnuradio import trellis + 5 from gnuradio import trellis, digital, analog 6 from gnuradio import eng_notation 7 import math 8 import sys @@ -23,7 +23,7 @@ 21 22 # CHANNEL 23 add = gr.add_ff() - 24 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + 24 noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) 25 26 # RX 27 metrics = trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi diff --git a/gr-trellis/doc/test_viterbi_equalization1.py b/gr-trellis/doc/test_viterbi_equalization1.py index c9c897fe2e..cac96df117 100755 --- a/gr-trellis/doc/test_viterbi_equalization1.py +++ b/gr-trellis/doc/test_viterbi_equalization1.py @@ -9,6 +9,12 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed): tb = gr.top_block () L = len(channel) @@ -28,7 +34,7 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel # CHANNEL isi = gr.fir_filter_fff(1,channel) add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols diff --git a/gr-trellis/doc/test_viterbi_equalization1.py.xml b/gr-trellis/doc/test_viterbi_equalization1.py.xml index 751633a618..e1f2aeefcb 100644 --- a/gr-trellis/doc/test_viterbi_equalization1.py.xml +++ b/gr-trellis/doc/test_viterbi_equalization1.py.xml @@ -4,7 +4,7 @@ 2 3 from gnuradio import gr 4 from gnuradio import audio - 5 from gnuradio import trellis + 5 from gnuradio import trellis, digital, analog 6 from gnuradio import eng_notation 7 import math 8 import sys @@ -30,7 +30,7 @@ 28 # CHANNEL 29 isi = gr.fir_filter_fff(1,channel) 30 add = gr.add_ff() - 31 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + 31 noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) 32 33 # RX 34 skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols diff --git a/gr-trellis/src/examples/grc/interference_cancellation.grc b/gr-trellis/src/examples/grc/interference_cancellation.grc index 7674b4bf16..129ee87905 100644 --- a/gr-trellis/src/examples/grc/interference_cancellation.grc +++ b/gr-trellis/src/examples/grc/interference_cancellation.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Wed Aug 31 17:40:25 2011</timestamp> + <timestamp>Sat Nov 10 15:39:57 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -229,37 +233,6 @@ </param> </block> <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>alpha**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(988, 196)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>random_source_x</key> <param> <key>id</key> @@ -299,142 +272,6 @@ </param> </block> <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(660, 311)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>(1-alpha)**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(994, 319)</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</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1224, 244)</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>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(1146, 369)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>gr_sub_xx</key> <param> <key>id</key> @@ -507,6 +344,14 @@ <value>True</value> </param> <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(994, 545)</value> </param> @@ -588,78 +433,16 @@ <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(1005, 798)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> + <key>vlen</key> <value>1</value> </param> <param> - <key>_coordinate</key> - <value>(405, 998)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>alpha**0.5</value> - </param> - <param> - <key>vlen</key> + <key>scale</key> <value>1</value> </param> <param> <key>_coordinate</key> - <value>(710, 1008)</value> + <value>(1005, 798)</value> </param> <param> <key>_rotation</key> @@ -770,78 +553,16 @@ <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(1009, 1156)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> + <key>vlen</key> <value>1</value> </param> <param> - <key>num_ports</key> + <key>scale</key> <value>1</value> </param> <param> <key>_coordinate</key> - <value>(420, 1368)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>(1-alpha)**0.5</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(733, 1374)</value> + <value>(1009, 1156)</value> </param> <param> <key>_rotation</key> @@ -952,39 +673,16 @@ <value>True</value> </param> <param> - <key>_coordinate</key> - <value>(1010, 1551)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>init_state</key> - <value>0</value> + <key>scale</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(336, 311)</value> + <value>(1010, 1551)</value> </param> <param> <key>_rotation</key> @@ -1035,7 +733,7 @@ </param> <param> <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <value>digital.TRELLIS_EUCLIDEAN</value> </param> <param> <key>_coordinate</key> @@ -1090,7 +788,7 @@ </param> <param> <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <value>digital.TRELLIS_EUCLIDEAN</value> </param> <param> <key>_coordinate</key> @@ -1102,37 +800,6 @@ </param> </block> <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(89, 998)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>trellis_viterbi_combined_xx</key> <param> <key>id</key> @@ -1176,7 +843,7 @@ </param> <param> <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <value>digital.TRELLIS_EUCLIDEAN</value> </param> <param> <key>_coordinate</key> @@ -1188,37 +855,6 @@ </param> </block> <block> - <key>trellis_encoder_xx</key> - <param> - <key>id</key> - <value>trellis_encoder_xx_2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ss</value> - </param> - <param> - <key>fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> - </param> - <param> - <key>init_state</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(105, 1367)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>trellis_viterbi_combined_xx</key> <param> <key>id</key> @@ -1262,7 +898,7 @@ </param> <param> <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <value>digital.TRELLIS_EUCLIDEAN</value> </param> <param> <key>_coordinate</key> @@ -1274,37 +910,6 @@ </param> </block> <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(1400, 262)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>wxgui_scopesink2</key> <param> <key>id</key> @@ -1434,76 +1039,6 @@ </param> </block> <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(534, 149)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,1j,-1j,-1</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(682, 186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>variable</key> <param> <key>id</key> @@ -1874,6 +1409,507 @@ <value>0</value> </param> </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(1400, 262)</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</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(1224, 245)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>analog_noise_source_x</key> + <param> + <key>id</key> + <value>analog_noise_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noisevar</value> + </param> + <param> + <key>seed</key> + <value>-42</value> + </param> + <param> + <key>_coordinate</key> + <value>(1178, 321)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>samples_per_second</key> + <value>R</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(579, 143)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_const_vxx</key> + <param> + <key>id</key> + <value>gr_multiply_const_vxx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>const</key> + <value>alpha**0.5</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(988, 196)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>digital_chunks_to_symbols_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>complex</value> + </param> + <param> + <key>symbol_table</key> + <value>1,1j,-1j,-1</value> + </param> + <param> + <key>dimension</key> + <value>1</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(703, 211)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_const_vxx</key> + <param> + <key>id</key> + <value>gr_multiply_const_vxx_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>const</key> + <value>(1-alpha)**0.5</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(994, 319)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_encoder_xx</key> + <param> + <key>id</key> + <value>trellis_encoder_xx_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>ss</value> + </param> + <param> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + </param> + <param> + <key>init_state</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(336, 311)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>digital_chunks_to_symbols_xx_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>complex</value> + </param> + <param> + <key>symbol_table</key> + <value>1,1j,-1j,-1</value> + </param> + <param> + <key>dimension</key> + <value>1</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(703, 311)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>digital_chunks_to_symbols_xx_0_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>complex</value> + </param> + <param> + <key>symbol_table</key> + <value>1,1j,-1j,-1</value> + </param> + <param> + <key>dimension</key> + <value>1</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(418, 1000)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_const_vxx</key> + <param> + <key>id</key> + <value>gr_multiply_const_vxx_2</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>const</key> + <value>alpha**0.5</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(710, 1008)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_encoder_xx</key> + <param> + <key>id</key> + <value>trellis_encoder_xx_2</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>ss</value> + </param> + <param> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + </param> + <param> + <key>init_state</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(89, 1000)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_const_vxx</key> + <param> + <key>id</key> + <value>gr_multiply_const_vxx_2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>const</key> + <value>(1-alpha)**0.5</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(733, 1374)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>trellis_encoder_xx</key> + <param> + <key>id</key> + <value>trellis_encoder_xx_2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>ss</value> + </param> + <param> + <key>fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm"</value> + </param> + <param> + <key>init_state</key> + <value>0</value> + </param> + <param> + <key>_coordinate</key> + <value>(103, 1366)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>digital_chunks_to_symbols_xx_0_0_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>complex</value> + </param> + <param> + <key>symbol_table</key> + <value>1,1j,-1j,-1</value> + </param> + <param> + <key>dimension</key> + <value>1</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(420, 1366)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <connection> <source_block_id>random_source_x_1</source_block_id> <sink_block_id>trellis_encoder_xx_1</sink_block_id> @@ -1881,18 +1917,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>trellis_encoder_xx_1</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_multiply_const_vxx_0</source_block_id> <sink_block_id>gr_add_xx_0</sink_block_id> <source_key>0</source_key> @@ -1905,18 +1929,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_1</source_block_id> - <sink_block_id>gr_multiply_const_vxx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_multiply_const_vxx_1</source_block_id> <sink_block_id>gr_add_xx_0</sink_block_id> <source_key>0</source_key> @@ -2013,18 +2025,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>trellis_encoder_xx_2</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_2</source_block_id> - <sink_block_id>gr_multiply_const_vxx_2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_multiply_const_vxx_2</source_block_id> <sink_block_id>gr_sub_xx_2</sink_block_id> <source_key>0</source_key> @@ -2085,18 +2085,6 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>trellis_encoder_xx_2_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_2_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>trellis_viterbi_combined_xx_2</source_block_id> <sink_block_id>trellis_encoder_xx_2_0</sink_block_id> <source_key>0</source_key> @@ -2169,8 +2157,56 @@ <sink_key>0</sink_key> </connection> <connection> + <source_block_id>analog_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> + <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_chunks_to_symbols_xx_0_0</source_block_id> + <sink_block_id>gr_multiply_const_vxx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_encoder_xx_1</source_block_id> + <sink_block_id>digital_chunks_to_symbols_xx_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_encoder_xx_2</source_block_id> + <sink_block_id>digital_chunks_to_symbols_xx_0_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_chunks_to_symbols_xx_0_0_0</source_block_id> + <sink_block_id>gr_multiply_const_vxx_2</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>trellis_encoder_xx_2_0</source_block_id> + <sink_block_id>digital_chunks_to_symbols_xx_0_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_chunks_to_symbols_xx_0_0_1</source_block_id> + <sink_block_id>gr_multiply_const_vxx_2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-trellis/src/examples/grc/pccc.grc b/gr-trellis/src/examples/grc/pccc.grc index c3111c3211..06fa9cd69f 100644 --- a/gr-trellis/src/examples/grc/pccc.grc +++ b/gr-trellis/src/examples/grc/pccc.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Sep 1 12:53:13 2011</timestamp> + <timestamp>Sat Nov 10 15:37:00 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -222,6 +226,14 @@ <value>True</value> </param> <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(535, 609)</value> </param> @@ -318,41 +330,6 @@ </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>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>wxgui_scopesink2</key> <param> <key>id</key> @@ -467,10 +444,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>trellis_pccc_encoder_xx</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>trellis_pccc_encoder_xx_0</value> </param> <param> <key>_enabled</key> @@ -478,58 +455,58 @@ </param> <param> <key>type</key> - <value>short</value> + <value>ss</value> </param> <param> - <key>samples_per_second</key> - <value>R</value> + <key>o_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>o_init_state</key> + <value>0</value> </param> <param> - <key>_coordinate</key> - <value>(517, 103)</value> + <key>i_fsm_args</key> + <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> </param> <param> - <key>_rotation</key> + <key>i_init_state</key> <value>0</value> </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> + <key>interleaver_args</key> + <value>trellis.interleaver(block,666)</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>bl</key> + <value>block</value> </param> <param> - <key>in_type</key> - <value>short</value> + <key>_coordinate</key> + <value>(236, 147)</value> </param> <param> - <key>out_type</key> - <value>float</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>variable</key> <param> - <key>symbol_table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> + <key>id</key> + <value>R</value> </param> <param> - <key>dimension</key> - <value>2</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>num_ports</key> - <value>1</value> + <key>value</key> + <value>100e3</value> </param> <param> <key>_coordinate</key> - <value>(551, 184)</value> + <value>(482, 17)</value> </param> <param> <key>_rotation</key> @@ -537,10 +514,10 @@ </param> </block> <block> - <key>trellis_pccc_encoder_xx</key> + <key>trellis_pccc_decoder_combined_xx</key> <param> <key>id</key> - <value>trellis_pccc_encoder_xx_0</value> + <value>trellis_pccc_decoder_combined_xx_0</value> </param> <param> <key>_enabled</key> @@ -548,7 +525,11 @@ </param> <param> <key>type</key> - <value>ss</value> + <value>f</value> + </param> + <param> + <key>out_type</key> + <value>s</value> </param> <param> <key>o_fsm_args</key> @@ -559,6 +540,10 @@ <value>0</value> </param> <param> + <key>o_final_state</key> + <value>-1</value> + </param> + <param> <key>i_fsm_args</key> <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> </param> @@ -567,16 +552,44 @@ <value>0</value> </param> <param> - <key>interleaver_args</key> + <key>i_final_state</key> + <value>-1</value> + </param> + <param> + <key>interleaver</key> <value>trellis.interleaver(block,666)</value> </param> <param> - <key>bl</key> + <key>block_size</key> <value>block</value> </param> <param> + <key>iterations</key> + <value>10</value> + </param> + <param> + <key>dim</key> + <value>2</value> + </param> + <param> + <key>table</key> + <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> + </param> + <param> + <key>metric_type</key> + <value>digital.TRELLIS_EUCLIDEAN</value> + </param> + <param> + <key>siso_type</key> + <value>trellis.TRELLIS_MIN_SUM</value> + </param> + <param> + <key>scaling</key> + <value>1.0</value> + </param> + <param> <key>_coordinate</key> - <value>(236, 147)</value> + <value>(196, 274)</value> </param> <param> <key>_rotation</key> @@ -584,22 +597,30 @@ </param> </block> <block> - <key>variable</key> + <key>gr_sub_xx</key> <param> <key>id</key> - <value>R</value> + <value>gr_sub_xx_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>100e3</value> + <key>type</key> + <value>short</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> </param> <param> <key>_coordinate</key> - <value>(482, 17)</value> + <value>(217, 597)</value> </param> <param> <key>_rotation</key> @@ -607,10 +628,10 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>analog_noise_source_x</key> <param> <key>id</key> - <value>gr_add_xx_1</value> + <value>analog_noise_source_x_0</value> </param> <param> <key>_enabled</key> @@ -621,16 +642,20 @@ <value>float</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>amp</key> + <value>noisevar</value> + </param> + <param> + <key>seed</key> + <value>-42</value> </param> <param> <key>_coordinate</key> - <value>(951, 256)</value> + <value>(584, 259)</value> </param> <param> <key>_rotation</key> @@ -638,10 +663,10 @@ </param> </block> <block> - <key>trellis_pccc_decoder_combined_xx</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>trellis_pccc_decoder_combined_xx_0</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> @@ -649,71 +674,58 @@ </param> <param> <key>type</key> - <value>f</value> - </param> - <param> - <key>out_type</key> - <value>s</value> - </param> - <param> - <key>o_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + <value>short</value> </param> <param> - <key>o_init_state</key> - <value>0</value> + <key>samples_per_second</key> + <value>R</value> </param> <param> - <key>o_final_state</key> - <value>-1</value> + <key>vlen</key> + <value>1</value> </param> <param> - <key>i_fsm_args</key> - <value>prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_4.fsm"</value> + <key>_coordinate</key> + <value>(517, 103)</value> </param> <param> - <key>i_init_state</key> + <key>_rotation</key> <value>0</value> </param> + </block> + <block> + <key>digital_chunks_to_symbols_xx</key> <param> - <key>i_final_state</key> - <value>-1</value> - </param> - <param> - <key>interleaver</key> - <value>trellis.interleaver(block,666)</value> - </param> - <param> - <key>block_size</key> - <value>block</value> + <key>id</key> + <value>digital_chunks_to_symbols_xx_0</value> </param> <param> - <key>iterations</key> - <value>10</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>dim</key> - <value>2</value> + <key>in_type</key> + <value>short</value> </param> <param> - <key>table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> + <key>out_type</key> + <value>float</value> </param> <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <key>symbol_table</key> + <value>-7,0,-5,0,-3,0,-1,0,1,0,3,0,5,0,7,0,-7,0,-5,0,-3,0,-1,0,1,0,3,0,5,0,7</value> </param> <param> - <key>siso_type</key> - <value>trellis.TRELLIS_MIN_SUM</value> + <key>dimension</key> + <value>2</value> </param> <param> - <key>scaling</key> - <value>1.0</value> + <key>num_ports</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(196, 274)</value> + <value>(559, 180)</value> </param> <param> <key>_rotation</key> @@ -721,10 +733,10 @@ </param> </block> <block> - <key>gr_sub_xx</key> + <key>gr_add_xx</key> <param> <key>id</key> - <value>gr_sub_xx_0</value> + <value>gr_add_xx_1</value> </param> <param> <key>_enabled</key> @@ -732,19 +744,19 @@ </param> <param> <key>type</key> - <value>short</value> - </param> - <param> - <key>vlen</key> - <value>1</value> + <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>(217, 597)</value> + <value>(951, 256)</value> </param> <param> <key>_rotation</key> @@ -758,30 +770,12 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_add_xx_1</source_block_id> <sink_block_id>wxgui_scopesink2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_multiply_xx_2_0</source_block_id> <sink_block_id>gr_short_to_float_1_0</sink_block_id> <source_key>0</source_key> @@ -829,4 +823,22 @@ <source_key>0</source_key> <sink_key>1</sink_key> </connection> + <connection> + <source_block_id>analog_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> diff --git a/gr-trellis/src/examples/grc/pccc1.grc b/gr-trellis/src/examples/grc/pccc1.grc index 15a63707ee..c111ebd3ec 100644 --- a/gr-trellis/src/examples/grc/pccc1.grc +++ b/gr-trellis/src/examples/grc/pccc1.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Wed Aug 31 20:34:39 2011</timestamp> + <timestamp>Sat Nov 10 15:36:08 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -222,6 +226,14 @@ <value>True</value> </param> <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(535, 609)</value> </param> @@ -318,72 +330,6 @@ </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>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</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_1</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>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>wxgui_scopesink2</key> <param> <key>id</key> @@ -498,37 +444,6 @@ </param> </block> <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(517, 103)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>gr_sub_xx</key> <param> <key>id</key> @@ -560,45 +475,6 @@ </param> </block> <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>float</value> - </param> - <param> - <key>symbol_table</key> - <value>-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7,0, 0,-7,0, -5,0, -3,0, -1,0, 1,0, 3,0, 5,0, 7</value> - </param> - <param> - <key>dimension</key> - <value>2</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>trellis_pccc_encoder_xx</key> <param> <key>id</key> @@ -736,7 +612,7 @@ </param> <param> <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <value>digital.TRELLIS_EUCLIDEAN</value> </param> <param> <key>_coordinate</key> @@ -770,6 +646,142 @@ <value>0</value> </param> </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>samples_per_second</key> + <value>R</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(517, 103)</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_1</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>(951, 256)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>digital_chunks_to_symbols_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>float</value> + </param> + <param> + <key>symbol_table</key> + <value>-7,0,-5,0,-3,0,-1,0,1,0,3,0,5,0,7,0,-7,0,-5,0,-3,0,-1,0,1,0,3,0,5,0,7</value> + </param> + <param> + <key>dimension</key> + <value>2</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(552, 178)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>analog_noise_source_x</key> + <param> + <key>id</key> + <value>analog_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>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noisevar</value> + </param> + <param> + <key>seed</key> + <value>-42</value> + </param> + <param> + <key>_coordinate</key> + <value>(622, 257)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <connection> <source_block_id>random_source_x_0</source_block_id> <sink_block_id>gr_sub_xx_0</sink_block_id> @@ -777,30 +789,12 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_add_xx_1</source_block_id> <sink_block_id>wxgui_scopesink2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_multiply_xx_2_0</source_block_id> <sink_block_id>gr_short_to_float_1_0</sink_block_id> <source_key>0</source_key> @@ -854,4 +848,22 @@ <source_key>0</source_key> <sink_key>1</sink_key> </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> </flow_graph> diff --git a/gr-trellis/src/examples/grc/sccc.grc b/gr-trellis/src/examples/grc/sccc.grc index e8f656f637..36657f5441 100644 --- a/gr-trellis/src/examples/grc/sccc.grc +++ b/gr-trellis/src/examples/grc/sccc.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Wed Aug 31 19:57:09 2011</timestamp> + <timestamp>Sat Nov 10 15:34:26 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -165,37 +169,6 @@ </param> </block> <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(951, 256)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>gr_sub_xx</key> <param> <key>id</key> @@ -268,6 +241,14 @@ <value>True</value> </param> <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(416, 815)</value> </param> @@ -430,111 +411,6 @@ </param> </block> <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>short</value> - </param> - <param> - <key>samples_per_second</key> - <value>R</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(514, 105)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>1,0,1j,0,-1j,0,-1,0, 0,1,0,1j,0,-1j,0,-1</value> - </param> - <param> - <key>dimension</key> - <value>2</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(551, 184)</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>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>noisevar</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(672, 290)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>trellis_sccc_encoder_xx</key> <param> <key>id</key> @@ -732,7 +608,7 @@ </param> <param> <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <value>digital.TRELLIS_EUCLIDEAN</value> </param> <param> <key>siso_type</key> @@ -751,6 +627,142 @@ <value>0</value> </param> </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>short</value> + </param> + <param> + <key>samples_per_second</key> + <value>R</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(514, 105)</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_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(951, 256)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>digital_chunks_to_symbols_xx</key> + <param> + <key>id</key> + <value>digital_chunks_to_symbols_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>in_type</key> + <value>short</value> + </param> + <param> + <key>out_type</key> + <value>complex</value> + </param> + <param> + <key>symbol_table</key> + <value>1,0,1j,0,-1j,0,-1,0,0,1,0,1j,0,-1j,0,01</value> + </param> + <param> + <key>dimension</key> + <value>2</value> + </param> + <param> + <key>num_ports</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(551, 181)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>analog_noise_source_x</key> + <param> + <key>id</key> + <value>analog_noise_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noisevar</value> + </param> + <param> + <key>seed</key> + <value>-42</value> + </param> + <param> + <key>_coordinate</key> + <value>(651, 270)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <connection> <source_block_id>random_source_x_0</source_block_id> <sink_block_id>gr_sub_xx_0</sink_block_id> @@ -758,30 +770,12 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_add_xx_1</source_block_id> <sink_block_id>wxgui_scopesink2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>random_source_x_0</source_block_id> <sink_block_id>trellis_sccc_encoder_xx_0</sink_block_id> <source_key>0</source_key> @@ -829,4 +823,22 @@ <source_key>0</source_key> <sink_key>1</sink_key> </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>digital_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> </flow_graph> diff --git a/gr-trellis/src/examples/grc/sccc1.grc b/gr-trellis/src/examples/grc/sccc1.grc index 0be59d0c47..17626e3dce 100644 --- a/gr-trellis/src/examples/grc/sccc1.grc +++ b/gr-trellis/src/examples/grc/sccc1.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Wed Aug 31 20:09:23 2011</timestamp> + <timestamp>Sat Nov 10 15:41:10 2012</timestamp> <block> <key>options</key> <param> @@ -44,6 +44,10 @@ <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -425,6 +429,14 @@ <value>True</value> </param> <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>scale</key> + <value>1</value> + </param> + <param> <key>_coordinate</key> <value>(535, 609)</value> </param> @@ -521,10 +533,10 @@ </param> </block> <block> - <key>gr_noise_source_x</key> + <key>trellis_metrics_x</key> <param> <key>id</key> - <value>gr_noise_source_x_0</value> + <value>trellis_metrics_x_0</value> </param> <param> <key>_enabled</key> @@ -532,23 +544,27 @@ </param> <param> <key>type</key> - <value>float</value> + <value>f</value> </param> <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> + <key>card</key> + <value>8</value> </param> <param> - <key>amp</key> - <value>noisevar</value> + <key>dim</key> + <value>1</value> </param> <param> - <key>seed</key> - <value>42</value> + <key>table</key> + <value>-7, -5, -3, -1, 1, 3, 5, 7</value> + </param> + <param> + <key>metric_type</key> + <value>digital.TRELLIS_EUCLIDEAN</value> </param> <param> <key>_coordinate</key> - <value>(672, 290)</value> + <value>(58, 354)</value> </param> <param> <key>_rotation</key> @@ -556,69 +572,74 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>wxgui_scopesink2</key> <param> <key>id</key> - <value>gr_add_xx_1</value> + <value>wxgui_scopesink2_0</value> </param> <param> <key>_enabled</key> - <value>True</value> + <value>False</value> </param> <param> <key>type</key> <value>float</value> </param> <param> - <key>num_inputs</key> - <value>2</value> + <key>title</key> + <value>Scope Plot</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>samp_rate</key> + <value>R</value> </param> <param> - <key>_coordinate</key> - <value>(951, 256)</value> + <key>v_scale</key> + <value>0</value> </param> <param> - <key>_rotation</key> + <key>v_offset</key> <value>0</value> </param> - </block> - <block> - <key>trellis_metrics_x</key> <param> - <key>id</key> - <value>trellis_metrics_x_0</value> + <key>t_scale</key> + <value>0</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>ac_couple</key> + <value>False</value> </param> <param> - <key>type</key> - <value>f</value> + <key>xy_mode</key> + <value>False</value> </param> <param> - <key>card</key> - <value>8</value> + <key>num_inputs</key> + <value>1</value> </param> <param> - <key>dim</key> - <value>1</value> + <key>win_size</key> + <value></value> </param> <param> - <key>table</key> - <value>-7, -5, -3, -1, 1, 3, 5, 7</value> + <key>grid_pos</key> + <value></value> </param> <param> - <key>metric_type</key> - <value>trellis.TRELLIS_EUCLIDEAN</value> + <key>notebook</key> + <value></value> + </param> + <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> </param> <param> <key>_coordinate</key> - <value>(58, 354)</value> + <value>(952, 73)</value> </param> <param> <key>_rotation</key> @@ -657,74 +678,69 @@ </param> </block> <block> - <key>wxgui_scopesink2</key> + <key>digital_chunks_to_symbols_xx</key> <param> <key>id</key> - <value>wxgui_scopesink2_0</value> + <value>digital_chunks_to_symbols_xx_0</value> </param> <param> <key>_enabled</key> - <value>False</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> + <value>True</value> </param> <param> - <key>samp_rate</key> - <value>R</value> + <key>in_type</key> + <value>short</value> </param> <param> - <key>v_scale</key> - <value>0</value> + <key>out_type</key> + <value>float</value> </param> <param> - <key>v_offset</key> - <value>0</value> + <key>symbol_table</key> + <value>-7,-5,-3,-1,1,3,5,7</value> </param> <param> - <key>t_scale</key> - <value>0</value> + <key>dimension</key> + <value>1</value> </param> <param> - <key>ac_couple</key> - <value>False</value> + <key>num_ports</key> + <value>1</value> </param> <param> - <key>xy_mode</key> - <value>False</value> + <key>_coordinate</key> + <value>(607, 175)</value> </param> <param> - <key>num_inputs</key> - <value>1</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>gr_add_xx</key> <param> - <key>win_size</key> - <value></value> + <key>id</key> + <value>gr_add_xx_1</value> </param> <param> - <key>grid_pos</key> - <value></value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>notebook</key> - <value></value> + <key>type</key> + <value>float</value> </param> <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> + <key>num_inputs</key> + <value>2</value> </param> <param> - <key>y_axis_label</key> - <value>Counts</value> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(952, 73)</value> + <value>(951, 256)</value> </param> <param> <key>_rotation</key> @@ -732,38 +748,34 @@ </param> </block> <block> - <key>gr_chunks_to_symbols_xx</key> + <key>analog_noise_source_x</key> <param> <key>id</key> - <value>gr_chunks_to_symbols_xx_0</value> + <value>analog_noise_source_x_0</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>in_type</key> - <value>short</value> - </param> - <param> - <key>out_type</key> + <key>type</key> <value>float</value> </param> <param> - <key>symbol_table</key> - <value>-7, -5, -3, -1, 1, 3, 5, 7</value> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> </param> <param> - <key>dimension</key> - <value>1</value> + <key>amp</key> + <value>noisevar</value> </param> <param> - <key>num_ports</key> - <value>1</value> + <key>seed</key> + <value>-42</value> </param> <param> <key>_coordinate</key> - <value>(551, 184)</value> + <value>(632, 254)</value> </param> <param> <key>_rotation</key> @@ -777,30 +789,12 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_add_xx_1</source_block_id> <sink_block_id>wxgui_scopesink2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_noise_source_x_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx_0</source_block_id> - <sink_block_id>gr_add_xx_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>random_source_x_0</source_block_id> <sink_block_id>trellis_sccc_encoder_xx_0</sink_block_id> <source_key>0</source_key> @@ -854,4 +848,22 @@ <source_key>0</source_key> <sink_key>1</sink_key> </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>digital_chunks_to_symbols_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>digital_chunks_to_symbols_xx_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>analog_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> </flow_graph> diff --git a/gr-trellis/src/examples/python/test_cpm.py b/gr-trellis/src/examples/python/test_cpm.py index 7e80d400be..6b9b9a4f52 100755 --- a/gr-trellis/src/examples/python/test_cpm.py +++ b/gr-trellis/src/examples/python/test_cpm.py @@ -9,7 +9,6 @@ from gnuradio import gr from gnuradio import trellis, digital, filter -from gnuradio.gr import firdes from grc_gnuradio import blks2 as grc_blks2 import math import numpy @@ -17,6 +16,12 @@ import fsm_utils from gnuradio import trellis try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + +try: import scipy.stats except ImportError: print "Error: Program requires scipy (see: www.scipy.org)." @@ -91,13 +96,13 @@ def run_test(seed,blocksize): random_source_x_0 = gr.vector_source_b(data.tolist(), False) digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf((-1, 1), 1) gr_interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(Q, p) - gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*h*(1.0/Q)) + gr_frequency_modulator_fc_0 = analog.frequency_modulator_fc(2*math.pi*h*(1.0/Q)) gr_add_vxx_0 = gr.add_vcc(1) - gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, (N0/2.0)**0.5, -long(seed)) + gr_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, (N0/2.0)**0.5, -long(seed)) gr_multiply_vxx_0 = gr.multiply_vcc(1) - gr_sig_source_x_0 = gr.sig_source_c(Q, gr.GR_COS_WAVE, -f0T, 1, 0) + gr_sig_source_x_0 = analog.sig_source_c(Q, analog.GR_COS_WAVE, -f0T, 1, 0) # only works for N=2, do it manually for N>2... gr_fir_filter_xxx_0_0 = filter.fir_filter_ccc(Q, MF[0].conjugate()) gr_fir_filter_xxx_0_0_0 = filter.fir_filter_ccc(Q, MF[1].conjugate()) diff --git a/gr-trellis/src/examples/python/test_pccc_turbo1.py b/gr-trellis/src/examples/python/test_pccc_turbo1.py index abc0e1d01f..bbcce106fb 100755 --- a/gr-trellis/src/examples/python/test_pccc_turbo1.py +++ b/gr-trellis/src/examples/python/test_pccc_turbo1.py @@ -8,6 +8,11 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): tb = gr.top_block () @@ -24,7 +29,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX metrics_in = trellis.metrics_f(fi.O()*fo.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO diff --git a/gr-trellis/src/examples/python/test_sccc_hard.py b/gr-trellis/src/examples/python/test_sccc_hard.py index 397ebf0871..b75a07b8b0 100755 --- a/gr-trellis/src/examples/python/test_sccc_hard.py +++ b/gr-trellis/src/examples/python/test_sccc_hard.py @@ -8,6 +8,12 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): tb = gr.top_block () @@ -23,7 +29,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi diff --git a/gr-trellis/src/examples/python/test_sccc_soft.py b/gr-trellis/src/examples/python/test_sccc_soft.py index b1ffaae748..0b10c07bbc 100755 --- a/gr-trellis/src/examples/python/test_sccc_soft.py +++ b/gr-trellis/src/examples/python/test_sccc_soft.py @@ -8,8 +8,11 @@ import sys import random import fsm_utils - - +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): tb = gr.top_block () @@ -26,7 +29,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi diff --git a/gr-trellis/src/examples/python/test_sccc_turbo.py b/gr-trellis/src/examples/python/test_sccc_turbo.py index e8054a08b2..979dfeca59 100755 --- a/gr-trellis/src/examples/python/test_sccc_turbo.py +++ b/gr-trellis/src/examples/python/test_sccc_turbo.py @@ -8,7 +8,11 @@ import sys import random import fsm_utils - +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,type): metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner Viterbi @@ -65,7 +69,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX (head,tail) = make_rx(tb,fo,fi,dimensionality,constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) diff --git a/gr-trellis/src/examples/python/test_sccc_turbo1.py b/gr-trellis/src/examples/python/test_sccc_turbo1.py index ef5d32f588..60188e4d3b 100755 --- a/gr-trellis/src/examples/python/test_sccc_turbo1.py +++ b/gr-trellis/src/examples/python/test_sccc_turbo1.py @@ -8,6 +8,11 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): tb = gr.top_block () @@ -21,7 +26,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX dec = trellis.sccc_decoder_combined_fs(fo,0,-1,fi,0,-1,interleaver,K,IT,trellis.TRELLIS_MIN_SUM,dimensionality,constellation,digital.TRELLIS_EUCLIDEAN,1.0) diff --git a/gr-trellis/src/examples/python/test_sccc_turbo2.py b/gr-trellis/src/examples/python/test_sccc_turbo2.py index 942572676d..e9f4841e3e 100755 --- a/gr-trellis/src/examples/python/test_sccc_turbo2.py +++ b/gr-trellis/src/examples/python/test_sccc_turbo2.py @@ -8,6 +8,11 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation,Es,N0,IT,seed): tb = gr.top_block () @@ -21,7 +26,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX metrics_in = trellis.metrics_f(fi.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO diff --git a/gr-trellis/src/examples/python/test_tcm.py b/gr-trellis/src/examples/python/test_tcm.py index eff93f5b4e..fced315260 100755 --- a/gr-trellis/src/examples/python/test_tcm.py +++ b/gr-trellis/src/examples/python/test_tcm.py @@ -10,6 +10,12 @@ import fsm_utils from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): tb = gr.top_block () @@ -28,7 +34,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi diff --git a/gr-trellis/src/examples/python/test_tcm_bit.py b/gr-trellis/src/examples/python/test_tcm_bit.py index 1a89d06a89..873d58684b 100755 --- a/gr-trellis/src/examples/python/test_tcm_bit.py +++ b/gr-trellis/src/examples/python/test_tcm_bit.py @@ -10,6 +10,11 @@ import fsm_utils from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): tb = gr.top_block () @@ -30,7 +35,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX diff --git a/gr-trellis/src/examples/python/test_tcm_combined.py b/gr-trellis/src/examples/python/test_tcm_combined.py index a46444e32b..8bea1ac86a 100755 --- a/gr-trellis/src/examples/python/test_tcm_combined.py +++ b/gr-trellis/src/examples/python/test_tcm_combined.py @@ -9,6 +9,11 @@ import fsm_utils from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): tb = gr.top_block () @@ -23,7 +28,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX diff --git a/gr-trellis/src/examples/python/test_tcm_parallel.py b/gr-trellis/src/examples/python/test_tcm_parallel.py index 72fb8cf3bf..1767cc730f 100755 --- a/gr-trellis/src/examples/python/test_tcm_parallel.py +++ b/gr-trellis/src/examples/python/test_tcm_parallel.py @@ -9,6 +9,11 @@ import fsm_utils from gnuradio.eng_option import eng_option from optparse import OptionParser +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P): tb = gr.top_block () @@ -26,7 +31,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P): noise=[] for i in range(P): add.append(gr.add_ff()) - noise.append(gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)) + noise.append(analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed)) # RX metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi diff --git a/gr-trellis/src/examples/python/test_turbo_equalization.py b/gr-trellis/src/examples/python/test_turbo_equalization.py index d97f3f2c29..baddd7cb50 100755 --- a/gr-trellis/src/examples/python/test_turbo_equalization.py +++ b/gr-trellis/src/examples/python/test_turbo_equalization.py @@ -7,6 +7,11 @@ import math import sys import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO @@ -63,7 +68,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellat # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) diff --git a/gr-trellis/src/examples/python/test_turbo_equalization1.py b/gr-trellis/src/examples/python/test_turbo_equalization1.py index e8b946458c..dfe1a2d82e 100755 --- a/gr-trellis/src/examples/python/test_turbo_equalization1.py +++ b/gr-trellis/src/examples/python/test_turbo_equalization1.py @@ -8,6 +8,12 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): metrics_in = trellis.metrics_f(fi.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for innner SISO scale = gr.multiply_const_ff(1.0/N0) @@ -66,7 +72,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona # CHANNEL isi = filter.fir_filter_fff(1,channel) add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) diff --git a/gr-trellis/src/examples/python/test_turbo_equalization2.py b/gr-trellis/src/examples/python/test_turbo_equalization2.py index 6b37ee9b59..fb0a899eba 100755 --- a/gr-trellis/src/examples/python/test_turbo_equalization2.py +++ b/gr-trellis/src/examples/python/test_turbo_equalization2.py @@ -8,6 +8,12 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + def make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,type): scale = gr.multiply_const_ff(math.sqrt(1.0/N0)) gnd = gr.vector_source_f([0],True); @@ -64,7 +70,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona # CHANNEL isi = filter.fir_filter_fff(1,channel) add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX (head,tail) = make_rx(tb,fo,fi,dimensionality,tot_constellation,K,interleaver,IT,Es,N0,trellis.TRELLIS_MIN_SUM) diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization.py b/gr-trellis/src/examples/python/test_viterbi_equalization.py index 00d54620b2..91dc7e36da 100755 --- a/gr-trellis/src/examples/python/test_viterbi_equalization.py +++ b/gr-trellis/src/examples/python/test_viterbi_equalization.py @@ -7,6 +7,12 @@ import math import sys import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed): tb = gr.top_block () @@ -20,7 +26,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed): # CHANNEL add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX metrics = trellis.metrics_f(f.O(),dimensionality,tot_constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization1.py b/gr-trellis/src/examples/python/test_viterbi_equalization1.py index cb000d6852..4421e370a4 100755 --- a/gr-trellis/src/examples/python/test_viterbi_equalization1.py +++ b/gr-trellis/src/examples/python/test_viterbi_equalization1.py @@ -8,6 +8,12 @@ import sys import random import fsm_utils +try: + from gnuradio import analog +except ImportError: + sys.stderr.write("Error: Program requires gr-analog.\n") + sys.exit(1) + def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,seed): tb = gr.top_block () L = len(channel) @@ -27,7 +33,7 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel # CHANNEL isi = filter.fir_filter_fff(1,channel) add = gr.add_ff() - noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt index 315ef3a93c..dfb5d8ef19 100644 --- a/gr-trellis/src/lib/CMakeLists.txt +++ b/gr-trellis/src/lib/CMakeLists.txt @@ -214,7 +214,7 @@ set(GR_SWIG_INCLUDE_DIRS set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i) set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -set(GR_SWIG_LIBRARIES gnuradio-trellis) +set(GR_SWIG_LIBRARIES gnuradio-trellis gnuradio-digital gnuradio-analog) GR_SWIG_MAKE(trellis trellis.i) GR_SWIG_INSTALL( diff --git a/gr-trellis/src/python/CMakeLists.txt b/gr-trellis/src/python/CMakeLists.txt index ae2ab9cb41..5b5a35bcfc 100644 --- a/gr-trellis/src/python/CMakeLists.txt +++ b/gr-trellis/src/python/CMakeLists.txt @@ -21,6 +21,7 @@ # Handle the unit tests ######################################################################## if(ENABLE_TESTING) +include(GrPython) include(GrTest) file(GLOB py_qa_test_files "qa_*.py") foreach(py_qa_test_file ${py_qa_test_files}) @@ -29,9 +30,11 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gnuradio-core/src/python ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig ${CMAKE_BINARY_DIR}/gr-digital/swig + ${CMAKE_BINARY_DIR}/gr-analog/swig ${CMAKE_BINARY_DIR}/gr-trellis/src/lib ) - set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-digital gnuradio-trellis) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core + gnuradio-digital gnuradio-analog gnuradio-trellis) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-trellis/src/python/qa_trellis.py b/gr-trellis/src/python/qa_trellis.py index c6ba40d11f..53dcf0d8f6 100755 --- a/gr-trellis/src/python/qa_trellis.py +++ b/gr-trellis/src/python/qa_trellis.py @@ -30,6 +30,7 @@ import trellis import os import digital_swig as digital +import analog_swig as analog fsm_args = {"awgn1o2_4": (2, 4, 4, (0, 2, 0, 2, 1, 3, 1, 3), @@ -118,7 +119,7 @@ class trellis_tb(gr.top_block): # CHANNEL add = gr.add_cc() - noise = gr.noise_source_c(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) + noise = analog.noise_source_c(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed) # RX # data preprocessing to generate metrics for Viterbi diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt index 8d5c3a8849..23fef3a485 100644 --- a/gr-uhd/CMakeLists.txt +++ b/gr-uhd/CMakeLists.txt @@ -32,6 +32,8 @@ GR_REGISTER_COMPONENT("gr-uhd" ENABLE_GR_UHD Boost_FOUND UHD_FOUND ENABLE_GR_CORE + ENABLE_GR_FILTER + ENABLE_GR_ANALOG ) GR_SET_GLOBAL(GR_UHD_INCLUDE_DIRS diff --git a/gr-uhd/apps/hf_explorer/hfx.py b/gr-uhd/apps/hf_explorer/hfx.py index 1f08bd8ba6..8033273d06 100755 --- a/gr-uhd/apps/hf_explorer/hfx.py +++ b/gr-uhd/apps/hf_explorer/hfx.py @@ -81,6 +81,8 @@ import os, wx, sys, math import wx.lib.evtmgr as em from gnuradio.wxgui import powermate, fftsink2 from gnuradio import gr, audio, eng_notation +from gnuradio import analog +from gnuradio import filter from gnuradio.eng_option import eng_option from gnuradio import uhd from optparse import OptionParser @@ -272,23 +274,23 @@ class MyFrame(wx.Frame): self.tb.connect (self.src, radio_file) # 2nd DDC - xlate_taps = gr.firdes.low_pass ( \ - 1.0, input_rate, 16e3, 4e3, gr.firdes.WIN_HAMMING ) - self.xlate = gr.freq_xlating_fir_filter_ccf ( \ + xlate_taps = filter.firdes.low_pass ( \ + 1.0, input_rate, 16e3, 4e3, filter.firdes.WIN_HAMMING ) + self.xlate = filter.freq_xlating_fir_filter_ccf ( \ fir_decim, xlate_taps, self.tune_offset, input_rate ) # Complex Audio filter - audio_coeffs = gr.firdes.complex_band_pass ( + audio_coeffs = filter.firdes.complex_band_pass ( 1.0, # gain self.af_sample_rate, # sample rate -3000, # low cutoff 0, # high cutoff 100, # transition - gr.firdes.WIN_HAMMING) # window + filter.firdes.WIN_HAMMING) # window self.slider_fcutoff_hi.SetValue(0) self.slider_fcutoff_lo.SetValue(-3000) - self.audio_filter = gr.fir_filter_ccc(1, audio_coeffs) + self.audio_filter = filter.fir_filter_ccc(1, audio_coeffs) # Main +/- 16Khz spectrum display self.fft = fftsink2.fft_sink_c(self.panel_2, fft_size=512, @@ -307,10 +309,10 @@ class MyFrame(wx.Frame): # AM branch self.sel_am = gr.multiply_const_cc(0) # the following frequencies turn out to be in radians/sample - # gr.pll_refout_cc(alpha,beta,min_freq,max_freq) + # analog.pll_refout_cc(alpha,beta,min_freq,max_freq) # suggested alpha = X, beta = .25 * X * X - pll = gr.pll_refout_cc(.5,.0625,(2.*math.pi*7.5e3/self.af_sample_rate), - (2.*math.pi*6.5e3/self.af_sample_rate)) + pll = analog.pll_refout_cc(.5,.0625,(2.*math.pi*7.5e3/self.af_sample_rate), + (2.*math.pi*6.5e3/self.af_sample_rate)) self.pll_carrier_scale = gr.multiply_const_cc(complex(10,0)) am_det = gr.multiply_cc() # these are for converting +7.5kHz to -7.5kHz @@ -322,15 +324,15 @@ class MyFrame(wx.Frame): phaser2 = gr.multiply_const_ff(-1) # filter for pll generated carrier - pll_carrier_coeffs = gr.firdes.complex_band_pass ( + pll_carrier_coeffs = filter.firdes.complex_band_pass ( 2.0, # gain self.af_sample_rate, # sample rate 7400, # low cutoff 7600, # high cutoff 100, # transition - gr.firdes.WIN_HAMMING) # window + filter.firdes.WIN_HAMMING) # window - self.pll_carrier_filter = gr.fir_filter_ccc (1, pll_carrier_coeffs) + self.pll_carrier_filter = filter.fir_filter_ccc (1, pll_carrier_coeffs) self.sel_sb = gr.multiply_const_ff(1) combine = gr.add_ff() @@ -610,13 +612,13 @@ class MyFrame(wx.Frame): # Calculate taps and apply def filter(self): - audio_coeffs = gr.firdes.complex_band_pass ( + audio_coeffs = filter.firdes.complex_band_pass ( 1.0, # gain self.af_sample_rate, # sample rate self.slider_fcutoff_lo.GetValue(), # low cutoff self.slider_fcutoff_hi.GetValue(), # high cutoff 100, # transition - gr.firdes.WIN_HAMMING) # window + filter.firdes.WIN_HAMMING) # window self.audio_filter.set_taps(audio_coeffs) def set_lsb(self, event): diff --git a/gr-uhd/apps/uhd_rx_nogui b/gr-uhd/apps/uhd_rx_nogui index 9977f55a3c..c348ba23f5 100755 --- a/gr-uhd/apps/uhd_rx_nogui +++ b/gr-uhd/apps/uhd_rx_nogui @@ -20,7 +20,9 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, gru, uhd, optfir, audio, blks2 +from gnuradio import gr, gru, uhd, audio, blks2 +from gnuradio import filter +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -69,9 +71,9 @@ blocks. # (device_rate, channel_rate, audio_rate, channel_pass, channel_stop, demod) demod_params = { - 'AM' : (256e3, 16e3, 16e3, 5000, 8000, blks2.demod_10k0a3e_cf), - 'FM' : (256e3, 32e3, 8e3, 8000, 9000, blks2.demod_20k0f3e_cf), - 'WFM' : (320e3, 320e3, 32e3, 80000, 115000, blks2.demod_200kf3e_cf) + 'AM' : (256e3, 16e3, 16e3, 5000, 8000, analog.demod_10k0a3e_cf), + 'FM' : (256e3, 32e3, 8e3, 8000, 9000, analog.demod_20k0f3e_cf), + 'WFM' : (320e3, 320e3, 32e3, 80000, 115000, analog.demod_200kf3e_cf) } class uhd_src(gr.hier_block2): @@ -104,7 +106,7 @@ class uhd_src(gr.hier_block2): # Resampler to get to exactly samp_rate no matter what dev_rate is self._rrate = samp_rate / dev_rate - self._resamp = blks2.pfb_arb_resampler_ccf(self._rrate) + self._resamp = filter.pfb.arb_resampler_ccf(self._rrate) # If no gain specified, set to midrange gain_range = self._src.get_gain_range() @@ -142,27 +144,27 @@ class app_top_block(gr.top_block): channel_decim = int(if_rate // channel_rate) audio_decim = int(channel_rate // audio_rate) - CHAN_taps = optfir.low_pass(1.0, # Filter gain - if_rate, # Sample rate - channel_pass, # One sided modulation bandwidth - channel_stop, # One sided channel bandwidth - 0.1, # Passband ripple - 60) # Stopband attenuation + CHAN_taps = filter.optfir.low_pass(1.0, # Filter gain + if_rate, # Sample rate + channel_pass, # One sided modulation bandwidth + channel_stop, # One sided channel bandwidth + 0.1, # Passband ripple + 60) # Stopband attenuation - CHAN = gr.freq_xlating_fir_filter_ccf(channel_decim, # Decimation rate - CHAN_taps, # Filter taps - 0.0, # Offset frequency - if_rate) # Sample rate + CHAN = filter.freq_xlating_fir_filter_ccf(channel_decim, # Decimation rate + CHAN_taps, # Filter taps + 0.0, # Offset frequency + if_rate) # Sample rate - RFSQL = gr.pwr_squelch_cc(options.rf_squelch, # Power threshold - 125.0/channel_rate, # Time constant - int(channel_rate/20), # 50ms rise/fall - False) # Zero, not gate output + RFSQL = analog.pwr_squelch_cc(options.rf_squelch, # Power threshold + 125.0/channel_rate, # Time constant + int(channel_rate/20), # 50ms rise/fall + False) # Zero, not gate output - AGC = gr.agc_cc(1.0/channel_rate, # Time constant - 1.0, # Reference power - 1.0, # Initial gain - 1.0) # Maximum gain + AGC = analog.agc_cc(1.0/channel_rate, # Time constant + 1.0, # Reference power + 1.0, # Initial gain + 1.0) # Maximum gain DEMOD = demod(channel_rate, audio_decim) @@ -173,8 +175,8 @@ class app_top_block(gr.top_block): # Optionally add CTCSS and RSAMP if needed tail = DEMOD if options.ctcss != None and options.ctcss > 60.0: - CTCSS = gr.ctcss_squelch_ff(audio_rate, # Sample rate - options.ctcss) # Squelch tone + CTCSS = analog.ctcss_squelch_ff(audio_rate, # Sample rate + options.ctcss) # Squelch tone self.connect(DEMOD, CTCSS) tail = CTCSS diff --git a/gr-uhd/apps/uhd_siggen_base.py b/gr-uhd/apps/uhd_siggen_base.py index 9eecddb756..3dcebab29c 100644 --- a/gr-uhd/apps/uhd_siggen_base.py +++ b/gr-uhd/apps/uhd_siggen_base.py @@ -39,6 +39,7 @@ TYPE_KEY = 'type' def setter(ps, key, val): ps[key] = val from gnuradio import gr, gru, uhd, eng_notation +from gnuradio import analog from gnuradio.gr.pubsub import pubsub from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -239,28 +240,28 @@ class top_block(gr.top_block, pubsub): def set_waveform(self, type): self.lock() self.disconnect_all() - if type == gr.GR_SIN_WAVE or type == gr.GR_CONST_WAVE: - self._src = gr.sig_source_c(self[SAMP_RATE_KEY], # Sample rate - type, # Waveform type - self[WAVEFORM_FREQ_KEY], # Waveform frequency - self[AMPLITUDE_KEY], # Waveform amplitude - self[WAVEFORM_OFFSET_KEY]) # Waveform offset - elif type == gr.GR_GAUSSIAN or type == gr.GR_UNIFORM: - self._src = gr.noise_source_c(type, self[AMPLITUDE_KEY]) + if type == analog.GR_SIN_WAVE or type == analog.GR_CONST_WAVE: + self._src = analog.sig_source_c(self[SAMP_RATE_KEY], # Sample rate + type, # Waveform type + self[WAVEFORM_FREQ_KEY], # Waveform frequency + self[AMPLITUDE_KEY], # Waveform amplitude + self[WAVEFORM_OFFSET_KEY]) # Waveform offset + elif type == analog.GR_GAUSSIAN or type == analog.GR_UNIFORM: + self._src = analog.noise_source_c(type, self[AMPLITUDE_KEY]) elif type == "2tone": - self._src1 = gr.sig_source_c(self[SAMP_RATE_KEY], - gr.GR_SIN_WAVE, - self[WAVEFORM_FREQ_KEY], - self[AMPLITUDE_KEY]/2.0, - 0) + self._src1 = analog.sig_source_c(self[SAMP_RATE_KEY], + analog.GR_SIN_WAVE, + self[WAVEFORM_FREQ_KEY], + self[AMPLITUDE_KEY]/2.0, + 0) if(self[WAVEFORM2_FREQ_KEY] is None): self[WAVEFORM2_FREQ_KEY] = -self[WAVEFORM_FREQ_KEY] - self._src2 = gr.sig_source_c(self[SAMP_RATE_KEY], - gr.GR_SIN_WAVE, - self[WAVEFORM2_FREQ_KEY], - self[AMPLITUDE_KEY]/2.0, - 0) + self._src2 = analog.sig_source_c(self[SAMP_RATE_KEY], + analog.GR_SIN_WAVE, + self[WAVEFORM2_FREQ_KEY], + self[AMPLITUDE_KEY]/2.0, + 0) self._src = gr.add_cc() self.connect(self._src1,(self._src,0)) self.connect(self._src2,(self._src,1)) @@ -272,12 +273,12 @@ class top_block(gr.top_block, pubsub): if self[WAVEFORM2_FREQ_KEY] is None: self[WAVEFORM2_FREQ_KEY] = 0.1 - self._src1 = gr.sig_source_f(self[SAMP_RATE_KEY], - gr.GR_TRI_WAVE, - self[WAVEFORM2_FREQ_KEY], - 1.0, - -0.5) - self._src2 = gr.frequency_modulator_fc(self[WAVEFORM_FREQ_KEY]*2*math.pi/self[SAMP_RATE_KEY]) + self._src1 = analog.sig_source_f(self[SAMP_RATE_KEY], + analog.GR_TRI_WAVE, + self[WAVEFORM2_FREQ_KEY], + 1.0, + -0.5) + self._src2 = analog.frequency_modulator_fc(self[WAVEFORM_FREQ_KEY]*2*math.pi/self[SAMP_RATE_KEY]) self._src = gr.multiply_const_cc(self[AMPLITUDE_KEY]) self.connect(self._src1,self._src2,self._src) else: @@ -288,7 +289,7 @@ class top_block(gr.top_block, pubsub): if self._verbose: print "Set baseband modulation to:", waveforms[type] - if type == gr.GR_SIN_WAVE: + if type == analog.GR_SIN_WAVE: print "Modulation frequency: %sHz" % (n2s(self[WAVEFORM_FREQ_KEY]),) print "Initial phase:", self[WAVEFORM_OFFSET_KEY] elif type == "2tone": @@ -306,7 +307,7 @@ class top_block(gr.top_block, pubsub): print "Amplitude out of range:", amplitude return False - if self[TYPE_KEY] in (gr.GR_SIN_WAVE, gr.GR_CONST_WAVE, gr.GR_GAUSSIAN, gr.GR_UNIFORM): + if self[TYPE_KEY] in (analog.GR_SIN_WAVE, analog.GR_CONST_WAVE, analog.GR_GAUSSIAN, analog.GR_UNIFORM): self._src.set_amplitude(amplitude) elif self[TYPE_KEY] == "2tone": self._src1.set_amplitude(amplitude/2.0) @@ -341,16 +342,16 @@ def get_options(): help="Set baseband waveform frequency to FREQ [default=%default]") parser.add_option("-y", "--waveform2-freq", type="eng_float", default=None, help="Set 2nd waveform frequency to FREQ [default=%default]") - parser.add_option("--sine", dest="type", action="store_const", const=gr.GR_SIN_WAVE, + parser.add_option("--sine", dest="type", action="store_const", const=analog.GR_SIN_WAVE, help="Generate a carrier modulated by a complex sine wave", - default=gr.GR_SIN_WAVE) - parser.add_option("--const", dest="type", action="store_const", const=gr.GR_CONST_WAVE, + default=analog.GR_SIN_WAVE) + parser.add_option("--const", dest="type", action="store_const", const=analog.GR_CONST_WAVE, help="Generate a constant carrier") parser.add_option("--offset", type="eng_float", default=0, help="Set waveform phase offset to OFFSET [default=%default]") - parser.add_option("--gaussian", dest="type", action="store_const", const=gr.GR_GAUSSIAN, + parser.add_option("--gaussian", dest="type", action="store_const", const=analog.GR_GAUSSIAN, help="Generate Gaussian random output") - parser.add_option("--uniform", dest="type", action="store_const", const=gr.GR_UNIFORM, + parser.add_option("--uniform", dest="type", action="store_const", const=analog.GR_UNIFORM, help="Generate Uniform random output") parser.add_option("--2tone", dest="type", action="store_const", const="2tone", help="Generate Two Tone signal for IMD testing") diff --git a/gr-uhd/doc/uhd.dox b/gr-uhd/doc/uhd.dox index f03705fe18..4cd30a86b6 100644 --- a/gr-uhd/doc/uhd.dox +++ b/gr-uhd/doc/uhd.dox @@ -92,10 +92,10 @@ resampler to take care of the difference. actual_rate = self.u.get_samp_rate() resample = desired_rate / actual_rate - # Use the blks2 version and pass only the resample factor. + # Use the filter.pfb version and pass only the resample factor. # This block builds a half-band filter for you - self.resampler = blks2.pfb_arb_resampler_ccf(resample) + self.resampler = filter.pfb.arb_resampler_ccf(resample) \endcode */ diff --git a/gr-uhd/examples/c++/tag_sink_demo.h b/gr-uhd/examples/c++/tag_sink_demo.h index 207cc47e61..5417bd3242 100644 --- a/gr-uhd/examples/c++/tag_sink_demo.h +++ b/gr-uhd/examples/c++/tag_sink_demo.h @@ -55,8 +55,8 @@ public: const pmt::pmt_t &value = rx_time_tag.value; std::cout << boost::format("Full seconds %u, Frac seconds %f, abs sample offset %u") - % pmt::pmt_to_uint64(pmt_tuple_ref(value, 0)) - % pmt::pmt_to_double(pmt_tuple_ref(value, 1)) + % pmt::pmt_to_uint64(pmt::pmt_tuple_ref(value, 0)) + % pmt::pmt_to_double(pmt::pmt_tuple_ref(value, 1)) % offset << std::endl; } diff --git a/gr-uhd/examples/grc/uhd_two_tone_loopback.grc b/gr-uhd/examples/grc/uhd_two_tone_loopback.grc index 8bcbc07927..b186c2f2bc 100644 --- a/gr-uhd/examples/grc/uhd_two_tone_loopback.grc +++ b/gr-uhd/examples/grc/uhd_two_tone_loopback.grc @@ -1,6 +1,65 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sat Oct 8 15:27:04 2011</timestamp> + <timestamp>Sat Nov 10 14:55:26 2012</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>uhd_two_tone_loopback</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>UHD Loopback - 2 Tone</value> + </param> + <param> + <key>author</key> + <value>Example</value> + </param> + <param> + <key>description</key> + <value>Loopback test</value> + </param> + <param> + <key>window_size</key> + <value>1280, 1024</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <block> <key>parameter</key> <param> @@ -177,53 +236,10 @@ </param> </block> <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>tone1</value> - </param> - <param> - <key>amp</key> - <value>tone_ampl</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(258, 136)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> + <key>uhd_usrp_sink</key> <param> <key>id</key> - <value>gr_sig_source_x0</value> + <value>uhd_usrp_sink_0</value> </param> <param> <key>_enabled</key> @@ -231,160 +247,122 @@ </param> <param> <key>type</key> - <value>complex</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>tone2</value> - </param> - <param> - <key>amp</key> - <value>tone_ampl</value> - </param> - <param> - <key>offset</key> - <value>0</value> + <value>fc32</value> </param> <param> - <key>_coordinate</key> - <value>(259, 248)</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</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> + <key>otw</key> + <value></value> </param> <param> - <key>type</key> - <value>complex</value> + <key>stream_args</key> + <value></value> </param> <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> + <key>dev_addr</key> + <value>address0</value> </param> <param> - <key>amp</key> - <value>noise_ampl</value> + <key>sync</key> + <value></value> </param> <param> - <key>seed</key> - <value>42</value> + <key>clock_rate</key> + <value>0.0</value> </param> <param> - <key>_coordinate</key> - <value>(279, 364)</value> + <key>num_mboards</key> + <value>1</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>clock_source0</key> + <value></value> </param> - </block> - <block> - <key>uhd_usrp_sink</key> <param> - <key>id</key> - <value>uhd_usrp_sink_0</value> + <key>time_source0</key> + <value></value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>sd_spec0</key> + <value></value> </param> <param> - <key>type</key> - <value>complex</value> + <key>clock_source1</key> + <value></value> </param> <param> - <key>dev_addr</key> - <value>address0</value> + <key>time_source1</key> + <value></value> </param> <param> - <key>sync</key> + <key>sd_spec1</key> <value></value> </param> <param> - <key>clock_rate</key> - <value>0.0</value> + <key>clock_source2</key> + <value></value> </param> <param> - <key>num_mboards</key> - <value>1</value> + <key>time_source2</key> + <value></value> </param> <param> - <key>ref_source0</key> + <key>sd_spec2</key> <value></value> </param> <param> - <key>sd_spec0</key> + <key>clock_source3</key> <value></value> </param> <param> - <key>ref_source1</key> + <key>time_source3</key> <value></value> </param> <param> - <key>sd_spec1</key> + <key>sd_spec3</key> <value></value> </param> <param> - <key>ref_source2</key> + <key>clock_source4</key> <value></value> </param> <param> - <key>sd_spec2</key> + <key>time_source4</key> <value></value> </param> <param> - <key>ref_source3</key> + <key>sd_spec4</key> <value></value> </param> <param> - <key>sd_spec3</key> + <key>clock_source5</key> <value></value> </param> <param> - <key>ref_source4</key> + <key>time_source5</key> <value></value> </param> <param> - <key>sd_spec4</key> + <key>sd_spec5</key> <value></value> </param> <param> - <key>ref_source5</key> + <key>clock_source6</key> <value></value> </param> <param> - <key>sd_spec5</key> + <key>time_source6</key> <value></value> </param> <param> - <key>ref_source6</key> + <key>sd_spec6</key> <value></value> </param> <param> - <key>sd_spec6</key> + <key>clock_source7</key> <value></value> </param> <param> - <key>ref_source7</key> + <key>time_source7</key> <value></value> </param> <param> @@ -1242,7 +1220,15 @@ </param> <param> <key>type</key> - <value>complex</value> + <value>fc32</value> + </param> + <param> + <key>otw</key> + <value></value> + </param> + <param> + <key>stream_args</key> + <value></value> </param> <param> <key>dev_addr</key> @@ -1261,7 +1247,11 @@ <value>1</value> </param> <param> - <key>ref_source0</key> + <key>clock_source0</key> + <value></value> + </param> + <param> + <key>time_source0</key> <value></value> </param> <param> @@ -1269,7 +1259,11 @@ <value></value> </param> <param> - <key>ref_source1</key> + <key>clock_source1</key> + <value></value> + </param> + <param> + <key>time_source1</key> <value></value> </param> <param> @@ -1277,7 +1271,11 @@ <value></value> </param> <param> - <key>ref_source2</key> + <key>clock_source2</key> + <value></value> + </param> + <param> + <key>time_source2</key> <value></value> </param> <param> @@ -1285,7 +1283,11 @@ <value></value> </param> <param> - <key>ref_source3</key> + <key>clock_source3</key> + <value></value> + </param> + <param> + <key>time_source3</key> <value></value> </param> <param> @@ -1293,7 +1295,11 @@ <value></value> </param> <param> - <key>ref_source4</key> + <key>clock_source4</key> + <value></value> + </param> + <param> + <key>time_source4</key> <value></value> </param> <param> @@ -1301,7 +1307,11 @@ <value></value> </param> <param> - <key>ref_source5</key> + <key>clock_source5</key> + <value></value> + </param> + <param> + <key>time_source5</key> <value></value> </param> <param> @@ -1309,7 +1319,11 @@ <value></value> </param> <param> - <key>ref_source6</key> + <key>clock_source6</key> + <value></value> + </param> + <param> + <key>time_source6</key> <value></value> </param> <param> @@ -1317,7 +1331,11 @@ <value></value> </param> <param> - <key>ref_source7</key> + <key>clock_source7</key> + <value></value> + </param> + <param> + <key>time_source7</key> <value></value> </param> <param> @@ -1964,10 +1982,10 @@ </param> </block> <block> - <key>gr_add_xx</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>gr_add_xx</value> + <value>wxgui_fftsink2</value> </param> <param> <key>_enabled</key> @@ -1978,71 +1996,76 @@ <value>complex</value> </param> <param> - <key>num_inputs</key> - <value>3</value> + <key>title</key> + <value>FFT Plot</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>_coordinate</key> - <value>(529, 172)</value> + <key>baseband_freq</key> + <value>0</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>y_per_div</key> + <value>10</value> </param> - </block> - <block> - <key>options</key> <param> - <key>id</key> - <value>uhd_two_tone_loopback</value> + <key>y_divs</key> + <value>10</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>ref_level</key> + <value>0</value> </param> <param> - <key>title</key> - <value>UHD Loopback - 2 Tone</value> + <key>ref_scale</key> + <value>2.0</value> </param> <param> - <key>author</key> - <value>Example</value> + <key>fft_size</key> + <value>512*2</value> </param> <param> - <key>description</key> - <value>Loopback test</value> + <key>fft_rate</key> + <value>15</value> </param> <param> - <key>window_size</key> - <value>1280, 1024</value> + <key>peak_hold</key> + <value>False</value> </param> <param> - <key>generate_options</key> - <value>wx_gui</value> + <key>average</key> + <value>False</value> </param> <param> - <key>category</key> - <value>Custom</value> + <key>avg_alpha</key> + <value>0</value> </param> <param> - <key>run_options</key> - <value>prompt</value> + <key>win</key> + <value>window.blackmanharris</value> </param> <param> - <key>run</key> - <value>True</value> + <key>win_size</key> + <value></value> </param> <param> - <key>realtime_scheduling</key> + <key>grid_pos</key> + <value>1, 2, 2, 4</value> + </param> + <param> + <key>notebook</key> <value></value> </param> <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> - <value>(10, 10)</value> + <value>(1114, 264)</value> </param> <param> <key>_rotation</key> @@ -2050,86 +2073,120 @@ </param> </block> <block> - <key>wxgui_fftsink2</key> + <key>parameter</key> <param> <key>id</key> - <value>wxgui_fftsink2</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> + <key>label</key> + <value>Sample Rate</value> + </param> + <param> + <key>value</key> + <value>500e3</value> + </param> + <param> <key>type</key> - <value>complex</value> + <value>eng_float</value> </param> <param> - <key>title</key> - <value>FFT Plot</value> + <key>short_id</key> + <value>s</value> + </param> + <param> + <key>_coordinate</key> + <value>(539, 11)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>analog_sig_source_x</key> + <param> + <key>id</key> + <value>analog_sig_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> </param> <param> <key>samp_rate</key> <value>samp_rate</value> </param> <param> - <key>baseband_freq</key> - <value>0</value> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> </param> <param> - <key>y_per_div</key> - <value>10</value> + <key>freq</key> + <value>tone1</value> </param> <param> - <key>y_divs</key> - <value>10</value> + <key>amp</key> + <value>tone_ampl</value> </param> <param> - <key>ref_level</key> + <key>offset</key> <value>0</value> </param> <param> - <key>ref_scale</key> - <value>2.0</value> + <key>_coordinate</key> + <value>(264, 136)</value> </param> <param> - <key>fft_size</key> - <value>512*2</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>analog_sig_source_x</key> <param> - <key>fft_rate</key> - <value>15</value> + <key>id</key> + <value>analog_sig_source_x_1</value> </param> <param> - <key>peak_hold</key> - <value>False</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>average</key> - <value>False</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>avg_alpha</key> - <value>0</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>win</key> - <value>window.blackmanharris</value> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> </param> <param> - <key>win_size</key> - <value></value> + <key>freq</key> + <value>tone2</value> </param> <param> - <key>grid_pos</key> - <value>1, 2, 2, 4</value> + <key>amp</key> + <value>tone_ampl</value> </param> <param> - <key>notebook</key> - <value></value> + <key>offset</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(1114, 264)</value> + <value>(265, 247)</value> </param> <param> <key>_rotation</key> @@ -2137,34 +2194,65 @@ </param> </block> <block> - <key>parameter</key> + <key>gr_add_xx</key> <param> <key>id</key> - <value>samp_rate</value> + <value>gr_add_xx</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Sample Rate</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>value</key> - <value>500e3</value> + <key>num_inputs</key> + <value>3</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(529, 172)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>analog_noise_source_x</key> + <param> + <key>id</key> + <value>analog_noise_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> </param> <param> <key>type</key> - <value>eng_float</value> + <value>complex</value> </param> <param> - <key>short_id</key> - <value>s</value> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>amp</key> + <value>noise_ampl</value> + </param> + <param> + <key>seed</key> + <value>-42</value> </param> <param> <key>_coordinate</key> - <value>(539, 11)</value> + <value>(288, 359)</value> </param> <param> <key>_rotation</key> @@ -2172,33 +2260,33 @@ </param> </block> <connection> - <source_block_id>gr_noise_source_x</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> + <source_block_id>gr_add_xx</source_block_id> + <sink_block_id>uhd_usrp_sink_0</sink_block_id> <source_key>0</source_key> - <sink_key>2</sink_key> + <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_sig_source_x0</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> + <source_block_id>uhd_usrp_source_0</source_block_id> + <sink_block_id>wxgui_fftsink2</sink_block_id> <source_key>0</source_key> - <sink_key>1</sink_key> + <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_sig_source_x</source_block_id> + <source_block_id>analog_sig_source_x_0</source_block_id> <sink_block_id>gr_add_xx</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_add_xx</source_block_id> - <sink_block_id>uhd_usrp_sink_0</sink_block_id> + <source_block_id>analog_sig_source_x_1</source_block_id> + <sink_block_id>gr_add_xx</sink_block_id> <source_key>0</source_key> - <sink_key>0</sink_key> + <sink_key>1</sink_key> </connection> <connection> - <source_block_id>uhd_usrp_source_0</source_block_id> - <sink_block_id>wxgui_fftsink2</sink_block_id> + <source_block_id>analog_noise_source_x_0</source_block_id> + <sink_block_id>gr_add_xx</sink_block_id> <source_key>0</source_key> - <sink_key>0</sink_key> + <sink_key>2</sink_key> </connection> </flow_graph> diff --git a/gr-uhd/examples/python/fm_tx4.py b/gr-uhd/examples/python/fm_tx4.py index 255b436f56..ae3e1b94f3 100755 --- a/gr-uhd/examples/python/fm_tx4.py +++ b/gr-uhd/examples/python/fm_tx4.py @@ -34,7 +34,7 @@ audio_to_file.py from gnuradio import gr, eng_notation from gnuradio import uhd -from gnuradio import blks2 +from gnuradio import analog from gnuradio.eng_option import eng_option from optparse import OptionParser import math @@ -62,19 +62,19 @@ class pipeline(gr.hier_block2): sys.exit(1) print audio_rate, if_rate - fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6) + fmtx = analog.nbfm_tx(audio_rate, if_rate, max_dev=5e3, tau=75e-6) # Local oscillator - lo = gr.sig_source_c (if_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - lo_freq, #frequency - 1.0, # amplitude - 0) # DC Offset - mixer = gr.multiply_cc () - - self.connect (src, fmtx, (mixer, 0)) - self.connect (lo, (mixer, 1)) - self.connect (mixer, self) + lo = analog.sig_source_c(if_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + lo_freq, # frequency + 1.0, # amplitude + 0) # DC Offset + mixer = gr.multiply_cc() + + self.connect(src, fmtx, (mixer, 0)) + self.connect(lo, (mixer, 1)) + self.connect(mixer, self) class fm_tx_block(stdgui2.std_top_block): def __init__(self, frame, panel, vbox, argv): diff --git a/gr-uhd/examples/python/fm_tx_2_daughterboards.py b/gr-uhd/examples/python/fm_tx_2_daughterboards.py index d98d655ab1..f896be6d04 100755 --- a/gr-uhd/examples/python/fm_tx_2_daughterboards.py +++ b/gr-uhd/examples/python/fm_tx_2_daughterboards.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -30,7 +30,9 @@ Side A is 600 Hz tone. Side B is 350 + 440 Hz tones. """ -from gnuradio import gr, uhd, blks2 +from gnuradio import gr, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_notation import num_to_str, str_to_num from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -47,11 +49,11 @@ class example_signal_0(gr.hier_block2): gr.io_signature(0, 0, 0), # Input signature gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - src = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 600, # frequency - 1.0, # amplitude - 0) # DC Offset + src = analog.sig_source_c(sample_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + 600, # frequency + 1.0, # amplitude + 0) # DC Offset self.connect(src, self) @@ -65,17 +67,17 @@ class example_signal_1(gr.hier_block2): gr.io_signature(0, 0, 0), # Input signature gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature - src0 = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 350, # frequency - 1.0, # amplitude - 0) # DC Offset - - src1 = gr.sig_source_c (sample_rate, # sample rate - gr.GR_SIN_WAVE, # waveform type - 440, # frequency - 1.0, # amplitude - 0) # DC Offset + src0 = analog.sig_source_c(sample_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + 350, # frequency + 1.0, # amplitude + 0) # DC Offset + + src1 = analog.sig_source_c(sample_rate, # sample rate + analog.GR_SIN_WAVE, # waveform type + 440, # frequency + 1.0, # amplitude + 0) # DC Offset sum = gr.add_cc() self.connect(src0, (sum, 0)) self.connect(src1, (sum, 1)) @@ -86,7 +88,7 @@ class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) - usage="%prog: [options] tx-freq0 tx-freq1" + usage = "%prog: [options] tx-freq0 tx-freq1" parser = OptionParser (option_class=eng_option, usage=usage) parser.add_option("-a", "--args", type="string", default="", help="UHD device address args [default=%default]") @@ -158,7 +160,7 @@ class my_top_block(gr.top_block): # Correct for any difference in requested and actual rates rrate = self.usrp_rate / dev_rate - resamp = blks2.pfb_arb_resampler_ccf(rrate) + resamp = filter.pfb.arb_resampler_ccf(rrate) # and wire them up self.connect(intl, resamp, self.u) diff --git a/gr-uhd/examples/python/max_power.py b/gr-uhd/examples/python/max_power.py index 5d23f16afc..79fe120641 100755 --- a/gr-uhd/examples/python/max_power.py +++ b/gr-uhd/examples/python/max_power.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2007,2011 Free Software Foundation, Inc. +# Copyright 2004,2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,6 +26,7 @@ Setup USRP for maximum power consumption. from gnuradio import gr +from gnuradio import analog from gnuradio import uhd from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -63,9 +64,9 @@ class build_block(gr.top_block): self.u_tx = uhd.usrp_sink(device_addr=args, stream_args=stream_args) self.u_tx.set_samp_rate(MAX_RATE) - self.tx_src0 = gr.sig_source_c(self.u_tx.get_samp_rate(), - gr.GR_CONST_WAVE, - 0, 1.0, 0) + self.tx_src0 = analog.sig_source_c(self.u_tx.get_samp_rate(), + analog.GR_CONST_WAVE, + 0, 1.0, 0) # Get dboard gain range and select maximum tx_gain_range = self.u_tx.get_gain_range() @@ -94,7 +95,7 @@ class build_block(gr.top_block): self.u_rx = uhd.usrp_source(device_addr=args, io_type=uhd.io_type.COMPLEX_FLOAT32, num_channels=rx_nchan) - self.rx_dst0 = gr.null_sink (gr.sizeof_gr_complex) + self.rx_dst0 = gr.null_sink(gr.sizeof_gr_complex) self.u_rx.set_samp_rate(MAX_RATE) diff --git a/gr-uhd/examples/python/usrp_am_mw_rcv.py b/gr-uhd/examples/python/usrp_am_mw_rcv.py index 40a7fee68d..a389e173f8 100755 --- a/gr-uhd/examples/python/usrp_am_mw_rcv.py +++ b/gr-uhd/examples/python/usrp_am_mw_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,10 +20,11 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, eng_notation, optfir +from gnuradio import gr, eng_notation +from gnuradio import filter +from gnuradio import analog from gnuradio import audio from gnuradio import uhd -from gnuradio import blks2 from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -96,36 +97,36 @@ class wfm_rx_block (stdgui2.std_top_block): # Resample signal to exactly self.usrp_rate # FIXME: make one of the follow-on filters an arb resampler rrate = usrp_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate) + self.resamp = filter.pfb.arb_resampler_ccf(rrate) - chan_filt_coeffs = gr.firdes.low_pass_2 (1, # gain - usrp_rate, # sampling rate - 8e3, # passband cutoff - 4e3, # transition bw - 60) # stopband attenuation + chan_filt_coeffs = filter.firdes.low_pass_2(1, # gain + usrp_rate, # sampling rate + 8e3, # passband cutoff + 4e3, # transition bw + 60) # stopband attenuation if self.use_IF: # Turn If to baseband and filter. - self.chan_filt = gr.freq_xlating_fir_filter_ccf (chanfilt_decim, - chan_filt_coeffs, - self.IF_freq, - usrp_rate) + self.chan_filt = filter.freq_xlating_fir_filter_ccf(chanfilt_decim, + chan_filt_coeffs, + self.IF_freq, + usrp_rate) else: - self.chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs) + self.chan_filt = filter.fir_filter_ccf(chanfilt_decim, chan_filt_coeffs) - self.agc = gr.agc_cc(0.1, 1, 1, 100000) + self.agc = analog.agc_cc(0.1, 1, 1, 100000) self.am_demod = gr.complex_to_mag() self.volume_control = gr.multiply_const_ff(self.vol) - audio_filt_coeffs = gr.firdes.low_pass_2 (1, # gain - demod_rate, # sampling rate - 8e3, # passband cutoff - 2e3, # transition bw - 60) # stopband attenuation - self.audio_filt=gr.fir_filter_fff(audio_decim, audio_filt_coeffs) + audio_filt_coeffs = filter.firdes.low_pass_2(1, # gain + demod_rate, # sampling rate + 8e3, # passband cutoff + 2e3, # transition bw + 60) # stopband attenuation + self.audio_filt = filter.fir_filter_fff(audio_decim, audio_filt_coeffs) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), + self.audio_sink = audio.sink(int (audio_rate), options.audio_output, False) # ok_to_block diff --git a/gr-uhd/examples/python/usrp_nbfm_ptt.py b/gr-uhd/examples/python/usrp_nbfm_ptt.py index af4c214795..d377e3a0a2 100755 --- a/gr-uhd/examples/python/usrp_nbfm_ptt.py +++ b/gr-uhd/examples/python/usrp_nbfm_ptt.py @@ -25,7 +25,8 @@ import sys import wx from optparse import OptionParser -from gnuradio import gr, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import stdgui2, fftsink2, scopesink2, slider, form @@ -317,15 +318,15 @@ class transmit_path(gr.hier_block2): audio_taps = convolve(array(lpf),array(hpf)) self.audio_filt = gr.fir_filter_fff(1,audio_taps) - self.pl = blks2.ctcss_gen_f(self.audio_rate,123.0) + self.pl = analog.ctcss_gen_f(self.audio_rate,123.0) self.add_pl = gr.add_ff() self.connect(self.pl,(self.add_pl,1)) - self.fmtx = blks2.nbfm_tx(self.audio_rate, self.if_rate) + self.fmtx = analog.nbfm_tx(self.audio_rate, self.if_rate) self.amp = gr.multiply_const_cc (self.normal_gain) rrate = dev_rate / self.if_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate) + self.resamp = filter.pfb.arb_resampler_ccf(rrate) self.connect(self.audio, self.audio_amp, self.audio_filt, (self.add_pl,0), self.fmtx, self.amp, @@ -395,23 +396,23 @@ class receive_path(gr.hier_block2): gr.firdes.WIN_HANN) # filter type rrate = self.quad_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.resamp = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) # instantiate the guts of the single channel receiver - self.fmrx = blks2.nbfm_rx(self.audio_rate, self.quad_rate) + self.fmrx = analog.nbfm_rx(self.audio_rate, self.quad_rate) # standard squelch block - self.squelch = blks2.standard_squelch(self.audio_rate) + self.squelch = analog.standard_squelch(self.audio_rate) # audio gain / mute block self._audio_gain = gr.multiply_const_ff(1.0) # sound card as final sink - audio_sink = audio.sink (int(self.audio_rate), audio_output) + audio_sink = audio.sink(int(self.audio_rate), audio_output) # now wire it all together - self.connect (self.u, self.resamp, self.fmrx, self.squelch, - self._audio_gain, audio_sink) + self.connect(self.u, self.resamp, self.fmrx, self.squelch, + self._audio_gain, audio_sink) if gain is None: # if no gain was specified, use the mid-point in dB diff --git a/gr-uhd/examples/python/usrp_nbfm_rcv.py b/gr-uhd/examples/python/usrp_nbfm_rcv.py index 4a8340ec7b..1a06e7d06d 100755 --- a/gr-uhd/examples/python/usrp_nbfm_rcv.py +++ b/gr-uhd/examples/python/usrp_nbfm_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005,2007,2011 Free Software Foundation, Inc. +# Copyright 2005,2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,9 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -285,21 +287,21 @@ class receive_path(gr.hier_block2): # Create filter to get actual channel we want nfilts = 32 - chan_coeffs = gr.firdes.low_pass (nfilts, # gain - nfilts*dev_rate, # sampling rate - 8e3, # low pass cutoff freq - 2e3, # width of trans. band - gr.firdes.WIN_HANN) # filter type + chan_coeffs = filter.firdes.low_pass(nfilts, # gain + nfilts*dev_rate, # sampling rate + 8e3, # low pass cutoff freq + 2e3, # width of trans. band + filter.firdes.WIN_HANN) # filter type rrate = self.quad_rate / dev_rate - self.resamp = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.resamp = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) if USE_SIMPLE_SQUELCH: - self.squelch = gr.simple_squelch_cc(20) + self.squelch = analog.simple_squelch_cc(20) else: - self.squelch = blks2.standard_squelch(self.audio_rate) + self.squelch = analog.standard_squelch(self.audio_rate) # instantiate the guts of the single channel receiver - self.fmrx = blks2.nbfm_rx(self.audio_rate, self.quad_rate) + self.fmrx = analog.nbfm_rx(self.audio_rate, self.quad_rate) # audio gain / mute block self._audio_gain = gr.multiply_const_ff(1.0) diff --git a/gr-uhd/examples/python/usrp_tv_rcv.py b/gr-uhd/examples/python/usrp_tv_rcv.py index b42cf57992..0d0ddf531f 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv.py +++ b/gr-uhd/examples/python/usrp_tv_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -47,6 +47,7 @@ except: print "FYI: gr-video-sdl is not installed" print "realtime SDL video output window will not be available" from gnuradio import uhd +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -194,7 +195,7 @@ class tv_rx_block (stdgui2.std_top_block): file_sink=gr.file_sink(gr.sizeof_char, options.out_filename) self.dst =file_sink - self.agc=gr.agc_cc(1e-7,1.0,1.0) #1e-7 + self.agc = analog.agc_cc(1e-7,1.0,1.0) #1e-7 self.am_demod = gr.complex_to_mag () self.set_blacklevel=gr.add_const_ff(0.0) self.invert_and_scale = gr.multiply_const_ff (0.0) #-self.contrast *128.0*255.0/(200.0) @@ -243,8 +244,8 @@ class tv_rx_block (stdgui2.std_top_block): self.invert_and_scale, self.set_blacklevel, f2uc, self.dst) else: # process_type=='do_test_image': - src_vertical_bars = gr.sig_source_f (usrp_rate, gr.GR_SIN_WAVE, - 10.0 *usrp_rate/320, 255,128) + src_vertical_bars = analog.sig_source_f(usrp_rate, analog.GR_SIN_WAVE, + 10.0 *usrp_rate/320, 255,128) self.connect(src_vertical_bars, f2uc, self.dst) self._build_gui(vbox, usrp_rate, usrp_rate, usrp_rate) diff --git a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py index cfb36222cb..54275bb037 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py +++ b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py @@ -35,6 +35,7 @@ development but not yet in cvs. """ from gnuradio import gr, eng_notation +from gnuradio import analog from gnuradio import audio from gnuradio import uhd from gnuradio.eng_option import eng_option @@ -158,7 +159,7 @@ class my_top_block(gr.top_block): raise SystemExit, 1 - self.agc = gr.agc_cc(1e-7,1.0,1.0) #1e-7 + self.agc = analog.agc_cc(1e-7,1.0,1.0) #1e-7 self.am_demod = gr.complex_to_mag () self.set_blacklevel = gr.add_const_ff(options.brightness +255.0) self.invert_and_scale = gr.multiply_const_ff (-options.contrast *128.0*255.0/(200.0)) diff --git a/gr-uhd/examples/python/usrp_wfm_rcv.py b/gr-uhd/examples/python/usrp_wfm_rcv.py index a7d114d8cc..824af8975c 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2009,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2009,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,9 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, optfir, audio, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -88,27 +90,27 @@ class wfm_rx_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation + chan_coeffs = filter.optfir.low_pass(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 80e3, # passband cutoff + 115e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) + self.guts = analog.wfm_rcv(demod_rate, audio_decim) self.volume_control = gr.multiply_const_ff(self.vol) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block + self.audio_sink = audio.sink(int (audio_rate), + options.audio_output, + False) # ok_to_block # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) + self.connect(self.u, self.chan_filt, self.guts, + self.volume_control, self.audio_sink) self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) diff --git a/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py b/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py index f7e72ae6f9..e76c78e017 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv2_nogui.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,9 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from optparse import OptionParser import sys @@ -94,12 +96,12 @@ class wfm_rx_block (gr.top_block): # taps for channel filter nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation + chan_coeffs = filter.optfir.low_pass(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 80e3, # passband cutoff + 115e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation rrate = usrp_rate / dev_rate # set front end PLL to middle frequency @@ -111,8 +113,8 @@ class wfm_rx_block (gr.top_block): options.gain = float(g.start()+g.stop())/2.0 for n in range(2): - chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - guts = blks2.wfm_rcv (demod_rate, audio_decim) + chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) + guts = analog.wfm_rcv(demod_rate, audio_decim) volume_control = gr.multiply_const_ff(self.vol) #self.connect((self.di, n), chan_filt) diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py b/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py index b794825727..97bd2b2d32 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv_fmdet.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,9 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form, scopesink2 @@ -90,31 +92,31 @@ class wfm_rx_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2(10*nfilts, # gain - nfilts*usrp_rate, # sampling rate - 90e3, # passband cutoff - 30e3, # transition bw - 70) # stopband attenuation + chan_coeffs = filter.firdes.low_pass_2(10*nfilts, # gain + nfilts*usrp_rate, # sampling rate + 90e3, # passband cutoff + 30e3, # transition bw + 70) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv_fmdet (demod_rate, audio_decim) + self.guts = analog.wfm_rcv_fmdet (demod_rate, audio_decim) chan_rate = audio_rate / (demod_rate/audio_decim) - self.rchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) - self.lchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) + self.rchan_filt = filter.pfb.arb_resampler_fff(chan_rate) + self.lchan_filt = filter.pfb.arb_resampler_fff(chan_rate) # FIXME rework {add,multiply}_const_* to handle multiple streams self.volume_control_l = gr.multiply_const_ff(self.vol) self.volume_control_r = gr.multiply_const_ff(self.vol) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block + self.audio_sink = audio.sink(int (audio_rate), + options.audio_output, + False) # ok_to_block # now wire it all together - self.connect (self.u, self.chan_filt, self.guts) + self.connect(self.u, self.chan_filt, self.guts) self.connect((self.guts, 0), self.lchan_filt, self.volume_control_l, (self.audio_sink,0)) self.connect((self.guts, 1), self.rchan_filt, diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py b/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py index 6e9c830c61..f2271fb6db 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv_nogui.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,9 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, optfir, audio, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -82,16 +84,16 @@ class wfm_rx_block (gr.top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 80e3, # passband cutoff - 115e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation + chan_coeffs = filter.optfir.low_pass(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 80e3, # passband cutoff + 115e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) + self.guts = analog.wfm_rcv(demod_rate, audio_decim) self.volume_control = gr.multiply_const_ff(1) @@ -101,8 +103,8 @@ class wfm_rx_block (gr.top_block): False) # ok_to_block # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) + self.connect(self.u, self.chan_filt, self.guts, + self.volume_control, self.audio_sink) if options.gain is None: # if no gain was specified, use the mid-point in dB diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_pll.py b/gr-uhd/examples/python/usrp_wfm_rcv_pll.py index a5c78cb24b..8cd3d5ab13 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv_pll.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv_pll.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,9 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio import eng_notation from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate @@ -90,20 +92,20 @@ class wfm_rx_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2 (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 90e3, # passband cutoff - 30e3, # stopband cutoff - 70) # stopband attenuation + chan_coeffs = filter.firdes.low_pass_2(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 90e3, # passband cutoff + 30e3, # stopband cutoff + 70) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv_pll (demod_rate, audio_decim) + self.guts = analog.wfm_rcv_pll(demod_rate, audio_decim) chan_rate = audio_rate / (demod_rate/audio_decim) - self.rchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) - self.lchan_filt = blks2.pfb_arb_resampler_fff(chan_rate) + self.rchan_filt = filter.pfb.arb_resampler_fff(chan_rate) + self.lchan_filt = filter.pfb.arb_resampler_fff(chan_rate) # FIXME rework {add,multiply}_const_* to handle multiple streams self.volume_control_l = gr.multiply_const_ff(self.vol) diff --git a/gr-uhd/examples/python/usrp_wfm_rcv_sca.py b/gr-uhd/examples/python/usrp_wfm_rcv_sca.py index 0e93e22fcd..68ff27ff30 100755 --- a/gr-uhd/examples/python/usrp_wfm_rcv_sca.py +++ b/gr-uhd/examples/python/usrp_wfm_rcv_sca.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2006,2007,2011 Free Software Foundation, Inc. +# Copyright 2006,2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -50,7 +50,9 @@ OFDM. """ -from gnuradio import gr, optfir, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -121,19 +123,19 @@ class wfm_rx_sca_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = optfir.low_pass (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 100e3, # passband cutoff - 140e3, # stopband cutoff - 0.1, # passband ripple - 60) # stopband attenuation + chan_coeffs = filter.optfir.low_pass(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 100e3, # passband cutoff + 140e3, # stopband cutoff + 0.1, # passband ripple + 60) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) - + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) + #Create demodulator block for Main FM Channel max_dev = 75e3 fm_demod_gain = demod_rate/(2*math.pi*max_dev) - self.fm_demod = gr.quadrature_demod_cf (fm_demod_gain) + self.fm_demod = analog.quadrature_demod_cf(fm_demod_gain) # Note - deemphasis is not applied to the Main FM Channel as # main audio is not decoded @@ -143,20 +145,20 @@ class wfm_rx_sca_block (stdgui2.std_top_block): max_sca_dev = 6e3 # Create filter to get SCA channel we want - sca_chan_coeffs = gr.firdes.low_pass (1.0, # gain - demod_rate, # sampling rate - max_sca_dev, # cutoff freq - max_sca_dev/3, # trans. band - gr.firdes.WIN_HANN) # filter type + sca_chan_coeffs = filter.firdes.low_pass(1.0, # gain + demod_rate, # sampling rate + max_sca_dev, # cutoff freq + max_sca_dev/3, # trans. band + analog.firdes.WIN_HANN) # filter type - self.ddc = gr.freq_xlating_fir_filter_fcf(sca_chanfilt_decim, # decim rate - sca_chan_coeffs, # taps - 0, # freq translation amount (Gets set by the UI) - demod_rate) # input sample rate + self.ddc = filter.freq_xlating_fir_filter_fcf(sca_chanfilt_decim, # decim rate + sca_chan_coeffs, # taps + 0, # freq translation amount (Gets set by the UI) + demod_rate) # input sample rate #Create demodulator block for SCA Channel sca_demod_gain = sca_demod_rate/(2*math.pi*max_sca_dev) - self.fm_demod_sca = gr.quadrature_demod_cf (sca_demod_gain) + self.fm_demod_sca = analog.quadrature_demod_cf(sca_demod_gain) # SCA analog audio is bandwidth limited to 5 KHz @@ -166,31 +168,31 @@ class wfm_rx_sca_block (stdgui2.std_top_block): sca_tau = 150e-6 # compute FIR filter taps for SCA audio filter - audio_coeffs = gr.firdes.low_pass (1.0, # gain - sca_demod_rate, # sampling rate - max_sca_audio_freq, # cutoff freq - max_sca_audio_freq/2.5, # trans. band - gr.firdes.WIN_HAMMING) + audio_coeffs = filter.firdes.low_pass(1.0, # gain + sca_demod_rate, # sampling rate + max_sca_audio_freq, # cutoff freq + max_sca_audio_freq/2.5, # trans. band + filter.firdes.WIN_HAMMING) # input: float; output: float - self.audio_filter = gr.fir_filter_fff (audio_decim, audio_coeffs) + self.audio_filter = filter.fir_filter_fff(audio_decim, audio_coeffs) # Create deemphasis block that is applied after SCA demodulation - self.deemph = blks2.fm_deemph (audio_rate, sca_tau) + self.deemph = analog.fm_deemph(audio_rate, sca_tau) self.volume_control = gr.multiply_const_ff(self.vol) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), - options.audio_output, - False) # ok_to_block + self.audio_sink = audio.sink(int (audio_rate), + options.audio_output, + False) # ok_to_block # now wire it all together - self.connect (self.u, self.chan_filt, self.fm_demod, - self.ddc, self.fm_demod_sca) - self.connect (self.fm_demod_sca, self.audio_filter, - self.deemph, self.volume_control, - self.audio_sink) + self.connect(self.u, self.chan_filt, self.fm_demod, + self.ddc, self.fm_demod_sca) + self.connect(self.fm_demod_sca, self.audio_filter, + self.deemph, self.volume_control, + self.audio_sink) self._build_gui(vbox, usrp_rate, demod_rate, sca_demod_rate, audio_rate) diff --git a/gr-uhd/examples/python/usrp_wxapt_rcv.py b/gr-uhd/examples/python/usrp_wxapt_rcv.py index 5cceca1e98..ef774e2a07 100755 --- a/gr-uhd/examples/python/usrp_wxapt_rcv.py +++ b/gr-uhd/examples/python/usrp_wxapt_rcv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2005-2007,2011 Free Software Foundation, Inc. +# Copyright 2005-2007,2011,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,7 +20,9 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, audio, blks2, uhd +from gnuradio import gr, audio, uhd +from gnuradio import filter +from gnuradio import analog from gnuradio.eng_option import eng_option from gnuradio.wxgui import slider, powermate from gnuradio.wxgui import stdgui2, fftsink2, form @@ -88,24 +90,24 @@ class wxapt_rx_block (stdgui2.std_top_block): dev_rate = self.u.get_samp_rate() nfilts = 32 - chan_coeffs = gr.firdes.low_pass_2 (nfilts, # gain - nfilts*usrp_rate, # sampling rate - 40e3, # passband cutoff - 20e3, # transition bw - 60) # stopband attenuation + chan_coeffs = filter.firdes.low_pass_2(nfilts, # gain + nfilts*usrp_rate, # sampling rate + 40e3, # passband cutoff + 20e3, # transition bw + 60) # stopband attenuation rrate = usrp_rate / dev_rate - self.chan_filt = blks2.pfb_arb_resampler_ccf(rrate, chan_coeffs, nfilts) + self.chan_filt = filter.pfb.arb_resampler_ccf(rrate, chan_coeffs, nfilts) - self.guts = blks2.wfm_rcv (demod_rate, audio_decim) + self.guts = analog.wfm_rcv(demod_rate, audio_decim) self.volume_control = gr.multiply_const_ff(self.vol) # sound card as final sink - self.audio_sink = audio.sink (int (audio_rate), options.audio_output) + self.audio_sink = audio.sink(int (audio_rate), options.audio_output) # now wire it all together - self.connect (self.u, self.chan_filt, self.guts, - self.volume_control, self.audio_sink) + self.connect(self.u, self.chan_filt, self.guts, + self.volume_control, self.audio_sink) self._build_gui(vbox, usrp_rate, demod_rate, audio_rate) diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc index 6c1688ea07..6216c94a83 100644 --- a/gr-uhd/lib/gr_uhd_usrp_sink.cc +++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc @@ -389,8 +389,8 @@ public: else if (pmt::pmt_equal(key, TIME_KEY)){ _metadata.has_time_spec = true; _metadata.time_spec = uhd::time_spec_t( - pmt::pmt_to_uint64(pmt_tuple_ref(value, 0)), - pmt::pmt_to_double(pmt_tuple_ref(value, 1)) + pmt::pmt_to_uint64(pmt::pmt_tuple_ref(value, 0)), + pmt::pmt_to_double(pmt::pmt_tuple_ref(value, 1)) ); } } diff --git a/gr-video-sdl/src/CMakeLists.txt b/gr-video-sdl/src/CMakeLists.txt index a5c5b8cbd2..0a8c83168c 100644 --- a/gr-video-sdl/src/CMakeLists.txt +++ b/gr-video-sdl/src/CMakeLists.txt @@ -109,6 +109,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-video-sdl/src ) set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-video-sdl) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING AND ENABLE_PYTHON) diff --git a/gr-vocoder/python/CMakeLists.txt b/gr-vocoder/python/CMakeLists.txt index 32f69f2b69..7599aea53f 100644 --- a/gr-vocoder/python/CMakeLists.txt +++ b/gr-vocoder/python/CMakeLists.txt @@ -45,6 +45,8 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-vocoder/swig ${CMAKE_BINARY_DIR}/gr-filter/python ${CMAKE_BINARY_DIR}/gr-filter/swig + ${CMAKE_BINARY_DIR}/gr-analog/python + ${CMAKE_BINARY_DIR}/gr-analog/swig ) set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-vocoder) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) diff --git a/gr-vocoder/python/qa_cvsd_vocoder.py b/gr-vocoder/python/qa_cvsd_vocoder.py index 573e6a1302..fc7ba35249 100755 --- a/gr-vocoder/python/qa_cvsd_vocoder.py +++ b/gr-vocoder/python/qa_cvsd_vocoder.py @@ -95,7 +95,9 @@ class test_cvsd_vocoder (gr_unittest.TestCase): -0.16035343706607819, 0.014823081903159618, 0.16282452642917633, 0.33802291750907898) - src = gr.sig_source_f(sample_rate, gr.GR_SIN_WAVE, 200, 1, 0) + # WARNING: not importing analog in this QA code. + # If we enable this, we can probably just create a sin with numpy. + src = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 200, 1, 0) head = gr.head(gr.sizeof_float, 100) src_scale = gr.multiply_const_ff(scale_factor) diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt index a488c47e91..8d7ac65f7b 100644 --- a/gr-wavelet/CMakeLists.txt +++ b/gr-wavelet/CMakeLists.txt @@ -32,6 +32,7 @@ include(GrComponent) GR_REGISTER_COMPONENT("gr-wavelet" ENABLE_GR_WAVELET Boost_FOUND ENABLE_GR_CORE + ENABLE_GR_ANALOG GSL_FOUND ) diff --git a/gr-wavelet/python/CMakeLists.txt b/gr-wavelet/python/CMakeLists.txt index f118683954..a884c58052 100644 --- a/gr-wavelet/python/CMakeLists.txt +++ b/gr-wavelet/python/CMakeLists.txt @@ -40,6 +40,8 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig ${CMAKE_BINARY_DIR}/gr-wavelet/python ${CMAKE_BINARY_DIR}/gr-wavelet/swig + ${CMAKE_BINARY_DIR}/gr-analog/python + ${CMAKE_BINARY_DIR}/gr-analog/swig ) set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-wavelet) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) diff --git a/gr-wavelet/python/qa_classify.py b/gr-wavelet/python/qa_classify.py index 5701bce8c1..0906761aca 100755 --- a/gr-wavelet/python/qa_classify.py +++ b/gr-wavelet/python/qa_classify.py @@ -26,6 +26,7 @@ import copy #import pygsl.wavelet as wavelet # FIXME: pygsl not checked for in config import math import wavelet_swig +import analog_swig as analog def sqr(x): return x*x @@ -66,7 +67,7 @@ class test_classify(gr_unittest.TestCase): trg_data = src_data * 0.5 src = gr.vector_source_f(src_data) dst = gr.vector_sink_f() - rail = gr.rail_ff(-0.5, 0.5) + rail = analog.rail_ff(-0.5, 0.5) self.tb.connect(src, rail) self.tb.connect(rail, dst) self.tb.run() diff --git a/gr-wxgui/CMakeLists.txt b/gr-wxgui/CMakeLists.txt index ab00489065..ff8752667a 100644 --- a/gr-wxgui/CMakeLists.txt +++ b/gr-wxgui/CMakeLists.txt @@ -40,6 +40,7 @@ GR_REGISTER_COMPONENT("gr-wxgui" ENABLE_GR_WXGUI ENABLE_GR_CORE ENABLE_GR_FFT ENABLE_GR_FILTER + ENABLE_GR_ANALOG ENABLE_PYTHON ${wxgui_python_deps} ) diff --git a/gr-wxgui/src/python/fftsink_gl.py b/gr-wxgui/src/python/fftsink_gl.py index 72659b8fa4..931cf5c725 100644 --- a/gr-wxgui/src/python/fftsink_gl.py +++ b/gr-wxgui/src/python/fftsink_gl.py @@ -1,5 +1,5 @@ # -# Copyright 2008,2009,2010 Free Software Foundation, Inc. +# Copyright 2008-2010,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,6 +27,7 @@ from __future__ import division import fft_window import common from gnuradio import gr, fft +from gnuradio import analog from pubsub import pubsub from constants import * import math @@ -150,7 +151,7 @@ from gnuradio.wxgui import stdgui2 class test_app_block (stdgui2.std_top_block): def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv) + stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) fft_size = 256 @@ -158,44 +159,44 @@ class test_app_block (stdgui2.std_top_block): input_rate = 2048.0e3 #Generate some noise - noise =gr.noise_source_c(gr.GR_UNIFORM, 1.0/10) + noise = analog.noise_source_c(analog.GR_UNIFORM, 1.0/10) # Generate a complex sinusoid - #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 2e3, 1) - src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 57.50e3, 1) + #src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 2e3, 1) + src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 57.50e3, 1) # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) - sink1 = fft_sink_c (panel, title="Complex Data", fft_size=fft_size, - sample_rate=input_rate, baseband_freq=100e3, - ref_level=0, y_per_div=20, y_divs=10) - vbox.Add (sink1.win, 1, wx.EXPAND) + sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size, + sample_rate=input_rate, baseband_freq=100e3, + ref_level=0, y_per_div=20, y_divs=10) + vbox.Add(sink1.win, 1, wx.EXPAND) - combine1=gr.add_cc() + combine1 = gr.add_cc() self.connect(src1, (combine1,0)) self.connect(noise,(combine1,1)) self.connect(combine1,thr1, sink1) - #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1) - src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 57.50e3, 1) + #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1) + src2 = analog.sig_source_f (input_rate, analog.GR_CONST_WAVE, 57.50e3, 1) thr2 = gr.throttle(gr.sizeof_float, input_rate) - sink2 = fft_sink_f (panel, title="Real Data", fft_size=fft_size*2, - sample_rate=input_rate, baseband_freq=100e3, - ref_level=0, y_per_div=20, y_divs=10) - vbox.Add (sink2.win, 1, wx.EXPAND) + sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2, + sample_rate=input_rate, baseband_freq=100e3, + ref_level=0, y_per_div=20, y_divs=10) + vbox.Add(sink2.win, 1, wx.EXPAND) - combine2=gr.add_ff() - c2f2=gr.complex_to_float() + combine2 = gr.add_ff() + c2f2 = gr.complex_to_float() self.connect(src2, (combine2,0)) self.connect(noise,c2f2,(combine2,1)) self.connect(combine2, thr2,sink2) def main (): - app = stdgui2.stdapp (test_app_block, "FFT Sink Test App") - app.MainLoop () + app = stdgui2.stdapp(test_app_block, "FFT Sink Test App") + app.MainLoop() if __name__ == '__main__': - main () + main() diff --git a/gr-wxgui/src/python/fftsink_nongl.py b/gr-wxgui/src/python/fftsink_nongl.py index 1f91a976aa..bc634b5cc7 100644 --- a/gr-wxgui/src/python/fftsink_nongl.py +++ b/gr-wxgui/src/python/fftsink_nongl.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2003,2004,2005,2006,2007,2009,2010 Free Software Foundation, Inc. +# Copyright 2003-2007,2009,2010,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, gru, window, fft, filter +from gnuradio import analog from gnuradio.wxgui import stdgui2 import wx import plot @@ -604,33 +605,33 @@ class test_app_block (stdgui2.std_top_block): input_rate = 100*20.48e3 # Generate a complex sinusoid - #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 100*2e3, 1) - src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 100*5.75e3, 1) + #src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 100*2e3, 1) + src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 100*5.75e3, 1) # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) - sink1 = fft_sink_c (panel, title="Complex Data", fft_size=fft_size, - sample_rate=input_rate, baseband_freq=100e3, - ref_level=0, y_per_div=20, y_divs=10) - vbox.Add (sink1.win, 1, wx.EXPAND) + sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size, + sample_rate=input_rate, baseband_freq=100e3, + ref_level=0, y_per_div=20, y_divs=10) + vbox.Add(sink1.win, 1, wx.EXPAND) self.connect(src1, thr1, sink1) - #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 100*2e3, 1) - src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 100*5.75e3, 1) + #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 100*2e3, 1) + src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 100*5.75e3, 1) thr2 = gr.throttle(gr.sizeof_float, input_rate) - sink2 = fft_sink_f (panel, title="Real Data", fft_size=fft_size*2, - sample_rate=input_rate, baseband_freq=100e3, - ref_level=0, y_per_div=20, y_divs=10) - vbox.Add (sink2.win, 1, wx.EXPAND) + sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2, + sample_rate=input_rate, baseband_freq=100e3, + ref_level=0, y_per_div=20, y_divs=10) + vbox.Add(sink2.win, 1, wx.EXPAND) self.connect(src2, thr2, sink2) def main (): - app = stdgui2.stdapp (test_app_block, "FFT Sink Test App") - app.MainLoop () + app = stdgui2.stdapp(test_app_block, "FFT Sink Test App") + app.MainLoop() if __name__ == '__main__': main () diff --git a/gr-wxgui/src/python/histosink_gl.py b/gr-wxgui/src/python/histosink_gl.py index 509f746be6..8d90204046 100644 --- a/gr-wxgui/src/python/histosink_gl.py +++ b/gr-wxgui/src/python/histosink_gl.py @@ -1,5 +1,5 @@ # -# Copyright 2009 Free Software Foundation, Inc. +# Copyright 2009,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,7 +24,8 @@ ################################################## import histo_window import common -from gnuradio import gr, blks2 +from gnuradio import gr +from gnuradio import analog from pubsub import pubsub from constants import * @@ -94,17 +95,17 @@ class test_app_block (stdgui2.std_top_block): # build our flow graph input_rate = 20.48e3 - src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1) - #src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1) + src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1) + #src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1) thr2 = gr.throttle(gr.sizeof_float, input_rate) - sink2 = histo_sink_f (panel, title="Data", num_bins=31, frame_size=1000) - vbox.Add (sink2.win, 1, wx.EXPAND) + sink2 = histo_sink_f(panel, title="Data", num_bins=31, frame_size=1000) + vbox.Add(sink2.win, 1, wx.EXPAND) self.connect(src2, thr2, sink2) def main (): - app = stdgui2.stdapp (test_app_block, "Histo Sink Test App") - app.MainLoop () + app = stdgui2.stdapp(test_app_block, "Histo Sink Test App") + app.MainLoop() if __name__ == '__main__': - main () + main() diff --git a/gr-wxgui/src/python/numbersink2.py b/gr-wxgui/src/python/numbersink2.py index 85e8927e36..f85d9c3ee1 100644 --- a/gr-wxgui/src/python/numbersink2.py +++ b/gr-wxgui/src/python/numbersink2.py @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,7 @@ import number_window import common from gnuradio import gr, blks2, filter +from gnuradio import analog from pubsub import pubsub from constants import * @@ -134,38 +135,38 @@ class number_sink_c(_number_sink_base): import wx from gnuradio.wxgui import stdgui2 -class test_app_flow_graph (stdgui2.std_top_block): +class test_app_flow_graph(stdgui2.std_top_block): def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv) + stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) # build our flow graph input_rate = 20.48e3 # Generate a real and complex sinusoids - src1 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2.21e3, 1) - src2 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 2.21e3, 1) + src1 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2.21e3, 1) + src2 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 2.21e3, 1) # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. thr1 = gr.throttle(gr.sizeof_float, input_rate) thr2 = gr.throttle(gr.sizeof_gr_complex, input_rate) - sink1 = number_sink_f (panel, unit='V',label="Real Data", avg_alpha=0.001, - sample_rate=input_rate, minval=-1, maxval=1, - ref_level=0, decimal_places=3) - vbox.Add (sink1.win, 1, wx.EXPAND) - sink2 = number_sink_c (panel, unit='V',label="Complex Data", avg_alpha=0.001, - sample_rate=input_rate, minval=-1, maxval=1, - ref_level=0, decimal_places=3) - vbox.Add (sink2.win, 1, wx.EXPAND) + sink1 = number_sink_f(panel, unit='V',label="Real Data", avg_alpha=0.001, + sample_rate=input_rate, minval=-1, maxval=1, + ref_level=0, decimal_places=3) + vbox.Add(sink1.win, 1, wx.EXPAND) + sink2 = number_sink_c(panel, unit='V',label="Complex Data", avg_alpha=0.001, + sample_rate=input_rate, minval=-1, maxval=1, + ref_level=0, decimal_places=3) + vbox.Add(sink2.win, 1, wx.EXPAND) - self.connect (src1, thr1, sink1) - self.connect (src2, thr2, sink2) + self.connect(src1, thr1, sink1) + self.connect(src2, thr2, sink2) def main (): - app = stdgui2.stdapp (test_app_flow_graph, "Number Sink Test App") - app.MainLoop () + app = stdgui2.stdapp(test_app_flow_graph, "Number Sink Test App") + app.MainLoop() if __name__ == '__main__': - main () + main() diff --git a/gr-wxgui/src/python/scopesink_gl.py b/gr-wxgui/src/python/scopesink_gl.py index ab07550397..51bc454f09 100644 --- a/gr-wxgui/src/python/scopesink_gl.py +++ b/gr-wxgui/src/python/scopesink_gl.py @@ -1,5 +1,5 @@ # -# Copyright 2008,2010 Free Software Foundation, Inc. +# Copyright 2008,2010,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -206,18 +206,20 @@ class test_top_block (stdgui2.std_top_block): # Generate a complex sinusoid ampl=1.0e3 - self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3*input_rate/default_input_rate, ampl) - self.noise =gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 11.1*25.1e3*input_rate/default_input_rate, ampl/10) - #self.noise =gr.noise_source_c(gr.GR_GAUSSIAN, ampl/10) - self.combine=gr.add_cc() + self.src0 = analog.sig_source_c(input_rate, gr.GR_SIN_WAVE, + 25.1e3*input_rate/default_input_rate, ampl) + self.noise = analog.sig_source_c (input_rate, analog.GR_SIN_WAVE, + 11.1*25.1e3*input_rate/default_input_rate, ampl/10) + #self.noise = analog.noise_source_c(analog.GR_GAUSSIAN, ampl/10) + self.combine = analog.add_cc() # We add this throttle block so that this demo doesn't suck down # all the CPU available. You normally wouldn't use it... self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate) - scope = scope_sink_c (panel,"Secret Data",sample_rate=input_rate, - v_scale=v_scale, t_scale=t_scale) - vbox.Add (scope.win, 1, wx.EXPAND) + scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate, + v_scale=v_scale, t_scale=t_scale) + vbox.Add(scope.win, 1, wx.EXPAND) # Ultimately this will be # self.connect("src0 throttle scope") @@ -226,8 +228,8 @@ class test_top_block (stdgui2.std_top_block): self.connect(self.combine, self.thr, scope) def main (): - app = stdgui2.stdapp (test_top_block, "O'Scope Test App") - app.MainLoop () + app = stdgui2.stdapp(test_top_block, "O'Scope Test App") + app.MainLoop() if __name__ == '__main__': - main () + main() diff --git a/gr-wxgui/src/python/scopesink_nongl.py b/gr-wxgui/src/python/scopesink_nongl.py index d45e799060..6351daa723 100644 --- a/gr-wxgui/src/python/scopesink_nongl.py +++ b/gr-wxgui/src/python/scopesink_nongl.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2003,2004,2006,2007 Free Software Foundation, Inc. +# Copyright 2003,2004,2006,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, gru, eng_notation +from gnuradio import analog from gnuradio.wxgui import stdgui2 import wx import gnuradio.wxgui.plot as plot @@ -45,7 +46,7 @@ class scope_sink_f(gr.hier_block2): for i in range(num_inputs): self.connect((self, i), (self.guts, i)) - self.win = scope_window(win_info (msgq, sample_rate, frame_decim, + self.win = scope_window(win_info(msgq, sample_rate, frame_decim, v_scale, t_scale, self.guts, title), parent) def set_sample_rate(self, sample_rate): @@ -66,8 +67,8 @@ class scope_sink_c(gr.hier_block2): for i in range(num_inputs): c2f = gr.complex_to_float() self.connect((self, i), c2f) - self.connect((c2f, 0), (self.guts, 2*i+0)) - self.connect((c2f, 1), (self.guts, 2*i+1)) + self.connect((c2f, 0),(self.guts, 2*i+0)) + self.connect((c2f, 1),(self.guts, 2*i+1)) self.win = scope_window(win_info(msgq, sample_rate, frame_decim, v_scale, t_scale, self.guts, title), parent) @@ -81,7 +82,7 @@ class constellation_sink(scope_sink_c): def __init__(self, parent, title='Constellation', sample_rate=1, size=default_scopesink_size, frame_decim=default_frame_decim): scope_sink_c.__init__(self, parent=parent, title=title, sample_rate=sample_rate, - size=size, frame_decim=frame_decim) + size=size, frame_decim=frame_decim) self.win.info.xy = True #constellation mode # ======================================================================== @@ -141,21 +142,21 @@ def EVT_DATA_EVENT(win, func): class DataEvent(wx.PyEvent): def __init__(self, data): wx.PyEvent.__init__(self) - self.SetEventType (wxDATA_EVENT) + self.SetEventType(wxDATA_EVENT) self.data = data - def Clone (self): - self.__class__ (self.GetId()) + def Clone(self): + self.__class__(self.GetId()) -class win_info (object): +class win_info(object): __slots__ = ['msgq', 'sample_rate', 'frame_decim', 'v_scale', 'scopesink', 'title', 'time_scale_cursor', 'v_scale_cursor', 'marker', 'xy', 'autorange', 'running'] - def __init__ (self, msgq, sample_rate, frame_decim, v_scale, t_scale, - scopesink, title = "Oscilloscope", xy=False): + def __init__(self, msgq, sample_rate, frame_decim, v_scale, t_scale, + scopesink, title = "Oscilloscope", xy=False): self.msgq = msgq self.sample_rate = sample_rate self.frame_decim = frame_decim @@ -170,30 +171,30 @@ class win_info (object): self.autorange = not v_scale self.running = True - def get_time_per_div (self): - return self.time_scale_cursor.current () + def get_time_per_div(self): + return self.time_scale_cursor.current() - def get_volts_per_div (self): - return self.v_scale_cursor.current () + def get_volts_per_div(self): + return self.v_scale_cursor.current() def set_sample_rate(self, sample_rate): self.sample_rate = sample_rate - def get_sample_rate (self): + def get_sample_rate(self): return self.sample_rate - def get_decimation_rate (self): + def get_decimation_rate(self): return 1.0 - def set_marker (self, s): + def set_marker(self, s): self.marker = s - def get_marker (self): + def get_marker(self): return self.marker -class input_watcher (gru.msgq_runner): - def __init__ (self, msgq, event_receiver, frame_decim, **kwds): +class input_watcher(gru.msgq_runner): + def __init__(self, msgq, event_receiver, frame_decim, **kwds): self.event_receiver = event_receiver self.frame_decim = frame_decim self.iscan = 0 @@ -211,166 +212,166 @@ class input_watcher (gru.msgq_runner): bytes_per_chan = nsamples * gr.sizeof_float records = [] - for ch in range (nchan): + for ch in range(nchan): start = ch * bytes_per_chan chan_data = s[start:start+bytes_per_chan] - rec = numpy.fromstring (chan_data, numpy.float32) - records.append (rec) + rec = numpy.fromstring(chan_data, numpy.float32) + records.append(rec) # print "nrecords = %d, reclen = %d" % (len (records),nsamples) - de = DataEvent (records) - wx.PostEvent (self.event_receiver, de) + de = DataEvent(records) + wx.PostEvent(self.event_receiver, de) records = [] del de self.iscan -= 1 -class scope_window (wx.Panel): +class scope_window(wx.Panel): - def __init__ (self, info, parent, id = -1, - pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""): - wx.Panel.__init__ (self, parent, -1) + def __init__(self, info, parent, id = -1, + pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""): + wx.Panel.__init__(self, parent, -1) self.info = info - vbox = wx.BoxSizer (wx.VERTICAL) + vbox = wx.BoxSizer(wx.VERTICAL) - self.graph = graph_window (info, self, -1) + self.graph = graph_window(info, self, -1) - vbox.Add (self.graph, 1, wx.EXPAND) - vbox.Add (self.make_control_box(), 0, wx.EXPAND) - vbox.Add (self.make_control2_box(), 0, wx.EXPAND) + vbox.Add(self.graph, 1, wx.EXPAND) + vbox.Add(self.make_control_box(), 0, wx.EXPAND) + vbox.Add(self.make_control2_box(), 0, wx.EXPAND) self.sizer = vbox - self.SetSizer (self.sizer) - self.SetAutoLayout (True) - self.sizer.Fit (self) + self.SetSizer(self.sizer) + self.SetAutoLayout(True) + self.sizer.Fit(self) self.set_autorange(self.info.autorange) # second row of control buttons etc. appears BELOW control_box - def make_control2_box (self): - ctrlbox = wx.BoxSizer (wx.HORIZONTAL) + def make_control2_box(self): + ctrlbox = wx.BoxSizer(wx.HORIZONTAL) - self.inc_v_button = wx.Button (self, 1101, " < ", style=wx.BU_EXACTFIT) - self.inc_v_button.SetToolTipString ("Increase vertical range") - wx.EVT_BUTTON (self, 1101, self.incr_v_scale) # ID matches button ID above + self.inc_v_button = wx.Button(self, 1101, " < ", style=wx.BU_EXACTFIT) + self.inc_v_button.SetToolTipString("Increase vertical range") + wx.EVT_BUTTON(self, 1101, self.incr_v_scale) # ID matches button ID above - self.dec_v_button = wx.Button (self, 1100, " > ", style=wx.BU_EXACTFIT) - self.dec_v_button.SetToolTipString ("Decrease vertical range") - wx.EVT_BUTTON (self, 1100, self.decr_v_scale) + self.dec_v_button = wx.Button(self, 1100, " > ", style=wx.BU_EXACTFIT) + self.dec_v_button.SetToolTipString("Decrease vertical range") + wx.EVT_BUTTON(self, 1100, self.decr_v_scale) - self.v_scale_label = wx.StaticText (self, 1002, "None") # vertical /div - self.update_v_scale_label () + self.v_scale_label = wx.StaticText(self, 1002, "None") # vertical /div + self.update_v_scale_label() - self.autorange_checkbox = wx.CheckBox (self, 1102, "Autorange") - self.autorange_checkbox.SetToolTipString ("Select autorange on/off") + self.autorange_checkbox = wx.CheckBox(self, 1102, "Autorange") + self.autorange_checkbox.SetToolTipString("Select autorange on/off") wx.EVT_CHECKBOX(self, 1102, self.autorange_checkbox_event) - ctrlbox.Add ((5,0) ,0) # left margin space - ctrlbox.Add (self.inc_v_button, 0, wx.EXPAND) - ctrlbox.Add (self.dec_v_button, 0, wx.EXPAND) - ctrlbox.Add (self.v_scale_label, 0, wx.ALIGN_CENTER) - ctrlbox.Add ((20,0) ,0) # spacer - ctrlbox.Add (self.autorange_checkbox, 0, wx.ALIGN_CENTER) + ctrlbox.Add((5,0) ,0) # left margin space + ctrlbox.Add(self.inc_v_button, 0, wx.EXPAND) + ctrlbox.Add(self.dec_v_button, 0, wx.EXPAND) + ctrlbox.Add(self.v_scale_label, 0, wx.ALIGN_CENTER) + ctrlbox.Add((20,0) ,0) # spacer + ctrlbox.Add(self.autorange_checkbox, 0, wx.ALIGN_CENTER) return ctrlbox - def make_control_box (self): - ctrlbox = wx.BoxSizer (wx.HORIZONTAL) + def make_control_box(self): + ctrlbox = wx.BoxSizer(wx.HORIZONTAL) - tb_left = wx.Button (self, 1001, " < ", style=wx.BU_EXACTFIT) - tb_left.SetToolTipString ("Increase time base") - wx.EVT_BUTTON (self, 1001, self.incr_timebase) + tb_left = wx.Button(self, 1001, " < ", style=wx.BU_EXACTFIT) + tb_left.SetToolTipString("Increase time base") + wx.EVT_BUTTON(self, 1001, self.incr_timebase) - tb_right = wx.Button (self, 1000, " > ", style=wx.BU_EXACTFIT) - tb_right.SetToolTipString ("Decrease time base") - wx.EVT_BUTTON (self, 1000, self.decr_timebase) + tb_right = wx.Button(self, 1000, " > ", style=wx.BU_EXACTFIT) + tb_right.SetToolTipString("Decrease time base") + wx.EVT_BUTTON(self, 1000, self.decr_timebase) - self.time_base_label = wx.StaticText (self, 1002, "") - self.update_timebase_label () + self.time_base_label = wx.StaticText(self, 1002, "") + self.update_timebase_label() - ctrlbox.Add ((5,0) ,0) - # ctrlbox.Add (wx.StaticText (self, -1, "Horiz Scale: "), 0, wx.ALIGN_CENTER) - ctrlbox.Add (tb_left, 0, wx.EXPAND) - ctrlbox.Add (tb_right, 0, wx.EXPAND) - ctrlbox.Add (self.time_base_label, 0, wx.ALIGN_CENTER) + ctrlbox.Add((5,0) ,0) + # ctrlbox.Add(wx.StaticText(self, -1, "Horiz Scale: "), 0, wx.ALIGN_CENTER) + ctrlbox.Add(tb_left, 0, wx.EXPAND) + ctrlbox.Add(tb_right, 0, wx.EXPAND) + ctrlbox.Add(self.time_base_label, 0, wx.ALIGN_CENTER) - ctrlbox.Add ((10,0) ,1) # stretchy space + ctrlbox.Add((10,0) ,1) # stretchy space - ctrlbox.Add (wx.StaticText (self, -1, "Trig: "), 0, wx.ALIGN_CENTER) - self.trig_chan_choice = wx.Choice (self, 1004, - choices = ['Ch1', 'Ch2', 'Ch3', 'Ch4']) - self.trig_chan_choice.SetToolTipString ("Select channel for trigger") - wx.EVT_CHOICE (self, 1004, self.trig_chan_choice_event) - ctrlbox.Add (self.trig_chan_choice, 0, wx.ALIGN_CENTER) + ctrlbox.Add(wx.StaticText(self, -1, "Trig: "), 0, wx.ALIGN_CENTER) + self.trig_chan_choice = wx.Choice(self, 1004, + choices = ['Ch1', 'Ch2', 'Ch3', 'Ch4']) + self.trig_chan_choice.SetToolTipString("Select channel for trigger") + wx.EVT_CHOICE(self, 1004, self.trig_chan_choice_event) + ctrlbox.Add(self.trig_chan_choice, 0, wx.ALIGN_CENTER) - self.trig_mode_choice = wx.Choice (self, 1005, - choices = ['Free', 'Auto', 'Norm']) + self.trig_mode_choice = wx.Choice(self, 1005, + choices = ['Free', 'Auto', 'Norm']) self.trig_mode_choice.SetSelection(1) - self.trig_mode_choice.SetToolTipString ("Select trigger slope or Auto (untriggered roll)") - wx.EVT_CHOICE (self, 1005, self.trig_mode_choice_event) - ctrlbox.Add (self.trig_mode_choice, 0, wx.ALIGN_CENTER) + self.trig_mode_choice.SetToolTipString("Select trigger slope or Auto (untriggered roll)") + wx.EVT_CHOICE(self, 1005, self.trig_mode_choice_event) + ctrlbox.Add(self.trig_mode_choice, 0, wx.ALIGN_CENTER) - trig_level50 = wx.Button (self, 1006, "50%") - trig_level50.SetToolTipString ("Set trigger level to 50%") - wx.EVT_BUTTON (self, 1006, self.set_trig_level50) - ctrlbox.Add (trig_level50, 0, wx.EXPAND) + trig_level50 = wx.Button(self, 1006, "50%") + trig_level50.SetToolTipString("Set trigger level to 50%") + wx.EVT_BUTTON(self, 1006, self.set_trig_level50) + ctrlbox.Add(trig_level50, 0, wx.EXPAND) - run_stop = wx.Button (self, 1007, "Run/Stop") - run_stop.SetToolTipString ("Toggle Run/Stop mode") - wx.EVT_BUTTON (self, 1007, self.run_stop) - ctrlbox.Add (run_stop, 0, wx.EXPAND) + run_stop = wx.Button(self, 1007, "Run/Stop") + run_stop.SetToolTipString("Toggle Run/Stop mode") + wx.EVT_BUTTON(self, 1007, self.run_stop) + ctrlbox.Add(run_stop, 0, wx.EXPAND) - ctrlbox.Add ((10, 0) ,1) # stretchy space + ctrlbox.Add((10, 0) ,1) # stretchy space - ctrlbox.Add (wx.StaticText (self, -1, "Fmt: "), 0, wx.ALIGN_CENTER) - self.marker_choice = wx.Choice (self, 1002, choices = self._marker_choices) - self.marker_choice.SetToolTipString ("Select plotting with lines, pluses or dots") - wx.EVT_CHOICE (self, 1002, self.marker_choice_event) - ctrlbox.Add (self.marker_choice, 0, wx.ALIGN_CENTER) + ctrlbox.Add(wx.StaticText(self, -1, "Fmt: "), 0, wx.ALIGN_CENTER) + self.marker_choice = wx.Choice(self, 1002, choices = self._marker_choices) + self.marker_choice.SetToolTipString("Select plotting with lines, pluses or dots") + wx.EVT_CHOICE(self, 1002, self.marker_choice_event) + ctrlbox.Add(self.marker_choice, 0, wx.ALIGN_CENTER) - self.xy_choice = wx.Choice (self, 1003, choices = ['X:t', 'X:Y']) - self.xy_choice.SetToolTipString ("Select X vs time or X vs Y display") - wx.EVT_CHOICE (self, 1003, self.xy_choice_event) - ctrlbox.Add (self.xy_choice, 0, wx.ALIGN_CENTER) + self.xy_choice = wx.Choice(self, 1003, choices = ['X:t', 'X:Y']) + self.xy_choice.SetToolTipString("Select X vs time or X vs Y display") + wx.EVT_CHOICE(self, 1003, self.xy_choice_event) + ctrlbox.Add(self.xy_choice, 0, wx.ALIGN_CENTER) return ctrlbox _marker_choices = ['line', 'plus', 'dot'] - def update_timebase_label (self): - time_per_div = self.info.get_time_per_div () - s = ' ' + eng_notation.num_to_str (time_per_div) + 's/div' - self.time_base_label.SetLabel (s) + def update_timebase_label(self): + time_per_div = self.info.get_time_per_div() + s = ' ' + eng_notation.num_to_str(time_per_div) + 's/div' + self.time_base_label.SetLabel(s) - def decr_timebase (self, evt): - self.info.time_scale_cursor.prev () - self.update_timebase_label () + def decr_timebase(self, evt): + self.info.time_scale_cursor.prev() + self.update_timebase_label() - def incr_timebase (self, evt): - self.info.time_scale_cursor.next () - self.update_timebase_label () + def incr_timebase(self, evt): + self.info.time_scale_cursor.next() + self.update_timebase_label() - def update_v_scale_label (self): - volts_per_div = self.info.get_volts_per_div () - s = ' ' + eng_notation.num_to_str (volts_per_div) + '/div' # Not V/div - self.v_scale_label.SetLabel (s) + def update_v_scale_label(self): + volts_per_div = self.info.get_volts_per_div() + s = ' ' + eng_notation.num_to_str(volts_per_div) + '/div' # Not V/div + self.v_scale_label.SetLabel(s) - def decr_v_scale (self, evt): - self.info.v_scale_cursor.prev () - self.update_v_scale_label () + def decr_v_scale(self, evt): + self.info.v_scale_cursor.prev() + self.update_v_scale_label() - def incr_v_scale (self, evt): - self.info.v_scale_cursor.next () - self.update_v_scale_label () + def incr_v_scale(self, evt): + self.info.v_scale_cursor.next() + self.update_v_scale_label() - def marker_choice_event (self, evt): - s = evt.GetString () - self.set_marker (s) + def marker_choice_event(self, evt): + s = evt.GetString() + self.set_marker(s) def set_autorange(self, on): if on: @@ -395,64 +396,64 @@ class scope_window (wx.Panel): else: self.set_autorange(False) - def set_marker (self, s): - self.info.set_marker (s) # set info for drawing routines - i = self.marker_choice.FindString (s) + def set_marker(self, s): + self.info.set_marker(s) # set info for drawing routines + i = self.marker_choice.FindString(s) assert i >= 0, "Hmmm, set_marker problem" - self.marker_choice.SetSelection (i) + self.marker_choice.SetSelection(i) - def set_format_line (self): - self.set_marker ('line') + def set_format_line(self): + self.set_marker('line') - def set_format_dot (self): - self.set_marker ('dot') + def set_format_dot(self): + self.set_marker('dot') - def set_format_plus (self): - self.set_marker ('plus') + def set_format_plus(self): + self.set_marker('plus') - def xy_choice_event (self, evt): - s = evt.GetString () + def xy_choice_event(self, evt): + s = evt.GetString() self.info.xy = s == 'X:Y' - def trig_chan_choice_event (self, evt): - s = evt.GetString () - ch = int (s[-1]) - 1 - self.info.scopesink.set_trigger_channel (ch) + def trig_chan_choice_event(self, evt): + s = evt.GetString() + ch = int(s[-1]) - 1 + self.info.scopesink.set_trigger_channel(ch) - def trig_mode_choice_event (self, evt): + def trig_mode_choice_event(self, evt): sink = self.info.scopesink - s = evt.GetString () + s = evt.GetString() if s == 'Norm': - sink.set_trigger_mode (gr.gr_TRIG_MODE_NORM) + sink.set_trigger_mode(gr.gr_TRIG_MODE_NORM) elif s == 'Auto': - sink.set_trigger_mode (gr.gr_TRIG_MODE_AUTO) + sink.set_trigger_mode(gr.gr_TRIG_MODE_AUTO) elif s == 'Free': - sink.set_trigger_mode (gr.gr_TRIG_MODE_FREE) + sink.set_trigger_mode(gr.gr_TRIG_MODE_FREE) else: assert 0, "Bad trig_mode_choice string" - def set_trig_level50 (self, evt): - self.info.scopesink.set_trigger_level_auto () + def set_trig_level50(self, evt): + self.info.scopesink.set_trigger_level_auto() - def run_stop (self, evt): + def run_stop(self, evt): self.info.running = not self.info.running -class graph_window (plot.PlotCanvas): +class graph_window(plot.PlotCanvas): channel_colors = ['BLUE', 'RED', 'CYAN', 'MAGENTA', 'GREEN', 'YELLOW'] - def __init__ (self, info, parent, id = -1, + def __init__(self, info, parent, id = -1, pos = wx.DefaultPosition, size = (640, 240), style = wx.DEFAULT_FRAME_STYLE, name = ""): - plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name) + plot.PlotCanvas.__init__(self, parent, id, pos, size, style, name) - self.SetXUseScopeTicks (True) - self.SetEnableGrid (True) - self.SetEnableZoom (True) + self.SetXUseScopeTicks(True) + self.SetEnableGrid(True) + self.SetEnableZoom(True) self.SetEnableLegend(True) - # self.SetBackgroundColour ('black') + # self.SetBackgroundColour('black') self.info = info; self.y_range = None @@ -462,38 +463,38 @@ class graph_window (plot.PlotCanvas): self.avg_x_min = None self.avg_x_max = None - EVT_DATA_EVENT (self, self.format_data) + EVT_DATA_EVENT(self, self.format_data) - self.input_watcher = input_watcher (info.msgq, self, info.frame_decim) + self.input_watcher = input_watcher(info.msgq, self, info.frame_decim) - def channel_color (self, ch): + def channel_color(self, ch): return self.channel_colors[ch % len(self.channel_colors)] - def format_data (self, evt): + def format_data(self, evt): if not self.info.running: return if self.info.xy: - self.format_xy_data (evt) + self.format_xy_data(evt) return info = self.info records = evt.data - nchannels = len (records) - npoints = len (records[0]) + nchannels = len(records) + npoints = len(records[0]) objects = [] - Ts = 1.0 / (info.get_sample_rate () / info.get_decimation_rate ()) - x_vals = Ts * numpy.arange (-npoints/2, npoints/2) + Ts = 1.0 / (info.get_sample_rate() / info.get_decimation_rate()) + x_vals = Ts * numpy.arange(-npoints/2, npoints/2) # preliminary clipping based on time axis here, instead of in graphics code - time_per_window = self.info.get_time_per_div () * 10 - n = int (time_per_window / Ts + 0.5) + time_per_window = self.info.get_time_per_div() * 10 + n = int(time_per_window / Ts + 0.5) n = n & ~0x1 # make even - n = max (2, min (n, npoints)) + n = max(2, min(n, npoints)) - self.SetXUseScopeTicks (True) # use 10 divisions, no labels + self.SetXUseScopeTicks(True) # use 10 divisions, no labels for ch in range(nchannels): r = records[ch] @@ -502,74 +503,74 @@ class graph_window (plot.PlotCanvas): lb = npoints/2 - n/2 ub = npoints/2 + n/2 - # points = zip (x_vals[lb:ub], r[lb:ub]) - points = numpy.zeros ((ub-lb, 2), numpy.float64) + # points = zip(x_vals[lb:ub], r[lb:ub]) + points = numpy.zeros((ub-lb, 2), numpy.float64) points[:,0] = x_vals[lb:ub] points[:,1] = r[lb:ub] - m = info.get_marker () + m = info.get_marker() if m == 'line': - objects.append (plot.PolyLine (points, - colour=self.channel_color (ch), - legend=('Ch%d' % (ch+1,)))) + objects.append(plot.PolyLine(points, + colour=self.channel_color(ch), + legend=('Ch%d' % (ch+1,)))) else: - objects.append (plot.PolyMarker (points, - marker=m, - colour=self.channel_color (ch), - legend=('Ch%d' % (ch+1,)))) + objects.append(plot.PolyMarker(points, + marker=m, + colour=self.channel_color(ch), + legend=('Ch%d' % (ch+1,)))) - graphics = plot.PlotGraphics (objects, - title=self.info.title, - xLabel = '', yLabel = '') + graphics = plot.PlotGraphics(objects, + title=self.info.title, + xLabel = '', yLabel = '') - time_per_div = info.get_time_per_div () + time_per_div = info.get_time_per_div() x_range = (-5.0 * time_per_div, 5.0 * time_per_div) # ranges are tuples! - volts_per_div = info.get_volts_per_div () + volts_per_div = info.get_volts_per_div() if not self.info.autorange: self.y_range = (-4.0 * volts_per_div, 4.0 * volts_per_div) - self.Draw (graphics, xAxis=x_range, yAxis=self.y_range) - self.update_y_range () # autorange to self.y_range + self.Draw(graphics, xAxis=x_range, yAxis=self.y_range) + self.update_y_range() # autorange to self.y_range - def format_xy_data (self, evt): + def format_xy_data(self, evt): info = self.info records = evt.data - nchannels = len (records) - npoints = len (records[0]) + nchannels = len(records) + npoints = len(records[0]) if nchannels < 2: return objects = [] - # points = zip (records[0], records[1]) - points = numpy.zeros ((len(records[0]), 2), numpy.float32) + # points = zip(records[0], records[1]) + points = numpy.zeros((len(records[0]), 2), numpy.float32) points[:,0] = records[0] points[:,1] = records[1] - self.SetXUseScopeTicks (False) + self.SetXUseScopeTicks(False) - m = info.get_marker () + m = info.get_marker() if m == 'line': - objects.append (plot.PolyLine (points, - colour=self.channel_color (0))) + objects.append(plot.PolyLine(points, + colour=self.channel_color(0))) else: - objects.append (plot.PolyMarker (points, - marker=m, - colour=self.channel_color (0))) + objects.append(plot.PolyMarker(points, + marker=m, + colour=self.channel_color(0))) - graphics = plot.PlotGraphics (objects, - title=self.info.title, - xLabel = 'I', yLabel = 'Q') + graphics = plot.PlotGraphics(objects, + title=self.info.title, + xLabel = 'I', yLabel = 'Q') - self.Draw (graphics, xAxis=self.x_range, yAxis=self.y_range) - self.update_y_range () - self.update_x_range () + self.Draw(graphics, xAxis=self.x_range, yAxis=self.y_range) + self.update_y_range() + self.update_x_range() - def update_y_range (self): + def update_y_range(self): alpha = 1.0/25 graphics = self.last_draw[0] - p1, p2 = graphics.boundingBox () # min, max points of graphics + p1, p2 = graphics.boundingBox() # min, max points of graphics if self.avg_y_min: # prevent vertical scale from jumping abruptly --? self.avg_y_min = p1[1] * alpha + self.avg_y_min * (1 - alpha) @@ -578,15 +579,15 @@ class graph_window (plot.PlotCanvas): self.avg_y_min = p1[1] # -500.0 workaround, sometimes p1 is ~ 10^35 self.avg_y_max = p2[1] # 500.0 - self.y_range = self._axisInterval ('auto', self.avg_y_min, self.avg_y_max) + self.y_range = self._axisInterval('auto', self.avg_y_min, self.avg_y_max) # print "p1 %s p2 %s y_min %s y_max %s y_range %s" \ # % (p1, p2, self.avg_y_min, self.avg_y_max, self.y_range) - def update_x_range (self): + def update_x_range(self): alpha = 1.0/25 graphics = self.last_draw[0] - p1, p2 = graphics.boundingBox () # min, max points of graphics + p1, p2 = graphics.boundingBox() # min, max points of graphics if self.avg_x_min: self.avg_x_min = p1[0] * alpha + self.avg_x_min * (1 - alpha) @@ -595,16 +596,16 @@ class graph_window (plot.PlotCanvas): self.avg_x_min = p1[0] self.avg_x_max = p2[0] - self.x_range = self._axisInterval ('auto', self.avg_x_min, self.avg_x_max) + self.x_range = self._axisInterval('auto', self.avg_x_min, self.avg_x_max) # ---------------------------------------------------------------- # Stand-alone test application # ---------------------------------------------------------------- -class test_top_block (stdgui2.std_top_block): +class test_top_block(stdgui2.std_top_block): def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv) + stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) if len(argv) > 1: frame_decim = int(argv[1]) @@ -626,26 +627,26 @@ class test_top_block (stdgui2.std_top_block): input_rate = 1e6 # Generate a complex sinusoid - self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3, 1e3) + self.src0 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 25.1e3, 1e3) # We add this throttle block so that this demo doesn't suck down # all the CPU available. You normally wouldn't use it... self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate) - scope = scope_sink_c (panel,"Secret Data",sample_rate=input_rate, - frame_decim=frame_decim, - v_scale=v_scale, t_scale=t_scale) - vbox.Add (scope.win, 1, wx.EXPAND) + scope = scope_sink_c(panel,"Secret Data",sample_rate=input_rate, + frame_decim=frame_decim, + v_scale=v_scale, t_scale=t_scale) + vbox.Add(scope.win, 1, wx.EXPAND) # Ultimately this will be # self.connect("src0 throttle scope") self.connect(self.src0, self.thr, scope) -def main (): - app = stdgui2.stdapp (test_top_block, "O'Scope Test App") - app.MainLoop () +def main(): + app = stdgui2.stdapp(test_top_block, "O'Scope Test App") + app.MainLoop() if __name__ == '__main__': - main () + main() # ---------------------------------------------------------------- diff --git a/gr-wxgui/src/python/waterfallsink_gl.py b/gr-wxgui/src/python/waterfallsink_gl.py index b17f292875..050bbb5924 100644 --- a/gr-wxgui/src/python/waterfallsink_gl.py +++ b/gr-wxgui/src/python/waterfallsink_gl.py @@ -1,5 +1,5 @@ # -# Copyright 2008,2009 Free Software Foundation, Inc. +# Copyright 2008,2009,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,7 @@ import waterfall_window import common from gnuradio import gr, fft +from gnuradio import analog from pubsub import pubsub from constants import * @@ -133,9 +134,9 @@ class waterfall_sink_c(_waterfall_sink_base): import wx from gnuradio.wxgui import stdgui2 -class test_top_block (stdgui2.std_top_block): +class test_top_block(stdgui2.std_top_block): def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv) + stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) fft_size = 512 @@ -143,30 +144,30 @@ class test_top_block (stdgui2.std_top_block): input_rate = 20.000e3 # Generate a complex sinusoid - self.src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000) - #src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000) + self.src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000) + #src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1000) # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) - sink1 = waterfall_sink_c (panel, title="Complex Data", fft_size=fft_size, - sample_rate=input_rate, baseband_freq=100e3) + sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size, + sample_rate=input_rate, baseband_freq=100e3) self.connect(self.src1, self.thr1, sink1) - vbox.Add (sink1.win, 1, wx.EXPAND) + vbox.Add(sink1.win, 1, wx.EXPAND) # generate a real sinusoid - self.src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000) + self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000) self.thr2 = gr.throttle(gr.sizeof_float, input_rate) - sink2 = waterfall_sink_f (panel, title="Real Data", fft_size=fft_size, - sample_rate=input_rate, baseband_freq=100e3) + sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size, + sample_rate=input_rate, baseband_freq=100e3) self.connect(self.src2, self.thr2, sink2) - vbox.Add (sink2.win, 1, wx.EXPAND) + vbox.Add(sink2.win, 1, wx.EXPAND) def main (): - app = stdgui2.stdapp (test_top_block, "Waterfall Sink Test App") - app.MainLoop () + app = stdgui2.stdapp(test_top_block, "Waterfall Sink Test App") + app.MainLoop() if __name__ == '__main__': main () diff --git a/gr-wxgui/src/python/waterfallsink_nongl.py b/gr-wxgui/src/python/waterfallsink_nongl.py index be164bbccd..0e9b706708 100644 --- a/gr-wxgui/src/python/waterfallsink_nongl.py +++ b/gr-wxgui/src/python/waterfallsink_nongl.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2003,2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2003-2007,2008,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr, gru, window, fft, filter +from gnuradio import analog from gnuradio.wxgui import stdgui2 import wx import gnuradio.wxgui.plot as plot @@ -391,7 +392,7 @@ def next_down(v, seq): class test_top_block (stdgui2.std_top_block): def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv) + stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) fft_size = 512 @@ -399,30 +400,30 @@ class test_top_block (stdgui2.std_top_block): input_rate = 20.000e3 # Generate a complex sinusoid - self.src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000) - #src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000) + self.src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000) + #src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 5.75e3, 1000) # We add these throttle blocks so that this demo doesn't # suck down all the CPU available. Normally you wouldn't use these. self.thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate) - sink1 = waterfall_sink_c (panel, title="Complex Data", fft_size=fft_size, - sample_rate=input_rate, baseband_freq=100e3) + sink1 = waterfall_sink_c(panel, title="Complex Data", fft_size=fft_size, + sample_rate=input_rate, baseband_freq=100e3) self.connect(self.src1, self.thr1, sink1) - vbox.Add (sink1.win, 1, wx.EXPAND) + vbox.Add(sink1.win, 1, wx.EXPAND) # generate a real sinusoid - self.src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 5.75e3, 1000) + self.src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 5.75e3, 1000) self.thr2 = gr.throttle(gr.sizeof_float, input_rate) - sink2 = waterfall_sink_f (panel, title="Real Data", fft_size=fft_size, - sample_rate=input_rate, baseband_freq=100e3) + sink2 = waterfall_sink_f(panel, title="Real Data", fft_size=fft_size, + sample_rate=input_rate, baseband_freq=100e3) self.connect(self.src2, self.thr2, sink2) - vbox.Add (sink2.win, 1, wx.EXPAND) + vbox.Add(sink2.win, 1, wx.EXPAND) def main (): - app = stdgui2.stdapp (test_top_block, "Waterfall Sink Test App") - app.MainLoop () + app = stdgui2.stdapp(test_top_block, "Waterfall Sink Test App") + app.MainLoop() if __name__ == '__main__': - main () + main() diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 31298a2288..842e32c15e 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -8,9 +8,6 @@ <name></name> <!-- Blank for Root Name --> <cat> <name>Sources</name> - <block>const_source_x</block> - <block>gr_sig_source_x</block> - <block>gr_noise_source_x</block> <block>gr_vector_source_x</block> <block>random_source_x</block> <block>gr_null_source</block> @@ -123,10 +120,6 @@ <block>gr_mpsk_sync_cc</block> - <block>gr_pll_carriertracking_cc</block> - <block>gr_pll_freqdet_cf</block> - <block>gr_pll_refout_cc</block> - <block>gr_simple_correlator</block> <block>blks2_packet_decoder</block> @@ -134,20 +127,11 @@ </cat> <cat> <name>Level Controls</name> - <block>gr_dpll_bb</block> <block>gr_peak_detector_xb</block> <block>gr_peak_detector2_fb</block> <block>gr_sample_and_hold_xx</block> - <block>gr_agc_xx</block> - <block>gr_agc2_xx</block> - <block>gr_feedforward_agc_cc</block> - <block>gr_mute_xx</block> - <block>gr_simple_squelch_cc</block> - <block>blks2_standard_squelch</block> - <block>gr_pwr_squelch_xx</block> - <block>gr_ctcss_squelch_ff</block> <block>gr_threshold_ff</block> </cat> <cat> @@ -161,22 +145,6 @@ <cat> <name>Modulators</name> <block>gr_vco_f</block> - <block>gr_frequency_modulator_fc</block> - <block>gr_phase_modulator_fc</block> - <block>gr_quadrature_demod_cf</block> - <block>gr_cpfsk_bc</block> - - <block>blks2_wfm_tx</block> - <block>blks2_wfm_rcv</block> - <block>blks2_wfm_rcv_pll</block> - - <block>blks2_nbfm_tx</block> - <block>blks2_nbfm_rx</block> - - <block>blks2_am_demod_cf</block> - <block>blks2_fm_demod_cf</block> - <block>blks2_fm_deemph</block> - <block>blks2_fm_preemph</block> </cat> <cat> <name>Error Correction</name> @@ -189,7 +157,6 @@ </cat> <cat> <name>Probes</name> - <block>gr_probe_avg_mag_sqrd_x</block> <block>gr_probe_signal_f</block> </cat> <cat> diff --git a/grc/examples/simple/variable_config.grc b/grc/examples/simple/variable_config.grc index 95c287cce7..fc0d2fea6b 100644 --- a/grc/examples/simple/variable_config.grc +++ b/grc/examples/simple/variable_config.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jun 25 10:56:04 2009</timestamp> + <timestamp>Sat Nov 10 15:20:12 2012</timestamp> <block> <key>options</key> <param> @@ -36,10 +36,18 @@ <value>Custom</value> </param> <param> - <key>autostart</key> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> <value>True</value> </param> <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> <key>realtime_scheduling</key> <value></value> </param> @@ -161,6 +169,10 @@ <value></value> </param> <param> + <key>notebook</key> + <value></value> + </param> + <param> <key>_coordinate</key> <value>(429, 24)</value> </param> @@ -170,10 +182,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>wxgui_fftsink2</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>wxgui_fftsink2_0</value> </param> <param> <key>_enabled</key> @@ -184,59 +196,76 @@ <value>complex</value> </param> <param> - <key>samples_per_second</key> - <value>samp_rate</value> + <key>title</key> + <value>FFT Plot</value> </param> <param> - <key>vlen</key> - <value>1</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>_coordinate</key> - <value>(392, 233)</value> + <key>baseband_freq</key> + <value>0</value> </param> <param> - <key>_rotation</key> - <value>0</value> + <key>y_per_div</key> + <value>10</value> </param> - </block> - <block> - <key>gr_sig_source_x</key> <param> - <key>id</key> - <value>gr_sig_source_x_0</value> + <key>y_divs</key> + <value>10</value> </param> <param> - <key>_enabled</key> - <value>True</value> + <key>ref_level</key> + <value>50</value> </param> <param> - <key>type</key> - <value>complex</value> + <key>ref_scale</key> + <value>2.0</value> </param> <param> - <key>samp_rate</key> - <value>samp_rate</value> + <key>fft_size</key> + <value>1024</value> </param> <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> + <key>fft_rate</key> + <value>30</value> </param> <param> - <key>freq</key> - <value>freq</value> + <key>peak_hold</key> + <value>False</value> </param> <param> - <key>amp</key> - <value>1</value> + <key>average</key> + <value>False</value> </param> <param> - <key>offset</key> + <key>avg_alpha</key> <value>0</value> </param> <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> - <value>(148, 233)</value> + <value>(671, 233)</value> </param> <param> <key>_rotation</key> @@ -244,10 +273,10 @@ </param> </block> <block> - <key>wxgui_fftsink2</key> + <key>gr_throttle</key> <param> <key>id</key> - <value>wxgui_fftsink2_0</value> + <value>gr_throttle_0</value> </param> <param> <key>_enabled</key> @@ -258,56 +287,59 @@ <value>complex</value> </param> <param> - <key>title</key> - <value>FFT 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>baseband_freq</key> - <value>0</value> + <key>_coordinate</key> + <value>(392, 233)</value> </param> <param> - <key>y_per_div</key> - <value>10</value> + <key>_rotation</key> + <value>0</value> </param> + </block> + <block> + <key>analog_sig_source_x</key> <param> - <key>y_divs</key> - <value>10</value> + <key>id</key> + <value>analog_sig_source_x_0</value> </param> <param> - <key>ref_level</key> - <value>50</value> + <key>_enabled</key> + <value>True</value> </param> <param> - <key>fft_size</key> - <value>1024</value> + <key>type</key> + <value>complex</value> </param> <param> - <key>fft_rate</key> - <value>30</value> + <key>samp_rate</key> + <value>samp_rate</value> </param> <param> - <key>peak_hold</key> - <value>False</value> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> </param> <param> - <key>average</key> - <value>False</value> + <key>freq</key> + <value>freq</value> </param> <param> - <key>avg_alpha</key> - <value>0</value> + <key>amp</key> + <value>1</value> </param> <param> - <key>grid_pos</key> - <value></value> + <key>offset</key> + <value>0</value> </param> <param> <key>_coordinate</key> - <value>(671, 233)</value> + <value>(173, 201)</value> </param> <param> <key>_rotation</key> @@ -315,14 +347,14 @@ </param> </block> <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>wxgui_fftsink2_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> + <source_block_id>analog_sig_source_x_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/grc/examples/xmlrpc/xmlrpc_server.grc b/grc/examples/xmlrpc/xmlrpc_server.grc index dc539ef1b1..ea70ded720 100644 --- a/grc/examples/xmlrpc/xmlrpc_server.grc +++ b/grc/examples/xmlrpc/xmlrpc_server.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jul 24 14:27:42 2008</timestamp> + <timestamp>Sat Nov 10 15:20:55 2012</timestamp> <block> <key>options</key> <param> @@ -36,51 +36,24 @@ <value>Custom</value> </param> <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x</value> + <key>run_options</key> + <value>prompt</value> </param> <param> - <key>_enabled</key> + <key>run</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> - <value>ampl</value> + <key>max_nouts</key> + <value>0</value> </param> <param> - <key>offset</key> - <value>offset</value> + <key>realtime_scheduling</key> + <value></value> </param> <param> <key>_coordinate</key> - <value>(162, 200)</value> + <value>(10, 10)</value> </param> <param> <key>_rotation</key> @@ -138,37 +111,6 @@ </param> </block> <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(386, 93)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>wxgui_scopesink2</key> <param> <key>id</key> @@ -191,11 +133,11 @@ <value>samp_rate</value> </param> <param> - <key>frame_decim</key> - <value>15</value> + <key>v_scale</key> + <value>0</value> </param> <param> - <key>v_scale</key> + <key>v_offset</key> <value>0</value> </param> <param> @@ -203,18 +145,38 @@ <value>.001</value> </param> <param> - <key>marker</key> - <value>set_format_line</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>win_size</key> + <value></value> + </param> + <param> <key>grid_pos</key> <value>0, 0, 2, 4</value> </param> <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>trig_mode</key> + <value>gr.gr_TRIG_MODE_AUTO</value> + </param> + <param> + <key>y_axis_label</key> + <value>Counts</value> + </param> + <param> <key>_coordinate</key> <value>(623, 28)</value> </param> @@ -262,6 +224,10 @@ <value>50</value> </param> <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> <key>fft_size</key> <value>512</value> </param> @@ -270,22 +236,38 @@ <value>15</value> </param> <param> - <key>avg_alpha</key> - <value>0</value> + <key>peak_hold</key> + <value>False</value> </param> <param> <key>average</key> <value>False</value> </param> <param> - <key>peak_hold</key> - <value>False</value> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>win</key> + <value>None</value> + </param> + <param> + <key>win_size</key> + <value></value> </param> <param> <key>grid_pos</key> <value>2, 0, 2, 4</value> </param> <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>freqvar</key> + <value>None</value> + </param> + <param> <key>_coordinate</key> <value>(630, 233)</value> </param> @@ -363,22 +345,96 @@ <value>0</value> </param> </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(386, 93)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>analog_sig_source_x</key> + <param> + <key>id</key> + <value>analog_sig_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> + </param> + <param> + <key>freq</key> + <value>freq</value> + </param> + <param> + <key>amp</key> + <value>ampl</value> + </param> + <param> + <key>offset</key> + <value>offset</value> + </param> + <param> + <key>_coordinate</key> + <value>(164, 154)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <connection> - <source_block_id>gr_sig_source_x</source_block_id> - <sink_block_id>gr_throttle</sink_block_id> + <source_block_id>gr_throttle</source_block_id> + <sink_block_id>wxgui_scopesink2</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> <source_block_id>gr_throttle</source_block_id> - <sink_block_id>wxgui_scopesink2</sink_block_id> + <sink_block_id>wxgui_fftsink2</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_throttle</source_block_id> - <sink_block_id>wxgui_fftsink2</sink_block_id> + <source_block_id>analog_sig_source_x_0</source_block_id> + <sink_block_id>gr_throttle</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> -</flow_graph>
\ No newline at end of file +</flow_graph> |