- “Subtract” – Use the “sum” block instead with “+-“ as inputs, which will make it work like a “subtract” block.
- “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.
- “Delay” – Use “unit delay” instead, which is equivalent for single-step discrete delays in controllers.
Understanding MISRA AC SLSF 005 - Allowable Simulink blocks
28 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
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.:
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!
More Answers (0)
See Also
Categories
Find more on MISRA C:2012 Directives and Rules in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!