Check the conditions for a given entry.
Version history
0.1.0
 
deGroot
Changes
Added:
- initial version
Overview
kind | name | type | default | comment |
---|---|---|---|---|
input | index | INT | PosTable entry for which the start conditions should be checked | |
input | posTableSize | INT | number of entries | |
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 |
Details
index
INT
PosTable entry for which the start conditions should be checked.
posTableSize
INT
Number of entries of the PosTable.
conditions
ARRAY [0..GVL.CONDITIONS_UBOUND] OF BOOL
Bits 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
TRUE
state - If you need a condition to be checked for the
FALSE
state, you need to invert the connected signal outside of PosTable
posTable
McePosTableData
Trajectory to be processed by PosTable.
Source code
Declarations
(*Check start conditions of a PosTable entry*)
FUNCTION McePosTableCheckConditions : MCEPOSTABLECONDITIONS
(*
* -----------------------------------------------------------------------------
* Name : McePosTableCheckConditions
* Version : 0.1.0
* Date : 2024-03-28
* Author : deGroot
* Family : YaskawaMce
* Organisation : github.com/YaskawaEurope/mlx-examples
*
* -----------------------------------------------------------------------------
* Check start conditions of a PosTable entry
* -----------------------------------------------------------------------------
*)
VAR_INPUT
index : INT; (*PosTable entry for which the start conditions should be checked*)
posTableSize : INT; (*number of entries*)
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*)
END_VAR
VAR
i : DINT; (*index for FOR loops*)
stConditionResult : McePosTableConditions; (*state if the next motion condition are satisfied*)
END_VAR
Logic
MEMUtils.MemSet(pbyBuffer := ADR(stConditionResult), byValue := 0, dwSize := SIZEOF(stConditionResult));
// check if this entry has start conditions
stConditionResult.bHasConditions := FALSE;
stConditionResult.bConditionsOk := TRUE;
IF index >= 0 THEN
FOR i := 0 TO GVL.CONDITIONS_UBOUND DO
stConditionResult.bHasConditions := stConditionResult.bHasConditions OR posTable.stEntry[index].aStartCondition[i];
stConditionResult.bConditionsOk := stConditionResult.bConditionsOk AND (NOT posTable.stEntry[index].aStartCondition[i] OR (posTable.stEntry[index].aStartCondition[i] AND conditions[i]));
stConditionResult.aMissingConditions[i] := posTable.stEntry[index].aStartCondition[i] AND NOT conditions[i];
END_FOR
END_IF;
McePosTableCheckConditions := stConditionResult;
Implementation
Snippet of the function call:
dummy := McePosTableCheckConditions(
index := ,
posTableSize := ,
conditions := ,
posTable := );