FB_PMA_TaskTransfer_Send
The function block FB_PMA_TaskTransfer_Send can be used to transfer data from a slow task back to a fast task. This may be necessary if computationally intensive algorithms were swapped out to a slow task and the results are required in another task.
Together with the function block FB_PMA_TaskTransfer_Receive, it forms a function block pair for sending and receiving data. The data is passed to a function block with the target analysis ID after each call of the Call method.
The output buffers are provided for the function blocks whose ID is entered in the array of target IDs. The buffer to be initialized must be sufficient to cover the data to be transmitted.
Syntax
Definition:
FUNCTION BLOCK FB_PMA_TaskTransfer_Send
VAR_INPUT
nOwnID : UDINT;
aDestIDs : ARRAY[1..GVL_PMA.cMA_MaxDest] OF UDINT;
nResultBuffers : UDINT := 4;
tTransferTimeout : LTIME := LTIME#40US;
stInitPars : ST_PMA_TaskTransfer_InitPars;
END_VAR
VAR_OUTPUT
bError : BOOL;
ipResultMessage : I_TcMessage;
bNewResult : BOOL;
nCntResults : ULINT;
END_VAR
Inputs
The input parameters of this function block represent initialization parameters and have to be assigned during the declaration of the function block instance (alternatively: Init method). They may only be assigned once. A change at runtime is not possible.
Name |
Type |
Description |
---|---|---|
nOwnID |
UDINT |
Identifies the function block instance with a unique ID. This must always be greater than zero. A proven approach is to define an enumeration for this purpose. |
aDestIDs |
ARRAY[1..GVL_PMA.cMA_MaxDest] OF UDINT |
The data of the function block is sent to the IDs of the function block instances of the type specified here as an array FB_PMA_TaskTransfer_Receive. |
nResultBuffers |
UDINT |
Number of multi-array buffers that are initialized for the results. |
tTransferTimeout |
LTIME |
Setting of the synchronous timeout for internal multi-array forwardings. See Parallel Processing in Transfer Tray. |
stInitPars |
Function block-specific structure with initialization parameters. The parameters must match the definition of the input and output buffers. |
Outputs
Name |
Type |
Description |
---|---|---|
bError |
BOOL |
TRUE if an error occurs. |
ipResultMessage |
I_TcMessage |
The interface offers detailed information about the return value. |
bNewResult |
BOOL |
TRUE once new results have been provided. |
nCntResults |
ULINT |
Count value is incremented with new output data. |
Methods
Name |
Description |
---|---|
The method is called in each cycle to write the values to the output buffer. | |
Alternative to the function block initialization |
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x86, x64) | Tc3_PowerMonitoring |