MATLAB Answers

Simulink Real Time Code: Scope update speed issue/data logging issue

6 views (last 30 days)
Ross
Ross on 3 Nov 2016
Commented: Ross on 19 Jan 2017
Hello,
I'm using Speedgoat Education edition and Simulink Real Time to conduct some Hardware-in-Loop testing. I'm struggling to get scopes to update in a timely fashion AND log data to workspace. I can do one or other by changing duration settings in Tools>External Mode Control Panel>Signals & Triggering.
I've a sample time of 100 ms.
I've the trigger options set to manual source, normal mode, a duration of 50 samples and a delay 0 seconds. The scopes will update every 5 seconds. But at end of 9 minute simulation I've only a few data points.
If I increase the duration to a number higher than number of samples in simulation run time I get the data but the scope doesn't update.
Can someone please explain what settings I need to change to get near real time (<5seconds) updating of scope AND log data for full simulation duration (approx 3-15 minutes)?
Thank you for any help on this matter, Ross

  0 Comments

Sign in to comment.

Accepted Answer

Jon Lobo
Jon Lobo on 6 Dec 2016
Edited: Jon Lobo on 6 Dec 2016
Which release are you using? The scope behavior changed a little in recent releases and now you can use tools like the Simulink Data Inspector to stream data back to the PC.
For logging data for the real-time application, it is recommended to log data directly on the target using the file scope. You can then use the command line API for Simulink Real-Time to retrieve the data in MATLAB, or alternatively you can use the slrtexplr to do that. (see: Data Logging with File Scope )

  1 Comment

Ross
Ross on 19 Jan 2017
Hi John, thank you for your advice.
Extra information for anyone who reads this question in future.
There were a lot of difference links on various scopes out there. In the end, I used the "outport" block.
As part of this I needed to increase the Signal logging data buffer size under Configuration Parameters>Code Generation>Simulink Real-Time Options

Sign in to comment.

More Answers (0)


Translated by