Are there any AUTOSAR guidelines to include m script function in Simulink model?

2 次查看(过去 30 天)
Not sure if this is the correct forum. But I just wanted to check if someone has a expreince or know any AUTOSAR guideline to include m script function in the AUTOSAR model?

回答(1 个)

Nivedita
Nivedita 2024-6-6
Hey Gaurav,
While I couldn't find any documented guideline as such but I hope following these steps to integrate an M-script function into an AUTOSAR model in Simulink should help:
  • Open your Simulink model and ensure it's set up for AUTOSAR using the AUTOSAR Blockset. If it's not configured, use the AUTOSAR Component Designer in Simulink to do so.
  • Find the MATLAB Function block under User-Defined Functions in the Simulink Library Browser and drag it into your model.
  • Double-click the block to open the editor and input your custom MATLAB code. Make sure this code is suitable for code generation.
  • Right-click the MATLAB Function block, select AUTOSAR > Map Block to AUTOSAR, and configure it for AUTOSAR through the AUTOSAR Component Designer or Model Explorer.
  • Link the block's inputs and outputs with the rest of your model to ensure proper data flow.
  • Confirm your AUTOSAR settings are correct using the AUTOSAR tools in Simulink, then generate AUTOSAR-compliant code by building the model.
Make sure that your MATLAB script must be compatible with AUTOSAR code generation. Stick to supported functions and code generation best practices. Also, rigorously test the MATLAB Function block to verify its performance in both simulation and the generated code.

类别

Help CenterFile Exchange 中查找有关 AUTOSAR Blockset 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by