Introduction To GNU Radio

2y ago
40 Views
6 Downloads
1.11 MB
66 Pages
Last View : 15d ago
Last Download : 1m ago
Upload by : Azalea Piercy
Transcription

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaIntroduction to GNU RadioMAC-TCTanguy RissetCiti Laboratory, INSA de LyonMay 25, 2016Tanguy RissetIntroduction to GNU Radio1

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaTable of contents1Introduction to Gnu radio2GNU radio with gnuradio-companion3Creating Gnu radio blocksCoding conventionBoost, Volk ad SwigCreating a trivial GNU radio module: square signalCreating a sync bloc: div164Block behavior and Schedulergeneral worksync blocks5Message passing interfacePMTMetadataTags & MessagesTanguy RissetIntroduction to GNU Radio2

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaSource material and Warning These slides were built from many sources among which: Gnuradio wiki radio/wiki/) Gnuradio API doc (https://gnuradio.org/doc/doxygen/), variousversion, mostly 3.7.7 Tom Rondeau slides (http://www.trondeau.com/) “Developing Signal Processing Blocks for Software Defined Radio”,Gunjan Verma and Paul Yu, Army Research Laboratory,ARL-TR-5897, 2012. Gnuradio is evolving quickly, some of the details mentioned herecan become optional or are not yet deployed if you use olderversionTanguy RissetIntroduction to GNU Radio3

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaTable of Contents1Introduction to Gnu radio2GNU radio with gnuradio-companion3Creating Gnu radio blocksCoding conventionBoost, Volk ad SwigCreating a trivial GNU radio module: square signalCreating a sync bloc: div164Block behavior and Schedulergeneral worksync blocks5Message passing interfacePMTMetadataTags & MessagesTanguy RissetIntroduction to GNU Radio4

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaWhat is GNU Radio?An open source framework for building softwareradio transceivers An open source software toolkit Creating signal processing applications Defining waveforms in software Processing waveforms in software An important development community Active developer community producing examples GNU radio conference (2011-2014) A set of hardware platforms USRP1 & USRP2, Universal Software Radio Peripheral, RTL2832 TV tuners an easy-to-use approach (Simulink-like)Tanguy RissetIntroduction to GNU Radio5

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaThe big pictureSamplingBaseband taEncrypt/DecryptVoiceVideoFront EndMediaAccessDigitalDSP/FPGATanguy RissetIFIFAmp FilterRFRFAmp FilterAntennaAntennaSystemsAnalogASICDedicated HardwareIntroduction to GNU Radio6

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaA 3 tier architecture Python scripting language usedfor creating "‘signal flow graphs"’ C used for creating signalprocessing blocks An already existing library ofsignalling blocks Tools for enabling the addition ofnew blocks The scheduler is using Python’sbuilt-in module threading, tocontrol the ‘starting’, ‘stopping’or ‘waiting’ operations of thesignal flow graph.Tanguy RissetIntroduction to GNU RadioPythonApplication developmentcreating flow graphsC Signal processingmodulesSchedulercontrolingflow graphs7

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaGNU Radio ‘Hello World’ application#!/usr/bin/env ss top block(gr.top block):def init (self):gr.top block. init (self, "Hello Word")samp rate 32000freq1 440ampl 0.4self.audio sink audio.sink(32000, "", True)self.analog sig source 1 analog.sig source f(samp rate,analog.GR COS WAVE, 350, ampl, 0)self.analog sig source 0 analog.sig source f(samp rate,analog.GR COS WAVE, 440, ampl, 0)self.connect((self.analog sig source 0, 0), (self.audio sink, 1))self.connect((self.analog sig source 1, 0), (self.audio sink, 0))if name ' main ':tb top block()tb.start()raw input ('Press Enter to quit: ')tb.stop ()Tanguy RissetIntroduction to GNU Radio8

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaData-flow programming Sources, Sinks, Computational Blocks and Data FlowsBlock 1Source 1Block 2Sink 1Block 4Block 3Source 2Tanguy RissetIntroduction to GNU Radio9

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaGNU Radio LibraryFundamentals gr-analogGraphical Interfaces gr-audio gr-wxgui gr-qtgui gr-blocks gr-channels gr-digital gr-fecHardware Interfaces gr-audio gr-fft gr-comedi gr-filter gr-shd gr-trellis gr-uhd gr-vocoder gr-waveletTanguy RissetIntroduction to GNU Radio10

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaTable of Contents1Introduction to Gnu radio2GNU radio with gnuradio-companion3Creating Gnu radio blocksCoding conventionBoost, Volk ad SwigCreating a trivial GNU radio module: square signalCreating a sync bloc: div164Block behavior and Schedulergeneral worksync blocks5Message passing interfacePMTMetadataTags & MessagesTanguy RissetIntroduction to GNU Radio11

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaA simple example with GNU Radio companion (GRC) Dial tone GNURADIO/gr-audio/example/grc/dial-tone.grcTanguy RissetIntroduction to GNU Radio12

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaRun-Time Execution The dial-tone.grc in an XMLinterface instantiating python and C code. It can be: Compiled (it generates a python file:dial-tone.py) Executed (i.e. executes the generatedpython file) Debugged (with spectrum analyzer forinstance)Tanguy RissetIntroduction to GNU Radio13

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaDebugging dial toneTanguy RissetIntroduction to GNU Radio14

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaDial Tone: GRC XML code block key analog sig source x /key param key id /key value analog sig source x 0 /value /param param ?xml version '1.0' encoding 'ASCII'? key enabled /key flow graph value True /value timestamp Tue May 6 17:48:23 2014 /timestamp /param block param key options /key key type /key param value float /value key id /key /param value dial tone /value param /param key samp rate /key param value samp rate /value key enabled /key /param value True /value [.] /param /block param [.] key title /key connection value Dial Tone /value source block id blocks add xx /source block i /param sink block id audio sink /sink block id param source key 0 /source key key author /key sink key 0 /sink key value Example /value /connection [.] connection source block id analog sig source x 0 /source sink block id blocks add xx /sink block id source key 0 /source key sink key 0 /sink key Tanguy RissetIntroduction to GNURadio15

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaDial Tone: Python code (manual)fromfromfromfromfromgnuradio import grgnuradio import audiognuradio.eng option import eng optionoptparse import OptionParsergnuradio import analogclass my top block(gr.top block):def init (self):gr.top block. init (self)[.]sample rate int(options.sample rate)ampl 0.1src0 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:my top block().run()except KeyboardInterrupt:passTanguy RissetIntroduction to GNU Radio16

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaDial Tone: Python code (generated from .grc)#!/usr/bin/env ####### Gnuradio Python Flow Graph# Title: Dial Tone# Author: Example# Description: example flow graph# Generated: Tue May 6 17:48:25 ####from gnuradio import analogfrom gnuradio import audiofrom gnuradio import blocks[.]class dial tone(grc wxgui.top block gui):def init (self):grc wxgui.top block gui. init (self, title "Dial Tone")icon path png"self.SetIcon(wx.Icon( icon path, wx.BITMAP TYPE ANY))self.samp rate samp rate 32000self.noise noise .005self.ampl ampl .4noise sizer wx.BoxSizer(wx.VERTICAL)self. noise text box forms.text box(parent self.GetWin(),sizer noise sizer,value self.noise,callback self.set noise,label "Noise",Tanguy RissetIntroduction to GNU Radio17

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaDial Tone: C code (manual)/** GNU Radio C example creating dial tone* ("the simplest thing that could possibly work")** Send a tone each to the left and right channels of stereo audio* output and let the user's brain sum them.*/#include gnuradio/top block.h #include gnuradio/analog/sig source f.h #include gnuradio/audio/sink.h using namespace gr;int main(int argc, char **argv){int rate 48000; // Audio card sample ratefloat ampl 0.1; // Don't exceed 0.5 or clipping will occur// Construct a top block that will contain flowgraph blocks. Alternatively,// one may create a derived class from top block and hold instantiated blocks// as member data for later manipulation.top block sptr tb make top block("dial tone");// Construct a real-valued signal source for each tone, at given sample rateanalog::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 tonesaudio::sink::sptr sink audio::sink::make(rate);Tanguy RissetIntroduction to GNU Radio18

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaGNU Radio software layers GRC: Graphical design tool GNURADIO/gr-audio/example/grc/dial-tone.grc . python : Mostly Composite Block application GNURADIO/gr-audio/examples/python/dial tone.py GNURADIO/gr-digital/python/digital/ofdm.py . C : Mostly Low level functions GNURADIO/gr-audio/examples/c /dial tone.cc GNURADIO/gr-digital/lib/ofdm cyclic prefixer impl.c .Tanguy RissetIntroduction to GNU Radio19

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaImportant on line documentation GNU radio C libraryhttp://gnuradio.org/doc/doxygen/index.html GNU radio block documentation: /BlocksCodingGuide Build a new GNU radio / Note that internet may not be accessible in lab roomTanguy RissetIntroduction to GNU Radio20

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaTable of Contents1Introduction to Gnu radio2GNU radio with gnuradio-companion3Creating Gnu radio blocksCoding conventionBoost, Volk ad SwigCreating a trivial GNU radio module: square signalCreating a sync bloc: div164Block behavior and Schedulergeneral worksync blocks5Message passing interfacePMTMetadataTags & MessagesTanguy RissetIntroduction to GNU Radio21

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaGNU radio naming convention Words in identifiers are separated by underscores (e.g.gr vector int) All types begin by gr (e.g. gr float) All class variable begin by d (e.g. d min stream) Each C class is implemented in a separated file (e.g. classgr magic implemented in file gr magic.cc with header filegr magic.h) All signal processing blocs contain their input and output types intheir suffixes. e.g.:dc blocker ff impl.ccdc blocker cc impl.cc[.][.]dc blocker ff impl::dc blocker cc impl::dc blocker cc impl(int D, bool longdc blocker ff impl(int D, bool long form): sync block("dc blocker cc",: sync block("dc blocker ff",io signature::make (1, 1, sizeof(gr complex)),io signature::make (1, 1, sizeof(float)),io signature::make (1, 1, sizeof(gr complex))),io signature::make (1, 1, sizeof(float))),d length(D), d long form(long form)d length(D), d long form(long form)Tanguy RissetIntroduction to GNU Radio22

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaBlock signature A bloc signature is a specification of the data types that enter orexit the bloc. There are always two bloc signatures, one for inputs, the otherfor outputs. Each bloc signature specifies the number and types of ports. excerpt from gr io signature.h:class GR RUNTIME API io signature{intd min streams;intd max streams;std::vector int d sizeof stream item;io signature(int min streams, int max streams,const std::vector int &sizeof stream items);public:typedef boost::shared ptr io signature sptr; io signature();static sptr make(int min streams, int max streams,int sizeof stream item);/*!* \brief Create an i/o signature*Tanguy RissetIntroduction to GNU Radio* \ingroup internal23

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaBoost Pointer Gnu radio uses Boost smart pointers. Boost is a software library that provides a smart implementationof C pointers that offers garbage collection (i.e. delete objectnot used anymore). Gnu radio uses only the shared ptr type of Boost Instead of declaring a pointer to a type X:X* myPointer;you can declare:boost::shared ptr X myBoostPointer example in gr io signaturetypedef boost::shared ptr io signature sptr;static sptr make(int min streams, int max streams,int sizeof stream item);Tanguy RissetIntroduction to GNU Radio24

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaVolk library Gnu radio uses VOLK (which stands for Vector-Optimized Libraryof Kernels) volk provides a number of optimized function for vectorprocessing using SIMD instructions. Developing with volk might be tricky because it is sensible toalignment of vector in memory. Understanding code using volk simply requires to understandvolk naming convention: The basic naming scheme will look something like this:volk (inputs params) [name] (output params) [alignment] example:volk 32f invsqrt 32fTanguy RissetIntroduction to GNU Radio25

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaOther Volk example General naming convention when there are several inputs oroutputs:volk (input type 0) x(input num 0) (input type 1) x(input num 1) .[name] (output type 0) x(output num 0) (output type 1) x(output num 1) . [alignment] Examples: Multiply two complex float vectors together (aligned and unalignedversions) and the dispatcher:volk 32fc x2 multiply 32fc avolk 32fc x2 multiply 32fc uvolk 32fc x2 multiply 32fc Add four unsigned short vectors together:volk 16u x4 add 16u Multiply a complex float vector by a short integer:volk 32fc s16i multiply 32fcTanguy RissetIntroduction to GNU Radio26

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaSWIG SWIG is a software development tool that connects programswritten in C and C with a variety of high-level programminglanguages. SWIG is used in GNU Radio to link Python and C codeTanguy RissetIntroduction to GNU Radio27

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaSWIG in brief write a C file example.c code that defines the fact function. write an interface file for SWIG:%module example%{extern int fact(int n);%} execute the swig command: unix % swig -python example.i it generates a example wrap.c Compile it:unix % gcc -c example.c example wrap.c-I/usr/include/python2.7unix % ld -shared example.o example wrap.o -o example.so use it in python: import example example.fact(5)120Tanguy RissetIntroduction to GNU Radio28

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaCreating GNU radio modules A gnu radio module newModule corresponds to a directorynewModule should contain the following directories:CMakeLists.txt docs grc include lib python swig the gr modtool tool helps you create the various directory Hence the flow for creating a block in a module Create the module file hierarchy with gr modtool Create a block in the module with gr modtool Edit the C file to code the module functionalities Test, debug and validate the functionalitiesTanguy RissetIntroduction to GNU Radio29

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaCreating a trivial module: module creation creating the module directory structure: gr modtool newmodarith Go into the new directory: cd gr-arith cd gr-arith/ lsapps CMakeLists.txt examples includecmake docsgrclibTanguy RissetIntroduction to GNU RadioMANIFEST.mdpythonswig30

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaCreating a trivial module: adding a bloc create a general block in the module (answer to questions):gr modtool add -t general times2 create a python test method: edit python/qa times2.py update python/CMakeLists.txt (nothing to do here) create the build directory cd .;mkdir build; build the project: cd build; cmake ./Tanguy RissetIntroduction to GNU Radio31

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaCreating a trivial module: directory hierarchygr-arith[.] -- CMakeLists.txt -- docs -- CMakeLists.txt -- doxygen -- CMakeLists.txt[.] -- grc -- arith times2.xml -- CMakeLists.txt -- include -- arith -- api.h -- CMakeLists.txt -- times2.h -- lib -- CMakeLists.txt -- qa arith.cc -- qa arith.h -- qa times2.cc -- qa times2.h -- test arith.cc -- times2 impl.cc -- times2 impl.cc -- times2 impl.h -- python -- CMakeLists.txt -- init .py -- qa times2.py -- qa times2.py Tanguy RissetIntroduction to GNU Radio32

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaCreating a trivial module: The C part Header files are in include/times2 directory Code is in lib/times2 impl.cc, edit it and replace the by values. in times2 impl() (constructor in forecast (indicate scheduler how many input are requires forhow many output items) in general work core of the treatment. make it (in the build directory), and make testTanguy RissetIntroduction to GNU Radio33

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaCreating a trivial module: debugging use printf (#include sdtio.h ) use make; make test (from python testbench: not infinite) log output in Testing/Temporary/LastTest.logTanguy RissetIntroduction to GNU Radio34

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaCreating a trivial module: debugging Now that you have written a valid block, you can create a validgrc block (in gr-arith directory, gr modtool makexml times2 install it: cd build; sudo make install create a simple grc application (use throttle, remove printf) run it (warning: no print!)Tanguy RissetIntroduction to GNU Radio35

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaUsing gr modtool for a sync module creation gr modtool newmod fmrds gr modtool add -t sync div16 (heritates from gr sync block,no forecast method). edit python/qa div16.py edit lib/qa div16.ccTanguy RissetIntroduction to GNU Radio36

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaCreating a sync blockgr modtool add -t sync div16GNU Radio module name identified: fmrdsLanguage: C Block/code identifier: div16Enter valid argument list, including default arguments:Add Python QA code? [Y/n]Add C QA code? [y/N]Adding file 'div16 impl.h'.Adding file 'div16 impl.cc'.Adding file 'div16.h'.Editing swig/fmrds swig.i.Adding file 'qa div16.py'.Editing python/CMakeLists.txt.Adding file 'fmrds div16.xml'.Editing grc/CMakeLists.txt.Tanguy RissetIntroduction to GNU Radio37

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaWriting a test for the div16 blockfrom gnuradio import gr, gr unittestimport fmrds swig as fmrdsclass qa div16 (gr unittest.TestCase):def setUp (self):self.tb gr.top block ()def tearDown (self):self.tb Nonedef test 001 t (self):# set up fgself.tb.run ()# check dataTanguy RissetIntroduction to GNU Radio38

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaWriting the C core of div16Edit lib/div16 impl.cc[.]div16 impl::div16 impl(): gr::sync block("div16",gr::io signature::make( MIN IN , MAX IN , sizeof( ITYPE )),gr::io signature::make( MIN OUT , MAX OUT , sizeof( OTYPE ))){}[.]intdiv16 impl::work(int noutput items,gr vector const void star &input items,gr vector void star &output items){const ITYPE *in (const ITYPE *) input items[0]; OTYPE *out ( OTYPE *) output items[0];// Do signal processing }// Tell runtime system how many output items we produced.return noutput items;Tanguy RissetIntroduction to GNU Radio39

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaNext stageLabs: write an audio filter bloc in GNU radioTanguy RissetIntroduction to GNU Radio40

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaTable of Contents1Introduction to Gnu radio2GNU radio with gnuradio-companion3Creating Gnu radio blocksCoding conventionBoost, Volk ad SwigCreating a trivial GNU radio module: square signalCreating a sync bloc: div164Block behavior and Schedulergeneral worksync blocks5Message passing interfacePMTMetadataTags & MessagesTanguy RissetIntroduction to GNU Radio41

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaBlock important function Each Gnu radio bloc inherits from the gr block class. The gr block class contains the following important function (file GNURADIO/include/gnuradio:void set history(unsigned history);virtual void forecast(int noutput tems,gr vector int &ninput items required);virtual int general work(int noutput items,gr vector int &ninput items,gr vector const void star &input items,gr vector void star &output items);void consume(int which input, int how many items);Tanguy RissetIntroduction to GNU Radio42

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler Messafunction general work The general work() function computes output streams frominput streams It has 4 arguments int noutput items Number of output items to write on each outputstream (all output streams must produce the same number ofoutput). int ninput items[] Number of input items to read in each inputstream void* intput items[] Vectors of pointers to elements of the inputstream(s), i.e., element i of this vector points to the i th input stream. void* output items[] Vectors of pointers to elements of the outputstream(s), i.e., element i of this vector points to the i th output stream.Tanguy RissetIntroduction to GNU Radio43

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler Messafunction general work The general work function implement the signal processingalgorithm. It is called by the scheduler (implicitly, i.e. you do not have toinvoke this function explicitly) The consume function indicates to the scheduler how many datahave been consumed once the general work has been executed Use of input items and output items vectors:input items[0][0]input items[0][1]General Blockoutput items[0][0]output items[0][1]data.data.data.input items[1][0]Tanguy RissetIntroduction to GNU Radio44

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaOne execution of the block Before executioninput items[0][0]input items[0][1]General Blockdata.A6 A5 A4 A3 A2 A1noutput items 1data.output items[0][0]ninput items[0] 4ninput items[1] 2data.C1B3 B2 B1input items[1][0] after executioninput items[0][0]input items[0][1]General Blockdata.A6 A5noutput items 1data.output items[0][0]ninput items[0] 4ninput items[1] 2data.C1B3input items[1][0]Tanguy RissetIntroduction to GNU Radio45

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaWhat the code of work function could be Example: sum the 6 samples in input on the outputfor(unsigned int j 0; j 4; j ) {output items[0][0] input items[0][j];}for(unsigned int j 0; j 2; j ) {output items[0][0] input items[1][j];} But it is not that simple. Gnu radio scheduler invokes the work function for computing achunks of output (i.e. not one output by one output, in order toavoid too many context switches) noutput item stays symbolic, it will be set dynamically duringthe execution by the scheduler for performance optimization(usually between 4000 and 10000).Tanguy RissetIntroduction to GNU Radio46

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaWhat the code of work function should be add one loop over all noutput items output samples:for (i 0; i noutput items; i ) {for(j 0 ; j 4; j ) {output items[0][i] input items[0][4*i j];}for(unsigned int j 0; j 2; j ) {output items[0][i] input items[1][2*i j];}} Remember to avoid as much as possible samples copy.Tanguy RissetIntroduction to GNU Radio47

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler MessaWhat the code of work function really is Usual Gnu radio way of writing:const gr complex *in1 (const gr complex*)input items[0];const gr complex *in2 (const gr complex*)input items[1];gr complex *out (gr complex*)output items[0];for (i 0; i noutput items; i ) {for(j 0 ; j 4; j ) {*out *in1 ;}for(unsigned int j 0; j 2; j ) {*out *in2 ;}*out ;}Tanguy RissetIntroduction to GNU Radio48

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler Messaforecast function forecast() is a function which tells the scheduler how manyinput items are required to produce noutput items output items. In most of the case, they are the same:voidmy general block::forecast (int noutput items,gr vector int &ninput items required{ninput items required[0] noutput items;} It is used as an information by the scheduler to schedule theexecutions of the different blocs so as to prevent starvation orbuffer overflows.Tanguy RissetIntroduction to GNU Radio49

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler Messaconsume function The consume (int which input, int how many items)function tells the scheduler that how many items of input streamwhich input were consumed. This function should be called at the end of general work(),after all processing is finished consume each (int how many items) can be used it thenumber of items to consume is the same on each input streamsTanguy RissetIntroduction to GNU Radio50

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocksBlock behavior and Scheduler Messasummary: code for my general block{my general block::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 *in1 (const gr complex*)input items[0];const gr complex *in2 (const gr complex*)input items[1];gr complex *out (gr complex*)output items[0];for (i 0; i noutput items; i ) {for(j 0 ; j 4; j ) {*out *in1 ;}for(unsigned int j 0; j 2; j ) {*out *in2 ;}*out ;}consume(0,4*noutput items);consume(2,4*noutput items);}voidmy general block::forecast (int noutput items,gr vector int &ninput items required){}ninput items required[0] 4*noutput items;ninput items required[1] 2*noutput ite

Introduction to Gnu radio GNU radio with gnuradio-companion Creating Gnu radio blocks Block behavior and Scheduler Message passing interface Table of contents . Debugged (with spectrum analyzer for instance) Tanguy Risset Introduction to GNU Radio 13.File Size: 1MB

Related Documents:

Introduction to GNU Radio Creating Gnu radio blocks Block behavior and Scheduler Message passing interface Table of contents 1 Introduction to GNU Radio What is GNU Radio GNU radio with gnuradio-companion . Debugged (with spectrum analyzer for instanc

programming as well. In fact, while this guide is written and intended as an introduction to Octave, it can serve equally well as a basic introduction to MATLAB. What is GNU? A gnu is a type of antelope, but GNU is a free, UNIX-like computer operating system. GNU is a recursive acronym that stands for \GNU's not Unix." GNU Octave (and

bug-gnubg@gnu.orgor make abug report. All about GNU Backgammon iii COLLABORATORS TITLE : All about GNU Backgammon ACTION NAME DATE SIGNATURE WRITTEN BY Albert Silver and Christian Anthon July 23, 2018 REVISION HISTORY NUMBER DATE DESCRIPTION NAME All about GNU Backgammon March 2007 The GNU Backgammon Project All about GNU March 2007 Albert .

software environments as Matlab or GNU Radio. Figure 1. SDR with USRP and GNU Radio [10]. III. GNU RADIO GNU Radio [12] is an open-source toolkit that provides tools for development and simulation of SDR systems. It is used to design and execute algorithms that define a desired communication system. There are basically three ways to use GNU .

the GNU Radio libraries. The GNU Radio package is provided with a complete HDTV transmitter and receiver, a spectrum analyzer, an oscilloscope, a multichannel receiver . and a wide collection of modulators and demodulators. The user interface is called GNU Radio companion or GRC. GNU Ra

GNU is a Unix-like computer operating system developed by the GNU project. It is composed wholly of free software. It refers to GNU's Not Unix .GNU Project emphasizes on freedom and thus its logo type show a GNU, an animal living in freedom FSF: FSF is Free Software Foundation.

major components: a laptop running GNU Radio, a Universal Software Radio Periphery (USRP), a signal generator, and a spectrum analyzer. A block diagram of the setup is depicted in Fig. 4. A. GNU Radio GNU Radio is an open source software that is widely used as a programming plat

Accounting information and managerial work. Accounting, Organizations and Society, 35 (3), 301-315. ABSTRACT . Despite calls to link management accounting more closely to management (Jonsson, 1998), much is still to be learned about the role of accounting information in managerial work. This lack of progress stems partly from a failure to incorporate in research efforts the findings regarding .