- “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
    32 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Matthew Gordon
 el 24 de Abr. de 2025
  
    
    
    
    
    Comentada: Matthew Gordon
 el 2 de Mayo de 2025
            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 comentarios
Respuesta aceptada
  Darshak
 el 2 de Mayo de 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!
Más respuestas (0)
Ver también
Categorías
				Más información sobre MISRA C:2012 Directives and Rules en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

