Download Target Language Compiler Reference Guide

Transcript
Sample Time Functions
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 portor 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
• sfcnTID: integer (e.g., 2)
For block-based sample times (e.g., in S-function mdlInitializeSizes,
ssSetNumSampleTimes(S,N) with N > 1 was specified), sfcnTID is an integer
starting at 0 of the corresponding local S-function sample time.
• or sfcnTID: string of the form "InputPortIdxI", "OutputPortIdxI" where
I is a number ranging from 0 to the number of ports (e.g., "InputPortIdx0",
"OutputPortIdx7"). For port-based sample times (e.g., in S-function
9-37