Chapter 17 GNU Radio for Cognitive Radio Experimentation 1 1

Slides:



Advertisements
Similar presentations
Cognitive Radio Communications and Networks: Principles and Practice By A. M. Wyglinski, M. Nekovee, Y. T. Hou (Elsevier, December 2009) 1 Chapter 1 When.
Advertisements

Cognitive Radio Communications and Networks: Principles and Practice By A. M. Wyglinski, M. Nekovee, Y. T. Hou (Elsevier, December 2009) 1 Chapter 13 Defining.
Cognitive Radio Communications and Networks: Principles and Practice By A. M. Wyglinski, M. Nekovee, Y. T. Hou (Elsevier, December 2009) 1 Chapter 11 Information.
GNU APPLICATIONS IN RADAR
1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
By Patrick Ellis and Scott Jaris Advisors: Dr. Ahn & Dr. Lu Implementation of a Software Defined 16 QAM System Using the USRP2 Board.
Lecture 04 – Classes.  Python has a number of classes built-in  lists, dictionaries, sets, int, float, boolean, strings  We can define our own classes.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
A Crash Course Python. Python? Isn’t that a snake? Yes, but it is also a...
1 Lab 3 Objectives  Case study: “Hello world” program on motes  Write you first program on mote.
Overview and Basics of Software Defined Radios INSTRUCTOR: Dr. George Collins By Praveen Kumar Chukka
DATA COLLECTION USING ZIGBEE NETWORK Timothy Melton Moscow, ID.
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Video transmission using USRP
01/10/2013 Ebro Observatory, October 1st, 2013 New Technology involved in SWING: Software Radio and HF Links A.L. Saverino A.Capria, F.Berizzi, M. Martorella,
Software Defined Radio Testbed Team may11-18 Members: Alex Dolan, Mohammad Khan, Ahmet Unsal Adviser: Dr. Aditya Ramamoorthy.
Csc333 Data communication & Networking Credit: 2.
GNU R ADIO mehdi sajjadi Summer W HAT IS GNU R ADIO ? An open-source software toolkit Design & Implementation of Radio systems Two main set of.
Implement a 2x2 MIMO OFDM-based channel measurement system (no data yet) at 2.4 GHz Perform baseband processing and digital up and down conversion on Nallatech.
The Software Defined Radio Team D. J. Love, C.-C. Wang, and J. V. Krogmeier School of Electrical and Computer Engineering Purdue University, West Lafayette.
Chapter 11 Exception Handling and Event Handling.
Guide To UNIX Using Linux Third Edition
ASP.NET Programming with C# and SQL Server First Edition
WINLAB GNUradio Python Programming KC Huang. WINLAB Outlines  Python Introduction  Understanding & Using GNU Radio What is GNU Radio architecture? How.
Entering the World of GNU Software Radio
Fundamentals of Python: From First Programs Through Data Structures
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
- 1 - A Powerful Dual-mode IP core for a/b Wireless LANs.
The 6713 DSP Starter Kit (DSK) is a low-cost platform which lets customers evaluate and develop applications for the Texas Instruments C67X DSP family.
Instructor: Dr.George Collins Satyakiran Anugu. Introduction Why Mathematics in GNU Radio Creating block Pyhthon Mathematical operators in Python Mathematical.
Wavelet Transforms CENG 5931 GNU RADIO INSTRUCTOR: Dr GEORGE COLLINS.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Munster Programming Training
Network Coding Testbed Jeremy Bergan, Ben Green, Alex Lee.
Introduction to Python 2 Dr. Bernard Chen University of Central Arkansas PyArkansas 2011.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
Low Cost Radar and Sonar using Open Source Hardware and Software
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
The GNU in RADIO Shravan Rayanchu. SDR Getting the code close to the antenna –Software defines the waveform –Replace analog signal processing with Digital.
Developing a SDR Testbed Alex Dolan Mohammad Khan Ahmet Unsal Project Advisor Dr. Aditya Ramamoorthy.
Garrett Vanhoy, MaryPat Beaufait, Duyun Chen Advisor: Dr. Carl Dietrich.
Wireless Communication with GNU SDR. A simplified wireless communication scheme.
Manifold Lab 2 Introduction Basic Concepts First Examples.
Cohesion and Coupling CS 4311
Internet Presentation. What is the Internet? The worlds largest computer network. A collection of local, regional and national computer networks linked.
Wireless TXRX for TLL2020 It is awesome.. Outline Project Overview System Overview Transmiter Hardware Receiver Hardware FPGA Architecture Driver and.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
CSCI/CMPE 4341 Topic: Programming in Python Review: Exam I Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
CSC 110 Using Python [Reading: chapter 1] CSC 110 B 1.
DSP Techniques for Software Radio A System Example Dr. Jamil Ahmad.
Student: Vikas Agarwal Guide: Prof H S Jamadagni
Present Uses of the Fermilab Digital Signal Receiver VXI Module Brian Chase,Paul Joireman, Philip Varghese RF Embedded Systems (LLRF) Group.
Wireless communication Emmanuel Gyebison. Transmission Signals must be converted into digital values, using a circuit called ADC (Analog to Digital Converter),
GNU Radio Jiewen Huang 1/31/ Outline  What is GNU Radio?  Basic Concepts  Developing Applications  HW2 Introduction.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
ECE 101 Exploring Electrical Engineering Chapter 7 Data Acquisition Herbert G. Mayer, PSU Status 11/30/2015 Derived with permission from PSU Prof. Phillip.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Tinyos Introduction to Programming Pritee Parwekar.
Software Defined Radio
Topics Introduction to Repetition Structures
Munigala Srinivaas EE-587 (April )
Functions CIS 40 – Introduction to Programming in Python
Zigbee Networks Using Xbee Modules
Software Defined Radio
Python Primer 2: Functions and Control Flow
Topics Introduction to File Input and Output
Topics Introduction Hardware and Software How Computers Store Data
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Topics Introduction to File Input and Output
Presentation transcript:

Chapter 17 GNU Radio for Cognitive Radio Experimentation 1 1 “Cognitive Radio Communications and Networks: Principles and Practice” By A. M. Wyglinski, M. Nekovee, Y. T. Hou (Elsevier, December 2009) 1 1

Outline What is GNU Radio? Basic Concepts GNU Radio Architecture & Python Dial Tone Example Digital Communications Cognitive Transmitter 2

What is GNU Radio? Software toolkit for signal processing Software radio construction Rapid development Cognitive radio USRP (Universal Software Radio Peripheral)‏ Hardware frontend for sending and receiving waveforms

GNU Radio Components Hardware Frontend Host Computer RF Frontend (Daugtherboard)‏ ADC/DAC and Digital Frontend (USRP)‏ GNU Radio Software

GNU Radio Software Opensource software (GPL)‏ Features Don't know how something works? Take a look! Existing examples: 802.11b, Zigbee, ATSC (HDTV), OFDM, DBPSK, DQPSK Features Extensive library of signal processing blocks (C++/ and assembly)‏ Python environment for composing blocks (flow graph)‏

GNU Radio Hardware Sends/receives waveforms USRP Features USB 2.0 interface (480Mbps)‏ FPGA (customizable)‏ 64Msps Digital to Analog converters (receiving)‏ 128Msps Analog to Digital converteres (transmitting)‏ Daughterboards for different frequency ranges Available Daughterboard 400-500Mhz, 800-1000Mhz, 1150-1450Mhz, 1.5- 2.1Ghz, 2.3-2.9Ghz

GNU Radio Hardware Schematic Host Computer RX/TX Daughterboard ADC/DAC FPGA USB Interface

Outline What is GNU Radio? Basic Concepts GNU Radio Architecture & Python Dial Tone Example Digital Communications Cognitive Transmitter 8

Basics: Blocks Signal Processing Block Source: No input Accepts 0 or more input streams Produces 0 or more output streams Source: No input noise_source, signal_source, usrp_source Sink: No outputs audio_alsa_sink, usrp_sink

Basics: Data Streams Blocks operate on streams of data 1 5 3 4 12 12 3 7 9

Basics: Data Types Blocks operate on certain data types char, short, int, float, complex Vectors Input Signature: Data types for input streams Output Signature: Data types for output streams Two streams of float One stream of complex

Basics: Flow Graph Blocks composed as a flow graph Data stream flowing from sources to sinks

Outline What is GNU Radio? Basic Concepts GNU Radio Architecture & Python Dial Tone Example Digital Communications Cognitive Transmitter 13

GNU Radio Architecture Sender User-defined Code RF Front end USB FPGA DAC mother board daughter board PC USRP GNU radio has provided some useful APIs What we are interested in at this time is how to use the existing modules that has been provided in GNU radio project to communicate between two end systems 14

GNU Radio Architecture - software How these modules co-work? Signal processing block and flow-graph C++: Extensive library of signal processing blocks Performance-critical modules Python: Environment for composing blocks Glue to connect modules Non performance-critical modules 15

GNU Radio Architecture – software(2)‏ Python scripting language used for creating "signal flow graphs“ C++ used for creating signal processing blocks An already existing library of signaling blocks The scheduler is using Python’s built-in module threading, to control the ‘starting’, ‘stopping’ or ‘waiting’ operations of the signal flow graph. Python Application development Flow graph construction C++ Signal processing blocks Scheduler Control flow graph 16

GNU Radio Architecture – software(3)‏ V2 V2 C++ C++ C++ C++ Sink C++ C++ V1 V1 V3 V3 Source 17

Python - running Why Python? Object-oriented Free Mixable (python/c++)‏ Python scripts can be written in text files with the suffix .py Example: $ python script.py This will simply execute the script and return to the terminal afterwards 18

Python - format Module: a python file containing definitions and statements from pick_bitrate import pick_tx_bitrate (from file import function)‏ from gnuradio import gr, (or *) (from package import subpackage or all)‏ Some modules are built-in e.g. sys (import sys)‏ Indentation: it is Python’s way of grouping statements Example: while b < 10: print b return Body of loop has to be indented by the same amount to indicate statements of the loop 19

Python – function & class (1)‏ Function definitions have the following basic structure: def func(args): return values Regardless of the arguments, (including the case of no arguments) a function call must end with parentheses Example: def f1(x): return x*(x-1) f1(3) = 6 20

Python – function & class (2)‏ Classes class ClassName: <statement-1> . . . <statement-N> Objects x = ClassName() creates a new instance of this class and assigns the object to the variable x Initial state: for instantiation and parameter pass def __init__(self): 21

Creating Your Own Signal Block Basics A block is a C++ class Typically derived from gr_block or gr_sync_block class Three components my_block_xx.h: Block definition my_block_xx.cc: Block implementation my_block_xx.i: Python bindings (SWIG interface) (SWIG, a tool that generates wrapper code around your C++ functions and classes, so that they are callable from Python)‏ 22

Outline What is GNU Radio? Basic Concepts GNU Radio Architecture & Python Dial Tone Example Digital Communications Cognitive Transmitter 23

Dial Tone Example Sine Generator (350Hz)‏ Audio Sink 24

Dial Tone Example #!/usr/bin/env python from gnuradio import gr from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self)‏ parser = OptionParser(option_class=eng_option)‏ parser.add_option("-O", "--audio-output", type="string", default="", help="pcm output device name. E.g., hw:0,0")‏ parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, help="set sample rate to RATE (48000)")‏ (options, args) = parser.parse_args ()‏ if len(args) != 0: parser.print_help()‏ raise SystemExit, 1 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))‏ if __name__ == '__main__': try: my_top_block().run()‏ except KeyboardInterrupt: pass

Dial Tone Example (1)‏ Import modules from GNU Radio library from gnuradio import gr from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser Import modules from GNU Radio library

Dial Tone Example (2)‏ Define container for Flow Graph; class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self)‏ Define container for Flow Graph; gr.top_block class maintains the graph

Dial Tone Example (3)‏ Define and parse command-line options parser = OptionParser(option_class=eng_option)‏ parser.add_option("-O", "--audio-output", type="string", default="", help="pcm output device name. E.g., hw:0,0")‏ parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, help="set sample rate to RATE (48000)")‏ (options, args) = parser.parse_args ()‏ if len(args) != 0: parser.print_help()‏ raise SystemExit, 1

Dial Tone Example (4)‏ Create and connect signal processing blocks 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))‏

Dial Tone Example (5)‏ Run the flow graph when the program is executed if __name__ == '__main__': try: my_top_block().run()‏ except KeyboardInterrupt: pass Run the flow graph when the program is executed

Outline What is GNU Radio? Basic Concepts GNU Radio Architecture & Python Dial Tone Example Digital Communications Cognitive Transmitter 31

Digital Communications: Transmitter‏ Top level block of digital transmitter

Digital Transmitter‏ Building the Radio Running the Transmitter Modulating the data Setting up the USRP Running the Transmitter The main function Starting the program

Digital Communications: Receiver‏ Top level block of digital receiver

Digital Receiver‏ Building the Radio Running the Receiver Demodulating the data Setting up the USRP Packet callback function (different from the transmitter) Running the Receiver The main function Starting the program

Outline What is GNU Radio? Basic Concepts GNU Radio Architecture & Python Dial Tone Example Digital Communications Cognitive Transmitter 36

Cognitive Transmitter‏ Top level block of cognitive transmitter

Cognitive Transmitter‏ Building the Radio Modulating the data Setting up the USRP Running the Transmitter Timer control of flow graphs The main function Starting the program

Cognitive Transmitter: Timer Control‏ Time division of cognitive transmitter

Chapter 17 Summary This chapter introduces the reader to GNU radio for cognitive radio experimentation. The Introduction section provides an overview of software defined radio and the GNU Radio toolkit. The hardware commonly used with this software, the Universal Software Radio Peripheral (USRP), is also introduced. The analog communication section is focused on the Python level, introducing some Python basics and how Python is used in GNU Radio to connect signal processing blocks and control the flow of the digital data. The most common type of modern communication is digital. Building upon the analog communication section, a digital radio is developed to transmit a randomly generated bitstream modulated using DBPSK. In the last section, a time division protocol is implemented to enable channel noise calculations by the transmitter. This time division is similar to the one specified by the 802.22 standard and outlines how cognitive engines can be added to GR. 40

Appendix 1: GNU Radio modules from gnuradio import MODULENAME Miscellaneous utilities, mathematical and others. gru Use from gnuradio.eng_options import eng_options to import this feature. This module extends Pythons optparse module to understand engineering notation (see above). eng_options Adds some functions to deals with numbers in engineering notation such as `100M' for 100 * 106'. eng_notation This module contains additional blocks written in Python which include often-used tasks like modulators and demodulators, some extra filter code, resamplers, squelch and so on. blks2 Soundcard controls (sources, sinks). You can use this to send or receive audio to the sound cards, but you can also use your sound card as a narrow band receiver with an external RF frontend. audio USRP sources and sinks and controls. usrp The main GNU Radio library. You will nearly always need this. gr 41

Appendix 2: GNU Radio scheduler Unlock a flow graph in preparation for reconfiguration. When an equal number of calls to lock() and unlock() have occurred, the flow graph will be restarted automatically. unlock() Lock a flow graph in preparation for reconfiguration. lock() Wait for a flow graph to complete. Flowgraphs complete when either (1) all blocks indicate that they are done, or (2) after stop has been called to request shutdown. wait() Stop the running flow graph. Notifies each thread created by the scheduler to shutdown, then returns to caller. stop() Start the contained flow graph. Returns to the caller once the threads are created. start() The simplest way to run a flow graph. Calls start(), then wait(). Used to run a flow graph that will stop on its own, or to run a flow graph indefinitely until SIGINT is received. run() 42

Appendix 3: Useful Links Homepage (download, more links, etc)‏ http://gnuradio.org/trac/ More comprehensive tutorial http://gnuradio.org/trac/wiki/Tutorials/WritePythonApplications Available Signal Processing Blocks http://gnuradio.org/doc/doxygen/hierarchy.html GNU Radio Mailing List Archives http://www.gnu.org/software/gnuradio/mailinglists.html CGRAN: 3rd Party GNU Radio Apps https://www.cgran.org/ OFDM Implementation Presentation http://gnuradio.org/trac/wiki/Wireless