ssGetTaskTime
Get the current time for the current task
Syntax
time_T ssGetTaskTime(SimStruct *S, st_index)
Arguments
S
SimStruct that represents an S-Function block.
st_index
Index of the sample time corresponding to the task for which the current time is to be returned.
Returns
A value of type time_T
.
Description
Use to determine the current time (time_T
) of the task
corresponding to the sample rate specified by st_index
. You can
use this macro in mdlOutputs
and mdlUpdate
to
compute the output of your block. See
for a description of the
matlabroot
/extern/include/tmwtypes.htime_T
data type.
The ssGetTaskTime
macro should be called only inside an
ssIsSampleHit
check when you have
multirate S-Functions. It will not give the correct results if called with the
tid
passed into mdlOutputs
.
Languages
C, C++
Examples
The following example illustrates a correct usage of this macro:
static void mdlOutputs( SimStruct *S, int_T tid ) { double t; if(ssIsSampleHit(S,0,tid)) { t = ssGetTaskTime(S,0); ssPrintf("Task 0 sample hit in %s time = %g\n", ssGetPath(S),t); } if(ssIsSampleHit(S,1,tid)) { t = ssGetTaskTime(S,1); ssPrintf("Task 1 sample hit in %s time = %g\n", ssGetPath(S),t); } }
See Also
Version History
Introduced before R2006a