Target Language Compiler    

Sample Time Functions

LibBlockSampleTime(block)

Returns the block's sample time. The returned value depends on the sample time classification of the block, as shown in the following table.

Block Classification
Returned Value
Discrete
The actual sample time of a block (a real number greater than 0.)
Continuous
0.0
Triggered
-1.0
Constant
-2.0

See function in matlabroot/rtw/c/tlc/lib/blocklib.tlc.

LibGetGlobalTIDFromLocalSFcnTID(sfcnTID)

Returns the model task identifier (sample time index) corresponding to the specified local S-function task identifier or port sample time. This function allows you to use one function to determine a global TID, independent of port- or block-based sample times.

Calling this function with an integer argument is equivalent to the statement SampleTimesToSet[sfcnTID][1]. SampleTimesToSet is a matrix that maps local S-function TIDs to global TIDs.

The input argument to this function should be either

Examples

Multirate block.   

Inherited sample time block.   

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibGetNumSFcnSampleTimes(block)

Returns the number of S-function sample times for a block.

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibGetSFcnTIDType(sfcnTID)

Returns the type of the specified S-function's task identifier (sfcnTID).

The format of sfcnTID must be the same as for LibIsSFcnSampleHit.

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibGetTaskTimeFromTID(block)

Returns the string "ssGetT(S)" if the block is constant or the system is single rate and "ssGetTaskTime(S, tid)" otherwise. In both cases, S is the name of the SimStruct.

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibIsContinuous(TID)

Returns 1 if the specified task identifier (TID) is continuous, 0 otherwise. Note, TIDs equal to "triggered" or "constant" are not continuous.

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibIsDiscrete(TID)

Returns 1 if the specified task identifier (TID) is discrete, 0 otherwise. Note, task identifiers equal to "triggered" or "constant" are not discrete.

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibIsSFcnSampleHit(sfcnTID)

Returns 1 if a sample hit occurs for the specified local S-function task identifier (TID), 0 otherwise.

The input argument to this function should be either

Examples

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibIsSFcnSingleRate(block)

LibIsSFcnSingleRate returns a boolean value (1 or 0) indicating whether the S-function is single rate (one sample time) or multirate (multiple sample times).

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibIsSFcnSpecialSampleHit(sfcnSTI, sfcnTID)

Returns the Simulink macro to promote a slow task (sfcnSTI) into a faster task (sfcnTID).

This advanced function is specifically intended for use in rate transition blocks. This function determines the global TID from the S-function TID and calls LibIsSpecialSampleHit using the global TIDs for both the sample time index (sti) and the task ID (tid).

The input arguments to this function are

The format of sfcnSTI and sfcnTID must follow that of the argument to LibIsSFcnSampleHit.

Examples

See function in matlabroot/rtw/c/tlc/lib/utillib.tlc.

LibPortBasedSampleTimeBlockIsTriggered(block)

Determines if the port-based S-function block is triggered.

See function in matlabroot/rtw/c/tlc/lib/blocklib.tlc.

LibSetVarNextHitTime(block,tNext)

Generates code to set the next variable hit time. Blocks with variable sample time must call this function in their output functions.

See function in matlabroot/rtw/c/tlc/lib/blocklib.tlc.


  Code Configuration Functions Other Useful Functions