Model Advisor error:Abnormal exit?
14 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
There were no errors when I ran the model and generated the code. But why does the Model Advisor report errors?
0 Commenti
Risposte (2)
arushi
il 21 Ago 2024
Hi 李 ,
The Model Advisor in Simulink is a diagnostic tool that checks your model for potential issues, best practices, and compliance with modeling standards. It can report errors or warnings even if the model runs and generates code successfully. This is because Model Advisor checks for potential issues that might not immediately cause a failure but could lead to problems in specific contexts, such as embedded systems or safety-critical applications.
For example,Model Advisor might flag the use of pointers in Stateflow charts because pointers can lead to unsafe memory access or undefined behavior, especially in embedded systems where memory management is critical.
Hope this helps.
0 Commenti
Saurabh
il 21 Ago 2024
Modificato: Saurabh
il 21 Ago 2024
Although it appears that you were able to generate the code successfully; there were some issues when you conducted model checks.There might be few workarounds/troubleshooting steps for this issue. Let's examine each one separately.
- Check for Pointers in Stateflow charts: Pointers are not allowed in "Stateflow" charts. If Pointer operations are used in Stateflow charts, modify the specified chart to remove the dependency on pointer operations.
- Check usage of floating-point expressions in Stateflow charts: identify equal to operations (==) in expressions where at least one side of the expression is a floating-point variable or constant. The condition would be if Expressions use equality comparison operations (==, !=, ~=) where at least one side of the expression is a floating-point variable or constant. Then modify the specified expressions to avoid equality comparison operations between floating-point expressions or it can be The “Model Advisor” could not determine the data types in expressions with equality operations then typecast the specified expressions explicitly to allow Model Advisor to determine the data types.
- Check usage of unary minus operations in Stateflow charts: Identify unary minus operations applied to unsigned integers in Stateflow objects. The condition can be that the Unary minus operations are applied to unsigned integers in Stateflow objects then Modify the specified objects to remove dependency on unary minus operations. Or The Model Advisor could not determine the data types in expressions with unary minus operations then in this case typecast the specified expressions explicitly to allow Model Advisor to determine the data types.
The same information can be found in the provided links:
- https://www.mathworks.com/help/stateflow/ug/operations-for-stateflow-data.html#f0-55143
- https://www.mathworks.com/help/stateflow/ug/operations-for-stateflow-data.html#f0-61189
- https://www.mathworks.com/help/slcheck/ref/check-usage-of-unary-minus-operations-in-stateflow-charts.html
- https://www.mathworks.com/help/slcheck/ref/check-usage-of-floating-point-expressions-in-stateflow-charts.html
- https://www.mathworks.com/help/slcheck/ref/check-for-pointers-in-stateflow-charts.html
I hope this was helpful
0 Commenti
Vedere anche
Categorie
Scopri di più su Check Model Compliance in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!