-
Notifications
You must be signed in to change notification settings - Fork 10
Simulation result comparison error for models having Algebraic Loop Warning
When there exists an algebraic loop in a model, Simulink tries to solve the algebraic loop and simulate the model. If Simulink is able to solve it, it just raises an warning and continues simulating the model [1]. However, if Simulink can not solve the algebraic loop, it throws exception. This is the scenario when the Algebraic Loop setting in Diagnostic pane is set to warning .
This setting allows us to ask Simulink to solve the algebraic loop first. If Simulink fails to solve the loop, then it throws an exception, and we can easily catch it and solve the algebraic loop. We ran our generator in this setting as we thought it would be natural to depend on Simulink to solve the algebraic loop first. Other reason is that it is difficult to catch Matlab's warnings compared to catching exceptions and we have not implemented it (catching warnings) yet.
For multiple instances (generated random models), we have found simulation result comparison error. Values of signals of various blocks (of the same model) were different in the two simulation variations: running simulation in Normal vs. Accelerator mode. The generator identified these behavior, marked them as "comparison errors" and saved it in a directory for future investigation. Later investigating, we saw that the models have algebraic loops which did not stop Simulink from continuing the simulation. When we manually fixed the algebraic loops later, comparison errors were resolved.
Simulink has a guideline on "How to Handle Algebraic Loops in a Model" [1] from which we learn that if Simulink solves an algebraic loop, the results might be inaccurate.
- Our generator caught first kind of comparison error (although this behavior is documented and might not be a bug). However, we can use our generator to discover such inaccuracy (possible side use-case of the generator?).
- To ignore such type of errors in future run of the generator, we need to remove algebraic loop altogether i.e. can not depend on Simulink to solve the algebraic loops.
- Right now we only compare values at the final step of the simulation. However, for these (above mentioned) models there were value mismatches not only in the final step, but in intermediate simulation steps also. We have to take this into consideration.
- Matlab's equality checking (
==
operator) was used to detect these comparison errors.
- Matlab 2015a
- Linux
- Normal and Accelerator mode
Jump to: Home Page
This material is based upon work supported by the National Science Foundation under Grants No. 1117369, 1464311, and 1527398. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.