Filter löschen
Filter löschen

How can I improve the live streaming performance of Simulation Data Inspector (SDI) or Dashboard blocks when using Simulink Real-Time and Speedgoat?

52 Ansichten (letzte 30 Tage)
I use Simulink Real-Time (SLRT) to run simulations on a Speedgoat real-time target and want to view live signal data in the Simulation Data Inspector (SDI) or in Dashboard blocks. To do this, I selected signals for streaming using signal logging badges, the SLRT Explorer, or instrument objects.
However, I noticed that the MATLAB process causes very high RAM/CPU load on my host PC, making the MATLAB GUI slow and laggy. Sometimes, I see noticeable gaps in the SDI data or lost timesteps when inspecting the 'logsout' variable or exporting data from the SDI. Additionally, I may see the following warning in the Speedgoat system log:
Live Stream overload
Is there a way to improve the performance of SDI and my Dashboard blocks without reducing my model sample rate?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 23 Jul. 2024 um 0:00
Bearbeitet: MathWorks Support Team am 23 Jul. 2024 um 10:16
Here are some recommended steps to improve live streaming performance with Simulink Real-Time (SLRT) and Speedgoat hardware:
1. Upgrade to the Latest MATLAB Release and/or the Latest MATLAB Update for Your Release
We continuously work on improving SDI performance so using the latest MATLAB is recommended In particular, if you use External Mode ("Run on Target" button) and your model contains many graphical elements (Dashboard blocks, Scopes, Displays), an upgrade to R2022b and beyond may be beneficial since signals connected to such blocks will no longer appear in the SDI frontend. 
2. Decrease the Data Rate for Live Streaming
To decrease the data rate for live streaming, you could:
  • Reduce the model sample rate,
  • Stream fewer signals,
  • Change the signal data type (e.g. 'single' instead of 'double'),
  • Increase the decimation of instrumented signals, or
  • Adjust the logging sample time.
To adjust the decimation or logging sample time, right-click the logging badge (wi-fi symbol) for the signal and select "Properties". 
You can also use the "Decimate data" field to specify a decimation factor greater than one. For example, a decimation factor of 2 logs every other data point, effectively halving the sample rate and reducing the number of logged points.
3. Consider File Logging instead of (or in addition to) Live Streaming
While streaming signals at a lower rate in SDI, log the signals on the Speedgoat target via a File Log block to preserve the original sample time. File logging can handle much higher data rates without dropping data. More information can be found at Signal Logging and Streaming Basics
Note that live streaming from a real-time application does not guarantee that all data appears in SDI. Live stream instrumentation runs at a lower priority than the real-time application, so data sent by live streaming could be dropped if the host-target connection cannot keep up. This behavior is documented in Troubleshoot Gaps in Streamed Data
4. Change the SDI Record Mode
You can significantly improve SDI performance by changing the record mode to not retain data after simulation. Use the simulink.sdi.setrecorddata(false) MATLAB command or configure this in the SDI Preferences > Storage panel as shown in this screenshot:
When you change the Record mode setting to "View during simulation only", no logged data is available in SDI or the workspace after the simulation completes. Only use this mode when you do not want to save the data captured in SDI. See the following documentation for details on this feature and other tips to improve SDI performance: Limit the Size of Logged Data
5. Use a Custom App, SLRT Explorer, or MATLAB Commands instead of External Mode
When working with large Simulink models, run the real-time simulation from the real-time application file (.mldatx) instead of using the "Run on Target" button in Simulink. You can Create a custom SLRT app,Use Simulink Real-Time Explorer (>> slrtExplorer), or use MATLAB commands.
6. Remove DMR Files and Monitor the Host PC Disk Space
Another useful step is to delete any *.dmr artifacts that you find in your Windows temp folder: 
>> winopen(tempdir))
Normally, MATLAB should automatically remove these SDI artifacts upon closing. However, in cases of abnormal exits, these files may persist on the C drive and occupy valuable space.
There are also MATLAB commands to delete the DMR files:
% Makes sure to clear runs from current SDI session
>> Simulink.sdi.clear
% Delete DMR files
>> sdi.Repository.clearRepositoryFile
While your simulation is running, monitor the remaining space on your C drive. If you notice the drive is running full and you have no way of freeing up more space, apply methods (2), (3), or (4).
7. Increase RAM on Your Host PC
If you observe that the MATLAB process fills up RAM, consider increasing the RAM on your PC. More RAM can help handle larger datasets and reduce the likelihood of performance bottlenecks caused by insufficient memory.
8. Check Your Network Setup and Hardware
In rare cases, "Live stream overload" warnings may occur due to hardware/network issues, such as a faulty USB-Ethernet adapter. See Troubleshooting connection issues with Speedgoat target computers for more information.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by