A PLC Test Data Processing Method and System Based on Signal Transition Monitoring
By employing signal transition monitoring and a distributed game equilibrium algorithm, the problem of balancing real-time performance and resource consumption in PLC test data acquisition schemes in complex dynamic environments was solved, achieving optimized performance of the data processing system in an adaptive production environment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG SCI-TECH UNIV
- Filing Date
- 2026-04-23
- Publication Date
- 2026-05-26
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN122089007A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a PLC test data processing method and system based on signal transition monitoring. Background Technology
[0002] In the field of industrial automation testing, the PLC, as the core control unit, outputs digital signals that are key data reflecting the operating status of production equipment and product test results. Currently, mainstream PLC test data acquisition schemes are mainly divided into two categories: one is based on fixed-period polling, where the host computer periodically queries the PLC registers at a preset frequency to obtain signal status and store records. This scheme is widely used in various production line testing scenarios due to its simple logic and wide compatibility. The other category utilizes the hardware interrupt or event triggering mechanism supported by specific PLCs. When the signal meets preset trigger conditions, the PLC actively sends data to the host computer. This scheme has certain advantages in testing scenarios with high real-time requirements.
[0003] Both of the aforementioned data acquisition schemes have played a crucial role in industrial production. However, as industrial manufacturing transitions towards flexibility and intelligence, their adaptability in complex and dynamic production environments is becoming increasingly apparent. For fixed-period polling schemes, shortening the polling cycle to capture instantaneous signal changes significantly increases the load on the PLC processor and industrial network, potentially affecting the stability of the entire control system. Conversely, extending the polling cycle to reduce resource consumption can easily lead to missing transient signal state changes, making it difficult to balance data integrity and real-time performance. For hardware interrupt or event-triggered schemes, the acquisition logic is deeply tied to the proprietary hardware functions of specific PLC brands and models. When adding or replacing PLCs of different brands on the production line, a new, compatible acquisition program must be developed, resulting in high system integration and maintenance costs and limited scalability. More importantly, both schemes employ static parameter configuration, failing to recognize the differences in business value between different test signals and struggling to adjust acquisition strategies based on dynamic environmental factors such as production cycle fluctuations and network status changes. This makes it difficult to maintain an optimal balance between data acquisition value and resource consumption during long-term system operation. Summary of the Invention
[0004] The main objective of this invention is to provide a PLC test data processing method and system based on signal transition monitoring, aiming to solve the technical problems mentioned in the background art.
[0005] This invention proposes a PLC test data processing method based on signal transition monitoring, comprising:
[0006] Obtain the configuration information of the target PLC, including the communication protocol type, the list of key test signal points and the initial acquisition parameters, load the corresponding protocol adapter and establish a communication connection, and create and start a listening unit for each key test signal point;
[0007] The monitoring unit captures signal transitions and generates raw events with timestamps.
[0008] The original event is time-matched with the production event from the manufacturing execution system, and the product serial number and work order number are bound to generate an enhanced event record.
[0009] The enhanced event records are parsed using a predefined test rule base, the test results are determined and process features are extracted, test semantic records are generated, and the logical invalid events generated by each monitoring unit are counted.
[0010] Based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the aforementioned invalid events, the target resource quota of each monitoring unit is calculated periodically using a distributed game equilibrium algorithm, and parameter adjustment instructions are generated.
[0011] The parameter adjustment command is sent to the corresponding monitoring unit for execution to adjust its operating parameters; the adjusted operating parameters are applied to the subsequent step of "capturing signal transitions through the monitoring unit and generating original events with timestamps";
[0012] Output the test semantic records and optimization process information, and provide a visual display.
[0013] The present invention is further configured such that the step of matching the original event with the production event from the manufacturing execution system in time, binding the product serial number and work order number, and generating an enhanced event record includes:
[0014] Real-time acquisition of the average cycle time of the current production line, as well as the average network round-trip latency from the PLC to the computing device;
[0015] For each of the original events, the half-width of the associated time window is dynamically calculated based on its timestamp, average tick time, and average network round-trip delay.
[0016] A time window is constructed centered on the timestamp of the original event and combined with the half-width of the associated time window, and candidate production events within the time window are retrieved from the production event stream.
[0017] For each candidate production event, calculate its time proximity score to the timestamp of the original event;
[0018] The candidate production event with the highest time proximity score is selected. If its time proximity score is greater than a preset matching threshold, it is determined to be a successful match. If its time proximity score does not exceed the preset matching threshold, it is marked as a failed match.
[0019] The product serial number and work order number in the successfully matched candidate production event are bound to the original event to generate an enhanced event record.
[0020] The present invention is further configured to parse the enhanced event records using a predefined test rule base, determine the test results and extract process features, generate test semantic records, and simultaneously count the logically invalid events generated by each monitoring unit, including the following steps:
[0021] Extract the product serial number from the enhanced event record, and match the applicable test logic rule set from the test rule base according to the product type corresponding to the product serial number;
[0022] Create a rule engine instance for each product type that is in an active testing state, and load the corresponding test logic rule set;
[0023] All enhanced event records under the same product serial number are collected and sorted in chronological order to form an enhanced event sequence associated with the same test object, and the enhanced event sequence is input into the corresponding rule engine instance;
[0024] The rule engine instance performs streaming state matching based on the test logic rule set. When the enhanced event sequence satisfies the triggering and completion conditions of any rule in the test logic rule set, a test semantic record containing test results, process features, and related event references is generated.
[0025] When the enhanced event sequence does not match the expectations of all rules in the test logic rule set, the relevant events in the enhanced event sequence are marked as logically invalid events, and the identifier of the listening unit that generated the logically invalid event is recorded.
[0026] The present invention is further configured such that the method also includes a data quality self-healing step, specifically including:
[0027] Monitor the frequency of invalid logical events generated by each listening unit;
[0028] When the frequency of the logical invalid event of a certain monitoring unit exceeds a preset multiple of its historical normal fluctuation range, a special diagnosis for that monitoring unit is triggered.
[0029] Performing the specific diagnostics includes:
[0030] Verify the communication link status between the monitoring unit and the PLC;
[0031] Check whether its current operating parameters are within the parameter range supported by the protocol adapter;
[0032] Analyze the time series characteristics of the logically invalid events described therein;
[0033] Obtain the results of the specific diagnosis, and perform at least one of the following self-healing operations based on the results of the specific diagnosis:
[0034] If the communication link status is abnormal, the connection with the PLC is reset through the protocol adapter;
[0035] If the current operating parameters exceed a reasonable range, the information value quantification weight of the monitoring unit will be temporarily reduced in the next cycle calculation to trigger a conservative parameter adjustment.
[0036] If the time series characteristics of the logically invalid event exhibit regular fluctuations, an additional penalty factor is introduced when calculating its target resource quota, including: multiplying the marginal benefit calculated by the monitoring unit by a correction coefficient less than 1 before participating in subsequent iterative calculations.
[0037] The present invention is further configured to include the following steps: periodically calculating the target resource quota for each monitoring unit based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the aforementioned invalid logical events, using a distributed game equilibrium algorithm, and generating parameter adjustment instructions:
[0038] For each key test signal point, obtain the number and level of key rules triggered in the test rule base, as well as the cost associated with historical test failures, in order to calculate its information value quantification weight.
[0039] Collect the real-time resource consumption rate of each monitoring unit in the previous period, and calculate the statistical average over time to obtain the corresponding average resource consumption rate.
[0040] With the goal of maximizing the overall information value acquisition, under the constraint of the total system resource budget, the information value of each monitoring unit is quantified and weighted, and the average resource consumption rate is used as the initial resource quota of each monitoring unit. Through multiple rounds of distributed negotiation iteration, the target resource quota of each monitoring unit in the next cycle is calculated.
[0041] Based on the target resource quota of each monitoring unit and the parameter-resource consumption mapping model of the protocol adapter, the specific acquisition parameter adjustment value is solved by numerical optimization method and encapsulated as the parameter adjustment instruction.
[0042] The present invention is further configured such that, with the goal of maximizing the overall information value acquisition, under the constraint of the total system resource budget, the steps of quantifying the information value weight of each monitoring unit, using the average resource consumption rate as the initial resource quota for each monitoring unit, and calculating the target resource quota for each monitoring unit in the next cycle through multiple rounds of distributed negotiation iterations include:
[0043] Set the system's total resource budget for the current period;
[0044] Set a resource quota variable for each monitoring unit and set its initial value to the average resource consumption rate of the monitoring unit in the previous period;
[0045] Enter the iteration loop and perform the following operations in a single iteration:
[0046] Each of the aforementioned monitoring units calculates its marginal benefit based on its current resource quota variable and information value quantification weight;
[0047] Calculate the global average marginal benefit of the marginal benefits of all the aforementioned listening units;
[0048] Each monitoring unit calculates its resource quota adjustment amount based on the deviation between its own marginal benefit and the global average marginal benefit, and the adjustment direction is to make the marginal benefit converge to the global average marginal benefit;
[0049] Each of the listening units applies the resource quota adjustment amount to update its current resource quota variable, and after all listening units have updated, the resource quota variable is normalized to ensure that their sum does not exceed the total resource budget.
[0050] When the variance of the marginal benefit of all monitoring units in continuous iteration is lower than the preset convergence threshold, the iteration stops, and the final value of the resource quota variable of each monitoring unit is determined as its target resource quota.
[0051] The present invention is further configured such that the step of outputting the test semantic records and optimization process information and providing a visual display includes:
[0052] Obtain the parameter adjustment history, and output the test semantic record and the dataset containing the real-time resource consumption rate of each monitoring unit, the information value quantification weight, the target resource quota and the parameter adjustment history;
[0053] Based on the test semantic records and the dataset, visualization instructions are generated to control the visualization interface to be updated synchronously.
[0054] In response to external input received through the visual interface (user-initiated input via interactive controls), perform at least one of the following operations:
[0055] If the external input is an adjustment value for the information value quantification weight of the system's total resource budget or a specific key test signal point, then the adjustment value is used as an input parameter and applied to the next calculation cycle.
[0056] If the external input is a selection instruction for a specific test semantic record, then the original event sequence associated with the test semantic record, the bound production context information, and the relevant historical performance data are retrieved and returned.
[0057] This invention also provides a PLC test data processing system based on signal transition monitoring, including...
[0058] The protocol configuration module is used to obtain the configuration information of the target PLC, including the communication protocol type, the list of key test signal points and the initial acquisition parameters, load the corresponding protocol adapter and establish a communication connection, and create and start a listening unit for each key test signal point.
[0059] The signal acquisition module is used to capture signal transitions through the monitoring unit and generate raw events with timestamps.
[0060] The association matching module is used to match the original event with the production event from the manufacturing execution system in time, bind the product serial number and work order number, and generate an enhanced event record.
[0061] The parsing and statistics module is used to parse the enhanced event records using a predefined test rule base, determine the test results and extract process features, generate test semantic records, and at the same time count the logically invalid events generated by each monitoring unit.
[0062] The strategy optimization module is used to periodically calculate the target resource quota of each monitoring unit based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the logical invalid events, and generate parameter adjustment instructions.
[0063] The dynamic update module is used to send the parameter adjustment instructions to the corresponding monitoring unit for execution, so as to adjust its operating parameters;
[0064] The integrated display module is used to output the test semantic records and optimization process information, and provide a visual display.
[0065] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of a PLC test data processing method based on signal transition monitoring.
[0066] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of a PLC test data processing method based on signal transition monitoring.
[0067] The beneficial effects of this invention are as follows: This invention solves the problem of multi-brand device integration by constructing a protocol-independent universal acquisition framework. It adopts an active listening mechanism based on signal transitions, which significantly reduces system resource load while ensuring fast real-time response. Furthermore, through dynamic context association and rule-based parsing, it achieves accurate transformation and value enhancement of test data into traceable business information. In particular, through periodic game optimization calculations, it automatically and dynamically adjusts the resource allocation strategy of each acquisition point under total resource constraints, driving the system to continuously tend towards maximizing the total output of information value. This enables the system to intelligently adapt to dynamic environments such as changes in production rhythm and network fluctuations, and always maintains an optimal balance between data acquisition value and system resource consumption. Attached Figure Description
[0068] Figure 1 This is a schematic diagram of a method flow according to an embodiment of this application.
[0069] Figure 2 This is a schematic diagram of the system structure according to an embodiment of this application.
[0070] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0071] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0072] like Figure 1 As shown, this application provides a PLC test data processing method based on signal transition monitoring, including:
[0073] S1, obtain the configuration information of the target PLC, including the communication protocol type, the list of key test signal points and the initial acquisition parameters, load the corresponding protocol adapter and establish a communication connection, and create and start a listening unit for each key test signal point;
[0074] S2, The monitoring unit captures signal transitions and generates original events with timestamps;
[0075] S3, Match the original event with the production event from the manufacturing execution system in time, bind the product serial number and work order number, and generate an enhanced event record;
[0076] S4. The enhanced event records are parsed using a predefined test rule base, the test results are determined and process features are extracted, test semantic records are generated, and the logical invalid events generated by each monitoring unit are counted.
[0077] S5, periodically based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the aforementioned invalid logical events, calculates the target resource quota of each monitoring unit through a distributed game equilibrium algorithm, and generates parameter adjustment instructions.
[0078] S6, the parameter adjustment instruction is sent to the corresponding monitoring unit for execution to adjust its operating parameters; the adjusted operating parameters are applied to the subsequent step of "capturing signal transitions through the monitoring unit and generating original events with timestamps";
[0079] S7, output the test semantic record and optimization process information, and provide a visual display.
[0080] As described in steps S1-S7 above, the present invention provides an adaptive acquisition and management method for PLC test data in dynamic industrial environments, in order to solve the core problems existing in the prior art, such as the contradiction between real-time acquisition and resource consumption, poor system scalability, and the inability of static configuration to adapt to dynamic environments.
[0081] In industrial production line testing, the digital signals output by the PLC are crucial data reflecting the test results. Current mainstream acquisition solutions primarily rely on a host computer polling the PLC registers at a fixed frequency. This approach has the following drawbacks: increasing the polling frequency to capture instantaneous signals drastically increases the load on the PLC and industrial network, affecting system stability; extending the polling cycle to reduce load inevitably leads to increased data latency and misses brief state transitions. Another approach, utilizing specific PLC hardware interrupts, can guarantee real-time performance, but its implementation is strongly tied to the equipment brand and model, resulting in high integration and maintenance costs when the system is on a production line with multiple brands of equipment. More fundamentally, existing solutions use static parameter configuration, failing to perceive the differences in business value between different test signals, and unable to adjust acquisition strategies based on dynamic environmental factors such as production cycle changes and network fluctuations. Therefore, it is difficult to maintain the optimal balance between data acquisition value and system resource consumption during continuous operation.
[0082] The method proposed in this invention first performs a configuration and initialization step. The computing device, based on a configuration file, obtains the target PLC's communication protocol type, a list of key test signal points to be monitored, and their initial acquisition parameters. Based on the communication protocol type, the system dynamically loads the corresponding protocol adapter module. This adapter encapsulates all protocol details for communication with a specific brand of PLC and provides a unified connection and data reading interface. Subsequently, the system instantiates an independent listening unit for each key test signal point in the list. This listening unit binds to the corresponding protocol adapter and, after completing its own configuration based on the initial parameters, starts running. This step, by abstracting and encapsulating the volatile communication protocol details in an independent adapter, decouples the upper-level core business logic from the specific device. When a new PLC model is added to the production line or the PLC model is changed, only a new protocol adapter needs to be developed and registered, without modifying any core code for data acquisition, processing, or optimization. This solves the technical problems of poor system scalability and high cross-platform integration costs, and provides a stable and scalable data access foundation for subsequent processing steps.
[0083] After the monitoring unit starts, it enters the signal acquisition and event generation step. Each monitoring unit, according to its current configuration, continuously monitors the level status of a specified signal point through the bound protocol adapter. Its core mechanism is to listen for signal level transitions, rather than periodic polling. When a valid level transition event is detected, the monitoring unit immediately captures the system's high-precision timestamp and encapsulates the signal point identifier, transition direction, post-transition state value, and timestamp into a structured raw event. By replacing periodic polling with an event-driven mechanism, efficiency is improved. Furthermore, since data communication and processing actions only occur when the physical state actually changes, it ensures millisecond-level response and capture of instantaneous pulse signals while reducing the unnecessary occupation of PLC and network resources. This effectively resolves the contradiction between real-time performance and resource overhead in traditional solutions, laying the foundation for stable operation of the system in scenarios with high concurrency and high real-time requirements.
[0084] Next, production business semantics are injected into the original physical events to form enhanced event records. This improves the success rate and reliability of accurately associating test data with specific production materials in complex and asynchronous industrial environments, generating data units rich in context and directly usable for quality traceability. Subsequently, the enhanced event records are processed using a predefined, structured test rule base, realizing the automated and standardized execution of test business logic and producing key feedback that drives system optimization. The statistical quantity of logically invalid events for each monitoring unit provides core metrics for objectively evaluating the "effectiveness" and "quality" of data collection in that unit, becoming a key feedback signal connecting front-end collection behavior and back-end optimization decisions.
[0085] The core innovation of this invention lies in periodically calculating the target resource quota of each monitoring unit based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the aforementioned invalid logical events, and generating parameter adjustment instructions. This is done through a distributed game equilibrium algorithm. The periodic execution of this algorithm forms a closed-loop control, enabling the system to continuously and dynamically maximize the overall information value output under resource constraints based on data value differences and environmental changes, thus solving the problem that static configuration cannot adapt to dynamic environments.
[0086] The generated parameter adjustment instructions are securely and reliably sent to the corresponding monitoring unit. The monitoring unit calls the interface of its protocol adapter to dynamically update its core operating parameters such as sampling period and debouncing time. This process ensures that the optimization strategy can take effect in real time without interrupting the service. After the update, the monitoring unit immediately starts working with the new and better parameters. The changes in data quality and resource consumption generated will be sensed, evaluated and optimized again. This step, as the executor of closed-loop control, transforms the calculated optimization strategy into actual system behavior changes, ensuring the physical closure of the perception, decision-making and execution feedback loop, and enabling the system to have self-adjustment capabilities.
[0087] Finally, the data output and process visualization steps organically combine human expert experience with algorithmic autonomous decision-making, enhancing the system's processing capabilities and reliability under complex and abnormal operating conditions.
[0088] It should be noted that the protocol adapter is middleware that enables communication between the system and PLCs of different brands. Its core functions include communication protocol parsing, data format conversion, connection status maintenance, and anomaly handling: The communication protocol parsing function supports mainstream industrial communication protocols such as Modbus, Profinet, EtherNet / IP, and DeviceNet, and can parse the raw signal data output by the PLC into a unified structured data format of the system; the data format conversion function converts the parsed signal data into a key-value pair format (the key is the signal point identifier, and the value is the signal status and timestamp), which is convenient for subsequent event encapsulation; the connection status maintenance function monitors the communication link status by periodically sending heartbeat packets (default period of 5 seconds), and if the heartbeat packet does not respond within a timeout period, it is determined to be a connection anomaly; the anomaly handling function automatically triggers a retransmission mechanism when a communication error (such as packet loss or bit error) is detected, and if the retransmission fails 3 times, an anomaly log is recorded and maintenance personnel are notified. The protocol adapter adaptation logic is as follows: The system has built-in standard protocol adapters for common PLC brands. When a new or replaced PLC device is added to the production line, if it is a supported brand, the corresponding adapter is loaded directly from the adapter library; if it is not a supported brand, an adapter development interface is provided (including communication protocol parsing templates, data format conversion specifications, and connection status monitoring interfaces). After developers develop custom adapters according to the interface specifications, they can import them into the system through the system's adapter registration function to achieve communication adaptation with the new PLC device without modifying the system's core code.
[0089] In one embodiment, the step of matching the original event with a production event from the manufacturing execution system in time, binding the product serial number and work order number, and generating an enhanced event record includes:
[0090] S31, obtains the average cycle time of the current production line in real time, as well as the average network round-trip delay from the PLC to the computing device;
[0091] S32, for each of the original events, dynamically calculate the half-width of the associated time window based on its timestamp, average tick time, and average network round-trip delay, using the following formula:
[0092]
[0093] In the formula, This represents the half-width of the associated time window. It represents the average cycle time (obtained in real time from the manufacturing execution system or production line control system, or calculated statistically from the time intervals between recent products passing through the test station). This represents the average network round-trip delay (calculated by averaging the timestamps from periodic network probes (such as the Ping command) or monitoring the network communication layer). Indicates the first calibration coefficient. Indicates the second calibration coefficient ( and Adjustments are made based on the specific workstation's logistics transmission time fluctuation characteristics and network stability, determined through experience-based settings or on-site debugging, and are constants greater than zero.
[0094] S33, construct a time window centered on the timestamp of the original event and in conjunction with the half-width of the associated time window. And retrieve candidate production events within that time window from the production event stream;
[0095] S34, for each candidate production event, calculate the time proximity score between its timestamp and the timestamp of the original event, using the following formula:
[0096]
[0097] In the formula, This represents the temporal proximity score (the value ranges from [0,1], and the closer the value is to 1, the closer the temporal proximity). The timestamp of the original event (obtained directly from the system clock when the signal transition is captured by the listening unit). Indicates the timestamp of the candidate production event. This represents the time decay factor (preset based on the tolerance for time deviation in practical applications; it is a constant greater than zero used to control the rate at which the fraction decays as the time difference increases).
[0098] S35, select the candidate production event with the highest time proximity score. If its time proximity score is greater than the preset matching threshold, it is determined to be a successful match. If its time proximity score does not exceed the preset matching threshold, it is marked as a failed match.
[0099] S36, bind the product serial number and work order number in the successfully matched candidate production event to the original event to generate an enhanced event record.
[0100] As described in steps S31-S36 above, the present invention can unambiguously and accurately associate raw events that only reflect changes in physical layer signals with upper-layer production business information to generate high-value data units that can be directly traced and analyzed, thereby solving the problem that test data is limited in value due to the lack of production context.
[0101] Specifically, the system first performs real-time acquisition of two key data points in parallel: one is to obtain the average cycle time of the current production line, which is obtained by querying the manufacturing execution system or statistically analyzing the intervals between product passages through test stations, representing the inherent physical rhythm of the production process; the other is to obtain the average network round-trip delay from the PLC to the acquisition server, which is obtained through periodic network probing, reflecting the inherent transmission delay of the communication link. Of these two dynamic parameters, the former defines the time scale benchmark for the occurrence of events, while the latter quantifies the inherent deviation of timestamps between systems, providing a basis for subsequent compensation calculations.
[0102] Based on the above dynamic parameters, the half-width of the associated time window is calculated using a formula, and a unique time matching range is calculated for each original event. The design principle of this formula is to integrate the natural fluctuations in the event occurrence time allowed by the production cycle and the time uncertainty introduced by network transmission into a time range that is dynamically adjusted according to the scenario. Furthermore, through preset first and second calibration coefficients, it can automatically adapt to different production line speeds and different network conditions, thereby overcoming the problem of association failure or error caused by fixed time windows in dynamic industrial environments and improving the robustness of association operations.
[0103] Subsequently, a specific time interval is constructed centered on the timestamp of the original event. Within this interval, all candidate production events from the Manufacturing Execution System are retrieved, transforming the dynamic strategy into an actual data filtering process. Then, each candidate event is quantitatively evaluated according to the formula... A value between 0 and 1 is calculated to reflect how close the two events are on the timeline. The output value not only serves as the basis for selecting the best match, but also constitutes a confidence measure of this association attempt.
[0104] It should be noted that the time decay factor γ ranges from 1 to 10, and its setting principle is positively correlated with the production cycle time and the tolerance for time deviation: when the average cycle time of the production line... ≤10s (high-speed production scenario), low tolerance for time deviation, γ value takes the range of 7~10; when 10s < ≤60s (medium-speed production scenario), γ takes a value of 3~7; when >60s (low-speed production scenario), with high tolerance for time deviation, γ value ranges from 1 to 3. γ can be adjusted in both automatic and manual modes: In automatic mode, the system dynamically updates the γ value every hour based on the average cycle time of the current production line and the success rate of the last 100 matching attempts (γ automatically increases by 1 when the matching success rate is below 80%; γ automatically decreases by 1 when the matching success rate is above 95%, ensuring the matching success rate remains within the 85%~95% range); In manual mode, maintenance personnel can directly input the γ value through a visual interface, which automatically overwrites the automatic adjustment result until manually switching back to automatic mode.
[0105] The final decision is then made based on the quantitative evaluation results. First, the candidate event with the highest temporal proximity score is selected. Then, it is determined whether the score exceeds a preset matching threshold. Only when the score exceeds the threshold is the association considered successful; otherwise, it is marked as an association failure. By introducing the matching threshold mechanism, it is possible to prevent forced association when all candidate events have weak temporal correlation. This serves as a quality control standard to effectively filter out erroneous associations with low confidence that may introduce noise.
[0106] Finally, for the original events that are determined to be successfully associated, the system injects key business attributes such as the product serial number and work order number contained in the successfully matched production events as new fields into the data structure of the original event. This generates an enhanced event record that simultaneously contains accurate physical status information and complete production context information, thus making the test data a traceable production event.
[0107] In one embodiment, the steps of parsing the enhanced event records using a predefined test rule base, determining test results and extracting process features to generate test semantic records, and simultaneously counting the logically invalid events generated by each monitoring unit include:
[0108] S41, extract the product serial number from the enhanced event record, and match the applicable test logic rule set from the test rule base according to the product type corresponding to the product serial number;
[0109] S42, create a rule engine instance for each product type in an active testing state, and load the corresponding test logic rule set;
[0110] S43, all the enhanced event records under the same product serial number are collected and sorted in chronological order to form an enhanced event sequence associated with the same test object, and the enhanced event sequence is input into the corresponding rule engine instance;
[0111] S44, the rule engine instance performs streaming state matching based on the test logic rule set. When the enhanced event sequence satisfies the triggering and completion conditions of any rule in the test logic rule set, a test semantic record containing test results, process features and related event references is generated.
[0112] S45, when the enhanced event sequence does not match the expectations of all rules in the test logic rule set, the relevant events in the enhanced event sequence are marked as logically invalid events, and the identifier of the listening unit that generated the logically invalid event is recorded.
[0113] As described in steps S41-S45 above, the present invention can automatically parse the enhanced event records associated with the production context, transform the original event sequence into test results and process features with clear semantics, and simultaneously generate key feedback information for evaluating the quality of front-end data collection.
[0114] Specifically, the product serial number is first extracted from the enhanced event log to determine its product type. Then, based on this product type, applicable test logic rule sets are matched and loaded from a predefined test rule base. This enables configurable and dynamic loading of test business logic. The test rule base defines the complete test process, expected signal sequences, timing constraints, and result judgment conditions for various products in a structured manner (e.g., using state machines or sequential logic descriptions). By separating business logic from hard-coded rules and abstracting it into configurable rules, it can flexibly adapt to the testing needs of different products. When the production line switches product models, there is no need to modify the program code; only the corresponding rule set needs to be updated or configured. This improves the system's adaptability and maintainability and provides clear judgment criteria for automated parsing.
[0115] After the rules are loaded, the rule engine is instantiated. An independent rule engine instance is created and maintained for each product type that is in an active testing state. The loaded test logic rule set is loaded into the instance. This design isolates the test logic states of different products and different production tasks, avoiding state confusion. The rule engine instance is a computing unit responsible for tracking the entire process state of a specific test task. Based on the loaded rule set, it maintains the current test state (such as "to start", "in test", "waiting for result") in memory and waits for the input of relevant events to drive state transitions.
[0116] Next, the events are aggregated and input. All enhanced event records belonging to the same product serial number (i.e., the same physical test object) are strictly ordered according to their timestamps to form a time-correct event sequence related to the complete lifecycle of the test object. Subsequently, this event sequence is streamed into the rule engine instance created for this product type. Through this aggregation and sorting operation, it is ensured that the input data processed by the rule engine is logically complete and time-accurate.
[0117] Subsequently, the rule engine instance, based on the state machine or temporal logic defined by its internal rule set, progressively parses the input event sequence. It examines each new event to determine if it meets the triggering or state transition conditions defined by a rule in the current state. When the evolution of the event sequence fully satisfies all conditions for a rule from triggering to termination, the rule engine instance determines that the test is complete and immediately generates a structured "test semantic record." This "test semantic record" includes at least the final test result (e.g., "pass" or "fail"), key process features extracted from this test (e.g., total time, specific parameter values), and identifiers of all relevant original events referenced. This achieves real-time, objectivity, and consistency in test result determination, elevating raw, low-level signal events into structured information with high business value.
[0118] Finally, invalid event identification and feedback statistics are performed. During the streaming matching process of the rule engine, event sequences or isolated events that cannot match the expected logic of all loaded rule sets are identified. These events typically originate from signal acquisition anomalies (such as interference jitter), communication errors, or unexpected production operations and are marked as "logically invalid events." The source of each logically invalid event is also recorded, i.e., the corresponding monitoring unit identifier. This step generates a set of data quality feedback signals. By statistically analyzing the number and proportion of logically invalid events generated by each monitoring unit, the validity and reliability of data at each data acquisition point can be quantitatively evaluated. This feedback information is one of the core inputs for subsequent dynamic optimization steps to evaluate the effectiveness of the acquisition strategy, identify problematic units, and guide resource reallocation, thereby driving the system to continuously evolve towards acquiring higher-quality and more valuable data.
[0119] It should be noted that the criteria for determining invalid logical events include timing consistency constraints, signal correlation constraints, and rule matching constraints: Timing consistency constraints require that the sequence of enhanced events under the same product serial number must conform to the time order of the test process (e.g., "start test, parameter acquisition, complete test"), and event sequences that are out of order or skip steps are considered invalid; Signal correlation constraints require that the signal state changes contained in the enhanced event sequence must be related to the physical process of product testing (e.g., parameter acquisition events that occur before the test is started are considered invalid); Rule matching constraints require that the matching score between the enhanced event sequence and the test logic rule set is less than 60 points (the matching score is calculated by: traversing all rules, calculating the number of attribute matches and timing match deviations between the event sequence and the expected rules, using weighted summation to obtain the individual rule matching score, and taking the highest individual rule matching score as the sequence matching score, with a full score of 100 points). The definition of "related events" is as follows: if an event sequence is determined to be invalid due to timing consistency constraints or signal correlation constraints, all events in the sequence are marked as logically invalid events; if it is determined to be invalid due to rule matching constraints, only isolated events in the sequence that do not match all rule expectations are marked as logically invalid events, while other events in the sequence that meet the basic constraints (timing, correlation) are still retained as valid events, but they do not participate in the generation of test semantic records.
[0120] In one embodiment, the method further includes a data quality self-healing step, specifically comprising:
[0121] S461, monitors the frequency of invalid logical events generated by each listening unit;
[0122] S462, when the frequency of the logical invalid event of a certain monitoring unit exceeds a preset multiple of its historical normal fluctuation range, a special diagnosis for the monitoring unit is triggered.
[0123] S463, Perform the specific diagnostics, including:
[0124] Verify the communication link status between the monitoring unit and the PLC;
[0125] Check whether its current operating parameters are within the parameter range supported by the protocol adapter;
[0126] Analyze the time series characteristics of the logically invalid events described therein;
[0127] S464, Obtain the result of the specific diagnosis, and perform at least one of the following self-healing operations based on the result of the specific diagnosis:
[0128] If the communication link status is abnormal, the connection with the PLC is reset through the protocol adapter;
[0129] If the current operating parameters exceed a reasonable range, the information value quantification weight of the monitoring unit will be temporarily reduced in the next cycle calculation to trigger a conservative parameter adjustment.
[0130] If the time series characteristics of the logically invalid event exhibit regular fluctuations, an additional penalty factor is introduced when calculating its target resource quota, including: multiplying the marginal benefit calculated by the monitoring unit by a correction coefficient less than 1 before participating in subsequent iterative calculations.
[0131] As described in steps S461-S464 above, this step of the present invention is an independent, event-driven safeguard process. Its technical purpose is to actively monitor abnormal quality trends of front-end collected data, automatically diagnose the root causes of abnormalities, and perform targeted corrective operations, thereby maintaining the stability and reliability of the overall system acquisition performance without human intervention and enhancing the system's long-term robustness in complex industrial environments.
[0132] Specifically, the system continuously tracks the number of invalid logical events generated by each monitoring unit and calculates their real-time frequency. This monitoring process is based on the historical behavior baseline of each monitoring unit. By analyzing the data on the occurrence of invalid logical events in each unit over a period of time, the system establishes its "historical normal fluctuation range." This range is dynamically determined through statistical methods (such as calculating the moving average and standard deviation). When the system detects that the real-time frequency of invalid logical logical events in a certain monitoring unit continuously exceeds a preset multiple of its historical normal fluctuation range (for example, exceeding twice the standard deviation of the historical average), it determines that the unit has an abnormal quality trend. This achieves intelligent anomaly detection based on individual behavioral baselines, avoiding false alarms or missed alarms that may be caused by using a uniform threshold for all units. It can keenly perceive significant degradation in the data quality of a single collection point, providing accurate trigger signals for timely intervention.
[0133] Once the triggering conditions are met, the system initiates a specific diagnostic for the abnormal monitoring unit, conducting an in-depth investigation of the specific unit and its associated context. The generation and issuance of diagnostic instructions are automated, ensuring timely response. Step S463 defines the specific investigation dimensions included in the specific diagnostic. First, it verifies the communication link status between the monitoring unit and the target PLC by sending dedicated test messages, checking communication response time, or evaluating the packet loss rate and retransmission rate at the link layer. This aims to determine whether there is instability, interruption, or performance degradation in the physical connection or protocol session layer. Second, it checks the current operating parameter configuration of the monitoring unit. The system compares the currently used acquisition parameters (such as sampling period and debouncing time) with the reasonable range of parameters supported and recommended by the protocol adapter bound to the unit. It also considers the current production conditions (such as product testing cycle time) to determine whether the existing parameters are still suitable and whether there are configuration failures due to environmental changes. Third, the time series characteristics of the logical invalid events generated by the unit are analyzed. The system uses time series analysis methods to check whether the occurrence of invalid events exhibits regular periodic jitter, sudden clusters or other identifiable patterns, in order to distinguish between random interference and systematic signal or configuration problems.
[0134] Based on the deep diagnostic results of step S463, step S464 executes corresponding self-healing operations. According to the diagnostic conclusions, the system automatically selects and executes at least one of the following corrective measures: If the diagnosis confirms an abnormal communication link status, the system proactively initiates a connection reset process through the protocol adapter to attempt to rebuild a stable communication channel and repair the underlying transmission fault. If the diagnosis finds that the current operating parameters have deviated from a reasonable range or are mismatched with the operating conditions, the system adopts a more intelligent intervention approach: In the dynamic optimization calculation of the acquisition strategy in the next cycle, the information value quantification weight of the abnormal unit is temporarily reduced. This operation will guide the optimization algorithm to allocate a more secure weight to the unit in the game equilibrium calculation. The system maintains a target resource quota (meaning lower and more stable resource consumption), and then generates a new set of safer and more robust collection parameters through reverse parameter calculation. This achieves parameter smoothing and automatic correction. If diagnostic analysis indicates that logically invalid events exhibit a regular jitter pattern, the system introduces an additional penalty factor for that unit in subsequent optimization calculations. For example, when calculating its marginal benefit, its information value quantification weight is multiplied by a correction coefficient less than 1. In the optimization algorithm, the credibility and value score of that data source are temporarily reduced, causing the system to temporarily reduce its dependence on it during resource allocation until the abnormal pattern disappears, achieving progressive correction of resource scheduling degradation. This allows the system to not only passively receive quality feedback but also actively identify, analyze, and correct anomalies at the data collection source, thereby improving the system's inherent resilience against interference and adaptation to unknown operating conditions, and reducing the need for operation and maintenance intervention.
[0135] In one embodiment, the step of periodically calculating the target resource quota for each monitoring unit based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the logical invalid events, and generating parameter adjustment instructions, includes:
[0136] S51, for each key test signal point, obtain the number and level of key rules triggered in the test rule base, as well as the cost associated with historical test failures, in order to calculate its information value quantification weight.
[0137] For example, the information value quantification weight is calculated using a weighted summation method, with a value range of 0 to 10. It corely combines two dimensions: rule association importance and historical failure cost. Regarding rule association importance, key rules are divided into three levels (Level 1 corresponds to product qualification judgment, Level 2 to process parameter evaluation, and Level 3 to auxiliary information collection), assigned weights of 3, 2, and 1 respectively. The rule association importance score is obtained by statistically analyzing the number of rules triggered by each level at the signal point and normalizing the data. Regarding historical failure cost, the number of test failures related to the signal point and the average cost per failure (including material, downtime, and order delay costs) over the past 12 months are statistically analyzed and compared with a preset cost benchmark value before normalization, resulting in a historical failure cost score. The two scores are weighted and summed in a default ratio of 6:4, which is the basic weight. Furthermore, the proportion of logically invalid events will adjust the basic weight: when the proportion exceeds 30%, the weight is adjusted by (1 - proportion); when the proportion is between 10% and 30%, it is adjusted by (1 - proportion / 2); and when the proportion is below 10%, the weight remains unchanged.
[0138] S52 collects the real-time resource consumption rate of each monitoring unit in the previous cycle, and calculates the statistical average by time dimension to obtain the corresponding average resource consumption rate.
[0139] S53, with the goal of maximizing the overall information value acquisition, under the constraint of the total system resource budget, the information value of each monitoring unit is quantified and weighted, and the average resource consumption rate is used as the initial resource quota of each monitoring unit. Through multiple rounds of distributed negotiation iteration, the target resource quota of each monitoring unit in the next cycle is calculated.
[0140] S54. Based on the target resource quota of each monitoring unit and combined with the parameter-resource consumption mapping model of the protocol adapter, the specific acquisition parameter adjustment value is solved by numerical optimization method and encapsulated as the parameter adjustment instruction.
[0141] As described in steps S51-S54 above, the technical objective of this invention is to periodically generate a parameter adjustment strategy that continuously optimizes the overall system performance based on quantified data value, real-time resource consumption, and feedback data quality through a set of calculation models. This solves the problem in the background technology where static configuration prevents the system from maintaining the optimal balance between data acquisition value and resource consumption in a dynamic environment.
[0142] Specifically, for each monitored key test signal point, its "information value quantification weight" is calculated. The calculation of this "information value quantification weight" is based on two aspects: First, the importance of the signal point in the predefined test rule base. The system counts the number of test rules associated with the signal point as a trigger condition or key judgment condition, and performs a weighted sum based on the predefined business level (such as critical, important, and general) of each rule. Second, the historical failure associated costs of the signal point. The system retrieves all records from the historical test semantic records that caused test failures due to events containing the signal point, and estimates the average production loss (such as material scrap cost, equipment downtime cost, and order delay cost) caused by each failure based on a predefined model, and then calculates its average. Subsequently, the system normalizes the evaluation results of the two dimensions and merges them according to a preset ratio to generate a comprehensive and comparable numerical weight. This enables the system to clearly distinguish the value difference between the "emergency stop alarm" signal and the "fan operation" signal at the business level, transforming qualitative business importance into quantitative optimization target driving factors, and laying a precise numerical foundation for the subsequent realization of differentiated, value-driven resource scheduling.
[0143] Then, resource consumption data collection is performed in parallel. At the end of each optimization cycle, the "real-time resource consumption rate" of each monitoring unit over the past cycle is collected. This "real-time resource consumption rate" is a comprehensive performance indicator, calculated by monitoring the proportion of processor time slices used by the monitoring unit, memory usage, and network traffic data generated, and aggregating these data according to a predefined model. The collected unit consumption rates are statistically averaged over time to form the "average resource consumption rate" for each unit. This step provides a realistic picture of the system's operational state for optimization decisions. It depicts the actual usage of system computing and communication resources by each data collection task under the current configuration, serving as a realistic baseline for measuring the current resource allocation pattern.
[0144] Next, a game-theoretic equilibrium-based solution for the target resource quota is executed. This model transforms a constrained optimization problem into a distributed negotiation process. The goal is to find a set of target resource quotas allocated to each monitoring unit, given a "total system resource budget" (i.e., the maximum total resource consumption allowed in the current period), maximizing the overall information value output of all units. During algorithm initialization, the average resource consumption rate of each unit in the previous period is set as its initial resource quota. Subsequently, multiple rounds of iterative negotiation are conducted. In each iteration, each unit calculates its "marginal benefit" (i.e., the value contributed by a unit quota) based on its current quota and the information value quantification weight of its signal points. All units exchange marginal benefit information and calculate the global average. Each unit then autonomously calculates an adjustment amount for its resource quota based on the deviation between its own marginal benefit and the global average, with the adjustment direction driving its own marginal benefit towards the global average. This process iterates multiple times until the marginal benefits of all units converge, reaching a "Nash equilibrium" state. At this point, the temporary quota held by each unit is determined as the "target resource quota" for the next period. This step simulates a resource market, automatically and fairly allocating scarce system resources (computing power, bandwidth) to numerous concurrent data collection tasks through a distributed, marginal benefit-based negotiation mechanism. As a result, high-value tasks with relatively low current resource consumption will receive more quotas, while low-value tasks or those that consume large amounts of resources but produce low-quality data (many invalid events) will have their quotas reduced. This achieves continuous optimization of the total information value output under limited resource constraints at the system-wide level.
[0145] It should be noted that the convergence threshold is related to the total system resource budget and the number of monitoring units, with a value ranging from 0.01 to 0.1. The more monitoring units there are and the greater the difference in initial marginal benefits, the more lenient the threshold becomes. To avoid infinite iteration, the maximum number of iterations is dynamically set in conjunction with the number of monitoring units. It is based on the common logarithm of the number of monitoring units, scaled proportionally, and then superimposed on a fixed base to balance iteration efficiency and resource allocation accuracy. When the variance of the marginal benefits of all monitoring units in continuous iterations is lower than the convergence threshold, or when the number of iterations reaches the maximum value, the algorithm stops and uses the current resource quota variable value as the target resource quota. If the algorithm fails to converge after reaching the upper limit of the number of iterations, a system alarm is triggered.
[0146] Finally, the parameters are inversely calculated, transforming the abstract optimization objective into concrete execution instructions. Internally, the system maintains a "parameter-resource consumption mapping model" for each type of protocol adapter. This model describes the functional or empirical relationship between the values of key adjustable acquisition parameters (such as sampling period and signal debouncing time) and the expected resource consumption rate. For each monitoring unit, the system uses its target resource quota as the desired output value and, using its corresponding mapping model, employs numerical optimization methods (such as model-based prediction, interpolation, or iterative search) to inversely calculate a set of specific parameter values that best approximate the target quota for its expected resource consumption. Finally, these parameter values are encapsulated into explicit "parameter adjustment instructions," enabling the abstract strategy derived from value and equilibrium calculations to be precisely translated into concrete operational commands that drive changes in the behavior of the underlying monitoring units, ensuring the entire optimization decision is implemented effectively. This allows the system to continuously and automatically adjust its global acquisition strategy based on real-time feedback data value, resource consumption, and quality indicators, thus endowing it with the adaptive capability to maintain acquisition performance close to the theoretical optimal state when facing changing production rhythms, fluctuating network conditions, and diverse product types.
[0147] It should be noted that the parameter-resource consumption mapping model is a quantitative relationship model bound one-to-one with the protocol adapter. Its core components include an input layer, a mapping function layer, and an output layer. The input layer contains the key adjustable acquisition parameters of the monitoring unit, specifically the sampling period, signal debouncing time, and trigger sensitivity threshold. The output layer consists of three core resource consumption indicators: processor utilization, memory usage, and network bandwidth utilization. The model is constructed using a combination of experimental statistics and dynamic calibration: First, through orthogonal experimental design, several sets of resource consumption data are collected under different parameter combinations. An initial mapping function is obtained by fitting multiple linear regression or gradient boosting tree algorithms (linear protocol adapters use a linear regression model, and nonlinear protocol adapters use a gradient boosting tree model). During system operation, at regular intervals (e.g., 24 hours), the model automatically collects the parameter configuration and actual resource consumption data within that period, and updates the coefficients of the mapping function using the least squares method to achieve dynamic iterative calibration of the model. The model's calling logic is as follows: after obtaining the target resource quota of the monitoring unit, the target values of processor utilization and network bandwidth utilization are used as constraints. The mapping function is solved by Newton's iteration method to obtain the corresponding sampling period, debouncing time and trigger sensitivity threshold adjustment value.
[0148] It should also be noted that during the iterative calculation of the distributed game equilibrium algorithm, the adjustment terms generated by the data quality self-healing step need to be incorporated into the quantitative calculation logic: For monitoring units whose current operating parameters are determined to be outside the reasonable range by a special diagnosis, their basic weight value will be multiplied by a temporary attenuation coefficient of 0.6 to 0.8 (this coefficient can be adjusted in the system configuration according to the production line's data integrity requirements) when calculating the information value quantification weight in the next cycle. The attenuated weight value is directly used as the input parameter for calculating the marginal benefit. For monitoring units where logical invalid events exhibit regular fluctuations, the initial calculation result needs to be multiplied by a penalty correction coefficient of 0.5 to 0.7 when calculating the marginal benefit in each iteration. The corrected marginal benefit then participates in the calculation of the global average marginal benefit and the solution of the resource quota adjustment amount. The initial values of the above attenuation coefficient and penalty correction coefficient are calibrated experimentally and can be dynamically optimized based on the feedback data of the self-healing effect during system operation.
[0149] In one embodiment, with the goal of maximizing overall information value acquisition, under the constraint of the total system resource budget, the steps of quantifying the information value of each monitoring unit based on its weight, using the average resource consumption rate as the initial resource quota for each monitoring unit, and calculating the target resource quota for each monitoring unit in the next cycle through multiple rounds of distributed negotiation iterations include:
[0150] S531 sets the total resource budget for the system in the current period;
[0151] S532, set a resource quota variable for each of the listening units, and set its initial value to the average resource consumption rate of the listening unit in the previous period;
[0152] S533, enter the iteration loop, and perform the following operations in a single iteration:
[0153] (1) Each monitoring unit calculates its marginal benefit based on its current resource quota variable and information value quantification weight;
[0154] In the formula, It represents marginal benefit (used to measure the information value contributed by the current unit of resource consumption of this unit, which is calculated in each round of the game equilibrium iteration). This indicates the weighting of information value. This indicates the current resource quota variable of the monitoring unit in this iteration round, which is continuously updated in subsequent iterations based on the resource quota adjustment amount;
[0155] (2) Calculate the global average marginal benefit of the marginal benefits of all the aforementioned listening units;
[0156] (3) Each monitoring unit calculates its resource quota adjustment amount based on the deviation between its own marginal benefit and the global average marginal benefit, and the adjustment direction is to make the marginal benefit converge to the global average marginal benefit;
[0157]
[0158] In the formula, This represents the resource quota adjustment amount (based on the deviation between the monitoring unit's own marginal benefit and the global average marginal benefit, combined with a preset adjustment step size, expressed through a function). The function was calculated. The specific form aims to drive marginal benefits to converge toward the global average marginal benefit, for example, it could be proportional adjustment. This represents the marginal benefit of the target unit. This represents the global average marginal benefit (i.e., the weighted average obtained by collecting the marginal benefits of all listening units in each iteration). This indicates the adjustment step size (a preset parameter that controls the adjustment range; it is a constant preset for algorithm stability, or it may decrease adaptively based on the number of iterations).
[0159] (4) Each of the listening units applies the resource quota adjustment amount to update its current resource quota variable, and after all the listening units have updated, the resource quota variable is normalized to ensure that their sum does not exceed the total resource budget;
[0160] S534, when the variance of the marginal benefit of all monitoring units in continuous iteration is lower than the preset convergence threshold, the iteration is stopped, and the final value of the resource quota variable of each monitoring unit is determined as its target resource quota.
[0161] As described in steps S531-S534 above, the technical objective is to combine the differentiated information value of each monitoring unit with the system's total resource budget constraints through a distributed, convergent mathematical iterative process, and solve a set of specific resource allocation schemes that maximize the global information value output, thereby providing a precise quantitative basis for generating the final parameter adjustment instructions.
[0162] Specifically, the preferred system determines and sets the "total system resource budget" for the current optimization cycle based on the current operating conditions, overall load level, and comprehensive requirements for real-time data acquisition. This "total system resource budget" is a clear numerical constraint, representing the maximum amount of resources (usually measured by aggregated processor usage, memory bandwidth, or network throughput) that the system is allowed to allocate to all listening units for signal acquisition tasks under the current environment. Its significance lies in transforming the optimization problem from an open, unconstrained optimization to a realistic, resource-limited constrained optimization problem, ensuring that the final resource allocation scheme is physically feasible and will not lead to system overload.
[0163] The system then creates an independent "resource quota variable" for each monitoring unit participating in the optimization, and sets the initial value of the "resource quota variable" to the average resource consumption rate of the monitoring unit in the previous optimization cycle. It uses the system's most recent actual operating state as the starting point for the iterative search. Compared with random initialization, this method allows the iterative algorithm to start from a position close to the current effective operating point, thereby accelerating the convergence speed, improving the efficiency and stability of the optimization process, and enabling each periodic optimization calculation to be smoothly adjusted based on the previous run, rather than oscillating violently. In each iteration, the algorithm sequentially performs the following four calculation operations: (1) Each monitoring unit quantifies the weight of its current resource quota variable value and its corresponding information value. It quantifies the information value that the unit can contribute per unit of resource consumption under the current quota, which is the core signal driving resource flow. (2) All units exchange their marginal benefit values through communication. The system calculates the weighted average of these values to obtain the "global average marginal benefit", which represents the overall average level of information value contributed by unit resource consumption in the system in the current iteration. (3) Each unit calculates its "resource quota adjustment amount" according to the predefined adjustment strategy function based on the deviation between its own marginal benefit and the global average marginal benefit. The design principle of this function is that if the unit's own marginal benefit is higher than the global average, it should increase its resource quota to contribute more value (but the increase will lead to a decrease in its marginal benefit); if it is lower than the global average, it should reduce its quota to release resources to more efficient units. The adjustment direction is always to drive the unit's own marginal benefit to converge to the global average benefit. (4) Each unit updates its resource quota variable by applying the calculated adjustment amount. After all units have been updated, the system performs a normalization process on all resource quota variables, forcing their sum to be constrained within the total system resource budget set in step S531.
[0164] Finally, the algorithm continuously runs the iterative loop defined in S533, calculating the statistical variance of the marginal benefit values of all monitoring units after each iteration. The system presets a "convergence threshold" to characterize the standard for achieving equilibrium. When it is detected that the marginal benefit variance of all units is stably lower than this convergence threshold for several consecutive iterations, the algorithm is determined to have converged to the equilibrium point. At this point, the system immediately stops iterating and determines the value of the final resource quota variable currently held by each monitoring unit as the "target resource quota" for that unit in the next cycle. This convergence determination mechanism ensures the stability and reliability of the algorithm's output, avoids infinite loops or result oscillations, and ensures that each optimization calculation outputs a definite and usable resource allocation scheme. This enables the overall information value output of the system to reach or approach the Pareto optimal solution.
[0165] In one embodiment, the steps of outputting the test semantic records and optimization process information and providing a visual display include:
[0166] S71, obtain the parameter adjustment history, and output the test semantic record and the dataset containing the real-time resource consumption rate of each monitoring unit, the information value quantification weight, the target resource quota and the parameter adjustment history;
[0167] S73, Generate visualization instructions based on the test semantic records and the dataset to control the visualization interface to be updated synchronously;
[0168] S75, in response to external input received through the visual interface (user-initiated input via interactive controls), perform at least one of the following operations:
[0169] (a) If the external input is an adjustment value for the information value quantification weight of the total resource budget of the system or a specific key test signal point, then the adjustment value is used as an input parameter and applied to the next calculation cycle;
[0170] (b) If the external input is a selection instruction for a specific test semantic record, then retrieve and return the original event sequence associated with the test semantic record, the bound production context information, and the relevant historical performance data.
[0171] As described in steps S71-S75 above, the technical objective is to integrate and push high-value test results generated by internal processing with key optimization decision-making process information and present them in a collaborative and visual form, while providing a controlled human intervention channel, so that the system is both automated and has reliable human-machine collaboration capabilities.
[0172] Specifically, the system first retrieves the recorded "parameter adjustment history" from internal storage or message queues. This history records all parameter adjustment commands issued, target monitoring units, adjustment times, and expected optimization goals. Next, the system structurally encapsulates and outputs two types of data streams: the first is a "test semantic record" stream, containing all test conclusions, feature values, and related information generated by the rule parsing engine; the second is an "optimization process information" dataset, a comprehensive state snapshot that synchronously includes at least the current real-time resource consumption rate of each monitoring unit, the calculated information value quantification weight, the latest determined target resource quota, and the acquired parameter adjustment history. This achieves synchronous output and externalization of processing results and decision-making processes. It transforms the system's internal computational state (such as resource quotas and value weights) and decision history (parameter adjustments) into standardized, consumable data, enabling downstream display systems or operation and maintenance analysis platforms not only to know the test results but also to understand why the system made such adjustments to its collection strategy. This provides a complete data foundation for building a transparent and auditable operating system.
[0173] Then, based on the aforementioned data, visualization instructions are generated to drive interface updates. The system receives the data stream pushed by step S71 and generates specific visualization instructions based on predefined visual coding rules and view layout templates. These instructions then control the visualization interface for real-time and synchronous updates. The visualization interface is a multi-view collaborative display system, including at least: a real-time test status dashboard that dynamically scrolls and displays the pass / fail counts and latest results for each workstation; a resource-information game equilibrium diagram that displays the real-time values and historical trend lines of the information value quantification weight, resource consumption rate, and marginal benefit of each monitoring unit in chart form, clearly marking the occurrence time of each parameter adjustment event; and a test details traceability panel. This step, through multi-view collaboration and process visualization, transforms the complex internal state and optimization logic of the system into intuitive graphical information. It enables maintenance personnel to grasp the overall test overview at a glance and understand how the optimization algorithm dynamically adjusts resource allocation based on value and consumption through trend charts. This transforms the system from a black box into a white box with transparent state and decision-making logic, enhancing the maintenance personnel's monitoring capabilities and trust in the system's automated behavior.
[0174] Furthermore, the visual interface provides specific interactive controls for receiving external input, allowing authorized operations and maintenance personnel to proactively intervene. This step explicitly responds to two types of input operations: First, if the external input is an adjustment value for the "total system resource budget" or the "quantification weight of the information value of a specific key test signal point," the system will treat this adjustment value as a high-priority input parameter and directly apply it to the optimization process of the next calculation cycle. For example, if an engineer manually increases the weight of a key signal point related to safety based on production experience, this value will override the value previously calculated by the algorithm and directly affect the game equilibrium calculation in the next round, thereby changing the resource allocation strategy. Second, if the external input is a selection instruction issued by the user for a "specific test semantic record" through clicks or other operations, the system will trigger an associated query process, automatically retrieving and returning the original event sequence completely associated with the test record, the bound production context information, and the relevant historical performance data curves of the equipment or signal points involved in the test. This achieves a two-way human-machine collaborative closed loop, which not only clearly presents the internal state and decision-making logic of the system to humans, but also provides a standard channel for "injecting" human expert experience, domain knowledge and real-time diagnostic intent into the automated optimization process. When faced with special working conditions that the algorithm has not experienced or when it is necessary to prioritize specific business objectives, it can make decisions that are more in line with the actual needs of complex production through human-machine collaboration, thereby improving the flexibility and reliability of the system.
[0175] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of a PLC test data processing method based on signal transition monitoring.
[0176] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of a PLC test data processing method based on signal transition monitoring.
[0177] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0178] The above description is merely a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A PLC test data processing method based on signal transition monitoring, characterized in that, include: Obtain the configuration information of the target PLC, establish a communication connection with the target PLC based on the configuration information, and create a listening unit for each key test signal point; The monitoring unit captures signal transitions and generates raw events with timestamps. The original events are correlated and matched with production events from external systems to generate enhanced event records; The enhanced event records are logically parsed using a predefined test rule base to generate test semantic records, and the logically invalid events generated by each listening unit are statistically analyzed. Based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the aforementioned invalid events, the target resource quota of each monitoring unit is calculated periodically using a distributed game equilibrium algorithm, and parameter adjustment instructions are generated. Adjust the operating parameters of the corresponding monitoring unit according to the parameter adjustment command; Output the test semantic records and optimization process information, and provide a visual display.
2. The PLC test data processing method based on signal transition monitoring according to claim 1, characterized in that, The step of associating and matching the original event with production events from external systems to generate enhanced event records includes: Real-time acquisition of the average cycle time of the current production line, as well as the average network round-trip latency from the PLC to the computing device; For each of the original events, the half-width of the associated time window is dynamically calculated based on its timestamp, average tick time, and average network round-trip delay. A time window is constructed centered on the timestamp of the original event and combined with the half-width of the associated time window, and candidate production events within the time window are retrieved from the production event stream. For each candidate production event, calculate its time proximity score to the timestamp of the original event; The candidate production event with the highest time proximity score is selected. If its time proximity score is greater than a preset matching threshold, it is determined to be a successful match. If its time proximity score does not exceed the preset matching threshold, it is marked as a failed match. The product serial number and work order number in the successfully matched candidate production event are bound to the original event to generate an enhanced event record.
3. The PLC test data processing method based on signal transition monitoring according to claim 1, characterized in that, The steps of using a predefined test rule base to logically parse the enhanced event records, generate test semantic records, and statistically analyze the logically invalid events generated by each monitoring unit include: Extract the product serial number from the enhanced event record, and match the applicable test logic rule set from the test rule base according to the product type corresponding to the product serial number; Create a rule engine instance for each product type that is in an active testing state, and load the corresponding test logic rule set; All enhanced event records under the same product serial number are collected and sorted in chronological order to form an enhanced event sequence associated with the same test object, and the enhanced event sequence is input into the corresponding rule engine instance; The rule engine instance performs streaming state matching based on the test logic rule set. When the enhanced event sequence satisfies the triggering and completion conditions of any rule in the test logic rule set, a test semantic record is generated. When the enhanced event sequence does not match the expectations of all rules in the test logic rule set, the relevant events in the enhanced event sequence are marked as logically invalid events, and the identifier of the listening unit that generated the logically invalid event is recorded.
4. The PLC test data processing method based on signal transition monitoring according to claim 3, characterized in that, It also includes data quality self-healing steps, specifically including: Monitor the frequency of invalid logical events generated by each listening unit; When the frequency of the logical invalid event of any of the monitoring units exceeds a preset multiple of its historical normal fluctuation range, a special diagnosis for that monitoring unit is triggered. Performing the specific diagnostics includes: Verify the communication link status between the monitoring unit and the PLC; Check whether its current operating parameters are within the range supported by the protocol adapter; Analyze the time series characteristics of the logically invalid events described therein; Obtain the results of the specific diagnosis, and perform at least one of the following self-healing operations based on the results of the specific diagnosis: If the communication link status is abnormal, the connection with the PLC is reset through the protocol adapter; If the current operating parameters exceed a reasonable range, the information value quantification weight of the monitoring unit will be temporarily reduced in the next cycle calculation to trigger a conservative parameter adjustment. If the time series characteristics of the logically invalid event exhibit regular fluctuations, an additional penalty factor is introduced when calculating its target resource quota.
5. The PLC test data processing method based on signal transition monitoring according to claim 4, characterized in that, The step of periodically calculating the target resource quota for each monitoring unit based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the logical invalid events, and generating parameter adjustment instructions through a distributed game equilibrium algorithm includes: For each key test signal point, obtain the number and level of key rules triggered in the test rule base, as well as the cost associated with historical test failures, in order to calculate its information value quantification weight. Collect the real-time resource consumption rate of each monitoring unit in the previous period, and calculate the statistical average over time to obtain the corresponding average resource consumption rate. With the goal of maximizing the overall information value acquisition, under the constraint of the total system resource budget, the information value of each monitoring unit is quantified and weighted, and the average resource consumption rate is used as the initial resource quota of each monitoring unit. Through multiple rounds of distributed negotiation iteration, the target resource quota of each monitoring unit in the next cycle is calculated. Based on the target resource quota of each monitoring unit and combined with the parameter-resource consumption mapping model of the protocol adapter, the adjustment value of the acquisition parameter is solved by numerical optimization method and encapsulated into parameter adjustment instruction.
6. The PLC test data processing method based on signal transition monitoring according to claim 5, characterized in that, The steps for maximizing overall information value acquisition, under the constraint of the total system resource budget, based on the information value quantification weight of each monitoring unit, and using the average resource consumption rate as the initial resource quota for each monitoring unit, to calculate the target resource quota for each monitoring unit in the next cycle through multiple rounds of distributed negotiation iterations include: Set the system's total resource budget for the current period; Set a resource quota variable for each monitoring unit and set its initial value to the average resource consumption rate of the monitoring unit in the previous period; Enter the iteration loop and perform the following operations in a single iteration: Each of the aforementioned monitoring units calculates its marginal benefit based on its current resource quota variable and information value quantification weight; Calculate the global average marginal benefit of the marginal benefits of all the aforementioned listening units; Each monitoring unit calculates its resource quota adjustment amount based on the deviation between its own marginal benefit and the global average marginal benefit, and the adjustment direction is to make the marginal benefit converge to the global average marginal benefit; Each of the aforementioned monitoring units updates its current resource quota variable using the resource quota adjustment amount; When the variance of the marginal benefit of all monitoring units in continuous iteration is lower than the preset convergence threshold, the iteration stops, and the final value of the resource quota variable of each monitoring unit is determined as its target resource quota.
7. The PLC test data processing method based on signal transition monitoring according to claim 6, characterized in that, The steps for outputting the test semantic records and optimization process information, and providing a visual representation, include: Obtain the parameter adjustment history, and output the test semantic record and the dataset containing the real-time resource consumption rate of each monitoring unit, the information value quantification weight, the target resource quota and the parameter adjustment history; Based on the test semantic records and the dataset, visualization instructions are generated to control the visualization interface to be updated synchronously. In response to external input received through the visual interface, perform at least one of the following operations: If the external input is an adjustment value for the information value quantification weight of the system's total resource budget or a specific key test signal point, then the adjustment value is used as an input parameter and applied to the next calculation cycle. If the external input is a selection instruction for a specific test semantic record, then the original event sequence associated with the test semantic record, the bound production context information, and the relevant historical performance data are retrieved and returned.
8. A PLC test data processing system based on signal transition monitoring, characterized in that, include: The protocol configuration module is used to obtain the configuration information of the target PLC, establish a communication connection with the target PLC based on the configuration information, and create a listening unit for each key test signal point. The signal acquisition module is used to capture signal transitions through the monitoring unit and generate raw events with timestamps. The association matching module is used to associate and match the original event with production events from external systems to generate enhanced event records; The parsing and statistics module is used to perform logical parsing on the enhanced event records using a predefined test rule base, generate test semantic records, and count the logically invalid events generated by each listening unit. The strategy optimization module is used to periodically calculate the target resource quota of each monitoring unit based on the information value of each key test signal point, the resource consumption data of each monitoring unit, and the statistics of the logical invalid events, and generate parameter adjustment instructions. The dynamic update module is used to adjust the operating parameters of the corresponding monitoring unit according to the parameter adjustment instructions; The integrated display module is used to output the test semantic records and optimization process information, and provide a visual display.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.