Main Content

Deploy DDS Applications

DDS Blockset connects applications modeled in Simulink® to DDS by providing out-of-the-box support for the DDS vendors RTI and eProsima. To use out-of-the-box DDS, create and model a DDS application in Simulink, set up the environment, and use Embedded Coder® to build the application model. The build creates exported XML, generated C++ code, and an application executable that you can use to directly connect to the DDS network.

Build and Deploy DDS Applications

To deploy your application on the DDS network:

  1. Ensure that your model is configured correctly. Verify that the model ports are configured and mapped appropriately for DDS. For more information, see Interactively Configure DDS Interface.

  2. Set up the environment. DDS Blockset generates an executable specific to the DDS vendor that you select, RTI or eProsima. To verify or change your vendor selection, you can use the Configuration Parameters dialog box to review the toolchain setting for your application. To build an executable of your application, set up your environment in a supported platform with a supported C++ compiler. If your target vendor is eProsima, additional setup is not required. If your target vendor is RTI, you must also install RTI Connext. For more information, see DDS Blockset System Requirements.

  3. Build the application model. On the DDS tab, click Build.

  4. Run the executable and connect your application to the DDS network.

Overview of Generated Files

When you build your DDS application model, the following folders and files are generated in your current working folder:

  • Application executable — The executable that you can deploy to connect the application to the DDS network.

  • Embedded Coder build folder — The generated C++ code files.

  • Simulink project folder (slprj) — The model simulation files.

  • Simulink Data Dictionary file — The associated DDS Dictionary (.sldd) file.

  • DDS Application model — The Simulink model for the application.

  • Exported XML/IDL file — The XML/IDL specifications of your DDS application.

Display of current folder containing generated folders and files.

You can use these generated files to analyze, deploy, and port your DDS application. Additionally, you can use the packNGo functionality to relocate and rebuild your application.

Portability of DDS Applications

To relocate, unpack, and rebuild your DDS application in another development environment, you can use packNGo. The packNGo function enables you to relocate files so that you can recompile for a specific target environment or rebuild in a development environment where MATLAB® is not installed. By default, the function packages the files as a flat folder structure in a ZIP file within the code generation folder. After you relocate the ZIP file, use a standard ZIP utility to unpack the compressed file.

To configure your model to build with packNGo:

  1. Open the Configuration Parameters dialog box.

  2. Select Pack code and artifacts.

  3. On the toolstrip, click Build.

For more information, see packNGo (Embedded Coder).

Implementation Details and Generated C++ Code

The implementation of DDS is specified by the Object Management Group (OMG) standard and implemented by several vendors in several different programming languages. The DDS Blockset provides out-of-the box integration with the DDS vendors RTI and eProsima. Specifically, the blockset supports the C++ implementation of the DDS standard provided by RTI and eProsima. If you are interested in these vendor APIs, refer to your vendor documentation.

The basic architecture of the generated C++ code is that the application is composed of message classes, vendor helper classes, and the main file. The message classes enable the application to send and receive data. The vendor helper classes are specific to the vendor and load the application profile, register the data types, create and initialize the DDS entities, and wrap the send and receive message classes specific to the vendor API. The main file then performs the application logic. If you would like to examine the generated C++ code, view the Embedded Coder build folder.

Generated C++ Class Name and Namespace Customization

If you would like to customize the generated C++ code for your DDS application, you can control the generated class name and namespace for your DDS application model interactively or programmatically.

To interactively configure these aspects of the generated code, from an open model, on the DDS tab, click Code Interface, select Class Name & Namespace, and customize the names in the opened configuration dialog box.

Dialog box for configuring C++ class name and namespace.

To programmatically configure the class name and class namespace, use the Embedded Coder API functions getClassName (Embedded Coder), setClassName (Embedded Coder), getClassNamespace (Embedded Coder), and setClassNamespace (Embedded Coder). For more information, see Configure class namespace (Embedded Coder).

Debug and Troubleshoot

A few common build issues you can troubleshoot are the following:

Incorrect environment setup

  • Description — If you select RTI as your vendor but do not install RTI Connext, then you are unable to deploy your application.

  • Action — Download and install RTI Connext.

Missing or invalid mapping for inports and outports in application model

  • Description — If the inports or outports have not been configured correctly the model does not build.

  • Action — Map the inports and outports in the application model to DDS Topics and configure the ports with the corresponding DDS data types.

Inconsistent data management of the DDS definitions

  • Description — If you map an inport or an outport to a Topic and then delete or change the data type for the Topic the model does not build.

  • Action — Verify that the DDS definitions are available in the associated DDS Dictionary.

Considerations and Limitations

  • RTI Connext Micro adapter — The default network interface names for your system may differ from the default interface names used in the RTI Micro Adapter, RTIMicroAdapter.hpp. In such cases, the participant may not initialize properly. Check and update the strings used for the names and manually rebuild the executable.

  • RTI Connext Micro DataReader and DataWriter capacity limits — The default number of allocated DataReaders (remote_reader_allocation) and DataWriters (remote_writer_allocation) for an application is 48. Depending on other DDS applications running and your network conditions, the number of readers and writers my exceed 48. You can configure the RTIMicroQosDefn.inl to increase this limit or you can change to a Domain where less readers and writers are currently occupied.

  • Folder Names with Special Characters — The build process might produce an error if a build-related folder path contains:

    • Unicode characters that do not belong to the system locale.

    • A Japanese (multibyte) character where the final byte is equal to the 5c hexadecimal character. The make and compiler tools might incorrectly interpret the final byte as the '\' (backslash) character.

  • DDS Target Specification — DDS Blockset does not support compiling the code generated from a DDS application model for a non-DDS application

  • DDS Definitions — The DDS Topics and QoS for your application are retrieved from the DDS Dictionary associated with your application model. Ensure that this dictionary is on your MATLAB path to appropriately build your model.

  • Code Generation Data Types — The generated C++ code does not provide support for certain data types. Multidimensional arrays are not supported for code generation.

  • Security — There are security risks inherent in communication platforms. These risks include the potential of malicious users to attempt to listen to or spoof DDS communication. Additionally, late-joining readers can potentially access previously transmitted data. To increase protection against these security risks, download and use the secure version of your vendor. The version of eProsima included with DDS Blockset is not the secure version.

Related Topics

External Websites