Error in Integrator block

Error:An error occurred during simulation and the simulation was terminated
Caused by:
Derivative of state '1' in block 'HW02_2024_SimulinkModel/VD model/velocity' at time 64.05749999999999 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
at my integrator block.

1 commentaire

Sam Chak
Sam Chak le 29 Sep 2024
The system you constructed in Simulink is unstable. This instability may be caused by human error in modeling the system dynamics or by incorrectly applied parameter values.

Connectez-vous pour commenter.

Réponses (1)

Yukthi S
Yukthi S le 4 Oct 2024

0 votes

This error occurs often possibly because of the following reasons:
Reason-1: An Inf or NaN output caused by a block in the model at that particular time instant.
Solution-1: Firstly, you can check for singularity in the Simulink model by navigating to Configuration parameters>Diagnostics>Data Validity and set Inf or NaN block output to error and run the model
If this is the issue, you will get the error as follows:
An error occurred while running the simulation and the simulation was terminated
Caused by:
  • Block 'BlockName' outputs 'NaN' for element x of output port x at major time step 0
where BlockName is the block which caused this error.
After identifying the block, you can debug further and avoid passing Inf or NaN values to the integrator.
Reason-2: Bigger step size
Solution-2: If no error was found after setting Inf or NaN block output to error, try reducing the step size. Try using ODE15s (Stiff/NDF) as solver.
Go to Model Configuration parameters (Ctrl+E) > Solver and adjust
  • Type: Variable-step
  • Solver: ode15s (stiff/NDF)
Reason-3: Unstable system of equations, basically a divergent system.
Solution-3: If the above two solutions did not work, the error might be because of unstable system and can be fixed by:
  • Run the model using the step forward function (run step by step).
  • Starting from the integrator block that makes the model stop, click on signals to display values.
  • Track the signal until you find where the value diverges.
  • make the necessary corrections.
Hope this is helpful!

5 commentaires

Sam Chak
Sam Chak le 4 Oct 2024
Hi @Yukthi S, Could you specifically explain to @Parth Bipin what you mean by avoiding passing Inf or NaN values to the integrator using some Simulink tricks?
Yukthi S
Yukthi S le 4 Oct 2024
I can think of two ways,
  1. If this error is associated with the initial condition of the input signal, you can change it by using a "IC block" before feeding the inputs to integrator block.
  2. If the error is caused when input signal crosses a certain range, then you can limit the input signal to a specific range using a "Saturation block" and then feed this range limited signal to integrator block.
@Sam Chak, feel free to add any more tricks that i could have possibly missed. Thank you!
Sam Chak
Sam Chak le 6 Oct 2024
Modifié(e) : Sam Chak le 6 Oct 2024
Thanks for the update. Let @Parth Bipin clarify and present the Simulink model. Most of the time, instability is due to modeling errors made by the user. The system should be stable, but the user may unknowingly introduce destabilizing elements into the model during the design stage without being "mathematically aware." Yes, when designing systems in Simulink, users must be "mathematically aware" of each and every block, and should not simply place any constraint on the signal with additional block that is not originally present in the math equation.
For example, the user in the following thread ran the simulation of a tuned mass damper without being aware of what destabilized the system:
Rigorous mathematical analysis must be conducted as required by standard academic journals or technical reports submitted to authorities. The report cannot claim that "if we use this special trick in the software, then the system will become stable," especially when the system involves the safety of human beings.
Parth
Parth le 6 Oct 2024
Thank you my model did work
Sam Chak
Sam Chak le 6 Oct 2024
Good to hear that, @Parth Bipin, (or @Parth). Please consider accepting @Yukthi S's answer since the issue is solved now.

Connectez-vous pour commenter.

Catégories

En savoir plus sur General Applications dans Centre d'aide et File Exchange

Produits

Version

R2024a

Commenté :

le 6 Oct 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by