ScratchRadio Programming: Difference between revisions

Democratising Wireless Innovation
Jump to navigation Jump to search
(Introduced basic Scratch Radio programming concepts.)
 
(Added simple flow graph example.)
Line 11: Line 11:
The setup phase of a Scratch Radio program is used to connect various radio blocks together into a data flow graph to create a complete radio system. Scratch Radio blocks which may be used during the setup phase are indicated by the use of a flow graph icon at the left hand side of the Scratch block. These icons have the following meanings:
The setup phase of a Scratch Radio program is used to connect various radio blocks together into a data flow graph to create a complete radio system. Scratch Radio blocks which may be used during the setup phase are indicated by the use of a flow graph icon at the left hand side of the Scratch block. These icons have the following meanings:


[[File:ScratchRadio-FlowIconSource.jpg]] '''Data Flow Source''' This icon is used to indicate that the flow graph block is a data input. When the radio is active, data will be received from some external data producer and emitted at the output of the block.
<table><tr>
<td>'''Source'''</td><td>[[File:ScratchRadio-FlowIconSource.jpg]]</td>
<td>This icon is used to indicate that the flow graph block is a data input. When the radio is active, data will be received from some external data producer and emitted at the output of the block.</td>
</tr><tr>
<td>'''Sink'''</td><td>[[File:ScratchRadio-FlowIconSink.jpg]]</td>
<td>This icon is used to indicate that the flow graph block is a data output. When the radio is active, data will be accepted at the input to the block and emitted to some external data consumer.</td>
</tr><tr>
<td>'''Process'''</td><td>[[File:ScratchRadio-FlowIconProcess.jpg]]</td>
<td>This icon is used to indicate that the flow graph block is a data processing block. When the radio is active, data will be accepted at the input of the block and processed, with the transformed data being emitted at the output of the block.</td>
</tr><tr>
<td>'''Tap'''</td><td>[[File:ScratchRadio-FlowIconTap.jpg]]</td>
<td>This icon is used to indicate that the flow graph block taps into the data being produced elsewhere in the flow graph and replicates it at the output of the block.</td>
</tr></table>


[[File:ScratchRadio-FlowIconSink.jpg]] '''Data Flow Sink''' – This icon is used to indicate that the flow graph block is a data output. When the radio is active, data will be accepted at the input to the block and emitted to some external data consumer.
A valid flow graph is created by connecting data flow blocks in a particular manner. Every data flow should start with a source block. Source blocks must not be immediately preceded by another source, process or tap block and must be immediately followed by a process or sink block. Multiple process blocks may then be chained together, ending with a sink block. The net effect is that the data flow icons ‘connect’ to give a visual indication of the data flow. A simple example which shows a radio source being filtered and output to a display sink block is shown below:


[[File:ScratchRadio-FlowIconProcess.jpg]] '''Data Flow Process''' – This icon is used to indicate that the flow graph block is a data processing block. When the radio is active, data will be accepted at the input of the block and processed, with the transformed data being emitted at the output of the block.
[[File:ScratchRadio-SimpleFlowGraphExample.jpg]]


[[File:ScratchRadio-FlowIconTap.jpg]] '''Data Flow Tap''' – This icon is used to indicate that the flow graph block taps into the data being produced elsewhere in the flow graph and replicates it at the output of the block.
{{Community}}

Revision as of 17:07, 18 July 2018

Program Structure

All Scratch Radio programs will have the same underlying structure consisting of two distinct phases. The radio setup phase is used to configure the way the radio will operate by connecting various radio blocks together. The radio operation phase then activates the radio and allows the radio to transmit and receive radio signals as required.

There are three Scratch Radio blocks which are used to control these phases of operation – the reset, start and stop blocks. The reset block is used to discard any previous radio configuration and prepare the radio at the start of the setup phase. Once the radio has been configured, the start block is used to activate the radio at the start of the operation phase. Finally, the stop block is used to halt the radio at the end of the operation phase. This means that all Scratch Radio programs will have a structure similar to the one shown below:

Flow Graph Setup

The setup phase of a Scratch Radio program is used to connect various radio blocks together into a data flow graph to create a complete radio system. Scratch Radio blocks which may be used during the setup phase are indicated by the use of a flow graph icon at the left hand side of the Scratch block. These icons have the following meanings:

Source This icon is used to indicate that the flow graph block is a data input. When the radio is active, data will be received from some external data producer and emitted at the output of the block.
Sink This icon is used to indicate that the flow graph block is a data output. When the radio is active, data will be accepted at the input to the block and emitted to some external data consumer.
Process This icon is used to indicate that the flow graph block is a data processing block. When the radio is active, data will be accepted at the input of the block and processed, with the transformed data being emitted at the output of the block.
Tap This icon is used to indicate that the flow graph block taps into the data being produced elsewhere in the flow graph and replicates it at the output of the block.

A valid flow graph is created by connecting data flow blocks in a particular manner. Every data flow should start with a source block. Source blocks must not be immediately preceded by another source, process or tap block and must be immediately followed by a process or sink block. Multiple process blocks may then be chained together, ending with a sink block. The net effect is that the data flow icons ‘connect’ to give a visual indication of the data flow. A simple example which shows a radio source being filtered and output to a display sink block is shown below: