Python Block Tags: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
Line 42: Line 42:
Change all of the blocks to be ''Float'' input and output. Connect them all according to the following flowgraph:
Change all of the blocks to be ''Float'' input and output. Connect them all according to the following flowgraph:


[[File:TestSignalFlowgraph.png|800px]]
[[File:TestSignalFlowgraph.png|900px]]


== Threshold: Defining the Block ==  
== Threshold: Defining the Block ==  

Revision as of 12:36, 28 January 2022

Template:TutorialNavigation

TODO:

  • use a threshold
  • set a tag when threshold exceeded
  • feed in a noise source (average it?)
  • tag blocker
  • block to read tag, then change the output
  • make a picture associating tags with samples

The flowgraph will use two Embedded Python Blocks for detecting when the input signal crosses the threshold and setting a tag for it and then reading the tag and updating an output counter with the time since the last detection.

The previous tutorial, Python Block Message Passing demonstrates how to send and receive messages using the Embedded Python Block. The next tutorial, Low Pass Filter Example, demonstrates how to use filtering blocks in GNU Radio.

Tags Overview

Tags are a way to convey information alongside digitized RF samples in a time-synchronous fashion. Tags are particularly useful when downstream blocks need to know upon which sample the receiver was tuned to a new frequency, or for including timestamps with specific samples.

Where messages convey information in an asynchronous fashion with no clock-based time guarantee, tags are information which are associated with specific RF samples. Tags ride alongside digitized RF samples in data streams and vectors, including Complex Float 32, Float 32, Byte and all of the other formats.

More information about tags can be found here: Stream Tags

Creating Test Signal

A test signal is needed in order to write tags inside a threshold detection block. Begin by dragging in the blocks for the input signal:

  • GLFSR Source
  • Repeat
  • Multiply Const
  • Add Const
  • Single Pole IIR Filter
  • Throttle
  • QT GUI Time Sink

Change the following parameters:

  • GLFSR Source, Degree: 32
  • Repeat, Interpolation: 128
  • Multiply Const, Constant: 0.5
  • Add Const, Constant: 0.5
  • Single Pole IIR Filter, Alpha: 0.05
  • samp_rate Variable, Value: 3200

Change all of the blocks to be Float input and output. Connect them all according to the following flowgraph:

TestSignalFlowgraph.png

Threshold: Defining the Block

Threshold: Writing the Tags

The next tutorial, Low Pass Filter Example, demonstrates how to use filtering blocks in GNU Radio.