FUNCTION_BLOCK SMC_RotateQueue2D
This function block will rotate the path stored in poqDataIn around the z-axis by the angle given by dPhi [°]. A positive angle effects a positive rotation in mathematical sense (counterclockwise).
The input variable poqDataIn is a pointer to the structure SMC_OUTQUEUE , which describes the path to get rotated. The initialization value FALSE of input variable bEnable will bar the rotation of the path. As soon as bEnable is set to TRUE all SMC_GEOINFO objects found in poqDataIn will be processed. When bEnable is reset to FALSE, the module will not execute any further modifications.
The initialization of input variable bReset with FALSE effects, that the SMC_GEOINFO objects currently found in poqDataIn will not get rotated, but only those that will be added.
As, during the processing, a sudden change of the characteristic parameter dPhi of the rotation might cause the path to be broken, modifications to the corresponding input will not be taken into account, until SMC_OUTQUEUE will be empty at poqDataIn or until a Reset (bReset) will be done.
In order to effect a rotation within the (x,y)-plane around a center differing from (0,0), e.g. around the point (xP,yP), a translation by the vector (-xP,-yP,0) has to be carried out first , followed by the rotation by the desired angle dPhi and followed again by a retranslation with vector (xP,yP,0).
InOut:
Scope |
Name |
Type |
Initial |
Comment |
Input |
bExecute |
BOOL |
FALSE |
Rising edge: Starts execution; while TRUE, the function block is active` |
bAppend |
BOOL |
FALSE |
If FALSE at a rising edge of bExecute, the output queue poqDataOut is emptied. |
|
poqDataIn |
POINTER TO SMC_OUTQUEUE |
NULL |
Pointer on a sufficiently large, free data area (buffer) that is allocated in the IEC application. |
|
dPhi |
LREAL |
0 |
Angle of rotation |
|
nSizeOutQueue |
UDINT |
0 |
This variable contains the size of the data buffer, the list of SMC_GEOINFO structure objects will be written to. This buffer must be at least five times as big as a SMC_GEOINFO structure itself. Otherwise, SMC_NCDecoder will not execute any actions at all. Its size may be predefined, but may be modified later only during a reset. It is recommended to create the buffer as described by the example below: ExampleBuf: Array of SMC_GeoInfo The appropriate buffer size will then be retrieved by use of the operator sizeof(ExampleBuf). |
|
pbyBufferOutQueue |
POINTER TO ARRAY [0..0] OF SMC_GEOINFO |
NULL |
This input must point to the first byte of the memory area that is allocated for the SMC_OUTQUEUE structure. This area must be at least as big as defined in nSizeOutQueue. Typically the allocation of the memory buffer is done in the declaration part of the IEC-program by defining an array of SMC_GEOINFO (e.g. BUF: ARRAY[1..50] OF SMC_GEOINFO; for a buffer that can store 50 path elements). The value may be predefined, but may be modified later on only during a reset. |
|
Output |
bDone |
BOOL |
FALSE |
This variable will be set to TRUE as soon as the input data of poqDataIn has been processed completely. Thereafter the module will not perform any further actions until it will be reset. If input bExecute is FALSE, bDone will be reset to FALSE. |
bBusy |
BOOL |
FALSE |
TRUE, while execution of function block is not finished |
|
bError |
BOOL |
FALSE |
Signals, that an error has occurred within the function block |
|
wErrorID |
SMC_ERROR |
SMC_NO_ERROR |
Error identification |
|
poqDataOut |
POINTER TO SMC_OUTQUEUE |
NULL |
Pointer to resulting SMC_OUTQUEUE |