Class UDPGenerator

Class Documentation

class UDPGenerator

Generates a stream of UDP packets according to the UDPFormat. The UDP packet stream is generated with zero’d data, but the metadata from the specified UDPFormat is used.

Public Functions

UDPGenerator() = default

Construct a new UDPGenerator object.

UDPGenerator(std::string host, int port)

Construct a new UDPGenerator object.

Parameters
  • host – IPv4 address for destination packets

  • port – UDP port number for destination packets

~UDPGenerator()

Destroy the UDPGenerator object.

void add_induced_error(uint32_t packet_number, ska::pst::recv::FailureType failure_type)

Introduce an error into the generated UDP packet stream.

Parameters
  • packet_number – packet at which to induce the error

  • failure_type – type of failure to induce

void configure_beam(const ska::pst::common::AsciiHeader &beam_config)

Process fixed configuration and perform resource allocation. Configures the generator using the fixed configuration parameters that are common to all observations and available at launch. Configures the UDPFormat and UDPStats instances. Opens the UDP socket to transmit UDP packets.

Parameters

beam_config – fixed configuration parameters

void configure_scan(const ska::pst::common::AsciiHeader &scan_config)

Processes the runtime configuration parameters in the header. Prepares the format with the runtime configuration parameters.

Parameters

scan_config – dynamic configuration parameters

void transmit(unsigned tobs, float data_rate)

Transmit the UDP data stream, returning once al data have been sent. Will terminate early if keep_transmitting is set to false.

Parameters
  • tobs – duration of the data transmission in seconds.

  • data_rate – data rate for the data transmission in bytes per second

inline void stop_transmit()

Stop transmitting data immediately.

void start_monitor_thread()

Start the monitoring thread that reports data transmission statistics.

void stop_monitor_thread()

Stop the monitoring thread that reports data transmission statistics.

void monitor_method()

Monitor the data transmission performance.

void set_start_packet_sequence_number(uint64_t psn)

Set the starting packet sequence number.

Parameters

psn – packet sequence number of the first packet generated

void set_beam_id(uint64_t beam_id)

set the expected beam id for the packet stream

void set_scan_id(uint64_t scan_id)

set the expected scan id for the packet stream

UDPStats &get_stats()

Return a reference to the UDP statstics management object.

Returns

UDPStats& UDP statistics management object

Protected Attributes

uint64_t beam_id = {0}

Expected beam id for the packet stream.

uint64_t scan_id = {0}

Expected scan id for the packet stream.

std::shared_ptr<UDPFormat> format = {nullptr}

UDP format provides the mapping from UDP metadata to memory addresses.

UDPHeader udp_header

UDP Header provides the encoding of UDP packets.

std::shared_ptr<common::PacketGenerator> data_generator = {nullptr}

Optional PacketGenerator sets the data and weights of each UDP packet.

UDPSocketSend sock

UDP sending socket.

UDPStats stats

statistics of UDP transmission performance

unsigned nsig = {1}

number of signals present in the data stream

unsigned nchan = {1}

number of channels in the data stream

unsigned ndim = {2}

number of dimensions in the data stream

unsigned nbit = {8}

number of bits per sample in the data stream

unsigned npol = {2}

number of polarisations in the data stream

std::string data_host

destination IPv4 address for the data stream

int data_port = {0}

destination UDP port for the data stream

std::string local_host

!local IPv4 address for the interface which will transmit the data stream

float bw = {0}

total bandwidth of the data stream in units of mega hertz

float tsamp = {0}

sampling interval of the data stream in units of micro seconds

unsigned bits_per_second = {0}

number of bits per second in the data stream

unsigned bytes_per_second = {0}

number of bytes per second in the data stream