Configure DDS Application Model to Connect to a Live Network During Simulation
DDS Blockset provides simulation support to test application logic on a live DDS network. When you enable this support, your DDS application model can subscribe to and publish topics directly to a live DDS network during simulation. You enable live connectivity for each subscriber and publisher individually within your model.
Connecting to a live network during simulation allows for error analysis and data capture, offering a faster method to generate initial data and validate your application logic using network-supplied data. Additionally, it helps identify connectivity issues early in the development process, reducing the risk of connectivity issues during deployment.
To configure your DDS application model to connect to a live network:
In Simulink®, create or open a model configured for DDS. For this example, open model
shapesdemo
.openExample("shapesdemo");
You can learn more about the Shapes Demo and its requirements in the tutorial DDS Blockset Shapes Demo.
Open the DDS Application Designer app.
Configure the Take DDS Sample block to connect to a live DDS network during simulation by opening the Block Parameters dialog box and selecting Connect to live network. Click OK.
You enable live connectivity for each subscriber and publisher individually, allowing you control over which domain participants are connected. In this example, you connect both the publisher and subscriber.
Configure the Write DDS Sample block to connect to a live network by opening its Block Parameters dialog box, selecting Connect to live network, and clicking OK.
The block icon for both the Take DDS Sample and Write DDS Sample blocks change to indicate the live connection.
Set up your live DDS environment to communicate with the simulation.
Once your external environment is set up, you can start a simulation and observe the signals in the model. You can change parameter values in the model while the simulation is running, but if you need to change topics mapped to subscribers or publishers, you must stop and restart the simulation.
Considerations and Limitations When Connecting to a Live Network During Simulation
Connecting to a live network during simulation is subject to these considerations and limitations:
Connecting to a live network is supported for models configured to use the eProsima or RTI vendor.
For models that use the eProsima vendor, connecting to a live network during simulation is not supported if the DDS Dictionary contains constants.
See DDS Blockset Limitations and Considerations for additional information.