Clear Filters
Clear Filters

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

2 views (last 30 days)
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?

Answers (1)

Nivedita
Nivedita on 6 Jun 2024
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.

Categories

Find more on AUTOSAR Blockset in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!