1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-25 20:22:10 -05:00
sdrangel/plugins/samplesource/sdrdaemonsource
2017-12-28 03:21:48 +01:00
..
CMakeLists.txt Web API: implemented device run APIs for BladeRF input, SDRdaemon input and SDRplay 2017-12-09 12:41:42 +01:00
readme.md SDRdaemonSink documentation 2017-06-10 22:59:45 +02:00
sdrdaemonsource.pro Web API: implemented device run APIs for BladeRF input, SDRdaemon input and SDRplay 2017-12-09 12:41:42 +01:00
sdrdaemonsourcebuffer.cpp Removed dependency on liblz4 2017-06-10 19:20:58 +02:00
sdrdaemonsourcebuffer.h Renamed the moving average of util section to avoid confusion 2017-11-06 01:02:20 +01:00
sdrdaemonsourcegui.cpp Source plugins: put a serializer and deserializer in the core plugin for server. NFM demod: fixed deserializer 2017-12-28 03:21:48 +01:00
sdrdaemonsourcegui.h SDRdaemon input: refactored plugin with nanomsg handling in core plugin 2017-12-26 02:18:30 +01:00
sdrdaemonsourcegui.ui SDRdaemon input: refactored plugin with nanomsg handling in core plugin 2017-12-26 02:18:30 +01:00
sdrdaemonsourceinput.cpp Source plugins: put a serializer and deserializer in the core plugin for server. NFM demod: fixed deserializer 2017-12-28 03:21:48 +01:00
sdrdaemonsourceinput.h Source plugins: put a serializer and deserializer in the core plugin for server. NFM demod: fixed deserializer 2017-12-28 03:21:48 +01:00
sdrdaemonsourceplugin.cpp SDRdaemon input: refactored plugin with nanomsg handling in core plugin 2017-12-26 02:18:30 +01:00
sdrdaemonsourceplugin.h Removed direct reference to the DeviceSourceAPI in the source GUIs 2017-10-30 00:45:23 +01:00
sdrdaemonsourcesettings.cpp Device source plugins: implemented an init method for initializations to be done when all collaborating objects are created and possibly connected 2017-12-25 09:10:19 +01:00
sdrdaemonsourcesettings.h SDRdaemonFEC: renamed all SDRdaemonFECxxx classes to SDRdaemonSourcexxx classes 2017-06-09 14:14:32 +02:00
sdrdaemonsourceudphandler.cpp SDRdaemon input: refactored plugin with nanomsg handling in core plugin 2017-12-26 02:18:30 +01:00
sdrdaemonsourceudphandler.h SDRdaemon input: refactored plugin with nanomsg handling in core plugin 2017-12-26 02:18:30 +01:00

SDRdaemon source plugin

Introduction

This input sample source plugin gets its samples over tbe network from a SDRdaemon receiver server using UDP connection. SDRdaemon refers to the SDRdaemon utility sdrdaemonrxfound in this Github repostory.

Forward Error Correction with a Cauchy MDS block erasure codec is used to prevent block loss. This can make the UDP transmission more robust particularly over WiFi links.

Please note that there is no provision for handling out of sync UDP blocks. It is assumed that frames and block numbers always increase with possible blocks missing. Such out of sync situation has never been encountered in practice.

Build

The plugin will be built only if libnanomsg and the CM256cc library is installed in your system. libnanomasg is present in most distributions and the dev version can be installed using the package manager. For CM256cc library you will have to specify the include and library paths on the cmake command line. Say if you install cm256cc in /opt/install/cm256cc you will have to add -DCM256CC_INCLUDE_DIR=/opt/install/cm256cc/include/cm256cc -DCM256CC_LIBRARIES=/opt/install/cm256cc/lib/libcm256cc.so to the cmake commands.

Interface

SDR Daemon source input plugin GUI

1: Common stream parameters

SDR Daemon source input stream GUI

1.1: Frequency

This is the center frequency in kHz sent in the meta data from the distant SDRdaemon instance and corresponds to the center frequency of reception.

1.2: Start/Stop

Device start / stop button.

  • Blue triangle icon: device is ready and can be started
  • Green square icon: device is running and can be stopped

1.3: Record

Record I/Q stresm toggle button

1.4: Stream sample rate

Stream I/Q sample rate in kS/s

2: Auto correction options and stream status

SDR Daemon source input AC and stream1 GUI

2.1: Auto correction options

These buttons control the local DSP auto correction options:

  • DC: auto remove DC component
  • IQ: auto make I/Q balance

2.2: Receive buffer length

This is the main buffer (writes from UDP / reads from DSP engine) length in units of time (seconds). As read and write pointers are normally about half the buffer apart the nominal delay introduced by the buffer is the half of this value.

2.3: Main buffer R/W pointers positions

Read and write pointers should always be a half buffer distance buffer apart. This is the difference in percent of the main buffer size from this ideal position.

  • When positive it means that the read pointer is leading
  • When negative it means that the write pointer is leading (read is lagging)

This corresponds to the value shown in the gauges above (9)

2.4: Date/time

This is the current timestamp of the block of data sent from the receiver. It is refreshed about every second. The plugin tries to take into account the buffer that is used between the data received from the network and the data effectively used by the system however this may not be extremely accurate. It is based on the timestamps sent from the SDRdaemon utility at the other hand that does not take into account its own buffers.

3: Main buffer R/W pointers gauge

There are two gauges separated by a dot in the center. Ideally these gauges should not display any value thus read and write pointers are always half a buffer apart. However due to the fact that a whole frame is reconstructed at once up to ~10% variation is normal and should appear on the left gauge (write leads).

  • The left gauge is the negative gauge. It is the value in percent of buffer size from the write pointer position to the read pointer position when this difference is less than half of a buffer distance. It means that the writes are leading or reads are lagging.
  • The right gauge is the positive gauge. It is the value in percent of buffer size of the difference from the read pointer position to the write pointer position when this difference is less than half of a buffer distance. It menas that the writes are lagging or reads are leading.

The system tries to compensate read / write unbalance however at start or when a large stream distruption has occured a delay of a few tens of seconds is necessary before read / write reaches equilibrium.

4: Forward Error Correction setting and status

SDR Daemon source input FEC GUI

4.1: Desired number of FEC blocks per frame

This is the number of FEC blocks per frame set by the user. A frame consists of 128 data blocks (1 meta data block followed by 127 I/Q data blocks) and a variable number of FEC blocks used to protect the UDP transmission with a Cauchy MDS block erasure correction.

Using the Cauchy MDS block erasure correction ensures that if at least the number of data blocks (128) is received per complete frame then all lost blocks in any position can be restored. For example if 8 FEC blocks are used then 136 blocks are transmitted per frame. If only 130 blocks (128 or greater) are received then data can be recovered. If only 127 blocks (or less) are received then none of the lost blocks can be recovered.

4.2: Total number of frames and number of FEC blocks

This is the total number of frames and number of FEC blocks separated by a slash '/' as sent in the meta data block thus acknowledged by the distant server. When you set the number of FEC blocks with (4.1) the effect may not be immediate and this information can be used to monitor when it gets effectively set in the distant server.

4.3: Stream status

The color of the icon indicates stream status:

  • Green: all original blocks have been received for all frames during the last polling timeframe (ex: 136)
  • No color: some original blocks were reconstructed from FEC blocks for some frames during the last polling timeframe (ex: between 128 and 135)
  • Red: some original blocks were definitely lost for some frames during the last polling timeframe (ex: less than 128)

4.4: Minimum total number of blocks per frame

This is the minimum total number of blocks per frame during the last polling period. If all blocks were received for all frames then this number is the nominal number of original blocks plus FEC blocks (Green lock icon). In our example this is 128+8 = 136.

If this number falls below 128 then some blocks are definitely lost and the lock lits in red.

4.5: Maximum number of FEC blocks used by frame

Maximum number of FEC blocks used for original blocks recovery during the last polling timeframe. Ideally this should be 0 when no blocks are lost but the system is able to correct lost blocks up to the nominal number of FEC blocks (Neutral lock icon).

4.6: Reset events counters

This push button can be used to reset the events counters (4.7 and 4.8) and reset the event counts timer (4.9)

4.7: Unrecoverable error events counter

This counter counts the unrecoverable error conditions found (i.e. 4.4 lower than 128) since the last counters reset.

4.8: Recoverable error events counter

This counter counts the unrecoverable error conditions found (i.e. 4.4 between 128 and 128 plus the number of FEC blocks) since the last counters reset.

4.9: events counters timer

This hh:mm:ss time display shows the time since the reset evetnts counters button (4.6) was pushed.

5: Network parameters

SDR Daemon status3 GUI

5.1: Local interface IP address

Address of the network interface on the local (your) machine to which the SDRdaemon Rx server sends samples to.

5.2: Local data port

UDP port on the local (your) machine to which the SDRdaemon Rx server sends samples to.

5.3 Distant configuration port

TCP port on the distant machine hosting the SDRdaemon Rx instance to send control messages to. The IP address of the host where the SDRdaemon instance runs is guessed from the address sending the data blocks hence the distant address does not need to be specified.

5.4: Validation button

When the return key is hit within the address (5.1), data port (5.2) or configuration port (5.3) boxes the changes are effective immediately. You can also use this button to set again these values.

6: Desired center frequency

This is the center frequency sent to the distant device. This becomes reflected in the main frequency dial (1.1) only when it gets acknowledged by the distant server and this frequency is sent back in the frames meta data.

Use the wheels to adjust the frequency. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. The minimum value is 0 Hz and the maximum value is 9.9 GHz. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arroews. Pressing shift simultanoeusly moves digit by 5 and pressing control moves it by 2.

7: Delay between UDP blocks transmission

This sets the minimum delay between transmission of an UDP block (send datagram) and the next. This allows throttling of the UDP transmission that is otherwise uncontrolled and causes network congestion.

The value is a percentage of the nominal time it takes to process a block of samples corresponding to one UDP block (512 bytes). This is calculated as follows:

  • Sample rate on the network: SR
  • Delay percentage: d
  • Number of FEC blocks: F
  • There are 127 blocks of I/Q data per frame (1 meta block for 128 blocks) and each I/Q data block of 512 bytes (128 samples) has a 4 bytes header (1 sample) thus there are 127 samples remaining effectively. This gives the constant 127*127 = 16219 samples per frame in the formula

Formula: ((127 ✕ 127 ✕ d) / SR) / (128 + F)

8: Desired distant device sample rate

This is the device sample rate sent to the distant device. It will be divided in the distant server by the decimation factor set with (9) to give the actual sample rate over the network. This becomes effective and displayed in (1.4) only when it gets acknowledged by the distant server and this sample rate is sent back in the frames meta data.

Use the wheels to adjust the sample rate. Left click on a digit sets the cursor position at this digit. Right click on a digit sets all digits on the right to zero. This effectively floors value at the digit position. The minimum value is 32 kS/s and the maximum value is 9.9 MS/s. Wheels are moved with the mousewheel while pointing at the wheel or by selecting the wheel with the left mouse click and using the keyboard arroews. Pressing shift simultanoeusly moves digit by 5 and pressing control moves it by 2.

9: Desired distant decimation factor

This is the decimation factor to be set in the distant server downsampler. The hardware device sample rate is divided by this factor before the I/Q blocks are sent over the network. The actual network sample rate becomes effective and displayed in (1.4) only when it gets acknowledged by the distant server and this sample rate is sent back in the frames meta data.

10: Center frequency position

The center frequency in the passband wil be set either:

  • below the local oscillator (NCO) or infradyne. Actually -1/4th the bandwidth.
  • above the local oscillator (NCO) or supradyne. Actually +1/4th the bandwidth.
  • centered on the local oscillator or zero IF.

11: Other parameters hardware specific

These are the parameters that are specific to the hardware attached to the distant SDRdaemon instance. You have to know which device is attached to send the proper parameters. Please refer to the SDRdaemon documentation or its line help to get information on these parameters.

12: Send data to the distant SDRdaemon Rx instance

When any of the parameters change they get immediately transmitted to the distant server over the TCP link. You can however use this button to send again the complete configuration. This is handy if for some reason you are unsure of the parameters set in the distant server.