Why does it take so long to stop a real-time application running on Speedgoat if my model contains many tunable parameters?

43 ビュー (過去 30 日間)
When I try to stop the application running on my Speedgoat real-time target using "tg.stop", or the 'Stop' button in Simulink or SLRT Explorer, this can sometimes take up to 15 seconds or even more until MATLAB is no longer 'Busy' executing the Stop command.
Additionally, I sometimes get the following prompt indicating a time-out:
Error communicating with target 'TargetPC1':
Cannot stop application on target 'TargetPC1':
Timed-out waiting for application to stop.

採用された回答

MathWorks Support Team
MathWorks Support Team 約14時間 前
編集済み: MathWorks Support Team 約1時間 前

What this issue means

When the application stops, an automatic parameter set file named "autoSaveOnStop" will be saved on the target. It contains the values of all tunable parameters at stop-time. This behavior is documented here: importParamSet
If your application contains many tunable parameters (in the order of several 100,000 doubles), this parameter autosave feature may be causing a longer delay when stopping the application. Our development team is working on addressing this performance issue for a future release of MATLAB.
 

Try these workarounds

(1) To avoid the delay, use the following code to disable the parameter autosave feature after your model has been built into a .mldatx file:
myApp = slrealtime.Application(mdlName);
updateAutoSaveParameterSetOnStop(myApp,false);
This option was officially added in R2022b, but was also made available through R2022a Update 1 and R2021b Update 4.
The "updateAutoSaveParameterSetOnStop" option is documented here and shows a more complete code example to run the simulation from the MATLAB Command Line: updateAutoSaveParameterSetOnStop
To use the option with External Mode ("Run on Target" button), use the "Step by Step" commands and run the code above after the "Build Application" step: Execute Real-Time Application in Simulink External Mode by Using Step-by-Step Commands
(2) Another workaround would be to consider reducing the number of tunable parameters in your code by inlining them: Default parameter behavior 
 

Further troubleshooting

If the above doesn't help, see the following answer for other reasons why your real-time simulation may take a long time to stop: https://www.mathworks.com/matlabcentral/answers/1813565
The "Timed-out waiting for application to stop" error message could also indicate that the target got in some kind of bad state or is hanging when the application stops. To further investigate this, check the Speedgoat status monitor using PuTTY to see if any message comes up when you try to stop the application: Target Computer Status Monitor
Contact MathWorks Technical Support with your findings.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by