Target Language Compiler    

Advanced Functions

LibBlockInputSignalBufferDstPort(portIdx)

Returns the output port corresponding to input port (portIdx) that share the same memory, otherwise (-1) is returned. You will need to use this function when you specify ssSetInputPortOverWritable(S,portIdx,TRUE) in your S-function.

If an input port and some output port of a block are

then the output port might reuse the same buffer as the input port. In this case, LibBlockInputSignalBufferDstPort returns the index of the output port that reuses the specified input port's buffer. If none of the block's output ports reuse the specified input port buffer, then this function returns -1.

This function is the TLC version of the Simulink macro ssGetInputPortBufferDstPort.

Example

Assume you have a block that has two input ports, both of which receive a complex number in 2-wide vectors. The block outputs the product of the two complex numbers.

Note that this example could have equivalently used (LibBlockInputSignalBufferDstPort(0) == 0) as the Boolean condition for the %if statements since there is only one output port.

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

LibBlockInputSignalStorageClass(portIdx, idx)

Returns the storage class of the specified block input port signal. The storage class can be "Auto", "ExportedSignal", "ImportedExtern", or "ImportedExternPointer".

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

LibBlockInputSignalStorageTypeQualifier(portIdx, idx)

Returns the storage type qualifier of the specified block input port signal. The type qualifier can be anything entered by the user such as "const". The default type qualifier is "Auto", which means do the default action.

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

LibBlockOutputSignalIsGlobal(portIdx)

Returns 1 if the specified block output port signal is declared in the global scope, otherwise returns 0.

If this function returns 1, then the variable holding this signal is accessible from any where in generated code. For example, this function returns 1 for signals that are test points, external or invariant.

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

LibBlockOutputSignalIsInBlockIO(portIdx)

Returns 1 if the specified block output port exists in the global Block I/O data structure. You may need to use this if you specify ssSetOutputPortReusable(S,portIdx,TRUE) in your S-function.

See matlabroot/toolbox/simulink/blocks/tlc_c/sfun_multiport.tlc.

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

LibBlockOutputSignalIsValidLValue(portIdx)

Returns 1 if the specified block output port signal can be used as a valid left-side argument (lvalue) in an assignment expression, otherwise returns 0. For example, this function returns 1 if the block output port signal is in read/write memory.

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

LibBlockOutputSignalStorageClass(portIdx)

Returns the storage class of the block's specified output signal. The storage class can be "Auto", "ExportedSignal", "ImportedExtern", or "ImportedExternPointer".

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

LibBlockOutputSignalStorageTypeQualifier(portIdx)

Returns the storage type qualifier of the block's specified output signal. The type qualifier can be anything entered by the user such as "const". The default type qualifier is "Auto", which means do the default action.

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

LibBlockSrcSignalBlock(portIdx, idx)

Returns a reference to the block that is source of the specified block input port element. The return argument is one of the following.

[systemIdx, blockIdx]
If unique block output or block state
"ExternalInput"
If external input (root inport)
"Ground"
If unconnected or connected to ground
"FcnCall"
If function-call output
0
If not unique (i.e., source for a Merge block or a reused signal due to block I/O optimization)

Example

The following code fragment finds the block that drives the second input on the first port of the current block, then, assigns the input signal of this source block to the variable y:

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

LibBlockSrcSignalIsDiscrete(portIdx, idx)

Returns 1 if the source signal corresponding to the specified block input port element is discrete, otherwise returns 0.

Note that this function also returns 0 if the driving block cannot be uniquely determined if it is a merged or reused signal (i.e., the source is a Merge block or the signal has been reused due to optimization).

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

LibBlockSrcSignalIsGlobalAndModifiable(portIdx, idx)

This function returns 1 if the source signal corresponding to the specified block input port element satisfies the following three conditions:

Otherwise, this function returns 0.

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

LibBlockSrcSignalIsInvariant(portIdx, idx)

Returns 1 if the source signal corresponding to the specified block input port element is invariant (i.e., the signal does not change).

For example, a source block with a constant TID (or equivalently, an infinite sample time) would output an invariant signal.

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

LibCreateHomogMathFcnRec(FcnName, FcnTypeId)

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

LibGetMathConstant(ConstName,ioTypeId)

Return a valid math constant expression with the proper datatype.

This function can only be called after funclib.tlc is included.

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

LibMathFcnExists(RTWFcnName, RTWFcnTypeId)

Return whether or not an implementation function exists for a given generic operation (function), given the specified function prototype.

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

LibSetMathFcnRecArgExpr(FcnRec, idx, argStr)

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


  Other Useful Functions model.rtw