I'm trying to make my level-2 Fortran S-function have a variable step time so that the output variables when ran in Simulink are continuous (right now the outputs are very choppy and step-function like). I can't use a fixed time step solver due to computation time requirements.
I have the following conditions set in my C code:
ssSetSampleTime(S, 0, VARIABLE_SAMPLE_TIME);
ssSetOffsetTime(S, 0, 0);
And the mex file compiles with no issue, however when I try to run a simulation I get the following error: Scheduled hit time 0 is less than the current time 0 for rate with index 0 and identifier ROM_exec_time/sfun_ROM_fortran_onestep$0 (https://i.stack.imgur.com/6TLdm.png)
I have tried adding the following to mdlGetTimeOfNextVarHit but to no avail:
time_T offset = getOffset();
time_T timeOfNextHit = ssGetT(S) + offset;
ssSetTNext(S, timeOfNextHit);
I also tried just setting offset = 0.1 and still get the same error.
Does anyone know what I'm missing? Thank you in advance.