Update the PosTable LoadIndex.
Version history
0.5.0
 
deGroot
Changes
Changed:
- rename
NR_OF_INSTANCEStoPOSTABLE_CMDS_UBOUNDfor consistency
show full history
0.4.1
 
Rioual
Changes
Added:
- rename
NR_OF_INSTANCESinINSTANCES_UBOUND(only relevant for Siemens)
0.4.0
 
Rioual
Changes
Added:
conditionsinput
0.3.0
 
Rioual
Changes
Added:
- If the next valid entry has conditions, the current entry is a standstill
0.2.0
 
Rioual
Changes
Changed:
- Replace
posTableModebyallowQueuing - Replace
nQAmaxbyQA_MAXas a constant
0.1.0-beta
 
Rioual
Changes
Added:
- 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 | index | INT | PosTable index for current motion | |
| input | conditions | ARRAY [0..GVL.CONDITIONS_UBOUND] OF BOOL | bits used as start conditions for a PosTable entry | |
| 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 | loadIndex | INT | PosTable index for loading next motion(s) |
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.
index
INTThe PosTable index to update the LoadIndex from.
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
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.
loadIndex
INTIndex of the last pre-loaded motion.
It is calculated as follow:
LoadIndex := Index + QA;
Source code
Declarations
(*Update the PosTable LoadIndex; for sending next motion*)
FUNCTION McePosTableUpdateLoadIndex
(*
* -----------------------------------------------------------------------------
* Name : McePosTableUpdateLoadIndex
* Version : 0.5.0
* Date : 2025-11-12
* Author : deGroot
* Family : YaskawaMce
* Organisation : github.com/YaskawaEurope/mlx-examples
*
* -----------------------------------------------------------------------------
* Update the PosTable LoadIndex; for sending next motion
* -----------------------------------------------------------------------------
*)
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*)
index : INT; (*PosTable index for current motion*)
conditions : ARRAY [0..GVL.CONDITIONS_UBOUND] OF BOOL; (*bits used as start conditions for a PosTable entry*)
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)*)
loadIndex : INT; (*PosTable index for loading next motion(s)*)
END_VAR
VAR
nPosTableSize : INT; (*number of entries*)
nEntriesRemaining : INT; (*number of entries remaining*)
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 loadIndex
// -----------------------------------------------------------------------------
// -------------------------------------
// not using queueing
// -------------------------------------
IF (QA = 0) OR firstMove THEN
loadIndex := index;
// -------------------------------------
// using queueing
// -------------------------------------
ELSE
// update load index to the next valid PosTableEntry
loadIndex := McePosTableFindEntry(loadIndex, 1, nPosTableSize, TRUE, posTable);
// no valid result found
IF (loadIndex < 0) THEN
loadIndex := index;
END_IF;
END_IF;
// -----------------------------------------------------------------------------
// calculating QA in case of firstMove
// -----------------------------------------------------------------------------
IF firstMove AND allowQueuing THEN
// -------------------------------------
// calculate remaining entries until standstill
// -------------------------------------
nEntriesRemaining := McePosTableRemainingEntries( index := index,
loadIndex := loadIndex,
posTableSize := nPosTableSize,
rollOver := NOT stopAfterLastEntry,
conditions := conditions,
posTable := posTable);
// -------------------------------------
// calculate Queueing Amount (allowed number of motions to be queued)
// -------------------------------------
QA := nEntriesRemaining;
IF (nEntriesRemaining > QA_MAX) THEN
QA := QA_MAX;
END_IF;
IF QA < 0 THEN
QA := 0;
END_IF;
END_IF;
Implementation
Snippet of the function call:
McePosTableUpdateLoadIndex(
allowQueuing := ,
firstMove := ,
stopAfterLastEntry := ,
index := ,
conditions := ,
posTable := ,
QA := ,
loadIndex := );