Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

TCP-UDP

 

Description

The TCP-UDP driver enables the exchange of data using raw Transmission Control Protocol (TCP) streams and User Datagram Protocol (UDP) datagrams.
The driver supports multiple streams allowing the exchange of data between multiple targets, applications, external equipment, etc. The format used for the data exchange is configurable by the user.
This is an asynchronous driver that will not incur high-latency, allowing models to run without having to wait for transmission or reception of network frames, which typically have a non-predictable latency.

Supported Features

The following is a list of the features supported by the driver:

  • Multiple streams:
    Multiple streams/endpoints allowing connection to multiple targets/applications/equipment
  • User-configurable payload format:
    UDP datagram or TCP stream payload format is configurable via the configuration interface, allowing matching with the remote transmission and expected format
  • Allows controlling of endianness of sent/received data
  • Single-client TCP server, TCP client, or UDP operation, using user-configurable local and remote ports
  • Automatic reconnection in TCP modes
  • NIC binding and NIC speed reconfiguration on Linux targets
  • User-configurable decimation factor
  • Runtime reception and transmission controls
  • Transmission and reception statistics
  • IP aliasing (on Linux platforms)
  • MSB message serialization for custom data
  • Configurable VLAN interface

Configuration

The driver is entirely configurable via the RT-LAB GUI. Users can easily add and delete streams and configure their frame format.

General Configuration

The first parameters to be configured are found below:

Use an RT core for asynchronous computation

If set to true, the driver reserves a real-time CPU core for its communication system and can handle a bigger amount of data.

If set to false, the communication system defaults to core 0.

VerboseIf set to true, the entire configuration is displayed during the loading of the model.
Data frame adjustments

This drop-down offers options for automatic adjustments to the data frame as it is being built.
This is done when a signal is added or removed or when the vector size, byte offset, bit offset or size in bits (including type changes) is modified.

The options are:
- None: no actions are taken
- Ensure no overlap: overlaps will be automatically corrected; this option permits having gaps in the frame
- Ensure contiguous: overlaps will be automatically corrected and any possible gaps will be automatically erased

The correction is done by displacing all signals affected by the changes mentioned above by the correct amount of bits.
Float and Double data types need to be byte-aligned, therefore they are moved to the nearest appropriate location possible.

Enable virtual mode

In virtual mode, the model can be executed even if this I/O interface is not compatible with the hardware configuration of the system.

The connections between the model and the I/O interface will be done during the initialization, but the I/O interface will not do anything.

The virtual mode can be used to troubleshoot problems on a system without having the required hardware, or to prepare a model with different
I/O interfaces even if the final hardware platform is not available.

TCP-UDP Stream Configuration

By default, the driver is configured with two streams with a TCP client and a TCP server, both using the internal loopback network on port 23000.

The next image shows a stream configured as a TCP client. Descriptions follow.


Each TCP-UDP stream device has multiple parameters:

Protocol

Two choices are available:

  • TCP: Stream exchanges data over TCP.
  • UDP: Stream exchanges data over UDP. 
TCP modeTwo choices are available:
  • Server: Stream endpoint acts as a TCP server.
  • Client: Stream endpoint acts as a TCP client. 

Note: Only visible when TCP is selected as protocol

TCP port

Select the TCP port on which the stream communicates. The default port is 23000.

Note: Only visible when TCP is selected as protocol

UDP local port

Select the local UDP port on which the endpoint receives data. The default port is 23001.

Note: Only visible when UDP is selected as protocol

UDP remote port

Select the remote UDP port on which the endpoint sends data. The default port is 23002.

Note: Only visible when UDP is selected as protocol

NIC name

The desired network interface name. The proper interface name should be selected based on the information given by the Linux command "ifconfig". The name of the Ethernet network is returned.

If the driver is running Windows this field is ignored.

Local IP Address

IP address of the local TCP/UDP endpoint

  • On Linux platforms, the IP aliasing functionality can be used to give each stream a different IP address even though the same network interface will be used. Each stream will have its own IP alias (i.e. eth0:0, eth0:1 ...) and they should appear in the list displayed by the linux command "ifconfig".
  • It is possible to use the keyword ‘auto’ and the IP address of the first network interface of the simulator will be automatically used to handle the communication of this stream.
NIC speed

The desired network interface speed. If the driver is running on Windows this field is ignored.

Several choices are available:

OptionDescription
DefaultDoesn't change the network interface speed
ForceAutoSet auto-negotiation mode
Force10Set the network interface speed to 10mbps
Force100Set the network interface speed to 100mbps
Force1000Set the network interface speed to 1gbps
Force10000Set the network interface speed to 10gbps
Remote IP address

IP address of the remote TCP/UDP endpoint.

Note: Only visible when TCP Server or UDP is selected.

Decimation factorNumber of timesteps between transmission triggers. A value of one triggers transmission at each timestep.
Enable transmission controlAdds a data point that controls whether or not the I/O interface sends data. If disabled, transmission is always enabled.
Enable reception controlAdds a data point that controls whether or not the I/O interface receives data. If disabled, reception is always enabled.
Swap byte orderSwaps the native byte order when transmitting data.
Enable custom byte swapIf Swap byte order is enabled, this field becomes visible. If enabled, byte swap option for custom data type is available.
Use sequential bit ordering for custom data

When enabled, each custom data frame on the stream will have its bits reorder from Most Significant Bit (MSB) to Least Significant Bit (LSB), which in turn reorders the messages in the stream, regardless of the endianness of the machine. Byte within messages are in MSB and messages with the smallest bit offset are serialized first. 

For instance, given that Message 0 and Message 1 have the following characteristics:

  • Message 0: bit offset of 0, byte offset of 0 and a value of 0x1
  • Message 1: bit offset of 4, byte offset of 0 and a value of 0xA BC DE F0

The MSB serialization will package the messages in the memory block the following way: 

  • Byte #0: 0x1A
  • Byte #1: 0xBC
  • Byte #2: 0xDE
  • Byte #3: 0xF0

Which will result 0x1A BC DE F0, as opposed of serializing traditionally in little endianness, read in a U32 register: 0xF0 DE BC 1A

Use VLAN

When enabled, this creates a VLAN interface based on the NIC name defined previously and the following parameters become visible:

  • VLAN index: Each stream must have a unique index.
  • VLAN address: An IP address dedicated to the VLAN.

Frame Format

A TCP-UDP stream frame builder example is shown below:

Users can add, remove and move data points as desired with the toolbar controls.

For each data point, the following parameters are configurable:

NameA specific name for the data point. This name must be unique within the frame.
TypeThe data type to use to transmit/receive the data. Custom types allow for bit fields.
Vector sizeNumber of values to transmit/receive.
Byte offsetStarting offset of data within frame in bytes.
Bit offsetStarting offset of data within byte in bits. May only be configured with custom data types.
Size (bits)Number of bits to use to transmit/receive each value. May only be configured with custom data types.
Initial valueInitial value for each element.
MinMinimum possible value for data type.
MaxMaximum possible value for data type.

Connections

The image below shows example connections points for the TCP-UDP I/O interface:

Once the driver has been configured as desired and associated with the proper model subsystem, the user needs to connect points in the model to points in the driver by using the corresponding RT-LAB GUI.

This connection panel shows all the driver's and model's connectable points, once the model has been compiled. Users can also make connections on LabVIEW panels.

  • If the Enable reception control option is selected, an additional Reception enable connection point is available to control whether or not the endpoint reads data from its socket.
  • If reception is disabled, data is still read from the socket, but discarded before reaching the model or panel.
  • If the Enable transmission control option is selected, an additional Transmission enable connection point is available to control whether or not the endpoint transmits data to its socket.
  • An additional Connected connection point is available when the stream is configured to use TCP and can be used to indicate whether the local endpoint is connected to the remote endpoint.

Limitations

The following is a list of the limitations of the driver:

  • NIC binding and speed setting only available on Linux targets.
  • Swap endianness only available with byte-aligned data.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323