High task execution time (TET) in the beginning of the model's execution could be related to a caching issue.
For instance, if your model has large amount of states, and you access those states in your real-time code, the first time you reference those states in your code, those states would need to be cached, so the execution time will increase.
The next time you access those states, they will probably be in your system's cache, so the execution time will be much lower.
If you do not want the caching mechanism to influence your real-time execution, you need to reference those states before the real-time execution begins, for instance, in the MdlStart function.
The idea is that the states will get cached outside of the real-time execution constraint.
Best Answer