ssSetNumTicksToNextHitForControllableSampleTime
Schedule number of steps to next event
Syntax
void ssSetNumTicksToNextHitForControllableSampleTime(SimStruct *S, int st_index, size_T numTick)
Arguments
- S
-
SimStruct representing an S-Function block.
- st_index
-
Index of the controllable sample time in the block.
Note
controllable Sample Time is only supported in single rate blocks. Hence
sti
will be 0. - numTick
-
Interval between current and next execution. The block will next execute after
numTick * resolution
. SeessSetControllableSampleTime
for information on settingresolution
.
Description
Use this function inmdlInitializeConditions
andmdlOutputs
to set the next time the S-function should execute. The next execution is scheduled fort_next = t + numTick * resolution
, wheret
is the current time andresolution
is set usingssSetControllableSampleTime
.
Languages
C, C++
Examples
SetnumTick = 1
when you callssSetNumTicksToNextHitForControllableSampleTime
inmdlInitializeConditions
to force the block to execute when the system is initialized.
staticvoidmdlInitializeConditions(SimStruct *S}{ ssSetNumTicksToNextHitForControllableSampleTime(S, 0, 1); }
Schedule the next execution of the block att + 4 * resolution
, wheret
is the current time.
staticvoidmdlOutputs(SimStruct* S, int_T tid){ ssSetNumTicksToNextHitForControllableSampleTime(S, 0, 4); }
See the S-functionsfun_pwm.c
used insfcndemo_pwm