A data frame synchronous communication method, system and numerical control machine tool

By adjusting the master station interrupt time and the adaptive synchronization algorithm (ASA), the time synchronization problem between the CNC system and the servo system was solved, improving the machining accuracy and synchronization performance of the machine tool and reducing data packet loss.

CN116455501BActive Publication Date: 2026-05-19TIANJIN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TIANJIN UNIV
Filing Date
2023-04-14
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In machine tool operation, low control synchronization accuracy and insufficient time synchronization between the CNC system and the servo system lead to low machining accuracy and are prone to data loss problems.

Method used

By adjusting the master station interrupt time, the master-slave clock deviation is obtained by measuring the slave station time, and the master station cycle is adjusted to stabilize the deviation within half an interpolation cycle Ts/2. The adaptive synchronization algorithm (ASA) is used to achieve time synchronization between the CNC system and the reference servo.

Benefits of technology

It effectively solves the time synchronization problem between CNC systems and servo systems, improves machining accuracy, reduces data packet loss, and achieves more precise synchronous cutting. It is suitable for embedded platforms without an operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116455501B_ABST
    Figure CN116455501B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of NC data processing of mechanical manufacturing engineering, and discloses a data frame synchronous communication method, a system and a numerical control machine tool.The data frame synchronous communication method comprises the following steps: adjusting the master station interrupt time to realize master-slave synchronization of a real-time Ethernet protocol EtherCAT; obtaining the clock deviation of the master station and the slave station by using slave station time measurement; and adjusting the master station cycle to stabilize the deviation within half an interpolation period T s / 2.The application proposes a clock synchronization mechanism based on a reference slave station stable sync0.The sync0 is very stable and almost has no jitter, and the jitter is only a few ns.The master station will adjust its trigger time within the interpolation period to adaptively and dynamically solve the packet loss problem caused by the master-slave asynchronization.In addition, the proposed method almost has no increase in calculation and communication load, and only needs to increase 4 bytes within the interpolation period to modify the EtherCAT frame.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of CNC data processing technology in mechanical manufacturing engineering, and particularly relates to a data frame synchronous communication method, system, and CNC machine tool. Background Technology

[0002] EtherCAT is a real-time Ethernet protocol designed specifically for industrial applications, characterized by its high communication efficiency. Due to its excellent real-time communication performance, numerous scientific articles on EtherCAT have appeared in the mechanical engineering field. Previously, Chen Xu proposed a new method for synchronizing the master and reference clocks on Windows. Other scholars, such as S. Park, introduced a new synchronization algorithm on Linux. Some articles introduced a high-precision time synchronization method based on a DSP+FPGA CNC platform. Some articles embedded synchronization frames into EtherCAT frames, improving the synchronization accuracy between EtherCAT master and slave stations. Additionally, some scholars focused on the analysis of distributed clocks. A paper on the accuracy of the EtherCAT distributed clock mechanism analyzed the mechanism from several aspects. Some articles focused on improving the synchronization performance in EtherCAT; although there is a distributed synchronization mechanism between EtherCAT slave stations, synchronization errors still exist. This paper proposed a method to reduce these errors. Some articles proposed an evaluation method to assess the distributed synchronization performance of EtherCAT. Some articles considered many possible influencing factors. Some articles measured and evaluated the accuracy of the distributed clock mechanism in a real network. Sung was interested in the process delay of the EPU.

[0003] Distributed clock mechanisms have superior performance in drive systems composed of servos, but few scholars have studied the EtherCAT synchronization mechanism between CNC systems and servos. Moreover, CNC systems and servos present a chain structure, and there are even fewer synchronization mechanisms applied to embedded CNC systems without an operating system (OS).

[0004] Furthermore, EtherCAT has been widely used in motion control due to its many advantages, such as high-speed transmission of 100Mbps or 1000Mbps, low processor utilization, and good synchronization performance. Although distributed clock synchronization mechanisms have shown strong performance between slave stations, methods for clock synchronization between master and slave stations are still lacking, and research in this area is limited.

[0005] Based on the above analysis, the problems and defects of the existing technology are as follows: In machine tool operation, the control synchronization accuracy is low, and it cannot effectively solve the time (cycle) synchronization between the embedded architecture CNC system and the servo system, making it impossible to perform more precise synchronous cutting in subsequent work; In the existing technology, when the master station adjusts its trigger time within the interpolation cycle, it cannot adaptively and dynamically solve the data packet loss problem caused by the asynchrony between the master station and the slave station, resulting in poor synchronization performance and low machining accuracy in machine tool processing. Summary of the Invention

[0006] To overcome the problems existing in related technologies, the present invention discloses a data frame synchronization communication method, system, and CNC machine tool, specifically relating to a data frame synchronization communication method based on EtherCAT bus for embedded CNC systems.

[0007] The technical solution is as follows: The data frame synchronization communication method is used for distributed architecture CNC systems and reference servos, and the method includes the following steps:

[0008] S1 achieves real-time master-slave synchronization of the EtherCAT Ethernet protocol by adjusting the master station interruption time;

[0009] S2, using slave time measurement to obtain master-slave clock deviation;

[0010] S3, adjust the master station cycle to stabilize the deviation within half an interpolation cycle T. s / 2 within.

[0011] In step S1, real-time EtherCAT master-slave synchronization is achieved by adjusting the master station interruption time, including:

[0012] The master station is a CNC system that obtains the time t for periodic interrupt triggering from the servo driver. interrupt IO data processing time T IO The calculation time T of the CNC system CNC_calc The method to eliminate the time t of periodic interrupt triggering interrupt IO data processing time T IO The calculation time T of the CNC system CNC_calc The time t when the servo slave periodically triggers sync0 sync0 The deviation between them, t sm It is the moment when the servo drive receives the command position after the CNC sends the command position, obtained from the servo drive register by the FPRD command; the moment when the servo slave receives the data frame is t. sm The formula is:

[0013] t sm =t interrupt +T IO +TCNC_calc +T Frame +T Wire_delay

[0014] T safety_interval Updated to:

[0015] T safety_interval =t sync0 -t sm +T Wire_delay

[0016] In the formula, the IO data processing time T IO Calculation time T of the CNC system CNC_calc The time overhead T for loading data frames by the CNC system master station Frame Disappears, while transmission delay T Wire_delay Unrelated to CNC systems; T safety_interval For the safe interval, T wire_delay This is for transmission delay.

[0017] In step S2, obtaining the master-slave clock deviation using slave time measurement includes:

[0018] The slave station includes multiple servo slave stations, and the first servo slave station is a reference servo.

[0019] The CNC system modifies the communication cycle based on the sync0 of the reference servo. The CNC system uses the servo cycle task start time t. sync0 As a reference, and at the time t from the start of the servo cycle task sync0 The CNC master station sends data packets t transmit Send command location at any time; T interupt This is the moment when a periodic interrupt is generated in the ARM; after the interrupt, the CNC system loads the I / O data into the communication buffer, then processes the I / O data, and at t transmit The I / O data frames are constantly transmitted to the cross-connect Ethernet to the real-time Ethernet protocol EtherCAT; I / O data processing time T IO And the calculation time T of the CNC system CNC_calc Obtained through a timer in the CNC system; transmission delay T wire_delay After a delay, the reference servo will receive the command position I / O data, where t represents a moment and T represents a time interval; if the command position is within t... sync0 Previously sent, i.e.:

[0020] T safety_interval =t sync0 -t sm +T wire_delay >0

[0021] In the formula, T safety_interval It is a safe interval, t sync0It is the moment when the servo slave generates the sync0 signal, t transmit It is the moment when the CNC master station sends data packets, t sm T is the time when the servo slave receives the data frame sent by the CNC system. wire_delay It's transmission delay, as long as it's within the safe interval T. safety_interval Data is sent internally without loss.

[0022] In one embodiment, the reference servo is at t sm The location where the command is received, after a certain period of time, i.e., t sync0 -t sm , and then t sync0 The system enters its cyclical task at t; if the drive system is at t sync0 If the CNC system has not yet sent the command position when the command position is being retrieved, a data packet loss occurs; if the CNC system sends the command position earlier or later, the response time for receiving the command position will be smaller or larger, depending on t. sync0 -t sm If the result of t is less than zero, then packet loss occurs; if t sync0 -t sm If the result is a constant, then no data packets are lost. The expression for the constant reference security interval is:

[0023] t sync0 -t sm =T refs_interval =T s / 2

[0024] In the formula, T refs_interval For reference safe interval, T s For the interpolation period, T s / 2 represents half an interpolation cycle.

[0025] In step S3, the master station period is adjusted to stabilize the deviation within half an interpolation period T. s / 2 includes: compensation between the CNC system and the reference servo, and the safety interval T. safety_interval and reference safe interval T refs_interval The larger factor determines whether to advance or delay the interpolation cycle of the CNC system; the safe range is:

[0026] T safety_interval =t sm -t sync0 +T wire_delay

[0027] In the formula, T safety_interval It is a safe interval, t sm It is the moment when the servo slave receives the data frame sent by the CNC system; t sync0 It is the moment when the servo slave generates the sync0 signal; tsm and t sync0 Obtained from the reference servo's register via the FPRD command; T wire_delay It's transmission delay.

[0028] In one embodiment, the compensation between the CNC system and the reference servo specifically includes:

[0029] If the safe interval T safety_interval Greater than the reference safe interval T refs_zone If the clock frequency of the CNC system is greater than the clock frequency of the reference servo, then t sm If the size is reduced, the CNC system will delay triggering the interpolation cycle; otherwise, it will trigger the interpolation cycle earlier.

[0030] In one embodiment, the average pre-compensation in the CNC system The formula is:

[0031]

[0032] In the formula, It is the average pre-compensation length, s CNC and s ref_s These are the sums of n interpolation cycles in the CNC master station and the reference servo, respectively. It is the pre-compensation amount of the servo slave station. It is the symbol for the pre-compensation amount of the servo slave.

[0033] In one embodiment, the compensation length T of the CNC system compensation It is the length of the average pre-compensation. and the remaining compensable length T within the interpolation cycle remain_interval The minimum value between them is expressed as:

[0034]

[0035] In the formula, T compensation It is the compensation length, T CNC It is the communication cycle of the CNC system, T ref It refers to the communication cycle of the reference servo slave, T safety_interval It is a safe interval, T refs_interval It is a reference safe range, T frame It's a 5μs overhead plus an 80ns time overhead per byte of data, T IO It is the I / O data processing time, T CNC_calc This is the calculation time of the CNC master station, where N is the number of cycles, and T is the time of calculation. remain_interval It is the remaining compensable length within the interpolation cycle.

[0036] Another object of the present invention is to provide a data frame synchronization communication system for implementing the data frame synchronization communication method, the system comprising:

[0037] The master-slave synchronization module is used to achieve real-time master-slave synchronization of the EtherCAT Ethernet protocol by adjusting the master station interruption time.

[0038] The master-slave clock deviation acquisition module is used to acquire the master-slave clock deviation by measuring the slave time.

[0039] The deviation stabilization module is used to adjust the master station period, stabilizing the deviation within half an interpolation period T. s / 2 within.

[0040] Another objective of the present invention is to provide a CNC machine tool that implements the data frame synchronization communication method, the CNC machine tool comprising a master station and five slave stations consisting of five servos, the five servos communicating with the master station in a chain structure, the master station running in the CNC system, and the first slave station being a reference servo.

[0041] Combining all the above technical solutions, the advantages and positive effects of this invention are as follows: Addressing the technical problems existing in the prior art and the difficulty of solving these problems, this invention, closely integrating the technical solution to be protected by this invention with the results and data from the research and development process, provides a detailed and in-depth analysis of how the technical solution of this invention solves the technical problems, and the inventive technical effects brought about after solving the problems, as specifically described below:

[0042] The present invention differs from the prior art in the principle of adjusting the interpolation cycle control amount. The prior art is based on PD control, while the present invention is based on the adjustment amount set by the deviation speed.

[0043] The existing technology is mainly aimed at CNC machine tools, but the present invention can be applied to a variety of fields with real-time control requirements, such as controllers; the present invention can be used for industrial products such as motion controllers and PLC controllers.

[0044] The existing technology is geared towards embedded system architecture, but this invention is not limited to embedded architecture systems and is applicable to any architecture system with adjustable communication cycles.

[0045] The ASA method proposed in this invention uses the stable sync0 of the servo as a reference to adaptively adjust the interpolation cycle of the CNC system, effectively solving the time synchronization problem between the CNC system and the reference slave in a distributed architecture.

[0046] This invention proposes the concept of a safety interval, which ensures that the time when the CNC system sends the command position always differs from sync0 by approximately T. s / 2. Regardless of whether the CNC clock is faster or slower than the servo clock, it can effectively ensure that the servo enters its periodic task at time t. sync0 The CNC system can operate at a distance of T from sync0. s The command location is sent ahead of schedule at / 2. The packet loss problem is effectively resolved by ASA.

[0047] Experiment 1 of this invention conducted a comparative experiment between the ASA method and no synchronization method, from... Figure 11 It can be seen that, in the case of asynchronous operation, the synchronization error, i.e., the actual safe interval T, is... safety_interval With reference safety area T refs_interval The deviation fluctuated continuously, with a gradually increasing trend, eventually leading to deviations of multiple interpolation cycles between the CNC system and the reference servo, causing data packet loss and resulting in contour errors. In the experiment, with only 300 cycles, if the interpolation cycle was 2ms (600ms), the synchronization error already reached approximately 30μs. As the synchronization error increased, a deviation the size of one interpolation cycle appeared at 20,000 interpolation cycles. That is, a packet loss occurred at 40s. The CNC system could not perform stable machining at all. However, using the ASA method, the synchronization error consistently fluctuated around 0, ensuring stable machining. Figure 11 It can be seen that using ASA can significantly improve the synchronization performance between the CNC and the reference slave, verifying the effectiveness of the ASA method in compensation within the CNC system. Furthermore, this algorithm enriches the synchronization methods applicable to embedded platforms without an operating system.

[0048] Experiment 1, a comparative experiment, compared the synchronization performance of the no-synchronization, ACF, and ASA methods. Without a synchronization mechanism, time drift between the CNC system and the drive system occurs in each interpolation cycle, and due to accumulation, can even result in a difference of several cycles. The same applies to ACF. However, using ASA, the CNC system and the drive system can achieve good synchronization performance.

[0049] In Experiment 2, the ASA method proposed in this invention exhibited good performance at different interpolation periods of 500 μs, 1 ms, and 2 ms, with an average synchronization accuracy of 32-71 ns. Furthermore, the synchronization accuracy can be controlled.

[0050] The method proposed in this invention adds almost no computational load, and formula (2) is used to obtain the length T of the compensation interval. compenateThe FPRD cmd only adds four bytes of communication load. It can be concluded that as the processor frequency increases, the synchronization accuracy can also be further improved. Therefore, the ASA method can effectively solve the time (beat) synchronization problem between embedded CNC systems and servo systems. Further work can refine the synchronization mechanism and compare it with real cutting experiments.

[0051] Viewing the technical solution as a whole or from a product perspective, the technical effects and advantages of the technical solution protected by this invention are specifically described as follows: EtherCAT is a real-time Ethernet protocol with transmission rates up to 100Mbps or 1000Mbps. Due to its excellent distributed clock (DC) synchronization mechanism, it is widely used in industrial control. The distributed clock synchronization mechanism is embedded in the ET1100 slave chip and is widely used by mainstream servo drive slave manufacturers. However, CNC master stations cannot directly utilize the ET1100 slave chip to leverage the excellent synchronization performance of the distributed clock. For CNC system master stations without a real-time operating system (RTOS), communication reliability cannot be guaranteed. To achieve the goal of applying the high real-time performance and high bandwidth of EtherCAT to the CNC field, this invention proposes an adaptive synchronization control method for machining position between the CNC system and the servo drive. First, it starts with the distributed clock synchronization mechanism, showcasing its outstanding synchronization characteristics between servo drive slave stations. Then, it analyzes the data packet loss phenomenon caused by the asynchrony between the CNC system master station and the servo drive slave station, leading to unstable machining by the CNC system. The causes of packet loss were analyzed, and the concept of a safe interval and a master-slave adaptive synchronization method based on sync0 were proposed. Ultimately, the data transmission delay between the CNC system and the servo drive was eliminated, and the phenomenon of communication data packet loss disappeared, achieving synchronized control of position information between the two. This also elevates the application of the EtherCAT master station to a new level, completely eliminating its independence from the real-time operating system. Experiments verified the overall applicability of the algorithm.

[0052] The ASA method proposed in this invention uses the stable sync0 of the reference servo driver as a reference and adaptively adjusts the interpolation period T. s Pre-compensation was performed, effectively resolving the packet loss problem caused by time asynchrony between the CNC system and the reference servo drive, and eliminating data transmission delay. The concept of a safe interval was introduced. The safe interval ensures that the time when the CNC issues a command position is always approximately T away from sync0. s / 2, regardless of whether the CNC clock is faster or slower than the reference servo clock, it can effectively guarantee t sync0 When the servo enters a cyclic task, the CNC can prepare in advance at a distance of sync0T. sThe command position transmission completed at time / 2 solves the message loss problem. The comparative experiment in Experiment 1 demonstrates that the ASA method effectively solves the packet loss problem. In asynchronous situations, the CNC system and servo drive experience time drift in each interpolation cycle, and this drift can accumulate over several cycles. However, with ASA, the CNC and servo drive exhibit excellent synchronization performance. In the comparative experiment with MSTS, if not limited by the interrupt module, the ASA synchronization error is reduced by 4.182 times compared to MSTS. Furthermore, this algorithm is completely unaffected by real-time systems, not only solving the packet loss problem but also ensuring accurate machining. Moreover, the time consumed by averaging multiple measurements (e.g., 500) is almost halved by ASA compared to MSTS. The results of Experiment 3 show that this algorithm is applicable to servo drives of different brands or manufacturers. In Experiment 4, the proposed ASA method exhibits good synchronization performance at different interpolation cycles of 500μs, 1ms, and 2ms, with an average synchronization accuracy of 32-71ns. Importantly, ASA elevates EtherCAT to a completely new level, enabling the EtherCAT master station to operate independently of the RTOS. This surpasses previous research. Furthermore, this method, based on a simple arithmetic series summation formula, obtains accurate pre-compensation ΔT with almost no increase in computational cost. pre-compensation Adding just two or four bytes to the FPRD command will have almost no impact on communication load. Furthermore, the timing of the CNC master sending the command position and the timing of the reference servo receiving the command position share a common reference t. sync0 This eliminates the accumulated errors caused by the relatively independent absolute timing between the CNC and the reference servo. With increasing processor frequency, the synchronization accuracy can be improved to 1 ns. Therefore, the ASA method can effectively solve the time (cycle) synchronization problem between embedded CNC systems and servo drives without an operating system. This method can also be used for time synchronization communication in distributed multi-master systems.

[0053] Compared to existing technologies, the advantages of this invention include: This invention proposes a clock synchronization mechanism based on a stable sync0 reference slave station. sync0 is highly stable, with almost no jitter, only a few tens of nanoseconds. The master station will adjust its trigger time within the interpolation period to adaptively and dynamically resolve packet loss caused by master-slave asynchrony. Furthermore, the proposed method adds almost no computational and communication load, requiring only an increase of 4 bytes within the interpolation period to modify the EtherCAT frame. Experiments conducted on machine tools demonstrate the advantages of the proposed method in improving synchronization performance, with an average frame jitter of only 32-71 ns.

[0054] This invention expands the application scope of EtherCAT master stations, freeing them from the limitations of real-time operating systems. It proposes an Adaptive Synchronization Algorithm (ASA) for distributed embedded CNC systems and reference servos. The proposed synchronization mechanism adaptively and dynamically adjusts the interpolation cycle instead of adjusting the clock, improving machining accuracy and filling gaps in the EtherCAT protocol. The proposed method adds almost no computational or communication load, requiring only the addition of four bytes within the interpolation cycle to modify the EtherCAT frame. This invention solves the problem of EtherCAT being limited by real-time operating systems. Attached Figure Description

[0055] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure;

[0056] Figure 1 This is a flowchart of the data frame synchronization communication method provided in an embodiment of the present invention;

[0057] Figure 2 This is a schematic diagram of the data frame synchronization communication method provided in an embodiment of the present invention;

[0058] Figure 3 This is a diagram of the EtherCAT data frame structure provided in an embodiment of the present invention;

[0059] Figure 4 This is a diagram illustrating the causes of data packet loss provided in an embodiment of the present invention;

[0060] Figure 5 This is a schematic diagram of the clock model of the numerical control system and drive system provided in the embodiments of the present invention;

[0061] Figure 6 This is a schematic diagram of the temperature drift of the clock source provided in an embodiment of the present invention;

[0062] Figure 7 This is a communication timing diagram of data frames transmitted from the CNC system to the drive system provided in an embodiment of the present invention;

[0063] Figure 8 This is a schematic diagram of the reference safety interval provided in the embodiments of the present invention;

[0064] Figure 9 This is a flowchart of the ASA algorithm provided in an embodiment of the present invention;

[0065] Figure 10 This is a schematic diagram of the shaft experimental platform provided in an embodiment of the present invention;

[0066] Figure 11 This is a schematic diagram of an ASA based on a security interval provided in an embodiment of the present invention;

[0067] Figure 12 This is a schematic diagram of the safe zone transfer to the servo driver provided in an embodiment of the present invention;

[0068] Figure 13 This is the half interpolation period T provided in the embodiment of the present invention. s / 2 Reference safety zone length schematic diagram. Detailed Implementation

[0069] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0070] Example 1, such as Figure 1 As shown, the data frame synchronization communication method provided in this embodiment of the invention is used for a distributed architecture embedded CNC system and a reference servo, and includes the following steps:

[0071] S1 achieves real-time EtherCAT master-slave synchronization by adjusting the master station interruption time, thus freeing the EtherCAT master station from the limitations of the real-time system.

[0072] S2 uses slave time measurement to obtain the master-slave clock deviation; traditional master-slave time deviation measurement uses the master time minus the slave deviation, which has an inherent bias. This method completely eliminates the inherent bias between the two, achieving accurate deviation measurement.

[0073] S3, adjust the master station cycle to stabilize the deviation within half an interpolation cycle T. s / 2 within.

[0074] In this embodiment of the invention, in step S1, the master station is a numerical control system; in step S2, the slave station includes multiple servo slave stations, and the first servo slave station is a reference servo.

[0075] In an embodiment of the present invention, Figure 2 This is the principle of the data frame synchronization communication method provided in the embodiments of the present invention.

[0076] In step S1 of this embodiment of the invention, real-time Ethernet protocol EtherCAT master-slave synchronization is achieved by adjusting the master station interruption time, including:

[0077] To address the data packet loss issue between the CNC system and the servo driver and eliminate data transmission delay, ASA dynamically modifies the CNC system's interpolation period to achieve time synchronization with the reference servo. As mentioned above, the CNC system modifies its own interpolation period based on the reference servo's sync0 value. Figure 11 In the middle, t interrupt It is the interrupt time of the interpolation cycle in ARM, t transmit This is the moment when the CNC master station sends data packets. interrupt After completion, the CNC loads the IO data into the communication buffer, processes the IO data, and then... transmit IO data frames are constantly transmitted to the Ethernet via a crossover Ethernet cable. The CNC system uses the start time t of the servo cycle task. sync0 Based on, at a distance from t sync0 t transmit The servo drive continuously sends command positions to the network. Upon receiving the command position I / O data, it delays for a certain period before resuming its task cycle. Here, 't' represents a moment, and 'T' is the time interval. If the command position is within 't'... sync0 Previously sent, i.e.:

[0078] T safety_interval =t sync0 -(t interrupt +T IO +T CNC_calc +T Frame )>0

[0079] No data packet loss will occur. transmit and t sync0 The interval between them is called T. safety_interval . t sync0 It can be obtained from the driver register via FPRD cmd.

[0080] However, t interrupt And T IO and T CNC_calc They all come from CNC systems, and t sync0 This comes from the servo driver. Due to the different clock sources, t interrupt and t sync0 There is still a discrepancy between them. Therefore, this invention proposes a method that does not obtain t from the CNC system. interrupt T IO and T CNC_calc The time t for periodic interrupt triggering is obtained from the servo driver. interrupt IO data processing time T IO The calculation time T of the CNC system CNC_calc The method to eliminate the time t of periodic interrupt triggering interrupt IO data processing time TIO The calculation time T of the CNC system CNC_calc The time t when the servo slave periodically triggers sync0 sync0 The deviation between them, t sm It is the moment when the servo drive receives the command position after the CNC sends the command position, which is directly obtained from the servo drive register by the FPRD command; the moment when the servo slave receives the data frame is t. sm The formula is:

[0081] t sm =t interrupt +T IO +T CNC_calc +T Frame +T Wire_delay

[0082] T safety_interval Updated to:

[0083] T safety_interval =t sync0 -t sm +T Wire_delay

[0084] In the formula, the IO data processing time T IO The calculation time T of the CNC system CNC_calc The time overhead T for loading data frames by the CNC system master station Frame Disappeared, and T Wire_delay Unrelated to CNC systems; T safety_interval For the safe interval, T wire_delay In addition to reducing transmission delay, this disappearance will reduce the amount of computation required by the processor and improve real-time performance.

[0085] In step S3 of this embodiment of the invention, the master station period is adjusted so that the deviation is stabilized within half an interpolation period T. s / 2 within.

[0086] Figure 12 In the middle, the servo driver is in t sm The command location is received, and after a certain period of time, i.e., t... sync0 -t sm , and then t sync0 Entering its periodic task, if the servo drive is in t sync0 If the CNC system fails to send the received position command, packet loss will occur. If the CNC system sends the position command too early or too late, the time t at which the position command is received will be affected. sm Small or large. t sync0 -t sm The result is variable if t sync0 -t sm If the result of t is less than zero, packet loss will occur.sync0 -t sm If the result is a positive number, then packet loss is impossible. sync0 -t sm Since it's a constant rather than a variable, the processor's computational burden is reduced. Therefore, the concept of a reference safe region is introduced and named T. refs_zone .

[0087] For a suitable length of the ASA reference safety region, the CNC clock is faster in CNC machine tools. Therefore, t in the formula... sm It will be smaller, therefore, the safe interval T safety_interval =t sync0 -t sm +T Wire_delay It will be longer. However, the CNC clock in another CNC machine tool is slower, causing the safety interval T of the other machine tool to be longer. safety_interval The length will be smaller. Therefore, in order to improve the versatility of ASA for both machine tools, a reasonable reference zone value T needs to be set. refs_zone .

[0088] like Figure 13 As shown, assume T refs_zone =T s / 2. If in a machine tool, the CNC system clock is faster than the reference servo clock, then t sm Smaller. However, the command position in the frame must be within t. 1,sync0 Then sent by CNC, t 1,sync0 In the previous interpolation cycle T s The reference servo enters the periodic task at the specified time. Otherwise, it enters the task during the previous interpolation cycle T. s Unprocessed command positions will be overwritten, resulting in packet loss. Therefore, in the previous interpolation cycle, the maximum length of the safe zone is T. s / 2. Even if in another machine tool, the CNC system clock is slower than the reference servo clock, then t sm Larger. The command position in the frame must be within t. 2,sync0 Previously sent by CNC. 2,sync0 It is the current interpolation period T s The reference servo enters the periodic task at the specified time. Otherwise, it enters during the current interpolation period T. s If the command location cannot be received, data packet loss will also occur. Therefore, within the current interpolation period, the maximum length of the safe zone remains T. s / 2. T s The / 2 length reference safety area is meaningful in both machine tools, therefore the reference safety area T refs_zone The length is T s / 2.

[0089] Example 2: The EtherCAT bus master-slave synchronization method for CNC systems provided in this embodiment of the invention includes:

[0090] Step 1, Packet loss analysis between the CNC system and the reference servo:

[0091] Step 1.1, Packet Loss Analysis; EtherCAT is a special Ethernet protocol where Ethernet type 0x88A4 is used, while the widely known TCP / IP or UDP Ethernet type is 0x0800. EtherCAT frames, also known as packets, are embedded in Ethernet frames, just like TCP / IP and UDP. Figure 3 As shown in the EtherCAT data frame structure, a complete EtherCAT frame consists of an Ethernet frame header, an EtherCAT frame header, and an EtherCAT PDU.

[0092] Analysis of the causes of data packet loss, such as Figure 4 As shown. T CNC It is the interpolation cycle of the CNC system, T drive This is the interpolation cycle of the drive system. t wire_delay This is due to network line delay. If the CNC system and the drive system have the same clock source, the CNC system should send the command position to the drive system at time t1. However, the CNC system sends the command position at time t2 instead. The reason is that the crystal oscillator frequency of the CNC system is lower than that of the drive system, causing the actual time interval T of the CNC system to be delayed. CNC In the same interpolation period T s The inner is greater than T drive When the drive system receives a position command, but the CNC system has not yet sent the command, this asynchrony will cause data packet loss.

[0093] Step 1.2, Asynchrony caused by differences in operating frequency and start-up time: The CNC system and the drive system operate from different clock sources, which is the main cause of packet loss. It is almost impossible for the CNC system and the drive system to have the same vibration frequency, such as... Figure 5As shown in the clock model of the CNC system and drive system, even if the crystals of the CNC system and drive system are from the same model and series, a deviation still exists. Taking 15 minutes from 8:00 to 8:15 (UTC+8, also known as Beijing time) as an example, the actual time of the CNC system is 14.9 minutes, while the drive system's is 15.1 minutes within the same 15 minutes. This deviation between the CNC system and drive system causes a discrepancy between the time the CNC system sends the command position and the time the drive system receives the command position, resulting in the CNC system's command position not being received by the drive system. Furthermore, the start-up times of the CNC system and drive system are also inconsistent, leading to an initial difference. This difference also causes a discrepancy between the time the CNC system sends the position and the time the drive system receives the position. Moreover, this difference always exists.

[0094] Step 1.3, Temperature-Induced Asynchrony: Furthermore, there is a phenomenon where the clock frequency of any crystal will drift with temperature. For example... Figure 6 The temperature drift of the clock source shows the clock frequency of the CNC system at different temperatures, while the drive system maintains the same frequency. Temperature drift can also cause timing discrepancies between the CNC system's transmitting position and the drive system's receiving position.

[0095] To address this issue, the traditional approach is to select one of two clock sources as a reference clock source, and use the reference clock as a reference to slightly modify its own clock cycle. However, in many processor architectures, such as ARM, calibrating the clock cycle is very difficult. The ASA (Adaptive Synchronization Algorithm) method proposed in this invention can eliminate the deviation between the CNC system and the drive system without calibrating the clock source frequency.

[0096] Step 2, Adaptive Synchronization Algorithm in CNC Embedded CNC Systems: Essentially, the claim of lost data packets is incorrect. In reality, the drive system always periodically receives position commands from the CNC system. The fundamental problem is that the CNC system fails to send position commands in a timely manner, such as... Figure 4 .

[0097] Step 2.1, Safe Interval Without Losing Data Packets: Few papers propose adjusting time or clocks for synchronization in distributed architectures, but adjusting the time or frequency of the crystal oscillator is not feasible in embedded CNC systems. Therefore, this invention proposes adjusting the interpolation period to achieve synchronization between the CNC system and the servo. Three types of distributed clock synchronization mechanisms exist in the servo, and their synchronization accuracy is analyzed. The mechanism of synchronizing to sync0 is chosen because sync0 is very stable, with only 12ns of jitter. Based on this, the proposed ASA method fully utilizes the very stable sync0 from the reference slave and sets sync0 as the reference to adjust the CNC system's interpolation period.

[0098] like Figure 7 The diagram shows the communication timing of data frames transmitted from the CNC system to the drive system. The timing is determined by T... io ,T CNC_calc ,T frame ,T wire_delay ,T adjust_time ,T servos_delay Composition. T io This is the time it takes to load I / O data into the communication buffer. T CNC_calc This refers to the data transfer time in CNC machining. (T) frame T is the time it takes to transmit IO data frames to Ethernet via a crossover Ethernet cable. frame It takes approximately 5μs of overhead plus 80ns of time per byte. wire_delay The frame delay time from the CNC system to the drive system is called the wire delay, which is 1 μs delay for 100BASE-TX and approximately 5 ns / m line delay. adjust_time This refers to the time taken within the CNC system to address synchronization issues by adjusting the cycle. T servos_delay This is the latency of the servo system. T servos_delay This can be set independently for each server, and is usually 0.

[0099] To address the data packet loss issue between the CNC system and the drive system, ASA can dynamically modify the CNC system's cycle and synchronize it with the reference servo's timing. As mentioned above, the CNC system modifies its communication cycle based on the reference servo's sync0. The CNC system uses the servo cycle task start time t... sync0 As a reference, and at the time t from the start of the servo cycle task sync0 The CNC master station sends data packets t transmit Send command location at any time; T interupt This is the moment when a periodic interrupt is generated in the ARM; after the interrupt, the CNC system loads the I / O data into the communication buffer, then processes the I / O data, and at t transmitConstantly transmit IO data frames to the crossover Ethernet via EtherCAT (Early Real-Time Ethernet Protocol); IO and t CNC_calc This can be obtained through a timer in an embedded CNC system. frame The overhead is approximately 5μs plus 80ns per byte of data. wire_delay Afterwards, the driver system will receive IO data, which represents the command location. wire_delay The base latency on a 100M Ethernet connection is 1μs, plus a 5ns / m cable delay. t represents a moment in time, and T represents the time interval. If the command position is at t... sync0 Previously sent, i.e.:

[0100] T safety_interval =t sync0 -t sm +T wire_delay >0 (1)

[0101] In the formula, t sync0 It is the moment when the servo slave generates the sync0 signal, t sm The moment when the servo slave receives the data frame sent by the CNC system. This is only required within the interval T. safety_interval Data is sent internally without loss.

[0102] Step 2.2, based on the reference safety interval of sync0: such as Figure 8 Referring to the safe interval, the drive system at t sm The location where the command is received, after a certain period of time, i.e., t sync0 -t sm , and then t sync0 It enters its cyclical task. If the drive system is at t sync0 If the CNC system has not yet sent the command position when the command position is being retrieved, data packet loss will occur. The timing of the CNC system sending the command position command, whether earlier or later, will result in a smaller or larger response time when the command position is received. This leads to t sync0 -t sm The result is a variable, if t sync0 -t sm If the result of t is less than zero, packet loss will occur. sync0 -t sm If the result is a positive number, then packet loss is impossible. Furthermore, if the processor calculates constants instead of variables, the computational burden will be reduced. Therefore, t sync0 -t sm =T refs_interval =T s / 2 is set to a constant, which serves as a reference safe interval and is named T. refs_interval Ts For the interpolation period, T s / 2 represents half an interpolation cycle.

[0103] Step 2.3, Compensation range in the embedded CNC system: including compensation between the CNC system and the reference servo, such as... Figure 9 As shown, T safety_interval and T refs_interval The larger value determines whether to advance or delay the CNC system's interpolation cycle. The reference safety interval is T. refs_interval The value is T s / 2. The safe interval is:

[0104] T safety_interval =t sm -t sync0 +T wire_delay

[0105] t sm It is the moment when the drive system receives the command location, t sync0 It is the moment when the command location is obtained and the system enters its periodic task in the drive system, t sm and t sync0 The transmission delay is T, which can be obtained from the reference servo's registers via the FPRD command. wire_delay .

[0106] The specific principle is as follows: Figure 9 As shown, the ASA algorithm includes: if T safety_interval Greater than T refs_zone Therefore, the clock frequency of the CNC system is greater than the clock frequency of the reference servo. Then t sm If the size decreases, the CNC system should delay triggering the interpolation cycle. Otherwise, the interpolation cycle should be triggered earlier. (As shown...) It cannot be directly used for the adaptive adjustment cycle of a CNC system because it is calculated based on the servo drive's clock. The average pre-compensation in a CNC system... The formula is:

[0107]

[0108] In the formula, It is the average pre-compensation length, s CNC and s ref_s These are the sums of n interpolation cycles in the CNC master station and the reference servo, respectively. It is the pre-compensation amount of the servo slave station. It is the symbol for the pre-compensation amount of the servo slave.

[0109] In one embodiment, the compensation length T of the CNC system compensation It is the length of the average pre-compensation. and the remaining compensable length T within the interpolation cycle remain_interval The minimum value between them is expressed as:

[0110]

[0111] In the formula, T compensation It is the compensation length, T CNC It is the communication cycle of the CNC system, T ref It refers to the communication cycle of the reference servo slave, T safety_interval It is a safe interval, T refs_interval It is a reference safe range, T frame It's a 5μs overhead plus an 80ns time overhead per byte of data, T IO It is the I / O data processing time, T CNC_calc This is the calculation time of the CNC master station, where N is the number of cycles, and T is the time of calculation. remain_interval It is the remaining compensable length within the interpolation cycle.

[0112] Example 3: This embodiment of the invention provides a data frame synchronization communication system, comprising:

[0113] The master-slave synchronization module is used to achieve real-time master-slave synchronization of the EtherCAT Ethernet protocol by adjusting the master station interruption time.

[0114] The master-slave clock deviation acquisition module is used to acquire the master-slave clock deviation by measuring the slave time.

[0115] The deviation stabilization module is used to adjust the master station period, stabilizing the deviation within half an interpolation period T. s / 2 within.

[0116] The information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of the present invention. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0117] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this invention. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments.

[0118] The data frame synchronization communication method provided in this invention has been applied to the Tianda Lean S6 series CNC system, enabling the high-performance output of this series of CNC systems.

[0119] Example 4: This embodiment of the invention also provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor executes the computer program to implement the steps in any of the above method embodiments.

[0120] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps described in the various method embodiments above.

[0121] This invention also provides an information data processing terminal, which, when executed on an electronic device, provides a user input interface to implement the steps described in the above method embodiments. The information data processing terminal is not limited to mobile phones, computers, or switches.

[0122] This invention also provides a server that, when executed on an electronic device, provides a user input interface to implement the steps described in the above method embodiments.

[0123] This invention provides a computer program product that, when run on an electronic device, enables the electronic device to implement the steps described in the various method embodiments above.

[0124] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0125] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0126] To verify the positive effects of the data frame synchronization communication method provided in the embodiments of the present invention, the present invention conducts the following experiments.

[0127] The synchronization performance of the proposed method is verified experimentally. For example... Figure 10 The experimental platform consists of a CNC machine tool with one CNC system and five servos arranged in a chain structure. The CNC system is an EtherCAT master, specifically Simple Open EtherCATMaster (SOME), running on an STM32H765TI embedded CNC system with a frequency of 400MHz. The five servos are slaves, i.e., the drive system. The first slave is the reference servo.

[0128] Experiment 1 compared the ASA method with no synchronization method. The synchronization error experiments provided in this embodiment of the invention show that, under different synchronization conditions, the synchronization error, i.e., the actual safety interval T... safety_interval With reference safety area T refs_zoneThe deviation fluctuates and gradually increases, eventually leading to multiple interpolation cycle deviations between the CNC system and the reference servo, causing data packet loss and contour errors. In the experiment, with only 300 cycles, if the interpolation cycle is 2ms (600ms), the synchronization error already reaches approximately 30μs. As the synchronization error increases, a deviation the size of one interpolation cycle appears at 20,000 interpolation cycles. That is, a packet loss occurs at 40s. The CNC system cannot perform stable machining at all. However, using the ASA method, the synchronization error consistently fluctuates around 0, ensuring stable machining. The synchronization error experiments provided in this embodiment of the invention, comparing ASA and no synchronization algorithm, demonstrate that using ASA can significantly improve the synchronization performance between the CNC and the reference slave, verifying the effectiveness of the ASA method in compensating for CNC system errors. Furthermore, this algorithm enriches the synchronization methods applicable to embedded platforms without an operating system.

[0129] In Experiment 2, using a 2m Ethernet cable, the measurement between the CNC system and the reference servo was 1.01μs. The synchronization accuracy of the experiment was 1μs. io and T CNC_calc This can be obtained through a timer in an embedded CNC system. frame The overhead is approximately 5μs plus 80ns per byte of data. CNC It is the interpolation period. Finally, the compensation interval T compensate The length can be obtained through formula (2) to achieve the purpose of interpolation cycle of adaptive CNC system.

[0130] To further evaluate the synchronization performance of ASA, comparative experiment 2 was established. Park proposed a synchronization method between EtherCAT master and slave stations, which converts the deviation between the master station and the reference slave station into the deviation of all servo slave stations (master and reference servo to servos, MSTS). MSTS achieves master-slave synchronization by adjusting the time of all servo drivers instead of the system time of the master station. The experiment was conducted on an embedded system based on STM32H7x at a frequency of 400MHz. Therefore, the maximum frequency of the master station is 400MHz, and the maximum frequency of the timer module in the master station is 200MHz. That is, the maximum precision of the master station timer is 5ns, so the system time error between the master station and the reference servo is also 5ns in precision transmitted to the servo drivers through MSTS. However, due to the limitation of the interrupt module in STM32H7x, the precision of the interrupt module is only 50ns, and the interpolation period of CNC is generated by the interrupt module. Therefore, the interpolation period adjusted by ASA is only a multiple of 50ns.

[0131] Table 1 Synchronization errors of different methods

[0132]

[0133] Table 1 presents the data analysis of the ASA and MSTS experiments. The synchronization error experimental results of the ASA and MSTS methods provided in this invention show that the synchronization error of MSTS is slightly smaller than that of ASA. This is due to the limitations of the master station interrupt module. If the ASA precision can also be adjusted by 5ns, the synchronization error will be smaller than that of MSTS, as detailed below. ASA can only adjust the interpolation period T in 50ns increments. s This is far greater than the MSTS 5ns adjustment unit. Furthermore, the servo drive's time accuracy is 1ns, and this 1ns adjustment comes from the ETG's time control loop. Therefore, the MSTS adjustment unit accuracy is 1-5ns. Formula (3) is the relationship between the pre-compensation sequence and jitter, which can be expressed by the formula e = T. safety_interval -T refs_zone This is known from the experiment. In the experimental part, jitter is called synchronization error. In formula (4), since n is 500, because the last term e n+1 The difference between subtracting the first term e1 is far less than 500 synchronization errors e. i The sum of , so formula (4) is approximated as formula (5), ignoring the first two terms of formula (4), and the proportionality coefficient k is 1. e mean It is the synchronization error e i The average of the sums. Therefore, it can be concluded that the average pre-compensation is proportional to the average synchronization error. Therefore, if the interpolation period T s The adjustment unit, i.e., the average pre-compensation, is reduced by a factor of 10, from 50ns to 5ns, which reduces the average synchronization error by a factor of 10. The experiment used the average value of multiple measurements. Based on the average synchronization error, it can be accurately deduced that if the ASA accuracy is adjusted to 5ns without the limitation of the interrupt module, then the ASA synchronization error of 42.296ns / 10 = 4.23ns will be significantly less than the 17.668ns in MSTS, a reduction of 4.182 times.

[0134]

[0135]

[0136]

[0137] As can be seen, MSTS uses the master clock as a reference to adjust the time of all servo drives. Therefore, the time accuracy and machining accuracy of the servo drives depend entirely on the real-time performance of the master station. If the master station is not a real-time system or its real-time performance is not very good, such as an experimental platform like the ARM STM32H7x without an RTOS, although packet loss will not occur, the interpolation accuracy and machining accuracy will be greatly reduced. However, ASA, based on the extremely stable sync0, is completely unaffected by the RTOS, not only solving the packet loss problem but also enabling stable and accurate machining. In addition, the average time consumption for multiple measurements (e.g., 500 times) in ASA is 1228ns, while that of MSTS is 2440ns. The computational overhead is almost halved.

[0138] Experiment 3, to verify the universality of the proposed ASA, was conducted on different servo drives. The experiment still consisted of one CNC system master station and five servo slave stations. The five servo drives comprised two CTB servo drives and three Jiutong servo drives. In one experiment, the servo from CTB was used as the reference servo, i.e., the first slave station. In the other experiment, the reference servo came from the three Jiutong servo drives. Table 2 shows the results of the two experiments. As can be seen from Table 2, the results of the two experiments are very similar in terms of maximum synchronization error, minimum synchronization error, and average synchronization error. This is because the proposed ASA method is independent of the servo brand or manufacturer; it only depends on the EtherCAT slave chip or FPGA core in the servo drive, and both EtherCAT slave chips and FPGA cores come from the same ETG technology group. Therefore, the ASA algorithm proposed in this invention is applicable to different servo brands or manufacturers.

[0139] Table 2 Synchronization Errors of Different Servo Slave Manufacturers

[0140]

[0141] Experiment 4 involved the EtherCAT master station sending command positions with interpolation cycles of 500μs, 1ms, and 2ms. In the experiment with a 500μs interpolation cycle provided in this invention, the sample size was 1200. The experimental results showed that the maximum synchronization error was 929ns, and the average synchronization error was only 61ns. This invention also presented an experiment with a 1ms interpolation cycle for the CNC system, with a total of 3400 samples. The experimental results showed that the maximum synchronization error was 769ns. Finally, this invention presented an experiment with a 2ms interpolation cycle for the CNC system, also with a total of 3400 samples. The experimental results showed that the maximum synchronization error was only 749ns.

[0142] To further demonstrate the performance of the proposed method, each experiment was repeated more than five times using the ASA method, and the maximum synchronization error, minimum synchronization error, and average synchronization error were analyzed, as shown in Table 3. The maximum synchronization error is a positive value, indicating that the time when the CNC system sends the command position lags behind the servo driver's sync0 by a distance greater than T. s / 2,T s / 2 is the length of the reference safety region. The minimum synchronization error is negative, indicating that the time when the command position is sent lags behind the servo driver's sync0 by a distance less than T. s / 2. The average synchronization error represents the time at which the CNC system sends a command position relative to t. sync0 -T s The average deviation between / 2. The maximum synchronization error is only 471-611ns. This means that the distance from the CNC command sending position to sync0 is T. s / 2+471-611ns. The minimum synchronization error is -909 to -609ns, and the average synchronization error is 32-71ns. That is, the average distance between the time when the CNC sends the command position and sync0 is only T. s / 2+32~71ns. That is, T is the time before the servo driver receives the command position. s At time / 2, the CNC can almost stably complete the transmission of command positions. Therefore, packet loss is impossible. This demonstrates the excellent stabilization effect of ASA. The smaller the synchronization error, the more stable the distance from sync0. s / 2. CNC can be located at a distance of T from sync0. s / 2 is the stable command issuance position, and sync0 is the moment when the servo driver enters a periodic task. ASA effectively avoids packet loss. Therefore, the PDJC proposed in this invention can effectively solve the packet loss problem.

[0143] Table 3 Synchronization error for different interpolation periods

[0144]

[0145] The ASA method proposed in this invention uses the stable sync0 of the reference servo driver as a reference and adaptively adjusts the interpolation period T. s Pre-compensation was performed, effectively resolving the packet loss problem caused by time asynchrony between the CNC system and the reference servo drive, and eliminating data transmission delay. The concept of a safe interval was introduced. The safe interval ensures that the time when the CNC issues a command position is always approximately T away from sync0. s / 2, regardless of whether the CNC clock is faster or slower than the reference servo clock, it can effectively guarantee t sync0When the servo enters a cyclic task, the CNC can prepare in advance at a distance from sync0T. s The command position transmission completed at time / 2 solves the message loss problem. The comparative experiment in Experiment 1 demonstrates that the ASA method effectively solves the packet loss problem. In asynchronous situations, the CNC system and servo drive experience time drift in each interpolation cycle, and this drift can accumulate over several cycles. However, with ASA, the CNC and servo drive exhibit excellent synchronization performance. In the comparative experiment with MSTS, if not limited by the interrupt module, the ASA synchronization error is reduced by 4.182 times compared to MSTS. Furthermore, this algorithm is completely unaffected by real-time systems, not only solving the packet loss problem but also ensuring accurate machining. Moreover, the time consumed by averaging multiple measurements (e.g., 500) is almost halved by ASA compared to MSTS. The results of Experiment 3 show that this algorithm is applicable to servo drives from different brands or manufacturers. In Experiment 4, the ASA method proposed in this invention exhibits good synchronization performance at different interpolation cycles of 500μs, 1ms, and 2ms, with an average synchronization accuracy of 32-71ns. Importantly, ASA elevates EtherCAT to a completely new level, enabling the EtherCAT master station to operate independently of the RTOS. This surpasses previous research. Furthermore, this method, based on a simple arithmetic series summation formula, obtains accurate pre-compensation ΔT with almost no increase in computational cost. pre-compensation Adding just two or four bytes to the FPRD command will have almost no impact on communication load. Furthermore, the timing of the CNC master sending the command position and the timing of the reference servo receiving the command position share a common reference t. sync0 This eliminates the accumulated errors caused by the relatively independent absolute timing between the CNC and the reference servo. With increasing processor frequency, the synchronization accuracy can be improved to 1 ns. Therefore, the ASA method can effectively solve the time (cycle) synchronization problem between embedded CNC systems and servo drives without an operating system. This method can also be used for time synchronization communication in distributed multi-master systems.

[0146] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by those skilled in the art within the scope of the technology disclosed in the present invention and within the spirit and principles of the present invention should be covered within the scope of protection of the present invention.

Claims

1. A data frame synchronization communication method, characterized in that, For a CNC system and reference servo with a distributed architecture, the method includes the following steps: S1 achieves real-time master-slave synchronization of the EtherCAT protocol by adjusting the master station interruption time; S2, use slave time measurement to obtain master-slave clock deviation; S3, adjust the master station cycle to stabilize the deviation within half an interpolation cycle. Inside; In step S3, the master station period is adjusted to stabilize the deviation within half an interpolation period. This includes: compensation between the CNC system and the reference servo, and a safe range. and reference safe range The larger factor determines whether to advance or delay the interpolation cycle of the CNC system; the safe range is: ; In the formula, It is a safe zone. It is the moment when the servo slave receives the data frame sent by the CNC system; It is generated by the servo slave. The timing of the signal; and Obtained from the reference servo's register via the FPRD command; It's transmission delay; The compensation between the CNC system and the reference servo specifically includes: If the safe zone Greater than the reference safe range If the clock frequency of the CNC system is greater than the clock frequency of the reference servo, then If the size is smaller, the CNC system will delay triggering the interpolation cycle; otherwise, the interpolation cycle will be triggered earlier. Average pre-compensation in CNC systems The formula is: ; In the formula, It is the average pre-compensated length. and These are the sums of n interpolation cycles in the CNC master station and the reference servo, respectively. It is the pre-compensation amount of the servo slave station. It is the symbol for the pre-compensation amount of the servo slave station; Compensation length of CNC system It is the length of the average pre-compensation. and the remaining compensable length within the interpolation cycle The minimum value between them is expressed as: ; In the formula, It is the compensation length. It is the communication cycle of the CNC system. It refers to the communication cycle of the servo slave. It is a safe zone. It is a reference safe range. yes The overhead plus the time cost of 80ns per byte of data, It is the I / O data processing time. N is the calculation time of the CNC master station, and N is the number of cycles. It is the remaining compensable length within the interpolation cycle.

2. The data frame synchronization communication method according to claim 1, characterized in that, In step S1, real-time EtherCAT master-slave synchronization is achieved by adjusting the master station interruption time, including: The master station is a CNC system that obtains the times for periodic interrupt triggering from the servo driver. IO data processing time Calculation time of CNC system Methods to eliminate the timing of periodic interrupts IO data processing time Calculation time of CNC system and servo slave periodic triggering The moment The deviation between them This refers to the moment when the servo drive receives the command position after the CNC sends it, obtained from the servo drive register by the FPRD command; and the moment when the servo slave receives the data frame. The formula is: ; Updated to: ; In the formula, IO data processing time Calculation time of CNC system The time overhead of loading data frames by the CNC system master station Disappearance, and transmission delay It is unrelated to the CNC system; For the safe zone, This is for transmission delay.

3. The data frame synchronization communication method according to claim 1, characterized in that, In step S2, obtaining the master-slave clock deviation using slave time measurement includes: The slave station includes multiple servo slave stations, and the first servo slave station is a reference servo. The CNC system is based on the reference servo Modify the communication cycle so that the CNC system uses the servo cycle task start time. As a reference, and at the time from the start of the servo cycle task The CNC master station sends data packets Send command location at all times; This is the moment when a periodic interrupt is generated in the ARM architecture; after the interrupt, the CNC system loads the I / O data into the communication buffer, then processes the I / O data, and... Constantly transmitting IO data frames to the crossover Ethernet via EtherCAT (Ethernet Real-Time Protocol); IO data processing time and the calculation time of the CNC system Obtained through a timer in the CNC system; transmission delay After the delay, the reference servo will receive the command position I / O data. Indicates a moment, Indicates a time interval; if the command position is in Previously sent, i.e.: ; In the formula, It is a safe zone. It is generated by the servo slave. The timing of the signal This is the moment when the CNC master station sends data packets. It is the moment when the servo slave receives the data frame sent by the CNC system. It's transmission delay, as long as it's within a safe range. Data is sent internally without loss.

4. The data frame synchronization communication method according to claim 3, characterized in that, Reference servo in The location where the command was received will be determined after a certain period of time. Then It enters its cyclical task; if when the drive system is If the CNC system has not yet sent the command when the command position is being obtained, a data packet loss will occur. If the CNC system sends the command position earlier or later, the response time of receiving the command position will be smaller or larger. If the result is less than zero, a data packet loss occurs. if If the result is a constant, then no data packets are lost. The expression for the constant reference security interval is: ; In the formula, For reference safety range, For the interpolation period, This is half an interpolation cycle.

5. A data frame synchronization communication system, implemented by the data frame synchronization communication method as described in any one of claims 1-4, characterized in that, The system includes: The master-slave synchronization module is used to achieve real-time master-slave synchronization of the EtherCAT Ethernet protocol by adjusting the master station interruption time. The master-slave clock deviation acquisition module is used to acquire the master-slave clock deviation by measuring the slave time. The deviation stabilization module is used to adjust the master station cycle, stabilizing the deviation within half an interpolation cycle. Inside.

6. A CNC machine tool implementing the data frame synchronization communication method according to any one of claims 1-4, characterized in that, The CNC machine tool includes a master station and five slave stations consisting of five servos. The five servos communicate with the master station in a chain structure. The master station runs in the CNC system, and the first slave station is a reference servo.