Why i am getting this simulation error?

3 views (last 30 days)
Sayali Nikam
Sayali Nikam on 15 Jun 2021
Answered: sanidhyak on 11 May 2025

Answers (1)

sanidhyak
sanidhyak on 11 May 2025
I understand that you are encountering an error while running your Simulink model, specifically due to a nonlinear iteration not converging and the stiffness check failing because the number of continuous states exceeds the default threshold. This issue typically arises in large or stiff models where the auto solver is not suitable.
This can be resolved by updating solver settings and increasing the stiffness threshold. Kindly refer to the following corrected steps:
% Set a higher threshold for stiffness check
set_param('li_ion_model', 'NumStatesForStiffnessChecking', '10000')
% Use a solver suitable for stiff systems
set_param('li_ion_model', 'Solver', 'ode15s')
% Relax solver constraints
set_param('li_ion_model', 'MinStep', '1e-6') % Increase minimum step size
set_param('li_ion_model', 'RelTol', '1e-3') % Loosen relative tolerance
These commands address both the solver limitations and the step size convergence issues seen at time 2.54467. The solver ode15s is recommended for stiff systems like this, and increasing the allowed number of continuous states avoids the initial check failure.
For further reference on configuring solvers in Simulink, kindly refer to:
I hope this helps!

Community Treasure Hunt

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

Start Hunting!