Check if Connected in External Mode in Simulink

조회 수: 3 (최근 30일)
Gijs van Oort
Gijs van Oort 2016년 10월 28일
I'm using Simulink in combination with TwinCAT (but this question is, I think, not only applicable to TwinCAT). In order for it to work, I build my Simulink model to 'TwinCAT.tlc' target, 'run' it in TwinCAT and use Simulink External Mode to connect to it and control it.
My problem now is that the model controls a robot, and, for safety, I want the robot to be turned off as soon as the connection between Simulink and TwinCAT is broken (and I also want to enable/disable logging based on the connection state).
Hence the question: Is there any way to get into Simulink the current state of connection between Simulink and TwinCAT (or any other target)? I think that it must be a Simulink block that directly outputs it in the model; a Matlab callback function could probably check it, but as soon as the connection is broken it is not able to send any information to the running Simulink executable (since the connection is broken), so that's not good enough.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by