Understanding MISRA AC SLSF 005 - Allowable Simulink blocks

28 views (last 30 days)
MISRA AC SLSF 005 refers to a list of Simulink blocks that allowed to be used in controller and/or plant models (Appendix E of the document)
Many of the blocks are what I would consider essential for creating a controller to run on an embedded system e.g.Delay, Compare to Constant and Subtract
I think I mist be misinterpreting the guidelines, because writing a controller withouth the ability to subtract seems next to impossible. Can anyone provide some insight on this specific rule?

Accepted Answer

Darshak
Darshak on 2 May 2025
Hello Matthew,
Blocks like “Subtract”, “Compare to Constant”, and “Delay” are not allowed under MISRA because they can hide important details about how the system works. MISRA wants code to be clear and predictable, especially in safety-critical projects. The problem with these blocks is that they sometimes have settings or logic inside them that aren’t obvious just by looking at the model. This makes it harder to check or prove exactly what’s happening in the model. This can be a real issue when you need to test or certify the system, since you need everything to be easy to understand and verify.
There are blocks which are allowed by the guidelines, and can be used as alternatives, for eg.:
  1. “Subtract” – Use the “sum” block instead with “+-“ as inputs, which will make it work like a “subtract” block.
  2. “Compare to Constant” – Use the “relational operator” block, feed one input from the signal and other from a constant, and set the operators as required.
  3. “Delay” – Use “unit delay” instead, which is equivalent for single-step discrete delays in controllers.
You can also assess your model’s ability to generate code that complies with MISRA standards by opening the Model Advisor and running the checks located under ‘By Task > Modelling Guidelines for MISRA C:2012’. For further details, please refer to the following documentation: https://www.mathworks.com/help/slcheck/ref/model-advisor-checks-for-misra-c2012-coding-standards.html
Hope this helps!
  1 Comment
Matthew Gordon
Matthew Gordon on 2 May 2025
Thanks for your time Darshak, that explains the situation perfectly.
In the cases above I am already using the alternative methods, so I'm complying with this particular aspect of MISRA. Now that I understand the intent of the standard I can check for functionality that should be 'rephrased'.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!