A fault prediction system for meter box operating conditions

By monitoring the digital input anti-jitter of the metering box and analyzing the waiting time of RTOS kernel tasks, frequency domain energy distribution state variables and time consumption trend polynomial parameters are generated. This solves the problem of fine-grained identification of complex anomalies in the metering box scenario and realizes the forward identification and accurate early warning of faults.

CN122487784APending Publication Date: 2026-07-31LONGZHIXING ELECTRIC POWER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LONGZHIXING ELECTRIC POWER TECH CO LTD
Filing Date
2026-05-07
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately break down complex anomalies caused by the interplay of external input jitter and internal task competition into specific contributing factors in metering scenarios. This results in early warnings that are biased towards the macro level and lack fine-grained support for the fault formation path. Early disturbances are averaged out, local degradation is weakened, and critical failures are detected with a lag.

Method used

The digital input anti-shake monitoring module obtains the time interval value between the external anti-theft micro switch and the digital I/O pin at the pulse cascade port of the metering box, generates the frequency domain energy distribution state quantity, and combines it with the task waiting time parameter in the RTOS kernel to generate a high-frequency energy ratio set and a time consumption trend polynomial parameter. The fitting and comparison are then performed to identify digital channel failures and scheduling anomalies.

Benefits of technology

It enables proactive identification of meter box faults, improves the accuracy of early warning and the targeted nature of fault location, and can identify long-term unresponsive tendencies before low-priority tasks have completely lost their response, thereby enhancing the initiative of operation and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122487784A_ABST
    Figure CN122487784A_ABST
Patent Text Reader

Abstract

This invention relates to the field of fault prediction technology, specifically a fault prediction system for the operating status of a metering box. The system includes a digital input anti-jitter monitoring module, which acquires the time interval values ​​generated by the digital I / O pins at the external connection anti-theft microswitch and pulse cascade port of the metering box during transition states, combines them into sequence format data, and then uses this sequence format data. In this invention, a timeout trigger time node is formed by solving a polynomial parameter of the time consumption trend, and is judged in conjunction with the current operating time parameter and the warning time limit setting. This allows for the identification of long-term unresponsive tendencies before low-priority tasks completely lose response, expanding metering box fault prediction from simple state monitoring to an approximate judgment of future failure points, thereby creating more significant gains in warning accuracy, fault location targeting, and proactive operation and maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fault prediction technology, and in particular to a fault prediction system for the operating status of a metering box. Background Technology

[0002] Fault prediction technology mainly focuses on monitoring, modeling, and trend determination of the state evolution of equipment during operation. By continuously collecting and analyzing multi-source operating parameters, behavioral characteristic parameters, and time series change information, it identifies the gradual and abrupt characteristics of equipment in the process of transitioning from normal to abnormal state.

[0003] Existing technologies, in practical operation, emphasize general monitoring and unified trend judgment of equipment state evolution. While they can identify the overall direction of equipment transition from normal to abnormal states, they often struggle to break down the source of anomalies into specific contributing factors when dealing with complex anomalies arising from the interplay of external input jitter and internal task competition in metering scenarios. This leads to warning results that focus on macroscopic anomaly alerts, lacking fine-grained support for the fault formation path. The continuous collection of multi-source operating parameters and time-series change information can easily lead to the juxtaposition of anomalies from different sources, at different rhythms, and with different triggering mechanisms within the same observation level. For example, counting deviations caused by short-term disturbances at pulse cascade ports and task delays caused by accumulated mutex lock waits in the RTOS kernel, while both leaving traces in state evolution, may result in early disturbances being averaged out, local degradation being weakened, and critical failures being detected late if identification is based solely on overall parameter fluctuations or general trend changes. Therefore, improvements are needed. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the existing technology and propose a fault prediction system for the operating status of a metering box.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: a fault prediction system for the operating status of a metering box includes: The digital input anti-shake monitoring module acquires the time interval values ​​generated by the external anti-theft micro switch and the digital I / O pin at the pulse cascade port of the metering box in the jumping state, combines them into sequence format data, generates frequency domain energy distribution state quantity based on the sequence format data, and generates a set of high frequency energy ratio values ​​based on the frequency domain energy distribution state quantity. The failure limit assessment and prediction module fits the high-frequency energy ratio set to generate a stabilization limit fitting extension, compares the stabilization limit fitting extension with the stabilization limit threshold, and determines and generates a digital channel failure warning command. The mutex lock time monitoring module extracts the waiting time parameters and holding time parameters of each task in the RTOS kernel inside the main control MCU to acquire critical resource mutex locks, obtains the extreme value of task waiting time, and arranges and combines the extreme values ​​of task waiting time in each statistical period in time order to generate a time trend polynomial parameter. The scheduling anomaly diagnosis module solves the time consumption trend polynomial parameter, generates a timeout trigger time node quantity, determines the difference between the timeout trigger time node quantity and the current running time parameter, and generates a scheduling starvation fault prediction result when the difference is lower than the warning time limit setting value.

[0006] Preferably, the step of obtaining the high-frequency energy ratio set is as follows: Call the digital I / O pin transition records at the external anti-theft micro switch of the metering box, call the digital I / O pin transition records at the pulse cascade port, calculate the difference between adjacent trigger times according to the triggering order of adjacent transition edges, remove trigger records that do not form a pair of transition edges, and obtain the time interval value. According to the node order of the digital I / O pins at the anti-theft micro switch and the pulse cascade port on the outside of the metering box, the time interval values ​​are arranged continuously at the same node to form a sequence format data. The sequence format data is then converted in the frequency domain item by item to extract the energy amplitude data item corresponding to each frequency point and generate the frequency domain energy distribution state quantity. Based on the frequency domain energy distribution state quantity, high-frequency noise band energy and low-frequency fundamental wave energy are separated according to the preset frequency band boundary. The ratio of high-frequency noise band energy to low-frequency fundamental wave energy is calculated node by node. The node ratio terms missing low-frequency fundamental wave energy are removed. The remaining node ratio terms are arranged in the order of node number to generate a high-frequency energy ratio set.

[0007] Preferably, the step of obtaining the anti-shake limit fitting extension is as follows: Based on the high-frequency energy ratio set, the values ​​of each node ratio item are read in the order of node number. The node number is used as the horizontal arrangement identifier, and the ratio item value is used as the vertical change identifier. The horizontal arrangement identifier and the vertical change identifier are aligned with a straight line. The trend position at the end of the straight line is continued, and the value of the fitting straight line extension point is obtained to generate the anti-shake limit fitting extension amount.

[0008] Preferably, the step of obtaining the digital channel failure warning instruction is as follows: Using the extreme stabilization threshold as a comparison benchmark, the extreme stabilization fitting extension is matched item by item with the corresponding node number. The node number whose extreme stabilization fitting extension is greater than the extreme stabilization threshold is selected. The missed pulse record of the digital pulse input channel corresponding to the node number is read. The missed pulse status judgment parameter of the digital pulse input channel is extracted and a channel failure prediction prompt signal is generated. Read the node number, missed pulse status judgment parameter, and threshold exceedance flag from the channel failure prediction prompt signal, write the node number into the warning object field, write the missed pulse status judgment parameter into the failure basis field, write the threshold exceedance flag into the trigger condition field, and generate a digital channel failure warning command.

[0009] Preferably, the step of obtaining the extreme value of the task waiting time is as follows: Extract the request, grant, and release times of each task acquiring critical resource mutex locks in the RTOS kernel inside the main control MCU. Calculate the waiting time parameter by subtracting the request time from the grant time, and the holding time parameter by subtracting the grant time from the release time. Merge the waiting time parameters by task number within a set periodic unit, and filter the maximum value among the waiting time parameters corresponding to each task number to generate the extreme value of task waiting time.

[0010] Preferably, the steps for obtaining the time-consuming trend polynomial parameter are as follows: The extreme values ​​of task waiting time are arranged in chronological order according to the start time of the statistical period. The task number, the maximum waiting time value and the range of holding time parameters corresponding to each statistical period are recorded. The missing positions of the statistical period are removed. The remaining extreme values ​​of task waiting time are continuously spliced ​​together to form a permutation and combination of extreme values ​​of task waiting time. Based on the arrangement and combination of the extreme values ​​of task waiting time, the change range of the extreme values ​​of task waiting time between adjacent statistical periods is read. The position of the statistical period corresponding to each change range is matched according to the time order. The positions of each statistical period and the extreme values ​​of task waiting time are orthogonally expanded. The characteristic terms of the correlation equation of the time consumption growth trend corresponding to the constant term, the first term, the second term and the residual fluctuation term are extracted to generate the time consumption trend polynomial parameter.

[0011] Preferably, the step of obtaining the timeout trigger time node quantity is as follows: Based on the time consumption trend polynomial parameter, read the parameter values ​​corresponding to the constant term, linear term, quadratic term and residual fluctuation term, substitute them into the time consumption boundary corresponding to the watchdog timeout threshold in the RTOS kernel, calculate the time position when the task waiting time reaches the time consumption boundary item by item, remove the calculation results of the time position earlier than the current running time parameter, and generate the timeout trigger time node quantity.

[0012] Preferably, the step of obtaining the scheduling starvation failure prediction result is as follows: Based on the timeout trigger time node quantity, the current running time parameter is used as the time comparison benchmark. The remaining interval of the timeout trigger time node quantity relative to the current running time parameter is calculated item by item. Time node records with remaining intervals lower than the warning time limit setting value are filtered out. The task priority identifiers corresponding to the time node records are extracted, and a judgment signal for low priority tasks in a long-term unresponsive state is generated. Based on the determination signal that the low-priority task is in a long-term unresponsive state, the low-priority task identifier, the timeout trigger time node quantity, the remaining interval, and the warning time limit setting value are read. The low-priority task identifier is written into the fault object field, the timeout trigger time node quantity is written into the trigger time field, and the remaining interval is written into the prediction basis field to generate a scheduling starvation fault prediction result.

[0013] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, the time interval values ​​generated by the switching states of digital I / O pins are organized and advanced to the frequency domain energy distribution state quantity. Then, a set of high-frequency energy ratios is extracted from the frequency domain energy distribution state quantity. This can transform the originally scattered switching jitter phenomenon into a comparable and extendable degradation characterization, so that the abnormal disturbances at the anti-theft microswitch and pulse cascade port no longer remain at the instantaneous phenomenon level, but form a trend basis with continuous evolution significance. The high-frequency energy ratio set is further fitted to generate the anti-jitter limit fitting extension quantity, and then compared with the limit anti-jitter threshold. This can expose the process of the digital input terminal evolving from slight jitter to the risk of missed pulses in advance, avoiding fault identification remaining after the actual failure occurs, thereby improving the forward-looking identification capability of digital channel anomalies. Further extraction of waiting time parameters and holding time parameters for each task acquiring critical resource mutex locks in the RTOS kernel of the main control MCU, and selection of extreme waiting time values ​​within the statistical period, followed by arranging and combining them in time order to generate a time-consumption trend polynomial parameter, can transform resource occupancy pressure and scheduling congestion pressure into a state trajectory with a time progression relationship, making the changes in internal operating load more interpretable. Then, the timeout trigger time node quantity is formed by solving the time-consumption trend polynomial parameter, and combined with the current running time parameter and the warning time limit setting value for judgment, it can identify the tendency of long-term unresponsiveness before low-priority tasks have completely lost response, expanding the metering box fault prediction from simple state monitoring to an approximate judgment of future failure time points, thereby forming more significant gains in terms of warning accuracy, fault location targeting, and proactive operation and maintenance. Attached Figure Description

[0014] Figure 1 This is a schematic diagram of the principle of the present invention. Detailed Implementation

[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0016] Please see Figure 1 The present invention provides a technical solution: a fault prediction system for the operating status of a metering box, comprising: The digital input anti-shake monitoring module acquires the time interval values ​​generated by the digital I / O pins at the external anti-theft micro switch and pulse cascade port of the metering box in the jumping state, combines them into sequence format data, generates frequency domain energy distribution state quantity based on sequence format data, and generates a set of high frequency energy ratio values ​​based on frequency domain energy distribution state quantity. The failure limit assessment and prediction module fits the high-frequency energy ratio set to generate the anti-shake limit fitting extension. It then compares the anti-shake limit fitting extension with the limit anti-shake threshold to determine and generate a digital channel failure warning command. The mutex lock time monitoring module extracts the waiting time parameters and holding time parameters of each task in the RTOS kernel inside the main control MCU when acquiring critical resource mutex locks. It obtains the extreme value of task waiting time and arranges the extreme values ​​of task waiting time in each statistical period in time order to generate a time trend polynomial parameter. The scheduling anomaly diagnosis module solves the time consumption trend polynomial parameter, generates the timeout trigger time node quantity, determines the difference between the timeout trigger time node quantity and the current running time parameter, and generates a scheduling starvation fault prediction result when the difference is lower than the warning time limit setting value.

[0017] The steps for obtaining the high-frequency energy ratio set are as follows: Call the digital I / O pin transition records at the external anti-theft micro switch of the metering box, call the digital I / O pin transition records at the pulse cascade port, calculate the difference between adjacent trigger times according to the triggering order of adjacent transition edges, remove trigger records that do not form a pair of transition edges, and obtain the time interval value. According to the node order of the digital I / O pins at the external connection of the anti-theft micro switch and the pulse cascade port of the metering box, the time interval values ​​are continuously arranged at the same node to form a sequence format data. The sequence format data is frequency domain converted item by item, and the energy amplitude data item corresponding to each frequency point is extracted to generate the frequency domain energy distribution state quantity. Based on the frequency domain energy distribution state quantity, the high-frequency noise band energy and the low-frequency fundamental wave energy are separated according to the preset frequency band boundary. The ratio of the high-frequency noise band energy to the low-frequency fundamental wave energy is calculated for each node. The node ratio terms missing the low-frequency fundamental wave energy are removed. The remaining node ratio terms are arranged in the order of node number to generate a high-frequency energy ratio set.

[0018] Specifically, call the digital I / O pin jump records at the anti-stealing electricity microswitch external connection of the metering box and the digital I / O pin jump records at the pulse cascade port. These records include the timestamp, node number, and the level status (high level or low level) of the pin. First, sort the jump records from the two sources globally in ascending order according to the timestamp to form a unified event sequence. Then, process this sequence and calculate the difference between adjacent trigger times item by item. Specifically, traverse the sorted sequence containing N events. For the i-th event (1 ≤ i < N) in the sequence, its trigger time is , and the trigger time of the next adjacent event is , calculate the time difference between the two . This process will generate an initial list containing N - 1 time differences. Subsequently, eliminate the trigger records that do not form paired jump edges. This process aims to filter out isolated level changes caused by single interference or at the end of the record sequence. The judgment basis is that for the same node number, its valid level jumps must occur in pairs. For example, a jump from low level to high level and then back from high level to low level constitutes a complete pulse. If a node has two consecutive jumps in the same direction, such as no "high to low" record between two "low to high" records, the first "low to high" record is regarded as an unpaired isolated event, and the associated previous time difference will be removed from the initial list. Similarly, if the last jump record of a node has no subsequent opposite jump to pair within the entire record period, it is also regarded as an isolated record, and the associated time difference is also removed. After screening in this way, all the remaining time differences correspond to a complete pulse width or pulse interval, and finally, the time interval value is obtained.

[0019] Extract the global event sequence containing the timestamp and level status from the previous step according to the node order of the digital I / O pins at the anti-stealing electricity microswitch external connection of the metering box and the digital I / O pins at the pulse cascade port. For frequency domain analysis, resample the original level jump records of each node at equal time intervals according to the set high-frequency fixed sampling rate (such as 10 kHz), and convert the discrete event records into a continuous level amplitude discrete time series. Intercept a continuous data segment of a fixed length from this discrete time series of each node. For example, set the length of each data segment to 1024 sampling points. These amplitude sequences at equal time intervals constitute the sequence format data. Then perform frequency domain conversion item by item on each group of sequence format data. Before the conversion, first apply the Hanning window function to each group of sequence format data for preprocessing to reduce the spectral leakage effect. The specific frequency domain conversion calculation follows the definition of the discrete Fourier transform, and its calculation expression is: ; in, This is the length of the sequence format data, which is 1024. This is the index of the resampled time sample points, ranging from 0 to 1023. It is the first The level amplitude value at each sampling time. It is a frequency point index in the frequency domain. It is the imaginary unit. This is the complex number result obtained after transformation. Due to the use of a 10kHz physical sampling rate, the frequency resolution at this point is... After the transformation is completed, the energy amplitude data item corresponding to each frequency point is extracted, i.e., the energy... Generate the frequency domain energy distribution state of the node.

[0020] Based on the frequency domain energy distribution state quantities of each node generated in the previous process, the high-frequency noise band energy and the low-frequency fundamental wave energy are separated according to the preset frequency band boundaries. The preset frequency band boundaries are set based on the theoretical frequency characteristics of the power pulse signal in the metering box and the physical characteristics of the hardware contact point jitter. For example, the standard power metering pulse frequency is usually below 20Hz. Considering the fundamental wave and low-order harmonics of the signal, the frequency band of the low-frequency fundamental wave energy is set to 0Hz to 100Hz. The high-frequency noise frequency generated by the contact jitter of the mechanical micro switch is usually above 1kHz. Therefore, the boundary of the high-frequency noise band is set to all frequencies above 1kHz. Subsequently, the ratio of the high-frequency noise band energy to the low-frequency fundamental wave energy is calculated for each node. Specifically, for the frequency domain energy distribution state quantity of each node, all energy amplitude data items in the low-frequency fundamental wave band (0Hz-100Hz) are first accumulated to obtain the low-frequency fundamental wave energy of that node. Then, sum up all the energy amplitude data items in the high-frequency noise band (greater than 1kHz) to obtain the high-frequency noise band energy of that node. Calculate the ratio of the two. Next, the ratio of nodes lacking low-frequency fundamental energy is removed. The criterion here is to set an energy effectiveness threshold, which is based on 1% of the average fundamental energy calibrated under normal system operation. For example, if the average fundamental energy of a normal signal is 500 units, the threshold is set to 5 units. If the calculated low-frequency fundamental energy of a certain node... If the value is below this threshold, it is considered that the node currently has no valid pulse signal input, and the calculated ratio R is meaningless and should be removed. All node ratio items that have passed the screening are arranged in the order of their corresponding anti-theft microswitches or pulse cascade ports, etc., to generate a high-frequency energy ratio set.

[0021] The steps to obtain the anti-shake limit fitting extension are as follows: Based on the high-frequency energy ratio set, the values ​​of each node ratio item are read in the order of node number. The node number is used as the horizontal arrangement identifier, and the ratio item value is used as the vertical change identifier. The horizontal arrangement identifier and the vertical change identifier are aligned with a straight line. The trend position at the end of the straight line is continued, and the value of the extension point of the fitted straight line is obtained to generate the anti-shake limit fitting extension amount.

[0022] Specifically, based on the high-frequency energy ratio set, for each independently monitored node (e.g., an anti-theft microswitch), its past consecutive values ​​are extracted. The high-frequency energy ratio within the statistical time window is arranged horizontally using the chronological order of the historical time windows. For example, the first history window The second historical window Similarly, the ratio of the node within the corresponding time window is used as the indicator of vertical change. This yields a series of two-dimensional data points reflecting the evolution of a single node over time. ,in This represents the time window number. Subsequently, a linear regression analysis is performed on these data points using the least squares method, with the goal of finding a straight line. This minimizes the sum of the Euclidean distances from all data points to the line. Slope and intercept The calculation process involves dividing the covariance of the horizontally arranged markers by the covariance of the vertically varied markers, and then dividing the covariance by the variance of the horizontally arranged markers themselves to obtain the slope. The intercept is then calculated using the mean of the data points. After obtaining the fitted straight line, the time trend position at the end of the line is extended to predict the ratio of that node in a specific future time window. The extension point here is chosen as the position where the last time window number in the current data sequence is increased by 1. ,in This is the latest time window number currently collected. The horizontal arrangement of this extended point's location is indicated. Substituting the values ​​into the obtained fitted line equation, we can calculate the predicted values ​​of the corresponding longitudinal change indicators, i.e. The calculation result This represents the numerical value of the single fitted line extension point for that node. This operation is repeated for the historical data sequences of all monitored nodes to generate the anti-shake limit fitted extension for each node.

[0023] The steps to obtain the digital channel failure warning command are as follows: Using the extreme stabilization threshold as a comparison benchmark, the extreme stabilization fitting extension is matched to the corresponding node number item by item. The node number with the extreme stabilization fitting extension greater than the extreme stabilization threshold is selected. The missed pulse record of the digital pulse input channel corresponding to the node number is read. The missed pulse status judgment parameter of the digital pulse input channel is extracted and a channel failure prediction prompt signal is generated. Read the node number, missed pulse status judgment parameter, and threshold exceedance flag from the channel failure prediction prompt signal, write the node number into the warning object field, write the missed pulse status judgment parameter into the failure basis field, write the threshold exceedance flag into the trigger condition field, and generate a digital channel failure warning command.

[0024] Specifically, a preset extreme image stabilization threshold is used as the judgment benchmark. This threshold is obtained through calibration testing on brand-new or well-maintained metrology boxes. The specific setting method is as follows: in a controlled environment, a standard pulse signal is applied to the digital I / O channels of one or more benchmark metrology boxes, and high-frequency energy ratios are continuously collected for 24 hours to form a benchmark ratio dataset. The mean and standard deviation of this dataset are calculated. The extreme image stabilization threshold is set to the benchmark mean plus three times the standard deviation. For example, if the mean of the measured benchmark ratio dataset is 0.05 and the standard deviation is 0.02, then the extreme image stabilization threshold is set to... The anti-shake limit fitting extension value generated in the previous step is compared with this threshold item by item. All anti-shake limit fitting extension values ​​greater than 0.11 are filtered out, and their corresponding node numbers are recorded. For each filtered node, the missing pulse record of its corresponding digital pulse input channel is immediately accessed. This record is a continuously updated counter that records the number of events that should theoretically be counted as valid pulses but were filtered out by the software anti-shake logic due to signal jitter or interference since the last reset. Next, the missing pulse status judgment parameter generated by the digital pulse input channel is extracted. This parameter is defined as the number of newly added missing pulses in the last hour. If this number is greater than a preset missing tolerance value, such as 5 times, the status of the judgment parameter is "abnormal"; otherwise, it is "normal". Finally, the filtered node number, the value of the exceeding anti-shake limit fitting extension value, the missing pulse status judgment parameter ("abnormal" or "normal"), and a threshold exceeding the limit marked as "true" are combined to generate a channel failure prediction prompt signal.

[0025] The process reads the node number, missed pulse status judgment parameter, and threshold exceedance flag from the channel failure prediction prompt signal generated in the previous process. This information is then structured and reorganized to generate a detailed digital channel failure early warning instruction. First, the node number from the channel failure prediction prompt signal, such as "Anti-theft Microswitch Channel 2," is directly written into the warning object field of the early warning instruction. Then, the missed pulse status judgment parameter is processed, not just recording "abnormal" or "normal," but combining it with relevant quantitative data to form the content of the failure basis field. For example, if the missed pulse status judgment parameter is "abnormal," and there are 8 newly added missed pulses in the last hour, the failure basis field is filled with "8 missed pulses in the last hour, exceeding the tolerance range of 5." Next, the threshold exceedance flag is processed. This flag is a simple Boolean value in the channel failure prediction prompt signal; when generating the early warning instruction, it is expanded into a more specific trigger condition field, including the comparison between the actual measured value and the threshold, such as "Predicted high-frequency energy ratio (0.125) > The warning command includes a dynamically calculated "risk level" field, which is determined by the percentage by which the stabilization limit fit extension exceeds the threshold. For example, 0%-20% is defined as "low risk", 21%-50% as "medium risk", and more than 50% as "high risk". If the calculated excess ratio is (0.125-0.11) / 0.11, which is approximately 13.6%, then the risk level field is assigned the value of "low risk". Finally, the warning object field, failure basis field, trigger condition field, risk level field, and the current system timestamp of the generated command are integrated together to generate a digital channel failure warning command.

[0026] The steps to obtain the extreme value of task waiting time are as follows: Extract the request, grant, and release times of each task acquiring critical resource mutex locks in the RTOS kernel inside the main control MCU. Calculate the waiting time parameter by subtracting the request time from the grant time, and the holding time parameter by subtracting the grant time from the release time. Merge the waiting time parameters by task number within a set periodic unit, and filter the maximum value among the waiting time parameters corresponding to each task number to generate the extreme value of task waiting time.

[0027] Specifically, the acquisition, grant, and release times of each task acquiring critical resource mutexes within the main MCU's internal RTOS kernel are extracted. This extraction is achieved by setting trace hooks at the entry and exit points of mutex operation functions (such as `take` and `give`) in the RTOS kernel. Each hook records the task number, mutex identifier, and a microsecond-level timestamp provided by a high-precision hardware timer when the event occurs. Then, a waiting time parameter is generated by subtracting the acquisition time from the grant time, and a holding time parameter is generated by subtracting the grant time from the release time. These two calculations are performed for each complete mutex acquisition-grant-release cycle. Subsequently, within a set period of 1 second, the waiting time parameters are merged according to the task number. This period is a result of a trade-off between system responsiveness and data processing overhead. Within each 1-second cycle, all recorded waiting time parameters are merged according to their respective... The task IDs are grouped into multiple lists, each corresponding to all waiting time records for a task within the current period. Then, the maximum value in the waiting time parameter corresponding to each task ID is selected, i.e., the maximum value is taken from the waiting time list of each task. For example, if task A has three waiting times of 150 microseconds, 220 microseconds, and 180 microseconds within 1 second, its maximum value is 220 microseconds. If a task does not acquire a mutex lock within this period, its maximum value is recorded as 0. The maximum waiting time values ​​calculated for all tasks within this 1-second period are collected to generate the extreme value of task waiting time for this statistical period.

[0028] The steps to obtain the time-consuming trend polynomial parameter are as follows: The extreme values ​​of task waiting time are arranged in chronological order according to the start time of the statistical period. The task number, the maximum waiting time value and the range of holding time parameters corresponding to each statistical period are recorded. The missing positions of the statistical period are removed, and the remaining extreme values ​​of task waiting time are continuously spliced ​​together to form a permutation and combination of extreme values ​​of task waiting time. Based on the arrangement and combination of extreme values ​​of task waiting time, the change range of extreme values ​​of task waiting time between adjacent statistical periods is read. The position of the statistical period corresponding to each change range is matched according to the time order. The positions of each statistical period and the extreme values ​​of task waiting time are orthogonally expanded. The characteristic terms of the correlation equation of time consumption growth trend corresponding to constant term, linear term, quadratic term and residual fluctuation term are extracted to generate time consumption trend polynomial parameters.

[0029] Specifically, the extreme values ​​of task waiting times generated in the previous step are sorted chronologically according to the start time of the statistical period, creating a record table with time as the sequence. Each row represents a statistical period (e.g., second 1, second 2, second 3), and records the task number corresponding to each statistical period, the maximum waiting time value of that task, and its holding time parameter range. The holding time parameter range is defined as the minimum and maximum values ​​of all holding time parameters for that task within the same statistical period. For example, if the holding time records for task B in the second second are 500 microseconds, 650 microseconds, and 480 microseconds, then its holding time parameter range is recorded as [480, 650] microseconds. Next, missing positions in the statistical period are removed. This operation checks whether there are consecutive time points in the record table where there are no values. For task activity cycles, if no extreme waiting time records are generated for any monitored task within a 1-second statistical period (i.e., all values ​​are 0), the data row at that time point is considered invalid and removed from the table. This is to avoid introducing flat, invalid data segments in subsequent trend analysis. The remaining extreme waiting time values ​​are then concatenated sequentially for each independent task to form a unique permutation of extreme waiting time values ​​for that task. Essentially, this constructs a time series vector for each task, where each element is the maximum waiting time for that task within a continuous valid statistical period. For example, for task A, the permutation might be [220, 250, 240, 310, ...], where each value corresponds to the extreme waiting time value for a valid statistical period.

[0030] Based on the permutation and combination of extreme task wait times generated for each task, the variation amplitude of the extreme task wait times between adjacent statistical periods is first read, i.e., the first difference of the time series is calculated. Then, the statistical period positions corresponding to each variation amplitude are matched according to the time order, and standard polynomial curve fitting is performed on each statistical period position and the corresponding extreme task wait times. This process selects the 128 most recent valid data points and uses polynomial regression analysis based on the least squares method, with time indexing. The extreme value of task waiting time is the independent variable. Assuming the dependent variable, establish a second-order polynomial trend equation: ; By constructing the Vandermonde matrix and solving the normal equation, the polynomial coefficients that minimize the sum of squared residuals are calculated. Represents the baseline level (constant term) of the time-consuming series. Represents a linear growth rate (linear term). This represents the acceleration (quadratic term) of the time consumption increase. After obtaining the optimal fit coefficients, the residual fluctuation term is obtained by subtracting the predicted value of the fitted polynomial from the original data, i.e., calculating the value at each point. Extract the variance of the residual sequence. This is used to characterize the randomness of the fluctuations in time consumption. Finally, the calculated coefficients... Together with the residual variance, a time consumption trend polynomial parameter is generated, providing consistent mathematical input for subsequent time consumption boundary arrival time prediction based on a quadratic equation.

[0031] The steps to obtain the timeout trigger time node quantity are as follows: Based on the polynomial parameter of the time consumption trend, read the parameter values ​​corresponding to the constant term, linear term, quadratic term and residual fluctuation term, substitute them into the time consumption boundary corresponding to the watchdog timeout threshold in the RTOS kernel, calculate the time position when the task waiting time reaches the time consumption boundary item by item, remove the calculation results of the time position earlier than the current running time parameter, and generate the timeout trigger time node quantity.

[0032] Specifically, based on the polynomial parameter of the time consumption trend, the corresponding constant term is first read for each monitored task. One term Quadratic terms and the variance of the residual fluctuation term These parameters collectively describe the historical trend of the task's waiting time. Subsequently, these parameter values ​​are substituted into a quadratic prediction equation to solve for the future time point at which the task's waiting time reaches the timeout threshold of the watchdog timeout in the RTOS kernel. This timeout threshold is a hard upper limit set based on the execution cycle and tolerable latency of the system's critical tasks. For example, if the timeout period of the system's independent watchdog is 500 milliseconds, then the timeout threshold... We can conservatively set it to 80%, or 400 milliseconds. To improve the robustness of the prediction, we incorporate the residual fluctuation term and establish the following prediction equation: ; in, These are future time points to be solved, expressed in units of statistical periods. The coefficients are read from the time-consuming trend polynomial parameter. It is the set time boundary of 400 milliseconds. It is the residual variance. This is the confidence coefficient, set according to the required confidence level of the prediction. For example, a coefficient of 1.96 corresponds to a 95% confidence interval. This is achieved by solving for this confidence coefficient. The quadratic equation in one variable yields one or two real solutions. These solutions represent how many statistical periods, starting from the current time point, will elapse before the task's expected waiting time reaches the time limit. Then, results for all time positions earlier than the current runtime parameter are discarded, meaning only all real solutions greater than zero are retained. These solutions are then converted into absolute timestamps to generate a number of timeout trigger time nodes.

[0033] The steps for obtaining the scheduling starvation failure prediction results are as follows: Based on the number of timeout trigger time nodes, the current running time parameter is used as the time comparison benchmark. The remaining interval of the timeout trigger time node relative to the current running time parameter is calculated item by item. Time node records with remaining intervals lower than the warning time limit setting value are filtered out. The task priority identifiers corresponding to the time node records are extracted, and a judgment signal for low-priority tasks in a long-term unresponsive state is generated. Based on the signal indicating that a low-priority task is in a prolonged unresponsive state, the low-priority task identifier, timeout trigger time node quantity, remaining interval, and warning time limit setting value are read. The low-priority task identifier is written to the fault object field, the timeout trigger time node quantity is written to the trigger time field, and the remaining interval is written to the prediction basis field to generate a scheduling starvation fault prediction result.

[0034] Specifically, based on the timeout trigger time nodes generated in the previous step, the current running time parameter provided by the system's high-precision clock is used as the time comparison benchmark. For each timeout trigger time node, its remaining interval relative to the current running time parameter is calculated. This calculation is a direct difference, i.e., remaining interval = timeout trigger time node - current running time parameter. Subsequently, all time node records with remaining intervals lower than the warning time limit setting are filtered out. This warning time limit setting is a parameter pre-configured based on the system maintenance response time and risk level. For example, for a system requiring manual intervention, the warning time limit might be set to 24 hours, meaning a warning is issued one day in advance. If the system has an automatic degradation or recovery mechanism, this value is set to 10 minutes. Here, we take 30 minutes as an example. That is, 1800 seconds. If the calculated remaining interval is less than 1800 seconds, the record is judged to need attention. For all the selected time node records, the corresponding task priority identifier is extracted. The task priority identifier is an integer assigned by the RTOS kernel to each task. For example, in the range of 0-255, the smaller the value, the higher the priority. Here, tasks with a priority value greater than 32 are defined as low-priority tasks. If a selected record has a corresponding task priority identifier greater than 32, the task is initially judged to have scheduling starvation risk. Finally, all the record information that meets the conditions, including task identifier, task priority, predicted trigger time and remaining interval, are combined into a structured data to generate a judgment signal for low-priority tasks in a long-term unresponsive state.

[0035] Based on the low-priority task status signal generated in the previous process, which indicates a prolonged period of inactivity, the system reads the low-priority task identifier, timeout trigger time node quantity, remaining interval, and warning time limit setting value contained within each signal. This information is then reorganized and written into a standardized fault prediction report structure. Specifically, the low-priority task identifier from the signal, such as the task name "DataUploadTask," is directly copied to the "Fault Object" field of the fault prediction result. The timeout trigger time node quantity, a future timestamp, is written to the "Trigger Time" field to clearly indicate the predicted fault occurrence time. Next, the remaining interval and warning time limit setting value are formatted to form a descriptive text, such as "Predicted timeout in 12 hours and 34 minutes, already in the 30-minute warning window," and this text is written to the "Prediction Basis" field. To make the prediction result more complete, a "Fault Details" field is added to record more contextual information related to this prediction, such as the task priority that caused this prediction (e.g., "Priority: 50"), and the coefficients of its waiting time trend equation (c0, c1, ...). The value of c2 and the current extreme value of waiting time are recorded in this field. In this way, the original judgment signal is transformed into an information-rich and easy-to-interpret record, and finally the scheduling starvation failure prediction result is generated.

Claims

1. A fault prediction system for the operating status of a metering box, characterized in that, The system includes: The digital input anti-shake monitoring module acquires the time interval values ​​generated by the external anti-theft micro switch and the digital I / O pin at the pulse cascade port of the metering box in the jumping state, combines them into sequence format data, generates frequency domain energy distribution state quantity based on the sequence format data, and generates a set of high frequency energy ratio values ​​based on the frequency domain energy distribution state quantity. The failure limit assessment and prediction module fits the high-frequency energy ratio set to generate a stabilization limit fitting extension, compares the stabilization limit fitting extension with the stabilization limit threshold, and determines and generates a digital channel failure warning command. The mutex lock time monitoring module extracts the waiting time parameters and holding time parameters of each task in the RTOS kernel inside the main control MCU to acquire critical resource mutex locks, obtains the extreme value of task waiting time, and arranges and combines the extreme values ​​of task waiting time in each statistical period in time order to generate a time trend polynomial parameter. The scheduling anomaly diagnosis module solves the time consumption trend polynomial parameter, generates a timeout trigger time node quantity, determines the difference between the timeout trigger time node quantity and the current running time parameter, and generates a scheduling starvation fault prediction result when the difference is lower than the warning time limit setting value.

2. The fault prediction system for the operating status of the metering box according to claim 1, characterized in that, The steps for obtaining the set of high-frequency energy ratios are as follows: Call the digital I / O pin transition records at the external anti-theft micro switch of the metering box, call the digital I / O pin transition records at the pulse cascade port, calculate the difference between adjacent trigger times according to the triggering order of adjacent transition edges, remove trigger records that do not form a pair of transition edges, and obtain the time interval value. According to the node order of the digital I / O pins at the anti-theft micro switch and the pulse cascade port on the outside of the metering box, the time interval values ​​are arranged continuously at the same node to form a sequence format data. The sequence format data is then converted in the frequency domain item by item to extract the energy amplitude data item corresponding to each frequency point and generate the frequency domain energy distribution state quantity. Based on the frequency domain energy distribution state quantity, high-frequency noise band energy and low-frequency fundamental wave energy are separated according to the preset frequency band boundary. The ratio of high-frequency noise band energy to low-frequency fundamental wave energy is calculated node by node. The node ratio terms missing low-frequency fundamental wave energy are removed. The remaining node ratio terms are arranged in the order of node number to generate a high-frequency energy ratio set.

3. The fault prediction system for the operating status of the metering box according to claim 1, characterized in that, The steps for obtaining the anti-shake limit fitting extension are as follows: Based on the high-frequency energy ratio set, the values ​​of each node ratio item are read in the order of node number. The node number is used as the horizontal arrangement identifier, and the ratio item value is used as the vertical change identifier. The horizontal arrangement identifier and the vertical change identifier are aligned with a straight line. The trend position at the end of the straight line is continued, and the value of the fitting straight line extension point is obtained to generate the anti-shake limit fitting extension amount.

4. The failure prediction system of operating state of a metering box according to claim 1, characterized by, The steps for obtaining the digital channel failure warning command are as follows: Using the extreme stabilization threshold as a comparison benchmark, the extreme stabilization fitting extension is matched item by item with the corresponding node number. The node number whose extreme stabilization fitting extension is greater than the extreme stabilization threshold is selected. The missed pulse record of the digital pulse input channel corresponding to the node number is read. The missed pulse status judgment parameter of the digital pulse input channel is extracted and a channel failure prediction prompt signal is generated. Read the node number, missed pulse status judgment parameter, and threshold exceedance flag from the channel failure prediction prompt signal, write the node number into the warning object field, write the missed pulse status judgment parameter into the failure basis field, write the threshold exceedance flag into the trigger condition field, and generate a digital channel failure warning command.

5. The failure prediction system of operating status of a metering box according to claim 1, characterized by, The steps for obtaining the extreme value of the task waiting time are as follows: Extract the request, grant, and release times of each task acquiring critical resource mutex locks in the RTOS kernel inside the main control MCU. Calculate the waiting time parameter by subtracting the request time from the grant time, and the holding time parameter by subtracting the grant time from the release time. Merge the waiting time parameters by task number within a set periodic unit, and filter the maximum value among the waiting time parameters corresponding to each task number to generate the extreme value of task waiting time.

6. The failure prediction system of operating status of a metering box according to claim 1, characterized by, The steps for obtaining the time-consuming trend polynomial parameter are as follows: The extreme values ​​of task waiting time are arranged in chronological order according to the start time of the statistical period. The task number, the maximum waiting time value and the range of holding time parameters corresponding to each statistical period are recorded. The missing positions of the statistical period are removed. The remaining extreme values ​​of task waiting time are continuously spliced ​​together to form a permutation and combination of extreme values ​​of task waiting time. Based on the arrangement and combination of the extreme values ​​of task waiting time, the change range of the extreme values ​​of task waiting time between adjacent statistical periods is read. The position of the statistical period corresponding to each change range is matched according to the time order. The positions of each statistical period and the extreme values ​​of task waiting time are orthogonally expanded. The characteristic terms of the correlation equation of the time consumption growth trend corresponding to the constant term, the first term, the second term and the residual fluctuation term are extracted to generate the time consumption trend polynomial parameter.

7. The failure prediction system of operating status of a metering box according to claim 1, characterized by, The steps for obtaining the timeout trigger time node quantity are as follows: Based on the time consumption trend polynomial parameter, read the parameter values ​​corresponding to the constant term, linear term, quadratic term and residual fluctuation term, substitute them into the time consumption boundary corresponding to the watchdog timeout threshold in the RTOS kernel, calculate the time position when the task waiting time reaches the time consumption boundary item by item, remove the calculation results of the time position earlier than the current running time parameter, and generate the timeout trigger time node quantity.

8. The failure prediction system of operating status of a metering box according to claim 1, characterized by, The steps for obtaining the scheduling starvation failure prediction result are as follows: Based on the timeout trigger time node quantity, the current running time parameter is used as the time comparison benchmark. The remaining interval of the timeout trigger time node quantity relative to the current running time parameter is calculated item by item. Time node records with remaining intervals lower than the warning time limit setting value are filtered out. The task priority identifiers corresponding to the time node records are extracted, and a judgment signal for low priority tasks in a long-term unresponsive state is generated. Based on the determination signal that the low-priority task is in a long-term unresponsive state, the low-priority task identifier, the timeout trigger time node quantity, the remaining interval, and the warning time limit setting value are read. The low-priority task identifier is written into the fault object field, the timeout trigger time node quantity is written into the trigger time field, and the remaining interval is written into the prediction basis field to generate a scheduling starvation fault prediction result.