The smallest number of Simulink simulation steps

3 views (last 30 days)
What is the smallest number of simulation steps in Simulink? Does it differ for simulation with variable step and constant step?
I am trying to analyse model in Simulink by performing numerous sim() simulations saving state with 'SaveFinalState' and reloading using 'LoadInitialState'. Simulations are with constant step 1 minute. Ultimately, each simulation should be very short - consist of exactly two constant steps:
1) Start at moment defined in T (loaded simState),
2) End exactly at the end of the first step T+1min (determined in StopTime),
Unfortunately, such a script throws an error "The simulation of the model '__' stopped because the stop time is less than or equal to the snapshot time stored in the initial SimState. Increase the stop time if you want to continue the simulation from the specified __.".
The error can be removed by adding second step to simulation "StopTime=T + 2 * 1" insted of "StopTime=T + 1".

Answers (1)

Sai Bhargav Avula
Sai Bhargav Avula on 29 Jul 2019
Yes, the simulation step size varies for fixed and variable step solvers. If the solver is set to ‘auto’, then the simulation step size depends on the simulation time if a fixed-step type is used. If a variable-step type is used, then the simulation step is determined by considering the sample times of all the blocks in the model and then finding the greatest common divisor(gcd) of them.
In the given case, I think that the snapshot time is equal to the stop time which might be the reason for the error. Check the simulation time of the model after loading it. Also, the model’s step size is set to 1-minute which make the solver execute the model only once. Try decreasing step size the model.

Categories

Find more on General Applications in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!