Simulink External Mode Boolean Indicator

12 vues (au cours des 30 derniers jours)
Cody
Cody le 4 Nov 2014
Réponse apportée : Chirag le 22 Juil 2020
We are using Simulink external mode with Real-Time Windows Target for a control application. We have a custom GUI built using GUIDE that allows a technician to control the system.
There are a couple of boolean signals inside the Simulink model whose values need to be indicated to the technician during operation. In normal mode, I can successfully use a timer object inside the GUI code to read the value of a gain block's runtime object at fixed intervals ( Run-Time Object Data Export), which I can then use to (for example) change the color of a static textbox to indicate the boolean value.
However, in external mode, this no longer works. While the runtime object still exists, it always has value "0". I additionally already have the external mode control panel configured to collect 30-second lengths of a different signal, and it appears that the control panel does not allow me to set different triggers for different data sources/trigger types/durations.
Is there some way for me to allow external mode boolean signals to be read by the command line? Thanks for any help.

Réponses (1)

Chirag
Chirag le 22 Juil 2020
In External Mode, the model runs on the target (generated application on Desktop in Simulink Desktop Real-Time, and on Speedgoat Target Computer in Simulink Real-Time). Therefore all the block output signals are computed on the target and not transferred to the host, hence not reflected in RunTimeObject of the block. Because time is always transferred from the target to host, time is available with RumTimeObject (rto.CurrentTime).
An important exception to the above rule are blocks that act as external mode viewers (aka SimViewingDevice). These are Scope, Display, To Workspace, etc. These blocks are receiving the data from target via external mode communication channel, are able to display them (store to workspace, etc.), and, also, their RunTimeObject is able to return the data.
To solve this issue with RunTimeObjects in External Mode, we suggest to connect any SimViewingDevice to the signal you want to watch and use the RunTimeObject of this SimViewingDevice to get the value of the signal.
Beware, the signal will be present on the InputPort of the SimViewingDevice RunTimeObject, but *NOT* on the OutputPort of the RunTimeObject of the block connected to it. The connection between the connected block and the SimViewingDevice is the place where the data transfer happens, so the data are not present on the source side (output port), but they are present on the destination side (input port).
Hope this makes sense. Here is a simple example.
Open “sldrtex_dashboard” example model and add blocks (Display and Scope).
>> rtoScope = get_param('sldrtex_dashboard/Tank dynamics/Scope','RuntimeObject')
>> rtoDisplay = get_param('sldrtex_dashboard/Tank dynamics/Display','RuntimeObject')
>> rtoScope.InputPort(1).Data
>> rtoDisplay.InputPort(1).Data
rtoScope =
Simulink.RunTimeBlock
rtoDisplay =
Simulink.RunTimeBlock
ans =
21.7285
ans =
46.6138

Community Treasure Hunt

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

Start Hunting!

Translated by