Ultrasonic flowmeter data acquisition management system
By designing an ultrasonic flowmeter data acquisition and management system, using advanced models and algorithms to predict data and infer water supply conditions, the decision-making problems caused by simple threshold judgment in the tap water supply system are solved, and more accurate decision generation and optimization and upgrading of the water supply system are achieved.
Patent Information
- Application Number
- CN202510173708.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2025-06-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing tap water supply system, the problem of judging the water supply situation through simple thresholds leads to poor choice decisions, and it is difficult to extract valuable information from a large amount of historical data, which cannot effectively support the optimization and upgrading of the water supply system.
An ultrasonic flowmeter data acquisition management system is designed, including data acquisition, data preprocessing, data prediction, water supply detection, decision generation, and data storage and management modules. The system uses GRU, N-BEATS, Prophet models to predict data, and uses FastDTW and MEMM models to infer and decide on water supply.
Through more accurate data prediction and inference of water supply conditions, the system can more effectively generate optimized decision-making plans, avoiding inefficiency and high cost problems caused by decision-making errors, and at the same time, it can extract valuable information from a large amount of data to support the optimization and upgrading of the water supply system.
Smart Images

Figure CN120123145A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data management, and specifically to an ultrasonic flowmeter data acquisition and management system. Background Art
[0002] In today's tap water supply system, the acquisition of flow rate, flow velocity, and pipeline pressure data usually relies on traditional sensor devices. These sensors are usually installed at key positions of the pipeline and measure data at certain time intervals, and transmit the data to the data processing center by wired or wireless means. When the data shows abnormal fluctuations, coping strategies are often formulated based on simple threshold judgments. For example, if the flow rate exceeds the preset upper limit or is lower than the lower limit, a certain preset plan is directly adopted according to the inferred water supply situation. This decision-making method is relatively rough, lacking in-depth analysis and comprehensive consideration of the data, and some abnormalities take some time to be reflected. The fluctuation of a single data point does not represent the actual situation. At the same time, the simplicity of data management makes it difficult to extract valuable information from a large amount of historical data, unable to provide strong support for the optimization and upgrading of the water supply system, and not conducive to long-term stable operation and efficient allocation of water resources. Summary of the Invention
[0003] Aiming at the deficiencies of the prior art, the present invention provides an ultrasonic flowmeter data acquisition and management system, which solves the problem of poor decision-making caused by simply judging the water supply situation through thresholds in the tap water supply system.
[0004] To achieve the above objectives, the present invention is realized through the following technical solutions: An ultrasonic flowmeter data acquisition and management system, including:
[0005] A data acquisition module, which collects the flow rate, flow velocity, pipeline pressure, and water supply situation of water n times every time t within a fixed time T, where the water supply situation includes normal, pipeline leakage, pipeline blockage, pipeline deformation, pump mechanical failure, and pump electrical failure;
[0006] A data preprocessing module, which performs noise and outlier removal, missing value filling, and normalization processing on the collected flow rate, flow velocity, and pipeline pressure data;
[0007] A data prediction module, which establishes GRU, N-BEATS, and Prophet models to predict the preprocessed flow rate, flow velocity, and pipeline pressure data respectively, and performs inverse normalization processing on the predicted values;
[0008] The water supply detection module calculates the absolute value sequences △F(t), △V(t), and △P(t) of the errors between the inverse-normalized predicted values and the true values, uses FastDTW to calculate the distances dFV, dFP, and dVP between △F(t), △V(t), and △P(t), substitutes them into the MEMM for training, and substitutes the new observed values dFV(new), dFP(new), and dVP(new) into the trained model to infer the water supply situation;
[0009] The decision-making generation module, if the water supply situation is normal, no processing is required. Otherwise, all feasible decisions for this situation need to be identified, and the attribute weights in each decision are adaptively adjusted. The scores corresponding to each decision are calculated based on the weights, and the one with the highest score is selected as the final decision;
[0010] The data storage and management module is responsible for storing the collected raw data, preprocessed data, prediction results, detailed information on water supply detection, and the corresponding decision-making schemes, and performs regular backup, archiving, and cleaning of the stored data, effectively releasing the storage space while protecting the data from loss.
[0011] As a further solution of the present invention, in the data preprocessing module, median filtering is used for denoising, limit filtering or the quartile method is used to remove outliers, piecewise interpolation is used to supplement missing values, and Min-Max is used to normalize the data.
[0012] As a further solution of the present invention, GRU, N-BEATS, and Prophet models are established to predict the preprocessed flow rate, flow velocity, and pipeline pressure data respectively. Among them, the input layer neurons of the GRU model are 10, the number of GRU layers is 3, each layer of GRU has 32 to 64 neurons, the activation function is selected as relu, dropout is 0 to 0.3, the output layer neurons are 10, the optimizer is selected as adam, the number of samples in each training batch is 64, and the number of training epochs is 50; the number of general stacking blocks of the N-BEATS model is 2, each stacking block contains 3 blocks, the dimension of the internal parameter thetas is 4 to 32, the number of neurons in the network layer in the stacking block is 64 to 256, the input dimension is 10, the output dimension is 10, the learning rate is 0.001, the training batch is 64, and the number of training epochs is 50; the yearly_seasonality, weekly_seasonality, and daily_seasonality of the Prophet model are all set to true, changepoint_prior_scale is 0.5, the lower_window value ranges from -7 to -1, the upper_window value ranges from 1 to 7, the seasonality_mode value is multiplicative, and the seasonality_prior_scale value ranges from 0.01 to 100.
[0013] As a further solution of the present invention, the predicted value is de-normalized according to the formula xreal = xpred × (xmax - xmin) + xmin, where xreal is the value after de-normalization, xpred is the predicted value, and xmax and xmin are the maximum and minimum values of the original sequence respectively.
[0014] As a further solution of the present invention, the specific steps for calculating the time series distance using FastDTW are as follows:
[0015] For time series A = [a1, a2,..., an], B = [b1, b2,..., bn];
[0016] Find the important points in A and B and combine the sequences C = [c1, c2,..., cp] (p < n) and D = [d1, d2,..., dq] (q < n) in chronological order;
[0017] Calculate the distance matrix M of sequences C and D, where the Euclidean distance is used as the distance metric, and the calculation formula is d(ci, dj) = sqrt((ci - dj)^2);
[0018] Create a cumulative distance matrix M' of size (p + 1)×(q + 1), and initialize all its elements to infinity, where M'[0,0] = 0;
[0019] Calculate the elements in M' according to the formula M'[k,l] = M[k,l]+min(M'[k - 1,l],M'[k,l - 1],M'[k - 1,l - 1]);
[0020] The distance between time series A and B is M'[p,q].
[0021] As a further solution of the present invention, the method for finding important points in A and B is as follows:
[0022] Find all minimum points and maximum points from A and B;
[0023] Use cubic spline interpolation to connect all the minimum points and maximum points respectively;
[0024] Obtain two envelope lines A1 and A2 of A, calculate the average value between A1 and A2 to obtain the average envelope line A';
[0025] Obtain two envelope lines B1 and B2 of B, calculate the average value between B1 and B2 to obtain the average envelope line B';
[0026] Find the point sequence where A > A' as C = [c1,c2,...,cp] (p < n), and the point sequence where B > B' as D = [d1,d2,...,dq] (q < n).
[0027] As a further solution of the present invention, the steps of substituting dFV, dFP, dVP into MEMM for training are as follows:
[0028] Define the feature function fe(u,v), where u = (dFV,dFP,dVP) is the observation value, and v is the hidden state, representing the water supply situation;
[0029] Based on the feature function, obtain the conditional probability distribution P(v|u) of the hidden state v when each given observation value u, and the calculation formula is where λe is the weight of the feature function fe(u,v), and Z(x) is the normalization factor;
[0030] Substitute the training data set {(ui,vi),i∈[1,N]}, and select the log-likelihood function as the optimization objective, where the log-likelihood function can be expressed as L(λ) = sum(logP(vi|ui));
[0031] Use the quasi-Newton method to calculate the weight λ of the feature function to obtain the final MEMM model.
[0032] As a further solution of the present invention, the attributes of all feasible decisions in the decision generation module include the repair cost C(di), the repair time T(di), the degree of impact on water supply I(di), and the improvement of long-term stability S(di).
[0033] As a further solution of the present invention, the specific steps for adaptively adjusting the attribute weights are as follows:
[0034] Calculate the ratio r1 of the average current water consumption to the average historical maximum water consumption, the deviation rate p1 of the average current pipeline pressure from the average normal pipeline pressure, and the ratio v1 of the average current water flow velocity to the average normal water flow velocity within time t;
[0035] Preset the initial weight of C(di) as wC0, the initial weight of T(di) as wT0, the initial weight of I(di) as wI0, and the initial weight of S(di) as wS0;
[0036] When r >= 0.8, for C(di), adaptively adjust its weight according to wC = wC0 × exp(-5 × (r1 - 0.8)); for T(di), adaptively adjust its weight according to the formula wT = wT0 × (1 + 4 × (r1 - 0.8)) × exp(-2 × p1); for I(di), adaptively adjust its weight according to the formula wI = wI0 × (1 + 5 × (r1 - 0.8)) × exp(3 × p1); for S(di), adaptively adjust its weight according to the formula wS = wS0 × exp(-3 × (r1 - 0.8)) × (1 + 0.5 × v1);
[0037] When r < 0.5, for C(di), adaptively adjust its weight according to wC = wC0 × (1 + 0.6 × (0.5 - r1)) × (1 + 0.3 × (1 - 1 / v1)); for T(di), adaptively adjust its weight according to the formula wT = wT0 × (1 - 0.4 × (0.5 - r1)); for I(di), adaptively adjust its weight according to the formula wI = wI0 × (1 - 0.3 × (0.5 - r1)) × (1 - 0.2 × v1); for S(di), adaptively adjust its weight according to the formula wS = wS0 × (1 + 0.5 × (0.5 - r1)) × (1 + 0.4 × p1);
[0038] When 0.5 <= r < 0.8, wC = wC0, wT = wT0, wI = wI0, wS = wS0.
[0039] As a further solution of the present invention,
[0040] Calculate the score of each decision according to the formula Ei = wT×C(di)+wT×T(di)+wI×I(di)+wS×S(di), and select the decision corresponding to the maximum Ei.
[0041] The present invention provides an ultrasonic flowmeter data acquisition and management system. Compared with the prior art, it has the following beneficial effects:
[0042] (1) The present invention respectively uses GRU, N-BEATS, and Prophet models to predict the data characteristics of flow rate, flow velocity, and pipeline pressure, further improving the accuracy of prediction;
[0043] (2) The present invention processes the absolute value sequences of the differences between the predicted values and the true values of flow rate, flow velocity, and pipeline pressure, can extract useful information from the absolute value sequences, and calculates the distances between the three absolute value sequences through FastDTW, effectively connecting the time order and dynamic characteristics of the sequences, effectively breaking through the stretching and distortion of the sequences in time, better adapting to the changes in flow rate, flow velocity, and pipeline pressure data in the water supply system, and being able to calculate the distances between them more accurately;
[0044] (3) The present invention substitutes the distance calculated by FastDTW into MEMM for training, effectively combines the relationship between the three absolute value sequences with the water supply relationship, and lays a foundation for inferring the water supply situation of the newly predicted values later;
[0045] (4) The present invention adaptively adjusts the attribute weights of each decision in the water supply situation, finds the decision most suitable for dealing with the water supply situation, and effectively avoids the problems of low efficiency and high cost caused by decision-making errors. Description of the Drawings
[0046] Figure 1 It is the system block diagram of the present invention. Detailed Embodiment
[0047] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0048] As Figure 1 , the present invention provides an ultrasonic flowmeter data acquisition and management system, including:
[0049] A data acquisition module; within a fixed time T, every time t, collect the flow rate, flow velocity, pipeline pressure of water, and the water supply situation n times;
[0050] T, t, and n can be adjusted according to the actual situation. If you want to analyze the recent data in detail, you can reduce T and t and increase n. For example, T can be set to 1 day, t to 1 hour, and n to 24×10 (i.e., collect data every 6 minutes), and collect the water supply situation every 1 hour. If you want to find the hidden relationship between the data, you can increase T, keep t unchanged, and increase n. For example, T can be set to 1 month and n to 30×24×10;
[0051] The water supply situation is divided into normal, pipeline failure, and pump failure. Among them, pipeline failures include (1) pipeline leakage. For example, the pipeline is eroded by water for a long time, accidentally damaged by construction machinery, or the pipeline connection is aged, etc.; (2) pipeline blockage. For example, the scale and microorganisms formed over a long time will cause the water flow to be unsmooth, resulting in the final pipeline blockage; (3) pipeline deformation. For example, changes in geology, temperature, and surrounding buildings will cause the pipeline to bend and expand;
[0052] Pump failures include (1) mechanical failures. For example, the damage of the impeller, bearing, and sealing device will affect the performance of the pump; (2) electrical failures. For example, motor and control system failures will cause the pump to fail to operate normally.
[0053] Data preprocessing module: This module mainly performs noise and outlier removal, missing value filling, and normalization processing on the collected flow rate, flow velocity, and pipeline pressure data;
[0054] For denoising, median filtering can be used. By sorting the data within a certain window and taking the median value to replace the noise points, impulse noise can be effectively removed. For outliers in the data, limit filtering or the quartile method can be used to determine the data outside the range as outliers and correct them;
[0055] When some data is missing due to transmission problems or temporary disconnection of the device, according to the time characteristics of the data, a suitable interpolation algorithm can be selected, such as linear interpolation. When the adjacent data points are known, the value of the missing point is calculated according to the linear relationship. For data with a certain periodicity, cubic spline interpolation is used to construct a smooth curve using the data points and their derivative information to more accurately fill the missing data and ensure the continuity of the data sequence. For non-linear data, piecewise interpolation can quickly supplement its missing values according to its own flexibility and local approximation ability;
[0056] The data is made dimensionless according to the formula xnew = (x - xmin) / (xmax - xmin), and the original data x is mapped to the interval [0,1], where xmin and xmax are the minimum and maximum values of the original data set x respectively;
[0057] Divide the normalized flow rate, flow velocity, and pipeline pressure data into training set, validation set, and test set according to the ratio of 7:2:1.
[0058] Data prediction module: Use GRU, N-BEATS, and Prophet models to predict the flow rate, flow velocity, and pipeline pressure data;
[0059] Flow rate data prediction: Flow rate data usually has complex time series characteristics, with long-term dependencies, and may be affected by various factors such as seasonal changes, holidays, population growth, etc. Given the non-linearity and time series nature of the flow rate data, a GRU model is adopted;
[0060] The GRU model controls the flow and forgetting of information through update gates and reset gates, and can effectively capture long-term dependencies in time series. During the training process, substitute the flow rate training set, adjust the model parameters through the backpropagation algorithm, evaluate the model performance and adjust hyperparameters on the validation set, and finally test the prediction accuracy of the model on the test set to achieve reliable prediction of future flow rates;
[0061] When establishing a GRU model, it is necessary to determine the parameters in its input layer, GRU layer, output layer, and optimizer. Among them, the number of neurons in the input layer is 10, there are 3 GRU layers, the number of neurons in each GRU layer is 32 - 64, the activation function is selected as relu, dropout is 0 - 0.3, the number of neurons in the output layer is 10, the optimizer is selected as adam, the number of samples in each training batch is 64, and the number of training epochs is 50;
[0062] Flow velocity data prediction: Flow velocity data not only has time series characteristics, but may also be affected by spatial factors such as pipeline layout, topography, and water demand distribution, showing complex non-linear relationships. For this type of data, the N-BEATS model is selected;
[0063] The N-BEATS model is based on a neural network architecture and automatically extracts data features and patterns by stacking multiple blocks, and can well adapt to the complex change laws of flow velocity data. During training, bring in the flow velocity training set and validation set for iterative training, and continuously optimize the model structure and parameters to improve the flow velocity prediction accuracy;
[0064] When establishing an N-BEATS model, it is necessary to determine parameters such as the type of stacked blocks, the number of blocks, and the number of neurons. Among them, there are 2 general stacked blocks, each stacked block contains 3 blocks, the dimension of the internal parameter thetas is 4 - 32, the number of neurons in the network layer in the stacked block is 64 - 256, the input dimension is 10, the output dimension is 10, the learning rate is 0.001, the training batch is 64, and the number of training epochs is 50;
[0065] Prediction of pipeline pressure data: Pipeline pressure data usually has obvious periodic and seasonal characteristics, such as the peak and trough periods of daily water use, and the changes in water use demand in different seasons. For this type of data, the Prophet model is adopted;
[0066] Based on the principles of time series decomposition and additive models, the Prophet model can automatically identify components such as seasonality and trends in the data and perform modeling and prediction. In practical applications, model parameters are configured according to the historical patterns and characteristics of pipeline pressure data, such as setting seasonal periods and trend change patterns, so as to accurately predict the dynamic changes in pipeline pressure;
[0067] When establishing the Prophet model, it is necessary to determine seasonal parameters, trend parameters, holiday and special event parameters, and other parameters. Among them, yearly_seasonality, weekly_seasonality, and daily_seasonality are all set to true, changepoint_prior_scale is 0.5, lower_window can take values from -7 to -1, upper_window can take values from 1 to 7, seasonality_mode takes the value multiplicative, and seasonality_prior_scale can take values from 0.01 to 100.
[0068] Water supply detection module: Use the trained model to predict the flow rate, flow velocity, and pipeline pressure in the test set, and then perform inverse normalization processing according to the formula xreal = xpred × (xmax - xmin) + xmin to obtain the true values, and obtain the predicted data per hour (there are 10 sets of predicted values per hour), and calculate the absolute value sequences △F(t), △V(t), △P(t) of the differences between the predicted values and the true values;
[0069] Perform Z-Score standardization processing on △F(t), △V(t), and △P(t) respectively to enhance data stability. At the same time, there is a dependency relationship between the data at adjacent time points in the sequences of △F(t), △V(t), and △P(t). Using traditional Euclidean distance and Manhattan distance cannot effectively capture the characteristics of this time series. In addition, these sequences also show non-linear changes. If the local distortions and stretches in the data cannot be well processed, it may lead to incorrect judgments of sequence similarity;
[0070] Use FastDTW to calculate the distances between ΔF(t), ΔV(t), and ΔP(t). The specific reasons are as follows: (1) FastDTW can better connect the time order and dynamic characteristics of sequences. It uses dynamic programming to find the optimal matching path between two sequences, allowing time series to stretch and distort on the time axis, so as to better adapt to the changes in flow rate, flow velocity, and pipeline pressure data in the water supply system and calculate the distances between them more accurately; (2) FastDTW has good robustness. It will not be affected by irregular data changes and can more stably reflect the overall characteristics and similarity degrees of sequences; (3) FastDTW can handle time series data of different lengths. In the actual monitoring of water supply systems, due to reasons such as data collection time intervals and equipment failures, the lengths of the observed data obtained in the same time period may be inconsistent;
[0071] For example, the specific steps to calculate the distance between two sequences using FastDTW are as follows:
[0072] Suppose A = [a1, a2,..., an], B = [b1, b2,..., bn];
[0073] If A and B are long time series, the computational complexity when constructing the distance matrix will be very high. Therefore, the following method is adopted to extract important points from A and B for constructing the distance matrix:
[0074] Find all the minimum and maximum points in A, and use cubic spline interpolation to connect all the minimum and maximum points respectively to obtain two envelope lines A1 and A2. Calculate the average value between A1 and A2 to obtain the average envelope line A'. Similarly, the average envelope line of B is obtained as B';
[0075] Find the point sequence where A > A' as C = [c1, c2,..., cp] (p < n), and the point sequence where B > B' as D = [d1, d2,..., dq] (q < n). Among them, the points extracted from C and D are all relatively important points in A and B;
[0076] Calculate the distance matrix M of the sampled sequences C and D. Among them, the Euclidean distance is used as the distance metric, and the calculation formula is d(ci, dj) = sqrt((ci - dj)^2);
[0077] Create a cumulative distance matrix M' of size (p + 1) × (q + 1) and initialize all its elements to infinity, where M'[0, 0] = 0;
[0078] According to the formula M’[k,l] = M[k,l] + min(M’[k - 1,l], M’[k,l - 1], M’[k - 1,l - 1]);
[0079] Finally, the distance between A and B is obtained as M’[p,q];
[0080] The distances between the calculated △F(t), △V(t), and △P(t) are dFV, dFP, and dVP respectively. Then, substitute them into the MEMM as the parameters for constructing the feature function. The specific steps are as follows:
[0081] Define the feature function fe(u,v), where u = (dFV, dFP, dVP) is the observed value and v is the hidden state representing the water supply situation. For example, f1(u,v) can be defined as: when dFV is greater than a certain threshold T1, dFP ∈ [L1, U1], dVP ∈ [L2, U2], and the water supply situation v is "pipe leakage", f1(u,v) = 1; otherwise, f1(u,v) = 0;
[0082] Based on the feature function, obtain the conditional probability distribution P(v|u) of the hidden state v for each given observed value u. The calculation formula is where λe is the weight of the feature function fe(u,v), which needs to be estimated from the training data, and Z(x) is the normalization factor used to ensure that P(v|u) is a legal probability distribution;
[0083] Substitute the training data set {(ui,vi), i ∈ [1, N]} and select the log-likelihood function as the optimization objective. The log-likelihood function can be expressed as L(λ) = sum(logP(vi|ui)), and use the quasi-Newton method to calculate the weight λ of the feature function;
[0084] After training the MEMM, for a new observed value u, the water supply situation at this time can be judged by calculating P(v|u). Specifically, calculate the probability P(v|u) of all possible hidden states v, and then select the hidden state with the maximum probability as the inferred water supply situation.
[0085] Decision generation module: If the water supply situation is normal, no processing is required; otherwise, all feasible decisions for this water supply situation need to be clarified according to the specific situation. Let the decision set be {de1, de2,..., der}, where r is the number of decisions;
[0086] Determine the attributes for evaluating decisions, including: repair cost C(di), which represents the economic cost required to execute decision di; repair time T(di), that is, the time taken for decision di to complete the repair of the anomaly from the start of execution; the degree of impact on water supply I(di), which quantifies the degree of interference with normal water supply during the execution of the decision, and the greater the value, the greater the impact; long-term stability improvement S(di), which reflects the improvement degree of the long-term stability of the water supply system after the implementation of the decision.
[0087] For example, it has been determined that the cause of the anomaly is pipeline leakage. At this time, the treatment methods are as follows: Decision 1 - local pipeline repair, C(d1) = 5000 yuan, T(d1) = 8 hours, I(d1) = 0.6 (within the range of 0 - 1, 1 indicates a serious impact), S(d1) = 0.7 (within the range of 0 - 1, 1 indicates a significant improvement); Decision 2 - replace some components, C(d2) = 8000 yuan, T(d1) = 12 hours, I(d1) = 0.4, S(d1) = 0.8; Decision 3 - overall pressure regulation, C(d3) = 3000 yuan, T(d3) = 4 hours, I(d3) = 0.8, S(d3) = 0.6.
[0088] Within time t, the ratio r1 of the current average water consumption to the average historical maximum water consumption, the deviation rate p1 of the current average pipeline pressure from the average normal pipeline pressure, the ratio v1 of the current average water flow velocity to the average normal water flow velocity, the initial weight of C(di) is wC0, the initial weight of T(di) is wT0, the initial weight of I(di) is wI0, and the initial weight of S(di) is wS0.
[0089] When r >= 0.8, it indicates that this time period is in the peak water consumption period. The weights of T(di) and I(di) should be increased, and the weights of C(di) and S(di) should be decreased. For the repair cost, its weight is adaptively adjusted according to the formula wC = wC0 × exp(-5 × (r1 - 0.8)); for the repair time, its weight is adaptively adjusted according to the formula wT = wT0 × (1 + 4 × (r - 0.8)) × exp(-2 × p1); for the degree of impact on water supply, its weight is adaptively adjusted according to the formula wI = wI0 × (1 + 5 × (r - 0.8)) × exp(3 × p1); for the long-term stability, its weight is adaptively adjusted according to the formula wS = wS0 × exp(-3 × (r - 0.8)) × (1 + 0.5 × v1).
[0090] When r < 0.5, it indicates that this time period is in the low water - consumption period. The weights of T(di) and I(di) should be reduced, while the weights of C(di) and S(di) should be increased. For the repair cost, its weight is adaptively adjusted according to the formula wC = wC0×(1 + 0.6×(0.5 - r))×(1 + 0.3×(1 - 1 / v1)); for the repair time, its weight is adaptively adjusted according to the formula wT = wT0×(1 - 0.4×(0.5 - r)); for the degree of water - supply impact, its weight is adaptively adjusted according to the formula wI = wI0×(1 - 0.3×(0.5 - r))×(1 - 0.2×v1); for the long - term stability, its weight is adaptively adjusted according to the formula wS = wS0×(1 + 0.5×(0.5 - r))×(1 + 0.4×p1).
[0091] When 0.5 <= r < 0.8, it indicates that this time period is in the normal water - consumption range, and there is no need to adjust the weight of each item anymore, that is, wC = wC0, wT = wT0, wI = wI0, wS = wS0;
[0092] Calculate the decision score Ei of each item according to the weights: Ei = wT×C(di)+wT×T(di)+wI×I(di)+wS×S(di), and select the decision corresponding to the largest Ei.
[0093] Data storage and management module: Responsible for storing the collected raw data, pre - processed data, prediction results, detailed information of water - supply detection (including the time, type, and analysis - process data corresponding to the water - supply situation), and relevant decision - making information, etc. Build a secure, reliable, and easily extensible database architecture. For example, adopt a combination of relational databases and non - relational databases to ensure the efficient storage and rapid retrieval of data;
[0094] Perform regular backup and archiving operations on the stored data to prevent data loss. At the same time, according to the timeliness and importance of the data, formulate a reasonable data - cleaning strategy to release storage space and ensure the performance of the database. For example, compress and store the raw data that exceeds a certain number of years, summarize and archive the data of the solved water - supply situations, and retain key information for subsequent analysis and experience reference.
[0095] Some of the data in the above formulas are numerically calculated after removing their dimensions, and the content not described in detail in this specification belongs to the prior art well - known to those skilled in the art.
[0096] The above embodiments are only used to illustrate the technical method of the present invention and not to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical method of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical method of the present invention.
Claims
1. An ultrasonic flowmeter data acquisition and management system, characterized in that: include: The data acquisition module collects water flow, flow rate, pipeline pressure and water supply conditions for n times at intervals of time t within a fixed time T, where the water supply conditions include normal, pipeline leakage, pipeline blockage, pipeline deformation, water pump mechanical failure, and water pump electrical failure; The data preprocessing module removes noise and outliers, fills in missing values, and normalizes the collected flow, velocity, and pipeline pressure data; In the data prediction module, GRU, N-BEATS, and Prophet models are established to predict the preprocessed flow, flow velocity, and pipeline pressure data, and the predicted values are denormalized; In the water supply detection module, the absolute value sequence of the inverse normalized predicted value and the true value error △F(t), △V(t), △P(t) is obtained, and the distances dFV, dFP, and dVP between △F(t), △V(t), and △P(t) are calculated using FastDTW, and substituted into the MEMM for training. The new observations dFV(new), dFP(new), and dVP(new) are substituted into the trained model to infer the water supply situation. Decision generation module: If the water supply situation is normal, no processing is required. Otherwise, all feasible decisions for the situation need to be identified, and the attribute weights in each decision need to be adaptively adjusted. The score corresponding to each decision is calculated based on the weight, and the one with the highest score is selected as the final decision. The data storage and management module is responsible for storing the collected raw data, pre-processed data, prediction results, detailed information on water supply testing and corresponding decision-making plans, and regularly backing up, archiving and cleaning up the stored data.
2. The ultrasonic flowmeter data acquisition and management system according to claim 1, characterized in that: In the data preprocessing module, median filtering is used to remove noise, limiting filtering or quartile method is used to remove outliers, segmented interpolation is used to supplement missing values, and Min-Max is used to normalize the data.
3. The ultrasonic flowmeter data acquisition and management system according to claim 1, characterized in that: Build GRU, N-BEATS, and Prophet models to predict the preprocessed flow rate, flow velocity, and pipeline pressure data respectively. Among them, the input layer neurons of the GRU model are 10, the number of GRU layers is 3, each layer of GRU has 32 - 64 neurons, the activation function is selected as relu, dropout is 0 - 0.3, the output layer neurons are 10, the optimizer is selected as adam, the number of samples in each training batch is 64, and the number of training epochs is 50; the number of general stacking blocks of the N-BEATS model is 2, each stacking block contains 3 blocks, the dimension of the internal parameter thetas is 4 - 32, the number of neurons in the network layer in the stacking block is 64 - 256, the input dimension is 10, the output dimension is 10, the learning rate is 0.001, the training batch is 64, and the number of training epochs is 50; for the Prophet model, yearly_seasonality, weekly_seasonality, and daily_seasonality are all set to true, changepoint_prior_scale is 0.5, the lower_window value ranges from -7 to -1, the upper_window value ranges from 1 to 7, seasonality_mode takes the value of multiplicative, and seasonality_prior_scale takes the value from 0.01 to 100.
4. The ultrasonic flowmeter data acquisition and management system according to claim 1, characterized in that: Perform inverse normalization on the predicted value according to the formula xreal = xpred × (xmax - xmin) + xmin, where xreal is the value after inverse normalization, xpred is the predicted value, and xmax and xmin are the maximum and minimum values of the original sequence respectively.
5. The ultrasonic flowmeter data acquisition and management system according to claim 1, characterized in that: The specific steps to calculate the time series distance using FastDTW are as follows: For time series A = [a1, a2,..., an], B = [b1, b2,..., bn]; Find the important points in A and B and combine the sequences C = [c1, c2,..., cp] (p < n) and D = [d1, d2,..., dq] (q < n) in chronological order; Calculate the distance matrix M of sequences C and D, where the Euclidean distance is used as the distance metric, and the calculation formula is d(ci, dj) = sqrt((ci - dj)^2); Create a cumulative distance matrix M' of size (p + 1) × (q + 1) and initialize all its elements to infinity, where M'[0, 0] = 0; Calculate the elements in M' according to the formula M'[k, l] = M[k, l] + min(M'[k - 1, l], M'[k, l - 1], M'[k - 1, l - 1]); The distance between time series A and B is M'[p, q].
6. The ultrasonic flowmeter data acquisition and management system according to claim 5, characterized in that: The method to find the important points in A and B is as follows: Find all the minimum and maximum points from A and B; Use cubic spline interpolation to connect all the minimum and maximum points respectively; Obtain two envelopes A1 and A2 of A, calculate the average value between A1 and A2, and obtain the average envelope A'; Obtain two envelopes B1 and B2 of B, calculate the average value between B1 and B2, and obtain the average envelope B'; Find the point sequence C = [c1, c2, ..., cp] (p<n),B> The point sequence of B' is D = [d1, d2, ..., dq] (q <n)。 7. The ultrasonic flowmeter data acquisition and management system according to claim 1, characterized in that: The steps to substitute dFV, dFP, and dVP into MEMM for training are: Define the characteristic function fe(u,v), where u = (dFV, dFP, dVP) is the observed value and v is the hidden state, indicating the water supply situation; Based on the characteristic function, the conditional probability distribution P(v|u) of the hidden state v for each given observation value u is obtained, and the calculation formula is Among them, λe is the weight of the characteristic function fe(u,v), and Z(x) is the normalization factor; Substitute the training data set {(ui,vi),i∈[1,N]} and select the log-likelihood function as the optimization target, where the log-likelihood function can be expressed as L(λ)=sum(logP(vi|ui)); The quasi-Newton method is used to calculate the characteristic function weight λ and obtain the final MEMM model.
8. The ultrasonic flowmeter data acquisition and management system according to claim 1, characterized in that: The attributes of all feasible decisions in the decision generation module include repair cost C(di), repair time T(di), impact on water supply I(di), and long-term stability improvement S(di).
9. The ultrasonic flowmeter data acquisition and management system according to claim 8, characterized in that: The specific steps for adaptively adjusting attribute weights are: Calculate the ratio of the current average water consumption to the historical highest average water consumption within the time t, r1, the deviation rate of the current average pipe pressure to the normal average pipe pressure, p1, and the ratio of the current average water flow velocity to the normal average water flow velocity, v1; The initial weight of C(di) is preset to be wC0, the initial weight of T(di) is preset to be wT0, the initial weight of I(di) is preset to be wI0, and the initial weight of S(di) is preset to be wS0; When r>=0.8, for C(di), its weight is adaptively adjusted according to wC=wC0×exp(-5×(r1-0.8)); For T(di), its weight is adaptively adjusted according to the formula wT=wT0×(1+4×(r1-0.8))×exp(-2×p1); For I(di), its weight is adaptively adjusted according to the formula wI=wI0×(1+5×(r1-0.8))×exp(3×p1); For S(di), its weight is adaptively adjusted according to the formula wS=wS0×exp(-3×(r1-0.8))×(1+0.5×v1); When r<0.5, for C(di), its weight is adaptively adjusted according to wC=wC0×(1+0.6×(0.5-r1))×(1+0.3×(1-1 / v1)); For T(di), its weight is adaptively adjusted according to the formula wT=wT0×(1-0.4×(0.5-r1)); For I(di), its weight is adaptively adjusted according to the formula wI=wI0×(1-0.3×(0.5-r1))×(1-0.2×v1); For S(di), its weight is adaptively adjusted according to the formula wS=wS0×(1+0.5×(0.5-r1))×(1+0.4×p1); When 0.5<=r<0.8, wC=wC0, wT=wT0, wI=wI0, wS=wS0.
10. The ultrasonic flowmeter data acquisition and management system according to claim 9, characterized in that: Calculate the score of each decision according to the formula Ei=wT×C(di)+wT×T(di)+wI×I(di)+wS×S(di), and select the corresponding decision when Ei is the largest.