| CPC G06F 13/20 (2013.01) [G06F 2213/40 (2013.01)] | 9 Claims |

|
1. A synchronization optimization method for EtherCAT master-slaves, comprising steps of:
capturing a time when a master sends a data frame and a time when the master receives the data frame, capturing a time when a reference slave receives the data frame, calculating a transmission delay between the master and the reference slave, and obtaining a compensated transmission delay between the master and the reference slave;
calculating a time taken for the data frame to leave a parent port of a non-reference slave and return to the parent port of the non-reference slave, calculating a transmission delay, a clock offset, and a clock drift for the non-reference slave;
compensating for the clock drift by adopting a double exponential smoothing algorithm, subtracting the compensated clock drift from the clock offset and obtaining a new clock offset, writing the new clock offset into the non-reference slave for compensation to complete a synchronization optimization; and
before the step of capturing a time when a master sends a data frame and a time when the master receives the data frame, further comprising: by sending the data frame through the master, capturing a number of slaves, a first port of each slave that receives the data frame, and active ports of each slaves, determining a parent and a parent port of the non-reference slave based on the number of connected slaves and a port transmission sequence.
|