A high-precision synchronous control method and related device for EtherCAT bus

By setting up a double buffer zone in the EtherCAT slave station and using iterative approximation algorithm and interpolation compensation algorithm, the data loss problem caused by real-time jitter of the EtherCAT bus is solved, and high-precision synchronization control and system stability are achieved, adapting to complex application scenarios.

CN118400218BActive Publication Date: 2024-11-05SHENZHEN YUANHUI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410597423.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2024-11-05
Estimated Expiration
2044-05-14

AI Technical Summary

Technical Problem

In real-time communication, the EtherCAT bus causes real-time jitters in the master station due to network delay and data conflict, resulting in the slave station failing to receive location information in time, which may cause production line downtime or equipment damage. Traditional solutions such as adding buffers or data completion algorithms cannot Ensure high accuracy and real-time.

Method used

Set up a double buffer zone in the EtherCAT slave station, and use the iterative approximation algorithm to calculate the lost data, and complete the data through the data checksum interpolation compensation algorithm to ensure high accuracy and real-timeness of the data.

Benefits of technology

The accuracy of data processing and system stability are improved through double buffer zones and iterative approximation algorithms, and the lost data is quickly recovered, ensuring the system's high-precision synchronous operation, and adapting to complex application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118400218B_ABST
    Figure CN118400218B_ABST
Patent Text Reader

Abstract

The present invention discloses a high-precision synchronous control method for an EtherCAT bus and a related device, wherein the method comprises: setting a double buffer in an EtherCAT slave station, each buffer containing a plurality of storage units; when it is detected that the position data increment of the current cycle is not received, calculating the position data increment of the current cycle by an iterative approximation algorithm; calculating the checksum of the data before the slave station reads the buffer data, if the checksum does not match, switching to another buffer to read the data and triggering a data recovery process to reacquire the lost or damaged data from the master station; at the end of each EtherCAT communication cycle, the slave station writes the position data increment of the current cycle into two buffers, and calculates and stores a new checksum after writing to ensure the synchronization of the data in the two buffers; when data loss is detected, data completion is performed by an interpolation compensation algorithm. The present invention realizes high-precision synchronous control of the EtherCAT bus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of EtherCAT bus drive control, and in particular to an EtherCAT bus high-precision synchronization control method and device, computing equipment, and a computer program product. Background Art

[0002] In scenarios where the EtherCAT bus is used for automated control, real-time communication between the EtherCAT master and slaves is essential to ensure high-precision synchronization and stable operation of the entire system. However, in actual applications, due to network delays, data conflicts or other unpredictable factors, the real-time performance of the EtherCAT master may jitter, resulting in the slave failing to receive the position information sent by the master in a timely manner. When the real-time performance of the EtherCAT master jitters greatly and the task takes a long time, the slave may not receive the position information in the current cycle, which will cause a sudden change in the command position. In extreme cases, it will cause the production line to shut down or even damage the equipment.

[0003] Traditional solutions usually rely on adding buffers or using simple data completion algorithms, which often fail to ensure high accuracy and real-time performance of data. Although adding buffers can alleviate the problem of data loss to a certain extent, the capacity of the buffer is limited. Once the buffer is filled, the new data will overwrite the old data, resulting in an increased risk of data loss. In addition, the design of the buffer usually does not take into account the real-time requirements of the data, causing the data to stay in the buffer for too long, thus affecting the real-time performance of the system. Although data completion algorithms such as linear interpolation can restore lost data to a certain extent, these algorithms are often based on some simplified assumptions and cannot accurately reflect the actual changes in the data. Especially in high-speed motion control systems, small changes in data may have a significant impact on the performance of the system, and traditional solutions are difficult to adapt to complex and changing actual application scenarios.

[0004] Therefore, a more efficient high-precision synchronization control method for EtherCAT bus is needed to ensure that the system can still maintain high-precision synchronization and stable operation in the case of data loss or delay. The present invention studies a high-precision synchronization control method for EtherCAT bus, which effectively solves the problems of data loss and position mutation caused by large real-time jitter of EtherCAT master station and serious time-consuming task by setting double buffer areas in the slave station, using iterative approximation algorithm for data estimation, and using data verification and interpolation compensation algorithm for data completion, thereby ensuring high-precision synchronization and stable operation of the system. Summary of the invention

[0005] In view of the above problems, the present invention is proposed to provide an EtherCAT bus high-precision synchronization control method and device, computing equipment, and computer program product that overcome the above-mentioned problems of low synchronization accuracy and unstable operation.

[0006] According to one aspect of the present invention, there is provided an EtherCAT bus high-precision synchronization control method, comprising:

[0007] A double buffer is set in the EtherCAT slave station, each buffer contains multiple storage units for storing position data increments of multiple cycles, and an additional check field;

[0008] When it is detected that the position data increment of the current cycle has not been received, the position data increment of the current cycle is calculated by an iterative approximation algorithm based on the valid position data increments of the last two cycles in the buffer area;

[0009] Before reading the data from the cache at the slave station, the checksum of the data is calculated and compared with the checksum; if the checksum does not match, the data is switched to another cache area to read and the data recovery process is triggered to retrieve the lost or damaged data from the master station;

[0010] At the end of each EtherCAT communication cycle, the slave writes the position data increment of this cycle into the two buffers, and calculates and stores a new checksum after writing to ensure the synchronization of the data in the two buffers;

[0011] The slave station is equipped with a high-speed EtherCAT network interface to achieve real-time communication with the master station. When data loss is detected, the data is supplemented through an interpolation compensation algorithm.

[0012] In an optional manner, the calculating the position data increment of the current cycle by using an iterative approximation algorithm further includes:

[0013] Set the initial estimate value to the position data increment of the last known valid period, and predict the position data increment of the current period based on the rule set and historical data;

[0014] Set the forgetting factor and weight set to assign weights to each historical data point;

[0015] The number of iterations is set, and the rule set is used for each iteration step to predict the position data increment of the current period based on the historical data to obtain a set of predicted values;

[0016] Assign a weight to each predicted value, calculate its corresponding forgetting weight, weighted average predicted increment, and sum of weights;

[0017] Update the estimate based on the weighted sum and the predicted increment;

[0018] After the iteration is completed, the final estimated value is used as the estimated value of the position data increment of the current cycle and output.

[0019] In an optional manner, the calculation formula of the forgetting weight is:

[0020] ,

[0021] The calculation formula of the weighted average predicted increment is:

[0022] ,

[0023] The calculation formula of the weight sum is:

[0024] ,

[0025] The calculation formula for the estimated value update is:

[0026] ,

[0027] Among them, estimate is the initial estimate, is the i-th prediction increment, is the weight of the i-th predicted value, forgetting_factor is the forgetting factor, is the i-th forget weight, is the i-th predicted value, current_time is the current time, is the time at which the i-th prediction value is assigned its initial weight, is the updated estimate, and estimate is the initial estimate.

[0028] In an optional manner, calculating the checksum of data before reading the buffer data from the slave station further includes:

[0029] Traversing each byte of the data in the buffer area, and adding the value of each byte to the checksum;

[0030] If the data type of the checksum has a size limit, the lower 16 bits of the sum are taken and accumulated to obtain the checksum.

[0031] In an optional manner, the calculation formula of the checksum is:

[0032] ,

[0033] in, is the value of the i-th byte in the packet, n is the number of bytes in the packet, Indicates the lower 16 bits of the sum.

[0034] In an optional manner, the data completion by using an interpolation compensation algorithm further includes:

[0035] Construct a Lagrangian basis function based on each known data point;

[0036] Constructing a Lagrangian polynomial based on known data points and the Lagrangian basis functions;

[0037] Substitute the independent variable values ​​of the missing data points into the Lagrange polynomial to obtain the estimated function value.

[0038] In an optional manner, the Lagrangian basis function is:

[0039] ,

[0040] The Lagrange polynomial is:

[0041] ,

[0042] in, is the value of the independent variable at the known data point, Except The independent variable value of other known data points other than , Π represents the product operation, is the function value at the known data point.

[0043] According to another aspect of the present invention, there is provided an EtherCAT bus high-precision synchronization control device, comprising:

[0044] A dual buffer management module is used to set dual buffers in the EtherCAT slave station. Each buffer contains multiple storage units for storing position data increments of multiple cycles with a checksum field.

[0045] A data increment calculation module, used to calculate the position data increment of the current cycle by an iterative approximation algorithm based on the valid position data increments of the last two cycles in the buffer area when it is detected that the position data increment of the current cycle has not been received;

[0046] A data recovery module is used to calculate the checksum of the data before the slave station reads the data in the cache area and compare it with the checksum; if the checksum does not match, switch to another cache area to read the data and trigger the data recovery process to reacquire the lost or damaged data from the master station;

[0047] The checksum calculation module is used to write the position data increment of the current cycle into two buffers at the end of each EtherCAT communication cycle, and calculate and store a new checksum after writing to ensure the synchronization of the data in the two buffers;

[0048] The data completion module is used to equip the slave station with a high-speed EtherCAT network interface to achieve real-time communication with the master station. When data loss is detected, data completion is performed through an interpolation compensation algorithm.

[0049] According to another aspect of the present invention, there is provided a computing device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0050] According to yet another aspect of the present invention, a computer program product is provided, comprising at least one executable instruction, wherein the executable instruction enables the processor to execute operations corresponding to the above-mentioned EtherCAT bus high-precision synchronization control method.

[0051] According to the scheme provided by the present invention, a double buffer is set in the EtherCAT slave station, each buffer contains multiple storage units for storing position data increments of multiple cycles, and a check field is attached; when it is detected that the position data increment of the current cycle is not received, based on the valid position data increments of the last two cycles in the buffer, the position data increment of the current cycle is calculated by an iterative approximation algorithm; before the slave station reads the buffer data, the checksum of the data is calculated and compared with the checksum; if the checksum does not match, switch to another buffer to read the data and trigger the data recovery process to reacquire the lost or damaged data from the master station; at the end of each EtherCAT communication cycle, the slave station writes the position data increment of the current cycle into two buffers, and calculates and stores a new checksum after writing to ensure the synchronization of the data in the two buffers; the slave station is equipped with a high-speed EtherCAT network interface to realize real-time communication with the master station, and when data loss is detected, the data is supplemented by an interpolation compensation algorithm. The present invention improves the accuracy of data processing by setting a double buffer in the EtherCAT slave station and calculating the lost data using an iterative approximation algorithm. The iterative approximation algorithm is based on historical data and rule sets, and can accurately predict lost data, thereby ensuring high-precision synchronous control of the system. The slave is equipped with a high-speed EtherCAT network interface to ensure real-time communication with the master. At the same time, when data loss is detected, the dual buffer can quickly read data from another buffer to reduce the time for data recovery. In addition, the iterative approximation algorithm and the interpolation compensation algorithm have a fast calculation speed and can quickly obtain an estimated value, further ensuring the real-time performance of the system. By attaching a check field to the buffer data and calculating the checksum for comparison before the slave reads the data, the integrity and accuracy of the data are ensured. When a checksum mismatch is detected, it can quickly switch to another buffer to read the data, trigger the data recovery process, and retrieve the lost or damaged data from the master, further improving the reliability and stability of the system. Parameters such as the initial estimate, forgetting factor, weight set, and number of iterations can be set according to actual needs to adapt to different application scenarios. According to the number and distribution of known data points, more accurate estimates can be obtained by fitting through basis functions and polynomials.

[0052] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0054] Figure 1 A schematic flow chart of a high-precision synchronous control method for an EtherCAT bus according to an embodiment of the present invention is shown;

[0055] Figure 2 A schematic diagram of the framework of an EtherCAT bus high-precision synchronization control device according to an embodiment of the present invention is shown;

[0056] Figure 3 A schematic diagram of the structure of a computing device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0057] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0058] Technical term explanation:

[0059] EtherCAT: It is a fieldbus system based on Ethernet. In the EtherCAT network, when a data frame passes through an EtherCAT node, the node will copy the data and transmit it to the next node, and identify and process the data corresponding to this node. The time for each node to receive and transmit data is less than 1 microsecond. Generally speaking, only one frame of data is needed for all nodes on the network to transmit and receive data. It uses standard IEEE 802.3 Ethernet frame transmission, and the Ethertype is 0x88a4. The master station can communicate with the slave station in broadcast and multicast. If IP routing is required, the EtherCAT communication protocol can be placed in a UDP / IP data packet. EtherCAT is used in fields such as PLC, servo controller, and robot to improve the accuracy and efficiency of the system.

[0060] Figure 1 The flowchart of the high-precision synchronous control method of the EtherCAT bus according to the embodiment of the present invention is shown. Figure 1 As shown, the following steps are included:

[0061] Step S101, a double buffer area is set in the EtherCAT slave station, each buffer area includes a plurality of storage units for storing position data increments of a plurality of cycles, and is accompanied by a check field.

[0062] The dual buffers provide redundant storage for data. When the data in one buffer is lost or damaged for some reason, the data can be read from the other buffer to ensure the continuity and integrity of the data. By storing multiple cycles of position data increments, the slave can use the data in the buffer for interpolation or approximation calculations when data is lost or delayed, which can maintain the real-time and accuracy of the system. The data in each buffer is accompanied by a check field, which can be checked before reading the data to ensure the integrity of the data and reduce system failures caused by data damage.

[0063] Specifically, two independent buffers (buffer A and buffer B) are set in the EtherCAT slave, each of which contains multiple storage units for storing position data increments for multiple cycles. Each storage unit contains a position data increment value and a corresponding check field. At the end of each EtherCAT communication cycle, the slave writes the position data increment of this cycle into the two buffers. During the writing process, the checksum of each storage unit is calculated and stored to ensure the integrity of the data. When the slave needs to read the buffer data, the checksum of the data in the buffer is first calculated and compared with the stored checksum. If the checksum does not match, it means that the data may be damaged or lost. At this time, switch to another buffer to read the data and trigger the data recovery process. When data loss or damage is detected, the slave can use the redundant data in the dual buffers for recovery. For example, an iterative approximation algorithm or an interpolation compensation algorithm can be used to estimate the lost data. As shown in Table 1, buffers A and B store n cycles of position data increments (ΔP1, ΔP2, ..., ΔPn) and corresponding checksums (CHK1, CHK2, ..., CHKn and CHK1', CHK2', ..., CHKn'). When the slave needs to read data from a certain cycle, it first calculates the checksum of the cycle data and compares it with the stored checksum. If the checksum does not match, the data is read from the other buffer.

[0064] Table 1:

[0065]

[0066] Step S102, when it is detected that the position data increment of the current cycle is not received, the position data increment of the current cycle is calculated by an iterative approximation algorithm based on the valid position data increments of the latest two cycles in the buffer area.

[0067] Assuming that the position data increment is continuous and changes smoothly, the missing data can be estimated based on the known data. When the EtherCAT slave detects that the position data increment of the current cycle is not received, the valid position data increment of the last two cycles in the buffer is used to calculate the position data increment of the current cycle through an iterative approximation algorithm.

[0068] For example, the slave checks buffers A and B to find the two most recent consecutive and valid position data increments. The difference between the two valid position data increments is calculated, which represents the position change rate between the two cycles. The position data increment of the current cycle is estimated using the position change rate calculated in the previous step and the position data increment of the previous known valid cycle. Once the position data increment of the current cycle is estimated, the slave can use it as valid data until the next actual position data increment is received. As shown in Table 2, assuming that the following data is in buffer A, the position data increment of the current cycle n has not been received. The position change rate can be calculated using ΔPn-2 and ΔPn-1, and ΔPn can be estimated by an iterative approximation algorithm.

[0069] Table 2:

[0070]

[0071] In an optional manner, the calculating the position data increment of the current cycle by using an iterative approximation algorithm further includes:

[0072] Set the initial estimate value to the position data increment of the last known valid period, and predict the position data increment of the current period based on the rule set and historical data;

[0073] Set the forgetting factor and weight set to assign weights to each historical data point;

[0074] The number of iterations is set, and the rule set is used for each iteration step to predict the position data increment of the current period based on the historical data to obtain a set of predicted values;

[0075] Assign a weight to each predicted value, calculate its corresponding forgetting weight, weighted average predicted increment, and sum of weights;

[0076] Update the estimate based on the weighted sum and the predicted increment;

[0077] After the iteration is completed, the final estimated value is used as the estimated value of the position data increment of the current cycle and output.

[0078] In this embodiment, the position data increment of the current period is estimated by combining the iterative approximation algorithm with the forgetting factor and the weight set, and the estimated value can be dynamically adjusted according to the change of historical data, and has good adaptability to data with periodic or non-periodic changes. Through multiple iterations and weighted processing, the changing trend of the data increment can be more accurately reflected, and iterative updates can be quickly performed according to the newly received data to ensure the real-time response capability of the system. In the case of data loss or abnormality, historical data is used for estimation to maintain the stability of the system.

[0079] The calculation formula of the forgetting weight is:

[0080] ,

[0081] The calculation formula of the weighted average predicted increment is:

[0082] ,

[0083] The calculation formula of the weight sum is:

[0084] ,

[0085] The calculation formula for the estimated value update is:

[0086] ,

[0087] Among them, estimate is the initial estimate, is the i-th prediction increment, is the weight of the i-th predicted value, forgetting_factor is the forgetting factor, is the i-th forget weight, is the i-th predicted value, current_time is the current time, is the time at which the i-th prediction value is assigned its initial weight, is the updated estimate, and estimate is the initial estimate.

[0088] For example, set the initial estimate estimate to the position data increment of the last known valid period, and set the number of iterations N. Set the forgetting factor forgetting_factor (usually less than 1, used to control the influence of historical data). Assign an initial weight to each historical data point .

[0089] For each iteration step i (from 1 to N): predict the position data increment of the current period based on the rule set and historical data .

[0090] Calculate the forget weight of the i-th prediction value

[0091] ,

[0092] Calculate the weighted average forecast increment

[0093] ,

[0094] Calculate the sum of weights

[0095] ,

[0096] Update the estimate based on the weighted average forecast increment and the sum of the weights

[0097] ,

[0098] After the iteration is completed, the final estimated value estimate_update is used as the estimated value of the position data increment of the current cycle and output.

[0099] Assume the following historical data:

[0100] Table 3:

[0101]

[0102] The current time is t, the position data increment has not been received, and the iterative approximation algorithm is used for estimation, assuming that only one iteration is performed:

[0103] Table 4:

[0104]

[0105] Weighted average and estimate update:

[0106] Table 5:

[0107]

[0108] Step S103, before reading the cache data from the slave station, calculate the checksum of the data and compare it with the checksum; if the checksum does not match, switch to another cache area to read the data and trigger the data recovery process to re-acquire the lost or damaged data from the master station.

[0109] Through checksum checking, possible damage or loss of data during transmission or storage can be discovered in time to ensure data integrity and accuracy. When data corruption is detected, it can quickly switch to another cache area to reduce system downtime caused by data errors. By triggering the data recovery process, lost or damaged data can be automatically retrieved from the master station to achieve automatic data repair and update, reducing manual intervention.

[0110] Specifically, before the slave station reads the cache data, the checksum calculated by the slave station is compared with the checksum stored in the cache area. If the checksum does not match, it means that the data may be damaged or lost. Switch to another backup cache area (if there are multiple cache areas) to try to read the data. If the data checksum of the backup cache area also does not match, the data recovery process is triggered, and a data recovery request is sent to the master station, requesting the lost or damaged data to be resent. After receiving the request, the master station resends the data to the slave station. After receiving the new data, the slave station calculates the checksum of the new data and stores it. The execution process of the data verification and data recovery process is shown in Table 6:

[0111] Table 6:

[0112]

[0113] In an optional manner, calculating the checksum of data before reading the buffer data from the slave station further includes:

[0114] Traversing each byte of the data in the buffer area, and adding the value of each byte to the checksum;

[0115] If the data type of the checksum has a size limit, the lower 16 bits of the sum are taken and accumulated to obtain the checksum.

[0116] In this embodiment, the checksum is calculated by accumulating bytes and taking the lower 16 bits. The algorithm is simple and efficient, and does not require special hardware support. The calculation formula of the checksum is:

[0117] ,

[0118] in, is the value of the i-th byte in the packet, n is the number of bytes in the packet, Indicates the lower 16 bits of the sum.

[0119] For example, as shown in Table 7, before starting to traverse the buffer data, the checksum is initialized to 0. The data in the buffer is traversed byte by byte, and the value of each byte is added to the checksum. If the data type of the checksum has a size limit (for example, only 16 bits), the lower 16 bits of the sum are taken after each accumulation, which can be achieved by performing a modulo 2^16 operation on the checksum. When all data are traversed and accumulated, the final result is the checksum.

[0120] Table 7:

[0121]

[0122] In the above table, it is assumed that the data packet contains 4 bytes, and the accumulated value is calculated byte by byte. When the accumulated value exceeds 16 bits, the lower 16 bits are taken as the new accumulated value, and the final accumulated value (after taking the lower 16 bits) is the checksum.

[0123] Step S104, at the end of each EtherCAT communication cycle, the slave station writes the position data increment of the current cycle into the two buffer areas, and calculates and stores a new checksum after writing to ensure synchronization of the data in the two buffer areas.

[0124] Redundant data storage is achieved by writing to two buffers. When a problem occurs in one buffer, the other buffer can be quickly switched. Since both buffers store the same data, the data between them is synchronized. Data can be quickly restored in the event of a failure, reducing the risk of data loss or inconsistency. Data is updated at the end of each EtherCAT communication cycle to ensure the real-time and periodicity of high-precision synchronized industrial automation applications. When reading data, the checksum is compared to detect whether the data has been tampered with or damaged during transmission or storage.

[0125] Step S105, the slave station is equipped with a high-speed EtherCAT network interface to achieve real-time communication with the master station. When data loss is detected, data is supplemented through an interpolation compensation algorithm.

[0126] The high-speed EtherCAT network interface ensures real-time communication between the slave and the master, meeting the real-time requirements of industrial automation systems. When data loss is detected, the interpolation compensation algorithm can automatically complete the data to avoid system performance degradation or failure due to data loss. For example, suppose the slave receives 10 data points sent by the master every second, but suddenly loses the 5th data point at some point. At this time, the slave will start the interpolation compensation algorithm to complete the data. The approximate value of the 5th data point will be calculated based on the values ​​of the 4th and 6th data points and the time interval between them. The slave will then return the approximate value to the master as the completed data.

[0127] In an optional manner, the data completion by using an interpolation compensation algorithm further includes:

[0128] Construct a Lagrangian basis function based on each known data point;

[0129] Constructing a Lagrangian polynomial based on known data points and the Lagrangian basis functions;

[0130] Substitute the independent variable values ​​of the missing data points into the Lagrange polynomial to obtain the estimated function value.

[0131] In this embodiment, the Lagrangian basis function is:

[0132] ,

[0133] The Lagrange polynomial is:

[0134] ,

[0135] in, is the value of the independent variable at the known data point, Except The independent variable value of other known data points other than , Π represents the product operation, is the function value at the known data point.

[0136] The Lagrange interpolation method constructs a polynomial from known data points, which is equal to the original function at the known data points. That is, near the known data points, the Lagrange interpolation polynomial can approximate the original function more accurately, so the estimated function value of the missing data point has a higher accuracy. Once the Lagrange interpolation algorithm determines the known data points, the corresponding Lagrange basis function and polynomial can be constructed based on these data points. It performs better in terms of real-time performance and efficiency, and is suitable for application scenarios that require fast response. In addition, the Lagrange interpolation method is not limited by the number or distribution of data points, and can be flexibly applied to various data completion scenarios. Whether it is a small number of known data points or a large number of data points, the Lagrange interpolation method can effectively complete the data. Even if there are individual abnormal data points, it will not have a significant impact on the entire interpolation result.

[0137] According to the scheme provided by the present invention, a double buffer is set in the EtherCAT slave station, each buffer contains multiple storage units for storing position data increments of multiple cycles, and a check field is attached; when it is detected that the position data increment of the current cycle is not received, based on the valid position data increments of the last two cycles in the buffer, the position data increment of the current cycle is calculated by an iterative approximation algorithm; before the slave station reads the buffer data, the checksum of the data is calculated and compared with the checksum; if the checksum does not match, switch to another buffer to read the data and trigger the data recovery process to reacquire the lost or damaged data from the master station; at the end of each EtherCAT communication cycle, the slave station writes the position data increment of the current cycle into two buffers, and calculates and stores a new checksum after writing to ensure the synchronization of the data in the two buffers; the slave station is equipped with a high-speed EtherCAT network interface to realize real-time communication with the master station, and when data loss is detected, the data is supplemented by an interpolation compensation algorithm. The present invention improves the accuracy of data processing by setting a double buffer in the EtherCAT slave station and calculating the lost data using an iterative approximation algorithm. The iterative approximation algorithm is based on historical data and rule sets, and can accurately predict lost data, thereby ensuring high-precision synchronous control of the system. The slave is equipped with a high-speed EtherCAT network interface to ensure real-time communication with the master. At the same time, when data loss is detected, the dual buffer can quickly read data from another buffer to reduce the time for data recovery. In addition, the iterative approximation algorithm and the interpolation compensation algorithm have a fast calculation speed and can quickly obtain an estimated value, further ensuring the real-time performance of the system. By attaching a check field to the buffer data and calculating the checksum for comparison before the slave reads the data, the integrity and accuracy of the data are ensured. When a checksum mismatch is detected, it can quickly switch to another buffer to read the data, trigger the data recovery process, and retrieve the lost or damaged data from the master, further improving the reliability and stability of the system. Parameters such as the initial estimate, forgetting factor, weight set, and number of iterations can be set according to actual needs to adapt to different application scenarios. According to the number and distribution of known data points, more accurate estimates can be obtained by fitting through basis functions and polynomials.

[0138] Figure 2 The schematic diagram of the structure of the EtherCAT bus high-precision synchronization control device of the embodiment of the present invention is shown. The EtherCAT bus high-precision synchronization control device includes: a double buffer management module 210, a data increment calculation module 220, a data recovery module 230, a checksum calculation module 240 and a data completion module 250.

[0139] The dual buffer management module 210 is used to set dual buffers in the EtherCAT slave station, each buffer comprising a plurality of storage units for storing position data increments of a plurality of cycles, and an accompanying check field;

[0140] The data increment calculation module 220 is used to calculate the position data increment of the current cycle by an iterative approximation algorithm based on the valid position data increments of the last two cycles in the buffer area when it is detected that the position data increment of the current cycle has not been received;

[0141] The data recovery module 230 is used to calculate the checksum of the data before the slave station reads the data in the buffer area, and compare it with the checksum; if the checksum does not match, switch to another buffer area to read the data and trigger the data recovery process to re-acquire the lost or damaged data from the master station;

[0142] The checksum calculation module 240 is used for, at the end of each EtherCAT communication cycle, the slave station writes the position data increment of the current cycle into the two buffer areas, and calculates and stores a new checksum after writing, so as to ensure the synchronization of the data in the two buffer areas;

[0143] The data completion module 250 is used to equip the slave station with a high-speed EtherCAT network interface to achieve real-time communication with the master station. When data loss is detected, data completion is performed through an interpolation compensation algorithm.

[0144] In an optional manner, the calculating the position data increment of the current cycle by using an iterative approximation algorithm further includes:

[0145] Set the initial estimate value to the position data increment of the last known valid period, and predict the position data increment of the current period based on the rule set and historical data;

[0146] Set the forgetting factor and weight set to assign weights to each historical data point;

[0147] The number of iterations is set, and the rule set is used for each iteration step to predict the position data increment of the current period based on the historical data to obtain a set of predicted values;

[0148] Assign a weight to each predicted value, calculate its corresponding forgetting weight, weighted average predicted increment, and sum of weights;

[0149] Update the estimate based on the weighted sum and the predicted increment;

[0150] After the iteration is completed, the final estimated value is used as the estimated value of the position data increment of the current cycle and output.

[0151] In an optional manner, the calculation formula of the forgetting weight is:

[0152] ,

[0153] The calculation formula of the weighted average predicted increment is:

[0154] ,

[0155] The calculation formula of the weight sum is:

[0156] ,

[0157] The calculation formula for the estimated value update is:

[0158] ,

[0159] Among them, estimate is the initial estimate, is the i-th prediction increment, is the weight of the i-th predicted value, forgetting_factor is the forgetting factor, is the i-th forget weight, is the i-th predicted value, current_time is the current time, is the time at which the i-th prediction value is assigned its initial weight, is the updated estimate, and estimate is the initial estimate.

[0160] In an optional manner, calculating the checksum of data before reading the buffer data from the slave station further includes:

[0161] Traversing each byte of the data in the buffer area, and adding the value of each byte to the checksum;

[0162] If the data type of the checksum has a size limit, the lower 16 bits of the sum are taken and accumulated to obtain the checksum.

[0163] In an optional manner, the calculation formula of the checksum is:

[0164] ,

[0165] in, is the value of the i-th byte in the packet, n is the number of bytes in the packet, Indicates the lower 16 bits of the sum.

[0166] In an optional manner, the data completion by using an interpolation compensation algorithm further includes:

[0167] Construct a Lagrangian basis function based on each known data point;

[0168] Constructing a Lagrangian polynomial based on known data points and the Lagrangian basis functions;

[0169] Substitute the independent variable values ​​of the missing data points into the Lagrange polynomial to obtain the estimated function value.

[0170] In an optional manner, the Lagrangian basis function is:

[0171] ,

[0172] The Lagrange polynomial is:

[0173] ,

[0174] in, is the value of the independent variable at the known data point, Except The independent variable value of other known data points other than , Π represents the product operation, is the function value at the known data point.

[0175] Figure 3 A schematic diagram of the structure of an embodiment of a computing device of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computing device.

[0176] like Figure 3 As shown, the computing device may include: a processor (processor) 302 , a communication interface (Communications Interface) 304 , a memory (memory) 306 , and a communication bus 308 .

[0177] The processor 302, the communication interface 304, and the memory 306 communicate with each other via the communication bus 308. The communication interface 304 is used to communicate with other devices such as a client or other server network elements. The processor 302 is used to execute the program 310, which can specifically execute the relevant steps in the above-mentioned EtherCAT bus high-precision synchronization control method embodiment.

[0178] Specifically, the program 310 may include program codes, which include computer operation instructions.

[0179] The processor 302 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present invention. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0180] The memory 306 is used to store the program 310. The memory 306 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0181] According to the scheme provided by the present invention, a double buffer is set in the EtherCAT slave station, each buffer contains multiple storage units for storing position data increments of multiple cycles, and a check field is attached; when it is detected that the position data increment of the current cycle is not received, based on the valid position data increments of the last two cycles in the buffer, the position data increment of the current cycle is calculated by an iterative approximation algorithm; before the slave station reads the buffer data, the checksum of the data is calculated and compared with the checksum; if the checksum does not match, switch to another buffer to read the data and trigger the data recovery process to reacquire the lost or damaged data from the master station; at the end of each EtherCAT communication cycle, the slave station writes the position data increment of the current cycle into two buffers, and calculates and stores a new checksum after writing to ensure the synchronization of the data in the two buffers; the slave station is equipped with a high-speed EtherCAT network interface to realize real-time communication with the master station, and when data loss is detected, the data is supplemented by an interpolation compensation algorithm. The present invention improves the accuracy of data processing by setting a double buffer in the EtherCAT slave station and calculating the lost data using an iterative approximation algorithm. The iterative approximation algorithm is based on historical data and rule sets, and can accurately predict lost data, thereby ensuring high-precision synchronous control of the system. The slave is equipped with a high-speed EtherCAT network interface to ensure real-time communication with the master. At the same time, when data loss is detected, the dual buffer can quickly read data from another buffer to reduce the time for data recovery. In addition, the iterative approximation algorithm and the interpolation compensation algorithm have a fast calculation speed and can quickly obtain an estimated value, further ensuring the real-time performance of the system. By attaching a check field to the buffer data and calculating the checksum for comparison before the slave reads the data, the integrity and accuracy of the data are ensured. When a checksum mismatch is detected, it can quickly switch to another buffer to read the data, trigger the data recovery process, and retrieve the lost or damaged data from the master, further improving the reliability and stability of the system. Parameters such as the initial estimate, forgetting factor, weight set, and number of iterations can be set according to actual needs to adapt to different application scenarios. According to the number and distribution of known data points, more accurate estimates can be obtained by fitting through basis functions and polynomials.

[0182] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and further may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature that provides the same, equivalent or similar purpose. In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and to form different embodiments. For example, in the following claims, any one of the claimed embodiments may be used in any combination. The present invention may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several means, several of these means may be embodied by the same hardware item. The steps in the above embodiments should not be understood as limiting the execution order unless otherwise specified.

Claims

1. A high-precision synchronous control method for EtherCAT bus, characterized in that: include: A double buffer is set in the EtherCAT slave station, each buffer contains multiple storage units for storing position data increments of multiple cycles, and an additional check field; When it is detected that the position data increment of the current cycle has not been received, the position data increment of the current cycle is calculated by an iterative approximation algorithm based on the valid position data increments of the last two cycles in the buffer area; The calculation of the position data increment of the current cycle by the iterative approximation algorithm comprises: Set the initial estimate value to the position data increment of the last known valid period, and predict the position data increment of the current period based on the rule set and historical data; Set the forgetting factor and weight set to assign weights to each historical data point; The number of iterations is set, and the rule set is used for each iteration step to predict the position data increment of the current cycle based on the historical data to obtain a set of predicted values; Assign a weight to each predicted value, calculate its corresponding forgetting weight, weighted average predicted increment, and sum of weights; The calculation formula of the forgetting weight is: The calculation formula of the weighted average predicted increment is: The calculation formula of the weight sum is: The calculation formula for the estimated value update is: Among them, estimate is the initial estimated value, is the i-th prediction increment, is the weight of the i-th predicted value, forgetting_factor is the forgetting factor, is the i-th forget weight, is the i-th predicted value, current_time is the current time, is the time at which the i-th prediction value is assigned its initial weight, is the updated estimate, and estimate is the initial estimate; Update the estimate based on the sum of weights and the forecast increment; After the iteration is completed, the final estimated value is used as the estimated value of the position data increment of the current cycle and output; Before reading the data from the cache at the slave station, the checksum of the data is calculated and compared with the checksum; if the checksum does not match, the data is switched to another cache area to read and the data recovery process is triggered to retrieve the lost or damaged data from the master station; At the end of each EtherCAT communication cycle, the slave writes the position data increment of this cycle into the two buffers, and calculates and stores a new checksum after writing to ensure the synchronization of the data in the two buffers; The slave station is equipped with a high-speed EtherCAT network interface to achieve real-time communication with the master station. When data loss is detected, the data is supplemented through an interpolation compensation algorithm.

2. The EtherCAT bus high-precision synchronization control method according to claim 1, characterized in that: The step of calculating the checksum of data before reading the buffer data from the slave station further comprises: Traversing each byte of the data in the buffer area, and adding the value of each byte to the checksum; If the data type of the checksum has a size limit, the lower 16 bits of the sum are taken and accumulated to obtain the checksum.

3. The EtherCAT bus high-precision synchronization control method according to claim 2, characterized in that: The calculation formula of the checksum is: in, is the value of the i-th byte in the packet, n is the number of bytes in the packet, Indicates the lower 16 bits of the sum.

4. The EtherCAT bus high-precision synchronization control method according to claim 1, characterized in that: The data completion by interpolation compensation algorithm further comprises: Construct a Lagrangian basis function based on each known data point; Constructing a Lagrangian polynomial based on known data points and the Lagrangian basis functions; Substitute the independent variable values ​​of the missing data points into the Lagrange polynomial to obtain the estimated function value.

5. The EtherCAT bus high-precision synchronization control method according to claim 4, characterized in that: The Lagrangian basis function is: The Lagrange polynomial is: in, is the value of the independent variable at the known data point, Except The independent variable value of other known data points other than represents the product operation, is the function value at the known data point.

6. An EtherCAT bus high-precision synchronization control device, characterized in that: The method for implementing the high-precision synchronization control of the EtherCAT bus according to any one of claims 1 to 5 comprises: A dual buffer management module is used to set dual buffers in the EtherCAT slave station. Each buffer contains multiple storage units for storing position data increments of multiple cycles with a checksum field. A data increment calculation module, used to calculate the position data increment of the current cycle by an iterative approximation algorithm based on the valid position data increments of the last two cycles in the buffer area when it is detected that the position data increment of the current cycle has not been received; A data recovery module is used to calculate the checksum of the data before the slave station reads the data in the cache area and compare it with the checksum; if the checksum does not match, switch to another cache area to read the data and trigger the data recovery process to reacquire the lost or damaged data from the master station; The checksum calculation module is used to write the position data increment of the current cycle into two buffers at the end of each EtherCAT communication cycle, and calculate and store a new checksum after writing to ensure the synchronization of the data in the two buffers; The data completion module is used to equip the slave station with a high-speed EtherCAT network interface to achieve real-time communication with the master station. When data loss is detected, data completion is performed through an interpolation compensation algorithm.

7. A computing device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the EtherCAT bus high-precision synchronization control method according to any one of claims 1-5.

8. A computer program product, comprising at least one executable instruction, wherein the executable instruction enables a processor to execute operations corresponding to the EtherCAT bus high-precision synchronization control method according to any one of claims 1 to 5.