Execution time prediction for Simulink models

3 views (last 30 days)
Hi,
Is there a method to predict if a simulink model A consumes more time than a Simulink model B?
In my case, I have many models generated by RTW. I am running these models in many threads. Before starting the simulation, I am trying to predict which model will consume more CPU and then affect it to a special thread.
If we can prove that state variables and zero-crossing events of model A are superior than those of model B, can we say that model A will consume more time than model B? I am not sure that is true...
Another solution is to use the WCET technique (Worst Case Execution Time), but I am searching for a simpler technique.
Thank you,
Best Reguards, Hassen

Accepted Answer

Andreas Goser
Andreas Goser on 14 Feb 2012
That is a very interesting question and I hope many others contribute to it. My first idea is to simulate a model for a brief period and then extrapolate the time.
Example: Model simulation time is 1000s. Simulate the model for the first 10s and multiply the execution time by 100 for a prediction.
Pro: Simple :-)
Cons: Would only be reasonable for fixed-step. Need to estimate the overhead for startingg a simulation. Does not take into account complex behaviour after the "presimulated" time like Stateflow state machines, enabled subsystems etc.

More Answers (2)

Hassen
Hassen on 14 Feb 2012
Thank you Andreas for answering.
I agree with your idea and I tested it. Fortunately, I am using only models with fixed-step solvers.
But, I am searching for something "more intelligent" without doing pre-simulation. At the initialisation of a model, information about zero-crossing events and number of state variables is available. I am not sure but I think that with fixed step solvers, zero-crossing events are disabled. So, may be comparaing the number of state variables could give me an idea about the complexity of the model. Indeed, I suppose that the user of the models (binary models generated with RTW) have no idea about the complexity of each model and also have not the possibility to make pre-simulation.
So here an example showing what I want to do: Let's take 3 models A, B and C. I suppose that the user have only 2 cores. The model A have the biggest execution time so it's assigned to one core, the models B and C are assigned in the other core.
Best Regards, Hassen

Hassen
Hassen on 1 Mar 2012
Any other ideas?

Categories

Find more on Manual Performance Optimization in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!