Error in Integrator block

8 visualizaciones (últimos 30 días)
Parth Bipin
Parth Bipin el 29 de Sept. de 2024
Comentada: Sam Chak el 6 de Oct. de 2024
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 comentario
Sam Chak
Sam Chak el 29 de Sept. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Yukthi S
Yukthi S el 4 de Oct. de 2024
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 comentarios
Parth
Parth el 6 de Oct. de 2024
Thank you my model did work
Sam Chak
Sam Chak el 6 de Oct. de 2024
Good to hear that, @Parth Bipin, (or @Parth). Please consider accepting @Yukthi S's answer since the issue is solved now.

Iniciar sesión para comentar.

Categorías

Más información sobre Model Verification en Help Center y File Exchange.

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by