Simulation time in Simulink

16 views (last 30 days)
I need to run a simulation from x sec to y sec in Simulink enviroment. I go to Solver --> set Start time=x Stop Time=y and run simulation. But this doesn´t work because simulation keep starting @ 0 sec. Does anybody knows how to do it?

Accepted Answer

Jingfang Qu
Jingfang Qu on 22 Jun 2018
Hi,
I understand you had some issue when you tried to set the simulation time for the Simulink model. You are in the right direction:
1. Configuration Parameters->Solver->Simulation time
2. Set start time=x, Stop Time=y;
3. Click Apply, then click OK.
4. Simulate the model, it should start with x and stop at y.
To see the start time, you can click on Step Forward instead of run, then you will see T=x at bottom right.
Thanks
  3 Comments
Pablo Panitta
Pablo Panitta on 22 Jun 2018
Yes and actually appears the T=Tstart x sec, but simulation always start running from 0 sec. Really weird...

Sign in to comment.

More Answers (2)

Ankita Bansal
Ankita Bansal on 25 Jun 2018
Edited: Ankita Bansal on 25 Jun 2018
Hi, can you see time offset(=4) at bottom right of your figure window?
The time offset is actually the start time you have given. The simulation runs from T=4 sec to T=12 sec only. It's just that the graph is shifted by 4 secs (x secs ).
You can also export the data to workspace and check for the min and max values of tout.
  2 Comments
Ankita Bansal
Ankita Bansal on 25 Jun 2018
"simulation actually last 8 sec"
Hi Pablo, simulation is running for 4 to 12 secs (for 8 secs duration). And the graph you are getting is also for 4 to 12 secs, it's just shifted by 4 secs. (4->0 and 12 ->8)
So (x,y) point in the graph actually corresponds to (x+4,y).

Sign in to comment.


Pablo Panitta
Pablo Panitta on 27 Jun 2018
Hi Ankita, first thank for keep helping me in this. Unfortunatelly I don´t see the same what you´re seeing.
Picture 1: Complete simulation time Tstart=0, Tstop=12
Picture 2 : Partial simulation time Tstart=4 , Tsopt=12.
The only difference I see is the time finish, but partial simulation is not starting at 4 sec, but 0 sec, which is what I try to avoid.
Thanks Pablo

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by