A method and system for synchronous measurement of electricity and water based on space-time matching
By using hardware interrupt synchronous acquisition and adaptive smoothing filtering technology, the problems of asynchronous electricity and water data and fixed conversion coefficients were solved. Millisecond-level synchronization of electricity and water data and adaptive calibration of conversion coefficients under working conditions were achieved, reducing metering errors and false alarm rates, and improving the stability and self-optimization capabilities of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 山东华特智慧技术有限公司
- Filing Date
- 2026-05-07
- Publication Date
- 2026-06-05
AI Technical Summary
Existing electro-water conversion technologies suffer from problems such as asynchronous electricity and water data, inability to dynamically calibrate conversion factors, poor adaptability to operating conditions, and lack of anomaly isolation capabilities, leading to large measurement errors and model contamination by abnormal data.
Electrical and water parameters are synchronously collected via hardware interrupts to construct an operating condition identification model. Conversion coefficients are calculated in real time, and adaptive smoothing filtering and hierarchical anomaly detection are adopted to dynamically adjust the acquisition cycle and threshold, forming a closed-loop system of acquisition-calibration-anomaly detection.
It achieves millisecond-level synchronization of electricity and water data, adaptive calibration of conversion coefficients under operating conditions, and precise hierarchical isolation of anomalies, thereby reducing metering errors and false alarm rates and improving system stability and self-optimization capabilities.
Smart Images

Figure CN122149578A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of agricultural irrigation water metering technology, specifically to a method and system for simultaneous metering of water and electricity based on spatiotemporal matching, applicable to scenarios such as dual metering of water and electricity in agricultural irrigation wells, dynamic calibration of the water conversion coefficient based on electricity, and comprehensive reform of agricultural water pricing. Background Technology
[0002] In my country, agricultural water use accounts for over 60% of the total national water consumption, with irrigation water accounting for approximately 90% of agricultural water use. For a long time, agricultural water use has been managed in an extensive and inefficient manner, making measurement difficult. Installing traditional flow meters directly on each well would be costly and difficult to maintain. Therefore, electro-hydraulic water conversion technology has emerged, which calculates water volume by relating electricity consumption to water intake. However, existing electro-hydraulic water conversion technologies and systems generally suffer from the following technical drawbacks: (1) Asynchronous time of electricity and water data: The acquisition of electricity parameters and water parameters are completed independently by different devices, resulting in a time difference. This causes the electricity and water data at the same time to not correspond accurately, introducing time mismatch error.
[0003] (2) The conversion factor cannot be dynamically calibrated: Traditional methods use fixed conversion factors or periodic spatial interpolation (such as KNN, ridge regression), which cannot respond in real time to the drift of the electro-water relationship caused by factors such as aging, head change, and operating condition switching of a single well pump. The measurement error can reach 15-20%.
[0004] (3) Poor adaptability to operating conditions: The differences in operating characteristics of water pumps under different head and flow ranges are not considered, and a uniform conversion model is used.
[0005] (4) Lack of anomaly isolation mechanism: It is impossible to identify abnormal scenarios such as water theft, electricity theft, and sensor failure. Abnormal data will directly pollute the conversion model, leading to inaccurate subsequent measurement.
[0006] In summary, existing technologies have not yet solved the core technical problems of spatiotemporal synchronization of hydroelectric data at the single-well scale, real-time calibration of conversion coefficients, adaptability to operating conditions, and poor robustness to anomalies. Summary of the Invention
[0007] The present invention aims to provide a method and system for synchronous metering of electricity and water based on spatiotemporal matching, in order to solve the problems of asynchronous electricity and water data acquisition, fixed conversion coefficient, poor adaptability to working conditions and lack of abnormal isolation capability in the prior art.
[0008] To achieve the above objectives, the present invention provides the following technical solution: A spatiotemporal matching-based method for simultaneous metering of electricity and water, comprising the following causal coordination steps: Step S1: Hardware interrupt synchronous acquisition and timing alignment: An interrupt signal is generated by the same hardware timer to synchronously trigger the electrical parameter acquisition module and the water parameter acquisition module to acquire electrical parameter and water volume data, and add a unified timestamp to each set of data; Step S2: Electrical parameter feature extraction and operating condition identification: Based on the electrical parameters obtained in step S1, construct a feature vector, input it into the preset operating condition classification model, and identify the current pump operating condition category C; Step S3: Real-time conversion factor calculation: Calculate the real-time conversion factor K_instant for the current sampling period; Step S4, Adaptive Filtering Calibration for Working Condition Correlation: Obtain the historical conversion coefficient K_history(C) corresponding to working condition category C, and use the adaptive smoothing filter formula to calculate the updated conversion coefficient K_new(C) for the current working condition, where the filter strength is correlated with working condition category C; Step S5: Anomaly Cooperative Detection and Hierarchical Isolation: Calculate the relative deviation between the real-time conversion coefficient and the historical conversion coefficient. When the deviation exceeds the dynamic threshold, read back the synchronously collected data of the most recent N periods preset in Step S1, and perform hierarchical isolation based on the read-back data. Step S6: Coefficient update and data reporting: Store the updated conversion factor K_new(C) into the historical conversion factor database for the corresponding working condition, and package and report the data.
[0009] This solution constructs a complete technical closed loop of data collection → identification → calibration → anomaly reporting, and its core principle lies in: The principle of step S1: In traditional solutions, electrical parameter acquisition and water parameter acquisition are performed independently by different modules. Due to clock drift and task scheduling delays between modules, there is a time difference of seconds or even minutes between the two. This invention generates an interrupt signal through the same hardware timer, and synchronously triggers the two acquisition modules in the interrupt service routine, fundamentally eliminating the timing mismatch problem and ensuring that electrical parameter and water volume data are aligned with millisecond-level accuracy.
[0010] The principle of step S2: When a water pump operates at different heads and flow rates, its electrical parameters (active power, power factor, harmonic distortion rate, and power change rate) exhibit different distribution patterns. By constructing a feature vector containing these parameters and inputting it into a classification model, the current operating condition can be accurately identified, providing a basis for subsequent differentiated calibration.
[0011] The principle of step S3: The core of using electricity to convert water is to establish a mapping relationship between power consumption and water intake. This step calculates the instantaneous conversion coefficient within each sampling period, which serves as the basic input for subsequent filter calibration.
[0012] The principle of step S4: The stability of the electro-water relationship varies under different operating conditions—the electro-water relationship is relatively stable under high head / low flow conditions, suitable for slow filtering; the electro-water relationship changes rapidly under low head / high flow conditions, requiring a fast response. This step correlates the filtering intensity with the operating condition category, realizing a differentiated calibration strategy that adapts to the operating condition.
[0013] The principle of step S5: Traditional anomaly detection relies solely on the current data point, which can easily misjudge natural transitions in operating conditions as anomalies. This step, when a deviation is detected, reads back historical data and analyzes the temporal continuity of the anomaly and the correlation with operating conditions to accurately distinguish between occasional disturbances, operating condition transitions, and real anomaly events.
[0014] The principle of step S6 is to store the calibrated coefficients in the historical conversion coefficient database to provide a continuously updated benchmark for subsequent calibrations; at the same time, the data is reported to the cloud to realize remote monitoring and data traceability.
[0015] Technical effects: Through the above six steps of collaboration, this invention achieves: ① millisecond-level synchronous alignment of electricity and water data; ② adaptive calibration of conversion coefficients under operating conditions; ③ precise hierarchical isolation of anomalies.
[0016] Furthermore, the electrical parameters obtained in step S1 include: voltage U, current I, active power P, and cumulative energy E; the water volume data includes: instantaneous flow rate Q and cumulative water volume V; the spatiotemporally aligned data pair is in the form of {Tn,[U,I,P,E],[Q,V]}.
[0017] The principle is as follows: voltage U and current I are used to calculate apparent power and power factor; active power P directly reflects the real-time energy consumption of the water pump; cumulative electricity E is used to calculate the increase in electricity consumption within a cycle; instantaneous flow rate Q is used to monitor instantaneous water intake intensity; and cumulative water volume V is used to calculate the increase in water volume within a cycle. These data are organized in the format {Tn, [electrical parameters], [water parameters]} for easy subsequent processing and traceability. This data format ensures a strict correspondence between electrical and water parameters at the timestamp level, providing an accurate data foundation for operating condition identification and coefficient calibration.
[0018] Furthermore, the feature vector F=[P,cosφ,THD,ΔP / Δt] constructed in step S2, where cosφ is the power factor, THD is the total harmonic distortion rate of the current, and ΔP / Δt is the power change rate; the operating condition category C includes at least high head / low flow rate operating condition, medium head / medium flow rate operating condition, and low head / high flow rate operating condition.
[0019] The principle is as follows: Active power P: the core energy consumption indicator of a water pump, with significant differences in power levels under different operating conditions. Under high-head conditions, the water pump needs to overcome greater water column pressure, resulting in higher active power; under low-head conditions, the active power is relatively lower.
[0020] Power factor cosφ: reflects the operating efficiency of the water pump motor. The power factor is higher when the motor is operating near its rated operating conditions, and decreases under light load or overload. It is an important auxiliary characteristic for distinguishing operating conditions.
[0021] Total Harmonic Distortion (THD): Reflects the degree of distortion in the current waveform. When a water pump operates under non-rated conditions, the current harmonic content increases. THD is a sensitive indicator for identifying abnormal operating conditions and motor failures.
[0022] Power change rate ΔP / Δt: reflects the degree of drastic change in operating conditions. The power change rate is large when the water pump starts and stops or when switching operating conditions, and close to zero during steady-state operation.
[0023] Using the aforementioned four-dimensional feature vectors, the operating condition classification model can accurately distinguish between three typical operating conditions: high head / low flow rate, medium head / medium flow rate, and low head / high flow rate, providing precise operating condition labels for differentiated calibration.
[0024] Furthermore, in step S3, the formula for calculating the real-time conversion factor is K_instant=ΔV / ΔE, where ΔV is the cumulative water volume increment and ΔE is the cumulative electricity volume increment; in step S4, the formula for adaptive smoothing filtering is K_new(C)=α×K_instant+(1-α)×K_history(C), where α is the adaptive smoothing factor, and its value is related to the operating condition category C and the power change rate |ΔP / Δt|.
[0025] The principle behind the real-time conversion factor K_instant=ΔV / ΔE: ΔV is the cumulative increase in water volume (unit: cubic meters) within the current sampling period, and ΔE is the cumulative increase in electricity consumption (unit: kilowatt-hours) within the current sampling period. The ratio of the two represents the amount of water pumped for every 1 kilowatt-hour of electricity consumed (unit: cubic meters / kilowatt-hour). This ratio is an instantaneous measure of the electricity-water relationship, reflecting the energy efficiency level of the water pump at the current moment.
[0026] The principle behind the adaptive smoothing filter formula K_new = α × K_instant + (1-α) × K_history is as follows: This is an application of first-order low-pass filtering in coefficient updates. Here, K_history is the historical conversion coefficient up to the previous sampling period (containing long-term statistical information), K_instant is the instantaneous coefficient of the current period (containing the latest operating condition information), and α is a weighting factor balancing the two. When α is large, coefficient updates rely more on the latest data, resulting in a fast response but large fluctuations; when α is small, coefficient updates rely more on historical data, resulting in good stability but a slow response.
[0027] The principle behind the correlation between α and operating conditions and power change rate: The value of α is associated with the operating condition category C and the power change rate |ΔP / Δt|, achieving intelligent filtering that adapts to operating conditions. Under steady-state operating conditions, the power change rate is small, so a smaller α value is used to maintain coefficient stability; under transient operating conditions, the power change rate is large, so a larger α value is used to quickly track changes in operating conditions. Simultaneously, the fundamental characteristics of different operating conditions also affect the reference value of α—under high-lift conditions, the electro-water relationship is stable, and the reference α is smaller; under low-lift conditions, the electro-water relationship changes rapidly, and the reference α is larger.
[0028] Furthermore, the adaptive smoothing factor α is determined as follows: when the power change rate |ΔP / Δt| is lower than the first threshold, α = α_base(C); when the power change rate |ΔP / Δt| is higher than the second threshold, α = min(0.8, α_base(C) × 2); when the power change rate is between the first threshold and the second threshold, α = α_base(C) × (1 + β × |ΔP / Δt|); where α_base(C) is the basic smoothing factor bound to the operating condition category C, and β is a preset proportional coefficient.
[0029] This scheme specifies the method for determining the segmentation of α, which is the core algorithm for realizing adaptive filtering under operating conditions.
[0030] The principle of the three-stage design is to divide the power change rate into three intervals: a stable region (<5%), a transition region (5%-15%), and a drastic region (>15%), and to use different α calculation strategies for each interval.
[0031] Stable region (|ΔP / Δt|<5%): At this point, the pump operates smoothly, and the electro-water relationship is basically stable. We take α=α_base(C), meaning we only use the basic smoothing factor bound to the operating condition. Typical values for α_base(C) are: 0.2 for high head condition, 0.3 for medium head condition, and 0.4 for low head condition, reflecting the design philosophy that the more stable the operating condition, the smoother the filtering.
[0032] Drastic change zone (|ΔP / Δt|>15%): At this point, the operating conditions are undergoing drastic changes (such as pump start-up and shutdown, operating condition switching), requiring rapid tracking of changes in the electro-water relationship. We set α=min(0.8,α_base(C)×2), which means amplifying the base α to twice its original value, but setting the upper limit to 0.8 to avoid coefficient oscillations due to over-response.
[0033] Transition zone (5% ≤ |ΔP / Δt| ≤ 15%): During this transition, the operating condition is in a gradual change process. A linear interpolation formula α = α_base(C) × (1 + β × |ΔP / Δt|) is used to make α increase linearly with the power change rate, achieving a smooth transition. The value of β is related to the operating condition category: β is smaller for high-lift conditions and larger for low-lift conditions, forming a reverse coupling relationship where the more stable the operating condition, the less sensitive α is to power changes.
[0034] Technical benefits: This three-stage adaptive α determination method enables coefficient calibration to maintain long-term stability (steady state) and respond quickly to changes in operating conditions (transient state), avoiding the shortcomings of fixed α schemes, which have large fluctuations in steady state and slow response in transient state.
[0035] Furthermore, the hierarchical isolation in step S5 specifically includes: if the deviation lasts only for a single period and the data in adjacent periods is normal, it is determined to be an occasional disturbance, and coefficient freezing is performed without triggering an alarm; if the deviation lasts for multiple consecutive periods and is accompanied by a stable change in operating condition category C, it is determined to be a natural transition of operating condition, and the coefficient migration process is triggered; if the deviation lasts for multiple consecutive periods and operating condition category C does not change, it is determined to be an abnormal event, and coefficient freezing, abnormal data marking, and remote alarm triggering are performed.
[0036] This solution defines the specific logic for hierarchical isolation, which is one of the core innovations that distinguishes this invention from the traditional alarm solution that triggers an alarm at the first sign of an anomaly.
[0037] The principle of hierarchical isolation: Traditional anomaly detection uses a single threshold. Once the deviation exceeds the threshold, it is judged as an anomaly and the coefficient is frozen. However, in real-world scenarios, there are three different types of deviations: occasional disturbances (such as instantaneous interference), natural transitions in operating conditions (such as switching from high head to medium head), and real abnormal events (such as water theft or sensor failure). These three require different handling strategies.
[0038] Judgment and handling of occasional disturbances: If the deviation lasts only for a single cycle and the data in adjacent cycles is normal, it indicates that it is a transient disturbance (such as electromagnetic interference or communication interruption) and should not affect coefficient calibration. The handling strategy is to freeze the current coefficient update (excluding abnormal data from filtering) but not to trigger alarms, thus avoiding unnecessary maintenance responses.
[0039] Judgment and handling of working condition transition: If the deviation continues for multiple cycles and is accompanied by a stable change in working condition category C, it indicates a normal working condition switch (such as moving from the early stage to the middle stage of irrigation). At this time, the electricity-water relationship itself is changing and should not be judged as abnormal. The handling strategy is to trigger the coefficient migration process, migrate the historical conversion coefficients of the original working condition to the initial coefficients of the new working condition, and achieve a smooth transition of coefficients.
[0040] Judgment and handling of abnormal events: If the deviation continues for multiple cycles without a change in operating condition category C, it indicates that an abnormal change has occurred in the electricity-water relationship under the same operating conditions (such as water theft leading to abnormal water volume, or sensor failure causing data anomalies). The handling strategy is to freeze coefficient updates, mark abnormal data, and trigger remote alarms to prevent abnormal data from polluting the model.
[0041] Technical effect: Through three-level hierarchical isolation, the present invention reduces the false alarm rate by more than 35%, and at the same time realizes the smooth migration of coefficients during the working condition transition period, avoiding the problem of drastic fluctuations in coefficients caused by working condition switching in traditional solutions.
[0042] Furthermore, the method for determining the dynamic threshold in step S5 is: δ = δ_base(C) + k × σ(C), where δ_base(C) is the base threshold bound to the operating condition category C, σ(C) is the standard deviation of the historical deviation under the corresponding operating condition, and k is a coefficient; preferably, the dynamic threshold also includes an operating condition switching penalty term: δ = δ_base(C) + k × σ(C) + ε × S, where S is the system state factor, S = 1 when the operating condition is switched, otherwise S = 0, and ε is a preset switching penalty coefficient.
[0043] This scheme defines the method for determining the dynamic threshold, which is the core algorithm for realizing adaptive anomaly detection under working conditions.
[0044] The basic principle of dynamic thresholds: Traditional anomaly detection uses a fixed threshold (e.g., 8%), but the normal fluctuation range of the electro-hydraulic relationship varies under different operating conditions—small fluctuations under high-lift conditions and large fluctuations under low-lift conditions. A fixed threshold will lead to missed detections under high-lift conditions and false detections under low-lift conditions.
[0045] The base threshold δ_base(C) for different operating conditions: different base thresholds are set for different operating conditions. Under high head / low flow conditions, the electro-water relationship is stable, and the base threshold is relatively small (e.g., 0.12); under low head / high flow conditions, the electro-water relationship fluctuates greatly, and the base threshold is relatively large (e.g., 0.06).
[0046] The historical deviation standard deviation σ(C) term reflects the dispersion of historical deviations under this operating condition. Adding k×σ(C) to the threshold achieves an adaptive adjustment where the detection threshold is more lenient as the normal fluctuation range expands. The value of k ranges from 1 to 3, with a typical value of 2, corresponding to the 2σ principle in statistics.
[0047] Operating condition switching penalty term ε×S: During operating condition switching, the electrical-water relationship is in a transitional state, and the deviation naturally increases. A penalty term is added to increase the threshold and avoid frequent false triggering of anomaly detection. S=1 indicates switching is in progress, and S=0 indicates no switching.
[0048] Technical effect: Through the above dynamic threshold design, the present invention realizes the adaptive adjustment of the anomaly detection threshold under working conditions. Compared with the fixed threshold scheme, the false alarm rate is reduced by more than 50% and the false alarm rate is reduced by more than 60%.
[0049] Furthermore, the synchronous acquisition period T in step S1 is dynamically adjusted in relation to the operating condition category C and the power change rate |ΔP / Δt|: a long-cycle acquisition mode is used under stable operating conditions with high head and low flow rate, and a short-cycle acquisition mode is used under operating conditions with low head and high flow rate fluctuations; and when step S5 determines an abnormal event, it is temporarily forced to switch to the encrypted acquisition mode.
[0050] This solution defines the dynamic adjustment strategy for the data collection cycle, which is the core embodiment of the three-level linkage of data collection, identification, and anomaly detection.
[0051] The principle of variable period acquisition: Fixed period acquisition (e.g., 1 second) wastes power consumption and storage resources in steady state, and the sampling density is insufficient to capture details in transient state. This invention dynamically adjusts the acquisition period according to the operating conditions.
[0052] Long-cycle acquisition mode: When the operating conditions are high head / low flow rate and small power change rate, the relationship between electricity and water is very stable. Long-cycle (e.g., 5 seconds) acquisition is adopted to reduce equipment power consumption and extend terminal battery life.
[0053] Short-cycle acquisition mode: When the operating conditions are low head / high flow rate and large power change rate, the electro-water relationship changes rapidly. Short-cycle (e.g., 0.5 seconds) acquisition is adopted to increase the sampling density and ensure the timeliness of coefficient calibration.
[0054] Encrypted data collection mode: When the anomaly detection module determines that an anomaly event has occurred, it means that the current period needs to be monitored closely. The data collection cycle is temporarily switched to a higher frequency (such as 0.2 seconds) and collected continuously for M cycles to provide refined data support for anomaly analysis.
[0055] Technical benefits: By using variable-cycle data acquisition, this invention reduces the average power consumption of the device by about 40% while ensuring measurement accuracy, and at the same time provides refined encrypted data support for anomaly detection.
[0056] The present invention also provides a time-space matching-based electric-to-water synchronous metering system, used to implement the method described in any of the above, comprising: Synchronous acquisition module: used to synchronously trigger the acquisition of electrical and water parameters through hardware interrupts, and add a uniform timestamp to each set of data; Operating condition identification module: Its input end is connected to the output end of the synchronous acquisition module, and it is used to identify the current operating condition of the water pump based on the electrical parameter feature vector; Coefficient calibration module: Its first input terminal is connected to the output terminal of the synchronous acquisition module, and its second input terminal is connected to the output terminal of the working condition identification module. It is used to dynamically update the electricity-water conversion coefficient under each working condition by adopting an adaptive smoothing filtering algorithm associated with the working condition. Anomaly detection module: Its input is connected to the output of the synchronous acquisition module and the coefficient calibration module respectively. It is used to identify abnormal deviations of the conversion coefficient based on the dynamic threshold, and to perform hierarchical isolation by reading back the historical data of the synchronous acquisition module when an anomaly is determined. Data storage module: used for local cyclic storage of monitoring data; Communication module: Used to report processed data to the cloud platform via wireless network; Periodic controller: Its input terminals are respectively connected to the output terminals of the working condition identification module and the abnormality detection module, and its output terminal is connected to the control terminal of the synchronous acquisition module, which is used to dynamically adjust the acquisition cycle of the synchronous acquisition module; Self-healing management module: Its input is connected to the output of the coefficient calibration module, and it is used to monitor coefficient stability and trigger self-healing operation.
[0057] The system architecture for implementing the method of this invention is defined in this solution, and the connection relationship between each module reflects the design concept of collaborative work.
[0058] The principle behind the connection relationship between modules: Synchronous acquisition module → Operating condition identification module: The electrical parameters output by the synchronous acquisition module (especially P, cosφ, THD, ΔP / Δt) are the input of the operating condition identification module. Operating condition identification depends on the data quality of high-precision synchronous acquisition.
[0059] Synchronous acquisition module + operating condition identification module → coefficient calibration module: The coefficient calibration module simultaneously receives real-time data (K_instant) from the synchronous acquisition module and operating condition labels (C) from the operating condition identification module to achieve adaptive filtering of operating condition correlation.
[0060] Synchronous acquisition module + coefficient calibration module → anomaly detection module: The anomaly detection module receives the conversion coefficient from the coefficient calibration module (used to calculate the deviation), and reads back the historical data from the synchronous acquisition module when an anomaly is detected (used for hierarchical isolation), forming a two-way interaction of detection → readback.
[0061] Operating condition identification module + anomaly detection module → cycle controller → synchronous acquisition module: The cycle controller dynamically adjusts the acquisition cycle of the synchronous acquisition module based on the operating condition status output by the operating condition identification module and the anomaly status output by the anomaly detection module, forming a closed loop of identification → decision-making → control → acquisition.
[0062] Technical effect: The interconnection between the above modules ensures the smooth transmission of data flow and control flow. Each module is not an isolated island that works independently, but a technical whole that depends on and supports each other, together forming a complete ecosystem of acquisition → identification → calibration → detection → reporting.
[0063] Furthermore, the anomaly detection module includes a hierarchical isolation unit, which classifies anomalies into three levels—occasional disturbances, operational transitions, and abnormal events—based on the time continuity and operational condition correlation of the anomalies, and executes differentiated response strategies such as coefficient freezing, coefficient migration, encrypted data acquisition, and alarms respectively; the self-healing management module and the coefficient calibration module form a two-way feedback closed loop, constructing a collaborative ecosystem of data acquisition → identification → calibration → self-healing → model evolution.
[0064] This scheme defines two core enhancement features of the system: hierarchical isolation units and bidirectional feedback closed loops.
[0065] The principle of the hierarchical isolation unit: This unit is built into the anomaly detection module and is the functional carrier of the hierarchical isolation method described in claim 6. Based on the time continuity of the anomaly (single-cycle vs. multi-cycle) and the correlation of operating conditions (whether the operating conditions change), it automatically selects differentiated response strategies—freezing coefficients only for occasional disturbances, triggering coefficient migration for operating condition transitions, and triggering encrypted acquisition and alarms for abnormal events.
[0066] The principle of the two-way feedback closed loop: A two-way interaction is established between the self-healing management module and the coefficient calibration module. The self-healing management module periodically queries the coefficient status (stability, drift, oscillation level) of the coefficient calibration module. When cumulative drift is detected, a recalibration command is sent; when coefficient oscillation is detected, a smoothing factor adjustment command is sent. After responding to the command, the coefficient calibration module returns the execution result to the self-healing management module, forming a complete feedback loop.
[0067] A five-tiered collaborative ecosystem: data collection, identification, calibration, self-healing, and model evolution. Acquisition stage: The synchronous acquisition module obtains the raw data; Recognition stage: The working condition recognition module outputs working condition labels; Calibration stage: The coefficient calibration module updates the conversion coefficients; Self-healing stage: The self-healing management module monitors the health of the coefficients and triggers self-healing actions; Model evolution stage: Stable coefficient data is fed back to the working condition identification model, triggering incremental model updates; Technical effect: Through the above five-level collaborative ecosystem, the system of the present invention has the ability of self-sensing, self-diagnosis, self-repair, and self-evolution, and the long-term measurement accuracy and system stability are continuously guaranteed.
[0068] Beneficial effects: Compared with the prior art, the present invention has the following outstanding substantive features and significant progress: 1. Data Acquisition-Calibration Collaboration: By binding the value of the adaptive smoothing factor α to the operating condition category C, a differentiated calibration strategy for different operating conditions and different filtering intensities is realized. Compared with a unified α value scheme, the operating condition adaptability of coefficient updates is further improved.
[0069] 2. Anomaly-Collection Collaboration: Anomaly detection is no longer performed in isolation. Instead, when an anomaly is detected, historical data from the synchronous acquisition module is actively read back to form a spatiotemporal data chain for anomaly type analysis. Anomaly detection and data acquisition form a closed-loop linkage.
[0070] 3. Hierarchical anomaly isolation: Based on the continuity of the spatiotemporal data chain and the correlation of operating conditions, anomalies are subdivided into three levels: occasional disturbances and transitional anomalies. Different processing strategies are adopted for each level, avoiding the crude processing of alarming or freezing upon the first anomaly in traditional solutions.
[0071] 4. End-to-end collaborative closed loop: This invention constructs a complete collaborative closed loop of synchronous acquisition → operating condition identification → coefficient calibration → anomaly detection → readback acquisition. The modules form a technical whole that is interdependent and mutually supportive, rather than a simple superposition of functions.
[0072] 5. Adaptive capability under operating conditions: Independent coefficients are maintained for three typical operating conditions, and the system dynamically switches between them based on real-time identification of the operating condition category to adapt to different hydrogeological conditions and pump operating statuses.
[0073] 6. Self-healing and evolutionary abilities: Through the two-way feedback closed loop of the self-healing management module and the coefficient calibration module, as well as the online incremental update of the working condition classification model, the system has the self-optimization capability for long-term operation. Attached Figure Description
[0074] Figure 1 This is a block diagram of the overall architecture of the system of the present invention; Figure 2 This is a timing diagram for the synchronous electro-water data acquisition of this invention; Figure 3 This is a flowchart of the working condition identification and coefficient calibration process of the present invention; Figure 4 This is a flowchart of the anomaly detection and isolation process of the present invention. Detailed Implementation
[0075] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. These embodiments are for illustrative purposes only and do not constitute a limitation on the scope of protection of the present invention. Those skilled in the art, based on their understanding of the inventive concept, can make several modifications and alterations to the following embodiments, and these modifications and alterations still fall within the scope of protection of the present invention.
[0076] I. System Hardware Configuration: This embodiment provides a time-space matching-based system for synchronous metering of electricity and water, applied to agricultural irrigation wells in a certain province. The system hardware configuration is as follows: The main control chip uses an STM32L152 with a main frequency of 32MHz, serving as the core control unit and running algorithms for synchronous data acquisition, operating condition identification, coefficient calibration, and anomaly detection. The energy metering chip uses an RN8302B with 0.5S accuracy, used to collect electrical parameters such as three-phase voltage U, current I, active power P, and cumulative energy consumption E. The water meter is an ultrasonic water meter, connected to the main control chip via an RS485 interface, with 1.0 accuracy, used to collect water volume data such as instantaneous flow rate Q and cumulative water volume V. The communication module uses a 4G module to report the processed data to the cloud platform.
[0077] II. System Overall Architecture: like Figure 1 As shown, the system of the present invention consists of two parts: a cloud platform and an integrated water-converting terminal.
[0078] The cloud platform, deployed on a cloud server, is responsible for receiving, storing, and analyzing data reported by various terminals. Its main functions include: receiving water and electricity data, conversion factors, operating condition information, and anomaly markers reported by various terminals via a 4G wireless network; storing the received data in a cloud database, supporting historical data queries and statistical analysis; displaying real-time monitoring data, historical trends, and anomaly alarms to users through a web interface or mobile application; and supporting remote modification of terminal parameters such as collection cycle, reporting frequency, and dynamic thresholds.
[0079] The terminal section comprises the following eight core modules, and the connection relationships between these modules are as follows: Figure 1 As shown.
[0080] (1) Synchronous acquisition module: The synchronous acquisition module is used to synchronously trigger the acquisition of electrical and water parameters via hardware interrupts and adds a unified timestamp to each set of data. This module is the data source for all subsequent modules, and its acquisition accuracy directly affects the metering accuracy of the entire system.
[0081] The internal components of the synchronous acquisition module include: using the TIM2 timer built into the STM32L152 main control chip as a hardware timer to generate periodic synchronous interrupt signals; using the RN8302B energy metering chip, which is connected to the main control chip via the SPI interface, to read electrical parameters such as voltage U, current I, active power P, and cumulative energy E when an interrupt is triggered; and connecting to the ultrasonic water meter via the RS485 bus to synchronously read water volume data such as instantaneous flow rate Q and cumulative water volume V when an interrupt is triggered.
[0082] The output of the synchronous acquisition module is connected to the operating condition identification module, coefficient calibration module, and anomaly detection module, providing raw data input to these modules.
[0083] (2) Operating condition identification module: The input of the operating condition identification module is connected to the output of the synchronous acquisition module, and is used to identify the current operating condition of the water pump based on the electrical parameter feature vector.
[0084] The internal processing flow of the operating condition identification module includes: the feature extraction unit extracts active power P, power factor cosφ, total harmonic distortion rate (THD), and power change rate ΔP / Δt from the electrical parameters output by the synchronous acquisition module, and constructs a four-dimensional feature vector F; the classification and identification unit inputs the feature vector F into the pre-trained operating condition classification model and outputs the current pump operating condition category C; the similarity calculation unit calculates the similarity between the current operating condition and each operating condition in the historical operating condition database, which is used for subsequent coefficient transfer and model update.
[0085] The output of the operating condition identification module is connected to the coefficient calibration module and the cycle controller, and outputs the operating condition category C and the power change rate |ΔP / Δt|.
[0086] (3) Coefficient calibration module: The first input terminal of the coefficient calibration module is connected to the output terminal of the synchronous acquisition module, and the second input terminal is connected to the output terminal of the working condition identification module. It is used to dynamically update the electricity-water conversion coefficient under each working condition by adopting an adaptive smoothing filtering algorithm based on working condition correlation.
[0087] The internal processing flow of the coefficient calibration module includes: the real-time coefficient calculation unit calculates the real-time conversion coefficient K_instant=ΔV / ΔE based on the cumulative water volume increment ΔV and cumulative power volume increment ΔE output by the synchronous acquisition module; the historical coefficient storage unit maintains the historical conversion coefficient K_history(C) corresponding to each operating condition category C, and uses a sliding window mechanism to save the most recently preset number of coefficient values; the adaptive filtering unit determines the adaptive smoothing factor α based on the operating condition category C and power change rate |ΔP / Δt| output by the operating condition identification module, and performs first-order low-pass filtering: K_new(C)=α×K_instant+(1-α)×K_history(C); when the operating condition undergoes a natural transition, the coefficient migration unit determines the operating condition conversion factor γ based on the Euclidean distance between the feature vectors of the original operating condition and the new operating condition, and performs coefficient migration: K_history(C_new)_initial=γ×K_history(C_old).
[0088] The output of the coefficient calibration module is connected to the anomaly detection module, the self-healing management module, and the data storage module, and outputs the updated conversion coefficient K_new(C).
[0089] (4) Anomaly detection module: The input of the anomaly detection module is connected to the output of the synchronous acquisition module and the coefficient calibration module, respectively. It is used to identify abnormal deviations in the conversion coefficient based on the dynamic threshold, and to perform hierarchical isolation by reading back the historical data of the synchronous acquisition module when an anomaly is determined.
[0090] The anomaly detection module consists of the following internal components: a deviation calculation unit that calculates the relative deviation between the real-time conversion coefficient and the historical coefficient, using the formula: deviation = |K_instant - K_history(C)| / K_history(C); a dynamic threshold generation unit that generates a dynamic threshold δ = δ_base(C) + k × σ(C) + ε × S based on the operating condition category C, the historical deviation standard deviation σ(C), and the system state factor S; a hierarchical isolation unit that classifies anomalies into three levels—occasional disturbances, operating condition transitions, and abnormal events—based on the time continuity and operating condition correlation of the anomalies, and executes differentiated processing strategies for each level; and a readback control unit that, when an anomaly is detected, sends a readback command to the synchronous acquisition module to obtain historical data from the most recent N periods to form a spatiotemporal data chain.
[0091] The output of the anomaly detection module is connected to the coefficient calibration module (sends coefficient freeze / migration commands), the period controller (sends encrypted acquisition commands), and the communication module (sends alarm signals).
[0092] (5) Data storage module: The data storage module is used for local cyclic storage of monitoring data. The stored content includes: raw collected data (timestamp Tn, electrical parameters [U,I,P,E], water volume data [Q,V]), conversion coefficients (real-time coefficient K_instant, updated coefficient K_new(C)), operating condition information (operating condition category C, power change rate |ΔP / Δt|), and anomaly markers (anomaly type, occurrence time, and processing result).
[0093] The data storage module employs a cyclic overwrite mechanism, with a retention period of no less than 30 days to ensure data traceability. The input end of the data storage module connects to the synchronous acquisition module, coefficient calibration module, and anomaly detection module, while the output end connects to the communication module for reading during data reporting.
[0094] (6) Communication module: The communication module is used to report the processed data to the cloud platform via a 4G wireless network.
[0095] The functions of the communication module include: periodic reporting, which reads and packages the summarized data from the data storage module and reports it according to the preset reporting frequency (e.g., once every 5 minutes); alarm reporting, which immediately reports alarm information (including the type of anomaly, the time of occurrence, and the deviation value) when the anomaly detection module determines that an abnormal event has occurred; and remote configuration receiving, which receives configuration instructions issued by the cloud platform and updates the terminal's collection period, reporting frequency, dynamic threshold and other parameters.
[0096] The input end of the communication module is connected to the anomaly detection module (to receive alarm trigger signals) and the data storage module (to read reported data), and the output end is connected to the cloud platform via a 4G wireless network.
[0097] (7) Periodic controller: The input terminal of the cycle controller is connected to the output terminals of the operating condition identification module and the anomaly detection module, respectively, and its output terminal is connected to the control terminal of the synchronous acquisition module, which is used to dynamically adjust the acquisition cycle T of the synchronous acquisition module.
[0098] The workflow of the cycle controller includes: operating condition monitoring, receiving the operating condition category C and power change rate |ΔP / Δt| output by the operating condition identification module; abnormal condition monitoring, receiving the abnormal judgment result and encrypted acquisition command output by the abnormal detection module; cycle decision, dynamically determining the acquisition cycle T based on the operating condition and abnormal condition; and cycle switching control, adopting a hysteresis control strategy to avoid frequent oscillations of the cycle at the threshold boundary.
[0099] The cycle controller realizes a dual closed-loop linkage between operating condition status → acquisition strategy and abnormal status → acquisition enhancement.
[0100] (8) Self-healing management module (not shown in the figure): The input of the self-healing management module is connected to the output of the coefficient calibration module. It is used to monitor the long-term stability of the conversion coefficient under various operating conditions and automatically trigger recalibration or parameter adjustment when aging or oscillation is detected, so as to realize the system's self-diagnosis and self-repair.
[0101] The internal functions of the self-healing management module include: a coefficient stability monitoring unit, which periodically queries the coefficient calibration module for the conversion coefficients, update frequency, and historical deviation statistics under various operating conditions, and calculates the moving average and moving standard deviation; an aging self-healing unit, which determines that the water pump is aging or worn when the cumulative offset of the moving average relative to the initial reference value exceeds the first self-healing threshold, and triggers the coefficient recalibration process; and an oscillation self-healing unit, which determines that the coefficient oscillation is abnormal when the moving standard deviation exceeds the second self-healing threshold, and triggers the smoothing factor adjustment process.
[0102] A two-way feedback loop is formed between the self-healing management module and the coefficient calibration module: the self-healing management module sends a recalibration command or a smoothing factor adjustment command to the coefficient calibration module, and the coefficient calibration module responds and returns the execution result to the self-healing management module. The output of the self-healing management module is connected to the operating condition identification module (triggering incremental model updates), forming a linkage link of coefficient calibration → self-healing decision → model evolution.
[0103] Inter-module collaboration relationships: The data and control flows between the eight modules are as follows: The synchronous acquisition module provides electrical parameters and water volume data to the operating condition identification module and the coefficient calibration module; the operating condition identification module provides the operating condition tag C and power change rate to the coefficient calibration module and the cycle controller; the coefficient calibration module provides the conversion coefficient to the anomaly detection module, the updated coefficient to the data storage module, and the coefficient status information to the self-healing management module; the anomaly detection module sends coefficient freeze / migration commands to the coefficient calibration module, encrypted acquisition commands to the cycle controller, and alarm signals to the communication module; the self-healing management module sends recalibration / smoothing factor adjustment commands to the coefficient calibration module and model update trigger signals to the operating condition identification module; the cycle controller sends cycle control signals to the synchronous acquisition module. These modules work collaboratively to form a complete data and control flow closed loop: acquisition → identification → calibration → detection → self-healing → reporting, thereby supporting a five-stage collaborative ecosystem of acquisition → identification → calibration → self-healing → model evolution.
[0104] III. Synchronous Acquisition Timing: like Figure 2 As shown, the system generates a synchronization interrupt signal through a hardware timer.
[0105] Interrupt triggering mechanism: The hardware timer uses the TIM2 timer built into the STM32L152 main control chip, configured in periodic interrupt mode. Upon arrival of each interrupt cycle, the CPU responds to the interrupt request and enters the interrupt service routine. In the interrupt service routine, the system synchronously performs the following operations: It sends a read command to the RN8302B energy metering chip via the SPI interface to synchronously read the voltage U (V), current I (A), active power P (kW), and cumulative energy E (kWh); it sends a read command to the ultrasonic water meter via the RS485 interface to synchronously read the instantaneous flow rate Q (m³ / h) and cumulative water volume V (m³).
[0106] Since the two read operations are executed sequentially in the same interrupt service routine with an interval of less than 1 millisecond, and the time difference between the electrical parameter reading and the water volume data reading is much smaller than the sampling period, it can be considered that the two are collected in the same time segment, achieving millisecond-level synchronization accuracy.
[0107] Add timestamp: After data acquisition, the system reads the current time from the real-time clock module built into the main control chip and generates a timestamp Tn in the format YYYY-MM-DDHH:MM:SS.mmm, accurate to milliseconds. The system combines the electrical parameters, water volume data, and timestamp into the following data pair format: {Tn,[U,I,P,E],[Q,V]}. This data pair is stored in a memory buffer, awaiting further processing.
[0108] Variable-period acquisition strategy: In this embodiment, the synchronous acquisition period T is not a fixed value, but is dynamically determined by the operating condition category C and the power change rate |ΔP / Δt|. The period controller dynamically adjusts the acquisition period T of the synchronous acquisition module based on the outputs of the operating condition identification module and the anomaly detection module.
[0109] Long-cycle acquisition mode: When the operating conditions are high head / low flow rate and the power change rate is small (e.g., less than 3%), the system is in a stable operating state, and the electricity-water relationship changes slowly. The cycle controller outputs a long cycle (e.g., T=5 seconds), and the synchronous acquisition module enters a low-power long-cycle acquisition mode, which can reduce equipment power consumption and extend terminal life.
[0110] Short-cycle acquisition mode: When the operating conditions are low head / high flow rate and the power change rate is large (e.g., greater than 10%), the system is in a fluctuating operating state, and the electro-water relationship changes rapidly. The cycle controller outputs a short cycle (e.g., T=0.5 seconds), and the synchronous acquisition module enters a high-precision short-cycle acquisition mode to increase the sampling density and ensure the timeliness of coefficient calibration.
[0111] Normal acquisition mode: In other cases, the acquisition period T remains at the default value (e.g., T=1 second).
[0112] Encrypted Acquisition Mode: When the anomaly detection module determines an anomaly event, it sends an encrypted acquisition command to the period controller. The period controller temporarily forces the period T to switch to the encrypted period (e.g., T=0.2 seconds), continuing for M periods (e.g., M=20, i.e., 4 seconds), before resuming the original period. Encrypted acquisition mode provides refined data support for anomaly analysis, helping to accurately determine the anomaly type.
[0113] Cycle switching employs hysteresis control to avoid frequent oscillations at threshold boundaries. For example, when the power change rate drops from above 10% to slightly below 10%, it does not immediately switch back to the normal mode, but waits until three consecutive cycles are below 8% before switching to ensure stable operation.
[0114] IV. Operating Condition Identification Process: like Figure 3 As shown, the working condition identification process includes the following steps.
[0115] Feature vector construction: Based on the electrical parameters acquired by the synchronous acquisition module, the system constructs a four-dimensional feature vector F=[P,cosφ,THD,ΔP / Δt]. Where: P is the active power (unit kW), directly read from the energy metering chip, reflecting the real-time energy consumption level of the water pump; cosφ is the power factor, calculated by the energy metering chip, cosφ=P / (U×I×√3), reflecting the motor's operating efficiency; THD is the total harmonic distortion rate of the current (unit %), obtained by the energy metering chip through FFT analysis of the current waveform, calculated as THD=√(∑(I_h)²) / I_1×100%, where I_h is the effective value of the h-th harmonic, and I_1 is the effective value of the fundamental wave; ΔP / Δt is the power change rate, reflecting the severity of changes in operating conditions, calculated as (P_current-P_previous) / P_current×100%.
[0116] Operating condition classification model: In this embodiment, the operating condition classification model adopts the K-means clustering algorithm, and the cluster centers are pre-trained and determined based on historical operating data. Operating condition category C includes at least three types: high head / low flow rate (C1), where the head is relatively high (e.g., greater than 50m), the flow rate is relatively low (e.g., less than 30m³ / h), and the power-water relationship is stable; medium head / medium flow rate (C2), where the head is moderate (e.g., 30 to 50m), the flow rate is moderate (e.g., 30 to 60m³ / h), and the power-water relationship is normal; and low head / high flow rate (C3), where the head is relatively low (e.g., less than 30m), the flow rate is relatively high (e.g., greater than 60m³ / h), and the power-water relationship fluctuates significantly.
[0117] The training process of the operating condition classification model is as follows: 30 consecutive days of operating data from the well are collected. Feature vector samples under three typical operating conditions are manually labeled. The K-means algorithm is used to cluster the labeled samples, resulting in three cluster centers corresponding to high-lift, medium-lift, and low-lift operating conditions, respectively. In the identification phase, for each real-time feature vector F, its Euclidean distance to the three cluster centers is calculated. The operating condition corresponding to the nearest cluster center is the current operating condition C.
[0118] Online model update mechanism: The operating condition classification model has online update capabilities. When the anomaly detection module determines that the operating condition is in a natural transition and the transition continues to operate stably for more than a preset time (such as 24 hours), the system uses the stable operating data after the transition as new samples to incrementally update the cluster centers.
[0119] The incremental update trigger condition is linked to the coefficient calibration result: the incremental update of the cluster center is only triggered when the conversion coefficient K_new(C_new) under the new operating condition is stable within a preset confidence interval for P consecutive periods (e.g., P=100). The incremental update formula is Center_new=(1-η)×Center_old+η×F_new, where Center_new is the updated cluster center, Center_old is the original cluster center, η is the learning rate (η=0.05 in this embodiment), and F_new is the feature vector of the new sample. This mechanism forms a positive incentive closed loop of coefficient stabilization → model update, enabling the model to adapt to the characteristic changes of the water pump after long-term operation.
[0120] V. Coefficient Calibration Procedure: Real-time conversion factor calculation: The system calculates the real-time conversion factor K_instant for the current sampling period using the formula K_instant = ΔV / ΔE. Where ΔV is the cumulative water volume increment (in m³), ΔV = V_current - V_previous; ΔE is the cumulative electricity volume increment (in kWh), ΔE = E_current - E_previous; V_current is the cumulative water volume for the current period, V_previous is the cumulative water volume for the previous period, E_current is the cumulative electricity volume for the current period, and E_previous is the cumulative electricity volume for the previous period. K_instant represents the amount of water pumped per kilowatt-hour of electricity consumed (in m³ / kWh), reflecting the pump's energy efficiency level at the current moment.
[0121] Adaptive filter calibration based on operating conditions: The system obtains the historical conversion factor K_history(C) corresponding to operating condition category C. This value is the weighted average of historical normal data under this operating condition. The calculation formula is K_history(C)=(∑_{i=1}^{L}K_i) / L, where L is the number of coefficients for normal cycles under this operating condition stored in the historical conversion factor database, and K_i is the conversion factor for the i-th normal cycle.
[0122] The system uses a first-order low-pass filter formula to update the conversion coefficients for this operating condition: K_new(C) = α × K_instant + (1-α) × K_history(C). Where K_new(C) is the updated conversion coefficient for operating condition C (unit: m³ / kWh), K_instant is the real-time conversion coefficient for the current period (unit: m³ / kWh), K_history(C) is the historical conversion coefficient for operating condition C (unit: m³ / kWh), and α is an adaptive smoothing factor (dimensionless, value range 0 < α < 1). The value of α determines the smoothness of the filter: the larger α is, the more the coefficient update depends on the latest data, resulting in a faster response but greater fluctuations; the smaller α is, the more the coefficient update depends on historical data, resulting in better stability but a slower response.
[0123] Method for determining the adaptive smoothing factor α: In this embodiment, α is determined using a three-segment segmentation method, which is associated with the operating condition category C and the power change rate |ΔP / Δt|.
[0124] When the power change rate |ΔP / Δt| is below the first threshold (e.g., 5%), it is considered a stable operating condition, α = α_base(C). Here, α_base(C) is a basic smoothing factor tied to the operating condition category C: α_base is set to a smaller value (e.g., 0.2) for high head / low flow rate conditions to maintain coefficient stability; α_base is set to a moderate value (e.g., 0.3) for medium head / medium flow rate conditions; and α_base is set to a larger value (e.g., 0.4) for low head / high flow rate conditions to enhance response speed.
[0125] When the power change rate |ΔP / Δt| is higher than the second threshold (e.g., 15%), it is considered a severe operating condition. α = min(0.8, α_base(C) × 2) is used to quickly track changes in the operating condition, but the upper limit is set to 0.8 to avoid coefficient oscillations due to over-response.
[0126] When the power change rate |ΔP / Δt| is between the first and second thresholds (i.e., 5% to 15%), it belongs to the transitional operating condition, α = α_base(C) × (1 + β × |ΔP / Δt|). Here, β is a preset proportionality coefficient, related to the operating condition category C: β is smaller under high head / low flow rate conditions, and larger under low head / high flow rate conditions, forming a reverse coupling relationship where the more stable the operating condition, the less sensitive α is to power changes.
[0127] Coefficient storage: The system stores the updated conversion factor K_new(C) into the historical conversion factor database for the corresponding working condition. The historical conversion factor database uses a sliding window mechanism to store the most recent preset number (e.g., 1000) of normal cycle factor values for subsequent statistical calculations (e.g., standard deviation σ(C)) and anomaly detection.
[0128] Anomaly detection and tiered isolation process: like Figure 4 As shown, the anomaly detection and isolation process includes the following steps.
[0129] Dynamic threshold calculation: The system calculates the relative deviation between the real-time conversion factor and the historical conversion factor, using the formula: Deviation = |K_instant - K_history(C)| / K_history(C). Where K_instant is the real-time conversion factor for the current period, K_history(C) is the historical conversion factor for operating condition C, and |·| represents absolute value calculation.
[0130] The system uses a dynamic threshold for anomaly detection. The formula for calculating the dynamic threshold is: δ = δ_base(C) + k × σ(C). Here, δ is the dynamic threshold (dimensionless), δ_base(C) is the base threshold bound to the operating condition category C (different base thresholds are used for different operating conditions), k is a coefficient ranging from 1 to 3, with a typical value of 2, and σ(C) is the standard deviation of the historical deviation under the corresponding operating condition, reflecting the normal fluctuation range of the electricity-water relationship under that condition.
[0131] During the operation condition switching process, a switching penalty term can be added to the dynamic threshold: δ=δ_base(C)+k×σ(C)+ε×S. Here, ε is the preset switching penalty coefficient, and S is the system state factor: S=1 during operation condition switching, otherwise S=0. This penalty term is used to expand the dynamic threshold during operation condition switching to avoid frequent false triggering of anomaly detection.
[0132] Normal branch update: When the deviation is less than or equal to the dynamic threshold, the normal update branch is executed, which includes: updating the coefficients according to the first-order low-pass filter formula; storing the updated coefficients in the historical conversion coefficient library; and storing the processing results (including normal markings) in local storage and reporting them to the cloud.
[0133] Anomaly detection triggered: When the deviation exceeds the dynamic threshold, the anomaly detection process is triggered, and the system automatically performs the following operations.
[0134] The first step is to read back historical data. The system automatically reads back the synchronously acquired data from the synchronous acquisition module for the most recent N periods (N is a preset value, such as N=10), forming a spatiotemporal data chain. The read-back data includes electrical parameters, water volume data, operating condition identification results, real-time conversion factors, etc., from the past N periods.
[0135] The second step is spatiotemporal data link analysis. The system analyzes anomalies based on two key dimensions of the back-read data link: temporal continuity, i.e., whether the deviation lasts only a single cycle or exists for multiple consecutive cycles; and operational condition correlation, i.e., whether operational condition category C changes during the period of deviation.
[0136] The third step is tiered isolation. Based on the analysis results, the system implements three-tiered isolation.
[0137] Level 1 Isolation: Handling occasional disturbances. When the deviation lasts only for a single period and the data in adjacent periods is normal, it is determined to be an occasional disturbance (such as electromagnetic interference), and the coefficient is frozen K_new=K_history(C), but no alarm is triggered.
[0138] Level 2 Isolation: Condition Transition Processing. When the deviation occurs for multiple consecutive cycles and is accompanied by a stable change in condition category C, it is determined to be a natural condition transition, triggering the coefficient migration process.
[0139] Level 3 Isolation: Abnormal Event Handling. When the deviation continues for multiple cycles without a change in operating condition category C, it is determined to be an abnormal event (such as water theft or sensor failure), and the following actions are taken: coefficient freeze K_new=K_history(C), abnormal data is marked, and remote alarm is triggered.
[0140] Step 4: Coefficient Transfer Process (corresponding to Level 2 Isolation). The coefficient transfer process is triggered when a natural transition of operating conditions is determined. The coefficient transfer formula is K_history(C_new)_initial=γ×K_history(C_old), where C_old is the original operating condition category, C_new is the new operating condition category, K_history(C_old) is the historical conversion coefficient of the original operating condition, K_history(C_new)_initial is the initial historical conversion coefficient of the new operating condition, and γ is the operating condition conversion factor (dimensionless). γ is dynamically determined based on the Euclidean distance between the feature vectors of operating conditions C_old and C_new, calculated as γ=1+(d / d_max)×γ_max, where d is the Euclidean distance between the feature vectors of the original and new operating conditions, d_max is the preset maximum possible distance, and γ_max is the preset maximum conversion factor increment (e.g., 0.2).
[0141] Step 5: Encrypted Data Acquisition and Linkage. When an abnormal event (Level 3) is detected, the anomaly detection module sends an encrypted data acquisition command to the periodic controller. The periodic controller temporarily forces the acquisition period T to encrypted mode (e.g., T=0.2 seconds), continues for M periods (e.g., M=20), and then restores the original period, providing refined data support for anomaly analysis.
[0142] VII. Self-healing management mechanism: This embodiment also includes a self-healing management module, which forms a two-way feedback closed loop with the coefficient calibration module to realize the system's self-diagnosis and self-repair.
[0143] Coefficient stability monitoring: The self-healing management module periodically (e.g., every 24 hours) queries the coefficient calibration module for the conversion factor K(C), update frequency, and historical deviation statistics for each operating condition. The system monitors the long-term trend of the conversion factor under each operating condition and calculates the moving average μ_K and the moving standard deviation σ_K. The moving average μ_K = (∑{i=1}^{L}K_i) / L, and the moving standard deviation σ_K = sqrt(∑_{i=1}^{L}(K_i-μ_K)² / (L-1)), where L is the length of the sliding window (e.g., L=100), and K_i is the conversion factor for the i-th period.
[0144] The aging self-healing process: When the cumulative offset of the sliding average value μ_K relative to the initial reference value μ_0 exceeds the first self-healing threshold θ_age, it is determined that the water pump is aging or worn. The determination condition is |μ_K-μ_0| / μ_0>θ_age. The first self-healing threshold θ_age is related to the operating condition category C: θ_age is smaller under high head / low flow conditions (e.g., 0.15), moderate under medium head / medium flow conditions (e.g., 0.12), and larger under low head / high flow conditions (e.g., 0.10).
[0145] When aging self-healing is triggered, the system automatically executes the coefficient recalibration process: pause normal filtering updates for D consecutive cycles (e.g., D=50); acquire sufficient samples (e.g., 200 samples) using encrypted acquisition mode; perform median filtering on the samples, remove outliers, and recalculate the baseline coefficient μ_0_new; store the new baseline coefficient in the historical conversion coefficient library, and resume normal filtering updates.
[0146] Shock self-healing process: When the sliding standard deviation σ_K exceeds the second self-healing threshold θ_osc, it is judged as an abnormal coefficient oscillation, and the judgment condition is σ_K / μ_K>θ_osc. The second self-healing threshold θ_osc is related to the operating condition category C: θ_osc is smaller under high head / low flow conditions (e.g., 0.08), moderate under medium head / medium flow conditions (e.g., 0.10), and larger under low head / high flow conditions (e.g., 0.12).
[0147] When the oscillation self-healing is triggered, the system automatically performs the following operations: sends a smoothing factor adjustment instruction to the coefficient calibration module; the coefficient calibration module temporarily reduces the basic smoothing factor α_base(C) corresponding to this operating condition to 50% of its original value; after the sliding standard deviation is below the threshold for several consecutive periods (e.g., 20 periods), α_base(C) is gradually restored to its original value (e.g., increasing by 10% every 10 periods).
[0148] Two-way feedback closed loop: A two-way feedback loop is formed between the self-healing management module and the coefficient calibration module. Information query direction: The self-healing management module periodically queries the coefficient calibration module for the conversion coefficients, update frequency, and historical deviation statistics under various operating conditions. Recalibration feedback direction: When cumulative drift is detected, a recalibration command is sent to the coefficient calibration module, which responds and returns the calibration result. Smoothing factor adjustment feedback direction: When oscillation anomalies are detected, a smoothing factor adjustment command is sent to the coefficient calibration module, which responds and returns the adjustment result.
[0149] Five-tiered collaborative ecosystem: The aforementioned self-healing management mechanism and the online update of the operating condition classification model form a three-level linkage: the stability output of the coefficient calibration module triggers the self-healing decision of the self-healing management module, and the self-healing decision of the self-healing management module triggers the incremental update of the operating condition classification model, thus constructing a complete five-level collaborative ecosystem of acquisition → identification → calibration → self-healing → model evolution, enabling the system to have the self-optimization capability for long-term operation.
[0150] VIII. Data Reporting and Storage: Local storage: The data storage module stores the following data in local storage media (built-in Flash, capacity 64MB): raw collected data, including timestamp Tn, electrical parameters [U,I,P,E], and water volume data [Q,V]; conversion coefficients, including real-time coefficient K_instant and updated coefficient K_new(C); operating condition information, including operating condition category C and power change rate |ΔP / Δt|; and anomaly markers, including anomaly type, occurrence time, and processing result.
[0151] The storage adopts a cyclic overwrite mechanism, with a retention period of no less than 30 days to ensure data traceability.
[0152] Cloud-based reporting: The communication module packages and reports the processed data to the cloud platform via a 4G wireless network. The data packet format includes the following fields: device_id, timestamp, voltage U, current I, active power P, cumulative energy consumption E, instantaneous flow rate Q, cumulative water consumption V, real-time conversion factor K_instant, historical conversion factor K_history, updated factor K_new, operating condition category C, power change rate dPdt, and abnormal_flag.
[0153] The reporting strategy is as follows: periodic reporting, according to the preset reporting frequency (e.g., once every 5 minutes), the aggregated data is read from the data storage module, packaged and reported; alarm reporting, when the anomaly detection module determines that an abnormal event is an anomaly, alarm information (including anomaly type, occurrence time, deviation value, etc.) is immediately reported.
[0154] IX. Implementation Results: When the irrigation wells using the method of this invention are compared with those using high-precision electromagnetic flowmeters (accuracy class 0.5), the error in calculating the water volume is significantly lower than that of the traditional fixed coefficient method.
[0155] The test results for anomaly detection and hierarchical isolation functions are as follows: the recognition rate for occasional disturbances is higher than 95%, and the response time is less than 1 second; the recognition rate for natural transition of operating conditions is higher than 95%, and the response time is less than 3 seconds; the recognition rate for abnormal events is higher than 95%, and the response time is less than 30 seconds.
[0156] The modules work together, the system operates stably, and its measurement accuracy and robustness against anomalies are superior to existing technical solutions.
[0157] 10. Comparative Verification: To further verify the synergistic effect of the present invention, the applicant set up the following comparative examples, using the same hardware platform and test dataset.
[0158] Comparative Example 1 removes the association between the operating condition and α, using a unified α. Test results show that the coefficient oscillation intensifies under high-lift conditions, the response is sluggish under low-lift conditions, and the overall error increases.
[0159] In Comparative Example 2, anomaly detection does not read back historical data. Test results show that it cannot distinguish between occasional disturbances and continuous anomalies, resulting in an increased false alarm rate; it also cannot identify transitional operating conditions.
[0160] Comparative Example 3 uses single-level anomaly handling (unified freeze + alarm). Test results show that occasional disturbances lead to unnecessary alarms and coefficient freezes, resulting in decreased system availability.
[0161] Comparative Example 4 uses a fixed sampling period. Test results show that power consumption increases in steady state, and insufficient sampling density leads to coefficient response delay in transient state.
[0162] The above comparative examples fully demonstrate that the acquisition-identification-calibration-anomaly synergistic relationship proposed in this invention is not a simple functional superposition, but rather an integrated technical solution characterized by interdependence and synergistic effects. The absence of any synergistic feature will lead to a significant decline in system performance, failing to achieve the comprehensive technical effect claimed by this invention.
[0163] XI. Other implementation methods: Those skilled in the art will understand that the specific parameter values described in the above embodiments (such as threshold values of 5% and 15%, α_base values of 0.2, 0.3, and 0.4, and acquisition periods of 0.5 seconds, 1 second, and 5 seconds, etc.) are merely illustrative examples and are not intended to limit the present invention. In practical applications, these parameters can be appropriately adjusted according to specific pump characteristics, hydrogeological conditions, accuracy requirements, and other factors, and such adjustments still fall within the protection scope of the present invention.
[0164] Furthermore, the working condition classification model described in this invention is not limited to the K-means clustering algorithm, but may also employ other machine learning algorithms, such as support vector machines, random forests, neural networks, etc. These alternative solutions still fall within the protection scope of this invention.
Claims
1. A method for simultaneous metering of electricity and water based on spatiotemporal matching, characterized in that, This includes the following causal synergistic steps: Step S1, Hardware Interrupt Synchronous Acquisition and Timing Alignment: An interrupt signal is generated by the same hardware timer to synchronously trigger the electrical parameter acquisition module and the water parameter acquisition module to acquire electrical parameter and water volume data, and a unified timestamp is added to each set of data; Step S2, Electrical Parameter Feature Extraction and Operating Condition Identification: Based on the electrical parameters obtained in step S1, construct a feature vector, input it into the preset operating condition classification model, and identify the current pump operating condition category C; Step S3: Calculate the real-time conversion factor K_instant for the current sampling period; Step S4, Adaptive Filtering Calibration for Working Condition Correlation: Obtain the historical conversion coefficient K_history(C) corresponding to working condition category C, and use the adaptive smoothing filter formula to calculate the updated conversion coefficient K_new(C) for the current working condition, where the filter strength is correlated with working condition category C; Step S5, Anomaly Collaborative Detection and Hierarchical Isolation: Calculate the relative deviation between the real-time conversion coefficient K_instant and the historical conversion coefficient K_history(C). When the deviation exceeds the dynamic threshold, read back the synchronously collected data of N cycles preset in step S1, and perform hierarchical isolation based on the read-back data. Step S6, Coefficient Update and Data Reporting: Store the updated conversion coefficient K_new(C) into the historical conversion coefficient database for the corresponding working condition, and package and report the data.
2. The method for synchronous metering of electricity and water based on spatiotemporal matching according to claim 1, characterized in that, The electrical parameters obtained in step S1 include: voltage U, current I, active power P, and cumulative energy E; the water data includes: instantaneous flow rate Q and cumulative water volume V; the spatiotemporally aligned data pairs are in the form of {Tn,[U,I,P,E],[Q,V]}.
3. The method for synchronous metering of electricity and water based on spatiotemporal matching according to claim 1, characterized in that, The feature vector F = [P, cosφ, THD, ΔP / Δt] constructed in step S2 is as follows: cosφ is the power factor, THD is the total harmonic distortion of the current, and ΔP / Δt is the power change rate. The operating condition category C includes at least high head / low flow rate, medium head / medium flow rate, and low head / high flow rate.
4. The method for synchronous metering of electricity and water based on spatiotemporal matching according to claim 1, characterized in that, The formula for calculating the real-time conversion factor in step S3 is K_instant=ΔV / ΔE, where ΔV is the cumulative water volume increment and ΔE is the cumulative electricity volume increment; the formula for adaptive smoothing filtering in step S4 is K_new(C)=α×K_instant+(1-α)×K_history(C), where α is the adaptive smoothing factor, and its value is related to the operating condition category C and the power change rate |ΔP / Δt|.
5. The method for synchronous metering of electricity and water based on spatiotemporal matching according to claim 4, characterized in that, The adaptive smoothing factor α is determined as follows: when the power change rate |ΔP / Δt| is lower than the first threshold, α = α_base(C); when the power change rate |ΔP / Δt| is higher than the second threshold, α = min(0.8, α_base(C) × 2); when the power change rate is between the first threshold and the second threshold, α = α_base(C) × (1 + β × |ΔP / Δt|); where α_base(C) is the basic smoothing factor bound to the operating condition category C, and β is a preset proportional coefficient.
6. The method for synchronous metering of electricity and water based on spatiotemporal matching according to claim 1, characterized in that, The hierarchical isolation in step S5 specifically includes: if the deviation lasts only for a single period and the data in adjacent periods is normal, it is determined to be an occasional disturbance, and coefficient freezing is performed without triggering an alarm; if the deviation lasts for multiple consecutive periods and is accompanied by a stable change in operating condition category C, it is determined to be a natural transition of operating condition, and the coefficient migration process is triggered; if the deviation lasts for multiple consecutive periods and operating condition category C does not change, it is determined to be an abnormal event, and coefficient freezing, abnormal data marking, and remote alarm triggering are performed.
7. The method for synchronous metering of electricity and water based on spatiotemporal matching according to claim 1, characterized in that, The method for determining the dynamic threshold in step S5 is: δ = δ_base(C) + k × σ(C), where δ_base(C) is the base threshold bound to the operating condition category C, σ(C) is the standard deviation of the historical deviation under the corresponding operating condition, and k is a coefficient; preferably, the dynamic threshold also includes an operating condition switching penalty term: δ = δ_base(C) + k × σ(C) + ε × S, where S is the system state factor, S = 1 when the operating condition is switched, otherwise S = 0, and ε is a preset switching penalty coefficient.
8. The method for synchronous metering of electricity and water based on spatiotemporal matching according to claim 1, characterized in that, The synchronous acquisition period T in step S1 is dynamically adjusted in relation to the operating condition category C and the power change rate |ΔP / Δt|: a long-cycle acquisition mode is used under stable operating conditions with high head and low flow rate, and a short-cycle acquisition mode is used under operating conditions with low head and large flow rate fluctuations; and when step S5 determines an abnormal event, it is temporarily forced to switch to the encrypted acquisition mode.
9. A time-space matching-based electric-to-water synchronous metering system, used to implement the method of any one of claims 1 to 8, characterized in that, include: Synchronous acquisition module: used to synchronously trigger the acquisition of electrical and water parameters through hardware interrupts, and add a uniform timestamp to each set of data; Operating condition identification module: Its input end is connected to the output end of the synchronous acquisition module, and it is used to identify the current operating condition of the water pump based on the electrical parameter feature vector; Coefficient calibration module: Its first input terminal is connected to the output terminal of the synchronous acquisition module, and its second input terminal is connected to the output terminal of the working condition identification module. It is used to dynamically update the electricity-water conversion coefficient under each working condition by adopting an adaptive smoothing filtering algorithm associated with the working condition. Anomaly detection module: Its input is connected to the output of the synchronous acquisition module and the coefficient calibration module respectively. It is used to identify abnormal deviations of the conversion coefficient based on the dynamic threshold, and to perform hierarchical isolation by reading back the historical data of the synchronous acquisition module when an anomaly is determined. Data storage module: used for local cyclic storage of monitoring data; Communication module: Used to report processed data to the cloud platform via wireless network; Periodic controller: Its input terminals are respectively connected to the output terminals of the working condition identification module and the abnormality detection module, and its output terminal is connected to the control terminal of the synchronous acquisition module, which is used to dynamically adjust the acquisition cycle of the synchronous acquisition module; Self-healing management module: Its input is connected to the output of the coefficient calibration module, and it is used to monitor coefficient stability and trigger self-healing operation.
10. The time-space matching-based synchronous metering system for electricity-to-water conversion according to claim 9, characterized in that, The anomaly detection module includes a hierarchical isolation unit, which classifies anomalies into three levels—occasional disturbances, operational transitions, and abnormal events—based on their temporal continuity and operational condition correlation, and executes differentiated response strategies such as coefficient freezing, coefficient migration, encrypted data acquisition, and alarms respectively; the self-healing management module and the coefficient calibration module form a two-way feedback closed loop.