Error in Integrator block

조회 수: 18 (최근 30일)
Parth Bipin
Parth Bipin 2024년 9월 29일
댓글: Sam Chak 2024년 10월 6일
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
Sam Chak
Sam Chak 2024년 9월 29일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by