Main Content

Model DDS Applications

To model a DDS application, construct or adapt a Simulink® model so that it can connect to the DDS middleware platform. To prepare a Simulink model so that it can publish and subscribe to the DDS network, the model must be configured as a top model with these modeling aspects:

  1. The model must have inports and outports set to DDS data types.

  2. The model must have message blocks that send and receive Data Samples from the DDS network. It is recommended that the model uses the DDS Blockset Take DDS Sample and Write DDS Sample blocks. These blocks convert between DDS and Simulink data types to enable the application modeled in Simulink to publish and subscribe to the DDS network.

  3. The model itself that contains the DDS application logic. The logic portion of the model is independent of the middleware. The DDS application uses the Simulink equivalent data types to compute its application logic.

You can model DDS applications to act as Subscribers, Publishers, or both.

Model a Subscriber

To configure the Simulink model as a Subscriber:

  1. Add an inport and set it to a DDS data type.

  2. Insert a Take DDS Sample block to convert the DDS data type to its Simulink equivalent data type.

  3. Enclose your application logic in a subsystem. On the boundary of the subsystem, insert In Bus Element ports to accept the Simulink data types from the Take DDS Sample block. For more information, see In Bus Element.

Model a Publisher

To configure the Simulink model as a Publisher:

  1. Enclose your application logic in a subsystem. On the boundary of the subsystem, insert Out Bus Element ports to send Simulink data types to the Write DDS Sample block. For more information, see Out Bus Element.

  2. Insert a Write DDS Sample block to convert Simulink data types to DDS data types.

  3. Add an outport and set it to a DDS data type.

Model a Subscriber and Publisher

To configure a Simulink model as a Publisher and Subscriber:

  1. Add an inport and set it to a DDS data type.

  2. Insert a Take DDS Sample block to convert a DDS data type to its Simulink equivalent data type.

  3. Enclose your application logic in a subsystem. On the boundary of the subsystem, insert in bus element ports to receive Simulink data types from the Take DDS Sample block and out bus element ports to send Simulink data types to a Write DDS Sample. For more information, see In Bus Element and Out Bus Element.

  4. Insert a Write DDS Sample block to convert Simulink data types to DDS data types.

  5. Add an outport and set it to a DDS data type.

Modeling Pattern Considerations and Limitations

  • Modeling – DDS applications must be configured as a top models.

  • Ports Configuration – DDS Blockset requires that all ports for must map to DDS. If you have ports that do not map DDS, the model will not simulate or build correctly.

See Also

| | |

Related Topics