ADS Access on CNC (C13)

1.1 IntroductionPAGEREF _Toc307388201 \h3

1.1.1 ADS services 4

1.2 Description 5

1.2.1 COM task 5

1.2.2 SDA and GEO tasks 6

1.2.2.1 Classes 6

1.2.2.2 Administration 7

1.2.2.3 Attributes 11

1.2.2.4 Dynamic elements 12

1.2.2.5 Examples 16

1.3 Parameters 16

1.3.1 Overview 16

1.4 Dynamic access on variables 18

1.4.1 P parameters 19

1.4.2 V.A. variables 19

1.4.3 V.E. variables 20

1.4.4 V.G. variables 20

1.4.5 V.L. variables 21

1.4.6 V.P. variables 21

1.4.7 V.S. variables 21

1.4.8 Read / Write access 23

1.4.9 Access to V.E.-array element 23

More:

button Introduction

button Description

button Parameters

button Dynamic access on variables


Introduction

Data of the CNC can be accessed via ADS. To this end, the element is defined via the ADS-NetId address, IndexGroup and IndexOffset.

Platform, channel and axis

Depending on the class, the instance can be global throughout the platform (channel number =0, e.g. position controller) or can be created as a channel-specific instance (channel number > 0).

Moreover, an instance can provide both its own elements and also axis-specific elements.

Axes of the platform

The number of axes that are global throughout the platform and also their logical itemization numbers are defined by the startup description at the time of configuration of the system and do not change during the run time. The ADS addressing information results from the fixed logical axis number and addressing via this address is possible at any time.

Axes of the channel

The axes of a channel are addressed via the index in the channel. Assignment of an axis in the channel can be modified to suit requirements or defined by the channel parameter definitions and axis replacement.

If an index of a channel axis is currently not occupied by an axis, it can be viewed by reading a "blank" data content. In particular, in this case the logical axis number = 0.

Here, the high-level driver (HLD, BF CHANNEL) is a special case. The HLD of the first channel drives all platform-global axes in the interface to the PLC in addition to the channel-specific elements. Therefore, the addresses of the axes are not changed by an axis replacement, but are fixed by the startup description.

IndexGroup = 0x20100 and 0x20200 are used as the base address for ADS access to internal CNC data of the port 0x553 (Task COM).

Individual channels or axes can be queried via different values that are additive to this base address (IndexGroup).

IndexGroup = 0x20300 is defined as the base address for ADS access to internal CNC data of the port 0x552 (task SDA) and 0x551 (task GEO).

Individual attributes of an element can be queried via different values that are additive to this base address (IndexGroup).

More:

button ADS services


ADS services

ADS Read

Data is read out of an ADS unit with ADS Read. The data is addressed by the Index Group and the Index Offset.

In: IndexGroup, 4 bytes, index group of the data to be read.

IndexOffset, 4 bytes, index offset of the data to be read.

Length, 4 bytes, length of the data to be read.

Out: result, 4 bytes, ADS error number

Length, 4 bytes, length of the data returned.

Data, n bytes, data returned

ADS Write

Data is written into an ADS unit with ADS Write. The data is addressed by the Index Group and the Index Offset.

In: IndexGroup, 4 bytes, index group of the data to be read.

IndexOffset, 4 bytes, index offset of the data to be read.

Length, 4 bytes, length of the data in bytes to be written.

Data, n bytes, data to be written

Out: result, 4 bytes, ADS error number

ADS Read & Write

Data is written into an ADS unit with ADS ReadWrite. Data can also be read out of the ADS unit. The data to be read is addressed by the Index Group and the Index Offset.

In: IndexGroup, 4 bytes, index group of the data to be read.

IndexOffset, 4 bytes, index offset of the data to be read.

ReadLength, 4 bytes, length of the data to be read.

WriteLength, 4 bytes, length of the data in bytes to be written.

Data, n bytes, data to be written

Out: result, 4 bytes, ADS error number

Length, 4 bytes, length in bytes of the data returned.

Data, n bytes, data returned


Description

More:

button COM task

button SDA and GEO tasks


COM task

Classes of the instances

Only one instance exists in the COM task, which administers all elements (platform, channels and axes).

Platform data

Axes of the platform

Channel data

Axes of the channel

IndexGroup = 0x20101, IndexOffset = <Element>

IndexGroup = 0x20200 +<axis>, IndexOffset = <element>

IndexGroup = 0x20100 +<channel>, IndexOffset = <element>

0x20100 +<channel>, IndexOffset = 0x1000 * <axis> + <element>


SDA and GEO tasks

More:

button Classes

button Administration

button Attributes

button Dynamic elements

button Examples


Classes

Classes of the instances

The following classes of the CNC instances can currently be addressed with the corresponding IndexGroup:

0x20300: position controller (once per CNC, channel-independent with platform-global axes)

0x21300: interpolator (channel-specific with channel axes)

0x22300: decoder (channel-specific with channel axes)

0x23300: HLD (channel-specific, JLD of the first channel additionally contains axes that are global to the platform)

0x24300: contour preparation (channel-specific)


Administration

Connection setup

Querying the existing instances of a class

To determine which instances of a class exist, you can query the ADS address of the first element (IndexOffset = 0x0) by means of a READ&WRITE access.

The IndexGroup and IndexOffset ADS address is returned. No instance of the class exists if (0, 0) is returned as the address.

If an instance exists, all further existing elements of the instance can be determined by incrementing the IndexOffset.

The individual attributes (name, type, data length, unit, etc.) can be read out once all existing elements of an instance have been found.

 | Programming example
ADS address query | IndexGroup = 0x23900 = 0x20300 + <class = HLD> + <address> 0x20300 + 0x3000 + 0x600 Input : Channel = 1, Axis = 0 Output : IndexGroup = 0x23301, IndexOffset = 0x0

Number of element types of a class

The number of existing element types of an instance can be queried by way of the value content of the first element (IndexOffset = 0).

The name of this element also describes the instance itself.


Attributes

Element types

The following attributes of an element can be queried (values are additive to the IndexGroup):

0x000: data content (depending on data type)

0x100: name as string

0x200: type as string [UNS08;SGN08; ... ;SGN32; REAL32, REAL64]

0x300: length of the data in bytes

0x400: unit as string

0x500: BOOLEAN flag indicating whether write access is allowed

0x600: ADS address: In (channel, axis), Out (IndexGroup, IndexOffset)

 | Programming example
Querying the attributes Element: Feedhold | IndexGroup = 0x20300 + <class = HLD> + <attribute> + <channel = 1> = 0x20300 + 0x3000 + <attribute> + 0x1 = 0x23301 + <attribute> 0x23301, data content 0x23401, name

0x23501, type

0x23601, length

0x23701, unit

0x23801, write access


Dynamic elements

Dymamically generated elements

During decoding of a CNC program variables are created and destroyed dynamically. This variables could also be accessed by ADS. To connect this variables following proceeding could be made:

1. read actual number of parameters n_max

2. for each parameter [ 1;n_max] read parameter name

3. read actual content of parameter

The task SDA provides some managing objects to read this information.

The index of a parameter could change dynamically if parameters are created or destroyed. The parameter name is constant over the live time of each parameter. -> The value could always be read by name.

Example

CNC program

%test_parameter.nc

N1 #VAR

N2 V.L.MY_ARRAY[3][2] = [1, 2,3,4,5,6]

N3 V.P.NEW_VAR1

N4 V.L.NEW_VAR2

N5 #ENDVAR

N10: P223=1.234

$IF EXIST [V.S.NEW_VAR3] == TRUE

N16 V.S.NEW_VAR3 = V.S.NEW_VAR3 + 1

$ELSE

N17 V.S.NEW_VAR3 = 10

$ENDIF

N20 M0

N30 #FLUSH WAIT

Acess in object browser


Examples

Programming example

// Test whether class exists: LR 0x20300, BAHN 0x21300, DEC 0x22300, CHANNEL 0x23300, BAVO 0x24300

for (i = 0; i < 5; i++)

{

CNC_ADDRESS wr;

ADS_ADDRESS rd;

AMS_NetID = ;

port = 0x551; // task GEO

iGroup = 0x20300 + i * 0x1000;

iOffset = 0x0;

// Test whether platform data exists:

wr.Channel = 0;

wr.Axis = 0;

ads_read( wr, rd);

if (rd.iGroup != 0)

{

... Store address and display object

}

else

{

// Test whether channels exist

wr.Channel = 1;

wr.Axis = 0;

ads_read( wr, rd);

while (rd.iGroup != 0)

{

// Internally store ADS address under "wr.Axis" channel

wr.Axis ++ ;

ads_read( wr, rd);

}

}

// Test whether axis exists

wr.Channel = 0;

wr.Axis = 1;

ads_read( wr, rd);

while (rd.iGroup != 0)

{

// Internally store ADS address under "wr.Axis"

wr.Axis ++ ;

ads_read( wr, rd);

}

}


Parameters

More:

button Overview


Overview

Configuration: two channels, three axes


Dynamic access on variables

ADS-objects

Normal ADS-objects are static and unique through their IndexGroup and IndexOffset. However, you can also read dynamic variables / parameters over ADS. Available are:

GEO

- AEP-Parameters

SDA

- P-Parameters

- V.A.-Variables

- V.E.-Variables

- V.G.-Variables

- V.L.-Variables

- V.P.-Variables

- V.S.-Variables

ADS-variables

Because these variables / parameters could be created depending on the NC-program, the access to them must be dynamic. For that reason, you have some static ADS-variables in the NC-kernel available, which offer metadata to the dynamic variables / parameters. Be aware of the fact that these static ADS-variables are the only ones where the IndexGroup and IndexOffset could change. To be sure, you have to search them by name. This name will not change.

The following tables with the IndexGroups / IndexOffsets are a snapshot and must not fit to the actual NC-kernel.

Then maximum length of a variable name was increased from 28 byte to 96 byte. This affects the every V.-Variables and P-Parameters.

More:

button P parameters

button V.A. variables

button V.E. variables

button V.G. variables

button V.L. variables

button V.P. variables

button V.S. variables

button Read / Write access

button Access to V.E.-array element


P parameters

Group Offset Designation Type Length

0x22301 0x2 P parameter number UNS32 4

0x22301 0x1B P-name by index UNS32/STRING 96

0x22301 0x1C P-value by name STRING/REAL64 8

0x22301 0x1D P-value by index UNS32/REAL64 8


V.A. variables

Group Offset Designation Type Length

0x22301 0x31 V.A-max. number UNS32 4

0x22301 0x32 V.A-name by index UNS32/STRING 96

0x22301 0x33 V.A-type by index UNS32/STRING 96

0x22301 0x34 V.A-mode by index UNS32/STRING 96

0x22301 0x37 V.A-read value by name STRING/EXT_VAR_WERT 24

0x22301 0x38 V.A-write value by name S_WRITE_VAR_DATA 120

V.A-type by index - Values:

V_BOOLEAN, V_UNS08, V_SGN08, V_UNS16, V_SGN16, V_UNS32, V_SGN32, V_REAL64, V_STRING, V_UNKNOWN_TYPE

V.A-mode by index - Values:

NO_ACCESS, UNKNOWN_ACCESS, READ_ONLY, WRITE_ONLY, PROT_ONLY, READ_WRITE, READ_WRITE_PROT, READ_PROT, WRITE_PROT

Structure EXT_VAR_WERT:

typedef union _ext_var_wert

{

UNS08 uns08;

SGN08 sgn08;

UNS16 uns16;

SGN16 sgn16;

UNS32 uns32;

SGN32 sgn32;

REAL64 real64;

BOOLEAN boolean;

VAR_STRING string;

} EXT_VAR_WERT;

Structure S_WRITE_VAR_DATA:

typedef struct s_write_var_data

{

ISG_CHAR name[92];

EXT_VAR_WERT value;

}WRITE_VAR_DATA;


V.E. variables

Group Offset Designation Type Length

0x22301 0x27 V.E parameter number UNS32 4

0x22301 0x28 V.E-dim by index UNS32/UNS32 4

0x22301 0x29 V.E-name by index UNS32/STRING 20

0x22301 0x2A V.E-type by index UNS32/STRING 20

0x22301 0x2B V.E-address by index UNS32/UNS32 4

0x22301 0x2C V.E-mem-place... by index UNS32/STRING 20

0x22301 0x2D V.E-Synchron mode UNS32/UNS32 4

0x22301 0x2E V.E-value by index UNS32/EXT_VAR_WERT 24

0x22301 0x2F V.E-array-value by index STRING/EXT_VAR_WERT 24

0x22301 0x30 V.E-Size by index UNS32/UNS32 4


V.G. variables

Group Offset Designation Type Length

0x22301 0x39 V.G-max. number UNS32 4

0x22301 0x3A V.G-name by index UNS32/STRING 96

0x22301 0x3B V.G-type by index UNS32/STRING 96

0x22301 0x3C V.G-mode by index UNS32/STRING 96

0x22301 0x3D V.G-node by index UNS32/STRING 96

0x22301 0x3E V.G-read value by name STRING/EXT_VAR_WERT 24

0x22301 0x3F V.G-write value by name S_WRITE_VAR_DATA 120

V.G-type by index - Values: see V.A.-variables

V.G-mode by index - Values: see V.A.-variables

V.G-node by index - Values:

V_CONTINUE, V_AXIS_INDEX, V_AXIS_NAME, V_CP_NAME, V_USER_DEF, V_USER_DEF_-ARRAY, V_ARRAY_INDEX, V_VALUE, UNKNOWN_NODE

Structure EXT_VAR_WERT: see V.A.-variables

Structure S_WRITE_VAR_DATA: see V.A.-variables


V.L. variables

Group Offset Designation Type Length

0x22301 0x3 V.L parameter number UNS32 4

0x22301 0x1E V.L-name by index UNS32/STRING 96

0x22301 0x1F V.L-value by name STRING/REAL64 8

0x22301 0x20 V.L-value by index UNS32/REAL64 8


V.P. variables

Group Offset Designation Type Length

0x22301 0x4 V.P parameter number UNS32 4

0x22301 0x21 V.P-name by index UNS32/STRING 96

0x22301 0x22 V.P-value by name STRING/REAL64 8

0x22301 0x23 V.P-value by index UNS32/REAL64 8


V.S. variables

Group Offset Designation Type Length

0x22301 0x5 V.S parameter number UNS32 4

0x22301 0x24 V.S-name by index UNS32/STRING 96

0x22301 0x25 V.S-value by name STRING/REAL64 8

0x22301 0x26 V.S-value by index UNS32/REAL64 8


Read / Write access

Access methods
P-/AEP-parameters
V.L/V.P/V.S-variables

In general, there are two different methods to access the variables. The first one concerns the P-parameters, AEP-parameters, V.L.-variables, V.P.-variables and V.S.-variables. This group has four properties: number of available variables, the name read by index, the value read by index and the value read by name. The index starts at 0 and is always without gap, which means you can read the name of all variables over the index from 0 to count-1. Reading the value should always be done by name, because the index of a variable can change, e.g. in the case that a variable is deleted from the middle. This group of variables can only contain numbers, so the data type is always REAL64.

Access methods
V.A/V.G-variables

To the second group belong the V.A.-variables and the V.G.-variables. A specific characteristic of these variables is, that the name consists of two parts - a static part and a dynamic part. The static part is transmitted when the name is read by index. The dynamic part is either an axis name from the concerning channel or an array index, rare but also possible is a combination of both. The axis name must be attached behind the variable name (static part), separated with a dot. In case of an array variable the maximum index is transmitted with the name. On access this maximum index must be replaced by the requested index

Example

Variable completed with axis name

V.A-variable: V.A.+SWE_MDS.X_AX

Static part : V.A.+SWE_MDS

Dynamic part: X_AX

Rare case: Array access+ Variable completed with axis name

V.G.-variable: V.G.NP[5].V.X_AX

Static part: V.G.NP[98].V

Dynamic part: X_AX

Completion with an
axis name

A completion with an axis name must always be done at V.A.-variables. At V.G.-variables the property V.G-node by index declares, whether to add an axis name or not. An ais name is to add when the property has the value V_AXIS_NAME. To detect an array, you can only check the name if there is the character [ or ] in it.

To check the actual number of axis in a channel you can use the following variable:

Group Offset Designation Type Length

0x22301 0x35 Number of axis in channel UNS32 4

The axis name can be determined by this variable:

0x22301 0x36 Name of axis by index UNS32/STRING 96

Identifying the variables type

Further on, the type of a variable is free chooseable. That means, in addition to the read process, like by P-Parameters, you have to check the type, to read a value successfully. Both variables types (V.A. and V.G.) support write access. The property Mode defines the access right (read / write) of the variable. When you write on a variable, you have to use a memory stream according to the S_WRITE_VAR_DATA structure.

V.E.-variables

Another type of variables are the V.E.-variables. According to their handling, these variables are a mixture of V.A.- / V.G.-variables und P-parameters. The V.E.-variables are NC-Program independent, so they can only be read by index. The type can be different from variable to variable, but the type cannot change during runtime (see [EXTV]). The reading must also be managed according to their type (like P-parameters). V.E.-variables can also be an array.


Access to V.E.-array element

The access to a element of a V.E.-array is done with a coded string. The string must have the following form:

Coding of the string

<Iindex V.E.-variable> @ <index array element> @

Basis of the following example:

The variable A[2] should be read in the 1st channel. The variable ist the second V.E. element and the corresponding index is 2. The entry in the array is the 3rd element.

 | Programming example
Access to a V.E.-array element | IndexGroup = 0x22301 Input : 2@2@ ASCII String coded Output : dependent to the type of data (24 byte) datatyp + rest = 24 byte

The index of the V.E.-variables starts with 1, the index of array elements with 0.