Recalculate the Queuing Amount.
Version history
0.5.0
Changes
- rename
NR_OF_INSTANCEStoPOSTABLE_CMDS_UBOUNDfor consistency
show full history
0.4.1
Changes
- rename
NR_OF_INSTANCESinINSTANCES_UBOUND(only relevant for Siemens)
0.4.0
Changes
conditionsare passed as an input instead of in_out- Use
conditionsOKinstead ofhasConditionfor waiting at the next entry
0.3.0
Changes
- If the next valid entry has conditions, the current entry is a standstill
0.2.0
Changes
- Replace
posTableModebyallowQueuing - Replace
nQAmaxbyQA_MAXas a constant
0.1.0-beta
Changes
- initial version
Overview
| kind | name | type | default | comment |
|---|---|---|---|---|
| input | allowQueuing | BOOL | allow queuing the next motions | |
| input | firstMove | BOOL | calc first move after system was reset | |
| input | stopAfterLastEntry | BOOL | continue to the start of PosTable when searching for the next Index and LoadIndex | |
| input | conditions | ARRAY [0..GVL.CONDITIONS_UBOUND] OF BOOL | bits used as start conditions for a PosTable entry | |
| input | loadIndex | INT | index for loading next motion(s) | |
| in_out | posTable | McePosTableData | trajectory to be processed by PosTable | |
| in_out | QA | INT | allowed Queueing Amount; number of motions to queue (for smooth motion) | |
| in_out | lastEntry | BOOL | last entry in process | |
| in_out | stopEntry | BOOL | entry with robot standstill (ActionID > 0) in process | |
| in_out | waitBeforeNextEntry | BOOL | next valid entry has start conditions | |
| in_out | index | INT | PosTable index for current motion |
Details
allowQueuing
BOOLAllow queuing the next motions.
| value | explanation |
|---|---|
| 0 | QA is decreased at the end of each motion until 0 |
| 1 | QA is updated depending on the number of remaining entries until standstill |
firstMove
BOOLMust be True when calculating the first motion of the PosTable.
False otherwise.
stopAfterLastEntry
BOOLContinue to the start of PosTable when searching for the next Index and LoadIndex if False.
conditions
ARRAY [0..GVL.CONDITIONS_UBOUND] OF BOOLBits used as start conditions for a PosTable entry.
If a PosTable entry has one or more bits in startConditions set to TRUE
then the motion for that entry will not be started until the start conditions
are satisfied.
- Conditions are only checked for the
TRUEstate - If you need a condition to be checked for the
FALSEstate, you need to invert the connected signal outside of PosTable
loadIndex
INTIndex of the last loaded motion.
posTable
McePosTableDataTrajectory to be processed by PosTable.
QA
INTThe Queueing Amount is the number of motions allowed to be queued.
Queueing motion in advance is necessary for smooth motion.
lastEntry
BOOLTrue if the last valid entry of the PosTable is in process.
stopEntry
BOOLTrue if the current entry of the PosTable ends in a standstill.
This means that an ActionID will be performed at the end of motion.
waitBeforeNextEntry
BOOLTrue if the next valid entry of the PosTable has start conditions.
index
INTThe PosTable index is updated by this function.
Source code
Declarations
(*Recalculate the Queuing Amount*)
FUNCTION McePosTableRecalcQA
(*
* -----------------------------------------------------------------------------
* Name : McePosTableRecalcQA
* Version : 0.5.0
* Date : 2025-11-12
* Author : deGroot
* Family : YaskawaMce
* Organisation : github.com/YaskawaEurope/mlx-examples
*
* -----------------------------------------------------------------------------
* Recalculate the Queuing Amount
* -----------------------------------------------------------------------------
*)
VAR_INPUT
allowQueuing : BOOL; (*allow queuing the next motions*)
firstMove : BOOL; (*calc first move after system was reset*)
stopAfterLastEntry : BOOL; (*continue to the start of PosTable when searching for the next Index and LoadIndex*)
conditions : ARRAY [0..GVL.CONDITIONS_UBOUND] OF BOOL; (*bits used as start conditions for a PosTable entry*)
loadIndex : INT; (*index for loading next motion(s)*)
END_VAR
VAR_IN_OUT
posTable : McePosTableData; (*trajectory to be processed by PosTable*)
QA : INT; (*allowed Queueing Amount; number of motions to queue (for smooth motion)*)
lastEntry : BOOL; (*last entry in process*)
stopEntry : BOOL; (*entry with robot standstill (ActionID > 0) in process*)
waitBeforeNextEntry : BOOL; (*next valid entry has start conditions*)
index : INT; (*PosTable index for current motion*)
END_VAR
VAR
nPosTableSize : INT; (*number of entries*)
nEntriesRemaining : INT; (*number of entries remaining*)
i : DINT; (*index for FOR loops*)
stConditionResult : McePosTableConditions; (*state if the next motion condition are satisfied*)
nNextIndex : INT; (*next valid entry*)
END_VAR
VAR CONSTANT
QA_MAX : INT := LIMIT(1, GVL.POSTABLE_CMDS_UBOUND, 20); (*max Queueing Amount; max number of motions which can be queued*)
END_VAR
Logic
nPosTableSize := UINT_TO_INT(SIZEOF(posTable) / SIZEOF(posTable.stEntry[0]));
// -----------------------------------------------------------------------------
// calculate remaining entries until standstill
// -----------------------------------------------------------------------------
nEntriesRemaining := McePosTableRemainingEntries( index := index,
loadIndex := loadIndex,
posTableSize := nPosTableSize,
rollOver := NOT stopAfterLastEntry,
conditions := conditions,
posTable := posTable);
// -----------------------------------------------------------------------------
// bitstatus last entry / stop entry
// -----------------------------------------------------------------------------
lastEntry := FALSE;
stopEntry := FALSE;
waitBeforeNextEntry := FALSE;
IF (nEntriesRemaining <= 0) THEN
MEMUtils.MemSet(pbyBuffer := ADR(stConditionResult), byValue := 0, dwSize := SIZEOF(stConditionResult));
nNextIndex := McePosTableFindEntry(index, 1, nPosTableSize, NOT stopAfterLastEntry, posTable);
IF nNextIndex >= 0 THEN
stConditionResult := McePosTableCheckConditions(
index := nNextIndex,
posTableSize := nPosTableSize,
conditions := conditions,
posTable := posTable);
waitBeforeNextEntry := NOT stConditionResult.bConditionsOk;
ELSE
waitBeforeNextEntry := FALSE;
END_IF;
IF (posTable.stEntry[index].nActionID > 0) THEN
stopEntry := TRUE;
// special case: the stopEntry is also the lastEntry
lastEntry := (McePosTableFindEntry(index, 1, nPosTableSize, FALSE, posTable) = - 1 );
ELSIF NOT waitBeforeNextEntry THEN
lastEntry := TRUE;
END_IF;
END_IF;
// -----------------------------------------------------------------------------
// calculate Queueing Amount (allowed number of motions to be queued)
// -----------------------------------------------------------------------------
// scenario 1; reduce QA till zero now
IF NOT allowQueuing THEN
QA := QA - 1;
ELSE
// scenario 2; reduce QA till zero by synchronizing to nEntriesRemaining
IF (nEntriesRemaining < QA_MAX) THEN
QA := nEntriesRemaining;
// scenario 3; use max QA
ELSE
QA := QA_MAX;
END_IF;
END_IF;
IF firstMove OR (QA < 0) THEN
QA := 0;
END_IF;
Implementation
McePosTableRecalcQA(
allowQueuing := ,
firstMove := ,
stopAfterLastEntry := ,
conditions := ,
loadIndex := ,
posTable := ,
QA := ,
lastEntry := ,
stopEntry := ,
waitBeforeNextEntry := ,
index := );