MATLAB Simulink: Algebraic Loop Error 'Algebraic state in loop containing __ computed at time 0.0 is Inf or NaN'
96 次查看(过去 30 天)
显示 更早的评论
Hello, I appear to have an algebraic loop in the system below for the signal "ETc_AngVel":
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/415213/image.jpeg)
And get the error: "Error using HW5_Initialization (line 183) Algebraic state in algebraic loop containing 'HW5_Task4_V3/3>Driveline model/Divide' computed at time 0.0 is Inf or NaN. There may be a singularity in the solution. If the model is correct, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)"
I have tried using a delay, initial condition (as seen in picture), and memory block to no avail. Any other suggestions?
Thank you!
1 个评论
采纳的回答
Deepak Meena
2020-11-20
This message may be caused by a singularity in your system. One situation where this may occur is if the values of your states differ by a large magnitude. If this is the case, the Simulink solver will have a hard time resolving your step size within the error tolerance as it attempts to "bounce" back and forth between the states.
To check if this is the case:
1. Return the states of your system as follows:
a) In the model editor go to Simulation-> Configuration Parameters
b) Select Data Import/Export, in the 'Save to Workspace' field, check 'States' to log the states as output
2. Run the simulation.
3. Plot:
plot(tout,xout)
You can see if one of the states is changing over a wide range compared to the others.
There are a couple of things you can do to try to correct this situation. If possible, you may want to rescale the model so that the states are within a couple of orders of magnitude of one another.
Also, you can set specific error tolerances for the integrator blocks in your system. For more information, please refer to 'Specifying the Absolute Tolerance for the Block's Outputs' section in the Integrator block documentation by entering
doc integrator
at the MATLAB command prompt.
Other things to try:
Use a stiff solver (e.g. ode15s)
Decrease initial step size, maximum step size, and relative tolerance
Thanks ,
Deepak
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!