CN107402534B - Adjusting method, EtherCAT main station and computer readable storage medium - Google Patents

Adjusting method, EtherCAT main station and computer readable storage medium Download PDF

Info

Publication number
CN107402534B
CN107402534B CN201710599596.5A CN201710599596A CN107402534B CN 107402534 B CN107402534 B CN 107402534B CN 201710599596 A CN201710599596 A CN 201710599596A CN 107402534 B CN107402534 B CN 107402534B
Authority
CN
China
Prior art keywords
time
ethercat
master station
periodic
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710599596.5A
Other languages
Chinese (zh)
Other versions
CN107402534A (en
Inventor
张福雷
李延法
王科
严彩忠
刘国华
丁信忠
李虎修
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Step Robotics Corp
Original Assignee
Shanghai Step Robotics Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Step Robotics Corp filed Critical Shanghai Step Robotics Corp
Priority to CN201710599596.5A priority Critical patent/CN107402534B/en
Publication of CN107402534A publication Critical patent/CN107402534A/en
Application granted granted Critical
Publication of CN107402534B publication Critical patent/CN107402534B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/25Pc structure of the system
    • G05B2219/25257Microcontroller

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The invention relates to the field of industrial Ethernet field bus communication, and discloses an adjusting method, an EtherCAT master station and a computer readable storage medium. In the invention, the adjusting method comprises the following steps: after the master station starts to execute the periodic real-time task, setting task awakening time of the periodic real-time task, and periodically acquiring the starting time of a periodic clock interrupt synchronous event provided by the slave station and the current time of a master station application program of the master station; if the time difference value between the starting time of the periodic clock interrupt synchronous event and the current time of the master station application program is not larger than the preset synchronous difference value, a target adjusting value is obtained; and adjusts and fixes the start time of the periodic clock interrupt sync event and the start time of the data input event or the data output event. Therefore, the problem of mutual conflict between the interruption of the data message generated by the master station and the interruption of the periodic clock provided by the slave station is solved.

Description

Adjusting method, EtherCAT main station and computer readable storage medium
Technical Field
The invention relates to the field of industrial Ethernet field bus communication, in particular to an adjusting method, an EtherCAT master station and a computer readable storage medium.
Background
With the progress of electronic and communication technologies, industrial automation control is gradually changed from a traditional point-to-point centralized control mode to a field bus communication control mode based on networking. The field bus communication system based on the industrial Ethernet integrates the control, monitoring and other devices of the industrial field in a communication network in a serial signal mode, has the advantages of full digital, bidirectional, serial and multi-node and the like, can realize the high-speed and low-jitter control of the hundred-mega Ethernet, and is widely applied to various high-speed and high-precision motion control systems.
EtherCAT (ethernet Control Automation Technology, or real-time industrial ethernet) is a fieldbus communication protocol based on industrial ethernet, and has been widely recognized and applied in various Control systems due to its advantages of wide applicability, short refresh period, good synchronization performance, etc.
However, in the process of implementing the invention, the inventor finds that the prior art has some problems: because the start time point of the data input event (or data output event) and the start time point of the periodic clock interrupt synchronization event performed in the EtherCAT master station cannot be fixed, the existing EtherCAT slave station collides with the data input event (or data output event) of the EtherCAT master station when performing the periodic clock interrupt synchronization event, and due to the existence of the collision, the EtherCAT master station loses the data frame when receiving or transmitting the data frame, and cannot ensure the real-time performance of the data frame, which is not favorable for a high-precision real-time control system.
Disclosure of Invention
The embodiment of the invention aims to provide an adjusting method, an EtherCAT master station and a computer readable storage medium, and solves the problem of mutual conflict between data message interruption generated when the EtherCAT master station transmits a data frame and periodic clock interruption provided by a slave station.
In order to solve the above technical problem, an embodiment of the present invention provides an adjusting method, where the adjusting method is applied to a real-time industrial ethernet EtherCAT master station, and includes: after the EtherCAT master station starts to execute the periodic real-time task, setting task awakening time of the periodic real-time task, and periodically acquiring the start time of a periodic clock interrupt synchronous event provided by the EtherCAT slave station and the current time of a master station application program of the EtherCAT master station; if the time difference value between the starting time of the periodic clock interrupt synchronous event and the current time of the master station application program is not larger than the preset synchronous difference value, a target adjusting value is obtained; the target adjusting value is a time difference value between the starting time of a periodic clock interrupt synchronous event and the starting time of a data input event or a data output event in a periodic real-time task; and adjusting and fixing the starting time of the periodic clock interrupt synchronous event and the starting time of the data input event or the data output event in the periodic real-time task according to the target adjusting value.
The embodiment of the invention also provides an EtherCAT main station, which comprises at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executable by the at least one processor to enable the at least one processor to perform the adjustment method as claimed in any of the embodiments of the invention; and the EtherCAT master station establishes communication connection with each EtherCAT in advance.
Embodiments of the present invention further provide a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method for adjusting an EtherCAT master station according to any embodiment of the present invention can be implemented.
Compared with the prior art, the adjusting method provided by the embodiment of the invention comprises the steps of periodically acquiring the start time of the periodic clock interrupt synchronous event provided by the EtherCAT slave station and the current time of the master station application program of the EtherCAT master station after the EtherCAT master station starts to execute the periodic real-time task and the task wake-up time of the periodic real-time task is set, acquiring a target adjusting value when the time difference between the start time of the periodic clock interrupt synchronous event and the current time of the master station application program is not greater than the preset synchronous difference, entering the synchronous stage of a data frame, finally adjusting and fixing the start time of the periodic clock interrupt synchronous event and the start time of the data input event or the data output event in the periodic real-time task according to the acquired target adjusting value, so that the time points of the data input or the data output event performed at the EtherCAT master station and the start of the periodic clock interrupt provided by the EtherCAT slave station are fixed, therefore, the problem of mutual conflict between data message interruption generated when the EtherCAT master station transmits the data frame and the periodic clock interruption provided by the slave station is solved.
In addition, before the EtherCAT master station starts to execute the periodic real-time task, the adjusting method further comprises the following steps: carrying out initialization configuration in an EtherCAT main station; the initialization configuration specifically includes: after the EtherCAT master station and all the EtherCAT slave stations adaptive to the EtherCAT master station are electrified, the EtherCAT master station sends reference time to the EtherCAT reference slave stations, and a clock of the EtherCAT reference slave stations is selected as a reference clock; the EtherCAT reference slave station is a first EtherCAT slave station with a distributed clock function connected with the EtherCAT master station, and the reference slave station calculates the starting time of a periodic clock interrupt synchronization event according to the reference time; the EtherCAT master station acquires the starting time of the periodic clock interrupt synchronous event from the EtherCAT reference slave station. Before the EtherCAT master station starts to execute the periodic real-time task, the EtherCAT master station is initialized and configured, so that time synchronization between the EtherCAT master station and the EtherCAT reference slave station is realized, and the accuracy of subsequent adjustment operation is ensured.
In addition, after the EtherCAT master station acquires the start time of the periodic clock interrupt synchronization event from the EtherCAT reference slave station, the initialization configuration further includes: the EtherCAT master station sends the start time of the cycle clock interrupt synchronization event to each EtherCAT slave station through a bus; and the EtherCAT slave stations receive the starting time of the periodic clock interrupt synchronous events from the bus in sequence according to the physical connection order. The method comprises the steps that the EtherCAT master station acquires the starting time of a periodic clock interrupt synchronous event from the EtherCAT reference slave station, and after time synchronization between the EtherCAT master station and the EtherCAT reference slave station is completed, the starting time of the periodic clock interrupt synchronous event is sent to each EtherCAT slave station by using a bus, so that time synchronization between the EtherCAT master station and the EtherCAT slave stations adaptive to the EtherCAT master station is achieved, the starting time of the periodic clock interrupt synchronous event is the same, and accuracy of subsequent adjustment operation is further guaranteed.
In addition, the obtaining of the target adjustment value specifically includes: the EtherCAT master station calculates a first time value, a second time value and a third time value according to the current time of the master station application program, the task wakeup time of the periodic real-time task and the start time of a periodic clock interrupt synchronous event in the periodic real-time task; the first time value is the time length from the task wakeup time of the periodic real-time task to the current time of the master station application program, the second time value is the time length from the task wakeup time of the periodic real-time task to the time of starting a data input or data output event in the periodic real-time task, and the third time value is the time length from the start time of a periodic clock interrupt synchronization event in the periodic real-time task to the current time of the master station application program; determining a first remaining time value according to the first time value and the task awakening duration of the periodic real-time task; determining a second remaining time value according to the second time value and the duration of a data input or data output event in the periodic real-time task; determining a third remaining time value according to the third time value and the duration of the periodic clock interrupt synchronous event in the periodic real-time task; and determining a target adjusting value according to the first remaining time value, the second remaining time value and the third remaining time value. The embodiment of the invention provides a specific mode for acquiring the target adjustment value, under the condition that the time of an EtherCAT master station and the time of an EtherCAT slave station are synchronous, the finally required target adjustment value can be accurately calculated according to the current time of a master station application program, the task wakeup time of a periodic real-time task, the time of starting a data input or data output event and the start time of a periodic clock interrupt synchronous event, the accuracy of the target adjustment value is ensured, and the calculation mode is simple and convenient.
In addition, after adjusting and fixing the start time of the periodic clock interrupt synchronization event and the start time of the data input event or the data output event within the periodic real-time task according to the target adjustment value, the adjustment method further includes: acquiring and storing a time difference value between the time when the EtherCAT master station starts to interrupt the synchronous event of the adjacent periodic clocks and the time when the data is input or output; the time difference is used as an adjustment reference value in the adjustment method. After the adjustment of the starting time of the periodic clock interrupt synchronous event and the starting time of the data input event or the data output event in the periodic real-time task is completed, the time difference between the starting time of the adjacent periodic clock interrupt synchronous event by the EtherCAT master station and the time of the data input event or the data output event is acquired and stored, and finally the time difference is used as an adjustment reference value for subsequent adjustment of the EtherCAT master station and the EtherCAT slave station by the adjustment method provided by the embodiment of the invention, so that the subsequent adjustment operation can be facilitated.
Drawings
FIG. 1 is a flow chart of a conditioning method of a first embodiment of the present invention;
FIG. 2 is a schematic diagram of the determination of a target adjustment value in the adjustment method of the first embodiment of the invention;
FIG. 3 is a flow chart of a conditioning method of a second embodiment of the present invention;
fig. 4 is a block diagram showing the structure of an EtherCAT master station according to the third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.
A first embodiment of the present invention relates to an adjusting method, where the adjusting method shown in fig. 1 is mainly applied to a real-time industrial ethernet EtherCAT master station, and in order to ensure that the adjusting method can be normally executed, it is required to ensure that the EtherCAT master station has established a communication connection with an EtherCAT slave station adapted thereto, and all the EtherCAT master station and the EtherCAT slave station are in a powered-on state, and specifically, a flow of the adjusting method shown in fig. 1 may include:
in step 101, the task wakeup time of the periodic real-time task is set, and the start time of the periodic clock interrupt synchronization event and the current time of the master application program are obtained.
Specifically, the start time of the periodic clock interrupt synchronization event obtained in the embodiment is provided by the EtherCAT slave station adapted to the EtherCAT master station, the current time of the master station application program is provided by the EtherCAT master station itself, and in order to ensure the accuracy of the subsequent operation, the obtaining operation needs to be performed periodically in the whole periodic real-time task.
In addition, in the present embodiment, the operation of setting the task wakeup time of the periodic real-time task needs to be performed after the EtherCAT master station starts to execute the periodic real-time task.
It should be noted that the periodic real-time task in this embodiment is specifically a data communication event performed by the EtherCAT master station and the EtherCAT slave station in one period, and specific settings about the period duration of the periodic real-time task and the task wakeup time of the periodic real-time task are not limited here.
In addition, the starting time of the periodic clock interrupt synchronous event specifically refers to the specific time when the EtherCAT master station starts to execute the periodic real-time task after being powered on and entering the working state. The task wake-up time of the periodic real-time task specifically refers to the time for the periodic real-time task to wake up from sleep in each period, and those skilled in the art can reasonably set the time as needed, which is not described herein again.
In addition, it is worth mentioning that, in practical applications, only one data input event (or data output event) and one cycle of the clock interrupt synchronization event are allowed in each cycle of the real-time task.
In step 102, a target adjustment value is obtained.
Specifically, in practical application, the target adjustment value is obtained in order to synchronize a data frame in the EtherCAT master station, and it is required that a cycle clock interrupt synchronization event is synchronized first on the premise that data frame synchronization is guaranteed, so that the EtherCAT master station calculates a time difference between the start time of the cycle clock interrupt synchronization event and the current time of the master station application program according to the start time of the cycle clock interrupt synchronization event obtained each time and the current time of the master station application program, compares the obtained time difference with a preset synchronization difference, and if it is determined that the time difference between the start time of the cycle clock interrupt synchronization event and the current time of the master station application program is not greater than the preset synchronization difference (i.e., it is determined that the cycle clock interrupt synchronization event is synchronized), the EtherCAT master station obtains the target adjustment value.
In practical application, when it is determined that a time difference between the start time of the periodic clock interrupt synchronization event and the current time of the master station application program is not greater than a preset synchronization difference, a synchronization flag set (a detection variable set during program compilation) written in the EtherCAT master station in advance is triggered, at this time, the EtherCAT master station can execute an operation of obtaining a target adjustment value according to the synchronization flag set, and specifically, the setting can be performed according to actual needs, and no limitation is made here.
For ease of understanding, the following description will be made of a specific manner of obtaining the target adjustment value:
the EtherCAT master calculates the first time value, the second time value and the third time value according to the current time (app _ time in fig. 2) of the master application program, the task wake time (task _ wake _ time in fig. 2) of the periodic real-time task, and the start time (sync _ start _ time in fig. 2) of the periodic clock interrupt synchronization event in the periodic real-time task.
It should be noted that the first time value is a time period from the task wake time task _ wake _ time of the first periodic real-time task on the left side in fig. 2 to the current time app _ time of the master application program.
The second time value is a time period required from the task wake time task _ wake _ time of the first periodic real-time task on the left side in fig. 2 to a time when a data input or data output event within the periodic real-time task starts (pdi _ time near the task wake time task _ wake _ time of the first periodic real-time task in fig. 2).
The third time value is the time duration required for the start time of the periodic tick sync event (the first sync _ start _ time on the left in fig. 2) within the periodic real-time task to the current time app _ time of the master application.
After obtaining the first time value, the second time value and the third time value, the EtherCAT master determines a first remaining time value, namely wake _ time _ diff in fig. 2, according to the first time value and the task wakeup duration (the duration between two task _ wake _ times), determines a second remaining time value, namely wake _ pdi _ diff in fig. 2, according to the second time value and the duration of the data input or data output event in the periodic real-time task (the duration between two pdi _ times), and determines a third remaining time value, namely sync _ start _ diff in fig. 2, according to the third time value and the duration of the periodic clock interrupt synchronization event in the periodic real-time task (the duration between two sync _ start _ times).
Finally, a target adjustment value, sync _ pdi _ diff in fig. 2, is determined according to the first remaining time value wake _ time _ diff, the second remaining time value wake _ pdi _ diff, and the third remaining time value sync _ start _ diff. That is, the target adjustment value sync _ pdi _ diff is the first remaining time value wake _ time _ diff minus the third remaining time value sync _ start _ diff plus a time value resulting after the second remaining time value wake _ pdi _ diff.
In step 103, the start time of the periodic tick sync event and the start time of the data input event or the data output event within the periodic real-time task are adjusted and fixed.
Specifically, after determining the target adjustment value, the EtherCAT master station performs step 103 according to the target adjustment value.
The above description is only for illustrative purposes and does not limit the technical aspects of the present invention.
Compared with the prior art, the adjusting method provided in this embodiment obtains the start time of the periodic clock interrupt synchronization event provided by the EtherCAT slave station and the current time of the master station application program of the EtherCAT master station by periodically obtaining the start time of the periodic clock interrupt synchronization event and the current time of the master station application program of the EtherCAT master station after the EtherCAT master station starts to execute the periodic real-time task and sets the task wake-up time of the periodic real-time task, obtains the target adjustment value when the time difference between the start time of the periodic clock interrupt synchronization event and the current time of the master station application program is not greater than the preset synchronization difference, enters the synchronization stage of the data frame, finally adjusts and fixes the start time of the periodic clock interrupt synchronization event and the start time of the data input event or the data output event in the periodic real-time task according to the obtained target adjustment value, so that the time points of the data input or the data output event performed at the EtherCAT master station and the start of the periodic clock interrupt provided by, therefore, the problem of mutual conflict between data message interruption generated when the EtherCAT master station transmits the data frame and the periodic clock interruption provided by the slave station is solved.
In addition, it should be mentioned that, in order to facilitate the subsequent adjustment of the EtherCAT master station and the EtherCAT slave station by the user, after the start time of the periodic clock interrupt synchronous event and the start time of the data input event or the data output event in the periodic real-time task are adjusted and fixed according to the target adjustment value, the time difference between the start time of the adjacent periodic clock interrupt synchronous event and the start time of the data input event (or the data output event) by the EtherCAT master station can be further obtained and stored, and the time difference is used as an adjustment reference value in the adjustment method, so that in the subsequent use process, when the start time of the periodic clock interrupt synchronous event and the start time of the data input event or the data output event in the periodic real-time task set in the EtherCAT master station need to be fixed, the start time is referred by the user, and further the subsequent adjustment is facilitated, and the accuracy of the adjustment is ensured.
A second embodiment of the invention relates to a method of regulation. The embodiment is further improved on the basis of the first embodiment, and the specific improvements are as follows: before the EtherCAT master station starts to execute the periodic real-time task, initialization configuration needs to be performed first, and a specific flow is shown in fig. 3.
Specifically, the present embodiment includes steps 301 to 304, wherein steps 302 to 304 are substantially the same as steps 101 to 103 in the first embodiment, and are not repeated herein. The following mainly introduces the differences:
in step 301, initialization configuration is performed in the EtherCAT master station.
Specifically, the initialization configuration performed in the EtherCAT master station specifically includes the following operations:
after the EtherCAT master station and the EtherCAT slave stations adaptive to the EtherCAT master station are powered on, the EtherCAT master station sends reference time to the EtherCAT reference slave station, and a clock of the EtherCAT reference slave station is selected as a reference clock.
The EtherCAT reference slave station selected in this embodiment is the first EtherCAT slave station having a distributed clock function and connected to the EtherCAT master station.
After receiving the reference time sent by the EtherCAT master station, the EtherCAT reference slave station calculates the start time of the periodic clock interrupt synchronous event according to the reference time, and further, the EtherCAT master station obtains the calculated start time of the periodic clock interrupt synchronous event from the EtherCAT reference slave station through a bus.
It should be noted that, in practical application, the EtherCAT master station acquires the calculated start time of the periodic clock interrupt synchronization event from the EtherCAT reference slave station, which needs to be performed after the start time of the periodic clock interrupt synchronization event and the current time of the master station application program are stable, and in order to calculate and control the communication interaction between the EtherCAT master station and each EtherCAT slave station, the period durations of the synchronization event, the task wakeup, the current actual, data input or data output event of the master station application program, and the like in the periodic real-time task in the EtherCAT master station may be set to the same time value, which may be specifically set as needed, and this is not done here.
In addition, it should be noted that after the EtherCAT master station acquires the start time of the cycle clock interrupt synchronization event from the EtherCAT reference slave station, the EtherCAT master station sends the start time of the cycle clock interrupt synchronization event to each EtherCAT slave station through a bus, so as to complete the time synchronization between each EtherCAT slave station and the EtherCAT master station.
It should be noted that, when the slave stations of the EtherCAT acquire the start time of the cycle clock interrupt synchronization event issued by the master stations of the EtherCAT from the bus, the slave stations of the EtherCAT receive the start time sequentially according to the sequence of physical connection.
In addition, after the EtherCAT master station acquires the start time of the periodic clock interrupt synchronous event from the EtherCAT reference slave station, the EtherCAT master station also sets the period duration of the periodic real-time task according to the acquired start time of the periodic clock interrupt synchronous event, and the EtherCAT master station sends a data message to each EtherCAT slave station in the periodic real-time task.
In addition, after the clock of the EtherCAT reference slave station is selected as the reference clock, before the EtherCAT master station starts to execute the periodic real-time task, the EtherCAT master station also sends the measurement message to each EtherCAT slave station, so that each EtherCAT slave station can calculate the transmission delay time and the system deviation time of the data message according to the received measurement message, thereby achieving the coarse synchronization of each EtherCAT slave station, ensuring that each EtherCAT slave station, the EtherCAT reference slave station and the EtherCAT master station are basically in a synchronous state when the EtherCAT master station starts to execute the periodic real-time task, and further ensuring the accuracy of subsequent operation when subsequent adjustment operation is carried out.
Compared with the prior art, the adjusting method provided by the embodiment has the advantages that the EtherCAT master station is initialized and configured before the EtherCAT master station starts to execute the periodic real-time task, so that the time synchronization between the EtherCAT master station and the EtherCAT reference slave station is realized, and the accuracy of subsequent adjusting operation is ensured. In addition, after the time synchronization of the EtherCAT master station and the EtherCAT reference slave station, the starting time of the periodic clock interrupt synchronization event is sent to each EtherCAT slave station by using the bus, so that the time synchronization of the EtherCAT master station and the EtherCAT slave stations adapted to the EtherCAT master station is achieved, the starting time of the periodic clock interrupt synchronization event is the same, and the accuracy of subsequent adjustment operation is further ensured.
The steps of the above method are divided for clarity of description, and may be combined into one step or split into some steps, and the steps are decomposed into multiple steps, so long as the steps contain the same logical relationship, which is within the protection scope of the patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
The third embodiment of the invention relates to an EtherCAT master station, which comprises a memory and a processor, wherein a preset program is stored in the memory, and the processor reads the program stored in the memory and executes the adjusting method in any embodiment of the invention according to the program.
Specifically, a block diagram of the EtherCAT master station is shown in fig. 4.
This EtherCAT main website includes: one or more processors 401 and a memory 402, one processor 401 being exemplified in fig. 4. The processor 401 and the memory 402 may be connected by a bus or other means, and fig. 4 illustrates the connection by a bus as an example. Memory 402, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The processor 401 executes various functional applications of the device and data processing by running non-volatile software programs, instructions and modules stored in the memory 402, i.e. implementing the adjustment method described in any of the method embodiments above.
The memory 402 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store a list of options, etc. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 402 may optionally include memory located remotely from processor 401, which may be connected to an external device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
One or more modules are stored in the memory 402 and when executed by the one or more processors 401 perform the adjustment method of any of the method embodiments described above.
The product can execute the method provided by the embodiment of the application, has corresponding functional modules and beneficial effects of the execution method, and can refer to the method provided by the embodiment of the application without detailed technical details in the embodiment.
A fourth embodiment of the present application relates to a computer-readable storage medium storing a computer program. It will be understood by those skilled in the art that all or part of the processes of the above method embodiments may be implemented by a computer program to instruct relevant hardware, and the computer program stored in a computer readable storage medium in a practical application may include the processes of any of the above method embodiments. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Those skilled in the art can understand that all or part of the steps in the method of the foregoing embodiments may be implemented by a program to instruct related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, etc.) or a processor (processor) to execute all or part of the steps in the method of the foregoing embodiments. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.

Claims (9)

1. An adjusting method is characterized by being applied to a real-time industrial Ethernet EtherCAT main station; the adjusting method comprises the following steps:
after the EtherCAT master station starts to execute a periodic real-time task, setting task awakening time of the periodic real-time task, and periodically acquiring the start time of a periodic clock interrupt synchronous event provided by the EtherCAT slave station and the current time of a master station application program of the EtherCAT master station;
the starting time of the periodic clock interrupt synchronous event refers to the specific time when the EtherCAT master station starts to execute the periodic real-time task after being electrified and entering a working state; the time for waking up the periodic real-time task refers to the time for waking up the periodic real-time task from sleep in each period;
if the time difference value between the starting time of the periodic clock interrupt synchronous event and the current time of the master station application program is not larger than the preset synchronous difference value, a target adjusting value is obtained; wherein the target adjustment value is a time difference value between the starting time of the periodic clock interrupt synchronous event and the starting time of a data input event or a data output event in the periodic real-time task;
and adjusting and fixing the starting time of the periodic clock interrupt synchronous event and the starting time of the data input event or the data output event in the periodic real-time task according to the target adjusting value.
2. The tuning method of claim 1, wherein the EtherCAT master station, prior to beginning execution of the periodic real-time task, further comprises:
performing initialization configuration in the EtherCAT main station;
the initialization configuration specifically includes:
after the EtherCAT master station and the EtherCAT slave stations adaptive to the EtherCAT master station are powered on, the EtherCAT master station sends reference time to the EtherCAT reference slave stations, and a clock of the EtherCAT reference slave stations is selected as a reference clock;
the EtherCAT reference slave station is a first EtherCAT slave station with a distributed clock function, and is connected with the EtherCAT master station, and the reference slave station calculates the starting time of the periodic clock interrupt synchronization event according to the reference time;
and the EtherCAT master station acquires the starting time of the periodic clock interrupt synchronous event from the EtherCAT reference slave station.
3. The method of adjusting of claim 2, wherein after the EtherCAT master station obtains the start time of the periodic clock interrupt synchronization event from the EtherCAT reference slave station, the initializing configuration further comprises:
the EtherCAT master station sends the start time of the periodic clock interrupt synchronous event to each EtherCAT slave station through a bus; and each EtherCAT slave station receives the starting time of the periodic clock interrupt synchronous event from the bus in sequence according to the physical connection order.
4. The method of adjusting of claim 2, wherein after the EtherCAT master station obtains the start time of the periodic clock interrupt synchronization event from the EtherCAT reference slave station, the initializing configuration further comprises:
the EtherCAT master station sets the period duration of the periodic real-time task according to the acquired start time of the periodic clock interrupt synchronous event; and the EtherCAT master station sends data messages to each EtherCAT slave station in the periodic real-time task.
5. The method of adjusting of claim 4, wherein after selecting the clock of the EtherCAT reference slave as the reference clock, the EtherCAT master prior to beginning execution of the periodic real-time task, the initializing configuration further comprises:
the EtherCAT master station transmits a measurement message to each EtherCAT slave station;
each EtherCAT slave station calculates the transmission delay time and the system deviation time of the data message according to the measurement message;
and each EtherCAT slave station performs coarse synchronization according to the transmission delay time and the system deviation time.
6. The adjustment method according to claim 1, wherein the obtaining of the target adjustment value specifically includes:
the EtherCAT master station calculates a first time value, a second time value and a third time value according to the current time of the master station application program, the task wakeup time of the periodic real-time task and the start time of a periodic clock interrupt synchronous event in the periodic real-time task; the first time value is the time length from the task wakeup time of the periodic real-time task to the current time of the master station application program, the second time value is the time length from the task wakeup time of the periodic real-time task to the time of starting the data input or data output event in the periodic real-time task, and the third time value is the time length from the start time of the periodic clock interrupt synchronization event in the periodic real-time task to the current time of the master station application program;
determining a first remaining time value according to the first time value and the task awakening duration of the periodic real-time task;
determining a second remaining time value according to the second time value and the duration of the data input or data output event in the periodic real-time task;
determining a third remaining time value according to the third time value and the duration of the periodic clock interrupt synchronization event in the periodic real-time task;
and determining the target adjusting value according to the first remaining time value, the second remaining time value and the third remaining time value.
7. The method of adjusting of claim 6, wherein after adjusting and fixing the start time of the periodic tick sync event and the start time of the data input event or the data output event within the periodic real-time task according to the target adjustment value, the method further comprises:
acquiring and storing a time difference value between the start time of the adjacent periodic clock interrupt synchronous event in the EtherCAT master station and the data input event or the data output event;
and taking the time difference value as an adjusting reference value.
8. An EtherCAT master station comprising at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the adjustment method of any one of claims 1 to 7;
and the EtherCAT master station and each EtherCAT slave station establish communication connection in advance.
9. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the adjustment method of one of claims 1 to 7.
CN201710599596.5A 2017-07-21 2017-07-21 Adjusting method, EtherCAT main station and computer readable storage medium Active CN107402534B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710599596.5A CN107402534B (en) 2017-07-21 2017-07-21 Adjusting method, EtherCAT main station and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710599596.5A CN107402534B (en) 2017-07-21 2017-07-21 Adjusting method, EtherCAT main station and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN107402534A CN107402534A (en) 2017-11-28
CN107402534B true CN107402534B (en) 2021-02-19

Family

ID=60402231

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710599596.5A Active CN107402534B (en) 2017-07-21 2017-07-21 Adjusting method, EtherCAT main station and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN107402534B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109991887B (en) * 2017-12-29 2021-08-31 沈阳高精数控智能技术股份有限公司 Real-time optimization method of embedded real-time EtherCAT main station
CN108199822B (en) * 2017-12-29 2021-04-02 武汉华中数控股份有限公司 Bus synchronization method and device of EtherCAT-NCUC
CN108377265B (en) * 2018-02-07 2020-10-16 南京南瑞继保电气有限公司 Real-time synchronization method for control protection distributed system in power system
US11360918B1 (en) * 2020-12-21 2022-06-14 Otis Elevator Company Real-time processing system synchronization in a control system
CN114706615B (en) * 2022-06-08 2022-09-06 国家工业信息安全发展研究中心 Automatic reverse analysis method and device for industrial robot protocol

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102271100A (en) * 2011-09-05 2011-12-07 国电南京自动化股份有限公司 Gateway device between EtherCAT industrial Ethernet and wireless Zigbee and protocol conversion method of gateway device
CN102655467A (en) * 2012-03-22 2012-09-05 上海三一精机有限公司 Ethernet field-bus master station structure and control method
CN104281086A (en) * 2014-10-22 2015-01-14 郑州斯倍思机电有限公司 Soft PLC control system based on EtherCAT communication protocol and applied to automatic argon-welding device
CN104620183A (en) * 2012-05-21 2015-05-13 泰塔制造有限责任公司 Automation and motion control system using a distributed control model
CN105024777A (en) * 2015-07-29 2015-11-04 上海新时达电气股份有限公司 Servo driver synchronized method based on Ether CAT real-time Ethernet
CN105187283A (en) * 2015-08-21 2015-12-23 中国科学院计算技术研究所 Industrial control network slave station communication method and device based on EtherCAT protocol
US10095224B2 (en) * 2014-03-03 2018-10-09 Samsung Electronics Co., Ltd. EtherCAT control device and factory automation system having the same

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8130773B2 (en) * 2008-06-25 2012-03-06 Honeywell International Inc. Hybrid topology ethernet architecture
EP2436095A2 (en) * 2009-05-25 2012-04-04 Vestas Wind Systems A/S Two global precise times for synchronization
US8145338B2 (en) * 2009-06-02 2012-03-27 The Procter & Gamble Company Systems and methods for detecting and rejecting defective absorbent articles from a converting line
EP2282452B1 (en) * 2009-07-31 2012-04-04 ABB Research Ltd. Data transmission in a ring-type communication network
KR101828295B1 (en) * 2011-08-30 2018-02-13 삼성전자 주식회사 Terminal and method for managing application thereof
CN102709949A (en) * 2012-06-15 2012-10-03 中国电力科学研究院 Micro-grid coordinated control system
CN102739491B (en) * 2012-07-13 2015-01-14 上海三一精机有限公司 Ethernet communication master station implementation method
WO2014083381A1 (en) * 2012-11-27 2014-06-05 Freescale Semiconductor, Inc. Redundant packet forwarding system
US9419737B2 (en) * 2013-03-15 2016-08-16 Concio Holdings LLC High speed embedded protocol for distributed control systems
CN104702474B (en) * 2015-03-11 2018-02-23 华中科技大学 A kind of EtherCAT master station devices based on FPGA
CN105259814B (en) * 2015-10-30 2018-01-19 上海交通大学 A kind of multi-robot system and its communication system
CN105553795B (en) * 2015-12-24 2018-10-16 武汉华中数控股份有限公司 A method of the transmission standard Ethernet data in Industrial Ethernet
CN105554012B (en) * 2015-12-28 2019-01-25 天津瑞能电气有限公司 A kind of EtherCAT slave station based on DSP turns the communication unit of Canopen main website
CN105656592B (en) * 2015-12-31 2018-09-21 深圳市汇川技术股份有限公司 EtherCAT communication systems main website and communication means
CN105763641B (en) * 2016-04-19 2019-01-15 华南理工大学 A kind of quick clock synchronous method of EtherCAT main website control system
CN106230541B (en) * 2016-08-05 2018-08-21 深圳市骏龙电子有限公司 A kind of Site synch system and method for Industrial Ethernet

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102271100A (en) * 2011-09-05 2011-12-07 国电南京自动化股份有限公司 Gateway device between EtherCAT industrial Ethernet and wireless Zigbee and protocol conversion method of gateway device
CN102655467A (en) * 2012-03-22 2012-09-05 上海三一精机有限公司 Ethernet field-bus master station structure and control method
CN104620183A (en) * 2012-05-21 2015-05-13 泰塔制造有限责任公司 Automation and motion control system using a distributed control model
US10095224B2 (en) * 2014-03-03 2018-10-09 Samsung Electronics Co., Ltd. EtherCAT control device and factory automation system having the same
CN104281086A (en) * 2014-10-22 2015-01-14 郑州斯倍思机电有限公司 Soft PLC control system based on EtherCAT communication protocol and applied to automatic argon-welding device
CN105024777A (en) * 2015-07-29 2015-11-04 上海新时达电气股份有限公司 Servo driver synchronized method based on Ether CAT real-time Ethernet
CN105187283A (en) * 2015-08-21 2015-12-23 中国科学院计算技术研究所 Industrial control network slave station communication method and device based on EtherCAT protocol

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Ethercat总线分布式多电机控制研究;张桢;《电子科技》;20140615(第6期);第106-116页 *

Also Published As

Publication number Publication date
CN107402534A (en) 2017-11-28

Similar Documents

Publication Publication Date Title
CN107402534B (en) Adjusting method, EtherCAT main station and computer readable storage medium
US9331838B2 (en) Method for synchronizing clocks in nodes of a vehicle network and node designed to perform the method
US9386552B2 (en) Wireless sensor time synchronization
CN107276711B (en) EtherCAT master station device
US9323286B2 (en) Ad-hoc synchronization of industrial control networks
CN107703878B (en) A kind of PLC distributed remote I/O expansion module
CN102769504B (en) A kind of 1588 systems and realize synchronous method
WO2015196685A1 (en) Clock synchronization method and apparatus
JP6495314B2 (en) System and method for maintaining synchronization with low power terminals in a time synchronization channel hopping network
JP5825446B2 (en) Signal synchronization system, node synchronization system, signal synchronization method, and node synchronization method
CN111511013B (en) Method, electronic device, and computer storage medium for synchronizing control signals
CN105049309A (en) Servo driver synchronization method based on POWERLINK real-time Ethernet
US8281177B2 (en) Distributed control system
CN103607270A (en) Method for improving synchronous performance of Powerlink Ethernet
CN104486058A (en) PTP system time synchronization method and device
GB2556844A (en) Random access repeater, relay system and relay method therefor
JP2010061458A (en) Machine controller system and method for synchronizing machine controllers
KR101435181B1 (en) Time synchronization and transmission delay time correction method between the master and the slave of intelligent power distribution system
CN214480655U (en) Embedded equipment compatible with definable deterministic communication Ethernet
CN108427606B (en) Time slice management and control device for scheduling connection and information exchange of motion controller and servo shaft
CN114257469A (en) Communication method, device and medium of EtherCAT main station
Kim et al. Time synchronization method of IEEE 802.1 AS through automatic optimal sync message period adjustment for in-car network
CN111381539A (en) Bus real-time synchronous control device
CN205139676U (en) Local IO extension module of PLC and distributed long -range IO extension module
US20220369416A1 (en) LTE Modem eDRx Paging Opportunity Management

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant