Main Content

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. Hencestiwill be 0.

numTick

Interval between current and next execution. The block will next execute afternumTick * resolution. SeessSetControllableSampleTimefor information on settingresolution.

Description

Use this function inmdlInitializeConditionsandmdlOutputsto set the next time the S-function should execute. The next execution is scheduled fort_next = t + numTick * resolution, wheretis the current time andresolutionis set usingssSetControllableSampleTime.

Languages

C, C++

Examples

SetnumTick = 1when you callssSetNumTicksToNextHitForControllableSampleTimeinmdlInitializeConditionsto 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, wheretis the current time.

staticvoidmdlOutputs(SimStruct* S, int_T tid){ ssSetNumTicksToNextHitForControllableSampleTime(S, 0, 4); }

See the S-functionsfun_pwm.cused insfcndemo_pwm

Introduced in R2017b