Solver is encountering difficulty in simulating model 'new_try_model1' at time 1.7234322815991867.

51 views (last 30 days)
I am runing my simulation with auto solver. So, It is taking ode45 as solver for my simulation. But when I run the simulink model, I am getting the error shown below.
Can anyone tell me what can i do in this error ?

Accepted Answer

Vignesh Murugavel
Vignesh Murugavel on 11 Nov 2022
Hi Shiv,
This problem likely occurs when an operation in the model causes an "Inf" or "NaN" output. These Infinite or NaN values get passed to the integrator block which generates this error message.
This can happen if an integrator is present in the model, but it does not necessarily mean the error is caused by or at the integrator.
In order to find out which block was responsible for generating Infinite or NaN value you can set the configuration parameters by performing the below steps:
  1. Go to 'Model Settings' of Top Model from Toolstrip
  2. Search for 'Inf or NaN block output' using the search bar present above in the Configuration Parameters panel.
  3. Set the value of 'Inf or NaN block output' to 'error' (by default it would be 'none')
  4. Click Apply and OK. Run the model again.
Now you can see an error in the 'Diagnostic Viewer' which points out the block that is creating Infinite or NaN value.
This block either divides by 0 or outputs NaN, which creates an Inf that when fed to an Integrator, generates this error.
So, avoid division by zero in the logic and check operations for possible NaN outputs.
You Could alternatively also try the following Approaches to resolve the problem:
  • Rescale the model if the values of your states differ by a large magnitude
  • Change Solver Type to ‘Variable-step’ and Solver to ‘ode15s (stiff/NDF)’ in Configuration Parameters
  • Set specific error tolerances for the Integrator blocks
Hope this helps!

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!