How to exchange data between Simulink model and App Designer when run in EXTERNAL MODE?

10 ビュー (過去 30 日間)
I wanted to test an equipment and observe the results with change in parameters. In order to communicate with the equipment I used HUMUSOFT multi-function card and created a Simulink Desktop Real-Time model which is, my model runs in external mode. To make the observation process simpler I wanted to create a Matlab app with the help of App Designer.
Now, I need help in getting data from simulink model(external mode) to App Designer.
Note: I just wanted to inform that, I know about 'sim' command and it works perfectly fine for normal mode and not for an external mode. For external mode I know about using 'set_param' but I am unable to get the data from simulink model( I tried using this command in an external model with a 'To Workspace' block).
I would be glad if someone provides me with any helpful links or an examples.

採用された回答

Jan Houska
Jan Houska 2021 年 5 月 12 日
Hi Nagendra,
there are several ways you can proceed. First, you can rethink the idea of creating a MATLAB app and use the blocks from the Simulink Dashboard library instead. These blocks work with external mode and you can create quite a nice dashboard using them. Please see the example model sldrtex_dashboard. This is probably the easiest way.
Then, you should be able to use the Scope block and the To Workspace block to log data to workspace. With the Scope block, you will need to make sure that logging to workspace is enabled. But data logged this way will appear in the workspace only after the simulation ends.
And, you can also write your app as a SimViewing S-function. This requires more effort but gives you the maximum flexibility.
Good Luck, Jan
  2 件のコメント
Mark Edwards
Mark Edwards 2021 年 6 月 29 日
Jan, can you provide more details on Simulink Dashboard working with external mode?
I'm running the sldrtex_dashboard on an external target (C2000). The model runs fine in exteral mode but none of the dashboard items change.
Thanks, Mark.
Jan Houska
Jan Houska 2021 年 7 月 2 日
Hi Mark,
the dashboard blocks require the external mode target to support the XCP protocol. Simulink Desktop Real-Time supports the protocol, but I'm not sure about the C2000.
Best Regards, Jan

サインインしてコメントする。

その他の回答 (1 件)

Jonas
Jonas 2021 年 5 月 12 日
編集済み: Jonas 2021 年 5 月 12 日
Does this example learn anything?
openExample('SlrtAddAppDesignerAppToInvertedPendulumModelExample');
app = slrt_ex_pendulumApp;

カテゴリ

Help Center および File ExchangeGet Started with Simulink Desktop Real-Time についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by