Method for cross-referencing deterministic data through multiple tasks of PLC

By introducing a locking mechanism, a task load prediction module and an adaptive jitter compensation mechanism in PLC, combined with a hash function and a filtering algorithm, the jitter and cache efficiency problems of multi-task cross-reference data in PLC are solved, and the data is determined and accurate, improving the system's adaptability and operation efficiency.

CN120256131AActive Publication Date: 2025-07-04BEIJING ASTRONAUTICS JUHENG SYST INTEGRATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510713163.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-30
Publication Date
2025-07-04
Estimated Expiration
2045-05-30

AI Technical Summary

Technical Problem

In multi-task cross-reference data operation, PLC has problems such as large jitter, simple data cache structure, lack of efficiency and insufficient communication jitter capability for the system, resulting in data instability and incorrect reference.

Method used

The locking mechanism, counter and task load prediction module are adopted, combined with neural network algorithm to adjust parameters, set shadow registers and pre-cache layers, use hash functions and data redundancy verification mechanism, combine Kalman filtering and particle filtering algorithm for jitter compensation, dynamically adjust task priority and temporary locking interval to ensure data certainty and accuracy.

Benefits of technology

It improves the data processing efficiency and accuracy of the PLC system under different loads and jitter conditions, enhances the adaptability to jitter, ensures the certainty and integrity of the data, and optimizes the task priority adjustment strategy.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention discloses a PLC multi-task cross reference deterministic data method, which comprises the steps that a locking mechanism, a counter and a task load prediction module are arranged, and the task load prediction module collects multi-dimensional data and adjusts locking parameters through neural network algorithm analysis. Data caching is triggered when a preset cycle number is calculated, a shadow register and a pre-caching layer are arranged, a hash function is combined, a hash value is calculated during storage, feature information is recorded, and checking is carried out before reading. And a self-adaptive jitter compensation mechanism is combined with two filtering algorithms. And the pre-cache layer stores data in a classified manner according to time correlation. The counter has a double-counting mode to deal with task abnormity. And a task priority dynamic evaluation adjustment and historical record library is also provided. The hash function has a data redundancy check mechanism. The locking mechanism comprises a temporary locking interval, and the jitter time adopts a multi-dimensional statistical method. According to the method, the data certainty and accuracy are guaranteed from multiple aspects, the system efficiency is improved, and the adaptive capacity of the system to jitter in different operation states is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of PLC applications, and particularly to a method for PLC multi-task cross-reference deterministic data. Background Art

[0002] In the field of modern industrial automation control, PLC (Programmable Logic Controller) is widely used in the control and management of various production processes. With the increasing complexity of industrial systems, PLC often needs to process multiple tasks simultaneously, which involves cross-reference data operations of multiple tasks.

[0003] Generally, there are multiple tasks in a common PLC, assumed to be Task 1 and Task 2. Task 1 will reference the data of Task 2 for calculation within its own task cycle. Similarly, Task 2 will reference the data of Task 1 for calculation within its own task cycle. However, Task 1 and Task 2 of the system run independently. When Task 1 references the data of Task 2, it is required that the data refresh of Task 2 is stable and periodic. For example, if Task 1 has a 1ms cycle and Task 2 has a 4ms cycle. If the cycle for Task 2 to reference Task 1 is sometimes 4mS, sometimes 5mS, and sometimes 3mS (3 Task 1 cycles), then the reference method for Task 2 will have a large jitter and cannot be accurately calculated.

[0004] Moreover, in terms of data caching and reference, the data caching structure of the traditional method is simple. There is no concept of a pre-caching layer, and data directly enters a single caching structure (a traditional cache similar to a shadow register). In this way, the organization and management of data lack efficiency. At the same time, in dealing with system communication jitter, the traditional PLC multi-task data processing method uses a relatively simple way to handle system communication jitter. It only determines the delay size of data caching based on limited historical experience or fixed statistical parameters, without an accurate jitter estimation and compensation mechanism, which easily leads to data instability and incorrect reference, and cannot meet the working requirements of PLC applications. Therefore, a method for PLC multi-task cross-reference deterministic data is proposed. Summary of the Invention

[0005] The present invention provides the following technical solutions: A method for PLC multi-task cross-reference deterministic data, including the following steps: S1: Set a locking mechanism within an integer multiple interval of the task cycle; S2: Set a counter and a task load prediction module to count the number of cycles of Task 1 and Task 2, and at the same time, perform data prediction through the task load prediction module, and adjust the relevant parameters of the locking mechanism in advance according to the prediction results; S3: When the timing reaches the preset number of cycles, directly trigger or delay the trigger of the corresponding data cache; S4: Set a shadow register and a pre-cache layer to store the data at the time of trigger. At the same time, in combination with the hash function, calculate the hash value of the data when the data is stored in the shadow register, store it together with the data, and recalculate the hash value of the data before the data is read and referenced, and compare it with the stored hash value; S5: Before the next data read reference, lock the data in the shadow register to ensure that the data is no longer refreshed; S6: By statistically analyzing the jitter time of the system communication, determine a reasonable delay size to ensure a deterministic correspondence relationship of the latched data. On this basis, establish an adaptive jitter compensation mechanism, and use dynamic filtering techniques such as the Kalman filter algorithm to estimate and compensate for the jitter in real time.

[0006] Preferably, the working mode of the task load prediction module is that when the task load prediction module performs data prediction, it collects detailed data information of Task 1 and Task 2 in the past multiple cycles, including but not limited to the multi-dimensional information such as the amount of data processed each time, the data type, the complexity of data processing, and the resource occupancy. And comprehensively analyze these multi-dimensional data through the neural network algorithm. When it is predicted that the task load is about to change, if it is predicted that the task load increases, the locking cycle can be shortened in advance or the counting frequency of the counter can be increased. If it is predicted that the task load decreases, the locking cycle can be appropriately extended or the counting frequency can be reduced.

[0007] Preferably, in addition to using the Kalman filter algorithm, the adaptive jitter compensation mechanism combines the particle filter algorithm to perform real-time estimation and compensation of the jitter, so that at the initial stage of the system operation, the Kalman filter algorithm and the particle filter algorithm are started at the same time. The Kalman filter algorithm makes a preliminary estimate of the jitter based on the linear state space model of the system, and the particle filter algorithm can better handle the situation of the nonlinear system. The results of the two algorithms are weighted and fused, and the determination of the weight is dynamically adjusted according to the current operating state of the system.

[0008] Preferably, the data storage in the pre-cache layer is classified according to the time correlation of the data. The data that will be referenced simultaneously in the near future is divided into the same class. When judging the time correlation of the data, factors such as the task cycle rules of Task 1 and Task 2, the usage frequency of the data in different task cycles, and the time interval of data generation are comprehensively considered.

[0009] Preferably, when the hash function stores data in the shadow register, in addition to calculating the hash value of the data, it synchronously records some characteristic information of the data. These characteristics include the source identifier of the data and the generation timestamp of the data. Before the data is read and referenced, not only the hash value is compared, but also the characteristic information of the data is checked. If the hash values are the same but the characteristic information does not match, the data is also determined to be abnormal.

[0010] Preferably, the counter has a dual counting mode. One is the normal counting mode, which counts according to the actual periods of Task 1 and Task 2; the other is the emergency counting mode. When the system detects that an abnormal situation occurs in Task 1 or Task 2, such as the task execution time exceeding a certain proportion of the normal period, it automatically switches to the emergency counting mode.

[0011] Preferably, in step S2, a dynamic evaluation and adjustment mechanism for task priorities is added. For the priority management of Task 1 and Task 2, in addition to dynamically adjusting the priorities according to the real-time importance, urgency of the tasks and the requirements for data accuracy, a priority history record library is also established. This record library will record the priority changes of each task in different time periods and the corresponding data references and processing results. By analyzing the data in the history record library, the future priority adjustment strategy can be optimized.

[0012] Preferably, in addition to setting the locking mechanism within integer multiples of the task cycle, a temporary locking interval is also set. When the system detects that the data interaction volume between Task 1 and Task 2 suddenly increases or the importance of the data significantly improves in the short term, the temporary locking interval is started. Within the temporary locking interval, it can be triggered immediately according to the real-time situation of data interaction without waiting for the preset number of cycles. At the same time, the data locking within the temporary locking interval has a higher priority and can take precedence over the operations in the normal locking interval, so as to ensure the deterministic reference of data in special data interaction situations.

[0013] Preferably, in addition to checking the data characteristic information, the hash function also introduces a data redundancy check mechanism. When the data is stored in the shadow register, redundant data is generated according to a specific redundancy algorithm and stored together with the original data, so that before the data is read and referenced, the data is checked using the redundancy check algorithm. If the redundancy check fails, even if the hash value and the data characteristic information are correct, the data is determined to have problems.

[0014] Preferably, in step S6, a multi-dimensional statistical method is adopted for the statistics of the system communication jitter time. In addition to statistically calculating the average value and variance of the system communication jitter time, the distribution law of the jitter time is also synchronously analyzed, and the parameters of the adaptive jitter compensation mechanism are adjusted according to the distribution law of the jitter time.

[0015] In summary, compared with the prior art, the present invention provides a method for PLC multi-task cross-reference deterministic data, which has the following beneficial effects: 1. The present invention predicts data through a task load prediction module combined with a neural network algorithm, and can adjust the parameters related to the locking mechanism in advance according to the change of task load, which helps to ensure that the locking mechanism adapts to the change of task load, guarantees the determinacy of data reference, and improves the system's ability to handle different load conditions. Secondly, the adaptive jitter compensation mechanism combines the Kalman filter and the particle filter algorithm, and dynamically adjusts the weight, which can more accurately estimate and compensate the jitter in real time, ensure the deterministic correspondence of the latched data, and enhance the system's adaptability to jitter in different operating states; 2. The pre-cache layer set by the present invention can store data according to the time correlation of the data, which can improve the transfer efficiency of the data from the pre-cache layer to the shadow register, and thus guarantee the determinacy of data reference. At the same time, by recording some characteristic information of the data through the hash function and introducing the data redundancy check mechanism, the integrity of the data is guaranteed from multiple dimensions, and data anomalies can be detected more comprehensively when the data is read and referenced, ensuring the accuracy and determinacy of the data; 3. The double counting mode of the counter in the present invention can quickly respond when a task is abnormal, and switch to the emergency counting mode to cope with risks, guaranteeing the determinacy of data reference in special situations. The dynamic evaluation and adjustment mechanism of task priority and the establishment of the priority history record library help to optimize the priority adjustment strategy, improving the overall operation efficiency of the system while guaranteeing data determinacy; 4. Through the setting of the temporary locking interval in the locking mechanism, the present invention can flexibly trigger data caching in special data interaction situations, guaranteeing the deterministic reference of the data. At the same time, the multi-dimensional statistical method is used for the system communication jitter time, and the parameters of the adaptive jitter compensation mechanism can be adjusted according to the distribution law of the jitter time, further ensuring the determinacy of the latched data. Specific embodiments

[0016] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the solutions in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0017] The present invention provides a technical solution, a method for PLC multi-task cross-reference deterministic data, including the following steps: S1: Within an integer multiple interval of the task cycle, set a locking mechanism and set a temporary locking interval inside the locking mechanism. The temporary locking interval can be started when the system detects a sudden increase in the data interaction volume between Task 1 and Task 2 or a significant improvement in the importance of the data in the short term. Within the temporary locking interval, the triggering method of data caching is more flexible and can be triggered immediately according to the real-time situation of data interaction without waiting until the preset number of cycles is reached. At the same time, the data locking within the temporary locking interval has a higher priority and can take precedence over the operations in the normal locking interval, thus ensuring the deterministic reference of data in special data interaction situations; S2: Set a counter with a dual counting mode and a task load prediction module inside. Count the number of cycles of Task 1 and Task 2, and at the same time, conduct data prediction through the task load prediction module. According to the prediction results, adjust the relevant parameters of the locking mechanism in advance. The working mode of the task load prediction module is that when the task load prediction module conducts data prediction, it collects detailed data information of Task 1 and Task 2 in the past multiple cycles, including but not limited to multi-dimensional information such as the amount of data processed each time, data type, complexity of data processing, and resource occupancy. And comprehensively analyze these multi-dimensional data through neural network algorithms. When it is predicted that the task load is about to change, if it is predicted that the task load increases, the locking cycle can be shortened in advance or the counting frequency of the counter can be increased. If it is predicted that the task load decreases, the locking cycle can be appropriately extended or the counting frequency can be reduced; The dual counting mode of the counter has one is the normal counting mode, which counts according to the actual cycles of Task 1 and Task 2; the other is the emergency counting mode, which automatically switches to the emergency counting mode when the system detects an abnormal situation in Task 1 or Task 2, such as when the task execution time exceeds a certain proportion of the normal cycle; The normal counting mode of the counter is: First, the system is default in the normal counting mode. In this mode, the counter counts according to the actual cycles of Task 1 and Task 2. This means that the counter will gradually increase the count value according to the respective preset normal cycle lengths of Task 1 and Task 2. For example, if the normal cycle of Task 1 is 10 time units and the normal cycle of Task 2 is 15 time units, the counter will count the two tasks according to such cycle rhythms respectively. During normal operation, the counter continuously works in this normal counting mode, cooperating with other modules (such as the task load prediction module, etc.) to count the number of cycles of the tasks. This counting result will be used for subsequent data caching triggering and other operations to ensure the determinacy of data reference. For example, when the counting reaches the preset number of cycles (this preset number of cycles is based on the counting result in the normal counting mode), the corresponding data caching operation will be triggered; The specific process of automatically switching to the emergency counting mode is as follows: The system continuously monitors the execution of Task 1 and Task 2. When an abnormal situation occurs in Task 1 or Task 2, it will trigger the switch from the normal counting mode to the emergency counting mode. Once an abnormal situation is detected, the counter automatically switches to the emergency counting mode. In the emergency counting mode, the counting speed of the counter is increased. This increased counting speed is to more quickly adapt to the data processing requirements in the abnormal state of the task. For example, if it counts once per second in the normal counting mode, it may count three times per second in the emergency counting mode or increase the counting speed according to specific preset rules; S3: When the timing reaches the preset number of cycles, directly trigger or delay-trigger the corresponding data cache; S4: Set a shadow register and a pre-cache layer to store the data at the time of triggering. At the same time, in combination with the hash function, calculate the hash value of the data when the data is stored in the shadow register, and store it together with the data. Before the data is read and referenced, calculate the hash value of the data again and compare it with the stored hash value. The data storage in the pre-cache layer is classified according to the time correlation of the data. The data that will be referenced simultaneously in the near future is divided into the same category. When judging the time correlation of the data, comprehensively consider the task cycle rules of Task 1 and Task 2, the usage frequency of the data in different task cycles, and the time interval of data generation; When the hash function stores the data in the shadow register, in addition to calculating the hash value of the data, it synchronously records some characteristic information of the data. These characteristics include the source identifier of the data and the generation timestamp of the data. Before the data is read and referenced, not only compare the hash values, but also check the characteristic information of the data at the same time. If the hash values are the same but the characteristic information does not match, the data is also determined to be abnormal; At the same time, in addition to checking the characteristic information of the data by the hash function, a data redundancy check mechanism is introduced. When the data is stored in the shadow register, redundant data is generated according to a specific redundancy algorithm and stored together with the original data, so that before the data is read and referenced, the data is verified by the redundancy check algorithm. If the redundancy check fails, even if the hash value and the data characteristic information are correct, the data is also determined to have problems; The specific process of the data redundancy check mechanism is as follows: First, when the data is to be stored in the shadow register (this timing is when the data cache is triggered when the timing reaches the preset number of cycles and the data is about to be stored in the shadow register), the data is in a pending state and ready for the operation of generating redundant data; Subsequent operations are carried out according to a specific redundancy algorithm preset by the system. This specific redundancy algorithm is specially designed for the method of PLC multitask cross-reference deterministic data to ensure data integrity and determinacy. Although the specific algorithm is not mentioned in the paragraph, it is the basic rule of the whole process; Calculate the original data to be stored in the shadow register according to the selected redundancy algorithm. For example, if it is a redundancy algorithm based on parity check, it may calculate each bit of the original data and generate a parity bit as redundant data according to the parity of the number of 1s in the original data; if it is a cyclic redundancy check (CRC) algorithm, the original data is regarded as a polynomial and calculated through a specific generating polynomial to obtain a remainder of a fixed length as redundant data; Integrate the generated redundant data with the original data. This integration may be a simple append operation, such as adding the redundant data at the end or a specific position of the original data. For example, the original data is 101011 and the generated redundant data is 01; Finally, store the integrated data containing the original data and the redundant data as a whole in the shadow register. In the shadow register, these data will be stored until the next data read reference operation. At the same time, the hash function will calculate the hash value of this integrated data and record partial characteristic information of the data (such as source identification and generation timestamp), and store them in the shadow register together. In this way, before the data read reference, multi-dimensional data verification can be carried out, including hash value comparison, characteristic information verification and redundancy check, to ensure data accuracy and determinacy; S5: Before the next data read reference, lock the data in the shadow register to ensure that the data is no longer refreshed; S6: Determine a reasonable delay size by statistically analyzing the jitter time of system communication to ensure a deterministic correspondence of the latched data. On this basis, establish an adaptive jitter compensation mechanism and use dynamic filtering techniques such as the Kalman filter algorithm to estimate and compensate for jitter in real time. In addition to using the Kalman filter algorithm, the adaptive jitter compensation mechanism also combines the particle filter algorithm for real-time estimation and compensation of jitter, so that at the initial stage of system operation, both the Kalman filter algorithm and the particle filter algorithm are started simultaneously. The Kalman filter algorithm makes a preliminary estimate of jitter based on the linear state space model of the system, and the particle filter algorithm can better handle the situation of non-linear systems. The results of the two algorithms are weighted and fused, and the determination of the weight is dynamically adjusted according to the current operating state of the system. In the statistical analysis of the system communication jitter time, a multi-dimensional statistical method is adopted. In addition to statistically analyzing the average value and variance of the system communication jitter time, the distribution law of the jitter time is also analyzed synchronously, and the parameters of the adaptive jitter compensation mechanism are adjusted according to the distribution law of the jitter time; Secondly, a dynamic evaluation and adjustment mechanism for task priorities is added in step S2. For the priority management of Task 1 and Task 2, in addition to dynamically adjusting priorities according to the real-time importance, urgency of the tasks, and the requirements for data accuracy, a priority history record library is established. This record library will record the priority changes of each task in different time periods, as well as the corresponding data references and processing results. By analyzing the data in the history record library, the future priority adjustment strategy can be optimized; The specific process of the dynamic evaluation and adjustment mechanism for task priorities is as follows: First, when the task load prediction module makes data predictions, it collects detailed data information of Task 1 and Task 2 in the past multiple cycles. This information includes multi-dimensional information such as the amount of data processed each time, data type, complexity of data processing, and resource occupancy. Secondly, the collected multi-dimensional data is comprehensively analyzed through a neural network algorithm. The neural network algorithm will evaluate the real-time importance, urgency of the tasks, and the requirements for data accuracy based on the internal relationships and patterns among these data. For example, if the amount of data processed by a task suddenly increases and the processing complexity becomes higher, and at the same time the requirement for data accuracy is also very high, then the importance and urgency of this task may be judged to be relatively high. Finally, according to the results of the comprehensive analysis, the priorities of Task 1 and Task 2 are dynamically adjusted. If the importance and urgency of a task increase, its priority will be raised; conversely, if the importance and urgency of a task decrease, its priority will be lowered. For example, if Task 1 originally had a medium priority, and after analysis, it is found that its data volume has increased sharply and the requirement for data accuracy is extremely high, then the priority of Task 1 may be raised to a high priority; The specific process of operating the priority history record library is as follows: First, the priority history repository records the priority changes of each task at different time periods, as well as the corresponding data references and processing results. For example, at time t1, the priority of task 1 is raised from low to medium. At this time, the data reference situation is that data is referenced from cache A, and the processing result is that a specific operation is successfully completed. All this information will be recorded in the priority history repository. Second, the system regularly analyzes the data in the priority history repository. The content of the analysis includes the impact of different priority changes on data references and processing results. For example, observe metrics such as the execution efficiency and data accuracy of tasks at different priorities. For example, check whether task 1 can always complete data processing faster and with higher data accuracy at high priority, or whether there will be data processing delays at low priority. Finally, by analyzing the data in the history repository, the future priority adjustment strategy can be optimized. If it is found that the priority adjustment is unreasonable in some cases, resulting in data processing problems, then the adjustment strategy can be corrected. For example, if it is found that frequently adjusting the priority of task 2 to high priority does not improve the overall data processing efficiency, but instead causes problems with data references of other tasks, then the priority adjustment strategy can be adjusted to avoid unnecessary priority increases.

[0018] This solution uses a task load prediction module combined with a neural network algorithm for data prediction, which can adjust the parameters related to the locking mechanism in advance according to the changes in task load, helping to ensure that the locking mechanism adapts to the task load changes, guarantee the determinacy of data references, and improve the system's ability to handle different load conditions. Second, the adaptive jitter compensation mechanism combines the Kalman filter and particle filter algorithms and dynamically adjusts the weights, which can more accurately estimate and compensate for jitter in real time, ensure the deterministic correspondence of the latched data, and enhance the system's adaptability to jitter in different operating states.

[0019] This solution classifies and stores data according to data time correlation through the set pre-cache layer, which can improve the transfer efficiency of data from the pre-cache layer to the shadow register, thereby guaranteeing the determinacy of data references. At the same time, by recording partial feature information of the data through a hash function and introducing a data redundancy check mechanism, the integrity of the data is guaranteed from multiple dimensions, and data anomalies can be detected more comprehensively during data reading and reference, ensuring the accuracy and determinacy of the data.

[0020] This solution can respond quickly when a task is abnormal through the dual counting mode of the counter, and switch to the emergency counting mode to handle risks, guaranteeing the determinacy of data references in special situations. The dynamic evaluation and adjustment mechanism of task priorities and the establishment of the priority history repository help to optimize the priority adjustment strategy, improving the overall operating efficiency of the system while guaranteeing data determinacy.

[0021] Through the setting of the temporary locking interval in the locking mechanism, this solution can flexibly trigger data caching in special data interaction scenarios to ensure the deterministic reference of data. The added system communication jitter time adopts a multi-dimensional statistical method, and the parameters of the adaptive jitter compensation mechanism can be adjusted according to the distribution law of the jitter time, further ensuring the determinacy of the latched data.

[0022] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device.

[0023] Although the embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. Method for PLC multitask cross-referencing deterministic data, characterized in that, It includes the following steps: S1: Set a locking mechanism within an integer multiple interval of the task cycle, and set a temporary locking interval inside the locking mechanism; S2: Set a counter and a task load prediction module to count the number of cycles for Task 1 and Task 2. Meanwhile, conduct data prediction through the task load prediction module, and adjust the relevant parameters of the locking mechanism in advance according to the prediction results. And a dual counting mode is set inside the counter; S3: When the timing reaches the preset number of cycles, directly trigger or delay-trigger the corresponding data cache; S4: Set a shadow register and a pre-cache layer to store the data at the time of triggering. Meanwhile, in combination with the hash function, calculate the hash value of the data when the data is stored in the shadow register, and store it together with the data. Before the data is read and referenced, calculate the hash value of the data again and compare it with the stored hash value; S5: Lock the data in the shadow register before the next data read and reference to ensure that the data is no longer refreshed; S6: Determine a reasonable delay size by statistically analyzing the jitter time of the system communication to ensure a deterministic correspondence relationship for the latched data. On this basis, establish an adaptive jitter compensation mechanism and use the Kalman filter algorithm to estimate and compensate the jitter in real time.

2. The method for PLC multi-task cross-reference deterministic data according to claim 1, characterized in that: The working mode of the task load prediction module is that when the task load prediction module conducts data prediction, it collects detailed data information of Task 1 and Task 2 in the past multiple cycles, including but not limited to multi-dimensional information such as the amount of data processed each time, data type, complexity of data processing, and resource occupancy. And comprehensively analyze these multi-dimensional data through the neural network algorithm. When it is predicted that the task load is about to change, that is, when it is predicted that the task load increases, the locking cycle can be shortened in advance or the counting frequency of the counter can be increased. If it is predicted that the task load decreases, the locking cycle can be appropriately extended or the counting frequency can be reduced.

3. The method for PLC multi-task cross-reference deterministic data according to claim 1, characterized in that: In addition to using the Kalman filter algorithm, the adaptive jitter compensation mechanism combines the particle filter algorithm for real-time estimation and compensation of jitter. At the initial stage of system operation, both the Kalman filter algorithm and the particle filter algorithm are started simultaneously. The Kalman filter algorithm makes a preliminary estimate of the jitter based on the linear state space model of the system, and the particle filter algorithm can better handle the situation of non-linear systems. The results of the two algorithms are weighted and fused, and the determination of the weight is dynamically adjusted according to the current operating state of the system.

4. The method for PLC multi-task cross-reference deterministic data according to claim 1, characterized in that: The data storage in the pre-cache layer is classified according to the time correlation of the data. The data that will be simultaneously referenced in the near future is divided into the same category. When judging the time correlation of the data, factors such as the task cycle rules of Task 1 and Task 2, the usage frequency of the data in different task cycles, and the time interval when the data is generated are comprehensively considered.

5. The method for PLC multi-task cross-reference deterministic data according to claim 1, characterized in that: When the data is stored in the shadow register, in addition to calculating the hash value of the data, the hash function synchronously records some characteristic information of the data, including the source identifier of the data and the generation timestamp of the data. Before the data is read and referenced, not only the hash value is compared, but also the characteristic information of the data is checked. When the hash values are the same but the characteristic information does not match, the data is also determined to be abnormal.

6. The method for PLC multi-task cross-reference deterministic data according to claim 1, characterized in that: The double counting mode of the counter has two types. One is the normal counting mode, which counts according to the actual periods of Task 1 and Task 2. The other is the emergency counting mode. When the system detects that an abnormal situation occurs in Task 1 or Task 2, that is, when the task execution time exceeds a certain proportion of the normal period, it automatically switches to the emergency counting mode.

7. The method for PLC multi-task cross-reference deterministic data according to claim 1, characterized in that: In step S2, a dynamic evaluation and adjustment mechanism for task priorities is added. For the priority management of Task 1 and Task 2, in addition to dynamically adjusting the priorities according to the real-time importance, urgency of the tasks, and the requirements for data accuracy, a priority history record library is established. The priority history record library records the priority changes of each task in different time periods, as well as the corresponding data references and processing results. By analyzing the data in the history record library, the future priority adjustment strategy can be optimized.

8. The method for PLC multi-task cross-reference deterministic data according to claim 1, characterized in that: The temporary locking interval can be started when the system detects a sudden increase in the data interaction volume between Task 1 and Task 2 or a significant increase in the importance of the data in the short term. Within the temporary locking interval, it can be triggered immediately according to the real-time situation of the data interaction without waiting for the preset number of cycles. At the same time, the data locking within the temporary locking interval has a higher priority and can take precedence over the operations in the normal locking interval, thus ensuring the deterministic reference of data in special data interaction situations.

9. The method for PLC multi-task cross-reference deterministic data according to claim 1, characterized in that: In addition to verifying the data characteristic information, the hash function introduces a data redundancy check mechanism. When the data is stored in the shadow register, redundant data is generated according to a specific redundancy algorithm and stored together with the original data. Before the data is read and referenced, the data is verified using the redundancy check algorithm. When the redundancy check fails, even if the hash value and the data characteristic information are correct, it is determined that there is a problem with the data.

10. The method for PLC multi-task cross-reference deterministic data according to claim 1, wherein: In step S6, a multi-dimensional statistical method is adopted for the statistics of the system communication jitter time. In addition to counting the average value and variance of the system communication jitter time, the distribution law of the jitter time is also analyzed synchronously, and the parameters of the adaptive jitter compensation mechanism are adjusted according to the distribution law of the jitter time.

Citation Information

Patent Citations

  • Multi-task time sequence execution method and system based on cache locks

    CN105550028A

  • Task management system and method

    CN112162969A

  • IEC task data consistency synchronization method and device, electronic equipment and storage medium

    CN119293120A

  • Multi-task operation method and device, storage medium and computer program product

    CN119310921A

  • Multi-task data analysis method and device and storage medium

    CN119847752A