Interfacing Simulink Real-Time and Matlab on Speedgoat

7 ビュー (過去 30 日間)
Michaela Loar
Michaela Loar 2019 年 8 月 1 日
回答済み: Jon Lobo 2019 年 8 月 21 日
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.

回答 (1 件)

Jon Lobo
Jon Lobo 2019 年 8 月 21 日
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).

カテゴリ

Help Center および File ExchangeTarget Computer Setup についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by