ItpBlocksearch
The function block ItpBlocksearch sets the interpreter to the point defined at the inputs.
If Blocksearch is executed during the first segment that contains a movement, the output sStartPosition of the function block ItpBlocksearch may return wrong values. For this reason, Blocksearch should only be used from the second segment.
The input values can be taken from function block ItpGetBlocksearchData or set manually. Once the interpreter has been set to the defined location with ItpBlocksearch, the motion can continue with ItpStepOnAfterBlocksearch at the position indicated at output sStartPosition.
Inputs
VAR_INPUT
bExecute : BOOL;
nBlockId : UDINT;
eBlockSearchMode : E_ItpBlockSearchMode;
eDryRunMode : E_ItpDryRunMode;
fLength : LREAL;
sPrgName : STRING(255);
nPrgLength : UDINT;
tTimeOut : TIME;
sAxesList : ST_ItpAxes;
sOptions : ST_ItpBlockSearchOptions;
END_VAR
Name | Type | Description |
---|---|---|
bExecute | BOOL | The command is triggered by a rising edge at this input. |
nBlockId | UDINT | Block number or EntryCounter of the segment in the NC program used as starting point. |
eBlockSearchMode | E_ItpBlockSearchMode | Defines whether the specified nBlockId is a block number (e.g. N4711) or continuous EntryCounter. A prerequisite for using the block number is that it is unique. See E_ItpBlockSearchMode. |
eDryRunMode | E_ItpDryRunMode | Defines which program lines are executed and which are skipped. See E_ItpDryRunMode. |
fLength | LREAL | Entry point within the segment selected with nBlockId in percent. |
sPrgName | STRING(255) | Name or path of the program to be executed. |
nPrgLength | UDINT | Indicates the length of string sPrgName. |
tTimeOut | TIME | ADS timeout delay |
sAxesList | ST_ItpAxes | Definition of the axes in the NCI group. See ST_ItpAxes. |
sOptions | ST_ItpBlockSearchOptions | ST_ItpBlockSearchOptions |
/ Inputs/Outputs
VAR_IN_OUT
sNciToPlc : NCTOPLC_NCICHANNEL_REF;
END_VAR
Name | Type | Description |
---|---|---|
sNciToPlc | NCTOPLC_NCICHANNEL_REF | The structure of the cyclic channel interface from the NCI to the PLC. This structure is read-only (type: NCTOPLC_NCICHANNEL_REF). |
Outputs
VAR_OUTPUT
bBusy : BOOL;
bErr : BOOL;
nErrId : UDINT;
bDone : BOOL;
sStartPosition : ST_ItpBlockSearchStartPosition;
END_VAR
Name | Type | Description |
---|---|---|
bBusy | BOOL | Remains TRUE until the function block has executed a command request, but no longer than the time specified at the 'Timeout' input. While Busy = TRUE, no new command will be accepted at the inputs. |
bErr | BOOL | Becomes TRUE if an error occurs during command execution. The command-specific error code is contained in 'nErrId'. Is reset to FALSE by the execution of a command at the inputs. |
nErrId | UDINT | Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs. The error numbers in ErrId can be looked up in the ADS error documentation or in the NC error documentation (error codes above 0x4000). |
bDone | BOOL | The output becomes TRUE when the command was executed successfully. |
sStartPosition | ST_ItpBlockSearchStartPosition | Indicates the start position from which the NC program continues. The individual axes should be moved to this position before ItpStepOnAfterBlocksearch is executed. See ST_ItpBlockSearchStartPosition. |
E_ItpBlockSearchMode
E_ItpBlockSearchMode is used to define in which way the block search is executed.
TYPE E_ItpBlockSearchMode :
(
ItpBlockSearchMode_Disable := 0,
ItpBlockSearchMode_BlockNo := 1,
ItpBlockSearchMode_EntryCounter := 2
);
END_TYPE
ItpBlockSearchMode_Disable: Block search disabled (initial value).
ItpBlockSearchMode_BlockNo: The block search is executed via the block number (e.g. N4711) programmed by the user in the NC program. A prerequisite is that the user-defined block number is unique.
ItpBlockSearchMode_EntryCounter: The block search is executed via a unique EntryCounter. This EntryCounter is implicitly unique, but it is not visible to the user in the NC program.
E_ItpDryRunMode
The enumeration E_ItpDryRunMode
enumerates those ways how the programmed blocks from the beginning of the program up to the place searched for shall be handled.
TYPE E_ItpDryRunMode :
(
ItpDryRunMode_Disable := 0,
ItpDryRunMode_SkipAll := 1,
ItpDryRunMode_SkipMotionOnly := 2,
ItpDryRunMode_SkipDwellAndMotion := 3
);
END_TYPE
ItpDryRunMode_Disable: DryRun disabled (initial value).
ItpDryRunMode_SkipAll: All previous blocks are skipped. R-parameters are written.
ItpDryRunMode_SkipMotionOnly: Only movement blocks are skipped. R-parameters are written, and dwell times and M-functions are executed.
ItpDryRunMode_SkipDwellAndMotion: Movement blocks and dwell times are skipped. R-parameters are written and M-functions are executed.
ST_ItpAxes
The structure ST_ItpAxes contains the axes that were in the NCI group during program execution. The interpolation group should not be built when blocksearch is executed. In order to still have a reference to the group axes, the structure ST_ItpAxes must be filled with the group axes.
TYPE ST_ItpAxes :
STRUCT
nAxisIds : ARRAY[1..8] OF UDINT;
END_STRUCT
END_TYPE
nAxisIds: Array of axes that were in the NCI group. The order is nAxisIds[1]=X, nAxisIds[2]=Y, nAxisIds[3]=Z, nAxisIds[4]=Q1, nAxisIds[5]=Q2… The axis ID can be read from the cyclic axis interface.
St_ItpBlockSearchOptions
The structure contains additional Blocksearch options.
TYPE ST_ItpBlockSearchOptions :
STRUCT
bIsRetrace : BOOL:= FALSE;
bRetraceBackward : BOOL:= FALSE;
bScanStartPos : BOOL:= FALSE;
END_STRUCT
END_TYPE
bIsRetrace: Indicates whether the retrace functionality is active.
bRetraceBackward: Indicates whether backward movement took place on the path.
bScanStartPos: bScanStartPos: Specifies whether or not the current axis positions should be read at the start of the program. In combination with ST_ItpAxesList, please set this input to TRUE. Setting this input to FALSE only makes sense for old projects (compatibility reasons).
ST_ItpBlockSearchStartPosition
The structure indicates the position at which the NC program continues after a block search. The user is responsible for moving the axes to the corresponding positions.
TYPE ST_ItpBlockSearchStartPosition :
STRUCT
sStartPosition : ARRAY[1..8] OF LREAL;
END_STRUCT
END_TYPE
sStartPosition: Array of axis positions at which the NC program continues.
The order is sStartPosition[1]=X, sStartPosition [2]=Y, sStartPosition [3]=Z, sStartPosition [4]=Q1, sStartPosition [5]=Q2…
Voraussetzungen
Entwicklungsumgebung | Zielplattform | Einzubindende SPS Bibliotheken |
---|---|---|
Classic Dialect Interpreter: TwinCAT V3.1.0 GST Interpreter: TwinCAT V3.1.4024.20 | PC oder CX (x86 oder x64) | Tc2_NCI |