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:
- Go to 'Model Settings' of Top Model from Toolstrip
- Search for 'Inf or NaN block output' using the search bar present above in the Configuration Parameters panel.
- Set the value of 'Inf or NaN block output' to 'error' (by default it would be 'none')
- 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!