Simulink Desktop Real-Timeのエクスターナルモードを使用する際、外部 C/C++ コードを挿入する方法(外部として関数を宣言、S Function、C Caller、C Function)の違いを知りたい。
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
健吾 織田
am 28 Jun. 2022
Kommentiert: 健吾 織田
am 29 Jun. 2022
IMUセンサから読み取ったデータをSimulink Desktop Real-Timeのエクスターナルモードを使いリアルタイム計測・アクチュエータを使った制御を行いたいです。
IMUセンサにはC++で書かれたサンプルコードファイル(.h,.cppファイルが20個程度の規模)があり、これをsimulinkに組み込むことを考えています。
調べた限りでは以下の3つの方法があるようですが、Simulink Desktop Real-Timeのエクスターナルモードで使用可能かどうかと、使い方の違い・メリットを教えていただきたいです。
・外部コードからmexファイル( MEX 関数)を作成し、MATLAB Functionの中で「外部として関数を宣言」して実行
https://jp.mathworks.com/help/simulink/slref/coder.extrinsic.html
・外部コードからS Functionブロックを作成し実行
https://jp.mathworks.com/help/simulink/slref/legacy_code.html
・C Caller、C FunctionからSimulink で C コードを統合(Simulink Desktop Real-Timeで使えるか未確認)
https://jp.mathworks.com/help/simulink/integrate-external-c-algorithms-using-c-function-block.html
https://jp.mathworks.com/help/simulink/slref/ccaller.html
0 Kommentare
Akzeptierte Antwort
Toshinobu Shintai
am 29 Jun. 2022
4 Kommentare
Toshinobu Shintai
am 29 Jun. 2022
Bearbeitet: Toshinobu Shintai
am 29 Jun. 2022
外部として関数を宣言「coder.extrinsic」はコード生成に対応していませんので、おそらく無理かと思います。
S-Function、C Caller、C Function は大丈夫です。
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu インストールとライセンスの紹介 finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!