Contour visualization (C17)

1.1 OverviewPAGEREF _Toc307300456 \h3

1.1.1 Different operation modes of contour visualization 3

1.2 Dry Run 4

1.2.1 Introduction 4

1.3 Online contour visualization 5

1.3.1 Introduction 5

1.4 Rapid contour visualization 6

1.4.1 Introduction 6

1.4.2 Description 8

1.4.3 Parameters 9

1.4.3.1 Overview 9

1.4.3.2 Channel parameter: Display format during machining simulation (P-CHAN-00121) 9

1.4.3.3 Channel parameter: Ignore internal Stop conditions during rapid contour visualization (P-CHAN-00183) 9

1.4.3.4 Startup parameter: channel specific / global reporting of display data (P_STUP_00040) 9

1.4.4 Interfaces 10

1.4.4.1 Selection via HMI 10

1.4.4.2 Commands and display via PLC 11

1.4.4.3 Output format description 12

1.4.5 Application examples 14

1.4.5.1 ADS access via AmsAdsDebugger 14

1.4.5.2 ADS access via Object Browser 15

1.4.5.3 ADS access via Win32 application 17

1.4.5.4 Display of axis positions in DXF format 20

1.5 Scene contour visualization 21

1.5.1 Introduction 21

More:

button Overview

button Dry Run

button Online contour visualization

button Rapid contour visualization

button Scene contour visualization


Overview

Contour visualization

For the visualization of movements the positions can be recorded and visualized via different interfaces.

Normally the axis position are reported in the display data. For the visualization of the contour the cyclic sampling of the positions is not sufficient. Real corners of the contour also in the visualization should be recognizable as corners. Even if the visualization is running much faster than the normal execution and only a low amount of sample points are reported the corners shall be displayed correct.

More:

button Different operation modes of contour visualization


Different operation modes of contour visualization

rapid contour visualization without real axis movement

If the control is working in simulation mode the execution of the CNC-program is done rapidly. The contour is sampled and the coarse points are reported for visualization. The actual corners are also reported.

The amount of sample points is decreased considerably.

The real axis are not moved.

Online contour
visualization

The control is working in standard execution mode, where the normal program execution is not influenced.

Additionally axis position are reported via the interface to the contour visualization, if it is required.

Scene

The kinematic chain is defined in the CNC program. At any coordinate system of the kinematic chain (LINKPOINT) one of many graphical objects can be placed. The movements of the coordinate systems are reported through an interface. The movements of the graphical objects can be visualized by kernelCAM and also the movement track of the objects can be recorded.

Functionality scene is not available under TwinCAT.

Execution mode | Data reduction before interpolation | Data reduction after interpolation | Coordinate system | Particularity | Viewer
Dry run | - none - | - none - | PCS | Without real axis movement, normal program execution |
Rapid contour visualization | Geometric grid, abs./rel. secant error | Geometric grid, abs./rel. secant error | PCS / ACS by channel parameter | Without real axis movement, rapid program execution | kernelCAM in preparation
Online contour visualization | - none - | Geometric grid, abs./rel. secant error | PCS / ACS by channel parameter |  | kernelCAM in preparation
Scene | - none - | Time sampling in frames per second | W0 Each coordinate sytem of the kinematic chain, also TCP | For any serial kinematic available. Kinematic chain must be defined in the NC-Program | kernelCAM as virtual CAM (vCAM)

Coordinate systems | The interfaces provide movements in different coordinate systems. Following definition of coordinate systems is used:
ACS | Axis coordinate system
W0 | Base workpiece coordinate system, kartesian base coordinate system of machine, corresponding to work piece clamp position
PCS | Programming coordinate system


Dry Run

More:

button Introduction


Introduction

0x40 MACHINE_LOCK | In the mode "dry run " the NC program is decoded and interpolated in normal way. Just the axis movement is not passed to the position controller. So the axis are not moved by the CNC.


Online contour visualization

More:

button Introduction


Introduction

Data reduction

Grid pattern

In the mode "online contour visualization" a real decoding of the NC program is executed. To ensure a high-performance data transmitting, the output values are filtered.

Dependent on the used motion block (linear/curved) the grid for the interpolation points can be parameterized by specifying a maximum grid point distance or by giving a maximum path error.


Rapid contour visualization

More:

button Introduction

button Description

button Parameters

button Interfaces

button Application examples


Introduction

Simulation

In some cases for testing or simulation a CNC program the program shall be executed without any real axes movements.

Rapid execution

IIn the simulation mode contour visualization the program is executed in a rapid mode, because the sample points are given in a coarse grid for interpolation.

Programmed dwell times (G04, #TIME) are also ignored.

Stop conditions

The execution of an CNC program can be stopped by internal and external influences.

Internal stop conditions are NC commands that are only finished after an user interaction, for example a programmmed stop (M00). With channel parameter P-CHAN-00183 stopping program execution by internal stop conditions can be avoided.

At external stop conditions the user itself causes a stop in CNC program excution, for example by setting a feedhold command via the PLC interface or by not acknowledging an technology function.

External stop conditions are still effective and have to be handled by the user in such a way, the the CNC program execution is not stopped.

.

Sample grid

The grid for the sample points can be parameterized by specifying a maximum sample point distance or by giving a maximum path error for secants.

The destination point of error NC block is reported in any case.

Usage

The simulated contour visualization can be used for following applications:

· Syntax check with usage of the whole CNC channel. As difference to the execution mode = syntax check during the contour visualization all modules of the CNC channel are active. Just the position controller commands no axis movements. Therefore additional error can be detected as wrong tool radius compensation values of moving above software limit switches.

· Visualization of the CNC program.

After any error in simulation the user can not continue as in syntax check mode [FCT-C9].

After any error the user has to execute a channel reset. The program can be restarted afterwards.


Description

Operation

Before program start the execution mode has to be set to simulation. This can be done through the HMI or the PLC interface.

Additionally the maximum sample point distance and the secant error can be specified.

Display

Corresponding to the given sample grid the movements blocks are segmented and the axis positions are reported.

Sample point grid for linear blocks

For linear blocks the sample point distance for interpolation can be given directly. Therefore the axis dynamics and the commanded velocity are not considered.

If the linear block is smaller than the given grid also the end point of the block is reported. By this the corners of the contour are always shown.
If the whole block is shorter than the grid distance, the endpoint is not reported. This is important if the whole NC program exists e.g. of short HSC blocks.

Sample point grid for curved contour
elements

For curved blocks (circles, polynomials) an absolute secant error and a relative secant error can be specified.


Parameters

More:

button Overview

button Channel parameter: Display format during machining simulation (P-CHAN-00121)

button Channel parameter: Ignore internal Stop conditions during rapid contour visualization (P-CHAN-00183)

button Startup parameter: channel specific / global reporting of display data (P_STUP_00040)


Overview

Constant | Description
MAX_SOLLKONT_VISU_DATA_COUNT | 16, maximum number of position samples per message
ANZ_SIMU_KOORD | 32, maximum number of axis positions per sample


Channel parameter: Display format during machining simulation (P-CHAN-00121)

By the parameter "simu_output_wcs" at the interface of the machining simulation the format of the display data concerning the coordinate system can be switched.

Variable name | Type | Permissible range | Dimension
simu_output_wcs | BOOLEAN | 0/1 | ----

0 | Display of the axes coordinates including all offsets (machine coordinates)
1 | Display of absolute coordinates without any offsets (programmed coordinates)


Channel parameter: Ignore internal Stop conditions during rapid contour visualization (P-CHAN-00183)

By the parameter "simu_ignore_internal_stop_cond" the stopping of the NC program because of internal stop conditions (e. g. M00) during rapid contour visualization can be suppressed.

Variable name | Type | Permissible range | Dimension
simu_ignore_internal_stop_cond | BOOLEAN | 0/1 | ----

0 | Internal stop conditions are effective
1 | Internal stop conditions are ignored.


Startup parameter: channel specific / global reporting of display data (P_STUP_00040)

The parameter "single_protocol_fifo defines if the data is reported channel specific output-FIFO or for all channels together in one platform FIFO.

Variable name | Type | Permissible range | Dimension
single_protocol_fifo | BOOLEAN | 0/1 | ----

0 | Channel specific output of visualization data
1 | Common output of visualization data in one global FIFO


Interfaces

More:

button Selection via HMI

button Commands and display via PLC

button Output format description


Selection via HMI

HMI interface

The contour visualization can be set before program start by the HMI.

This command is passed through the control unit to the PLC, which could deny or admit this command. Additionally the PLC itself could select the contour visualization.

ADS access

The visualization can be parameterized and the data can be read via ADS.

The ADS-access has to be done via task COM, which is port 0x553. The access of the single parameters is defined by the individual indexgroup / indexoffset identifiers.

Within the indexgroup <c> defines the individual channel number, where <c> is within [ 1; maximum number of channels].

Parameter | Format | Description | ADS-Index-Group | ADS-Index-Offset
mc_command_execution_mode_r, mc_command_execution_mode_w | UNS32 | Select of contour visualization mode 0x0000 ISG_STANDARD Normalbetrieb 0x0002 SOLLKON Sollkonturvisualisierung 0x0004 ON_LINE Online visu 0x0008 SYNCHK Syntaxcheck | 0x2010<c> c Element [1; max. channel] | 0x40, 0x3f
mc_contour_visu_grid_w mc_contour_visu_grid_r | UNS32 | Output grid for straight lines (G00/G01) in [0.1 µm] | 0x2010<c> c Element [1; max. channel] | 0x89, 0x8a
mc_contour_rel_curv_error_w | REAL64 | Maximum relative curvature error for curved contour elements (circles and polynomials) in [0.1%] | 0x2010<c> c Element [1; max. channel] | 0x8b
mc_contour_abs_curv_error_w | REAL64 | Maximum absolute curvature error for curved contour elements (circles and polynomials) in [0.1 µm] | 0x2010<c> c Element [1; max. channel] | 0x8c

For curved contour elements the parameter which leads to the smallest output grid for that contour element is used.


Commands and display via PLC

Channel mode
Description | Selection of channel specific execution mode, e.g. contour visualization, syntaxcheck [FCT-C9] or production time calculation
Data type | MCControlSGN32Unit, see description of Control Unit
Access | PLC reads Request + State and writes Command + Enable
ST-Path | pMC[channel_idx]^.addr^.MCControlDecoder_Data.MCControlSGN32Unit_ExecutionMode
Command, requested and return value
ST element | .D_Command .D_Request . D_State
Data type | DINT
Value range | 0x0000 ISG_STANDARD Normal execution 0x0002 SOLLKON Simulation contour visualization 0x0008 SYNCHK Simulation syntax check Remark: Following settings are in preparation: 0x0004 ON_LINE Simulation online visualization 0x0010 PROD_TIME Simulation production time calculation 0x0020 ONLINE_PROD_TIME Simulation online production time calculation 0x0040 MACHINE_LOCK Dry run without axis movement 0x0100 KIN_TRAFO_OFF enabling for kinematic transformations by a characteristic parameter defined in SDA_MDS (sda_mds*.lis).
Redirection
ST element | . X_Enable


Output format description

The visualization data can be access via following ADS objects.

Index-group | Index- offset | Data type | Description
0x2010<c> | 0x2000 | SOLLKONT_VISU_DATA | Data of channel specific queue
0x2010<c> | 0x2001 | UNS32 | Number of available blocks in channel specific queue
0x2010<c> | 0x2002 | SOLLKONT_VISU_DATA | Data in global queue (all channel data collected)
0x2010<c> | 0x2003 | UNS32 | Number of available blocks in global queue

The data unit, which can be read, has following format:

 | SOLLVISU_PDU
SGN32 | count, number of samples SOLLKONT_VISU_DATA_CH in the actual message
SGN32 | <alignment bytes>
SOLLKONT_VISU_DATA_CH | ch[ MAX_SOLLKONT_VISU_DATA_COUNT ]

 | SOLLKONT_VISU_DATA_CH
SGN32 | nc_satz_nr, number of actual block
SGN32 | File offset, position from begin of file in bytes >= 0 : valid offset after start of program == -1 : no program active or program finished
UNS16 | channel_nr
SGN16 | g_function >= 0 : G-function : G0, G1, G2, G3, G61 for polynomial blocks == -1 : no G-function active
UNS32 | circle_radius, radius in [0.1 µm] for G2 / G3-blocks
REAL64[2] | circle_center_point[2], absolute position of the circle center point in the active main plane (G17, G18, G19) in [0.1 µm] for G2 / G3 blocks (from CNC version V2.10.1032.03 or V2.10.1505.05 onwards).
SOLLKONT_VISU_ACHS_DATA | simu_achs_data[ANZ_SIMU_KOORD]

 | SOLLKONT_VISU_ACHS_DATA
SGN32 | akt_sollwert, actual command position of axis in [0.1 µm]
UNS16 | log_achs_nr, logical axis number
UNS16 | <alignment bytes>

With the file offset can be recognized if a program is in process and / or terminated.

An invalid G function (-1)is released e.g. by a NC line with an M function.


Application examples

More:

button ADS access via AmsAdsDebugger

button ADS access via Object Browser

button ADS access via Win32 application

button Display of axis positions in DXF format


ADS access via AmsAdsDebugger

By usage of the AmsAdsViewer you could directly test to access the
individual parameters of the contour visualization.


ADS access via Object Browser

The contour visualization is selected by the operation as processing mode before program start. This adjustment is transported to the PLC via a so-called "Control unit". This control unit can be admitted or rejected by PLC. Hereby the PLC also has the possibility to set the processing mode on contour visualization without a previous HMI request.


ADS access via Win32 application

Programming example

static BOOLEAN writeContourParameters(

UNS16 channel_nr, UNS32 grid, REAL64 abs_error, REAL64 rel_error)

{

SGN32 result;

SGN32 idx_group = 0x20100 + channel_nr;

if ((channel_nr < 1) || (channel_nr > SYS_KANAL_MAX))

return FALSE;

result = AdsSyncWriteReq( &amsCom, // Ams address of ADS server

idx_group, // index group:

0x89, // index offset:

sizeof(grid), // count of bytes to read

&grid); // pointer to the client buffer

if (0 != result)

return FALSE;

result = AdsSyncWriteReq( &amsCom, // Ams address of ADS server

idx_group, // index group:

0x8c, // index offset:

sizeof(abs_error),// count of bytes to read

&abs_error); // pointer to the client buffer

if (0 != result)

return FALSE;

result = AdsSyncWriteReq( &amsCom, // Ams address of ADS server

idx_group, // index group:

0x8B, // index offset:

sizeof(rel_error),// count of bytes to read

&rel_error); // pointer to the client buffer

if (0 != result)

return FALSE;

return TRUE;

}

static BOOLEAN activateContourVisu( UNS16 channel_nr)

{

SGN32 result;

SGN32 idx_group = 0x20100 + channel_nr;

UNS32 execution_mode = SOLLKON;

if ((channel_nr < 1) || (channel_nr > SYS_KANAL_MAX))

return FALSE;

result = AdsSyncWriteReq( &amsCom, // Ams address of ADS server

idx_group, // index group:

0x3f, // index offset:

sizeof(execution_mode),

&execution_mode);

if (0 != result)

return FALSE;

return TRUE;

}

static BOOLEAN readContourData (

SOLLKONT_VISU_PDU *p_visu_pdu, UNS16 channel_nr)

{

SGN32 result;

UNS32 count;

UNS32 fifo_count;

SGN32 idx_group = 0x20100 + channel_nr;

if ((channel_nr < 1) || (channel_nr > SYS_KANAL_MAX))

return FALSE;

result = AdsSyncReadReqEx( &amsCom, // Ams address of ADS server

idx_group, // index group:

0x2001, // index offset:

sizeof(fifo_count),

&fifo_count,

&count);

if (0 != fifo_count)

{

// read via COM

result = AdsSyncReadReqEx( &amsCom, // Ams address of ADS server

idx_group, // index group:

0x2000, // index offset:

sizeof(*p_visu_pdu),

p_visu_pdu,

&count)

if (0 == result)

return TRUE;

}

return FALSE;

}


Display of axis positions in DXF format

Programming example

%contour_visu

N001 G01 G90 X0 Y0 Z0 F1000

N100 X100

N200 Y100

N300 X0

N400 Y0

N500 X50 Y50 Z200

N500 X100 Y100 Z0

N600 X0

N700 X50 Y50 Z200

N800 X100 Y0 Z0

N900 G02 I100

N1000 #CS ON[0,0,100, 45 ,0,0]

N1001 G01 G90 X0 Y0 Z0 F1000

N1100 X100

N1200 Y100

N1300 X0

N1400 Y0

N1500 X50 Y50 Z200

N1500 X100 Y100 Z0

N1600 X0

N1700 X50 Y50 Z200

N1800 X100 Y0 Z0

N1900 G02 I100

N1500 #CS OFF

N2000 #CS ON[0,100,-100, 0, 45,0]

N2001 G01 G90 X0 Y0 Z0 F1000

N2100 X100

N2200 Y100

N2300 X0

N2400 Y0

N2500 X50 Y50 Z200

N2500 X100 Y100 Z0

N2600 X0

N2700 X50 Y50 Z200

N2800 X100 Y0 Z0

N2900 G02 I100

N2500 #CS OFF

M30

Generated DXF output

The read axes positions can by used to generate a contour visualization in DXF format.

0

SECTION

2

HEADER

999

isg.dxf created by TwinCAT CNC

0

ENDSEC

0

SECTION

2

TABLES

0

ENDSEC

0

SECTION

2

BLOCKS

0

ENDSEC

0

SECTION

2

ENTITIES

0

LINE

8

0

62

2

10

0.000000

20

0.000000

30

0.000000

11

10.000000

21

0.000000

31

0.000000

0

...

Display of DXF by general viewer


Scene contour visualization

More:

button Introduction


Introduction

Data reduction

Protocol

In the scene mode the CNC-program is executed in real manner, i.e. the axis are moved. The output rate of the reported positions can be specified in frames per second.

In the scene display each movement of a coordinate system is logged. So any movement and the track of a graphical object linked to one coordinate system can be visualized.