Main Content

Model DDS Input Events

DDS Blockset supports event-driven communication where a subscriber application thread waits for an event trigger before executing condition-based algorithms.

In Simulink, you configure DDS events at the input ports of your model and bind the event to a model partition that contains the response algorithm. You can trigger one or more events based on the flow of data into a root-level input port of a model subsystem. Using the Schedule Editor, you can specify a partition to execute in response to each event.

DDS Blockset supports input events for applications using RTI Connext®. In the generated code, the input event is implemented by using WaitSets and Conditions. The WaitSet wait() operation blocks execution of the application thread until an input event (or timeout) causes the user-defined condition to be true. For more information about WaitSets and Conditions, see RTI Connext documentation.

This table lists supported event types and maps DDS callback method names to the corresponding Simulink event name.

Event TypeDDS Method NameSimulink Event Trigger NameDescription


Input writeValue for input port updates.


Input write lostInput port value update overwrites unprocessed data.


Input write timeoutInput port value does not update within a specified amount of time.

Model DDS Input Event

This section provides an example of configuring an existing DDS model as the response algorithm for a data available event.

  1. Create or open a model configured for DDS. The model should contain Take DDS Sample blocks, application logic, and Inport blocks configured as DDS data types. For more information, see Model DDS Applications.

    Model configured for DDS.

  2. Enclose the model in a subsystem. To enclose the model in a subsystem, select all blocks in the DDS model, right-click one of the highlighted elements, and select Create Subsystem from Selection. The DDS model is enclosed in a subsystem, and corresponding inport and outport blocks are added at the top level.

    Top-level model with DDS subsystem.

  3. Configure the model to run tasks concurrently. On the Modeling tab, click Model Settings to open the configuration parameters:

    1. In the Configuration Parameters dialog box, on the Solver pane, click the arrow next to Solver details.

    2. Under Tasking and sample time options, select Allow tasks to execute concurrently on target.

    3. Click OK.

  4. Configure the DDS subsystem as an aperiodic partition that can be scheduled to respond to events.

    To configure the subsystem, right-click the subsystem block, select Block Parameters (Subsystem), and then do the following:

    1. In the dialogue box, select Treat as atomic unit.

    2. From the Schedule as list, select Aperiodic partition.

    3. Specify the partition name as A1.

      Block Parameters dialogue box to configure the DDS subsystem as an aperiodic partition.

    4. Click OK.

    After the subsystem is configured, in the top-level model, a badge appears above the subsystem block indicating that the subsystem is partitioned.

  5. Configure events on the input port.

    To configure the input port, right-click the Inport block, select Block Parameters (Inport), and then do the following:

    1. In the dialog box, select the Execution tab.

    2. On the Execution tab, under Events, click the plus sign to add one or more events:

      For this example, select Input Write.

      Block Parameters dialogue box to configure events on the input ports.

      Under Events, the Events spreadsheet contains event settings for that input port and lists the added events. You can add up to one of each event type. For an Input Write Timeout event, you enter the timeout duration in the Timeout column. The timeout duration is entered in seconds.

    3. Click OK. After adding the event, an event badge appears above the inport block.

  6. Use the Schedule Editor to bind events configured on input ports to partitions that execute on event occurrence. To configure event binding, do the following:

    1. Click the badge above the subsystem block to open the Schedule Editor. Alternatively, to open the Schedule Editor from the Inport Block, open the Inport Block Parameters dialogue box, and under the Execution tab, in the Events section, click The DDS event clock icon. The Schedule Editor opens.

    2. In the Schedule Editor, click Update Diagram, then expand the Events tab. The input write event for the input port (In1.InputWrite) displays.

    3. Bind the event to the partition by dragging the In1.InputWrite event from the Events panel to the A1 partition shown in the Schedule Editor canvas.

      Display of the Schedule Editor showing the input event binding with the partition.

      Note that this step might not be required because binding might occur automatically if you configured only one event and one partition.

    4. Schedule additional events or behaviors. See Schedule Editor for more information.

    5. Close the Schedule Editor, then press Ctrl+D to update the model. The block diagram updates to reflect the binding of the In1.InputWrite event to the A1 aperiodic partition scheduled as subsystem On Data Available Handler.

    DDS model with configured event.

Modeling Pattern Considerations and Limitations

  • Modeling – Modeling DDS input events is only supported for DDS Blockset models using RTI Connext 6.0.1+.

  • Port Configuration – DDS Blockset requires that all ports must map to DDS and all input ports in models that configure input events must use Inport blocks.

See Also

| | | |

Related Topics