The invention relates to the technical field of
clock synchronization, in particular to a
clock synchronization method of a
master station system based on
EtherCAT, which comprises the following steps: when a
master station periodically sends
time synchronization frames to all slave stations, collecting slave
station feedback
time data, respectively calculating a
clock offset value between master time and slave time, and simultaneously, calculating a
clock offset value between the master time and the slave time; constructing a master-slave offset time
feature matrix according to the collected multi-periodic data, extracting initial static offset, an offset fluctuation trend and offset
collaboration features among multiple slave stations from the constructed master-slave offset time
feature matrix, and determining an initial
estimation set according to the extracted features; constructing a master-slave offset prediction set based on the initial
estimation set, and performing master-
slave clock offset adaptive compensation correction based on the determined master-slave offset prediction set; according to the method, the initial offset
estimation set is constructed, the offset trend estimation function is introduced, secondary fitting of the offset sequence of each slave
station node is achieved, and it is ensured that the prediction precision is remarkably improved through an error comparison mechanism.