0

I intend to run a Matlab Simulink model (of 400 ODEs i.e. 400 ODE models) with a fixed step size of 200e-06 and a simulation/stop time of 52 hours. As per my understanding, the Simulink stop time unit is in seconds. Does it mean that I need to run the simulation for (52*3600) 187200 seconds?? Further, I realized that running the Simulink model with a simulation time of 187200 seconds will take a very large time (maybe a couple of months which is not a feasible option), irrespective, of high computer configuration or vectorized/parallelized model structure.

Can someone please let me know the relationship between stepsize and simulation/stop time??

Thank you for you time.

Regards

Waldi
  • 39,242
  • 6
  • 30
  • 78

1 Answers1

2

Step size and simulation duration are independent parameters.
For a fixed step simulation, you have the following relation :

NumberSteps = Duration / StepSize

The designer of the model should decide what is the time unit and design it accordingly.
It can be anything, seconds, hours, weeks,..., you only have to make sure that the calculations in the model are consistent with the unit you chose.
For example, you can model speed in m/s, km/h, miles/h, ... and make the same 1 s calculations either with 1 (s) step or 1/3600 (h) step.
The question is to know in which time unit the model you use was designed?
If the model uses a 1 second logic, then :

NumberSteps = 52 * 3600 / (200e-6) = 936e6

This is an unusual high number of steps and explains the too long run time.
I would question the need to have such a small step size for such a long duration.

It's also possible to model the same system with a 1 hour logic.
In this case :

NumberSteps = 52 / (200e-6) = 260e3
Stepsize = 200e-6 h = 0.72 s

This becomes an usual number of steps for a simulation and should run in a few seconds or minutes depending on model complexity

Waldi
  • 39,242
  • 6
  • 30
  • 78
  • Thank you for your response. I understand that the step size is small and causing it to be a high number of steps and high simulation runtime. Absolutely there is no need for such a small step size, but I have to check the model response with a step size of 0.0002. Also, I am still not clear about the "stop-time" to be mentioned in Simulink for 52 hours with a step size of 0.0002 . Can you please elaborate on that? Note that my model parameter units are in hours. – Sushil Surwase Jul 02 '20 at 21:27
  • I rephrased my answer because I got confused with the seconds you mentionned. Actually you should decide what is your duration unit, so you can decide that unit is hours if your model is designed to handle hours. In such a case you'll be 3600 faster. – Waldi Jul 02 '20 at 23:15
  • See my edit : was the model you use conceived in hours or in seconds? Is 0.0002 hours or seconds? – Waldi Jul 02 '20 at 23:37
  • Hi @waldi! Thank you for your detailed answer. My stepsize unit is 0.0002 hours and the model I am using is conceived in hours. As you mentioned, step size and simulation duration are independent parameters, so accordingly to run the model for 52 hours, do I need to mention the simulation stop time as 52 (to make sure unit consistency among step size and model parameters)? – Sushil Surwase Jul 03 '20 at 17:03
  • 1
    Yes, exactly, duration = 52 : it's going to be much faster! – Waldi Jul 03 '20 at 17:07
  • Yes, that sounds perfect! Thank you so much for your time. – Sushil Surwase Jul 03 '20 at 17:35
  • My pleasure. If it works, you can accept the answer. – Waldi Jul 03 '20 at 17:55