打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
The TwinCAT ADS interface to the EAP device
The TwinCAT EAP device provides a TwinCAT ADS/AMS interface for other communication partners (e.g. virtual field devices or Windows programs) and acts as an ADS/AMS server. ADS stands for Automation Device Specification. It describes a device- and fieldbus-independent interface. AMS stands for Automation MessageSpecification and enables central and decentral systems to be addressed, such as PCs or bus controllers. ADS/AMS was specified by Beckhoff and is supported by the TwinCAT router. Messages that are sent in a network beyond the computer boundaries are transferred via TCP/IP.
The CANopen communication channel SDO (Service Data Object) can also be used via this interface. The primary purpose of the SDOs is to read and write the parameters of the CANopen Object Dictionary (OD). The transmission of the SDOs takes place as a confirmed data transfer in the form of a point-to-point connection between two communication partners and is embedded in ADS:
Using the ADS Read or ADS Write commands on the port 0xFFFF and the NetID of the EAP device ("Protocol" tab), the parameters, or the SDO description of the CANopen OD respectively, are read or written. As listed in the table, the communication channel CANopen SDO is embedded in the ADS protocol as follows:
CANopen SDO
communication
ADS Command
Index group
Index offset
Meaning
SDO Upload
Read
0xF302
Index and subindex of an SDO.
Bit 16-31: Index
Bit 8: Complete Access
Bit 0-7: Subindex
Sample:
0x16010001:
Index = 0x1601
Complete Access = 0
Subindex = 1
The subindex has no meaning if Complete Access = 1
Data Type: UINT8[n]
SDO Upload Request:
The object is addressed on the basis of the Index Offset and its contents can be read with the help of an ADS Read.
SDO Download
Write
0xF302
Index and subindex of an SDO.
Bit 16-31: Index
Bit 8: Complete Access
Bit 0-7: Subindex
Sample:
0x16010001:
Index = 0x1601
Complete Access = 0
Subindex = 1
The subindex has no meaning if Complete Access = 1
Data Type: UINT8[n]
SDO Download Request:
The object is addressed on the basis of the Index Offset and its contents can be written with the help of an ADS Write.
SDO Information
Get Object List
Read
0xF3FC
Bit 16-31: List types
Samples:
0x00000000: Returns the number of all objects existing for each list type
0x00010000: Returns the indices of all objects for the specified list type
Returns the indices of the objects that belong to the list type specified in the Index Offset.
Possible list types are:
ALL_OBJECTS = 1
RXPD_OBJECTS = 2
TXPD_OBJECTS = 3
BACKUP_OBJECTS = 4
SETTING_OBJECTS = 5
Data Type: UINT16[6]
If list type = 0000:
Element = 0 : number of list types
Element > 0 : number of existing objects belonging to the nth list type
Data Type: UINT16[n]
If list type > 0000:
Element n=0 : number of existing objects belonging to this list type plus one.
Element n>0: the nth object index belonging to this list type
SDO Information
Get Object Description
Read
0xF3FD
Bit 16-31: Index
Read the SDO description of the complete object with the specified index.
SDO Information
Get Entry Description
Read
0xF3FE
Bit 16-31: Index
Bit 0-7: Subindex
Read the SDO description of the individual entry with the specified subindex belonging to the object with the specified index.
ADS over EtherCAT (AoE)
The TwinCAT EAP device also supports the AoE protocol. The specification of the AoE protocol can be found in the EtherCAT Protocol Enhancements (ETG 1020). The difference between ADS/AMS communication and AoE communication is that, in contrast to ADS/AMS communication, AoE communication requires no TwinCAT router. The AoE protocol is one of the protocols that are classified in TwinCAT under the category Mailbox Communication. An EtherCAT telegram of type 5 (mailbox communication) is used for the communication of AoE. A mailbox telegram can be transmitted from or to the TwinCAT EAP device:
via Ethernet (EtherType = 0x88A4) or
via UDP/IP (UDP Port = 0x88A4)
It is possible to transport (tunnel) various protocols by mailbox communication. The protocol to be tunneled is defined on the basis of the field type in the Mailbox Header. The AoE protocol is specified by the value 1 (see Mailbox Header in the following illustration). The Mailbox Header is directly followed by the AoE Header and then by the AoE data. Its structure is identical to the ADS/AMS protocol (refer also to the TwinCAT ADS/AMS specification in the Beckhoff information system). This gives rise to the possibility to also use the CANopen SDO communication via the mailbox protocol. Analogous to the ADS/AMS protocol, the CANopen OD of the TwinCAT EAP device can be accessed as described in the chapter The TwinCAT ADS interface to the EAP device.
Sample:
In order to read the Vendor ID of the identity object from the EAP Object Dictionary, the ADS command is defined in the AoE Header on the basis of the Command ID.
AoE command
Command ID
Description
ADS Read
2
ADS Read command for reading data
ADS Write
3
ADS Write command for writing data
A distinction is made between Request = 0 and Response = 1 on the basis of the 0th bit in the State Flag of the AoE Header.The AoE Data field is subsequently populated with the following contents (see following illustration):
At the beginning there is an ADS Read Request Header with
Index Group = 0x0000F302 for reading the contents of the parameter,
Index Offset = 0x10180001 for addressing the Vendor ID parameter and
Read Length = 4 to inform about the size of the available data buffer.
These are followed by the data buffer for the data to be read.
Online configuration of the TwinCAT EAP device
The CANopen OD offers the great advantage of allowing the virtually unlimited online configuration of a TwinCAT EAP device via a standardized interface. Carrying out an online configuration means that the TwinCAT EAP device is already active and needs to be switched to a safe state before changing the configuration. No process data communication takes place in the safe state.
The configuration is done by setting parameters and takes place
via TwinCAT:
the values are then changed directly in the online Object Dictionary.
This is useful for commissioning of the system. The new value is set in the respective parameter by clicking on the corresponding row of the index to be parameterized and entering an appropriate value in the Set Value dialog.
or from an application via ADS or AoE:
This is recommended for changes when the system is running or if no TwinCAT or operator is available.
On the one hand, a change can exclusively concern the entries in existing objects of the OD. On the other, a change can result in the generation of new objects or the deletion of existing ones.
Changing existing objects
A change that concerns only existing objects serves the adaptation of the current operating behavior (e.g. transmission cycle, destination address, etc.) or to assign purpose-related names to individual objects for a better understanding. The steps that are necessary for such a change can best be illustrated with an example:
Changing the time interval with which a Publisher Variable is transmitted.
Let's assume that the EAP device is configured with a TxPD (0xD000) in which an interval of 10000 µs is configured as the Cycle Time and this interval is now to be enlarged to 30000 µs. In this case the following steps have to be carried out:
1.
Place the EAP device in a safe state.
Set the object entry 0xF200:01 (Control Word) to the value 2 (=PreOperational)
Check object entry 0xF100:01 to ascertain whether the state is 2 (=PreOperational)
Carry out this check several times (polling) with a timeout of, for example, 200 ms.
2.
Change the time interval of the TxPD to the new value
Set the object entry Cycle Time of the TxPD (0xD000:07) to the value 30000
3.
Place the EAP device in its operative state again.
Set the object entry 0xF200:01 (Control Word) to the value 4 (=SafeOperational)
Check object entry 0xF100:01 to ascertain whether the state is 4 (=SafeOperational)
Carry out this check several times (polling) with a timeout of, for example, 200 ms.
Set the object entry 0xF200:01 (Control Word) to the value 8 (=Operational)
Check object entry 0xF100:01 to ascertain whether the state is 8 (=Operational)
Carry out this check several times (polling) with a timeout of, for example, 200 ms.
Generation and deletion of objects
The generation of new objects serves the extension of existing communication connections or the addition of new communication connections. This function makes it possible, for example, to establish a temporary communication connection between two controllers. Only the transmission and reception of the EAP device are briefly interrupted during the configuration phase. The processes of other components and modules of the controller are unaffected by this and can remain active throughout.
Objects are generated or deleted with the help of the objects Frame List (index 0xF020 – 0xF022) and Bitmap (index 0xF801)
There are a total of 512 entries in the Frame List objects – exactly as many as the maximum possible number of TxFrameobjects (see index 0xF020 in The EAP Object Dictionary (subprofile 1000)). Each entry is thus assigned precisely one TxFrameobject. The value 1000 (sub-profile number) is then saved in the corresponding entry for each existing TxFrame object. All other entries have the value 0. Let's assume that there are three TxFrames with the indices 0x8000, 0x8008 and 0x87F0. The assignment is then to be understood as follows:
No.
Frame List entries
Value
Assigned TxFrame object
1
0xF020:01
1000
0x8000
2
0xF020:02
1000
0x8008
0
254
0xF020:254
0
0x87E8
255
0xF021:01
1000
0x87F0
0
512
0xF022:04
0
0x8FF8
The corresponding TxFrame objects are generated as soon as the value of an entry is set to 1000. The object is deleted again when the value is reset to 0.
With the exception of TxFrames a separate entry exists for each dynamic object type in the object Bitmap. Accordingly, six entries are to be found (excluding the entry 0 – see index 0xF801 in The EAP Object Dictionary (subprofile 1000)). An entry contains a bit field of a sufficient length to be able to save the maximum number of objects of the corresponding object type in unary notation.
Let's assume that there are three TxPD objects with the indices 0xD000, 0xD00C and 0xD014. Then the bit sequence 10010100000000…0 with the total length of 1024 bits is saved in the entry 0xF801:03. The sequence is to be interpreted as follows:
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Bit 7
Bit 8
Bit 1024
1
0
0
1
0
1
0
0
0
0xD000
0x D004
0x D008
0x D00C
0x D010
0x D014
0x D018
0x D01C
0x DFFC
The corresponding object is generated as soon as a bit is set to 1. The object is deleted again on resetting.
Note
Deletion of objects configured offline.
It is also possible to delete objects that were configured before commissioning by means of TwinCAT (offline configuration) and as a result are already generated on activating the controller. The following must be considered in this case:
Some objects manage variables (e.g. CycleIndex, Quality, Status Word, Control Word etc.) that are located in the process image of the EAP device. TwinCAT accesses the process image by ADS when displaying online values. The addresses of the respective variables in the process image that were generated and activated with the help of TwinCAT are calculated after the configuration.
If an object that was configured offline is now deleted during an online configuration, this change remains hidden from TwinCAT. It therefore still accesses the calculated addresses in order to display their contents in the online view. It should be clear at this point that the online values displayed no longer match the configuration generated in TwinCAT.
In this case, therefore, the online view, or the addresses of the process image respectively, are no longer a valid reference source for monitoring or even evaluating the values of the process image.
It is recommended that objects configured offline be deactivated and not deleted.
If objects are deleted or added with the help of TwinCAT, new objects are not directly displayed in the Object Dictionary. Deleted objects remain in the OD and no values are displayed for their entries any longer. So that new objects are displayed and deleted objects are no longer displayed, the structure of the OD must be read again in TwinCAT. This can be done with the help of the Advanced Settings dialog (see fig. CoEOnline in chapter The TwinCAT EAP device).
Activation/deactivation of objects
In case certain Process Data/PDOs or complete Frames are only to be temporarily removed from the existing EAP communication, it is advisable to deactivate the objects concerned instead of deleting them.
The objects TxFrame (0x8000), TxPD Assignment (0x8001), TxPD (0xD000), TxPDO (0x1A00), RxPD (0xE000) and RxPDO(0x1600) can be deactivated and reactivated by setting their subindex 0 to the value 0. The activation then takes place by setting the original value or any other value greater than 0.
List-based objects
Note with the list-based objects TxPD Assignment and Rx/TxPDOs that their entries always contain references to other objects. Any change made to subindex 0 will therefore affect which and how many other objects are actually referenced.
Linking of a variable from the EAP process image with a PLC variable.
The linking of variables from the TwinCAT I/O level with variables from a PLC program takes place as standard in TwinCAT. If an Input/Output Variable from a PLC program is linked with a Publisher or Subscriber Variable of the EAP device, the symbol name of this variable is entered in the corresponding CANopen object of the EAP device (see next illustration).
As the previous illustration shows, the symbol name is made up of the Object ID (OID) of the PLC instance and the unique name of the PLC program variable, separated by a colon. Using the same syntax a symbol name can also be entered for an EAP object during the online configuration. The PLC variable is then linked accordingly with the Rx/TxVariable.
Online configuration of offline links
Links that had already been generated during the offline configuration can neither be changed nor deleted during the online configuration. These symbol names are thus marked with the Read-Only (RO) flag.
Reason:
The linking of these variables is defined by TwinCAT with the help of a mapping object when creating a configuration. However, this mapping object cannot be changed during operation.
Access to the CANopen Object Dictionary by Single Access/Complete Access
With the support of the communication channel CANopen SDO (see The TwinCAT ADS interface to the EAP device), the ADS interface allows both the values of individual object entries and the data of a complete object to be read or written respectively. Access to the individual object entry (Single Access) is explained in the section Changing existing objects in the chapter Online configuration of the TwinCAT EAP device.
Complete Access means access to the complete object. In this case the values of all object entries are transmitted in succession in binary in a block. For safety in the case of a write access, the correlation of the block length with the size of the object is checked before the access is enabled. To determine the necessary block length the documentation for the Object Dictionary can be consulted or an offline configuration can be exported to an EAP Device Configuration (EDC) file (see section Protocol in chapter The TwinCAT EAP device). The latter is a file in XML format containing the full Object Dictionary of the current configuration (see chapter The EAP Device Configuration (EDC) File).
Configuration of Polled Data Exchange
The Polled Data Exchange mode is configured with the help of the EAP Object Dictionary. To do this the RxPD which, as a client, is to receive the response of the server must be configured in one EAP device, while the TxPD which, as a server, defines the response to the client's request must be configured in another EAP device.
As shown in the following illustration, a TxPD is configured on the client side for the request and is cyclically transmitted as in Pushed Data Exchange mode. For receiving the server response, two RxPDs are configured on the client side in this sample. With both RxPDs the index of the TxPD that serves as the request is entered in the Poll Request TxPD property . On the basis of the transmission time of the request, an RxPD can determine a quality value on whose basis the time difference between request and response can be read.
On the server side, an RxPD is configured for the reception of the request that works as in Pushed Data Exchange mode. In this example two TxPDs are configured for the transmission of the response to the client request. With both TxPDs the index of the RxPD that serves as the recipient of the request is entered in the Poll Request RxPD property. In each processing cycle a TxPDchecks with its configured Poll Request RxPD whether a request has been received. If so, the TxPD is sent back in this cycle as the response.
Restoring the online configuration
If parameters of the CANopen OD are changed online for the EAP device, the current state of the CANopen OD is archived on the hard drive as soon as TwinCAT is switched back to the Stop/Config mode. When restarting TwinCAT in Run mode, the created archive is usually irrelevant, because the configuration made offline is simply restarted. All changes configured online are discarded.
If the online configuration is to be restored on restarting TwinCAT, then the option Recover Online Configuration must be switched on for this EAP device in TwinCAT (see following illustration) and the project must then be reactivated. In this case, when starting the controller, the offline configuration is initially loaded followed by the archive from the hard disk, so that the online configuration is active at the end of the start procedure.
It is not possible to change the configuration of the TwinCAT EAP device in TwinCAT if the option Recover Online Configurationis set. To do this the option must first be deactivated again. The sole purpose of this blocking mechanism is to protect the offline configuration against being changed by the user, even though this change would have no effect when activating the controller since the online configuration is restored.
Recover online configuration
The archived CANopen Object Dictionary is coupled to the instance of the EAP device in TwinCAT. As soon as this instance is deleted in TwinCAT and a new instance is created instead, the previously archived OD can no longer be restored for this instance.
The EAP Device Configuration (EDC) File
The EAP Device Configuration (EDC) takes place with the help of TwinCAT. At least the EAP device itself has to be created via TwinCAT so that an instance of the EAP device is generated accordingly when starting TwinCAT. The creation of TxFrames, Tx/RxProcessData, Tx/RxPDOs and Tx/RxVariables can then also be carried out subsequently by an ADS-Client application. TwinCAT must be in Run mode for this. In most cases, however, a TwinCAT EAP device is completely configured via TwinCAT and started as described in chapter Creation of an EAP configuration and Configuration of an EAP device.
A configurator with a graphical user interface (GUI) – the TwinCAT EAP Configurator (Product description TE1610) – has been developed for the online configuration of an EAP device or an entire network of EAP devices. This configurator enables the graphical representation of all EAP devices in the network and their communication connections with one another. Also, each EAP device can be configured via the GUI.
A configuration that has been created in TwinCAT and to which an EDC file has been exported contains all the information required when importing into the configurator in order to display the current configuration of the EAP device. Documentation on the TwinCAT EAP configurator can be found in the Beckhoff Information System under TE1610 EAP Configurator.
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
TwinCAT更新XML文件
GDI C++
Lab: I2C Communication With An Infrared Temperature Sensor
经典小故事十篇
西门子S7-1200与倍福PLC的PROFINET通讯(附案例下载)
体验XF IQ3 100MP高动态范围
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服