Data streaming (incremental NC program) (C19)

1.1 IntroductionPAGEREF _Toc287365725 \h2

1.2 Description: data streaming 2

1.2.1 General 2

1.2.2 Basic characteristics 2

1.2.3 Extended characteristics 2

1.2.3.1 Exceptional situations and error cases 2

1.2.3.2 Emptying the NC channel (#FLUSH CONTINUE) 2

1.2.3.3 Subprogram call 2

1.2.3.4 Loops and branches 2

1.2.3.5 Comments 2

1.2.3.6 Conditional interpretation 2

1.2.3.7 Block search 2

1.2.3.8 Jump to label 2

1.2.3.9 Tool radius compensation, contouring, splines 2

1.2.4 Data streaming versus automatic program commanding 2

1.3 Parameters 2

1.3.1 Overview 2

1.3.2 Description 2

1.4 Examples 2

1.4.1 Test: driver for file in data stream 2

1.5 Error messages 2

More:

button Introduction

button Description: data streaming

button Parameters

button Examples

button Error messages


Introduction

Commanding modes

Data streaming

When commanding NC machining, it is possible to distinguish between different interfaces/functionality.

1. Automatic program: starting a previously created program

2. Manual block: presetting of an NC command, possibly consisting of several blocks

3. Streaming: online presetting of sequential partial commands

4. PLC: commanding via PLC interface in compliance with PLCopen

Many user commands are only defined online, i.e. when the workpiece is already being machined. User actions are commanded to the controllers interactively with the programming environment and the PLC. Among other things, this concerns:

· Creating the geometry

· The user commands such as Forward/Reverse travel

· Interruption of machining with later continuation

Thanks to incremental presetting of the program portions, users can define and influence the process in a highly timely fashion.


Description: data streaming

More:

button General

button Basic characteristics

button Extended characteristics

button Data streaming versus automatic program commanding


General

Data streaming

In the case of incremental presetting of movement commands (streaming), the CAD/CAM system or the PLC presets the next distance to be covered (or even several distances). Thus, travel information can still be modified.


Basic characteristics

Activation

In the channel parameter list you can specify a program name for which changeover to the streaming mode takes place if this program is started.

That is to say that this virtual streaming NC program is started as the main program (automatic mode) or as a global subprogram, and so the data is read automatically out of the streaming interface.

For users, this program then behaves as if it were available as a real file on the hard disk.

Terminating

The streaming mode can be appropriately terminated in a regular fashion by means of a main program end (M2/M30) or a subprogram end (M17/M29).

After a regular streaming program termination, the remaining contents of the interface continue to exist, but data already read with the program end data packet is no longer considered, i.e. is discarded.

That is to say that, after a program end M2/M30/M17/M29 has been written, you should first wait until the streaming interface has been completely read empty.

The area of a program start marked red in the figure above is ignored.

Only then is there a guarantee that the next streaming program will be executed correctly from the very beginning.

 | Example: Activating streaming when invoking the program
Channel parameter list Activating streaming via a global subprogram | # **************************************** # #TC_CHANNEL_DESC_1: SDA-Daten # # **************************************** streaming_prog_file streaming.nc N10 G01 X200 F1000 N20 X240 Y100 N30 X200 Y0 N40 L streaming.nc

Writing,
timing sequence

The data stream can be written via a corresponding interface object, and one data packet can consist of one or several NC blocks.

In the case of several successive read accesses, the individual data packets are sorted according to chronological access and are available to the CNC for reading as a data packet consisting of several blocks.

On extraction, the data packets are no longer extracted singly but, instead, all data available at the time of read access is extracted as one common data packet (program segment).

Each NC block must be terminated with carriage return (ASCII value = 13) and line feed (ASCII value = 10).

Interrupting

If the data stream is not written any further, this leads to temporary interruption of movement. Movement can then be continued by writing the data stream.

Cancelling/reset/deleting

The streaming mode is deactivated in the event of NC reset. The previous contents of the streaming interface are also deleted.


Extended characteristics

More:

button Exceptional situations and error cases

button Emptying the NC channel (#FLUSH CONTINUE)

button Subprogram call

button Loops and branches

button Comments

button Conditional interpretation

button Block search

button Jump to label

button Tool radius compensation, contouring, splines


Exceptional situations and error cases

NC block incorrectly terminated | Each NC block must be terminated with carriage return (ASCII value = 13) and line feed (ASCII value = 10). If this is not the case, machining is cancelled with the error message 21476 "Streaming data does not contain a correct line end marker". (@@P-ERR-21476)
Syntax errors | Miscellaneous syntactical errors in the data stream are reported just like a comparable error in the NC program.


Emptying the NC channel (#FLUSH CONTINUE)

Cross-block considerations

Emptying the NC channel

#FLUSH CONTINUE

Speed

As planning is done over several geometry blocks when considering block transitions and in the case of special NC functionality (e.g. smoothing over the contour, tool radius compensation, etc.) and, to this end, these initially have to be stored and considered jointly, initially the blocks are not executed directly after commanding.

As a result of the #FLUSH CONTINUE instruction, all NC blocks currently stored in the NC channel are executed, i.e. the memory effect of the NC channel is cancelled at short notice. The last travel block programmed before #FLUSH CONTINUE is therefore immediately enabled for output.

If the next travel block is already in the look-ahead table, movement is continued without stopping. If there is still no further travel block, travel is stopped at short notice.

By means of the empty NC channel command, cross-block functions (e.g. active tool radius compensation) can no longer be used during streaming.

Programming example: Streaming instructions over several blocks with #FLUSH

N10 G01 X200 F1000

N20 X240 Y100

N30 X200 Y0

N40 #FLUSH CONTINUE


Subprogram call

L <subprogram>

It is possible to invoke a global subprogram (GSP) out of the incremental program sequence.

· Subprogram (SP) call

· Administration of nesting

· Return to streaming (M17, M29)

· Management of cache elements (streaming, program)

Programming example: Streaming instructions with subprogram call

N10 G01 X200 F1000

N20 X240 Y100

N30 X200 Y0

N40 L subprogram.nc


Loops and branches

Control structures

Control structures with repeated positioning of the file pointer in the past direction (loops) are not allowed. Such loops must be resolved in streaming programs and replaced with linearised NC block sequences. The following control structures result in output of an error message and cancellation of the streaming mode:

· $FOR - $ENDFOR

· $DO - $ENDDO

· $REPEAT - $UNTIL

· $WHILE - $ENDWHILE

By contrast, control structures that only contain sequential program branching in the forward direction can also be used fully across several data packets.

· $SWITCH - $CASE - $DEFAULT  $ENDSWITCH

· $IF - $ELSE - $ELSEIF - $ENDIF

 | Programming example: Jump list in the forward direction
1st data packet 2nd data packet | %switchstream N010 G00 X0 Y0 Z0 N020 P1=10 N030 N040 $SWITCH P1 N050 $CASE 1 N060 X10 N070 $BREAK N080 $CASE 5 N090 X50 N100 $BREAK N110 $CASE 9 N120 X90 N130 $BREAK N140 $CASE 10 N150 X100 N160 $ENDSWITCH : M30


Comments

Comments

Comment lines or blocks in the streaming mode are allowed and can be used fully, also across several data packets.

· ( <Comment text in parentheses>)

· ( <Comment text after open parentheses up to block end>

· ; <Comment text after semicolon up to block end>

· Comment blocks between #COMMENT BEGIN/END

Programming example: Block of comments across several blocks

1st data packet

2nd data packet

%commentstream

N010 G00 X0 Y0 Z0 (Move to start position)

N17 G53 G90 (Absolute dimension

N18 G00 X0

N19 G00 Y0

N20 G00 Z0

N21 G54 G90 ;Zero offsets

#COMMENT BEGIN

#HSC ON [OPMODE 2]

N22 ( ================= )

N23 (PROG NAME : Test.nc)

N24 (DATE : 24.02.2010 )

N25 (HISTORY :...)

N26 ( ================= )

N27 G00 X17.021 Z-90.0

N28 Y1.036

N29 S30000 M03

N30 G01 X17.021 Y6.036 F300

N31 G01 X17.021 Y8.062 F4000

N32 G01 X14.4 Y9.216

#COMMENT END

N33 G01 X14.4 Y9.216 F30000

N34 G01 X14.174 Y9.313

N35 G01 X13.987 Y9.39

N36 G01 X13.845 Y9.442

N37 G01 X13.755 Y9.468

N38 G01 X13.718 Y9.468

N39 G01 X13.718 Y9.468

N40 G01 X13.718 Y9.464 Z-88.029

N41 G01 X13.718 Y9.456 Z-86.51

N42 G01 X13.718 Y9.443 Z-84.787

N43 G01 X13.718 Y9.425 Z-83.063

N44 G01 X13.718 Y9.403 Z-81.339

N45 G01 X13.718 Y9.379 Z-79.615

N46 G01 X13.718 Y9.354 Z-77.892

N47 G01 X13.718 Y9.329 Z-76.168

N48 G01 X13.718 Y9.306 Z-74.444

N49 G01 X13.718 Y9.286 Z-72.721

N50 G01 X13.718 Y9.271 Z-70.997

N51 G01 X13.718 Y9.262 Z-69.273

N52 G01 X13.718 Y9.261 Z-67.549

N53 G01 X13.718 Y9.261 Z-65.825

N54 G01 X13.718 Y9.261 Z-64.102

:

M30


Conditional interpretation

Conditional
interpretation

The NC commands for conditional interpretation also permit sequential program branching (in the forward direction) and can be used fully, also across several data packets.

· #IF - #ELSE - #ENDIF

Programming example: Comment block

1st data packet

2nd data packet

%bedintprstream

N0020 P1=10 F40000

#IF P1 == 20

N0050 G00 X0 Y0 Z0

N0060 G01 X17.021 Y6.036 F300

N0070 G01 X17.021 Y8.062 F4000

N0080 G01 X14.4 Y9.216

N0090 G01 X14.4 Y9.216 F30000

N0100 G01 X14.174 Y9.313

N0110 G01 X13.987 Y9.39

N0120 G01 X13.845 Y9.442

N0130 G01 X13.755 Y9.468

N0140 G01 X13.718 Y9.468

N0150 G01 X13.718 Y9.468

N0160 G01 X13.718 Y9.464 Z-88.029

:

N0210 G01 X13.718 Y9.379 Z-79.615

N0220 G01 X13.718 Y9.354 Z-77.892

N0230 G01 X13.718 Y9.329 Z-76.168

#ELSE

N0260 G01 X13.718 Y9.306 Z-74.444

N0270 G01 X13.718 Y9.286 Z-72.721

N0280 G01 X13.718 Y9.271 Z-70.997

N0290 G01 X13.718 Y9.262 Z-69.273

N0300 G01 X13.718 Y9.261 Z-67.549

N0310 G01 X13.718 Y9.261 Z-65.825

N0320 G01 X13.718 Y9.261 Z-64.102

N0330 G01 X13.718 Y9.261 Z-62.378

N0340 G01 X13.718 Y9.261 Z-60.654

N0350 G01 X13.718 Y9.261 Z-58.93

N0360 G01 X13.718 Y9.261 Z-57.206

N0370 G01 X13.718 Y9.261 Z-55.483

N0380 G01 X13.718 Y9.261 Z-53.759

:

N0560 G01 X13.718 Y9.269 Z-19.283

N0570 G01 X13.718 Y9.283 Z-17.559

N0580 G01 X13.718 Y9.303 Z-15.836

N0590 G01 X13.718 Y9.325 Z-14.112

N0600 G01 X13.718 Y9.429 Z6.57

#ENDIF

:

N0810 M30


Block search

Block search

It is permissible to use the block search in streaming to the continuation position by specifying

· Block number

· Block counter

· File offset

to restore internal states (e.g. coolant on, spindle on, etc.).

Basically, streaming is also possible in combination with the block search @@[FCT-C6]. However, the block search function can also be processed via streaming, i.e. the blocks skipped are simply omitted during streaming.

Establishment of the internal state after the skipped program sequence and returning to the contour must then also be processed in the streaming mode itself.


Jump to label

$GOTO

Using the $GOTO command, it is only possible to jump in the forward direction.

· Jump within data packet

· Jump to subsequent data packet, post-loading

Jumps in the backward direction are not allowed and lead to output of an error message and cancellation of the streaming mode.

 | Programming example: Jump in the forward direction
1st data packet 2nd data packet 3rd data packet | N01 G01 X0 Y0 Z0 F1000 N10 G01 X20 N20 $GOTO N40 N30 G01 Z40 N40: G01 X40 N50 $GOTO N80 N60 G01 Y20 N70 G01 Y40 N80: G01 X-20 N90 G01 X-40 : M30


Tool radius compensation, contouring, splines

Cross-block functionality

Cross-block functions are possible if no implicit/explicit emptying of the channel (#FLUSH) is command when the function is active.

Programming example

%streaming-spline

#SET SPLINETYPE BSPLINE

G151

G134 50

N05 #INFO [TO TRACE_ON]

#INFO [TO PRE_SEG_TRACE_ON S0=\test.txt]

N36335 X-1.5586 Y-16.3853 (M122

N36336 X-1.5666 Y-16.4702 Z2.9971

N36337 X-1.5749 Y-16.5569 Z2.9881

N36338 X-1.5832 Y-16.6448 Z2.9725

N36339 X-1.5917 Y-16.7332 Z2.9501

N36340 X-1.6 Y-16.8214 Z2.9207

N36341 X-1.6083 Y-16.9086 Z2.8841

N36342 X-1.6164 Y-16.9939 Z2.8403

N36343 X-1.6243 Y-17.0764 Z2.7895

N36344 X-1.6318 Y-17.1553 Z2.732

N36345 X-1.6389 Y-17.2298 Z2.6681

N36346 X-1.6455 Y-17.2992 Z2.5983

N36347 X-1.6515 Y-17.3629 Z2.5235

N36348 X-1.657 Y-17.4202 Z2.4442

N36349 X-1.6618 Y-17.4707 Z2.3613

N36350 X-1.6659 Y-17.5143 Z2.2757

N36351 X-1.6694 Y-17.5508 Z2.1881

N36352 X-1.6722 Y-17.5801 Z2.0995

N36353 X-1.6743 Y-17.6023 Z2.0107

N36354 X-1.6758 Y-17.6178 Z1.9224

N36355 X-1.6766 Y-17.6268 Z1.8353

.


Data streaming versus automatic program commanding

Automatic program

In the automatic mode, the user generates the program in advance, and essential processes (geometry) are defined in it. After the NC program has been started, it must/can no longer be modified.

Via querying of variables/parameters, the process can still be influenced at the time of program decoding by the user interface or the PLC (conditional branches).

At the time of program execution, the axes are moved in accordance with the programmed geometry and information is sent to the PLC or execution is synchronised with the PLC.

Via specific NC functions, the PLC can still influence the process online:

· Speed: feed hold, override, reduced speed (safety)

· Interrupting/continuing, cancelling, reversing

Function/action | Automatic program | Data streaming
Starting/initialising the NCX status data | Each time the program is started, the channel's default settings are restored, i.e. programs do not influence each other globally (exception: holding parameter, etc.). | Only at the start of streaming, i.e. status data of the NC remains valid throughout the duration of streaming
Response to errors | NC reset with reset of the NC status data | NC reset with reset of the NC status data An NC reset without reset of the NC is currently not possible.
Data throughput | Implicitly given by access to the file system | Given by filling the data stream "in good time", i.e. axis movement can be interrupted by delaying filling.
Speed planning, look-ahead (HSC) | Cross-block speed planning is fully possible | Planning limited, possibly only possible for the specified blocks
Process changes | Not longer possible after program starting if branches (e.g. via external variables) are not already considered in the program. | Program parts not yet specified can still be modified.
Jumps/loops | Jumps to program flags possible, any higher-level language constructs with loops possible | No returning possible, no loop programming possible
Fast forward | Via block search (jump to block number, block counter, file position) -> system state at forward position is established automatically | By programming system with corresponding omission of forward areas -> system state at forward position must be established manually.
Reversing | NC functionality, currently possible by PLC command | Via NC functionality or by presetting an inverted data stream
Automatic geometry changes at the block transitions (phases, radii, blending, splines, etc.) | Possible via standard NC functions | By CAD/CAM system, no consideration of several distance segments in the NC because execution is always enabled directly. Without implicit #FLUSH, also possible by NC
Tool radius compensation | Standard NC function | To be executed by CAD/CAM system Without implicit #FLUSH, also possible by NC


Parameters

More:

button Overview

button Description


Overview

Constant | Description
MAX_PROGRAM_STREAM_SIZE | 4094: maximum size of the data stream in bytes
MAX_PROGRAM_STREAM_INPUT_SIZE | 992: maximum size of a data packet in bytes that is transferred with each write access operation.

ID | Parameters | Description
P-CHAN-00158 | streaming_prog_file | Name of the file (main program/global subprogram) that automatically triggers a changeover to the streaming mode when it is started.
COM interface | mc_program_stream_w | ADS-COM object by means of which the data stream can be described.


Description

P-CHAN-00158 | Program name for automatic activation of streaming
Parameters | streaming_prog_file
Description | When this program is opened as a main program or a subprogram, the ASCII data is not read in from the file system, but is requested from the data streaming interface. The data input is therefore diverted transparently to the streaming interface. The streaming functionality cannot be activated if this program name is not assigned.
Data type | String
Data range | <blank_string> ≤ P-CHAN-00158 ≤ string length depends on application String(83) (s. Konstante LAENGE_NAME)
Dimension | Translatory: | Rotatory:
Default | <Blank_string>: streaming functionality off
Remarks | -

Data stream for incremental program commanding

Description

By means of this COM interface object, the data stream can be written with incremental NC commands.

One complete NC block must always be written. Several NC blocks may also be written jointly in one write operation.

Each NC block must be terminated with carriage return (ASCII value = 13) and line feed (ASCII value = 10).

Type

String; the string length depends on the application
STRING(992), siehe MAX_PROGRAM_STREAM_INPUT_SIZE

Value range

ASCII characters

HMI elements

mc_program_stream_w

Access

Read, write

IndexOffsetADS

0x90

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


Examples

More:

button Test: driver for file in data stream


Test: driver for file in data stream

C example

#define ISGPORT_COMTASK 553

#define IDS_OFFSET_COM_DATA_STREAM 0x90

idx_group = 0x20100 + channel_nr;

idx_offset = IDS_OFFSET_COM_DATA_STREAM;

BOOLEAN write_line_to_stream( char * p_source, unsigned length)

{

int result;

result = AdsSyncWriteReq( p_amsAddr,

idx_group,

idx_offset,

length,

p_source);

if (0 != result)

return FALSE;

return TRUE;

}

while (NULL != fgets( inLine, MAX_LINE_LEN, pInFile))

{

unsigned long length = strlen( inLine);

// Attention : ensure line closed with "carriage return" & "line feed" !

if (inLine[length-1] == '\n')

{

inLine[length-1] = '\r';

inLine[length++] = '\n';

}

f_ret = write_line_to_stream( inLine, length);

while (FALSE == f_ret)

{

Sleep(500);

f_ret = write_line_to_stream( inLine, length);

printf(".");

}

inLine[length] = 0; // just for correct print

printf("%d/%d) %s", length, c_written_sum, inLine);

c_written_sum += length;

}


Error messages

Data transfer via COM object

The data are transfered via the COM object "mc_program_stream_w" to the CNC. If not enough memory is available to store the stream in the control, the message 11012  "Failure to write object." (warning) is issued. At the same time also the writing of the object via ADS is acknowleged negative.

In one of the next cycles the object has to be written again.

Using the streaming interface this message is recured again and again, if a lot of data are written in short time intervals.

For correctly realized clients the message is uncritical and therefore classified as warning.