| Real-Time Workshop® | ![]() |
Returns whether this TID corresponds to a asynchronous triggered rate.
See LibAsynchronousTriggeredTID in matlabroot/rtw/c/tlc/lib/utillib.tlc.
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 (real > 0) |
Continuous | 0.0 |
Triggered | -1.0 |
Constant | -2.0 |
See LibBlockSampleTime in matlabroot/rtw/c/tlc/lib/blocklib.tlc.
Returns integer task time (current clock tick of the task timer). The resolution of the timer can be obtained from LibGetClockTickStepSize(tid). The data type ID of the timer can be obtained from LibGetClockTickDataTypeId(tid).
See LibGetClockTick in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns clock tick data type ID.
See LibGetClockTickDataTypeId in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns high-order word of the integer task time. LibGetClockTickHigh is used when uint32 pairs are used to store absolute time. The resolution of a clock tick can be obtained from LibGetClockTickStepSize(tid).
See LibGetClockTickHigh in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns clock tick step size, which is the resolution of the integer task time. LibGetClockTickStepSize cannot be used if the task does not have a timer.
See LibGetClockTickStepSize in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns time elapsed since the last time the subsystem started to execute.
See LibGetElapseTime in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns an integer elapsed time. This is the number of clock ticks elapsed since the last time the system started. To get real-world elapsed time, this integer elapsed time must be multiplied by the applicable resolution.
You can obtain the resolution by calling LibGetElapseTimeResolution(system). You can obtain the data type ID of the integer elapsed time counter by calling LibGetElapseTimeCounterDTypeId(system).
See LibGetElapseTimeCounter in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns the date type ID of the integer elapsed time returned by LibGetElapseTimeCounter.
See LibGetElapseTimeCounterDTypeId in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns the resolution of the elapsed time returned by LibGetElapseTimeCounter.
See LibGetElapseTimeResolution in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns the model task identifier (sample time index) corresponding to the specified local S-function task identifier or port sample time. LibGetGlobalTIDFromLocalSFcnTID allows you to use one function to determine a global TID, independent of port- or block-based sample times.
The input argument to LibGetGlobalTIDFromLocalSFcnTID should be one of the following:
For block-based sample times (e.g., in S-function mdlInitializeSizes, ssSetNumSampleTimes(S, N) with N > 1 was specified), sfcnTID is a nonnegative integer giving the corresponding local S-function sample time.
For port-based sample times (e.g., in S-function mdlInitializeSizes, ssSetNumSampleTimes(S, PORT_BASED_SAMPLE_TIMES) was specified), sfcnTID is a string of the form "InputPortIdxI" or "OutputPortIdxI", where I is an integer ranging from 0 to the number of ports (e.g., "InputPortIdx0".
%assign globalTID = LibGetGlobalTIDFromLocalSFcnTID(2)
or
%assign globalTID =
LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx4")
%assign period =
CompiledModel.SampleTime[globalTID].PeriodAndOffset[0]
%assign offset =
CompiledModel.SampleTime[globalTID].PeriodAndOffset[1]%switch (LibGetSFcnTIDType(0))
%case "discrete"
%case "continuous"
%assign globalTID = LibGetGlobalTIDFromLocalSFcnTID(2)
%assign period = ...
CompiledModel.SampleTime[globalTID].PeriodAndOffset[0]
%assign offset = ...
CompiledModel.SampleTime[globalTID].PeriodAndOffset[1]
%breaksw
%case "triggered"
%assign period = -1
%assign offset = -1
%breaksw
%case "constant"
%assign period = rtInf
%assign offset = 0
%breaksw
%default
%<LibBlockReportFatalError([],"Unknown tid type")>
%endswitchSee LibGetGlobalTIDFromLocalSFcnTID in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns the number of S-function sample times for a block.
See LibGetNumSFcnSampleTimes in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns the type of the specified S-function task identifier (sfcnTID). Possible values are:
"continuous" — The specified sfcnTID is continuous.
"discrete" — The specified sfcnTID is discrete.
"triggered" — The specified sfcnTID is triggered.
"constant" — The specified sfcnTID is constant.
The format of sfcnTID must be the same as for LibIsSFcnSampleHit.
Note This is useful primarily in the context of S-functions that specify an inherited sample time. |
See LibGetNumSFcnSamplTimes in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns a string to access the absolute time of the task, which is a floating-point number. However, if you have configured the model for integer-only code generation (by deselecting Support floating-point numbers), the string represents an integer equal to the number of base rate ticks (the absolute time divided by the base sample time) rather than the absolute time.
LibGetTaskTime is the TLC version of the SimStruct macro: "ssGetTaskTime(S,tid)".
See LibGetTaskTime in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns a string to access the absolute time of the task associated with the block.
If the code format is not Embedded-C, LibGetTaskTimeFromTID returns the string "RTMGet("T")" if the block is constant or the system is single rate, and "RTMGetTaskTimeForTID(tid)" otherwise.
If the code format is Embedded-C, LibGetTaskTimeFromTID returns "RTMGetTaskTimeForTID(tid)".
If the block is constant or the system is single rate, this is the TLC version of the SimStruct macro: "ssGetT(S)" and "ssGetTaskTime(S, tid)" otherwise.
In both cases, S is the name of the SimStruct.
See LibGetTaskTime in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns 1 if the specified task identifier (TID) is continuous, 0 otherwise. Note that task identifiers equal to "triggered" or "constant" are not continuous.
See LibIsContinuous in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns 1 if the specified task identifier (TID) is discrete, 0 otherwise. Note that task identifiers equal to "triggered" or "constant" are not discrete.
See LibIsDiscrete in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns 1 if a sample hit occurs for the specified local S-function task identifier (TID), 0 otherwise.
The input argument to LibIsSFcnSampleHit should be one of the following:
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.
sfcnTID: "InputPortIdxI", or "OutputPortIdxI" (e.g., "InputPortIdx0")
For port-based sample times (e.g., in S-function mdlInitializeSizes, ssSetNumSampleTimes(S,PORT_BASED_SAMPLE_TIMES) was specified), sfcnTID is a string giving the input (or output) port index.
Consider a multirate S-function block with four block sample times. The call LibIsSFcnSampleHit(2) returns the code to check for a sample hit on the third S-function block sample time.
Consider a multirate S-function block with three input and eight output sample times. The call LibIsSFcnSampleHit("InputPortIdx0") returns the code to check for a sample hit on the first input port. The call LibIsSFcnSampleHit("OutputPortIdx7") returns the code to check for a sample hit on the eighth output port.
See LibIsSFcnSampleHit in matlabroot/rtw/c/tlc/lib/utillib.tlc.
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 LibIsSFcnSingleRate in matlabroot/rtw/c/tlc/lib/utillib.tlc.
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. LibIsSFcnSpecialSampleHit determines the global TID from the S-function TID
The input arguments to LibIsSFcnSpecialSampleHit are
For multirate S-function blocks:
sfcnSTI: local S-function sample time index (sti) of the slow task that is to be promoted
sfcnTID: local S-function task ID (tid) of the fast task where the slow task is to run
For single-rate S-function blocks using SS_OPTION_RATE_TRANSITION, sfcnSTI and sfcnTID are ignored and should be specified as "".
The format of sfcnSTI and sfcnTID must follow that of the argument to LibIsSFcnSampleHit.
A rate transition S-function (one sample time with SS_OPTION_RATE_TRANSITION)
if (%<LibIsSFcnSpecialSampleHit("","")>) {
A multirate S-function with port-based sample times where the output rate is slower than the input rate (e.g., a zero-order hold operation)
if (%<LibIsSFcnSpecialSampleHit("OutputPortIdx0","InputPortIdx0")>) {See LibIsSFcnSpecialSampleHit in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns true if model is single rate, and false otherwise.
See LibIsSingleRateModel in matlabroot/rtw/c/tlc/mw/codetemplatelib.tlc.
Returns 1 if the specified task identifier (TID) is zero order hold (ZOH) continuous, 0 otherwise. A TID equal to triggered or constant is not ZOH continuous.
See LibIsZOHContinuous in matlabroot/rtw/c/tlc/lib/utillib.tlc.
Returns the number of discrete sample times in the model.
See LibNumAsynchronousSampleTimes in matlabroot/rtw/c/tlc/mw/codetemplatelib.tlc.
Returns the number of discrete sample times in the model.
See LibNumDiscreteSampleTimes in matlabroot/rtw/c/tlc/mw/codetemplatelib.tlc.
Determines whether the port-based S-function block is triggered.
See LibPortBasedSampleTimeBlockIsTriggered in matlabroot/rtw/c/tlc/lib/blocklib.tlc.
Generates code to set the next variable hit time. Blocks with variable sample time must call LibSetVarNextHitTime in their output functions.
See LibSetVarNextHitTime in matlabroot/rtw/c/tlc/lib/blocklib.tlc.
Returns whether this TID corresponds to a triggered rate.
See LibTriggeredTID in matlabroot/rtw/c/tlc/lib/utillib.tlc.
![]() | Code Configuration Functions | Other Useful Functions | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |