Block search (C6)

1.1 Block search (Type 1, 3, 4,) PAGEREF _Toc307299957 \h2

1.2 Return to contour after block search 9

1.3 Interface and parameters of block search 11

1.3.1 General parameters 11

1.3.2 Parameters of type 1 : File offset, File name, program path identifier, pass counter for start and end position 14

1.3.3 Parameters of type 3 : Block count 15

1.3.4 Parameters of type 4 : Block number/ Pass count 16

1.4 On / off-Handshake with PLC 17

1.5 Known restrictions 18

1.6 Examples 23

1.7 Exceptions / Errors 24

More:

button Block search (Type 1, 3, 4,)

button Return to contour after block search

button Interface and parameters of block search

button On / off-Handshake with PLC

button Known restrictions

button Examples

button Exceptions / Errors


Block search (Type 1, 3, 4,)

Block search and selection of
start position

In block search mode the user has the possibility to start a program at an intermediate position (restart position). In this case it is necessary to restore the total program context (program parameters, axis positions, ) at that given start position.

The restart position could be a location, where the program has been previously interrupted. After doing some measurement of work piece (moving the axis away) or changing the tool the user wants to continue the program at the previous interrupt position with different parameters (e.g. tool radius). The user than specifies the restart position within the program where he wants to continue and starts the program in block search mode right from the start.

The start position even could lie inside a NC block. Due to this fact for all block search types optionally the already moved distance within this block can be defined, where the real execution shall continue.

Up to the restart position no physical movement of axis is executed within block search (just the NC program is decoded in kind of a simulation mode).

After reaching the start position the axis have to be moved from actual position to the command and also spindles have to reach the last active commanded revolution (back to contour).

The program continues than as it has been started without block search mode.

In order to switch the machine functions correctly, the PLC receives the technology functions during block search in the same way like in normal mode. These functions also has to be acknowledged.

The selection and deselection of the block search mode is synchronized with PLC. In this way a specific handling of some special technology commands is possible, if the PLC supports this (Group handling, activation of special functions before deselection of block search mode).

Block search type 1:

Start position and
end position by
file offset

This block search type provides the enabling of a processing section within the NC program by the definition of a start/end position via file offsets. At the start position the processing is activated and executed until the end position is reached. At the end position the processing is stopped and the NC program is finished at once. If no end position is defined, the processing is executed until NC program end M30.

The file offset defines the start position as the distance to the beginning of the NC program file. The use of the file offset is only possible, if within the NC program no contour influencing functions (e.g. polynomial countouring, HSC) are active. Only under this conditions the file offset really represent the correct start position.

The user is responsible for the correct determination of the file offset, whereas each file offset defines the first position of an NC block line in the corresponding NC program (main program, global sub program).

To determine the position where the NC-program shall be continued/ended in normal execution the file offset and other parameters can be passed during start of block search.

Type: 1

Start position

Parameter: file offset,

file name,

identifier, wether the file is in main (0) or sub program path (1),

pass counter (optional)

covered distance within block (optional)

End position (optional)

Parameter: file offset,

file name,

identifier, wether the file is in main (0) or sub program path (1),

pass counter (optional)

Example

Start in main program at file offset 100 in the first run on the block beginning, finish at file offset 239

Block search type 3: Start position by block count | The block count is a counter, which is incremented for each decoded NC-line from program start. It is also continuously incremented in comment lines, blank lines, loops and during subprogram calls. During normal execution the block count is displayed to PLC or HMI. To determine the position where the NC-program shall be continued in normal execution the block count can be passed as parameter during start of block search. Type: 3 Parameter: block count, covered distance within block (optional)
Example with block count | Start at block count 12

Block search type 4: Start position by block number | The block number is the number of a NC line of the NC program. The user (or NC generating system) is responsible to identify each line, which may be located later on, with an unique block number. Type: 4 Parameter: block number, covered distance within block (optional)
Start position by block number and pass counter | Within loops a block number is passed several times, so the block number is not unique all the time. In this case the processing start can be defined by an additional pass counter (optional). Type: 4 Parameter: block number, pass counter, covered distance within block (optional)

After reaching the restart position in NC program and start (continue) of program execution no automatic prepositioning of machine axes is done with default parameter settings. !!

With active cartesian or kinematic transformation it is not sensefull to have such offsets in machine axes !

Example with
block number

Start at block number 60

Example with
block number and
pass counter

Start at block number 60, in the 5. loop cycle


Return to contour after block search

Move back to the
command positions

Before continue of normal execution the real axis have to move back to the command positions of the NC-program (back to contour). This movement could be made by a user given NC-program or manually before start of block search or can be done automatically in a straight line.

Figure 1-1:Use of different tool radius

As seen in the example above the already moved distance in the actual block has to be given relative to the whole length of the block (in per mille), because the absolute length of the block be different after restart (e.g. circular blocks with different tool radius).

Automatic return
to contour

The automatic generated movement is done with rapid speed (G00).

Example

q User starts normal program at position 1.

q Program is interrupted at position 2 in block N20.

q Axis is moved to position 3 and if necessary tool is exchanged in position 3 (tool radius can change).

q Program context is restored via movement in block search mode to position 4. Physical axis are move from position 3 to position 4 in a straight line.

q Program can be continued with new tool radius in block N20.

Figure 1-2:Use of block search to restore program context

User input

Following input of the user is necessary:

q Restart position (block number and relative distance within block).

Manual return
to contour

If the movement back to contour is generated manually and the axis are not moved back to the exact contour, there could be an offset between the theoretical command position of the NC-program and the real axis position. The user can specify an maximum allowed 3-dimensional offset.

User input

Following input of the user is necessary:

q Restart position (block number and relative distance within block).

q Maximal allowed offset after block search mode between commanded and actual axis position.

With active offset > 0 backward motion is not possible !

For active offset and software limit monitoring the following has to be taken into consideration:

q The offset between command positions and actual axis positions can lead to unexpected software limit or collision detection errors although the actual axis positions are inside valid range an no collision has occured. In the same way, in the other case exceeding of software limits can´t be detected in advance but only online in position controller. With active axis offsets a collision cannot be detected anyway.


Interface and parameters of block search

Validity of block search parameters

Availability on the
HMI-Interface

The parameters of block search (block search mode, specification of restart position) are preselected before the NC program is started. When a program is started the actual settings are taken as program start parameters. Any change after a program has been started has no more effect on the actual running program.

Because the setting of this parameters has to be done just once before program start, it is not time critical. The parameters are available on the HMI-interface, which also could be accessed via PLC by ADS-Read/Write-Requests.

More:

button General parameters

button Parameters of type 1 : File offset, File name, program path identifier, pass counter for start and end position

button Parameters of type 3 : Block count

button Parameters of type 4 : Block number/ Pass count


General parameters

Block search type
Description | Specifies the type of block search mode.
Type | UNS16
Value range | 0  none (default), 1  file offset, 3  block count, 4  block number
HMI elements | mc_cmd_bs_type_r, mc_cmd_bs_type_w
Zugriff | Read, write
IndexOffsetADS | 0x61, 0x49 (IndexGroupADS = 0x000201<ii> with <ii> = channel)

Covered distance
Description | Specifies the actually moved distance in the NC block in per mille, where the real execution shall continue. The start of a block could be moved in block search (without execution) and remaining part could be moved real.
Type | REAL64
Value range | [ 0.0; 1000.0 ], default 0.0
HMI elements | mc_cmd_bs_covered_distance_r, mc_cmd_bs_covered_distance_w
Zugriff | Read, write
IndexOffsetADS | 0x62, 0x4A (IndexGroupADS = 0x000201<ii> with <ii> = channel)

Automatic return
Description | Specifies if return to contour shall be generated automatically.
Type | BOOLEAN
Value range | TRUE, FALSE (default)
HMI elements | mc_cmd_bs_auto_return_r, mc_cmd_bs_auto_return_w
Zugriff | Read, write
IndexOffsetADS | 0x63, 0x4b (IndexGroupADS = 0x000201<ii> with <ii> = channel)

Maximum path deviation

Description

Specifies the maximum deviation between actual axis position and restart position when execution is resumed after block search.

In case of automatic return to contour the maximum deviation is not considered, because the exact position must be reached anyway.

Type

UNS32

Value range

[ 0; MAX_UNS32 ] in 0.1 mikrom, default 0

HMI elements

mc_cmd_bs_deviation_max_r,
mc_cmd_bs_deviation_max_w

Zugriff

Read, write

IndexOffsetADS

0x64, 0x4c

(IndexGroupADS = 0x000201<ii> with <ii> = channel)

Actual covered distance (PCS)
Description | Is used in the PLC for reading the real covered distance of actual movement block (e.g. after feedhold, emergency stop, program abort ...).
Information flow | NCK → PLC
Unit | Per mille
ST path | pMC[channel_idx]^.addr^.StateBahn_Data.D_CoveredDistance
Data type | DINT
Access | PLC reads
Characteristics | During block search instruction the read value can be used for the definition of the covered distance in NC block, where the real execution shall continue.


Parameters of type 1 : File offset, File name, program path identifier, pass counter for start and end position

TwinCAT CNC: Overview

Parameters of type 1 : File offset , File name, program path identifier, pass counter for start and end position

Parameters for start position:

File offset
Description | Defines the file offset, where the real processing should continue.
Type | SGN32
Value range | [ 0; MAX_SGN32 ]
HMI elements | mc_cmd_bs_pos_start_offset_r, mc_cmd_bs_pos_start_offset_w
Access | Read, write
IndexOffsetADS | 0x68, 0x50 (IndexGroupADS = 0x000201<ii> mit <ii> = channel)

File name

Description

Defines the file, in which the given start position is defined by the fileoffset. At this file position the real processing should continue.

Type

STRING

Value range

[ 0; 83]  maximum 84 characters

HMI elements

mc_cmd_bs_pos_start_name_r,
mc_cmd_bs_pos_start_name_w

Access

Read, write

IndexOffsetADS

0x67, 0x4f

(IndexGroupADS = 0x000201<ii> mit <ii> = channel)

The given filename must be identical to the started file (in automatic mode). This also includes any added path in the filename.

I.e. if the path has been explicitly added to the file name during program start command, the same path also must be given in the specified filename for block search.

Program path identifier
Description | This identifiers defines, wether the NC program specified by the file name, is located in the main program path (0) or sub program path (1).
Type | UNS16
Value range | 0  main program path (Default); 1  sub program path
HMI elements | mc_cmd_bs_pos_start_type_r, mc_cmd_bs_pos_start_type_w
Access | Read, write
IndexOffsetADS | 0x66, 0x4e (IndexGroupADS = 0x000201<ii> mit <ii> = channel)

Pass counter
Description | The pass counter defines, how many times the start position shall be passed until the definite start (e.g. in loops).
Type | SGN16
Value range | [ 1; MAX_SGN16 ], Default 1
HMI elements | mc_cmd_bs_pos_start_count_r mc_cmd_bs_pos_start_count_w
Access | Read, write
IndexOffsetADS | 0x69, 0x51 (IndexGroupADS = 0x000201<ii> mit <ii> = channel)

Parameters for end position:

File offset
Description | Defines the file offset, where the real processing should end.
Type | SGN32
Value range | [ 0; MAX_SGN32 ]
HMI elements | mc_cmd_bs_pos_end_offset_r, mc_cmd_bs_pos_end_offset_w
Access | Read, write
IndexOffsetADS | 0x6c, 0x54 (IndexGroupADS = 0x000201<ii> mit <ii> = channel)

File name

Description

Defines the name of the NC program file, in which the specified file offset of the end position has to be searched.

Defines the file, in which the given end position is defined by the fileoffset. At this fileposition the real processing should finish.

Type

STRING

Value range

[ 0; 83]  maximal 84 Zeichen

HMI elements

mc_cmd_bs_pos_end_name_r,
mc_cmd_bs_pos_end_name_w

Access

Read, write

IndexOffsetADS

0x6b, 0x53

(IndexGroupADS = 0x000201<ii> mit <ii> = channel)

The given filename must be identical to the started file (in automatic mode). This also includes any added path in the filename.

I.e. if the path has been explicitly added to the file name during program start command, the same path also must be given in the specified filename for block search.

Program path identifier
Description | This identifiers defines, wether the NC program specified by the file name, is located in the main program path (0) or sub program path (1).
Type | UNS16
Value range | 0  main program path (Default); 1  sub program path
HMI elements | mc_cmd_bs_pos_end_type_r, mc_cmd_bs_pos_end_type_w
Access | Read, write
IndexOffsetADS | 0x6a, 0x52 (IndexGroupADS = 0x000201<ii> mit <ii> = channel)

Pass counter
Description | The pass counter defines, how many times the end position shall be passed until the definite processing end (e.g. in loops).
Type | SGN16
Wertebereich | [ 1; MAX_SGN16 ], Default 1
HMI elements | mc_cmd_bs_pos_end_count_r mc_cmd_bs_pos_end_count_w
Access | Read, write
IndexOffsetADS | 0x6d, 0x55 (IndexGroupADS = 0x000201<ii> mit <ii> = channel)


Parameters of type 3 : Block count

Block count
Description | Specifies the block count where the real execution should continue.
Type | UNS32
Value range | [ 1; MAX_UNS32 ]
HMI elements | mc_cmd_bs_intern_block_count_r, mc_cmd_bs_intern_block_count_w
Access | Read, write
IndexOffsetADS | 0x76, 0x5e (IndexGroupADS = 0x000201<ii> with <ii> = channel)


Parameters of type 4 : Block number/ Pass count

Block number
Description | Specifies the block number where the real execution should continue.
Type | UNS32
Value range | [ 0; MAX_UNS2 ]
HMI elements | mc_cmd_bs_block_number_r, mc_cmd_bs_ block_number_w
Access | Read, write
IndexOffsetADS | 0x77, 0x5f (IndexGroupADS = 0x000201<ii> with <ii> = channel)

Pass count
Description | If the same block number is passed several times (e.g. in a loop), the user can specify the pass count he wants to start with execution.
Type | UNS32
Value range | [ 1; MAX_UNS32 ], default 1
HMI elements | mc_cmd_bs_block_number_pass_r, mc_cmd_bs_block_number_pass_w
Access | Read, write
IndexOffsetADS | 0x78, 0x60 (IndexGroupADS = 0x000201<ii> with <ii> = channel)


On / off-Handshake with PLC

During block search PLC is informed about each technological M-function as in normal execution, but has to simulate the execution of this request respectively. Therefore PLC is informed about each change of block search mode (off / on) and has to acknowledge this change to NC. The NC waits for the acknowledgement of PLC as for synchronized M-functions.

If block search is active during CNC-reset, block search is turned off without handshake with PLC (PLC may be informed about reset specific Control Unit).

Block search on / off

Description

During each turn off/on request of block search the NC does a handshake with the PLC, informing the PLC and waiting for acknowledgement from PLC.

For this purpose, the PLC must indicate, by setting element X_Enable, that it would like to be informed about block search changes.

Data type

LCControlBoolUnit, see Description Control Unit

Access

NCK sets this value to TRUE for asking the PLC for block search on. The PLC acknowledges by setting X_State to TRUE (and vice a versa).

ST path

pMC[channel_idx]^.addr^.LCControlBahn_Data.LCControlBoolUnit_BlockSearch

Commanded Value

ST element

LCControlBoolUnit_BlockSearch.X_Command

Information flow

NCK → PLC

Data type

BOOLEAN

Value range

[TRUE = block search on reset request from NCK to PLC,
FALSE = block search off]

Return value

ST element

LCControlBoolUnit_BlockSearch.X_State

Information flow

PLC → NCK

Data type

BOOLEAN

Value range

[TRUE = PLC has acknowledged block search on, FALSE = block search off]

Request

ST element

LCControlBoolUnit_BlockSearch.X_Enable


Known restrictions

q If program is continued after block search with an offset, because it has not moved back totally to the original contour, this offset is valid till normal program end or reset. If the program is restarted again the positions do not have the offset any more.

q If a NC block for restart contains movement and technological commands, e.g. at N100, than just the remaining movement command is executed in real mode. All technological commands of block N100 are simulated (block search mode).

N90 X90

N100 X100 S1000 M3 M111

N110

If also the technological commands shall be executed the user can specify block N90 with 100 % as covered distance. The following properties must be taken into consideration with automatic return to contour:

q The axes are moving back in rapid mode in a straight line. If any obstacles are between the actual axis position and the position to continue after block search, the motion back to contour has to be generated manually.

q With active soft gantry mode the return movement is done with unlinked master and slaves, this means the axis coupling is activated after the return movement.

q Any axis exchange is only allowed if the axis are requested with implicite reading of position from interpolator (default, not in case of #CALL AX FAST).

Axes, which are moved during active block search and are released (#PUT AX) before switching to normal mode, are not moved to their last known position.

q Only the actual present axes of the channel are moving from their real positions at program start (default channel configuration) back to contour, which are known during block search off.

If during block search any new axis have been requested (#CALL AX) this axis can not be moved back automatically, because all start positions of the actual axis have to be known. Any other exchange of axes between program start and restart after block search is handled correctly.

N00 X10 Y20

N10 #CALL AX [B, 4, 3]

N20 B45 (B-axis movement not considered)

N30 #PUT AX [B]

N30 Z100

N50 #PUT AX [Z] (Z-axis released, can not be restored)

N10 #CALL AX [C, 5, 4] (C-axis not known at program start,
position must be fetched from IPO)

N30 Z100

N30 #PUT AX [X,Y]

N10 #CALL AX [X, 1, 1] [Y, 2, 0] (exchange of X/Y considered)

N100 X100 Y200 (continue normal execution after block search)

M30

In the example above the B-axis is not moved to 45 if automatic straight back to contour is enabled. Also Z-axis is not moved to contour. C-axis is moved correct back to contour.

If program execution was interrupted and continue at interruption point is requested with usage of block search function, the parameters are available directly with the present state data in PLC.

If block search parameter should be determined based on the input NC program, it has to be taken into consideration that contour influencing functionalities like tool radius compensation or polynomial contouring can modify target positions and block limits.


Examples

Type 4 :
Block number and pass count

Block search type = 4, block number = 100

Set pass count to 1 and start program

Program holds at restart position X = 8 Y = 10. After restart remaining part of square is moved.

NC program

%t_sv_number.nc

N00 G00 G90 X0 Y0

P1 = 0

N80 G01 G91 X10 F500

N095 Y10

$FOR P1 = 1, 5, 1

N100 X-2

$ENDFOR

N120 Y-10

N130 M30

Pass count = 0

Pass count = 4

Covered distance

Block search typ = 4, block number = 100, pass count = 1

Set covered distance and start program

After restart remaining part of square is moved.

NC program

N00 G00 G90 X0 Y0

P1 = 0

N80 G01 G91 X10 F500

N095 Y10

N100 X-10

N120 Y-10

N130 M30

1.Without block search, 2. covered distance 0, 3. covered distance 600 4. covered distance 1000

Block count

Block search type = 3, block count = 100

Start program

Program executed up to restart position and NC waits for continue. After restart remaining part of square is moved.

NC program

Block Count

%t_sv_count.nc 1

N00 G00 G90 X0 Y0 2

P1 = 0 3

N80 G01 G91 X10 F500 4

N095 Y10 5

6

$FOR P1 = 1, 5, 1 7, 9, 11, 13, 15

N100 X-2 8, 10, 12, 14, 16

$ENDFOR 17

18

N120 Y-10 19

N130 M30 20

Block count = 8

Block count = 16

Change offsets in block search

Start program with automatic return to contour at N100

Automatic return reaches correct contour, because each movement block contains implicit the actual offsets.

NC program

( Test block search with G92)

%t_sv_g92.nc

N907090 G00 G90 X0 Y0

N80 G01 X10 F500

N85 G92 X10 Y20

N095 Y-10

N100 X-10

N120 Y-20

N907091 M30


Exceptions / Errors

Jump to block with no movement

Start program and restart at block number N100 with 10%

Because N100 has no movement information the block is not split with 10%.

NC program

( Test block search )

%t_sv_p.nc

N907090 G01 X0 Y0 Z0 F1000

N070 Y10

N095 X2.1 Y2.2 Z2.3

N100 P100 = 1

N110 G00 G91 X10

N120 G90 X3.1 Y3.2 Z3.3

N907091 M30

Restart position not found

Set block search type = 4, start program

Set block pass count to high/ to low. Set unknown block number.

If pass count is smaller 2 the first occurrence of block number is taken as restart position.

If pass count is greater than 5 the restart position is not found and an error messages (20704, program end reached without restart mark found) is raised.

If block number for restart is not found also warning is raised and whole program is finished in block search (simulation) mode.

NC program

%t_sv_number.nc

N00 G00 G90 X0 Y0

P1 = 0

N80 G01 G91 X10 F500

N095 Y10

$FOR P1 = 1, 5, 1

N100 X-2

$ENDFOR

N120 Y-10

N130 M30