Estimation Time to Finish Simulink run to update a GUI

1 visualizzazione (ultimi 30 giorni)
Angelo
Angelo il 23 Feb 2016
Modificato: Angelo il 23 Feb 2016
Hello,
I'm trying to estimate the remaining time of a Simulink simulation and update this info into a GUI. It clearly depends strongly on the cpu load so it cannot be very precise but it can give an hint if we can go for a coffee or we should wait. My best solution up to now is to recursively compute the current simulation time get_param(model, 'SimulationTime') and the cputime required to simulate the same step. This gives me the nº of seconds required to the cpu to run the piece of simulation (e.g. to simulate 5s tooks 1s of my PC cpu). Then I extrapolate the remaining time multiplying this value for the remaining time to be simulated. An example:
sim_start = str2num(get_param(model, 'StartTime'));
sim_stop = str2num(get_param(model, 'StopTime'));
sim_time = get_param(model, 'SimulationTime');% = 3s
e_time = cputime - cputime_last_step;% = 0.2s
mean_time = GNCDE.mean_time + 1;
relative_time = e_time/sim_time;% = 0.0667s
rem_time(mean_time) = relative_time * (sim_stop - sim_time);
I also perform a mean on 5 or 10 consecutive output and set it on a string in a GUI:
if mod(mean_time,10) == 0
rem_time_mean = round(sum(rem_time)/10);
set(handle_text61,'String',num2str(rem_time_mean));
end
I know this is not very accurate (it depends on the past and not on the future simulation that in general can be more or less heavy wrt the previous part of the simulation) but it gives me oscillating but quite fair results.
Do you have different, hopefully more reliable, solutions?
Thanks
angelo

Risposte (0)

Categorie

Scopri di più su View and Analyze Simulation Results in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by