Interfacing Simulink Real-Time and Matlab on Speedgoat
조회 수: 7 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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).
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Target Computer Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!