Main Content

Interactively Configure DDS Interface

To connect a DDS application to publish and subscribe to the DDS network, configure a DDS interface. A DDS interface is the connection point between the application and the DDS network. Specifically, the interface defines the Topic and Quality of Service (QoS) for the DataReaders and DataWriters in an application. In an application model, the inports represent DataReaders and the outports represent DataWriters. To configure an interface, use the Code Mappings editor to configure the ports as readers and writers that meet your application requirements.

DDS model connects to the DDS network through the DDS interface.

How to Configure a DDS Interface

To configure the interface, you can either configure your model interactively by using default behavior or import XML definitions.

Configure a Model Interactively by Using Default Behavior

Configuring a model interactively by using default behavior enables a simplified, quick, and intuitive way to configure a DDS interface that does not require prior XML specification of DataReaders and DataWriters. You can use the Code Mappings editor to select Topics for your application and specify to have DDS Blockset generate DataReaders and DataWriters for you to connect to the DDS network. You can also configure additional QoS and Topic filters in the editor.

Configure a Model by Using Imported XML Definitions

Configuring a model by using imported XML definitions supports using XML specifications for DataReaders and DataWriters to provide greater customization and control over these definitions. Additionally, XML specifications provide the ability to define specific properties of DataReaders and DataWriters. You can use the Code Mappings editor to view the previously defined DataReaders and DataWriters for the model ports and the Topic and QoS properties from those definitions that have been loaded into the application.

Comparison of Configuration Styles

The differences between these configuration styles are listed in this table.

Configuration StylesRequirementsSource of Topic and Filter OptionsSource of QoS OptionsBenefits
Configure model interactively by using default behaviorNone
  • Topics defined in the DDS Dictionary

  • Configure Topic filters interactively

  • Default QoS

  • Built-in QoS profiles

  • Imported XML QoS profiles

  • Ideal for DDS newcomers

  • No XML specification necessary

  • DDS Blockset manages underlying DataReader/DataWriter specifications so you do not have to manage, create, or troubleshoot these entities

Configure model by using imported XML definitionsDataReader or DataWriter must be specified in imported XMLTopics and Topic filters specified within DataReader/DataWriter definitionsQoS specified within DataReader/DataWriter definitions
  • Easily map DDS applications defined in XML into Simulink®

  • Supports customization and control with explicit DataReader/DataWriter specifications

Configure DDS Interface Interactively by Using Default Behavior

To configure a DDS interface interactively by using default behavior:

  1. Open the environment.

    1. Open a model in the DDS Blockset app.

    2. Import or create DDS definitions. Configuring a DDS interface by using default behavior does not require prior XML specifications. You can use the DDS Application Quick Start to create a default dictionary for your application or use an existing DDS Dictionary or imported XML.

    3. Open the Code Mappings editor to configure the DDS interface. On the DDS tab, click Code Interface and select Individual Element Code Mappings.

      Inports tab of the Code Mappings editor open in DDS model.

  2. Select the Topics. For each inport or outport in the application model, select a Topic specified in the drop-down options by its path (DomainLibrary/Domain/Topic). The list of drop-down options shows the Topics that are specified with the same DDS data type as the port. If you do not see a Topic that you expected, review the port data type and the Registered Type for the Topic.

  3. Select the DataReaders and DataWriters. To use default behavior, set the Reader XML Path or Writer XML Path to Auto to have DDS Blockset automatically generate a reader or writer for the port.

  4. (Optional) Configure Topic filters. You can create a filter for a Topic so that your application only receives data relevant to your application without having to implement additional logic (in DDS this is referred to as a Key). To create a filter, in the row of the Topic that you want to filter, select the pencil icon Pencil icon and configure the properties Filter Kind, Filter Expression, and Filter Parameter List. The Filter Kind property refers to whether you want to specify your filter by using a string or by using a SQL expression. This choice also determines how the filter is expressed in the exported XML from your application. You can then use the Filter Expression and Filter Parameter List fields to create your filter.

    The following are simple examples of how to configure filters by using a String Match or a SQL expression:

    • Create a String Match filter — For example, if you want to specify a filter so that you only receive data from a qualitative Topic that publishes squares of different colors, but you want to only subscribe to the colors Blue and Yellow, you can configure:

      • Set Filter Kind to String Match

      • Set Filter Expression to Color MATCH %0

      • Set Filter Parameter List to Blue and in the next line Yellow

      The generated XML code would be the following:

       <filter name="MyFilter" kind="builtin.stringMatch">
       <expression>Color MATCH %0</expression>
       <parameter_list>
       <param>Blue</param>
       <param>Yellow</param>
       </parameter_list>
       </filter>
    • Create a SQL filter — For example, if you want to specify a filter so that you only receive data from a numeric Topic, shapesize, for values greater than 5 you can configure:

      • Set Filter Kind to SQL

      • Set Filter Expression to shapesize > 5

    The generated XML code would be the following:

    <data_reader name="XMLAppCreationTestReader" topic_ref="XMLAppCreationUserTestTopic">
     <datareader_qos base_name="qosLibrary::DefaultProfile"/>
     <filter name="XMLAppCreationUserTestCft" kind="builtin.sql">
     <expression> shapesize &gt; 5 </expression>
     </filter>
     </data_reader>
  5. (Optional) Configure the QoS. To specify QoS, in the editor, set the Reader QoS or Writer QoS to a drop-down option. You have several options to configure QoS:

    • You can leave the QoS policy as the default. The default QoS profile is the default provided by your target DDS vendor (RTI or eProsima). To see details of this profile, refer to your vendor documentation.

    • You can select from built-in QoS profiles. The built-in QoS profiles are profiles provided by the DDS Blockset. These profiles provide a set of QoS policies applicable to event-based, real-time event-based, real-time stream, and stream applications.

    • You can select from QoS profiles imported from XML. Imported QoS profiles also appear as options in this drop-down list.

    For more information, see Manage QoS.

  6. Build and deploy application to DDS network.

Configure DDS Interface by Using XML Definitions

To configure a DDS interface by using imported XML definitions:

  1. Open the environment.

    1. Open a model in the DDS Blockset app.

    2. Import DDS definitions. Import XML definitions by using the DDS Application Quick Start or DDS Dictionary.

    3. Configure the DDS interface. Open the Code Mappings editor. On the DDS tab, click Code Interface and select Individual Element Code Mappings.

      Inports tab of the Code Mappings editor open in DDS model.

  2. Select the Topics. For each inport or outport in the application model, the Topics appear in the editor as specified in your imported XML and shown by its path (DomainLibrary/Domain/Topic). The additional set of drop-down options shows the Topics that are specified with the same DDS data type as the port. If you do not see a Topic that you expected, review the port data type and the Registered Type for the Topic.

  3. Select the DataReaders and DataWriters. The DataReaders and DataWriters appear in the editor as specified in your imported XML

  4. (Optional) Configure Topic filters. If you are using imported XML definitions, the keys fields are pulled from the XML definitions of the DataReaders and are viewable in a dialog box as read-only when you select the pencil icon Pencil icon. If you would like to edit these properties, you can edit and reimport the source XML file that contains the definitions for your DataReaders. Alternatively, you can select a different DataReader and manually configure the key fields.

  5. (Optional) Configure the QoS. To specify QoS, in the editor, the Reader QoS or Writer QoS should already be filled with the QoS defined in your XML definitions for your selected reader or writer. You have several options to configure QoS:

    • You can leave the QoS policy as the default. The default QoS profile is the default provided by your target DDS vendor (RTI or eProsima). To see details of this profile, refer to your vendor documentation.

    • You can select from built-in QoS profiles. The built-in QoS profiles are profiles provided by the DDS Blockset. These profiles provide a set of QoS policies applicable to event-based, real-time event-based, real-time stream, and stream applications.

    • You can select from QoS profiles imported from XML. Imported QoS profiles also appear as options in this drop-down list.

    For more information, see Manage QoS.

  6. Build and deploy application to DDS network. Build the model and use the executable to deploy the application.

Considerations and Limitations

  • Topic filters — Topic filters are not available for RTI Connext Miro or eProsima.

  • 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.

  • Data Types — Inports and outports must have the same DDS data type as the Topic that they subscribe to or publish.

  • Unique Reader/Writer Mapping — Inports and outports must map to unique DataReaders and DataWriters. For example, two different inports cannot map to the same DataReader, and two different outports cannot map to the same DataWriter.

  • Accurate Data Management — Inports and outports must map to Topics and Quality of Service (QoS) definitions that can be found in the associated DDS dictionary or XML. For example, if you map the ports for a DDS application, and then remove Topics or QoS profiles from the dictionary, you might create invalid mappings where previously mapped ports now are configured to deleted definitions.

  • Mixed Mapping Configuration Modes — When you configure a DDS interface, you can use different configuration modes to map different inports and outports. For example, you can use Use Topic and QoS to configure one inport and Use Reader XML Path to configure a different inport within the same model.

See Also

|

Related Topics