Common gnuradio modules and gnuradio modules
--- Restore content start ---
Reference: http://gnuradio.org/redmine/projects/gnuradio/wiki/TutorialsWritePythonApplications
Statement of the import module
from gnuradio import MODULENAME
Common modules include the following
The main gr gnuradio library, basically used by every program
Functions related to analog signal and analog signal modulation
Audio Sound Card control, which can be used to send information to or receive information through the sound card
Blocks stores all things that do not belong to other modules.
Signal Model Used for channels Simulation
Digital and analog, functions related to digital signal modulation
Functions related to fft and ffts
Fec's tribute to fex
Filter Module
Plotdata plot data
Qtgui: graphical interface related to data representation (using the QT Library)
Wxgui contains some entities on the user interface for quick flow graph Creation
Vocoder functions related to sound Encoding
Wavelet functions related to microwave
Gru various functional entities related to mathematics and others
Select, define, and set the module. How to choose a module is quite male for us, because gnu radio provides a large number of pre-defined modules.
Therefore, we need to read some documents. You can also learn how to use these documents.
The following three lines of code define blocks sentences,
1 src0 = analog.sig_source_f (sample_rate, analog.GR_SIN_WAVE, 350, ampl)2 src1 = analog.sig_source_f (sample_rate, analog.GR_SIN_WAVE, 440, ampl)3 dst = audio.sink (sample_rate, "")
In the Lin1-2, a nameThe sig_source_f function is called and four function parameters are received.
1. sampling frequency sample_rate 2. analog. GR_SIN_WAVE, a constant defined in the analog module, which informs the signal production type here
3. 350/440 a constant, representing the frequency of the production Signal
4. ample: a variable that indicates the signal amplitude.
The problem is, how can I know which parameters I want to pass to without knowing the code in advance?sig_source_f
?
The answer is: reading documents, we need to find sig_source_f address: http://gnuradio.org/doc/doxygen/classgr_1_1analog_1_1sig__source__f.html
When many sig_source _ × values are included, f indicates that the generated signal is a floating point number. Others include:
C: plural floating point type
I: integer
S: Short integer
B: It is actually an integer.
For example, gr: filter: fir_filter_ccf Class
Representing FIR filter with gr_complex input, gr_complex output, and float taps.
Gr: blocks: add_const_ff
Indicates that the output = input + constant data types are all floating point numbers.
GNuradio blocks is written in C ++, but I use python for calling. All of the reasons for this are, gnuradio uses a tool called SWIG to create an excuse between python and C ++.
Each c ++ blocks has a creation function, gr: component: block: make (***) for example:gr::analog::sig_source_f::make()
. This function is often located on the same page as the corresponding class and can be output to python as well. It can be called through python. Of course, to understand how these blocks works, we may need to look at the code either early or late.