ADS Interface

All acyclic data are transferred with ADS Read, ADS Write, ADS ReadWrite or ADS Write Control to a BACnet device, a notification sink, a BACnet server or a BACnet client. Each BACnet device has a dedicate Net ID, which is displayed via the Settings tab and supports the following ports:

Port

Description

0xFFFF

Addresses the BACnet device itself, i.e. data that are not specific for a BACnet server, a notification sink or a BACnet client

1000 - 8192

Addresses a BACnet server, a notification sink or a BACnet client. The first configured BACnet server/client can be reached via port 1000, the second via port 1001 etc. Deleting a BACnet server/client does not lead to shifting of the ports, i.e. the assignment of the ADS port can therefore not necessarily be deduced from the order in the System Manager. The respective port can be viewed via the Settings tab of a BACnet server/client.

ADS-Read

An overview of the IndexGroup/IndexOffset supported by a BACnet device for ADS Read is provided below.

IndexGroup with local addressing of the BACnet device (port 0xFFFF)

IndexGroup (Lo-Word)

IndexGroup (Hi-Word)

IndexOffset

Description

0x0006

0x8000

always 0

Starting a scan for other BACnet devices in the network.

0x0008

0x8000

always 0

Stopping a scan for other BACnet devices in the network. Preparation for reading the results list.

0x0007

0x8000

0 : Number of entries in the results list

(number of clients*2)

2*n: IP address of device n

2*n+1: Device ID of device n

0xffffffff

A scan with the aid of a BACnet device follows the following pattern:

  1. Starting the scan
  2. Waiting for any timeout
  3. Stopping the scan
  4. Reading the scan results list

The scan results are read via this IndexGroup. The number of entries in the results list can be determined via IndexOffset 0. This corresponds to twice the number of BACnet devices found in the network. Even IndexOffsets > 0 address the IP address of a device; odd IndexOffsets address the device ID. Before reading the results list the scan process has to be stopped.

If, for example, 2 devices are found in a network, the query for index 0 comes up with 4. IndexOffset 1 relates to the device ID of device 1, IndexOffset 2 the IP address of device 1, IndexOffset 3 the device ID of device 2 and IndexOffset 4 the IP address of device 2.

Reading the objects present in the server. An array of type BACnetScanResult with the number of found clients is returned:

enum BACnetAddressChoice
{
Ethernet,Arcnet,MsTp,LonTalk,LonTalkNeuronId,
Address_3,Address_4,Address_5,Broadcast
}

struct BACnetAddress
{
BACnetAddressChoice choice;
BYTE layerAddress[7]; // MS/TP...LonTalk
BYTE reserved;
USHORT network_number;
}

struct BACnetScanResult
{
BACnetObjectIdentifier deviceObjIdentifier;
BACnetAddress netAddress;
ULONG IPadress;
WORD UdpPort;
WORD vendorId;
BYTE ethernetMacAddr[6];
}

0x000A

0x8000

always 0

Starting a backup. (triggering the BACnet service Backup Start)

0x001A

0x8000

always 0

Stopping a backup. (triggering the BACnet service Backup End) Between Backup Start and End the generated backup files can be saved with the aid of the Property Configuration Files of device object and the ADS file service.

0x002A

0x8000

always 0

Starting a restore. (triggering the BACnet service Restore Start)

0x003A

0x8000

always 0

Stopping a restore (triggering the BACnet service Restore End)

0x004A

0x8000

always 0

Aborting a restore (triggering the BACnet service Restore Abort).

0x005A

0x8000

always 0

Restarting the TwinCAT computer (triggering the BACnet service Cold Start)

0x006A

0x8000

always 0

Restarting TwinCAT (triggering the BACnet service Warm Start).

0x000C

0x8000

always 0

Reading the supplement key status:

  • 0x0000000 - supplement key is not valid
  • 0x0000001 - supplement key is valid

0x000D

0x8000

always 0

Reading the current Foreign Device Table (FDT) as array of type FDTEntry:

struct FDTEntry
{
ULONG ipAddr;
USHORT udpPort;
USHORT nTtlSecs;
USHORT nPurgeSecs; // seconds until entry is deleted
USHORT reserved; // alignment
}

0x000E

0x8000

always 0

Reading the current Broadcast Distribution Table (BDT) as array of type BDTEntry:

struct BDTEntry
{
ULONG ipAddr;
ULONG mask;
USHORT udpPort;
USHORT reserved; // alignment
}

0x000F

0x8000

always 0

Reading the BACnet diagnosis in the form of BACnetDiagnosis. (see BACnet device tab Diagnostics).

0x001F

0x8000

always 0

Reading the Advanced Parameters in the form of Advanced Parameters

struct AdvancedParameters
{
ULONG ap_MAX_SUBSCRIBE_COV_ENTRIES;
ULONG ap_MAX_PROPERTY_ELEMENTS;
ULONG ap_LIST_ALLOC_MEM_BYTES;
ULONG ap_MAX_DEVICE_BINDINGS;
ULONG ap_HASHTABLE_MAX_OBJECTS;
ULONG ap_HASHTABLE_MAX_CLIENTS;
ULONG ap_MAX_TASK_LIST_ENTRIES;
ULONG ap_MAX_TRENDLOG_ENTRYSIZE;
ULONG ap_DYN_TRENDLOG_BUFFERSIZE;
ULONG ap_MAX_MULTISTATE_DYNSTATES;
ULONG ap_BACNET_MAX_RECV_BAC_SEGM_FRAMES;
ULONG ap_BACNET_MAX_SEND_BAC_SEGM_FRAMES;
ULONG ap_IO_STARTUP_TIMEOUT;
}

IndexGroup for addressing a BACnet server/client (port 1000-8191) - property access

Property specific ADS services can be used with an IndexGroup/IndexOffset with the following scheme:

IndexGroup

IndexOffset

Description

0x80000000 + property ID

Group type (bits 22-30): 0

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Reading the current data of a property.

Example: The property PresentValue of object BinaryInput: 42 can be read via IndexGroup: 0x80000055 and IndexOffset: 0x00C0002A.

0x80400000 + property ID

Group type (bits 22-30): 1

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Reading the BACnet data type of a property. A list of data type coding can be found in the appendix.

0x80800000 + property ID

Group type (bits 22-30): 2

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Reading the data length of the current property value.

0x80C00000 + property ID

Group type (bits 22-30): 3

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Reading the write protection status of a property. The read data are interpreted as follows:

  • 0x00 property value can be written
  • 0x01 property value is read-only

0x81400000 + property ID

Group type (bits 22-30): 5

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Reading the number of elements of list and array types.

IndexGroup for addressing a BACnet server (port 1000-8191)

IndexGroup

IndexOffset

Description

0x82400000

0 number of list entries

> 0 and < 0xffffffff

Reading the objects present in the server. The objects created on a server can also be determined by reading the property ObjectList of the device object.

Index 0: Number of entries
Index n*2: object type for entry n
Index n*2+1: object instance for entry n

0x83400000

always 0

Reading the list of dynamically created objects. For each object the list has a 4-byte entry containing the respective object ID.

IndexGroup for addressing a notification sink (port 1000-8191)

IndexGroup

IndexOffset

Description

0x00000001

always 0

Reading the current number of event notifications in the event notification buffer

0x00000002

always 0

Reading the current number of COV notifications in the COV notification buffer

0x00000003

Number of the event notification

(0 .. number-1)

Reading an event notification. The structure of event notifications can be determined in the online dialog of the notification sink.

0x00000004

Number of the COV notification

(0 .. number-1)

Reading a COV notification. The structure of COV notifications can be determined in the online dialog of the notification sink.

0x00000005

Number of the event notification

(0 .. number-1)

Deleting an event notification

0x00000006

Number of the COV notification

(0 .. number-1)

Deleting a COV notification

0x00000007

Number of the event notification

(0 .. number-1)

Reading the time of receipt of an event notification

0x00000008

Number of the COV notification

(0 .. number-1)

Reading the time of receipt of a COV notification

ADS Write

An overview of the IndexGroup/IndexOffset supported by TwinCAT BACnet/IP for ADS Write is provided below.

IndexGroup with local addressing of the BACnet device (port 0xFFFF)

IndexGroup

IndexOffset

Description

0x8000002D

always 0

Triggering a global broadcast UTC synchronisation. A valid BACnetDateTime time stamp is required.

struct BACnetTime { BYTE hour; BYTE minute; BYTE second; BYTE hundredths; }

structBACnetDate { BYTE year; BYTE month; BYTE day; BYTE dayOfWeek; }

structBACnetDateTime { BACnetDate date; BACnetTime time; }

0x8000000F

always 0

BACnet diagnosis control:

Transferred data size 4:

  • 0x00000000 : deactivate time measurement
  • 0x00000001 : activate time measurement

Data size not equal 4: resetting the BACnet diagnosis

0x8000000E

always 0

Writing the Broadcast Distribution Table (BDT) as array in the form of BDTEntry:

struct BDTEntry
{
ULONG ipAddr;
ULONG mask;
USHORT udpPort;
USHORT reserved; // alignment
}

IndexGroup for addressing a BACnet server/client (port 1000-8191) - property access

Property specific ADS services can be used with an IndexGroup with the following scheme:

IndexGroup

IndexOffset

Description

0x80000000 + property ID

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Writing a property value. Prioritized write access is available via bits 22-30 of the IndexGroup. Priority 1 (top priority in BACnet) can be defined via the value 0x010 in bits 22-30. Priority 16 (the lowest priority in BACnet) can be defined with value 0x100.

0x84000000 + property-ID

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Write access with priority 1.

...

 

 

0xC0000000 + property ID

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Write access with priority 16.

IndexGroup for addressing a BACnet server/client (port 1000-8191)

IndexGroup

IndexOffset

Description

0x80800000

always 0

Creating an object dynamically. The following data must be transferred in the write request, to parameterize the object creation:

  • 4-byte object type
  • 4-byte object ID (the object type of the object ID must match the object type)
  • 4-byte flags (0x00000001 remote object (for client) , 0x00000000 local object (for server))
  • 8-byte 0x00 for an empty list of initial parameters, or a list of initials parameters with data type ReadPropertyMultipleResult

0x81000000

always 0

Deleting a dynamically created object. The following data must be transferred in a write request:

  • 4-byte object type
  • 4-byte object ID (the object type of the object ID must match the object type)
  • 4-byte flags (0x00000001 remote object (for client) , 0x00000000 local object (for server))
  • 8-byte 0x00

0x80C00000

always 0

Triggering saving of the persistent data. Only valid for BACnet servers if Persist Online Data is active.

ADS-ReadWrite

An overview of the IndexGroup/IndexOffset supported by TwinCAT BACnet/IP for ADS ReadWrite is provided below.

IndexGroup for addressing a BACnet server/client (port 1000-8191)

IndexGroup

IndexOffset

Description

0x82C00000

Object ID

  • Bits 0 - 21: object instance
  • Bits 22 - 31: object type

Reading the property list of an object. This service consolidates all properties of an object, like the BACnet service ReadPropertyMultiple. When the ADS ReadWrite command is executed a list with the required properties must be transferred.

Currently only triggering of the complete list is supported. To this end 4 bytes with the value 0x00000008 must be transferred.
A list of type ReadPropertyMultipleResult is returned. The list contains list headers and property IDs, followed by the property data.

0x8B800000

always 0

Query of the object ID with the name of an object. The name of the requested object must be written as ASCII string. The corresponding object ID (4 bytes) is returned. If an object is not found the ADS error NOT_FOUND is returned.

ADS Error Codes

The 32-bit ADS error code always consists of a general ADS error code (low word, see ADS documentation). The appropriate text message will also be displayed in the TwinCAT System Manager Logger.