Network Communication Interface

Sometimes, it is necessary to interface with external applications or devices for information or extra computational purposes. In order to allow communication with external applications or devices, you must add User Datagram Protocol (UDP) extensions to your simulation.
If you are connecting to an external device or application (e.g., Simulink), this section and Network Communication Add-on should provide you with enough information to set it up to communicate with Vortex® Studio using UDP.

The following UDP extensions are available:

UDP Network Communication Add-on Overview

Network Communication Add-on is a device that allows communication with external applications or devices over User Datagram Protocol (UDP).

The Network Communication Add-on devices can be created in both the content and the application set up as a device. The protocol used is the same as the Real-Time UDP for MATLAB and Simulink.

Data Format

The UDP Module sends data in binary and expects to read data in the same format.

If a UDP Send extension has multiple fields, the data will be packed one value after the other, the packet will be as big as the sum of each field's data size.
One packet with all field values is sent per extension, per simulation step.

The UDP Receive extension is expecting its data to be packed the same way that it is sent.
The module will try to read one packet per extension per step.  The packet read must contain a value for each field.  Partial packets will be rejected and a warning will be issued in the log.
The order of fields within the extension matters: data will be packed/unpacked in the same order as within the extension.

This table shows the direct conversion between the Vortex type and the external type.

Vortex TypeExternal TypeBytes
doubledouble8
floatsingle4
intint324
unsigned intuint324
shortint162
unsigned shortuint162
charint81
unsigned charuint81
boolboolean1

Data is packed in little-endian.
Single and double values are packed using the IEEE 754 standard representation for binary32 and binary 64, respectively.


Setup

UDP Module

In order to enable UDP network communication, you must first add the UDP Module to your Setup file. The UDP Module manages all UDP send and receive extensions (see below). The UDP module will read data from the network and fill the UDP Receive extensions during the pre-update phase of the simulation and will write data from the UDP send extensions to the network during the post-update phase of the simulation. Data is read/written at the frame rate of the simulation.

There must be a UDP Module located in the application setup file in order to make the extensions functional in the Vortex Studio Editor. The extensions are not functional when their name is grayed out.

From the Vortex Studio Editor and create a new setup or open an existing one.


To add a UDP Module:

  1. In your Setup file, select Modules in the Toolbox.
  2. Double-click UDP Module to add it to your setup.
  3. If desired, rename the UDP Module in the Name field of its Properties panel.


The editor default setup file already has a UPD Module.

Adding UPD extensions as content extensions

UDP extension can be used to drive data to an external UDP system, from the content and back.

For example, a Connection Container can be added in the same object as the UDP extension. In the same example, a Controllable Human is also added to the content in order to demonstrate data field connections.

Data fields from Human Control are added to Connections.

Once the data fields are added to the Connections Container, the fields can be linked together, as seen in the next image.

The data sent to the external application or device will be transferred to the Controllable Human's Body Move Speed and Bode Rotate Speed.

UDP Send extension in the content

In order to send communications to external applications or devices using UDP, you must add a UDP Send extension to your simulation.

To add a UDP Send extension:

  1. In your scene or mechanism, select Network in the Toolbox.
  2. Double-click UDP Send to add it.
  3. Right-click the UDP Send extension in the Explorer panel, then select Edit from the menu to add input data.
    1. In the resulting window, click Add. A new input row appears in the table.
    2. Edit the name of the input.
    3. Click in the Type field to open a drop-down list of possible data types for your input field (e.g., double, int32, Boolean).
    4. Click in the Physical Dimension field to open a drop-down list of possible dimensions for your input field (e.g., length, volume, mass).
    5. Add as many input fields as required, then click Ok.

In the UDP Send extension's Properties panel, you will see the following fields.

  • Inputs
    • Input data: This section displays the input data (via the Edit functionality mentioned above ) in the specified data type.
    • Debug
      • Log Traffic: When selected, adds information to the application log.
  • Outputs
    • Stats
      • Bound: Indicates whether the extension has made the connection through the socket.
      • Packets: Displays the number of packets communicated with the device.
      • Bytes: Displays the number of bytes communicated with the device.
  • Parameters
    • Auto Assign Locals: When selected, automatic local port and IP addressing is allowed
    • Local Address: Shows the source IPv4 address from which to send data. The default address (127.0.0.1) sets the address to the localhost.
    • Local Port: Displays the source port from which to send data.
    • Remote Address: Remote IPv4 address to which data is sent.
    • Remote Port: This shows the port to which data is sent.
  • Device ID: This section is filled in automatically by the module, providing identification information for the communicating device.

UDP Receive extension in the content

In order to receive communications from external applications or devices using UDP, you must add a UDP Receive extension to your simulation.


To add a UDP Receive extension:

  1. In your scene or mechanism, select Network in the Toolbox.
  2. Double-click UDP Receive to add it.
  3. Right-click the UDP Receive extension in the Explorer panel, then select Edit from the menu to add output data.
    1. In the resulting window, click Add. A new output row appears in the table.
    2. Edit the name of the output.
    3. Click in the Type field to open a drop-down list of possible data types for your output field (e.g., double, int32, Boolean).
    4. Click in the Physical Dimension field to open a drop-down list of possible dimensions for your output field (e.g., length, volume, mass).
    5. Add as many output fields as required, then click Ok.

In the UDP Receive extension's Properties panel, you will see the following fields.

  • Inputs
    • Debug
      • Log Traffic: When selected, adds information to the application log.
  • Outputs
    • Output data: This section displays the output data (via the Edit functionality mentioned above ) in the specified data type.
  • Stats
    • Bound: Indicates whether the extension has made the connection through the socket.
    • Packets: Displays the number of packets communicated with the device.
    • Bytes: Displays the number of bytes communicated with the device.
  • Parameters
    • Local Address: Shows the source IPv4 address from which to send data. The default address (127.0.0.1) sets the address to the localhost.
    • Local Port: Displays the source port from which to send data.
    • Auto Assign Remote: When selected, an automatic remote port and IP address are allowed.
    • Remote Address: Displays the source from which to receive data. The default address (0.0.0.0) enables the acceptance of all UDP packets from any accessible computer. If set to a specific IP address, only packets arriving from that address are received.
    • Remote Port: This shows the port of the target computer.
  • Device ID: This section is filled in automatically by the module, providing identification information for the communicating device.

Adding UDP extensions as Devices in the application

If you are connecting to an external device or application (e.g., Simulink), this section and the Network Extensions above should provide you with enough information to set it up to communicate with Vortex® Studio using UDP.


Similar to the module, the send and receive extensions can be added by searching UDP Send or UDP Receive in the Toolbox.

Once an extension is added, it is possible to modify its properties in the Properties panel.

In the Properties panel, you will find the following information:

  • Networking information (address/port)
  • Device ID
  • List of data to be sent/received

Parameters

The local address and port identify the host IP address and port, while the remote address and port describe the IP address and port of the external application or device communicating with Vortex Studio Editor.

The Device ID lists the information concerning the device, which is used in order to identify the device. This will be filled automatically by the module.

Received and Sent Data

The list of data to be sent or received can be found in the Outputs section when dealing with the UDP Receive extension, and the Inputs panel when dealing with the UDP Send extension.

As the name suggests, the UDP Receive extension will receive data, while the UDP Send will send data according to this data list.

To add data, right-click on the extension and select Edit. This window is used to add and remove fields of data, e.g., inputs and outputs.

In the example shown above, the UDP Receive extension will receive two double values (Move and Rotate) and one int32 value (Run).

Note The order of the data in the list will dictate the structure of the sent/received data. However, the names have no impact and are simply there to identify them locally.

Mapping the Device

Once the communication device has been created in the application setup, it can be mapped in the Vortex Studio Player via The Control Presets tab.

Mapping allows you to connect data fields to a Control Interface, which in turn is connected to a mechanism.

In the previous image, the UDP Receive device is associated with "ControlInterfaceInputs".

Once the data fields are properly associated, the data will automatically be transmitted to the Control Interface.

It is also possible to set the communication device as a Control Interface's default device in Vortex Studio Editor. This means that the Control Interface will automatically associate this device when the content is loaded in Vortex Studio Player.