FUNCTION_BLOCK SMC_SmoothMerge
The function block serves the preprocessing of line segments supplied by a CAD/CAM system. It is executed after decoding. It tries to approximate a maximum number of points by a polynom. The deviation from the original path must be within a given threshold. The created elements can be smoothed by use of the SMC_SmoothPath function block.
In each cycle this function block appends a maximum of one element to the out-queue. Exactly one element is appended if the in-queue is full or bEndOfList is active and the out-queue is not full. The look-ahead is therefore limited by the size of the in-queue. Only movements in X, Y, Z, A, B and C are considered.
The function block uses the mean-square-best-approximation, but always pass exactly through one first point (for avoiding jumps). This first point is given by the piDestPos of the last generated element. If it is the first element that we deal with, this is its piStartPos.
Every movement with type different from G01 will just be forwarded to the out-queue.
Note
The function block
does not support add-ax movements
does not support h-functions
does not support changes of flags like G51, G52, G40 and so on. These changes are ignored.
takes at most 128 line segments into account (as this quantity influences both performance and storage size).
A spline always contains the same tool correction information (i.e. lengths and diameter) as the first of the segments that it replaces.
InOut:
Scope |
Name |
Type |
Initial |
Comment |
Input |
bExecute |
BOOL |
Starts on rising edge; while TRUE, the function block is active. |
|
poqDataIn |
POINTER TO SMC_OUTQUEUE |
Points to the SMC_OUTQUEUE-structure object, which contains the SMC_GEOINFO objects of the unsmoothed path; typically it points to the output poqDataOut of the preceding module (e.g. the SMC_NCDecoder). |
||
nSizeOutQueue |
UDINT |
Size of the data buffer pbyBufferOutQueue`` in bytes |
||
pbyBufferOutQueue |
POINTER TO ARRAY [0..0] OF SMC_GEOINFO |
Points to the first byte of the memory area being 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 within the declaration part of the IEC-program by defining an array of SMC_GeoInfo (ExampleBuf: ARRAY[1..50] OF SMC_GEOINFO for a buffer which can hold 50 path elements). After predefining the value it may be modified during a reset only. |
||
piMaxDifference |
The maximum allowed deviation from the original path, in X, Y, Z, A, B and C |
|||
usiMaxDegree |
USINT |
5 |
The maximal degree for the resulting polynomials, at most 5 |
|
wFeatureFlag |
WORD |
The feature bit (0..31) used for smoothing (controlled by G38/G39) |
||
wAdditionalParamNumber |
WORD |
The number of the additional parameter (set by G38 I/J/K) that is used as a factor multiplied to the precision |
||
dMinimumCurvatureRadius |
LREAL |
0 |
If a possibly generated spline contains a position where its curvature radius is less than this value, it won't be generated. |
|
Output |
bDone |
BOOL |
Will be set to TRUE as soon as the input data from poqDataIn has been processed completely. Thereafter, the module will not perform any further actions until it gets reset. If the bExecute input is FALSE, bDone will be reset to FALSE. |
|
bBusy |
BOOL |
TRUE, while execution of function block is not finished |
||
bError |
BOOL |
Signals, that an error has occurred within the function block |
||
wErrorID |
SMC_ERROR |
Error identification |
||
poqDataOut |
POINTER TO SMC_OUTQUEUE |
The queue for the output path |
||
uiNrElems |
UINT |
The number of elements that have been merged in this cycle |