Error in Integrator block
8 次查看(过去 30 天)
显示 更早的评论
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
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
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.
You can refer to this Blog Post by MathWorks to get more insights: https://blogs.mathworks.com/simulink/2024/07/22/derivative-of-state-1-in-block-x-y-integrator-at-time-0-55-is-not-finite/
Hope this is helpful!
5 个评论
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 Center 和 File Exchange 中查找有关 Model Verification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!