Beckhoff Twincat 3.0 and C ++ software communications problems (EAP communication)

Before article introduces the ADS (Automation Device Specification) communication problem, which is based on TCP / IP application protocols, real-time general, higher real-time requirements can be applied Realtime Ethernet way that the EAP (EtherCAT Automation Protocal) communication protocol. The chart below compares the three means of communication:

Table 1 Some communication between the TwinCAT controller 1

protocol Hardware Requirements real-time Explanation
ADS communication Ordinary card, support wireless Typ: <100ms Server / Client, write the PLC program, no configuration IO
EAP communication Y-Driver supports the wired LAN, or preferably exclusively EL660x switch module Typ: <10ms Publisher / Subscriber, do not write the PLC program, to configure the IO
EtherCAT master and slave communication Slave interface slave controller should be, eg CX8090, -B110, FC11xx etc. Minimum: <1ms Master / Slave, do not write the PLC program, to configure the IO

Currently PC - control mode of the controller is very common, belonging to the communication between the controller communication between PC and controller instead of the traditional, less demanding situations in real time, can only by remote ADS, in order to read the variable name take way transmission between the variables can generally be achieved within 100ms;
and highly time-critical, since the communication between the controllers is not, and can not communicate directly through the EAP, but the idea can be converted, by the host computer the establishment of a local middle Twincat program, PC C ++ program information transfer through the local ADS with local middle Twincat program, and Twincat program with local middle Twincat program running on the controller for EAP communication, so that the original remote ADS communication becomes a ADS combination of local communication and EAP communication, this approach generally can achieve real-time within 10ms.
Since the ADS method and the C ++ before communication has mentioned article, this article describes the specific steps arranged only partially EAP communication, the local middle Twincat procedures are as follows:

1. Add EAP equipment

New construction, DEVICE add EAP, as shown below.
EAP
Select Network Variables type.
EAP
You may need to set up the network adapter to activate the EAP, select Adapter in the search, select the network adapter to determine, after the activation of the configuration before the next step.
adapter

2. Add Variable refresh cycle of Task

Right-added task with image type on the Task.
task
Communication is provided by EAP periodic refresh task communication variables, and therefore can set the task period and the task priority cycle time, and is not specifically described.
In the task subdirectory Inputs and Outputs are required to communicate new variable name and type, in which we set the type of a variable outputTest and inputTest BOOL.
task

3. Add transceivers (subscriber and Publisher)

Finally, add subscriber and publisher in the IO in the EAP.
transceiver
Similarly variables in the subscriber and the publisher, set the variable name and type. Here Insert Picture Description
We can see that you have added, transceiver drop-down list appeared VarData, we will link it to the task were already set in variable outputTest and inputTest, and then re-activate the configuration.

Wardt
Here Insert Picture Description

4. Test

For this project (PC - Controller), wherein the controller Inputs corresponding to the program variables to pass through the EAP, i.e. subscriber; Outputs controller program corresponding to the host computer via the variable transmission to ADS communication, i.e. publisher. So way for Outputs, we only need to write a value in the task variables can simulate ADS communication transmission over the variable conditions (PC ADS way communication method with the previous article the same way, variable names are to be read, for example, "Tasks.Outputs.outputTest"); for the Inputs, to be written in the subscriber IO controller in EAP to transmission over analog variable (for convenience, this would not introduce EAP configuration controller program portion, which is arranged herein IO configuration empathy).
ADS communication transmission over an analog variable conditions as an example:
outputTest written is 1,
outputTest
observed in the corresponding IO VarData value also becomes 1, indicating a successful IO configuration.
Wardt


  1. Lizzy Chen, "TwinCAT 2.0 from entry to the master", 2019. ↩︎

Released two original articles · won praise 6 · views 981

Guess you like

Origin blog.csdn.net/weixin_42811651/article/details/104360801