Introducing DDS Blockset from MathWorks
Written by Shwetha Patil, DDS Blockset Product Manager, MathWorks
September 28, 2021
MathWorks has been a long-time supporter of the Data Distribution ServiceTM (DDS) standard. RTI Connext®, based on DDS, has been integrated with Simulink® for several years, enabling users to import data for more realistic simulation work.
Now, MathWorks has raised the bar through its newly-launched Simulink add-on product – DDS Blockset. This productivity tool, available directly from MathWorks, enables you to create DDS applications in Simulink through apps, a DDS dictionary and blocks. DDS Blockset provides apps and blocks for modeling and simulating software applications that publish or subscribe to DDS middleware. Its DDS dictionary lets you manage, create and edit your DDS definitions in Simulink. It provides blocks for publishing and subscribing samples to DDS, including their corresponding Quality of Service (QoS). It fully integrates with the RTI Connext stack and generates C++ code and DDS-XML files from Simulink models (with Embedded Coder®).
This technical article will provide Connext users with an overview of DDS Blockset and its workflow, and the fundamental aspects of DDS application development in Simulink. To learn how DDS Blockset conceptually connects your Simulink applications to use DDS, I invite you to read this summary.
[RTI note: If you are not currently using Connext, here are the instructions to download and use a two-month trial version. Simulink users can apply for a longer-term license here.]
Let's get started!
If you have an application modeled in Simulink that you would like to be able to use with Connext, you can use the DDS Blockset to easily connect to your DDS middleware platform. The DDS Blockset brings DDS concepts into the Simulink environment, models those concepts in your Simulink application, and then enables you to connect your application to DDS.
You can learn how to model DDS applications in Simulink by following these steps:
STEP 0: Install RTI Connext for DDS Blockset
Before using the DDS Blockset with RTI Connext, you need to install the Connext license from RTI. You can download it from the website or from the Add-Ons manager that is built-in directly with MATLAB.
At the end of the installation process, you are asked about opening the Getting Started Guide script for finishing the configuration steps for RTI Connext for DDS Blockset. Click on the ‘Run’ button as the picture below shows, to finish the setup.
This installs a whole evaluation package of RTI Connext version 6.0.1. You can open RTI Launcher with all the RTI Connext tools and services by typing in MATLAB:
STEP 1: Create DDS Definitions
DDS Blockset enables applications modeled in Simulink to use DDS by bringing DDS concepts such as Domains, Topics, Types and QoS into the Simulink environment. To bring these concepts into Simulink, you can use the DDS Application Quick Start to import DDS definitions from XML or IDL, use previously-defined definitions stored in Simulink, or create default definitions from the application model. Here's how:
- Open a Simulink model, or choose the DDS Blockset shapes demo.
- Launch the “DDS Application Designer” App from the Simulink Apps toolstrip.
- The DDS Application Quick Start will ask you to specify the DDS application name and product. Select the application name or leave the default one, then choose RTI Connext Professional or RTI Connext Micro.
- Specify the source of the DDS definitions. You can import DDS definitions from XML, use previously-defined definitions stored in Simulink, or create default definitions from the application model. For this example, select “Import from IDL/XML”, then select a DDS-XML file which follows the DDS-XML standard that allows you to define a DDS system within an XML, including different QoS, entities (such as Domain Participants, Publishers or Subscribers), data types, etc.
This XML file can be created manually following the DDS-XML standard, or by using tools that help you with that task. For example, RTI System Designer provides a Graphical Interface to create these DDS-XML files more easily.
- To wrap up the transition from DDS to Simulink, click Finish. When you finish the DDS Application Quick Start, the app creates your DDS application, associates it with the DDS Dictionary, and configures it appropriately for RTI Connext.
STEP 2: View and Edit DDS Definitions
To view these DDS definitions in the DDS Dictionary, open the dictionary and view the Types, Domains, and QoS tabs.
STEP 3: Construct the Simulink Model as Publisher and Subscriber
In the Simulink model, view how the DDS blocks Take DDS Sample and Write DDS Sample are used to subscribe to and publish the location of the shape.
STEP 4: Configure the DDS Interface
In addition to the modeling, you can view the DDS interface configuration of the DataReaders and DataWriters for the model. This example below uses the Reader/Writer XML path configuration mode to map input and output ports with readers and writers defined in the DDS dictionary to configure the interface.
STEP 5: Build and Deploy the Application to DDS Network
DDS Blockset enables out-of-the-box support for RTI Connext. To use this support, build your application model and deploy your generated executable in your development environment.
You can also leverage the simulation power of Simulink to verify the run-time behavior of DDS application models using QoS policies such as HISTORY.
Summary and Conclusion
Integrating the DDS middleware standard into modeling and simulation makes it easy to design and deploy DDS applications. DDS Blockset is fully integrated with the RTI Connext connectivity framework, providing engineers with apps, a DDS dictionary and DDS custom blocks to model DDS communication between Simulink and other DDS applications. System designers and application developers can incorporate their Simulink designs as virtual components, ready to connect to other Simulink and non-Simulink components through the DDS databus integrated with RTI Connext. Users can generate C++ code with DDS APIs from Simulink models and deploy their models integrated with RTI Connext.
As Product Manager of DDS Blockset, I would be happy to help you through the development process of creating your own DDS applications in Simulink. For more information on DDS Blockset, please see the Simulink DDS demo presented by MathWorks in the recent RTI webinar - “Introducing MathWorks DDS Blockset with RTI Connext”.
About the author
Shwetha Bhadravathi Patil is a Senior Product Manager at MathWorks with a focus on DDS, AUTOSAR and Simulink code generation products. She is versed in embedded application software development for automotive ECUs. Prior to MathWorks, Shwetha worked as a software developer for Delphi automotive on AUTOSAR-based projects and worked as a technical marketing engineer for automotive Video CODECs at Analog Devices Inc. Shwetha graduated from Tufts University with a master’s degree in engineering management and Manipal University with a master’s degree in automotive embedded systems.