SMC_OUTQUEUE (FB)

FUNCTION_BLOCK SMC_OUTQUEUE

This function block is designed to manage SMC_GEOINFO objects in a list of defined size.

The path processing function blocks like SMC_NCDecoder, SMC_SmoothPath, SMC_RoundPath, SMC_AvoidLoop and SMC_ToolCorr - providing a pointer to an internally handled SMC_OUTQUEUE-structure - will initialize this structure automatically.

If this queue is programmed and filled "manually", then the correct initialization has to be done manually also. For this purpose the first two variables (pbyBuffer, size) have to be assigned.

Note

It is strictly recommended to use the functions inside the folder "OutQueue Functions" for working with an SMC_OUTQUEUE structure, and to avoid any modification of its parameters after initialization.

InOut:

Scope

Name

Type

Initial

Comment

Input

wOUTQUEUEStructID

WORD

16#9878

The fix value of this variable allows to check if the provided structure variable is of type SMC_OUTQUEUE.

pbyBuffer

POINTER TO ARRAY [0..0] OF SMC_GeoInfo

Address of coherent memory buffer allocated for SMC_GEOINFO objects. The variable pbyBuffer has to be assigned in every cycle within the IEC program allocating the buffer. The allocation is done within the declaration part, e.g. by using an array (BUFFER: ARRAY [0..99] OF SMC_GEOINFO for a memory area large enough to hold 100 SMC_GEOINFO objects).

nCapacity

UDINT

Contains the capacity in multiples of SMC_GEOINFO objects (The number OF SMC_GEOINFO objects that fit into pbyBuffer). The function SMC_SetQueueCapacity initializes this field.

nReadPos

UDINT

Contains the position in multiples of SMC_GEOINFO objects of the first object in the list.

bEndOfList

BOOL

In order to avoid a buffer underrun ( SMC_Interpolator), the SoftMotion function block being passed an SMC_OUTQUEUE structure will not start with the processing of this queue, until it has been filled up completely. However, when working on the last SMC_GEOINFO objects of a path, SMC_OUTQUEUE is no longer complete. Hence, in order to keep the processing going on, bEndOfList has to be set to TRUE as soon as the last SMC_GEOINFO object has been stored. In case that the list will be empty hereafter, but should be filled up again, bEndOfList has to be reset to FALSE.

byGenerator

BYTE

250

Originator of the queue. The interpolator will use this information for verifying that SMC_CheckVelocities has been processed as prescribed.

Valid values are:

bReCheckVelocities

BOOL

Internal variable

strProgramName

STRING

Name of the CNC program

nWritePos

UDINT

Contains the next free position in multiples of SMC_GEOINFO objects. (Declared after strProgramName in order to avoid cache thrashing: make sure, nReadPos and nWritePos aren't part of the same cache line.))

xPartofLM

BOOL

If the input, generated by programming system, is TRUE, the function block is maintained by managers.

nNumReservedEntries

UDINT

The number of reserved entries: if this number of free entries is reached, SMC_OutQueue.bFull will return TRUE. Must be at least 3 and at most nCapacity-1.

nPastMarker

DINT

Points to the first element that has been stored in the queue (if any) and has not yet been overwritten. So the elements from nPastMarker to nReadPos-1 are the "past" of the current queue. nPastMarker equals -1 if (and only if) no element has been appended to the queue yet.