Signal Data Types

From GNU Radio
Revision as of 18:51, 14 March 2022 by Mattcarrick (talk | contribs) (→‎Data Types: making easier to understand for ESL)
Jump to navigation Jump to search
Beginner Tutorials

Introducing GNU Radio

  1. What is GNU Radio?
  2. Installing GNU Radio
  3. Your First Flowgraph

Flowgraph Fundamentals

  1. Python Variables in GRC
  2. Variables in Flowgraphs
  3. Runtime Updating Variables
  4. Signal Data Types
  5. Converting Data Types
  6. Packing Bits
  7. Streams and Vectors
  8. Hier Blocks and Parameters

Creating and Modifying Python Blocks

  1. Creating Your First Block
  2. Python Block With Vectors
  3. Python Block Message Passing
  4. Python Block Tags

DSP Blocks

  1. Low Pass Filter Example
  2. Designing Filter Taps
  3. Sample Rate Change
  4. Frequency Shifting
  5. Reading and Writing Binary Files

SDR Hardware

  1. RTL-SDR FM Receiver
  2. B200-B205mini FM Receiver

This tutorial describes the data types which can be used to represent signals.

The starting flowgraph from Your First Flowgraph is used in this section, please complete the tutorial before proceeding. The next tutorial, Converting Data Types, shows how to convert between different data types.

Data Types

Every input and output port on a block will have a data type associated with it. The data type is identified by the color of the input and output port. The GNU Radio data types can be found by opening GNU Radio Companion (GRC) and clicking Help, Types:

GRCDataTypesHelp.png

A window displays the data types and their associated colors:

Types.png

These colors correspond to the input and output ports for blocks in GRC.

The most common data types in GNU Radio blocks are Complex Float 32 in blue and Float 32 in orange. Additional colors include the Integer 16 (or short) data type in yellow and the Integer 8 (or char) data type in magenta.

ExamplePortColors.png

Complex Data Type

The following flowgraph uses the Complex Float 32 data type, which uses a 32-bit float to represent the real and imaginary portions of a complex sample.

FlowgraphWithComplexDataTypes.png


Running the flowgraph shows the complex signal plotted in the time domain, where Signal 1 is the real component and Signal 2 is the imaginary component of the complex signal:

FlowgraphTimeSinkComplex.png

Each complex sample is therefore 64 bits: a 32-bit float for the real component, and a 32-bit float for the imaginary component.

Float Data Type

Many GNU Radio blocks support multiple data types. The data type of the Signal Source block can be changed by double-clicking it and selecting from the Output Type drop-down menu:

SignalSourceDataTypes.png


Selecting the float data type will have the Signal Source block create a real sinusoid, represented by the orange output port. Note the arrow connecting Signal Source to Throttle is now red, indicating a data type mismatch error:

RealToComplexConnectionError.png


The error is resolved by converting all of the other blocks to the orange Float data type. Data types may be cycled by clicking on the block, which is then highlighted in light blue, and pressing UP or DOWN on the keyboard:

BlockSelected.png


The flowgraph is complete after all data types have been converted to Float:

FlowgraphWithRealDataTypes.png


The Signal Source block creates a real output, which is displayed as the only signal in the time domain:

RealSignalTimeSink.png


The next tutorial, Converting Data Types, shows how to convert between different data types. Eventually we will learn about vector streams, as part of the Streams and Vectors tutorial.