Main Content

ssSetControllableSampleTime

Register controllable sample time in a block

Syntax

void ssSetControllableSampleTime(Simstruct *S, int st_index, time_T resolution) 

Arguments

S

SimStruct that represents 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.

resolution

Sample time resolution of the block. This is the smallest time step that the block can take. Events of the block can be set to occur at integral multiples of resolution.

Description

Use this function in mdlInitializeSampleTimes to register the block to be configured to run at a controllable sample time.

Languages

C, C++

Examples

Register the S-function block to use controllable sample time at a resolution of 0.01.

static void mdlInitializeSampleTimes(SimStruct* S)
{
    ssSetControllableSampleTime(S, 0, 0.01);
}

See the S-function sfun_pwm.c used in sfcndemo_pwm

Version History

Introduced in R2017b