Exporting script that runs a simulink model.

조회 수: 3 (최근 30일)
Thomas Stubbs
Thomas Stubbs 2023년 3월 3일
댓글: Thomas Stubbs 2023년 3월 6일
I have a few scripts that I am looking to export for running in an embedded system. One of the script (class) has a handle for a simulink model and handles simulating the model. Another script is an event listener listening to a comms network.
I tried using the Application Compiler and it seems to setup the communication nodes fine but errors out when setting up the simulink dependent scripts.
I am aware of the capability of exporting the model as a standalone FMU and was considering writing python code for the embedded system that functions identically to my scritps and uses this FMU.
Is there a good way to export these scripts/models for running on an embedded system that doesn't involve me completely re-writing my scripts?

채택된 답변

Jasvin
Jasvin 2023년 3월 6일
You can have a look at the Coder family of products for embedded code generation https://www.mathworks.com/products/embedded-coder.html.
You can convert the Simulink model to C/C++ code for an embedded target with Embedded Coder and MATLAB scripts can be converted to C/C++ code using MATLAB Coder, but it remains to be seen whether your specific code is compatible with the restrictions imposed by these products https://www.mathworks.com/help/rtw/ug/code-generation-limitations-for-model-reference.html.
  댓글 수: 1
Thomas Stubbs
Thomas Stubbs 2023년 3월 6일
Jasvin, Thank you for the quick response.
I am currently looking into these options. I believe I will need to seperately generate my matlab scripts in a seperate environment and compile the models and execute them from that environment.
The main target environment is a headless computer operating an x64 Linux OS. Our model is fixed step simulation model using only simulink or simscape blocks.
I had mentioned FMU in my original question but I am not against using embedded coder. What are the advantages between an FMU vs code generated by the embedded compiler or code generated by the simulink compiler.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by