Simulink error, integrator

77 views (last 30 days)
Si So
Si So on 12 Jan 2021
Answered: Jemima Pulipati on 15 Jan 2021
Hello,
How can I eliminate this error in Simulink?

Answers (1)

Jemima Pulipati
Jemima Pulipati on 15 Jan 2021
Hello,
From my understanding, you are facing a 'Derivative is not finite' error while using an Integrator block in your model.
You may try the following steps to fix the issue.
  1. Open 'Configuration Parameter', set the diagnostic 'Inf or NaN block output' to 'error', Now when you run the simulation you may see an error " Block 'BlockName' outputs NaN for element x of output port at major time step z" where 'BlockName' refers to the block in which error is thrown. Check if the block has a divide by zero which creates a 'Inf ' when fed to the integrator generates an error. You may have to avoid division by zero in the logic in this case.
  2. The error may be due to a model instability. One way to remove the error is to open the dialog box of the 'Integrator' block, select 'Limit output' and specify an initial condition and saturation limits. For example, 'Initial condition = 0.06', 'Upper saturation limit = 0.85', 'Lower saturation limit = 0.06'. You may have to change these values so that they are meaningful to your model.
Below is information on three tools that may assist you in further improving the model stability, if you are not already familiar with them:
  • Solver Profiler: The Solver Profiler can help you visualize your model dynamics and see where they may be unstable. Using the Solver Profile is described at this link
  • Log the Simulink states, so you may view their values after running the simulation (perhaps stop the simulation before the error or use the above approach to remove the error):
  • Use Stepping Options to pause the simulation and view signal values before the error occurs:
Additionally, MathWorks normally recommends using hierarchy when building complex models to improve readability. In case you are interested in that, information on converting your model to use subsystems may be found here:

Categories

Find more on Configure Simulation Conditions 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!