Intelligent water affair remote monitoring and control system based on Internet of Things
By integrating initialization, data transmission, verification feedback, and sampling optimization modules, and utilizing a long short-term memory network model and a lightweight edge prediction model, the sampling frequency and transmission strategy are dynamically adjusted, solving the problems of water pressure data delay and distortion, and improving the control accuracy and stability of the water supply system.
Patent Information
- Application Number
- CN202511468680.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2025-11-14
AI Technical Summary
In existing technologies, insufficient water pressure data acquisition frequency and limited transmission bandwidth lead to large delays and distortions in water pressure data, affecting the control accuracy of the water supply system, potentially causing false alarms and energy waste, and even the risk of pipeline rupture.
By integrating initialization, data transmission, verification feedback, and sampling optimization modules, a lightweight edge prediction model is generated using a long short-term memory network model. The sampling frequency and transmission strategy are dynamically adjusted to achieve efficient monitoring and optimized transmission.
It improves the real-time performance and accuracy of water monitoring, reduces bandwidth and energy consumption, and ensures system stability and precision.
Smart Images

Figure CN120956775A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent water management remote monitoring and control, and more specifically, to an intelligent water management remote monitoring and control system based on the Internet of Things. Background Technology
[0002] In modern urban water supply systems, water pressure stability is crucial for ensuring water quality, especially during peak water usage periods, such as morning and evening when residents use water intensively, or during sudden water usage incidents in industrial areas. In these scenarios, water pressure fluctuations in the pipe network are particularly severe, often large, potentially leading to frequent pump starts and stops, and even the risk of pipe bursts. To ensure the normal operation of the water supply system, pressure sensors in the pipe network monitor water pressure changes in real time and transmit the data to the control center. However, with the continuous growth in demand for tap water, real-time monitoring of water pressure data faces increasing challenges, especially given limited network bandwidth and transmission latency. How to accurately transmit water pressure data and ensure its timeliness and accuracy has become a core issue that current water supply management systems urgently need to address.
[0003] In existing technologies, water pressure data acquisition typically relies on a fixed sampling frequency, such as 1Hz, using linear interpolation to compensate for data delays. However, this method falls short when faced with frequent and drastic dynamic changes in water pressure. Due to the limitation of the sampling frequency, the data collected by the sensor often has a significant time delay, and the transmission bandwidth is also constrained during data transmission, leading to data distortion and an inability to accurately reflect the instantaneous state of water pressure. Especially when water pressure fluctuates sharply, the linear interpolation method cannot accurately compensate for missing data, resulting in increased data errors and affecting the control accuracy of the water supply system. More seriously, this data distortion may lead to false alarms, causing pumps to start and stop erroneously, resulting in energy waste and even the risk of pipeline rupture. The root cause of these problems lies in the fact that current sampling algorithms fail to fully consider the dynamic characteristics of water pressure fluctuations and the actual transmission environment, and fail to achieve a reasonable balance between sampling frequency and bandwidth. Therefore, how to implement an adaptive sampling strategy to minimize bandwidth usage while ensuring data accuracy has become a key technical issue for improving the accuracy and efficiency of pipeline pressure monitoring systems. Summary of the Invention
[0004] This invention addresses the technical problems existing in the prior art by providing an intelligent water remote monitoring and control system based on the Internet of Things. By integrating an initialization module, a data transmission module, a verification feedback module, and a sampling optimization module, it achieves efficient monitoring and optimized transmission of water pressure data, thereby solving the problems mentioned in the background art.
[0005] The technical solution of the present invention to solve the above-mentioned technical problems is as follows: it specifically includes an initialization module, a data transmission module, a verification feedback module, and a sampling optimization module;
[0006] Initialization module: Configured to pre-train a long short-term memory network model in the cloud using historical water pressure data, and generate a lightweight edge prediction model through knowledge distillation;
[0007] Data transmission module: configured to use the lightweight edge prediction model at the edge to calculate the pressure prediction value, generate the residual between the prediction value and the actual value, dynamically set the quantization threshold based on the residual variance, and perform differential encoding transmission when the absolute value of the residual exceeds the quantization threshold;
[0008] Verification feedback module: configured to receive differentially encoded data and reconstruct pressure values at the control center, perform confidence level detection based on the number of consecutive untransmitted residuals and reconstruction error, and generate a model recalibration command when the confidence level is lower than a set threshold;
[0009] Sampling optimization module: configured to dynamically calculate the sampling frequency using a dual-modal adjustment coefficient based on the confidence level detection results and residual fluctuation characteristics, and to constrain bandwidth usage and reconstruction accuracy using Lyapunov optimization theory;
[0010] In a preferred embodiment, the specific operation of pre-training the long short-term memory network model in the initialization module is as follows:
[0011] A1. Receives a historical water pressure dataset containing timestamps and original pressure values as input. Using non-steady-state signal processing techniques, the original pressure signal is separated into a core fluctuation term and an attenuation interference term. The core fluctuation term is composed of an adaptive basis function weighted by the characteristics of the pipe network resonant frequency and the pump periodicity, with the weights being time-varying amplitude coefficients related to water usage intensity. The attenuation interference term is suppressed by dynamic threshold filtering. This dynamic threshold is calculated proportionally based on the maximum value of the pressure change curvature. When the second derivative of the pressure value exceeds this dynamic threshold, median filtering is performed, ultimately outputting a pure core pressure fluctuation sequence that retains key physical characteristics.
[0012] A2. The pipeline network topology is abstracted into a hydraulic impedance-weighted graph structure model. The core pressure fluctuation sequence and associated weather types, season identifiers, and pipe diameter characteristics are input. When training the long short-term memory network model in the cloud, a preset loss function constraint is added. This preset loss function contains the weighted sum of the data fitting component and the physical conservation constraint component. The data fitting component is the sum of squares of the differences between the predicted value and the core pressure fluctuation value. The physical conservation constraint component requires that the prediction results satisfy the fluid mass conservation equation at each node of the pipeline network. A generative adversarial network is used to verify whether the prediction results satisfy the physical laws of fluid continuity. Finally, a pre-trained basic model with physical rationality is output.
[0013] In a preferred embodiment, the specific operation of generating the lightweight edge prediction model is as follows:
[0014] B1. Obtain all neuron weight parameters of the pre-trained base model; calculate the sensitivity of each weight parameter to the model prediction error, defined as the product of the gradient of the weight and the weight value; filter weights with sensitivity values higher than a preset proportional coefficient to generate a candidate parameter set; perform entropy-constrained non-uniform quantization on the candidate parameter set, and round it according to the dynamic quantization step size when the Shannon entropy value of the parameter distribution is less than the preset entropy threshold, otherwise retain the original parameter value; finally, generate a lightweight edge model framework with fewer parameters than the set upper limit.
[0015] B2. Deploy a lightweight edge model framework on the target edge device; use local measured data from the device to verify whether the model error is within the preset allowable range. If the error exceeds the set percentage of the device's range, start the meta-learning algorithm to optimize the weights. This optimization is completed in a single sampling iteration; reorganize the model parameter address mapping relationship according to the characteristics of the target device's memory storage unit; finally, output a device-customized edge prediction model.
[0016] In a preferred embodiment, the data transmission module specifically includes generating the residual between the predicted value and the actual value, which specifically includes:
[0017] First, the actual pressure measurement value of the target edge device at a specific moment is obtained. At the same time, the pressure prediction value at the same moment is calculated using a lightweight edge prediction model already deployed on the edge device. Then, the deviation between the actual pressure value and the predicted pressure value is calculated. Finally, a set of residual data containing device identifier, timestamp and deviation is output.
[0018] In a preferred embodiment, the specific operation of dynamically setting the quantization threshold based on the residual variance is as follows:
[0019] First, a historical residual sequence is collected within a sliding time window, with the window length fixed at a preset value. The sequence elements contain residual values at consecutive time points. Next, a dispersion measure of the residual sequence is calculated, which is obtained by averaging the squared deviations of each element in the residual set from the mean. Then, the dispersion measure is input into a preset nonlinear function model, which reflects the complex mapping relationship between the measure and the optimal decision threshold. Finally, a dynamic quantization threshold is output, which adaptively adjusts according to the degree of residual fluctuation and has a lower limit protection mechanism.
[0020] In a preferred embodiment, the specific operation of performing differential coded transmission is as follows:
[0021] First, the currently calculated residual data and corresponding dynamic quantization threshold are obtained. Then, it is determined whether the absolute value of the residual is greater than the latest quantization threshold. If it is not greater, an empty data packet is generated to maintain the transmission heartbeat. If it is greater, differential encoding is performed: the difference between the current residual and the previous valid transmission residual is extracted, and the difference is compressed using variable-length encoding rules to form a binary code stream. Finally, the data packet is encapsulated and sent to the central server via the User Datagram Protocol. At the same time, a periodic verification mechanism is executed to force the transmission of the complete residual value at fixed time intervals.
[0022] In a preferred embodiment, the specific operation of receiving differentially encoded data and reconstructing the pressure value in the verification feedback module is as follows:
[0023] First, the control center parses the type of the received data packets: if it is an empty data packet, the Lie algebra adjoint representation operator is triggered, and the virtual residual value is calculated in combination with the historical residual status of the device; if it is a differentially coded data packet, the inverse long decoding operation is performed to restore the difference value, and the current residual is calculated by superimposing the residual of the previous valid transmission with the difference value; if it is a complete residual data packet, the original residual value is directly extracted; second, the calculated residual is added to the real-time predicted pressure value of the edge device to generate the reconstruction pressure value; finally, the historical residual status of the device is updated to provide a benchmark for the next cycle.
[0024] In a preferred embodiment, the confidence level detection specifically includes:
[0025] First, a transmission state topology graph is constructed, with continuous untransmitted residual events as isolated nodes and effective transmitted events as connected edges, forming a dynamic graph structure. The algebraic connectivity index of this graph is calculated to quantify the risk of data transmission interruption. Second, the absolute deviation between the reconstructed pressure value and the actual pressure sensor value is obtained and converted into a dimensionless strain error through the stress-strain constitutive relationship of the pipe material. Subsequently, the algebraic connectivity and strain error are mapped to the Poincaré disk model to calculate the hyperbolic geodesic distance. Finally, the reciprocal function value of the hyperbolic distance is used as the confidence level to achieve a multi-dimensional fusion evaluation of physical constraints and communication status.
[0026] In a preferred embodiment, the specific operation of dynamically calculating the sampling frequency using the dual-modal adjustment coefficient in the sampling optimization module is as follows:
[0027] First, the system receives the confidence quantification and residual fluctuation characteristic index output by the verification feedback module. Second, the confidence quantification is divided into two modes: high reliability and low reliability. When the confidence level is higher than the preset safety threshold, the high reliability mode adjustment coefficient is selected; when the confidence level is lower than the safety threshold, the low reliability mode adjustment coefficient is selected. This coefficient is also associated with the mean residual fluctuation amplitude. Subsequently, based on the preset initial sampling frequency, the adjustment coefficient is made proportional to the confidence level in the high reliability state, and proportional to the product of the confidence level and the residual fluctuation amplitude in the low reliability state. Finally, a dynamic sampling frequency is generated, the value of which is constrained between the minimum and maximum hardware sampling rates allowed by the device.
[0028] In a preferred embodiment, the specific operation of constraining bandwidth occupancy and reconstruction accuracy using Lyapunov optimization theory is as follows:
[0029] First, a quadratic energy function is constructed, comprising a bandwidth occupancy deviation term and a reconstruction accuracy deviation term. The bandwidth deviation term is defined as the square of the difference between the current actual bandwidth occupancy and the preset bandwidth upper limit, and the accuracy deviation term is defined as the square of the difference between the current reconstruction pressure error and the preset accuracy threshold. The two deviations are multiplied by preset weighting coefficients and then added together to form the energy function. Second, using the dynamic sampling frequency as the optimization variable, the partial derivative of the energy function with respect to frequency is calculated to form a gradient vector. The optimal frequency solution is solved iteratively using the gradient descent method. Each iteration must forcibly satisfy the device hardware sampling rate boundary constraints. Finally, the optimized frequency value is encapsulated as a device control command. A curvature compensation operator based on the Riemannian manifold is added to the network transport layer, and the command strength is dynamically adjusted according to the number of hops in the network path topology to suppress transmission jitter.
[0030] The beneficial effects of this invention are as follows: By integrating an initialization module, a data transmission module, a verification feedback module, and a sampling optimization module, the system achieves efficient monitoring and optimized transmission of water pressure data. The system first pre-trains a long short-term memory network model in the cloud and generates a lightweight edge prediction model to reduce computational and transmission load. The data transmission module, based on dynamic quantization thresholds and differential coding technology for residuals, effectively reduces bandwidth usage while maintaining high data accuracy. The verification feedback module monitors the accuracy of transmitted data in real time through confidence level detection and triggers model recalibration when confidence level decreases, ensuring long-term system stability. The sampling optimization module dynamically adjusts the sampling frequency based on confidence level and residual fluctuation characteristics, achieving a balance between bandwidth usage and reconstruction accuracy using Lyapunov optimization theory, thus improving the real-time performance and accuracy of water monitoring while effectively reducing bandwidth consumption and energy consumption. Attached Figure Description
[0031] Figure 1 This is a flowchart of the method of the present invention;
[0032] Figure 2 This is a block diagram of the system structure of the present invention. Detailed Implementation
[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0034] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0035] In the description of this application, the term "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0036] Example 1
[0037] This embodiment provides, for example Figure 1-2 The present invention relates to an intelligent water remote monitoring and control system based on the Internet of Things, which specifically includes: an initialization module, a data transmission module, a verification feedback module, and a sampling optimization module;
[0038] Initialization module: Configured to pre-train a long short-term memory network model in the cloud using historical water pressure data, and generate a lightweight edge prediction model through knowledge distillation;
[0039] Data transmission module: configured to use a lightweight edge prediction model to calculate the pressure prediction value at the edge, generate the residual between the prediction value and the actual value, dynamically set the quantization threshold based on the residual variance, and perform differential encoding transmission when the absolute value of the residual exceeds the quantization threshold;
[0040] Verification feedback module: configured to receive differentially encoded data and reconstruct pressure values at the control center, perform confidence level detection based on the number of consecutive untransmitted residuals and reconstruction error, and generate a model recalibration command when the confidence level is lower than a set threshold;
[0041] Sampling optimization module: It is configured to dynamically calculate the sampling frequency using a dual-mode adjustment coefficient based on the confidence level detection results and residual fluctuation characteristics, and to constrain bandwidth occupancy and reconstruction accuracy using Lyapunov optimization theory.
[0042] In this embodiment, the initialization module needs to be specifically explained. The specific operation of the pre-trained long short-term memory network model is as follows:
[0043] A1. Receive historical water pressure dataset containing timestamps and raw pressure values as input. Use non-steady-state signal processing techniques to separate the raw pressure signal into a core fluctuation term and a decaying interference term. The expression is as follows:
[0044] ;
[0045] in, Represents timestamp The corresponding raw water pressure measurement value is used as the algorithm input signal to characterize the real-time pressure status of the pipeline network. The adaptive basis function, representing the resonant frequency characteristics of the pipeline network and the periodic characteristics of the water pump, provides a physical driving basis for water pressure fluctuations. Represents the time-varying amplitude coefficients (dynamic weighted basis functions) associated with water intensity. (Quantification of the contribution of water load to pressure fluctuations). This indicates the amplitude of a sudden disturbance (such as a valve suddenly closing or a pipe burst). Indicates the interference attenuation rate, used to control the attenuation speed of abnormal signals. The larger the value, the faster the interference disappears; its range is... , The number of basis functions is determined by the complexity of the network topology. =3-5), the function of this formula is to decompose the raw water pressure signal into interpretable physical components ( ) and sudden noise components ( This replaces the pure mathematical decomposition of the traditional Fourier transform; the core fluctuation term is composed of an adaptive basis function weighted by the characteristics of the pipe network resonant frequency and the pump periodicity, with the weights being time-varying amplitude coefficients related to water usage intensity; the attenuation interference term is suppressed by dynamic threshold filtering, which is calculated proportionally based on the maximum value of the pressure change curvature, and its calculation formula is:
[0046] ;
[0047] in, This represents the dynamic threshold for filtering, used to distinguish between real water pressure fluctuations and noise: when the acceleration of pressure change exceeds this value, it is considered interference. The second derivative of the pressure over time is used to quantify the curvature (acceleration) of the pressure change, reflecting the intensity of the fluctuation. 0.3 represents an empirical adjustment coefficient used to balance sensitivity and noise resistance: the smaller the value, the more sensitive (more prone to misjudging noise), and the larger the value, the less sensitive (more prone to residual interference). When the second derivative of the pressure value exceeds this dynamic threshold, median filtering is performed, and the final output is a pure core pressure fluctuation sequence that retains key physical properties.
[0048] A2. Abstract the pipeline network topology into a hydraulic impedance-weighted graph structure model, inputting the core pressure fluctuation sequence and associated weather types, season identifiers, and pipe diameter characteristics; when training the Long Short-Term Memory (LSTM) network model in the cloud, add a preset loss function constraint. This preset loss function contains a weighted sum of data fitting components and physical conservation constraint components, and its expression is:
[0049] ;
[0050] in, This represents the total loss during model training, used to optimize the objective function. Indicates time The predicted pressure value, i.e., the model output, Indicates time The filtered true pressure, i.e., the baseline value after noise reduction. express Range, used to quantify the deviation between predicted and actual values. This represents the physical constraint weight coefficient, used to adjust the influence of physical constraint terms (its value is set to 0.7). This represents the data fitting term, which forces the predicted values to approximate the true values. The physical regularization term forces the model to obey fluid dynamics laws; the data fitting component is the sum of squares of the differences between the predicted values and the core pressure fluctuation values; the physical conservation constraint component requires the predicted results to satisfy the fluid mass conservation equation at each node of the pipeline network, and its expression is:
[0051] ;
[0052] in, This represents the constraint term in the fluid mass conservation equation, used to measure the degree to which the prediction results violate fluid mass conservation. This represents a node in the pipeline topology diagram, specifically a pressure monitoring point within the pipeline network. This represents a network topology diagram, including all nodes. The graph structure of the pipe segment edges, This represents the divergence operator defined on the pipeline network topology diagram, used to calculate the spatial rate of change of physical quantities on the pipeline network diagram. Represents a node The diameter of the pipe section at the connection point determines the geometric characteristics of the pipe, which in turn determine the cross-sectional area of the water flow. Represents a node The predicted water pressure value, i.e., the pressure prediction result output by the model. Represents a node The hydraulic impedance of the corresponding pipe section is a physical parameter (similar to resistance) used to reflect the resistance to water flow. This represents the time partial derivative operator, used to calculate the rate of change of a physical quantity with respect to time. It represents the volumetric flow rate of water in the pipe network; it uses a generative adversarial network to verify whether the prediction results satisfy the physical laws of fluid continuity; and finally outputs a pre-trained basic model with physical rationality.
[0053] The specific steps for generating a lightweight edge prediction model are as follows:
[0054] B1. Obtain all neuron weight parameters of the pre-trained base model; calculate the sensitivity of each weight parameter to the model's prediction error, defined as the product of the gradient of that weight and the weight value, using the following formula:
[0055] ;
[0056] in, Represents neuron weights Sensitivity index, Indicating the first term in the pre-trained model One weight parameter, This represents a time index, which iterates through all time points in the historical dataset. This represents the summation of the absolute values of the pressure prediction errors over all time points. Indicates weight The partial derivative of the equation is used to reflect the influence of parameter changes on the error. The function of this formula is: through sensitivity... Filtering key weights ( The larger the value, the more significant the impact of the weight on prediction accuracy; select weights with sensitivity values higher than the preset proportional coefficient to generate a candidate parameter set; perform entropy-constrained non-uniform quantization on the candidate parameter set, the expression of which is:
[0057] ;
[0058] in, This represents the quantized weight values, i.e., the final weight parameters after compression. Represents the weight distribution Shannon entropy ( , (representing the probability distribution of the weights) This represents the entropy threshold (set to 1.2 nits), which is used to determine whether to perform a quantization operation. When the values are below this threshold, it indicates a simple weight distribution, suitable for quantization. This indicates the dynamic quantization step size (which is dynamically calculated based on the distribution characteristics of the weight parameters (e.g., based on the weight range) and is used to control the quantization accuracy). This function represents rounding, rounding the input value to the nearest integer. This is a conditional statement indicating that if the Shannon entropy of the weight is less than a threshold... If the result is positive, then quantization is performed; otherwise, the original weight values are retained. This represents a division operation, dividing the weight value by the quantization step size. This means first dividing by the step size, rounding, and then multiplying back by the step size to discretize the weights. When the Shannon entropy value of the parameter distribution is less than the preset entropy threshold, it is rounded according to the dynamic quantization step size; otherwise, the original parameter value is retained. Finally, a lightweight edge model framework with fewer parameters than the set upper limit is generated.
[0059] B2. Deploy a lightweight edge model framework on the target edge device; use local measured data from the device to verify whether the model error is within the preset allowable range. If the error exceeds the set percentage of the device's range, start the meta-learning algorithm for weight optimization, the expression of which is:
[0060] ;
[0061] in, Indicates device The local validation error is used to quantify the absolute bias of the model's predictions on the device. This indicates the length of the verification time window, i.e., the number of time points involved in error calculation (default). That is, 30 consecutive samples). Indicates device At any moment The predicted stress value is derived from the lightweight edge model. The generated output value, Indicates device At any moment The measured pressure value, that is, the actual pressure data directly collected by the device's sensors. Indicates equipment The maximum pressure value within the historical period, i.e., the dynamically recorded and updated upper limit of the equipment's range, is used to calculate the range. Indicates device The minimum pressure value within the historical period, i.e., the lower limit of the device range that is dynamically recorded and updated, is 0.05, which represents the preset tolerance coefficient to prevent false triggering caused by fluctuations in the device range. This optimization is completed in a single sampling iteration. The model parameter address mapping relationship is reorganized according to the characteristics of the target device's memory storage unit. Finally, a customized edge prediction model for the device is output.
[0062] In this embodiment, the data transmission module specifically needs to be explained. Generating the residual between the predicted and actual values includes:
[0063] First, the actual pressure measurement value of the target edge device at a specific moment is obtained. This actual pressure value is a physical quantity value directly collected by the device's sensors and after signal conditioning. Simultaneously, a lightweight edge prediction model deployed on the edge device is used to calculate the predicted pressure value at the same moment. This predicted value is derived from the model's feature inference results regarding the current pipeline network status. Then, the deviation between the actual pressure value and the predicted pressure value is calculated using the following formula:
[0064] ;
[0065] in, Represents the residual of the target device at a specific time (the signed deviation between the actual and predicted values), used to quantify the accuracy of the model prediction. The sign distinguishes between positive and negative deviations. This represents a unique identifier (such as a device number) for edge devices, used to mark the data source device and support differentiated processing across multiple devices. A timestamp is used to pinpoint the absolute point in time when the data occurred. This represents the actual pressure value, which is the physical quantity collected by the equipment's sensors and conditioned by the signal. This represents the predicted stress value, which is the output of the lightweight edge prediction model. The final output includes a set of residual data containing device identifiers, timestamps, and deviation amounts. All operations are performed locally on the edge device without cloud interaction.
[0066] The specific operation for dynamically setting the quantization threshold based on residual variance is as follows:
[0067] First, historical residual sequences are collected within a sliding time window, with the window length fixed at a preset value. The sequence elements contain residual values at consecutive time points. Next, a dispersion measure of this residual sequence is calculated. This measure is obtained by averaging the squared deviations of each element in the residual set from the mean. The calculation formula is as follows:
[0068] ;
[0069] in, It represents the variance of the residual series (a measure of dispersion). This indicates the length of the sliding window, used to control statistical sensitivity (default range: 20-50 sampling points). This represents the average value of the residual sequence, used to eliminate the inherent zero drift effect of the equipment. Its calculation method is as follows: , Indicates device exist The residuals at time points are used to reflect the single-point prediction bias. , Indicates the current time, used to define the end point of the calculation window ( ), The time index is used to iterate through the count variables of the residual sequence. The function of this formula is to dynamically measure the stability of the model's predictions by the dispersion of the residual data within the sliding window. Subsequently, the dispersion measure is input into a preset nonlinear function relationship model, the expression of which is:
[0070] ;
[0071] in, This represents the threshold scaling factor, used to control the threshold range (value is 0.1-0.5). This represents the variance sensitivity adjustment coefficient, used to adjust the strength of the influence of variance on the threshold (value ranges from 0.8 to 1.5). This represents the base threshold offset, used to ensure the minimum decision threshold (value is 0.02 Bar). This represents the dynamic quantization threshold, used to determine whether data transmission is triggered. Its calculation rule is based on variance. Adaptive adjustment of decision boundary This represents a sigmoid function used to smooth the variance to a threshold range (output range: 0-1). Its calculation rules are as follows: This model reflects the complex mapping relationship between the metric and the optimal decision threshold; the final output is a dynamic quantization threshold, which is adaptively adjusted according to the degree of residual fluctuation and has a lower limit protection mechanism.
[0072] The specific operations for performing differential coded transmission are as follows:
[0073] First, obtain the currently calculated residual data and its corresponding dynamic quantization threshold. Then, determine if the absolute value of the residual is greater than the latest quantization threshold. If it is not greater, generate an empty data packet to maintain the transmission heartbeat. If it is greater, perform differential coding: extract the difference between the current residual and the previous valid transmission residual, expressed as:
[0074] ;
[0075] in, This indicates the content being transmitted at the current moment, used to determine whether to send an empty packet or differentially encoded data. Indicates device At any moment The residual is used to represent the deviation between the measured pressure and the predicted pressure (with a sign). Indicates device At any moment The dynamic threshold is used to determine whether the residual needs to be transmitted. This represents the differential coding operator, used to compress the data to be transmitted. This represents an empty data packet, used to maintain the communication heartbeat, and occupies 1 byte. It is represented using variable-length encoding to compress the difference value, and its expression is:
[0076] ;
[0077] in, This represents the residual from the previous valid transmission, which is the baseline value for calculating the difference. This represents the differential value, which is the actual data content that needs to be compressed and transmitted. The current residual is represented and formed into a binary code stream; finally, it is encapsulated into a data packet and sent to the central server via the User Datagram Protocol (UDP); simultaneously, a periodic verification mechanism is executed, forcibly transmitting the complete residual value at fixed time intervals to eliminate accumulated errors, the expression of which is:
[0078] ;
[0079] in, This indicates a forced transmission flag, i.e., whether to send the complete residual (non-differential). Indicates the current timestamp. This indicates a forced transmission period, used to control the frequency of sending complete data. This represents the modulo operator, i.e., a time-cycle loop judgment.
[0080] In this embodiment, the specific operation of the verification feedback module in receiving differentially encoded data and reconstructing the pressure value is as follows:
[0081] First, the control center parses the type of the received data packet: if it is an empty data packet, the Lie algebra adjoint representation operator is triggered, and the virtual residual value is calculated in conjunction with the device's historical residual status. The calculation formula is as follows:
[0082] ;
[0083] in, This represents a unique identifier for the device, used to distinguish different peripheral devices (such as pumping stations, water meters, etc.) and ensure that the device performs independent calculations. Indicates device The historical residual state matrix, i.e., the historical residual data stored in the Lie group (SO(3) group), preserves the continuity of physical motion. This represents the adjoint operator, used to generate virtual motion trajectories in the group space to compensate for information loss caused by the lack of transmitted data (as an alternative to traditional linear interpolation). This represents a Lie group projection mapping used to project the results of operations in the Lie algebra space (abstract three-dimensional rotation) into one-dimensional real residual values. Indicates device The empty packet reconstruction residual is used to avoid physical distortion caused by traditional interpolation; if it is a differentially coded data packet, an inverse length decoding operation is performed to restore the difference value, and the current residual is calculated by superimposing the residual of the previous valid transmission with the difference value; if it is a complete residual data packet, the original residual value is directly extracted; next, the calculated residual is added to the real-time predicted pressure value of the edge device to generate the reconstruction pressure value, the expression of which is:
[0084] ;
[0085] in, This indicates the reconfiguration pressure value, i.e., the equipment being rebuilt in the control center. exist Real pressure at all times This represents the predicted pressure value, i.e., the edge model's effect on the device. exist Predicted output at time step This represents the reconstructed residual, i.e., the compensation amount generated through Lie group algebra. This represents a unique identifier for the device, used to distinguish different network node devices (such as...). ), Representing a timestamp, in this formula, It is not a simple summation, but rather a projection of the Lie group algebraically ( The process generates a data structure that maps from the group space to the real number domain, avoiding the linear error amplification problem of traditional difference accumulation. Finally, it updates the historical residual state of the device to provide a benchmark for the next cycle. This process avoids the error propagation caused by traditional linear accumulation.
[0086] Confidence testing specifically includes:
[0087] First, construct the transmission state topology graph. ,in This represents a transmission state topology diagram used to quantify the risk of continuous transmission interruption. Represents a set of nodes, each node express Transmission status at any given moment This represents the transmission status identifier, and its data consists of: enumeration values. , Indicates an empty packet. Indicates differentially encoded packets, Indicates the complete residual package. Represents a set of edges used to connect states at adjacent time points. This reflects state transitions, using consecutive untransmitted residual events as isolated nodes and effectively transmitted events as connected edges, forming a dynamic graph structure. The algebraic connectivity index of this graph is calculated to quantify the risk of data transmission interruption. The formula for calculating the algebraic connectivity index is:
[0088] ;
[0089] The failure index mapping expression is:
[0090] ;
[0091] in, The Laplace matrix represents the transmission state diagram and is used to describe the topology of transmission interruption events. Represents a unit vector, used as a search variable in optimization problems. The spectral gap (or algebraic connectivity) is used to measure network vulnerability: the smaller the value, the higher the risk of network outage. And 0 = completely disconnected, 2 = strongly connected. This represents the exponential decay factor, used to adjust the sensitivity to connectivity, and its value ranges from [value missing]. , Indicates device The failure index is used to output normalized risk: 1 = low risk, 0 = high risk. Next, the absolute deviation between the reconstructed pressure value and the actual pressure sensor value is obtained, and converted into dimensionless strain error through the pipe stress-strain constitutive relationship. Its expression is:
[0092] ;
[0093] in, Indicates device The pipe diameter, i.e., the actual pipe section size in the project, affects the stress distribution on the pipe wall. Indicates device The pipe wall thickness, i.e., the safety design parameter: insufficient thickness easily leads to the risk of pipe bursting. This represents Young's modulus, and the larger the value, the smaller the strain under the same stress. It represents dimensionless strain error, used to convert pressure deviation into a material deformation index, reflecting physical reliability. Indicates device The reconstruction pressure value, i.e. the pressure value that the control center recovers based on differentially encoded data. Indicates device The actual pressure value, i.e., the physical pressure value directly measured by the sensor, is then mapped to the Poincaré disk model along with the algebraic connectivity and strain error to calculate the geodesic distance in hyperbolic space. The calculation formula is as follows:
[0094] ;
[0095] in, This represents the hyperbolic distance of the Poincaré disk, i.e., the curvature distance from the origin to the risk point, and its value range is... (The larger the value, the higher the risk), its function is to fuse multidimensional risks in geometric space: 1. Nonlinearly amplify high risks; 2. Differentiate low-risk differences near the origin. This represents the coordinates of the decision point in the complex plane, i.e., the risk composite vector. Its function is to project two-dimensional risk onto the complex plane, and its calculation method is as follows: , The failure index, or transmission interruption risk quantification value, reflects the reliability of communication status, and its value ranges from [value missing]. (The closer to 1, the higher the risk). This represents the physical quantification of strain error, i.e., pressure reconstruction deviation, used to reflect the safety of engineering structures, and its value range is... (The larger the value, the higher the risk). Ultimately, the inverse function of the hyperbolic distance is used as the confidence level, expressed as:
[0096] ;
[0097] in, This represents the hyperbolic sine square, i.e., a super-exponential growth function, and its function is to enhance sensitivity in low-confidence intervals. The value decays drastically over time, and its range is as follows: , Indicates the final confidence level, i.e., the system's credibility index, and its role: core basis for decision-making: 1. 2. This enables a multi-dimensional fusion evaluation of physical constraints and communication status.
[0098] In this embodiment, the sampling optimization module, which uses a dual-modal adjustment coefficient to dynamically calculate the sampling frequency, is specifically described as follows:
[0099] First, the system receives the confidence quantification and residual fluctuation characteristic index output by the verification feedback module. Second, it classifies the confidence quantification into two modes: high reliability and low reliability. When the confidence level is higher than a preset safety threshold, the high reliability mode adjustment coefficient is selected; when the confidence level is lower than the safety threshold, the low reliability mode adjustment coefficient is selected. This coefficient is also related to the mean residual fluctuation amplitude, and its expression is as follows:
[0100] ;
[0101] in, Indicates time The residual, i.e., the deviation between the measured pressure and the predicted value. This represents the length of the sliding window, used to smooth transient noise; its value ranges from 20 to 50. The average fluctuation value is used to characterize the intensity of pressure surges. Then, based on a preset initial sampling frequency, the adjustment coefficient is made proportional to the confidence level under high reliability conditions, and proportional to the product of the confidence level and the residual fluctuation amplitude under low reliability conditions, ultimately generating a dynamic sampling frequency, the expression of which is:
[0102] ;
[0103] in, This represents the confidence quantification value. This represents the mean of the residual fluctuation. Indicates the initial sampling rate base. Represents the modal adjustment coefficient. This represents the confidence safety threshold, which ranges from 0.7 to 0.9. Its value is constrained between the minimum and maximum hardware sampling rates allowed by the device.
[0104] The specific operation of constraining bandwidth usage and reconstruction accuracy using Lyapunov optimization theory is as follows:
[0105] First, we construct a quadratic energy function that includes a bandwidth occupancy bias term and a reconstruction accuracy bias term, the expression of which is:
[0106] ;
[0107] in, This represents the Lyapunov energy function. This indicates the current bandwidth usage, used to reflect the consumption of communication resources. This indicates the maximum bandwidth usage threshold, used to ensure that it does not exceed the network's capacity limit. This represents the current reconstruction error, used to quantify the loss of accuracy in pressure monitoring. Its calculation method is as follows: , This indicates the pressure value for control center reconstruction. This represents the actual pressure value measured by the sensor, for example: if , ,but , This represents the accuracy requirement threshold, i.e., the maximum allowable pressure error. This represents the bandwidth weighting coefficient, used to adjust the priority of bandwidth optimization. The accuracy weighting coefficient is used to adjust the priority of accuracy optimization. The bandwidth deviation term is defined as the squared difference between the current actual bandwidth and the preset bandwidth limit, and the accuracy deviation term is defined as the squared difference between the current reconstruction pressure error and the preset accuracy threshold. These two deviations are multiplied by the preset weighting coefficient and then added to form the energy function. Next, using the dynamic sampling frequency as the optimization variable, the partial derivative of this energy function with respect to frequency is calculated to form the gradient vector. The optimal frequency solution is solved iteratively using the gradient descent method. Each iteration must forcibly satisfy the device hardware sampling rate boundary constraints. Finally, the optimized frequency value is encapsulated as a device control command, and a curvature compensation operator based on a Riemannian manifold is added to the network transport layer. Its expression is:
[0108] ;
[0109] in, Indicates device The final control command frequency, i.e., the actual sampling rate sent to the device. Indicates device The optimized frequency solution, i.e. the theoretically optimal sampling rate under bandwidth-precision constraints. The network path curvature is represented by the packet loss rate function: It is used to quantify the curvature of the transmission path (the more curved, the more unstable), and its value range is... (0 represents an ideal straight path). Indicates the time delay sensitivity factor, used to control the compensation strength: 1. 2. It is more sensitive to latency (compensation is weakened). Indicates the number of transmission hops, i.e., the device The number of routing nodes to the server, and (At least 1 jump) Represents the exponential decay function, used to calculate based on... The dynamic suppression command strength has a range of values. (1 indicates no attenuation) The command strength is dynamically adjusted according to the number of hops in the network path topology to suppress transmission jitter.
[0110] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0111] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0112] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0113] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0114] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0115] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0116] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A smart water management remote monitoring and control system based on the Internet of Things, characterized in that, Specifically, it includes: The module includes an initialization module, a data transmission module, a verification feedback module, and a sampling optimization module. Initialization module: Configured to pre-train a long short-term memory network model in the cloud using historical water pressure data, and generate a lightweight edge prediction model through knowledge distillation; Data transmission module: configured to use the lightweight edge prediction model at the edge to calculate the pressure prediction value, generate the residual between the prediction value and the actual value, dynamically set the quantization threshold based on the residual variance, and perform differential encoding transmission when the absolute value of the residual exceeds the quantization threshold; Verification feedback module: configured to receive differentially encoded data and reconstruct pressure values at the control center, perform confidence level detection based on the number of consecutive untransmitted residuals and reconstruction error, and generate a model recalibration command when the confidence level is lower than a set threshold; Sampling optimization module: It is configured to dynamically calculate the sampling frequency using a dual-mode adjustment coefficient based on the confidence level detection results and residual fluctuation characteristics, and to constrain bandwidth occupancy and reconstruction accuracy using Lyapunov optimization theory.
2. The IoT-based intelligent water remote monitoring and control system according to claim 1, characterized in that: The specific operations of pre-training the long short-term memory network model in the initialization module are as follows: A1. Receives a historical water pressure dataset containing timestamps and original pressure values as input. Using non-steady-state signal processing techniques, the original pressure signal is separated into a core fluctuation term and an attenuation interference term. The core fluctuation term is composed of an adaptive basis function weighted by the characteristics of the pipe network resonant frequency and the pump periodicity, with the weights being time-varying amplitude coefficients related to water usage intensity. The attenuation interference term is suppressed by dynamic threshold filtering. This dynamic threshold is calculated proportionally based on the maximum value of the pressure change curvature. When the second derivative of the pressure value exceeds this dynamic threshold, median filtering is performed, ultimately outputting a pure core pressure fluctuation sequence that retains key physical characteristics. A2. Abstract the pipeline network topology into a hydraulic impedance-weighted graph model, inputting the core pressure fluctuation sequence and associated weather types, season identifiers, and pipe diameter characteristics; When training the Long Short-Term Memory (LSTM) network model in the cloud, a pre-defined loss function constraint is added. This pre-defined loss function includes a weighted sum of the data fitting component and the physical conservation constraint component. The data fitting component is the sum of squared differences between the predicted value and the core pressure fluctuation value. The physical conservation constraint component requires that the prediction results satisfy the fluid mass conservation equation at each node of the pipeline network. A generative adversarial network is used to verify whether the prediction results satisfy the physical laws of fluid continuity. Finally, a pre-trained basic model with physical rationality is output.
3. The IoT-based intelligent water remote monitoring and control system according to claim 2, characterized in that: The specific steps for generating the lightweight edge prediction model are as follows: B1. Obtain all neuron weight parameters of the pre-trained base model; calculate the sensitivity of each weight parameter to the model's prediction error, defined as the product of the gradient of the weight and the weight value; filter weights with sensitivity values higher than a preset proportional coefficient to generate a candidate parameter set; A non-uniform quantization operation with entropy constraints is performed on the candidate parameter set. When the Shannon entropy value of the parameter distribution is less than the preset entropy threshold, rounding is performed according to the dynamic quantization step size; otherwise, the original parameter value is retained. Finally, a lightweight edge model framework with fewer parameters than the set upper limit is generated. B2. Deploy a lightweight edge model framework on the target edge device; use local measured data from the device to verify whether the model error is within the preset allowable range. If the error exceeds the set percentage of the device's range, start the meta-learning algorithm to optimize the weights. This optimization is completed in a single sampling iteration. Reorganize the model parameter address mapping relationship according to the characteristics of the target device's memory storage unit; finally output a device-customized edge prediction model.
4. The IoT-based intelligent water remote monitoring and control system according to claim 3, characterized in that: In the data transmission module, generating the residual between the predicted value and the actual value specifically includes: First, the actual pressure measurement value of the target edge device at a specific moment is obtained. At the same time, the pressure prediction value at the same moment is calculated using a lightweight edge prediction model already deployed on the edge device. Then, the deviation between the actual pressure value and the predicted pressure value is calculated. Finally, a set of residual data containing device identifier, timestamp and deviation is output.
5. The IoT-based intelligent water remote monitoring and control system according to claim 4, characterized in that: The specific operation for dynamically setting the quantization threshold based on residual variance is as follows: First, a historical residual sequence is collected within a sliding time window, with the window length fixed at a preset value. The sequence elements contain residual values at consecutive time points. Next, a dispersion measure of the residual sequence is calculated. This measure is obtained by averaging the squared deviations of each element in the residual set from the mean. Subsequently, the deviation trend metric is input into a preset nonlinear function relationship model, which reflects the complex mapping relationship between the metric value and the optimal decision threshold; finally, a dynamic quantification threshold is output, which is adaptively adjusted according to the degree of residual fluctuation and has a lower limit protection mechanism.
6. The IoT-based intelligent water remote monitoring and control system according to claim 5, characterized in that: The specific operations for performing differential coded transmission are as follows: First, obtain the residual data generated by the current calculation and the corresponding dynamic quantization threshold; then, determine whether the absolute value of the residual is greater than the latest quantization threshold. If it is not greater, generate an empty data packet to maintain the transmission heartbeat. If the value exceeds the limit, differential encoding is performed: the difference between the current residual and the previous valid transmission residual is extracted, and the difference is compressed using variable-length encoding rules to form a binary code stream; finally, the data packet is encapsulated and sent to the central server via the User Datagram Protocol; at the same time, a periodic verification mechanism is executed to force the transmission of the complete residual value at fixed time intervals.
7. The IoT-based intelligent water remote monitoring and control system according to claim 6, characterized in that: In the verification feedback module, the specific operations for receiving differentially encoded data and reconstructing the pressure value are as follows: First, the control center parses the type of the received data packet: if it is an empty data packet, the Lie algebra adjoint representation operator is triggered, and the virtual residual value is calculated in combination with the device's historical residual status; If it is a differentially encoded data packet, perform an inverse length decoding operation to restore the difference value, and calculate the current residual based on the residual of the previous valid transmission and the difference value. If it is a complete residual data packet, the original residual value is directly extracted; secondly, the calculated residual is added to the real-time predicted pressure value of the edge device to generate the reconstruction pressure value; finally, the historical residual status of the device is updated to provide a benchmark for the next cycle.
8. The IoT-based intelligent water remote monitoring and control system according to claim 7, characterized in that: The confidence detection specifically includes: First, a transmission state topology graph is constructed, with continuous untransmitted residual events as isolated nodes and effective transmitted events as connected edges, forming a dynamic graph structure. The algebraic connectivity index of this graph is calculated to quantify the risk of data transmission interruption. Second, the absolute deviation between the reconstructed pressure value and the actual pressure sensor value is obtained and converted into a dimensionless strain error through the stress-strain constitutive relationship of the pipe material. Subsequently, the algebraic connectivity and strain error are mapped to the Poincaré disk model to calculate the hyperbolic geodesic distance. Finally, the reciprocal function value of the hyperbolic distance is used as the confidence level to achieve a multi-dimensional fusion evaluation of physical constraints and communication status.
9. The IoT-based intelligent water remote monitoring and control system according to claim 8, characterized in that: In the sampling optimization module, the specific operation of dynamically calculating the sampling frequency using the dual-modal adjustment coefficient is as follows: First, the confidence quantification value and residual fluctuation characteristic index output by the verification feedback module are received. Second, the confidence quantification value is divided into two modes: high reliability state and low reliability state. When the confidence level is higher than the preset safety threshold, the high reliability mode adjustment coefficient is selected. When the confidence level is lower than the safety threshold, a low-reliability mode adjustment coefficient is selected, which is also associated with the mean residual fluctuation amplitude. Subsequently, based on the preset initial sampling frequency, the adjustment coefficient is made proportional to the confidence level in the high-reliability state, and proportional to the product of the confidence level and the residual fluctuation amplitude in the low-reliability state, thus generating a dynamic sampling frequency whose value is constrained between the minimum and maximum hardware sampling rates allowed by the device.
10. The IoT-based intelligent water remote monitoring and control system according to claim 9, characterized in that: The specific operation of constraining bandwidth usage and reconstruction accuracy using Lyapunov optimization theory is as follows: First, a quadratic energy function is constructed, comprising a bandwidth occupancy deviation term and a reconstruction accuracy deviation term. The bandwidth deviation term is defined as the square of the difference between the current actual bandwidth occupancy and the preset bandwidth upper limit, and the accuracy deviation term is defined as the square of the difference between the current reconstruction pressure error and the preset accuracy threshold. The two deviations are multiplied by preset weighting coefficients and then added together to form the energy function. Second, using the dynamic sampling frequency as the optimization variable, the partial derivative of the energy function with respect to frequency is calculated to form a gradient vector. The optimal frequency solution is solved iteratively using the gradient descent method. Each iteration must forcibly satisfy the device hardware sampling rate boundary constraints. Finally, the optimized frequency value is encapsulated as a device control command. A curvature compensation operator based on the Riemannian manifold is added to the network transport layer, and the command strength is dynamically adjusted according to the number of hops in the network path topology to suppress transmission jitter.
Citation Information
Patent Citations
Control method for water supply balance of urban water supply system
CN109537671A
Farmland full-automatic multi-path intelligent irrigation equipment and improved LSTM irrigation method
CN116187171A
Pressure sensor metering data calibration method and system
CN119958763A
Intelligent monitoring method and system for water disaster of top plate of steeply inclined working face
CN120403756A
Power plant load intelligent adjustment method and system
CN120582128A
Cited By
Real-time communication decision-making method of portable field hydrology and water quality monitoring equipment
CN121239356A
Water consumption terminal abnormal state monitoring and dynamic service authorization method and system
CN121682650A
A method and system for monitoring and dynamically authorizing services with water end-of-line abnormal conditions
CN121682650B