Ethernet framing jitter optimization method and device, computer equipment, readable storage medium and program product

By dynamically adjusting the redundant time and the reference cycle time, the problem of frame jitter in the industrial automation control system is solved, and the stability and fault tolerance of the system are improved.

CN119341999APending Publication Date: 2025-01-21BEIJING YIHUI INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411432366.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

In industrial automation control systems, the time point of task execution is inconsistent with the expected time point, resulting in frame transmission jitter, affecting the real-time and stability of the system.

Method used

By obtaining the expected execution time point for the current frame task, determine the maximum time in accordance with the reference cycle time and the expected execution time point, dynamically adjust the redundant time, ensure that the task is executed within a reasonable jitter, and update the reference cycle time to adapt to the system to adapt to the system change.

Benefits of technology

It improves the stability of the communication system during the Ethernet frame sending process, enhances the fault tolerance and scheduling flexibility of the system, and ensures efficient and stable communication capabilities when the load changes or uncertain factors increase.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119341999A_ABST
    Figure CN119341999A_ABST
Patent Text Reader

Abstract

The invention relates to an Ethernet frame sending jitter optimization method and device, computer equipment, a computer readable storage medium and a computer program product, relates to the field of Ethernet control, and can improve the stability of system operation. The method comprises the following steps: acquiring a predicted execution time point of a current frame sending task, and determining a maximum time point of the current frame sending task containing redundant time quantity according to reference period time and the predicted execution time point; obtaining a current time point when the current frame sending task is ready to be executed, determining current actual period time according to the difference between the current time point and the predicted execution time point, and updating the reference period time according to the actual period time; and under the condition that the current time point is greater than or equal to the maximum time point, if the current frame sending jitter is reasonable, executing the current frame sending task, determining the maximum time point of the next frame sending task according to the sum of the current time point and the updated reference period time, and determining the current time point as the predicted execution time point of the next frame sending task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Ethernet technology, and in particular to an Ethernet frame jitter optimization method, device, computer equipment, computer-readable storage medium and computer program product. Background Art

[0002] In industrial automation control systems, real-time and determinism are important factors affecting system performance and stability, especially in complex motion control systems, servo control systems and other scenarios. Such systems usually require the master controller to send instructions to multiple slave devices at fixed time intervals and make real-time adjustments based on the feedback data of the devices. In this process, the thread scheduling in the operating system is unstable, especially in the case of multi-tasking, which will cause the time point of task execution to be inconsistent with the expected time point; the real-time performance of the system may also fluctuate due to changes in the scheduling priority of the operating system, delays in thread locks, etc., which will lead to jitter in the frame transmission of the task. If the accuracy of the task cycle is not guaranteed, the stability and accuracy of the servo control will be seriously affected, and problems such as motor jitter and system response lag may occur.

[0003] In order to solve these problems, the existing technology usually increases the fault tolerance of task scheduling by setting a fixed time redundancy to ensure that scheduling deviations within a certain range will not affect the real-time performance of the system. However, the traditional time redundancy method cannot adapt to the dynamic changes in the adaptive system and cannot dynamically adjust the redundancy time according to the actual execution of the task. When the system load fluctuates greatly, the fixed redundancy time is difficult to effectively deal with sudden task delays, making the system less stable during the frame sending process of executing tasks. Summary of the invention

[0004] Based on this, it is necessary to provide an Ethernet frame jitter optimization method, device, computer equipment, computer-readable storage medium and computer program product that can improve the stability of the communication system during Ethernet frame transmission to address the above technical problems.

[0005] In a first aspect, the present application provides an Ethernet frame jitter optimization method, comprising:

[0006] Obtaining an estimated execution time point of the current frame sending task, and determining a maximum time point of the current frame sending task including redundant time according to a reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks;

[0007] Obtaining a current time point when preparing to execute the current frame sending task, determining an actual cycle time of the current frame sending task according to a difference between the current time point and the expected execution time point, and updating the reference cycle time according to the actual cycle time;

[0008] When the current time point is greater than or equal to the maximum time point, if the current frame jitter is reasonable, the current frame task is executed, and the maximum time point of the next frame task is determined based on the sum of the current time point and the updated reference cycle time, and the current time point is determined as the expected execution time point of the next frame task.

[0009] In one of the embodiments, before obtaining the estimated execution time point of the current frame sending task, the method further includes:

[0010] Acquire the first execution time point of the adjacent frame sending tasks; the first execution time point of each group of the adjacent frame sending tasks is determined based on the second execution time points of two adjacent frame sending tasks in the adjacent frame sending tasks;

[0011] The interval time between the adjacent frame sending tasks is calculated according to the first execution time point of the adjacent frame sending tasks, and the reference cycle time is determined.

[0012] In one embodiment, the obtaining the first execution time point of the adjacent frame sending task includes:

[0013] Execute the frame sending task, and determine the interval time between two adjacent frame sending tasks according to the second execution time points of the two adjacent frame sending tasks;

[0014] If the interval between two adjacent frame sending tasks is greater than the preset task period, return to the step of executing the frame sending task until the difference between the adjacent intervals is less than the preset threshold, and determine to enter the normal communication state;

[0015] Based on the second execution time points of two adjacent frame sending tasks in a normal communication state, the first execution time points of the adjacent frame sending tasks are determined.

[0016] In one of the embodiments, after the reference cycle time is updated according to the actual cycle time, the method further includes:

[0017] If the current time point is less than the maximum time point, subtract the maximum time point from the current time point to obtain a frame transmission extension time difference;

[0018] The current frame sending task is executed after waiting for the extended time difference of the frame sending, and the maximum time point is determined as the estimated execution time point of the next frame sending task.

[0019] In one of the embodiments, the rationality check of the jitter of the current transmission frame is performed through the following steps:

[0020] Determine the maximum value of the actual cycle time of the frame sending task according to the comparison result of the actual cycle time of the current frame sending task and the actual cycle time of each historical frame sending task;

[0021] Calculate the difference between the maximum value of the actual cycle time and the maximum time point to obtain the frame jitter range;

[0022] The current frame transmission jitter is determined according to the difference between the current time point and the maximum time point, and the rationality of the current frame transmission jitter is checked according to the comparison result between the current frame transmission jitter and the frame transmission jitter range.

[0023] In one of the embodiments, when the current time point is greater than or equal to the maximum time point, the method further includes:

[0024] If the current frame sending jitter exceeds the frame sending jitter range, then based on the maximum time point, the single reference cycle time is increased to obtain the updated maximum time point of the current frame sending task;

[0025] According to the updated maximum time point, the current frame sending task is executed, and the updated maximum time point is determined as the estimated execution time point of the next frame sending task.

[0026] In a second aspect, the present application also provides an Ethernet frame jitter optimization device, comprising:

[0027] A frame sending time point calculation module is used to obtain the estimated execution time point of the current frame sending task, and determine the maximum time point of the current frame sending task including the redundant time amount according to the reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks;

[0028] A reference cycle time updating module is used to obtain the current time point when the current frame sending task is to be executed, determine the actual cycle time of the current frame sending task according to the difference between the current time point and the expected execution time point, and update the reference cycle time according to the actual cycle time;

[0029] The task execution and time point adjustment module is used to execute the current frame sending task when the current time point is greater than or equal to the maximum time point and if the current frame sending jitter is reasonable, and determine the maximum time point of the next frame sending task based on the sum of the current time point and the updated reference cycle time, and determine the current time point as the expected execution time point of the next frame sending task.

[0030] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0031] Obtaining an estimated execution time point of the current frame sending task, and determining a maximum time point of the current frame sending task including redundant time according to a reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks;

[0032] Obtaining a current time point when preparing to execute the current frame sending task, determining an actual cycle time of the current frame sending task according to a difference between the current time point and the expected execution time point, and updating the reference cycle time according to the actual cycle time;

[0033] When the current time point is greater than or equal to the maximum time point, if the current frame jitter is reasonable, the current frame task is executed, and the maximum time point of the next frame task is determined based on the sum of the current time point and the updated reference cycle time, and the current time point is determined as the expected execution time point of the next frame task.

[0034] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0035] Obtaining an estimated execution time point of the current frame sending task, and determining a maximum time point of the current frame sending task including redundant time according to a reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks;

[0036] Obtaining a current time point when preparing to execute the current frame sending task, determining an actual cycle time of the current frame sending task according to a difference between the current time point and the expected execution time point, and updating the reference cycle time according to the actual cycle time;

[0037] When the current time point is greater than or equal to the maximum time point, if the current frame jitter is reasonable, the current frame task is executed, and the maximum time point of the next frame task is determined based on the sum of the current time point and the updated reference cycle time, and the current time point is determined as the expected execution time point of the next frame task.

[0038] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0039] Obtaining an estimated execution time point of the current frame sending task, and determining a maximum time point of the current frame sending task including redundant time according to a reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks;

[0040] Obtaining a current time point when preparing to execute the current frame sending task, determining an actual cycle time of the current frame sending task according to a difference between the current time point and the expected execution time point, and updating the reference cycle time according to the actual cycle time;

[0041] When the current time point is greater than or equal to the maximum time point, if the current frame jitter is reasonable, the current frame task is executed, and the maximum time point of the next frame task is determined based on the sum of the current time point and the updated reference cycle time, and the current time point is determined as the expected execution time point of the next frame task.

[0042] The above Ethernet frame jitter optimization method, device, computer equipment, computer-readable storage medium and computer program product obtain the estimated execution time point of the current frame task, and determine the maximum time point of the current frame task containing redundant time according to the reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame tasks; the current time point when the current frame task is ready to be executed is obtained, and the actual cycle time of the current frame task is determined according to the difference between the current time point and the estimated execution time point, and the reference cycle time is updated according to the actual cycle time; when the current time point is greater than or equal to the maximum time point, if the current frame jitter is reasonable, the current frame task is executed, and the maximum time point of the next frame task is determined according to the sum of the current time point and the updated reference cycle time, and the current time point is determined as the estimated execution time point of the next frame task. In the present application, by presetting the estimated execution time point and introducing the redundant time amount, the fault tolerance of the task is increased, so that the system can adapt to the scheduling fluctuations and time delays in actual operation. Furthermore, by calculating the time difference and updating the reference cycle time, this dynamic adjustment mechanism not only makes task scheduling more flexible, but also ensures that the system can maintain efficient and stable communication capabilities when the load changes or uncertain factors increase. By judging the rationality of jitter and continuing to execute tasks, the system exhibits higher fault tolerance when facing delays or task execution uncertainty. At the same time, the maximum time point and expected execution time point of the next task are dynamically set, so that the entire frame sending process forms a dynamic and adaptive time scheduling mechanism. A complete set of optimization mechanisms for the planning, execution and adjustment of frame sending tasks is realized, which effectively copes with the jitter of frame sending tasks in industrial control and improves the stability of the communication system. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0044] FIG1 is a schematic diagram of a flow chart of a method for optimizing Ethernet frame jitter transmission in one embodiment;

[0045] FIG2 is a schematic flow chart of a method for optimizing Ethernet frame jitter according to another embodiment;

[0046] FIG3 is a structural block diagram of an Ethernet frame jitter optimization device in one embodiment;

[0047] FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0049] In one embodiment, as shown in FIG1 , a method for optimizing Ethernet frame jitter is provided. This embodiment uses the method applied to a server as an example for illustration. It is understandable that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0050] Step S102, obtaining the estimated execution time point of the current frame sending task, and determining the maximum time point of the current frame sending task including the redundant time amount according to the reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks.

[0051] The expected execution time point refers to the frame sending moment expected by the server according to the scheduling mechanism, which is the ideal task execution time within the theoretical cycle time. The reference cycle time is obtained by counting the intervals between previous frame sending tasks to obtain a relatively stable time value, which will serve as a reference for the current frame sending task and guide the timing control of future frame sending tasks. The redundant time amount is a time buffer reserved to deal with uncertain factors in the system, which is used to ensure the real-time performance of the task. The maximum time point is the latest time that the current task is allowed to be delayed. If this time point is exceeded, the task will be considered to have timed out.

[0052] Optionally, the server determines the estimated execution time point based on the execution completion time of the previous cycle. In one embodiment, after the previous cycle ends, the server continues to determine the execution completion time of the previous cycle through the accumulation of an internal timer or other hardware time sources, and determines the estimated execution time point based on the execution completion time of the previous week. The reference cycle time can be an average cycle time calculated based on the interval time between historical adjacent frame sending tasks, which will be used to calculate the estimated execution time point of the next cycle at the current time point. The server will calculate the maximum time point containing the redundant time amount based on the reference cycle time and the estimated execution time point.

[0053] Exemplarily, in a series of frame-sending tasks, the server calculates the interval of each cycle by recording the start time and end time of adjacent tasks. Then, the reference cycle time is determined by taking the average of multiple cycles. The maximum time point determined by the reference cycle time includes redundant time. Redundant time is reserved to cope with factors such as scheduling jitter and network delay to ensure that the real-time and periodicity of the system can be maintained even if jitter occurs.

[0054] Optionally, the server may determine whether to increase or decrease the redundant time in the current task by analyzing the execution status of the previous cycle, such as analyzing the delay time of sending frames in the previous cycle.

[0055] Step S104, obtaining the current time point when preparing to execute the current frame sending task, determining the actual cycle time of the current frame sending task according to the difference between the current time point and the expected execution time point, and updating the reference cycle time according to the actual cycle time.

[0056] The current time point is the current moment obtained by the server when the frame sending task is ready to be executed. It can be obtained through a real-time timer or a hardware clock, and is used to represent the actual execution time of the task, as a benchmark for comparison with the expected execution time point. The actual cycle time refers to the actual execution cycle of the current frame sending task, that is, the time interval between the end of the last frame sending task and the start of the current frame sending task.

[0057] Optionally, the server obtains the current time point before each frame sending task is ready to be executed. After obtaining the current time point, the time point is compared with the previously calculated estimated execution time point to calculate the time difference. Based on the time difference, the server can calculate the actual cycle time of the current frame sending task and update the reference cycle time.

[0058] In one embodiment, the EtherCAT task of Ethernet frame transmission obtains the current time point at the beginning of each periodic task. If the server has not recorded any time point for executing the frame transmission task, the task is considered to be the first time the server executes the frame transmission task. The server uses the current time point as the initial time point and records it as the basis for calculating the cycle time of subsequent tasks. When the initial time point already exists, it means that the server has executed the frame transmission task at least once. In this case, the server will perform a difference operation between the current time point and the previously set estimated execution time point to calculate the actual cycle time.

[0059] Optionally, the current time point can be calibrated with high precision through an external time synchronization mechanism. In one embodiment, applied to a multi-node system, the current time point is calibrated through a GPS clock to ensure the time consistency of each node.

[0060] In some embodiments, the server updates the previous reference cycle time based on the latest actual cycle time. A weighted average method can be used to combine the latest actual cycle time with the previous reference cycle time according to a certain weight to obtain a new reference cycle time. This method can smooth the changes in cycle time and avoid large fluctuations caused by individual abnormal cycles; a fixed-length time window can also be used to calculate the cycle average value within a recent period of time. Whenever a new actual cycle time appears, the earliest cycle time is removed and the new time enters the calculation window; further, based on the current actual cycle time, the feedback from the real-time operation of the server, such as the real-time requirements of the current task, network delays, CPU load, etc., can be considered to dynamically adjust the size of the reference cycle time to adapt to the current state.

[0061] Step S106, when the current time point is greater than or equal to the maximum time point, if the current frame jitter is reasonable, the current frame task is executed, and the maximum time point of the next frame task is determined based on the sum of the current time point and the updated reference cycle time, and the current time point is determined as the expected execution time point of the next frame task.

[0062] Optionally, the server first checks whether the current time point of the current frame sending task to be executed has reached or exceeded the set maximum time point. If it is found that the current time point exceeds or equals the maximum time point, the server further determines whether the current frame sending jitter is within a reasonable range. Jitter refers to the deviation between the actual execution time of the task and the expected time. The reasonable jitter range can be set through empirical data or adaptive adjustment.

[0063] If the current frame jitter is judged to be reasonable, the server continues to execute the current frame sending task. Under the premise of reasonable jitter, even if the current time point is close to or exceeds the maximum time point, the normal execution of the task can still be guaranteed, and the real-time performance will not be affected by a small range of time differences.

[0064] After executing the current frame sending task, the server sets a new maximum time point for the next frame sending task. For example, the maximum time point of the next task can be obtained by adding the current time point to the updated reference cycle time through a simple addition operation. For example, assuming that the current time point is t1 and the updated reference cycle time is Tref, the maximum time point of the next frame sending task is t1 plus Tref.

[0065] Finally, the server uses the execution time of the current task as the estimated execution time of the next frame task. In other words, the current time is not only the end time of the current task, but also the start time of the next task, which is used as a reference point for scheduling the next cycle. As each periodic task is executed, the estimated execution time will be continuously recursively calculated based on the current time.

[0066] In the above Ethernet frame jitter optimization method, by obtaining the estimated execution time point of the current frame sending task, the maximum time point of the current frame sending task including the redundant time amount is determined according to the reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks; the current time point when preparing to execute the current frame sending task is obtained, and the actual cycle time of the current frame sending task is determined according to the difference between the current time point and the estimated execution time point, and the reference cycle time is updated according to the actual cycle time; when the current time point is greater than or equal to the maximum time point, if the current frame sending jitter is reasonable, the current frame sending task is executed, and the maximum time point of the next frame sending task is determined according to the sum of the current time point and the updated reference cycle time, and the current time point is determined as the estimated execution time point of the next frame sending task. In this embodiment, by introducing the redundant time amount, the fault tolerance of the task is increased, so that the system can adapt to the scheduling fluctuations and time delays in actual operation. Furthermore, by calculating the time difference and updating the reference cycle time, the system has the ability to adapt. This dynamic adjustment mechanism not only makes task scheduling more flexible, but also ensures that the system can maintain efficient and stable communication capabilities when the load changes or uncertain factors increase. By judging the rationality of jitter and continuing to execute tasks, the system shows higher fault tolerance when facing delays or task execution uncertainty. At the same time, the maximum time point and expected execution time point of the next task are dynamically set, so that the entire frame sending process forms a coherent, dynamically adaptive time scheduling mechanism. A complete set of optimization mechanisms for the planning, execution and adjustment of frame sending tasks is realized, which effectively copes with the jitter of frame sending tasks in industrial control and improves the stability of the communication system.

[0067] In an exemplary embodiment, before obtaining the estimated execution time point of the current frame sending task in step S102, it also includes: obtaining the first execution time point of adjacent frame sending tasks; the first execution time point of each group of adjacent frame sending tasks is determined based on the second execution time points of two adjacent frame sending tasks in the adjacent frame sending tasks; according to the first execution time points of the adjacent frame sending tasks, the interval time between the adjacent frame sending tasks is calculated to determine the reference cycle time.

[0068] Among them, the execution time point of the adjacent frame sending task is the time point when the server should execute the frame sending action for the adjacent frame sending task. In order to distinguish it from other execution time points in this article, the execution time point of the adjacent frame sending task used to determine the reference cycle time is called the first execution time point; the two adjacent frame sending task execution time points used as basic data to determine the first execution time point are called second execution time points.

[0069] Optionally, before executing the frame sending task, the server obtains the first execution time point of the adjacent frame sending task. In order to accurately obtain the first execution time point, the first execution time point of the adjacent frame sending task is determined based on the second execution time points of the two adjacent tasks. The second execution time point can be the specific moment when the frame sending task is actually executed, so the second execution time points of the two adjacent tasks will be used as basic data to deduce the first execution time point.

[0070] In this embodiment, by obtaining the execution time points of adjacent tasks, calculating the interval time of tasks and dynamically adjusting the reference cycle time, adaptive optimization of task cycle scheduling is achieved, which can effectively reduce the time deviation in frame sending tasks and improve the stability and communication performance of the entire system.

[0071] In an exemplary embodiment, step S102 obtains the first execution time point of adjacent frame sending tasks, including: executing the frame sending task, and determining the interval time between two adjacent frame sending tasks based on the second execution time points of the two adjacent frame sending tasks; if the interval time between two adjacent frame sending tasks is greater than the preset task period, returning to the step of executing the frame sending task until the difference between the adjacent interval times is less than the preset threshold, determining to enter the normal communication state; based on the second execution time points of the two adjacent frame sending tasks in the normal communication state, determining the first execution time point of the adjacent frame sending tasks.

[0072] Among them, the task preset period is the ideal period set by the server for each frame sending task. This period provides a time benchmark for task scheduling. If the interval time exceeds this preset period, the server will take corrective measures. The preset threshold is the task interval time error range allowed by the server. The server determines whether the deviation of the task interval time is within a reasonable range by setting this threshold. If it exceeds this range, the server will readjust the task execution. The normal communication state means that the periodicity of the server task execution has been restored to a reasonable preset period range. At this time, the task execution is stable, the communication process is smooth, and there is no obvious jitter or delay.

[0073] Optionally, the interval between adjacent frame sending tasks is determined by the difference between the second execution time points of two consecutive frame sending tasks, and the interval is used to evaluate whether the task is executed according to a preset period. If the interval is greater than the preset period of the task, it indicates that the execution period of the task deviates from the expected period of the server, and the server will re-enter the frame sending task execution process until the difference in the interval is less than a preset threshold set by the server.

[0074] After the server enters the normal communication state, based on the second execution time point of the adjacent frame sending task, the server determines the first execution time point of the adjacent frame sending task. The first execution time point is the time point at which the server periodically records the completion of the task, and this time point provides a reference for the execution cycle of the subsequent frame sending task of the server.

[0075] In this embodiment, a fault-tolerant adjustment mechanism for the periodic execution of tasks is implemented by setting a preset cycle and a preset threshold. After entering the normal communication state, subsequent scheduling is performed according to the first execution time point of the adjacent frame sending tasks, so that the task cycle is further calibrated and optimized, which can effectively ensure the periodicity of the frame sending tasks, reduce the task execution deviation caused by scheduling jitter or network delay, and improve the stability and robustness of communication.

[0076] In an exemplary embodiment, after updating the reference cycle time according to the actual cycle time, step S104 also includes: if the current time point is less than the maximum time point, subtracting the maximum time point from the current time point to obtain the frame extension time difference; executing the current frame transmission task after waiting for the frame extension time difference, and determining the maximum time point as the expected execution time point of the next frame transmission task.

[0077] The frame delay time difference is the time difference between the maximum time point and the current time point. When the server finds that the task execution time is earlier than the maximum time point, the server will delay the execution of the task until the time difference is zero to ensure that the task will not be executed too early.

[0078] Specifically, after the reference cycle time is updated according to the actual cycle time, if the current time point is earlier than the maximum time point, the server calculates the difference between the maximum time point and the current time point to obtain the extended time difference for sending frames. When the time difference is determined, the server enters the waiting state and executes the current frame sending task only after the extended time difference is reached.

[0079] After completing the execution of the current frame sending task, the server updates the maximum time point of the current task according to the execution result of this task, and determines it as the estimated execution time point of the next frame sending task.

[0080] In this embodiment, under the premise that the current time point is less than the maximum time point, by calculating the frame extension time difference and delaying the execution of the task, the maximum time point is updated to the expected execution time point of the next task, thereby ensuring that the frame sending task will not be executed in advance, and effectively controlling the execution timing of the task, preventing the task from being executed too early and causing an imbalance in the periodic scheduling, ensuring that subsequent tasks can be executed at the exact time point, and ensuring the stability and continuity of the system's periodic scheduling.

[0081] In an exemplary embodiment, step S106 performs a rationality check on the current frame sending jitter through the following steps: determine the maximum value of the actual cycle time of the frame sending task based on the comparison result of the actual cycle time of the current frame sending task and the actual cycle time of each historical frame sending task; calculate the difference between the maximum value of the actual cycle time and the maximum time point to obtain the frame sending jitter range; determine the current frame sending jitter based on the difference between the current time point and the maximum time point, and perform a rationality check on the current frame sending jitter based on the comparison result of the current frame sending jitter and the frame sending jitter range.

[0082] The actual cycle time of historical frame-sending tasks refers to the cycle time of multiple frame-sending tasks recorded by the server during previous executions. These data are used to establish a basis for comparing the cycle performance of the current task with that of historical tasks.

[0083] Specifically, the server compares the actual cycle time of the current frame sending task with the actual cycle time of multiple historical frame sending tasks, and determines the maximum value of the actual cycle time of the frame sending task. This maximum value reflects the longest execution cycle of all frame sending tasks during the server operation process, and is an important reference for evaluating the rationality of the current task jitter.

[0084] Next, the server calculates the difference between the maximum value of the actual cycle time and the maximum time point of the current task to obtain the frame jitter range. The frame jitter range is used to describe the maximum deviation that can occur in the task execution time, which reflects the maximum jitter range that the server can tolerate.

[0085] Then, the server determines the current frame jitter by calculating the difference between the current time point and the maximum time point. The current frame jitter is the difference between the actual execution time of the current task and the maximum allowed time point, indicating the delay phenomenon in the actual execution of the task.

[0086] Finally, the server compares the current frame jitter with the previously calculated frame jitter range. If the current frame jitter is within the allowed jitter range, it is considered reasonable; if the current frame jitter exceeds the jitter range, the server will adjust the task execution time or take corresponding corrective measures to ensure the scheduling accuracy of the server.

[0087] In this embodiment, a rationality check mechanism for frame jitter is used to ensure stable execution of frame periodic tasks, effectively improving the system's fault tolerance and scheduling accuracy, so that the execution time of the frame task can always be maintained within a controllable time range.

[0088] In an exemplary embodiment, in step S106, when the current time point is greater than or equal to the maximum time point, the method also includes: if the current frame jitter exceeds the frame jitter range, then on the basis of the maximum time point, increase the single reference cycle time to obtain the updated maximum time point of the current frame task; according to the updated maximum time point, execute the current frame task, and determine the updated maximum time point as the expected execution time point of the next frame task.

[0089] Optionally, when the server detects that the jitter of the current frame sending task exceeds the set range, the time point is compensated and adjusted by increasing the single reference cycle time based on the base time of the maximum time point. At this time, the server calculates the updated maximum time point and executes the current frame sending task based on this time point. After the frame sending task is executed, the server determines the updated maximum time point as the estimated execution time point of the next frame sending task.

[0090] In this embodiment, the execution time of the frame sending task can be accurately controlled and adjusted, ensuring that the frame sending task will not miss the execution window due to jitter exceeding the allowable range, avoiding task scheduling confusion caused by jitter exceeding the limit, and increasing the single reference cycle time on the basis of the maximum time point to ensure that the task can be executed within the appropriate time range, thereby improving the stability and fault tolerance of the system.

[0091] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present application is illustrated below by using an example, but it should be understood that the embodiment of the present application is not limited to this.

[0092] In an exemplary embodiment, in the IEC61131 runtime environment, EtherCAT communication uses a separate thread for processing, and its communication process follows a fixed pattern. First, the master station generates an EtherCAT frame containing all slave station data segments, and the data segment contains control instructions and status information for the slave station. Then, the master station sends the frame to the network, and the slave station reads and processes the control instructions, and writes its own status information into the frame, replacing the original data. When the data frame returns to the master station, the master station reads the status information of the slave station and performs further processing, such as updating the control instructions or monitoring the system status. This process is repeated continuously to ensure the real-time and deterministic data transmission.

[0093] There are scheduling jitter and execution jitter in the EtherCAT task execution process. When affected by the real-time performance of the system, there is a deviation between the actual execution time of the task and the expected execution time. The frame jitter can be optimized by the steps shown in Figure 2, where:

[0094] Step S202, in the process of calculating the estimated execution time point, when the number of executions of the EtherCAT periodic task reaches a certain value, the system enters the normal periodic communication state and calculates the reference cycle time of the task, which may be the average cycle time.

[0095] The system determines the first time point based on the interval of the second execution time point, and calculates the interval time between adjacent tasks through the first execution time points of adjacent frame-sending tasks to determine the reference cycle time. The reference cycle time can reflect the actual task scheduling of the system and is used to predict the execution timing of future tasks. This operation enables the system to adaptively adjust the task cycle and eliminate task execution deviations caused by scheduling jitter.

[0096] In step S204, the system obtains the current time point and compares it with the expected execution time point to calculate the time difference. Through the time difference, the system can determine the actual cycle time of the current task. Then, the system compares the actual cycle time with the previously recorded reference cycle time. If the actual cycle time deviates, the system will update the reference cycle time to ensure that the execution timing of subsequent tasks is more accurate.

[0097] Step S206, in order to prevent the frame sending task from exceeding the preset period due to excessive jitter, when the task is executed, if the user logic execution time is uncertain, the system will appropriately delay the frame sending task execution time according to the jitter. However, in order to balance the user logic execution time and the real-time requirements of the frame sending task, the system sets a maximum time point. When the execution time of the task exceeds the maximum time point, the system will record the size of the jitter and use the excess as the frame sending jitter value for subsequent scheduling adjustments.

[0098] Step S208, in the EtherCAT communication task, the thread lock introduced due to the thread synchronization operation will cause a large execution jitter, especially when the system real-time performance is affected, the operation time of the thread lock will have a large deviation. In order to deal with this jitter problem, time redundancy is added before the sending point of the task. The size of the redundant time is determined by the maximum jitter range that appeared in the previous task. When the frame sending task is close to execution, the system reserves a certain amount of redundant time before the task execution time point to ensure that even if the task execution deviates, the frame sending task can still be completed within the allowable range.

[0099] On the basis of increasing time redundancy, the system will also update the maximum time point, which is the latest time that the task can be delayed. The time redundancy value is dynamically adjusted according to the occurrence of the maximum jitter, and the redundancy time can be expanded according to the maximum jitter range, thereby improving the system's fault tolerance in the face of jitter.

[0100] When the current time point is greater than or equal to the maximum time point, the system determines the maximum value of the actual cycle time of the frame sending task by comparing the actual cycle time of the current frame sending task with the actual cycle time of each historical frame sending task. The difference between the maximum value and the maximum time point is calculated to obtain the frame sending jitter range.

[0101] Step S210, when the current time point is greater than or equal to the maximum time point, if the current frame jitter is reasonable, the frame task is executed, and the maximum time point of the next frame task is determined based on the sum of the current time point and the updated reference cycle time, and the current time point is determined as the expected execution time point of the next frame task; if the current frame jitter exceeds the set jitter range, the system increases the single reference cycle time based on the maximum time point, and executes the current task according to the updated maximum time point.

[0102] When the current time point is less than the maximum time point, the delay processing is used to calculate the extended time difference of the frame sending, and the frame sending task is executed after the extended time difference ends. After the task is completed, the system will update the maximum time point of the current task as the estimated execution time point of the next frame sending task.

[0103] In this embodiment, the real-time performance of the EtherCAT communication task and the system fault tolerance are effectively improved by dynamically controlling the execution time of the frame sending task, reasonably setting the time redundancy and introducing the maximum time point limit.

[0104] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0105] Based on the same inventive concept, the embodiment of the present application also provides an Ethernet frame jitter device for implementing the Ethernet frame jitter method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more Ethernet frame jitter device embodiments provided below can refer to the limitations of the Ethernet frame jitter method above, and will not be repeated here.

[0106] In an exemplary embodiment, as shown in FIG3 , an Ethernet frame jitter device is provided, comprising: a frame transmission time point calculation module 320, a reference cycle time update module 340 and a task execution and time point adjustment module 360, wherein:

[0107] The frame sending time point calculation module 320 is used to obtain the estimated execution time point of the current frame sending task, and determine the maximum time point of the current frame sending task containing redundant time according to the reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time between adjacent frame sending tasks.

[0108] The reference cycle time update module 340 is used to obtain the current time point when preparing to execute the current frame sending task, determine the actual cycle time of the current frame sending task based on the difference between the current time point and the expected execution time point, and update the reference cycle time based on the actual cycle time.

[0109] The task execution and time point adjustment module 360 ​​is used to execute the current frame sending task when the current time point is greater than or equal to the maximum time point and if the current frame sending jitter is reasonable, and determine the maximum time point of the next frame sending task based on the sum of the current time point and the updated reference cycle time, and determine the current time point as the expected execution time point of the next frame sending task.

[0110] In one embodiment, the frame sending time point calculation module 320 is used to: obtain the first execution time point of adjacent frame sending tasks; the first execution time point of each group of adjacent frame sending tasks is determined based on the second execution time points of two adjacent frame sending tasks in the adjacent frame sending tasks; according to the first execution time points of adjacent frame sending tasks, the interval time of adjacent frame sending tasks is calculated to determine the reference cycle time.

[0111] In one embodiment, the frame sending time point calculation module 320 is used to: execute the frame sending task, and determine the interval time between two adjacent frame sending tasks based on the second execution time points of the two adjacent frame sending tasks; if the interval time between two adjacent frame sending tasks is greater than the preset task period, return to the step of executing the frame sending task until the difference between the adjacent interval times is less than the preset threshold, and determine to enter the normal communication state; based on the second execution time points of the two adjacent frame sending tasks in the normal communication state, determine the first execution time points of the adjacent frame sending tasks.

[0112] In one embodiment, the task execution and time point adjustment module 360 ​​is used to: if the current time point is less than the maximum time point, subtract the maximum time point from the current time point to obtain the frame transmission extension time difference; wait for the frame transmission extension time difference before executing the current frame transmission task, and determine the maximum time point as the expected execution time point of the next frame transmission task.

[0113] In one embodiment, the task execution and time point adjustment module 360 ​​is used to: determine the maximum value of the actual cycle time of the frame sending task based on the comparison result of the actual cycle time of the current frame sending task and the actual cycle time of each historical frame sending task; calculate the difference between the maximum value of the actual cycle time and the maximum time point to obtain the frame sending jitter range; determine the current frame sending jitter based on the difference between the current time point and the maximum time point, and perform a rationality check on the current frame sending jitter based on the comparison result of the current frame sending jitter and the frame sending jitter range.

[0114] In one embodiment, the task execution and time point adjustment module 360 ​​is used to: if the current frame jitter exceeds the frame jitter range, then on the basis of the maximum time point, increase the single reference cycle time to obtain the updated maximum time point of the current frame task; according to the updated maximum time point, execute the current frame task, and determine the updated maximum time point as the expected execution time point of the next frame task.

[0115] Each module in the above-mentioned Ethernet frame jitter optimization device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.

[0116] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG4. The computer device includes a processor, a memory, an input / output interface, a communication interface, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, a near field communication (NFC) or other technologies. When the computer program is executed by the processor, an Ethernet frame jitter optimization method is implemented.

[0117] Those skilled in the art will understand that the structure shown in FIG. 4 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0118] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0119] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0120] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0121] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0122] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0123] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0124] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for optimizing Ethernet frame jitter, characterized in that: The method comprises: Obtaining an estimated execution time point of the current frame sending task, and determining a maximum time point of the current frame sending task including redundant time according to a reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks; Obtaining a current time point when preparing to execute the current frame sending task, determining an actual cycle time of the current frame sending task according to a difference between the current time point and the expected execution time point, and updating the reference cycle time according to the actual cycle time; When the current time point is greater than or equal to the maximum time point, if the current frame jitter is reasonable, the current frame task is executed, and the maximum time point of the next frame task is determined based on the sum of the current time point and the updated reference cycle time, and the current time point is determined as the expected execution time point of the next frame task.

2. The method according to claim 1, characterized in that Before obtaining the estimated execution time point of the current frame sending task, the method further includes: Acquire the first execution time point of the adjacent frame sending tasks; the first execution time point of each group of the adjacent frame sending tasks is determined based on the second execution time points of two adjacent frame sending tasks in the adjacent frame sending tasks; The interval time between the adjacent frame sending tasks is calculated according to the first execution time point of the adjacent frame sending tasks, and the reference cycle time is determined.

3. The method according to claim 2, characterized in that The obtaining the first execution time point of the adjacent frame sending task includes: Execute the frame sending task, and determine the interval time between two adjacent frame sending tasks according to the respective second execution time points of the two adjacent frame sending tasks; If the interval between two adjacent frame sending tasks is greater than the preset task period, return to the step of executing the frame sending task until the difference between the adjacent intervals is less than the preset threshold, and determine to enter the normal communication state; Based on the second execution time points of two adjacent frame sending tasks in a normal communication state, the first execution time points of the adjacent frame sending tasks are determined.

4. The method according to claim 1, characterized in that After the reference cycle time is updated according to the actual cycle time, the method further includes: If the current time point is less than the maximum time point, subtract the maximum time point from the current time point to obtain a frame transmission extension time difference; The current frame sending task is executed after waiting for the extended time difference of the frame sending, and the maximum time point is determined as the estimated execution time point of the next frame sending task.

5. The method according to claim 1, characterized in that The rationality check of the current frame jitter is performed through the following steps: Determine the maximum value of the actual cycle time of the frame sending task according to the comparison result of the actual cycle time of the current frame sending task and the actual cycle time of each historical frame sending task; Calculate the difference between the maximum value of the actual cycle time and the maximum time point to obtain the frame jitter range; The current frame transmission jitter is determined according to the difference between the current time point and the maximum time point, and the rationality of the current frame transmission jitter is checked according to the comparison result between the current frame transmission jitter and the frame transmission jitter range.

6. The method according to claim 5, characterized in that In a case where the current time point is greater than or equal to the maximum time point, the method further includes: If the current frame sending jitter exceeds the frame sending jitter range, then based on the maximum time point, the single reference cycle time is increased to obtain the updated maximum time point of the current frame sending task; According to the updated maximum time point, the current frame sending task is executed, and the updated maximum time point is determined as the estimated execution time point of the next frame sending task.

7. An Ethernet frame jitter optimization device, characterized in that: The device comprises: A frame sending time point calculation module is used to obtain the estimated execution time point of the current frame sending task, and determine the maximum time point of the current frame sending task including the redundant time amount according to the reference cycle time and the estimated execution time point; the reference cycle time is determined based on the interval time of adjacent frame sending tasks; A reference cycle time updating module is used to obtain the current time point when the current frame sending task is to be executed, determine the actual cycle time of the current frame sending task according to the difference between the current time point and the expected execution time point, and update the reference cycle time according to the actual cycle time; The task execution and time point adjustment module is used to execute the current frame sending task when the current time point is greater than or equal to the maximum time point and if the current frame sending jitter is reasonable, and determine the maximum time point of the next frame sending task based on the sum of the current time point and the updated reference cycle time, and determine the current time point as the expected execution time point of the next frame sending task.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.