Interfacing Simulink Real-Time and Matlab on Speedgoat
9 views (last 30 days)
Show older comments
I am trying to control inputs to a Modbus block in a simulink model running on a Speedgoat Real time target machine. Is it possible to control the input parameter from a Matlab script while the HIL simuluation is running? I have tried using setparam, but it only changes the value on the Simulink model, but not on the real time simulation. The only way I know to change values is on the slrt explorer. I need to be able to change values automatically while simultanesouly running a loop in Matlab.
0 Comments
Answers (1)
Jon Lobo
on 21 Aug 2019
Hi Michaela,
This is absolutely doable. You might notice that when you build your Simulink model and download to the Speedgoat target that there is a SimulinkRealTime.target object called "tg" in the base workspace.
If it isn't there, you can also execute the following in MATLAB.
tg = slrt;
From the tg object, you'll be able to see various information about the target computer: name of application on target, status, signals, parameters etc.
The object also has some methods you can use for getting and setting parameters on the target. In particular, try using "tg.setparam" (setparam).
0 Comments
See Also
Categories
Find more on Target Computer Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!