I run a quasi-empty model in xPC Target Freerun mode.
To approximately evaluate how much the sample time is constant, I insert in the model an S-function which outputs the system time:
static void mdlOutputs(SimStruct *S, int_T tid) {
#ifndef MATLAB_MEX_FILE
real_T *y;
y=ssGetOutputPortSignal(S,0);
y[0] = xpcGetElapsedTime( (xpcTime *)NULL );
#endif
}
I have logged the output signal of this S-function and I have plotted the difference (by diff matlab function) for visualizing the approximate sample time: I found that the sample time is very little and quite constant for almost all the samples (its value is 1.2e-6 sec) except for some regulars extra long sample (9.9e-3 sec) which occur every 100 samples.
I write to ask why this happens and how it is possible to solve this problem.
Thank in advance you for your help
Best regards