An internet of things interconnected wall-mounted water dispenser water quality monitoring and purification system and method and a storage medium thereof
By using data correction and adaptive transmission modules, combined with digital twin models and reinforcement learning, the problem of real-time data transmission and accuracy in water quality monitoring systems for water dispensers under complex environments has been solved, achieving efficient and reliable water quality monitoring and purification control.
Patent Information
- Application Number
- CN202610448843.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-07
- Publication Date
- 2026-07-03
Smart Images

Figure CN122340547A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water quality monitoring for water dispensers, and more specifically, to an Internet of Things (IoT) interconnected wall-mounted water dispenser water quality monitoring and purification system, method, and storage medium thereof. Background Technology
[0002] Commercial wall-mounted water dispensers or direct drinking water systems are widely used in densely populated public places such as campuses, large shopping malls, and airports to meet the large-scale, high-frequency instant drinking water demand. These scenarios are complex and dynamic: internally, they involve a large number of parallel water terminals with multiple built-in water quality sensors working continuously; externally, they face challenges such as the shielding and attenuation of wireless signals by building structures, electromagnetic interference from devices on the same frequency band caused by dense crowds, and network channel congestion pressure caused by periodic and explosive water usage peaks. These factors together constitute a hybrid physical information environment with extremely high requirements for the stability, real-time performance, and reliability of device data communication. In this environment, water dispensers not only need to provide instant purified water but are also required to have the ability to continuously and accurately monitor water quality safety to prevent public health risks caused by fluctuations in water sources or equipment performance degradation. Therefore, ensuring that water quality monitoring data can be accurately perceived, reliably transmitted, and responded to in a timely manner under complex on-site conditions has become the core challenge for improving the intelligence level and safety level of such products.
[0003] Currently, water quality monitoring solutions based on Internet of Things (IoT) technology, especially narrowband IoT technology, have become a research and application focus. Narrowband IoT technology, due to its low power consumption and wide coverage, is considered suitable for networking distributed water dispensers. However, this technology also has inherent limitations, with a transmission rate typically only tens of kbps. In practical deployments, this limitation can easily lead to data upload delays or even packet loss in areas with weak signals or network congestion, making it difficult to meet the stringent real-time requirements when water quality may change rapidly during peak water usage periods. Furthermore, the readings of sensors used to monitor key indicators such as pH, turbidity, and total dissolved solids are susceptible to changes in ambient temperature and humidity, as well as long-term operational drift. Interference from factors such as [unspecified factors] directly affects the accuracy of the data source. Existing technical solutions mostly adopt a simple strategy of timed reporting combined with fixed threshold alarms. This strategy cannot achieve high-frequency, reliable real-time data transmission under the bandwidth constraints of narrowband IoT, and it also lacks an online dynamic calibration and compensation mechanism for sensor data. As a result, when the system faces complex environmental disturbances, the timeliness and accuracy of the overall monitoring results are difficult to guarantee, which may delay water quality anomaly alarms and precise control of the purification system, posing safety hazards. Therefore, there is an urgent need for a new monitoring system and method that can effectively coordinate edge computing and narrowband IoT communication to simultaneously ensure real-time data transmission and measurement accuracy under resource-constrained conditions. Summary of the Invention
[0004] This invention addresses the technical problems existing in the prior art by providing an Internet of Things (IoT) interconnected wall-mounted water dispenser water quality monitoring and purification system, method, and storage medium. Through a data correction module, a data selection module, a strategy optimization module, and an adaptive transmission module, it solves 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: an Internet of Things interconnected wall-mounted water dispenser water quality monitoring and purification system, specifically including: a data correction module, a data selection module, a strategy optimization module and an adaptive transmission module, wherein; Data correction module: In response to periodic monitoring by the water quality sensor or an abnormal event trigger signal from the data selection module, it receives the raw water quality reading vector of the current moment output by the water quality sensor, obtains the water quality parameter prediction vector output by the digital twin model, wherein the water quality parameter prediction vector is generated based on the historical water quality reading vector of the previous moment adjacent to the current moment, the equipment operating status parameter vector, and the environmental parameter vector. It performs data fusion processing on the raw water quality reading vector and the water quality parameter prediction vector of the current moment, and generates and outputs the posterior state estimation vector as the correction result based on the extended Kalman filter algorithm. Data selection module: Connected to the data correction module, it receives the posterior state estimation vector and uses a lightweight long short-term memory autoencoder model to reconstruct and analyze the sequence of posterior state estimation vectors within a predetermined time period. Based on the calculated reconstruction error value and sequence volatility value, it calculates a water quality anomaly score and marks the posterior state estimation vectors as different event types according to the water quality anomaly score. When the marked event type is a preset anomaly event, it generates and sends an anomaly event trigger signal to the data correction module. At the same time, it performs intelligent selection and outputs selected data containing the selected event type label and the extracted key feature vectors. Strategy optimization module: Connects to the data selection module, receives the selected data, and operates based on the reinforcement learning agent. The reinforcement learning agent aims to optimize the overall efficiency of information transmission value and resource consumption. Based on the current network status, device energy status and event type label, it selects a transmission strategy from the preset action space. Adaptive transmission module: Connects to the strategy optimization module, receives the selected transmission strategy, constructs a transmission data packet with a dynamic payload structure according to the selected transmission strategy, and dynamically configures the physical layer transmission parameters of the narrowband IoT based on the payload size of the transmission data packet and the data urgency indicated by the selected transmission strategy to complete the data upload; In a preferred embodiment, the specific process of obtaining the predicted water quality parameter vector output by the digital twin model in the data correction module is as follows: After the data correction module is activated by a periodic monitoring signal or an abnormal event trigger signal, it acquires the original water quality reading vector of the current moment output by the water quality sensor, and obtains the historical water quality reading vector of the previous moment adjacent to the current moment, the equipment operating status parameter vector representing the operating condition of the equipment at the previous moment, and the environmental parameter vector representing the external environmental conditions at the current moment. Among them, the equipment operating status parameter vector includes the remaining lifespan percentage of the filter element and the pump operating cycle information, and the environmental parameter vector includes the ambient temperature value and the temperature difference between the equipment inlet and outlet. The historical water quality reading vector of the previous moment, the equipment operating status parameter vector, and the environmental parameter vector are input together into a pre-trained digital twin model. The digital twin model contains a set of model parameters consisting of fixed parameters and adjustable parameters. It uses a nonlinear mapping function to perform comprehensive calculations on the input vectors of historical water quality readings from the previous moment, equipment operating status parameters, and environmental parameters. The nonlinear mapping function uses the historical water quality reading vector from the previous moment as the main input reflecting the time-series evolution of water quality parameters, the equipment operating status parameter vector as the auxiliary input reflecting the impact of the equipment's own operating status on water quality, and the environmental parameter vector as the auxiliary input reflecting the impact of external environmental conditions on water quality, generating and outputting a predicted vector of water quality parameters.
[0006] In a preferred embodiment, the process of generating and outputting the posterior state estimation vector as the correction result based on the extended Kalman filter algorithm specifically includes: F1. Initialization and Prediction: Receive the predicted water quality parameter vector from the digital twin model and the original water quality reading vector at the current moment from the water quality sensor, and initialize the state vector and error covariance matrix required for the extended Kalman filter process. The state vector contains the true value components of the water quality parameters to be estimated and the sensor drift error components. Next, perform the prediction step calculation: Using a preset nonlinear state transition function, operate on the posterior state estimation vector obtained in the previous filtering cycle to obtain the prior state estimation vector for predicting the current state. Simultaneously, using the Jacobian matrix corresponding to the state transition function, the posterior error covariance matrix of the previous filtering cycle, and the preset process noise covariance matrix, calculate the prior error covariance matrix corresponding to the current moment according to the rule that the prior error covariance matrix is equal to the product of the Jacobian matrix and the posterior error covariance matrix of the previous filtering cycle, multiplied by the transpose of the Jacobian matrix, and then added to the process noise covariance matrix. F2. Adaptive Measurement Noise Adjustment and Gain Calculation: In the update step, the measurement noise covariance matrix at the current moment is first dynamically calculated. The calculation process is as follows: based on a preset baseline measurement noise covariance matrix, an adaptive adjustment coefficient, the squared Euclidean distance between the current original water quality reading vector and a theoretical observation vector, and an identity matrix are added. The theoretical observation vector is obtained by multiplying the preset observation matrix with the predicted water quality parameter vector. Subsequently, based on the prior error covariance matrix, the preset observation matrix and its transpose, and the calculated measurement noise covariance matrix at the current moment, the Kalman gain matrix is determined using the Kalman gain calculation formula. The specific calculation process is as follows: multiply the prior error covariance matrix with the transpose of the observation matrix to obtain an intermediate matrix A; calculate the inverse matrix of the matrix obtained by multiplying the observation matrix, the prior error covariance matrix, and the transpose of the observation matrix, and then adding it to the measurement noise covariance matrix at the current moment, denoted as intermediate matrix B; finally, multiply intermediate matrix A and intermediate matrix B to obtain the Kalman gain matrix. F3. State Update and Output: Calculate a new information vector, which equals the original water quality reading vector at the current time minus the predicted observation vector obtained by applying the observation function to the prior state estimation vector. Then, correct the prior state estimation vector using the Kalman gain matrix. The corrected posterior state estimation vector equals the prior state estimation vector plus the product of the Kalman gain matrix and the new information vector. Simultaneously, update the error covariance matrix to obtain the posterior error covariance matrix, whose value equals the identity matrix minus the product of the Kalman gain matrix and the observation matrix, and then multiplied by the prior error covariance matrix. The corrected posterior state estimation vector is the correction result. F4. Closed-Loop Fine-Tuning of Model Parameters: Based on the innovation vector sequence generated after filtering update, the adjustable parameter subset in the model parameter set of the digital twin model is fine-tuned online. The innovation vector sequence is composed of the innovation vectors calculated in step F3 for each filtering cycle in chronological order. The specific fine-tuning process is as follows: The innovation vector sequence is analyzed in real time. If the statistical mean of the innovation vector sequence or the square of its L2 norm continuously exceeds a preset threshold in multiple consecutive filtering cycles, it is determined that the digital twin model has prediction drift or the operating conditions have continuously changed, and the parameter fine-tuning process is triggered. In this fine-tuning process, firstly, based on the current innovation vector sequence, a model parameter adjustment amount is calculated with the goal of minimizing the norm of subsequent innovation vectors. Then, a preset normalized learning rate is multiplied by the model parameter adjustment amount to obtain the parameter fine-tuning amount. Finally, the parameter fine-tuning amount is applied to the adjustable parameter subset of the digital twin model to update the digital twin model.
[0007] In a preferred embodiment, the data selection module utilizes a lightweight long short-term memory autoencoder model to reconstruct and analyze the posterior state estimation vector sequence within a predetermined time period. The specific process for calculating the water quality anomaly score based on the calculated reconstruction error value and sequence volatility value is as follows: First, using a predefined fixed-length T as the time window, the system traces backward from the current time step, extracting the posterior state estimation vectors for T consecutive time steps and arranging them chronologically to construct the input sequence for the current time step. This input sequence is then fed into a pre-trained lightweight long short-term memory autoencoder network, which consists of an encoder network and a decoder network connected sequentially. The encoder network, composed of a long short-term memory recurrent neural network layer, encodes the input sequence into a fixed-dimensional context feature vector. The decoder network, also composed of a long short-term memory recurrent neural network layer, uses the context feature vector as its initial state to reconstruct a reconstructed output sequence that is completely identical to the input sequence in terms of time length and vector dimension. Then, for each posterior state estimation vector in the input sequence, the square of the Euclidean distance between it and the corresponding reconstructed output vector in the reconstructed output sequence is calculated, and the result is defined as the reconstruction error vector at that time step. The Euclidean norms of the reconstruction error vectors at all T time steps are summed, and then divided by the time window length T. The quotient is defined as the reconstruction error value for the current window. Next, the volatility value of the sequence is calculated based on T reconstruction error vectors. The specific process is as follows: Q1. Calculate the Euclidean norm of the reconstruction error vector at each time step within the current window; Q2. Divide the Euclidean norm calculated at each time step by the sum of the Euclidean norms at all times within the current window, thereby assigning a normalized weight coefficient to each time step. Q3. Calculate the sequence volatility value as the negative value of the weighted energy entropy of the normalized weight coefficients of the set; wherein, the calculation process of the weighted energy entropy is as follows: take the normalized weight coefficients of each time as the probability mass of that time, calculate the information entropy of these probability masses, and in the logarithmic operation of the information entropy, the proper number of the logarithm is formed by adding the normalized weight coefficients of that time to a preset normal coefficient. Finally, based on the reconstruction error value and the sequence volatility value, the water quality anomaly score is calculated using a preset synthesis rule. The synthesis rule is as follows: the reconstruction error value is used as the numerator, and the sum of the number 1 and the exponential function with the natural constant as the base is used as the denominator. The exponent of the exponential function is negative, and the product of a preset positive adjustment factor and the difference between the sequence volatility value and a preset real offset parameter is used. The result calculated using this rule is defined as the water quality anomaly score.
[0008] In a preferred embodiment, the specific operation of the output including the selected event type label and the extracted key feature vector after selection is as follows: First, the calculated water quality anomaly score is compared with a preset first threshold and a second threshold, where the first threshold is less than the second threshold. Based on the comparison result, the posterior state estimation vector at the current moment is labeled as one of the following three event types: When the water quality anomaly score is less than the first threshold, it is marked as a normal steady-state event; When the water quality anomaly score is greater than or equal to the first threshold and less than the second threshold, it is marked as a potential drift event; When the water quality anomaly score is greater than or equal to the second threshold, it is marked as an anomaly event; If the marked event type is an abnormal event, an abnormal event trigger signal is generated and sent to the data correction module; For the posterior state estimation vector labeled as a potential drift event or anomaly event, extract the context feature vector as the key feature vector from the context feature vector output by the encoder network of the lightweight long short-term memory autoencoder network. The output includes data containing the current event type label and the key feature vectors corresponding to the event type as a potential drift event or an anomaly event, which are used as the selected data.
[0009] In a preferred embodiment, the strategy optimization module operates based on a reinforcement learning agent. This agent aims to optimize the overall efficiency of information transmission value and resource consumption. The specific process of selecting a transmission strategy from a preset action space based on the current network state, device energy state, and event type labeling is as follows: First, selected data is received from the data selection module. Simultaneously, the device energy status, representing the remaining available energy of the current device, and the current network status, representing the quality of the current narrowband IoT communication link, are collected. Based on the event type label and the key feature vector, a data value feature is generated through a feature encoding process. Next, a state-aware vector is constructed, consisting of three sequentially connected components: the first component is the device energy status, which is the remaining battery percentage; the second component is the current network status, which is a sub-vector containing at least one parameter, such as estimated network latency and current received signal strength; and the third component is the data value feature. Next, the preset action space is defined, which consists of multiple candidate transmission strategies, where each candidate transmission strategy is a composite instruction containing a transmission decision dimension and a transmission strength dimension. The state-aware vector is input into a value evaluation network contained in the reinforcement learning agent. The value evaluation network is a deep neural network that outputs an evaluation value, called the long-term comprehensive performance evaluation value, for each candidate transmission strategy in the preset action space. The calculation of the long-term comprehensive performance evaluation value is based on a preset reward function, which is set to a three-term weighted sum: the first term is the product of a positive weight coefficient and the information transmission value gain; the second term is the product of a negative weight coefficient and the energy resource consumption cost; and the third term is the product of a negative weight coefficient and the communication bandwidth resource consumption cost. Then, progressive decision-making and confidence threshold judgment are performed: the long-term comprehensive performance evaluation values corresponding to all candidate transmission strategies are compared, the maximum and second-largest values are found, and the difference between the two is calculated; this difference is then compared with a preset confidence judgment threshold. If the difference is greater than the confidence threshold, the candidate transmission strategy with the largest long-term comprehensive performance evaluation value is directly selected as the final transmission strategy. If the difference is not greater than the confidence threshold, the decision is postponed and a waiting observation loop is triggered. In this loop, the updated current network status, especially the quality of the narrowband IoT communication link, is collected again, and the second component in the status perception vector is updated accordingly. The value assessment and comparison process is performed again until the difference is greater than the confidence threshold or the cumulative postponement reaches the preset limit. Then, the candidate transmission strategy with the largest long-term comprehensive performance evaluation value is selected as the final transmission strategy. Finally, the execution strategy distribution and closed-loop learning are as follows: P1. Output the final transmission strategy to the adaptive transmission module, and the adaptive transmission module performs the corresponding data transmission operation according to the final transmission strategy. P2. After the final transmission strategy is executed, calculate the actual immediate performance reward obtained from this decision based on the reward function; P3. The state perception vector, the selected final transmission strategy, the real-time performance reward, and the new state composed of the updated device energy state and the updated current network state collected after the decision is executed are stored together as a decision experience in an experience replay buffer; and multiple decision experiences are periodically sampled from the experience replay buffer to update the internal parameters of the value assessment network.
[0010] In a preferred embodiment, the specific process of constructing a transmission data packet with a dynamic payload structure according to the selected transmission strategy in the adaptive transmission module is as follows: The system receives the final transmission strategy from the strategy optimization module, which includes a transmission decision dimension and a transmission strength dimension. First, based on these dimensions, a data urgency identifier is generated. Simultaneously, from the selected data output by the data selection module, application data units containing event type markers and key feature vectors to be transmitted, as well as an estimated available channel bandwidth measured and estimated in real-time from the narrowband IoT communication unit interface, are obtained. Next, based on the data urgency identifier and the estimated available channel bandwidth, an adaptive fragmentation threshold is dynamically calculated. This threshold is calculated as follows: the estimated available channel bandwidth multiplied by a preset target maximum transmission delay, then multiplied by a positive load factor. Finally, a payload construction decision is executed. If the data urgency indicator is determined to be urgent, or the total size of the application data unit exceeds the adaptive fragmentation threshold, then the fragmentation transmission mode is enabled, and the application data unit is divided into multiple sub-data packets; at this time, the packet used for transmission is a sequence of sub-data packets composed of the multiple sub-data packets in sequence. If the data urgency level identifier is determined to be non-urgent and the total size of the application data units does not exceed the adaptive fragmentation threshold, then the aggregation transmission mode is enabled, and the application data unit to be sent is merged with other application data units in the cache queue that have the same or similar non-urgent identifiers to form an aggregated data packet; at this time, the packet used for transmission is the aggregated data packet. Finally, the completed sequence of sub-data packets or the aggregated data packets used for transmission are collectively referred to as the transmission data packets, and the payload size of the transmission data packets and the internal priority label obtained by converting the data urgency identifier according to preset rules are output.
[0011] In a preferred embodiment, the specific process of dynamically configuring the physical layer transmission parameters of the narrowband Internet of Things based on the payload size of the transmitted data packets and the data urgency indicated by the selected transmission strategy is as follows: R1, Input and Acquisition: Receive the constructed transmission data packet and its payload size and internal priority tag, and simultaneously acquire the current transmission environment status of the narrowband IoT physical layer. The transmission environment status includes physical layer measurement parameters characterizing the quality of the current narrowband IoT communication link. R2, Cross-layer parameter collaborative optimization configuration: Based on the payload size, internal priority label, and transmission environment status, the following configuration is performed: R2.1 Joint Optimization of Transmit Power: The final transmit power is composed of three parts: the base transmit power, the priority power increment, and the load adaptive compensation. The priority power increment is calculated by multiplying a preset power adjustment coefficient by the hyperbolic tangent function value of the internal priority label. The load adaptive compensation is calculated by multiplying a preset logarithmic compensation coefficient by the logarithmic value of the quotient of the load size and a preset reference load, which is based on a base of two. R2.2 Joint Selection of Modulation and Coding Strategies: Calculate the effective spectral efficiency index corresponding to each candidate modulation and coding strategy combination. This index is equal to the logarithm of the candidate modulation order (base 2) multiplied by 1 minus the estimated block error rate of the candidate coding strategy corresponding to the combination. Among all candidate combinations that meet the target packet error rate requirement, select the combination that minimizes the transmission time estimate as the final modulation and coding strategy. The transmission time estimate is equal to the payload size divided by the effective spectral efficiency index plus a fixed signaling overhead time. R2.3 Dynamic configuration of retransmission strategy: Dynamically set the maximum number of mixed automatic retransmission requests based on the data urgency identifier obtained by mapping the final transmission strategy; R3, Perform transmission, collect feedback, and perform closed-loop updates: R3.1 Transmission Execution: The final transmit power, the final modulation and coding strategy, and the maximum number of hybrid automatic repeat requests are sent to the narrowband IoT communication unit, driving the communication module to send the transmission data packet with the parameters. R3.2 Enhanced Feedback Generation: After transmission is completed, the actual transmission results are collected, including whether the transmission was successful, the actual transmission delay, and the estimated actual energy consumption. Based on the actual transmission results, the multi-dimensional transmission performance feedback vector is calculated: the reliability feedback component of this vector is one when the transmission is successful and zero when it fails; the timeliness feedback component of this vector is equal to the value of an exponential function with a base of the natural constant, where the exponent of the exponential function is negative, which is the quotient of the actual transmission delay and the preset target maximum transmission delay; the energy efficiency feedback component of this vector is equal to the load size divided by the estimated actual energy consumption. R3.3 Closed-loop update: The multidimensional transmission performance feedback vector, the final transmission strategy that triggered this transmission, and the current network state obtained in step R1 before transmission are combined to form a transmission experience tuple; this transmission experience tuple is uploaded to the cloud or returned to the strategy optimization module to update the value evaluation model of the reinforcement learning agent; at the same time, based on the channel measurement information in the actual transmission results, the available channel bandwidth estimate model used to calculate the adaptive fragmentation threshold is locally updated.
[0012] This application also provides a method for water quality monitoring and purification of an IoT-connected wall-mounted water dispenser, which specifically includes the following steps: Step S1: In response to periodic monitoring or abnormal event triggering, obtain the original water quality reading vector and the predicted water quality parameter vector at the current moment; use the extended Kalman filter algorithm to perform data fusion processing on the two and output the posterior state estimation vector; Step S2: Based on the posterior state estimation vector, perform time-series reconstruction analysis using a lightweight long short-term memory autoencoder model to calculate the water quality anomaly score; label the data as event types according to the score, and feed back a trigger signal when it is labeled as an anomalous event; for each event type, extract the context feature vector as the key feature vector, and output the selected data containing the event type label and the key feature vector. Step S3: Based on the selected data, optimize the transmission strategy using a reinforcement learning agent; encode the event type label and key feature vector into data value features, and construct a state awareness vector by combining the device energy status and the current network status; evaluate candidate transmission strategies through a value evaluation network, and determine the final transmission strategy by progressive decision based on the evaluation results and a preset confidence threshold. Step S4: Based on the final transmission strategy, dynamically construct transmission data packets and determine their payload size; based on the payload size and data urgency indicator, jointly optimize the physical layer transmission parameters of narrowband IoT and send data; collect actual transmission results, calculate multi-dimensional transmission performance feedback vector, and use it to update the value assessment model and channel estimation model.
[0013] This application also provides a storage medium storing a computer program that can be loaded by a processor and execute the methods described above.
[0014] The beneficial effects of this invention are as follows: by using digital twins and adaptive filtering to collaboratively correct sensor data, high-precision monitoring of water quality parameters is achieved; by utilizing time-series reconstruction and intelligent scoring mechanisms, abnormal events can be accurately identified and key features extracted; through reinforcement learning-driven resource perception strategy optimization, the timing and content priority of data transmission can be intelligently decided under limited network and energy constraints; and finally, by leveraging cross-layer parameter dynamic adaptation and load optimization, key information is ensured to be transmitted reliably and efficiently in narrowband IoT, thereby achieving the overall comprehensive benefits of accurate perception, timely early warning, and energy-saving communication. Attached Figure Description
[0015] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a block diagram of the system structure of the present invention. Detailed Implementation
[0016] 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.
[0017] 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.
[0018] 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. Example
[0019] This embodiment provides, for example Figure 1 The method for water quality monitoring and purification in an IoT-connected wall-mounted water dispenser includes the following steps: Step S1: In response to periodic monitoring or abnormal event triggering, obtain the original water quality reading vector and the predicted water quality parameter vector at the current moment; use the extended Kalman filter algorithm to perform data fusion processing on the two and output the posterior state estimation vector; Step S2: Based on the posterior state estimation vector, perform time series reconstruction analysis using a lightweight long short-term memory autoencoder model to calculate the water quality anomaly score; label the data as event types according to the score, and feed back a trigger signal when it is labeled as an anomalous event; for each event type, extract the context feature vector as the key feature vector, and output the selected data containing the event type label and the key feature vector; Step S3: Based on the selected data, optimize the transmission strategy using a reinforcement learning agent; encode the event type label and key feature vector into data value features, and construct a state awareness vector by combining the device energy status and the current network status; evaluate candidate transmission strategies through a value evaluation network, and determine the final transmission strategy by progressive decision based on the evaluation results and a preset confidence threshold. Step S4: Based on the final transmission strategy, dynamically construct the transmission data packet and determine its payload size; based on the payload size and data urgency indicator, jointly optimize the physical layer transmission parameters of the narrowband IoT and send the data; collect the actual transmission results, calculate the multi-dimensional transmission performance feedback vector, and use it to update the value assessment model and channel estimation model. Example
[0020] This embodiment provides, for example Figure 2 The illustrated IoT-connected wall-mounted water dispenser water quality monitoring and purification system specifically includes: a data correction module, a data selection module, a strategy optimization module, and an adaptive transmission module, wherein; Data correction module: In response to periodic monitoring by the water quality sensor or an abnormal event trigger signal from the data selection module, it receives the raw water quality reading vector of the current moment output by the water quality sensor, obtains the water quality parameter prediction vector output by the digital twin model, wherein the water quality parameter prediction vector is generated based on the historical water quality reading vector of the previous moment adjacent to the current moment, the equipment operating status parameter vector, and the environmental parameter vector. It performs data fusion processing on the raw water quality reading vector and the water quality parameter prediction vector of the current moment, and generates and outputs the posterior state estimation vector as the correction result based on the extended Kalman filter algorithm. Data selection module: Connected to the data correction module, it receives the posterior state estimation vector and uses a lightweight long short-term memory autoencoder model to reconstruct and analyze the sequence of posterior state estimation vectors within a predetermined time period. Based on the calculated reconstruction error value and sequence volatility value, it calculates a water quality anomaly score and marks the posterior state estimation vectors as different event types according to the water quality anomaly score. When the marked event type is a preset anomaly event, it generates and sends an anomaly event trigger signal to the data correction module. At the same time, it performs intelligent selection and outputs selected data containing the selected event type label and the extracted key feature vectors. Strategy optimization module: Connects to the data selection module, receives the selected data, and operates based on the reinforcement learning agent. The reinforcement learning agent aims to optimize the overall efficiency of information transmission value and resource consumption. Based on the current network status, device energy status and event type label, it selects a transmission strategy from the preset action space. Adaptive transmission module: Connected to the strategy optimization module, it receives the selected transmission strategy, constructs a transmission data packet with a dynamic payload structure according to the selected transmission strategy, and dynamically configures the physical layer transmission parameters of the narrowband IoT based on the payload size of the transmission data packet and the data urgency indicated by the selected transmission strategy to complete the data upload.
[0021] In this embodiment, the specific process of obtaining the predicted water quality parameter vector output by the digital twin model in the data correction module is as follows: After the data correction module is activated by a periodic monitoring signal or an abnormal event trigger signal, it acquires the raw water quality reading vector output by the water quality sensor at the current moment, and obtains the historical water quality reading vector from the previous moment adjacent to the current moment, the equipment operating status parameter vector representing the equipment's operating conditions at the previous moment, and the environmental parameter vector representing the external environmental conditions at the current moment. The equipment operating status parameter vector includes the remaining lifespan percentage of the filter cartridge and pump operating cycle information, while the environmental parameter vector includes the ambient temperature value and the temperature difference between the equipment inlet and outlet. The historical water quality reading vector from the previous moment, the equipment operating status parameter vector, and the environmental parameter vector are then input into a pre-trained... The digital twin model is a proxy model trained on pre-collected historical time-series data of the same type as historical water quality reading vectors, equipment operating status parameter vectors, and environmental parameter vectors. It is used to map the complex nonlinear relationship between equipment operating status, environmental factors, and water quality parameters. The training process of the digital twin model is completed before system deployment. By collecting historical time-series data generated by the water dispenser operating under typical conditions for a long time, a supervised learning algorithm is used. The historical water quality readings are used as labels, and the corresponding historical equipment operating status parameters and historical environmental parameters are used as features to fit the model parameters, so that the model can learn the nonlinear mapping relationship from equipment status and environment to water quality parameters. This digital twin model contains a set of model parameters consisting of fixed parameters and an adjustable subset of parameters. It uses a nonlinear mapping function to comprehensively process the input vectors: historical water quality readings from a previous moment, equipment operating status parameters, and environmental parameters. The nonlinear mapping function uses the historical water quality readings from a previous moment as the primary input reflecting the temporal evolution of water quality parameters, the equipment operating status parameters as an auxiliary input reflecting the impact of the equipment's own operating status on water quality, and the environmental parameters as an auxiliary input reflecting the impact of external environmental conditions on water quality. Through the operational rules defined by the model parameter set, it generates and outputs a predicted vector of water quality parameters representing the current water quality status. This predicted vector serves as the prior estimation basis for subsequent data fusion using the extended Kalman filter algorithm. Specifically, the nonlinear mapping function can be a neural network structure containing a multilayer perceptron, which performs linear combination and nonlinear activation transformation on the input vectors through weights and biases in the model parameter set, ultimately outputting the predicted vector of water quality parameters. The process of generating and outputting the posterior state estimation vector as the correction result based on the extended Kalman filter algorithm is as follows: F1. Initialization and Prediction: Receives the predicted water quality parameter vector from the digital twin model and the current-moment raw water quality reading vector from the water quality sensor, and initializes the state vector and error covariance matrix required for the extended Kalman filter process. The state vector contains the true values of the water quality parameters to be estimated and the sensor drift error components. Next, the prediction step is performed: using a preset nonlinear state transition function, the posterior state estimation vector obtained in the previous filtering cycle is calculated to obtain the prior state estimation vector for predicting the current state. Simultaneously, using… The prior error covariance matrix corresponding to the state transition function, the posterior error covariance matrix of the previous filtering cycle, and the preset process noise covariance matrix are calculated according to the rule that the prior error covariance matrix is equal to the product of the Jacobian matrix and the posterior error covariance matrix of the previous filtering cycle, multiplied by the transpose of the Jacobian matrix, and then added to the process noise covariance matrix. The process noise covariance matrix is used to characterize the uncertainty of the system state transition process, and its initial value is set according to the physical laws of water quality parameter changes and sensor noise characteristics. F2. Adaptive Measurement Noise Adjustment and Gain Calculation: In the update step, the measurement noise covariance matrix at the current moment is dynamically calculated. The calculation process is as follows: based on a preset baseline measurement noise covariance matrix, an adaptive adjustment coefficient, the squared Euclidean distance between the current original water quality reading vector and a theoretical observation vector, and an identity matrix are added. The theoretical observation vector is obtained by multiplying the preset observation matrix by the predicted water quality parameter vector. The squared Euclidean distance measures the difference between the predicted water quality parameter vector and the current original water quality reading vector. The adaptive adjustment coefficient controls the influence of the model prediction confidence on noise adjustment; its value is determined through experimental debugging to ensure that the sensor readings are consistent with the actual readings. A balance is achieved between mutations and model prediction bias. Subsequently, based on the prior error covariance matrix, the preset observation matrix and its transpose, and the calculated measurement noise covariance matrix at the current time, the Kalman gain matrix is determined using the Kalman gain calculation formula. The specific calculation process is as follows: multiply the prior error covariance matrix with the transpose of the observation matrix to obtain an intermediate matrix A; calculate the inverse matrix of the matrix obtained by multiplying the observation matrix, the prior error covariance matrix, and the transpose of the observation matrix, and then adding it to the measurement noise covariance matrix at the current time, denoted as intermediate matrix B; finally, multiply intermediate matrix A and intermediate matrix B to obtain the Kalman gain matrix. The Kalman gain matrix dynamically determines the trust weight allocation between sensor information and model prediction during state updates. F3. State Update and Output: Calculate an innovation vector, which equals the original water quality reading vector at the current time minus the predicted observation vector obtained by applying the observation function to the prior state estimation vector. Then, correct the prior state estimation vector using the Kalman gain matrix. The corrected posterior state estimation vector equals the prior state estimation vector plus the product of the Kalman gain matrix and the innovation vector. Simultaneously, update the error covariance matrix to obtain the posterior error covariance matrix, whose value equals the identity matrix minus the product of the Kalman gain matrix and the observation matrix, multiplied by the prior error covariance matrix. The corrected posterior state estimation vector is the correction result. The true water quality parameter components in the posterior state estimation vector are the high-confidence water quality data after filtering and correction. F4. Closed-Loop Fine-Tuning of Model Parameters: Based on the innovation vector sequence generated after filtering updates, the adjustable parameter subset in the model parameter set of the digital twin model is fine-tuned online. The innovation vector sequence is composed of the innovation vectors calculated in step F3 for each filtering cycle in chronological order. The specific fine-tuning process is as follows: The innovation vector sequence is analyzed in real time. If the statistical mean of the innovation vector sequence or the square of its L2 norm continuously exceeds a preset threshold within multiple consecutive filtering cycles, it is determined that the digital twin model has prediction drift or that the operating conditions have continuously changed, and the parameter fine-tuning process is triggered. The preset threshold is determined based on the statistical distribution of the prediction error of the digital twin model on the validation set. For example, it can be set as the statistical mean of the square of the L2 norm of the innovation vectors on the validation set plus twice the standard deviation to ensure sensitivity to abnormal changes while avoiding over-fine-tuning. In this fine-tuning process, the first step is to minimize the norm of subsequent innovation vectors based on the current innovation vector sequence. The process involves calculating a model parameter adjustment amount. This adjustment amount can be calculated using gradient descent, specifically along the negative gradient direction of the loss function (such as the expectation of the squared L2 norm of the innovation vector) relative to the subset of adjustable parameters. Then, a preset normalized learning rate is multiplied by this adjustment amount to obtain the fine-tuning amount. The learning rate is set to a small positive number to ensure the stability of model parameter updates, typically between 0.001 and 0.1, selected through cross-validation. Finally, this fine-tuning amount is applied to the subset of adjustable parameters of the digital twin model, thereby updating the model. The updated digital twin model will be used in the next monitoring cycle to generate new water quality parameter prediction vectors, thus forming a closed-loop optimization process from filtering results to model parameters. This process enables the digital twin model to adaptively track equipment performance degradation and long-term slow changes in external conditions, continuously maintaining high prediction accuracy.
[0022] In this embodiment, it is specifically necessary to explain the process in the data selection module where a lightweight long short-term memory autoencoder model is used to reconstruct and analyze the posterior state estimation vector sequence within a predetermined time period, and the water quality anomaly score is calculated based on the calculated reconstruction error value and sequence volatility value. First, using a predefined fixed-length T as a time window, the system backtracks from the current time step, extracting the posterior state estimation vectors for T consecutive time steps and arranging them chronologically to construct the input sequence for the current time step. This input sequence is then fed into a pre-trained lightweight long short-term memory autoencoder network, which consists of an encoder network and a decoder network connected sequentially. The encoder network, composed of at least one long short-term memory recurrent neural network layer, encodes the input sequence into a fixed-dimensional context feature vector. This vector is a compressed representation of the deep spatiotemporal features of the entire input sequence, with a dimension much lower than the total dimension of the original input sequence, achieving effective data compression. The decoder network also consists of at least one... The system consists of a long short-term memory recurrent neural network layer. Starting with the context feature vector as the initial state, it reconstructs a reconstructed output sequence that is completely identical to the input sequence in terms of time length and vector dimension, aiming to restore the input sequence as realistically as possible. Then, for each posterior state estimation vector in the input sequence, the square of the Euclidean distance between it and the corresponding reconstructed output vector in the reconstructed output sequence is calculated. The result is defined as the reconstruction error vector at that time step. This square operation amplifies the significant reconstruction bias. The Euclidean norms of the reconstruction error vectors at all T time steps are summed and then divided by the temporal window length T. The quotient is defined as the reconstruction error value of the current window, which represents the average level of the overall reconstruction loss of the current window. Next, the volatility value of the sequence is calculated based on T reconstruction error vectors. The specific process is as follows: Q1. Calculate the Euclidean norm of the reconstruction error vector at each time step within the current window; Q2. Divide the Euclidean norm calculated at each time step by the sum of the Euclidean norms at all times within the current window, thereby assigning a normalized weight coefficient to each time step, so that the sum of all weight coefficients is 1. Q3. Calculate the sequence volatility value as the negative value of the weighted energy entropy of the normalized weight coefficients. The calculation process of the weighted energy entropy is as follows: using the normalized weight coefficients at each time step as the probability mass at that time step, calculate the information entropy of these probability masses. In the logarithmic operation of the information entropy, the argument of the logarithm is formed by adding the normalized weight coefficient at that time step to a preset normal coefficient. The coefficient is used to ensure the mathematical validity of the logarithmic operation. The normal coefficient is a very small positive number, such as 10 to the power of negative 8. The sequence volatility value (i.e., negative entropy) can effectively quantify the degree of concentration of reconstruction error in the time dimension: when the reconstruction errors at all times are similar, the weight distribution is uniform, the entropy value is large and the negative entropy value is small, indicating low volatility; when the reconstruction error at a certain time step is significantly larger than that at other times, the weight is highly concentrated, the entropy value is small and the negative entropy value is large, indicating high volatility and suggesting the possible existence of sudden anomalies. Finally, based on the reconstruction error value and the sequence volatility value, a water quality anomaly score is calculated using a preset synthesis rule. The synthesis rule is as follows: the reconstruction error value is used as the numerator; the sum of the number 1 and an exponential function with a natural constant as the base is used as the denominator; the exponent of the exponential function is negative; and the product of a preset positive adjustment factor and the difference between the sequence volatility value and a preset real-valued offset parameter is used. The result calculated using this rule is defined as the water quality anomaly score. In the synthesis rule, the denominator is an S-shaped function, which dynamically modulates the sensitivity of the score to the reconstruction error: when the sequence volatility value is significantly lower than the real-valued offset parameter, the denominator approaches a number less than 1, thus significantly amplifying the score contributed by the reconstruction error value and enhancing the detection sensitivity to sudden anomalies; when the sequence volatility value is normal or high, the denominator approaches 1, and the score is mainly determined by the reconstruction error value, used to capture slow-moving anomalies. The positive adjustment factor controls the steepness of the transition region of the S-shaped function, and the real-valued offset parameter can be set based on the statistical distribution of the sequence volatility values in historical normal data, for example, by taking its statistical mean. The specific operation to output the selected data, which includes the selected event type labels and the extracted key feature vectors, is as follows: First, the calculated water quality anomaly score is compared with a preset first threshold and a second threshold, where the first threshold is less than the second threshold. The first and second thresholds are determined by analyzing the distribution of water quality anomaly scores under normal and typical abnormal operating conditions in historical operational data. For example, in one specific implementation, a large amount of score data under normal steady-state conditions can be collected, its statistical distribution can be calculated, and the first threshold can be set as the high quantile of this distribution (e.g., the 95th percentile) to reduce false alarms. Simultaneously, based on acceptable anomaly detection delay and false negative rate, combined with typical anomaly data, the second threshold is set. Based on the comparison results, the posterior state estimation vector at the current moment is labeled as one of the following three event types: When the water quality anomaly score is less than the first threshold, it is marked as a normal steady-state event; When the water quality anomaly score is greater than or equal to the first threshold and less than the second threshold, it is marked as a potential drift event; When the water quality anomaly score is greater than or equal to the second threshold, it is marked as an anomaly event; If the marked event type is an abnormal event, an abnormal event trigger signal is generated and sent to the data correction module. The signal is used to instruct the data correction module to increase the monitoring frequency, activate the backup sensor, or perform a more rigorous online calibration process. For the posterior state estimation vector labeled as a potential drift event or anomaly event, the context feature vector is extracted as a key feature vector from the context feature vector output by the encoder network of the lightweight long short-term memory autoencoder network. The context feature vector is a compressed representation of the input sequence by the encoder. Its data volume is much smaller than the original sequence, but it retains the key information for anomaly detection. Using it as a key feature vector achieves high-rate data compression, which is particularly suitable for narrowband IoT transmission. The output includes data containing the current event type label and the key feature vector corresponding to the event type as a potential drift event or an abnormal event. This data is used as the selected data. The selected data may also include information such as timestamps and device identifiers. For data marked as normal steady-state events, only the event type label and metadata such as timestamps are uploaded, or a periodic statistical summary is uploaded after accumulating multiple normal events to further save communication resources.
[0023] In this embodiment, it is specifically necessary to explain the operation based on the reinforcement learning agent in the strategy optimization module. This reinforcement learning agent aims to optimize the overall efficiency of information transmission value and resource consumption. The specific process of selecting a transmission strategy from the preset action space based on the current network state, device energy state, and event type label is as follows: First, the system receives selected data from the data selection module. Simultaneously, it collects the device energy status (VSA), representing the remaining available energy of the current device, and the current network status, representing the quality of the current narrowband IoT communication link. Based on event type labels and key feature vectors, a low-dimensional data value feature for quantifying information value is generated through a feature encoding process. Next, a state-aware vector is constructed, consisting of three sequentially connected components: the first component is the device energy status, representing the remaining battery percentage; the second component is the current network status, a sub-vector containing at least one parameter, such as estimated network latency or current received signal strength; and the third component is the data value feature. The feature encoding process can be implemented using a small fully connected neural network, mapping different event type labels to numerical codes, concatenating them with the key feature vector, and then compressing them into a fixed-dimensional vector as the data value feature. Next, a preset action space is defined, which consists of multiple candidate transmission strategies. Each candidate transmission strategy is a composite instruction, which includes a transmission decision dimension and a transmission strength dimension. The transmission decision dimension is used to indicate the timing of data reporting, and its value is selected from a set including immediate upload, delayed upload, and local record only. The transmission strength dimension is used to indicate the level of detail and priority of data reporting, and its value is selected from a set including high-priority complete data, medium-priority feature summary, and low-priority minimal metadata. The state-aware vector is input into a value evaluation network within the reinforcement learning agent. This value evaluation network is a deep neural network that outputs an evaluation value representing the long-term expected return for each candidate transmission strategy in the preset action space. This value is called the long-term comprehensive performance evaluation value. The calculation of the long-term comprehensive performance evaluation value is based on a preset reward function, which is structured as a weighted sum of three terms: the first term is the product of a positive weight coefficient and the information transmission value return; the second term is the product of a negative weight coefficient and the energy resource consumption cost; and the third term is the product of a negative weight coefficient and the communication bandwidth resource consumption cost. The reward function can be specifically exemplified as: Instant performance return = positive weight coefficient * data value feature * transmission strength coefficient - negative weight coefficient 1 * (estimated energy consumption / device energy status) - negative weight coefficient 2 * (estimated data volume * network congestion index); where the transmission strength coefficient, estimated energy consumption, and estimated data volume are determined by the candidate transmission strategies, and the network congestion index is derived from the current network state. The value gain of information transmission depends on the value characteristics of the data and the transmission strength of the evaluated candidate transmission strategies. The higher the value characteristics and the higher the transmission strength, the greater the gain. The energy resource consumption cost depends on the estimated energy consumption of the evaluated candidate transmission strategies and the energy status of the equipment. The higher the estimated energy consumption and the lower the energy status of the equipment, the greater the cost. The communication bandwidth resource consumption cost depends on the estimated data volume of the evaluated candidate transmission strategies and the channel quality reflected by the current network status. The larger the estimated data volume and the worse the channel quality, the greater the cost. Then, progressive decision-making and confidence threshold judgment are performed: the long-term comprehensive performance evaluation values corresponding to all candidate transmission strategies are compared, the maximum and second-largest values are identified, and the difference between them is calculated; this difference is compared with a preset confidence threshold used to measure the confidence level of the decision; the confidence threshold is set based on the statistical analysis of value differences in historical decision-making processes, for example, it can be set to 30% to 50% of the average historical value difference, to ensure that decisive decisions can be made in most cases, while avoiding potentially suboptimal choices when evaluations are close. If the difference is greater than the confidence threshold, the candidate transmission strategy with the largest long-term comprehensive performance evaluation value is directly selected as the final transmission strategy. If the difference is not greater than the confidence threshold, the decision is postponed and a waiting observation loop is triggered. In this loop, the updated current network status, especially the quality of the narrowband IoT communication link, is collected again, and the second component in the status perception vector is updated accordingly. The value assessment and comparison process is performed again until the difference is greater than the confidence threshold or the cumulative postponement reaches the preset limit. Then, the candidate transmission strategy with the largest long-term comprehensive performance evaluation value is selected as the final transmission strategy. Finally, the execution strategy distribution and closed-loop learning are as follows: P1. Output the final transmission strategy to the adaptive transmission module, which then performs the corresponding data transmission operation according to the final transmission strategy. For example, if the final transmission strategy is "immediate upload, high priority complete data", the adaptive transmission module constructs a high priority data packet containing complete abnormal data and feature vectors and sends it immediately. If it is "delayed upload, medium priority feature digest", it is added to the queue to be sent and the compressed feature digest is sent when the network is idle. P2. After the final transmission strategy is executed, calculate the actual immediate performance return obtained from this decision based on the reward function. In the actual calculation, use the energy actually consumed by the transmission action, the bandwidth actually occupied, and the actual information value benefit evaluated based on cloud feedback (such as model update effect, alarm confirmation), and substitute them into the reward function formula for calculation. P3. The state-aware vector, the selected final transmission strategy, the immediate performance reward, and the new state formed by the updated device energy state and the updated current network state collected after the decision-making process are stored together as a decision experience in an experience replay buffer. The experience replay buffer has a fixed capacity and manages decision experiences in a first-in-first-out manner to ensure that the data distribution used for learning remains relatively new and diverse. Multiple decision experiences are periodically sampled from the experience replay buffer to update the internal parameters of the value assessment network. The update adopts deep Q-learning or its variant algorithm to adjust the network parameters by minimizing the temporal difference error, so that the value assessment network can more accurately predict the long-term benefits of future states, thereby continuously optimizing the strategy of the reinforcement learning agent.
[0024] In this embodiment, the specific process of constructing a transmission data packet with a dynamic payload structure according to the selected transmission strategy in the adaptive transmission module is as follows: The system receives the final transmission strategy from the strategy optimization module, which includes a transmission decision dimension and a transmission strength dimension. First, based on these dimensions, a data urgency identifier is generated. For example, "immediate upload, high-priority complete data" is mapped to "urgent," and "delayed upload, medium-priority feature summary" is mapped to "normal." Simultaneously, from the selected data output by the data selection module, the system obtains the application data unit to be sent, containing event type markers and key feature vectors, as well as the estimated available channel bandwidth obtained in real-time from the narrowband IoT communication unit interface. Next, based on the data urgency identifier and the estimated available channel bandwidth, an adaptive fragmentation threshold is dynamically calculated. This threshold is calculated as follows: the estimated available channel bandwidth multiplied by a preset target maximum transmission delay, then multiplied by a positive load factor less than one. The target maximum transmission delay can be set according to service tolerance, for example, 100 milliseconds. The load factor is used to reserve bandwidth margin, and an empirical value between 0.7 and 0.9 is acceptable. Finally, a load construction decision is executed. If the data urgency indicator is determined to be urgent, or the total size of the application data unit exceeds the adaptive fragmentation threshold, then the fragmentation transmission mode is activated, dividing the application data unit into multiple sub-data packets, and ensuring that the payload size of each sub-data packet does not exceed the adaptive fragmentation threshold; the fragmentation strategy prioritizes the integrity of key feature vectors, which can be placed in the first fragment; at this time, the packet used for transmission is a sequence of sub-data packets composed of multiple sub-data packets in sequence; If the data urgency level is determined to be non-urgent and the total size of the application data units does not exceed the adaptive fragmentation threshold, then the aggregation transmission mode is enabled. The application data unit to be sent is merged with other application data units in the cache queue that have the same or similar non-urgent level, forming an aggregated data packet. The total size of this aggregated data packet is ensured not to exceed the adaptive fragmentation threshold. During merging, an independent header is added to each aggregated application data unit to maintain resolvability. At this time, the packet used for transmission is an aggregated data packet. Finally, the completed sequence of sub-data packets or aggregated data packets used for transmission are collectively referred to as transmission data packets. The payload size of the transmission data packets and the internal priority label obtained by converting the data urgency identifier according to preset rules are output for subsequent transmission execution, enhanced feedback collection and closed-loop update. The internal priority label can map "urgent" and "normal" to the values of one and 0.5 respectively for subsequent quantization calculation. The specific process of dynamically configuring the physical layer transmission parameters of narrowband IoT based on the payload size of the transmitted data packets and the data urgency indicated by the selected transmission strategy is as follows: R1, Input and Acquisition: Receive the constructed transmission data packet and its payload size and internal priority tag, and acquire the current transmission environment status of the narrowband IoT physical layer. The transmission environment status includes physical layer measurement parameters that characterize the quality of the current narrowband IoT communication link, such as reference signal received power and signal-to-interference-plus-noise ratio. R2, Cross-layer parameter collaborative optimization configuration: Based on payload size, internal priority label, and transmission environment status, the following configuration is performed: R2.1 Joint Optimization of Transmit Power: The final transmit power is composed of three parts: base transmit power, priority power increment, and adaptive load compensation. The priority power increment is calculated by multiplying a preset power adjustment coefficient by the hyperbolic tangent function value of the internal priority label. The adaptive load compensation is calculated by multiplying a preset logarithmic compensation coefficient by the logarithm of the quotient of a base-2 load size and a preset reference load. The hyperbolic tangent function ensures smooth saturation of the power increment brought by priority, avoiding a significant increase in power when the priority is already high. Logarithmic compensation simulates the diminishing marginal returns of the additional power required for large packet transmission, making it more energy-efficient than linear compensation. For example, the reference load can be set to 100 bytes, and the power adjustment coefficient and logarithmic compensation coefficient are calibrated using link budget and energy consumption models. R2.2 Joint Selection of Modulation and Coding Strategies: Calculate the effective spectral efficiency index corresponding to each candidate modulation and coding strategy combination. This index is equal to the logarithm of the candidate modulation order (base 2) multiplied by 1, minus the estimated block error rate (BER) of the candidate coding strategy corresponding to the combination. Among all candidate combinations that meet the target BER requirement, the combination that minimizes the transmission time estimate is selected as the final modulation and coding strategy. The transmission time estimate is equal to the payload size divided by the effective spectral efficiency index plus a fixed signaling overhead time. The BER estimate of the candidate coding strategy is obtained based on the current transmission environment state through a pre-stored lookup table or empirical model. The signaling overhead time includes the time consumed by random access, scheduling authorization, and other processes, and is typically about five to ten milliseconds in narrowband IoT. R2.3 Dynamic configuration of retransmission strategy: The maximum number of hybrid automatic retransmission requests is dynamically set according to the data urgency identifier obtained by mapping the final transmission strategy; the candidate coding block error rate estimate is obtained by using a pre-stored lookup table or empirical model based on the current transmission environment status; the signaling overhead time includes the time consumed by random access, scheduling authorization and other processes, and the typical value in narrowband IoT is about five to ten milliseconds. R3, Perform transmission, collect feedback, and perform closed-loop updates: R3.1 Transmission Execution: The final transmit power, the final modulation and coding strategy, and the maximum number of hybrid automatic repeat requests are sent to the narrowband IoT communication unit, driving the communication module to send the data packets as parameters. R3.2 Enhanced Feedback Generation: After transmission is completed, the actual transmission results are collected, including whether the transmission was successful, the actual transmission delay, and the estimated actual energy consumption. The estimated actual energy consumption can be obtained by measuring the integration of the current and voltage of the communication module during operation. Based on the actual transmission results, a multi-dimensional transmission efficiency feedback vector is calculated: the reliability feedback component of this vector is one when the transmission is successful and zero when it fails; the timeliness feedback component of this vector is equal to the value of an exponential function with the natural constant as the base, where the exponent of the exponential function is the quotient of the negative actual transmission delay and the preset target maximum transmission delay; this exponential function form causes the feedback component to decay rapidly after the delay exceeds the target value, thus strongly penalizing the timeout in the reward function; the energy efficiency feedback component of this vector is equal to the load size divided by the estimated actual energy consumption. R3.3 Closed-loop update: The multi-dimensional transmission performance feedback vector, the final transmission strategy that triggered this transmission, and the current network state before transmission obtained in step R1 are combined to form a transmission experience tuple; the current network state at least includes the transmission environment state obtained in step R1; this transmission experience tuple is uploaded to the cloud or returned to the policy optimization module to update the value evaluation model of the reinforcement learning agent; in the specific update, the tuple is used as a sample, and the temporal difference learning algorithm is used to adjust the weight parameters of the value evaluation network with the goal of minimizing the error between the predicted long-term performance reward and the actual reward; at the same time, based on the channel measurement information in the actual transmission results, the available channel bandwidth estimation model used to calculate the adaptive fragmentation threshold is updated locally, for example, by using moving average or Kalman filtering to smooth and track the channel bandwidth estimation. Example
[0025] This embodiment also provides a storage medium storing a computer program that can be loaded by a processor and execute the above-described methods.
[0026] 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.
[0027] 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.
[0028] 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.
[0029] 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.
[0030] 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.
[0031] 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.
[0032] 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. An Internet of Things interconnected wall-mounted water dispenser water quality monitoring and purification system, characterized in that, Specifically, it includes: The system includes a data correction module, a data selection module, a strategy optimization module, and an adaptive transmission module; Data correction module: In response to periodic monitoring by the water quality sensor or an abnormal event trigger signal from the data selection module, it receives the raw water quality reading vector of the current moment output by the water quality sensor, obtains the water quality parameter prediction vector output by the digital twin model, wherein the water quality parameter prediction vector is generated based on the historical water quality reading vector of the previous moment adjacent to the current moment, the equipment operating status parameter vector, and the environmental parameter vector. It performs data fusion processing on the raw water quality reading vector and the water quality parameter prediction vector of the current moment, and generates and outputs the posterior state estimation vector as the correction result based on the extended Kalman filter algorithm. Data selection module: Connected to the data correction module, it receives the posterior state estimation vector and uses a lightweight long short-term memory autoencoder model to reconstruct and analyze the sequence of posterior state estimation vectors within a predetermined time period. Based on the calculated reconstruction error value and sequence volatility value, it calculates a water quality anomaly score and marks the posterior state estimation vectors as different event types according to the water quality anomaly score. When the marked event type is a preset anomaly event, it generates and sends an anomaly event trigger signal to the data correction module. At the same time, it performs intelligent selection and outputs selected data containing the selected event type label and the extracted key feature vectors. Strategy optimization module: Connects to the data selection module, receives the selected data, and operates based on the reinforcement learning agent. The reinforcement learning agent aims to optimize the overall efficiency of information transmission value and resource consumption. Based on the current network status, device energy status and event type label, it selects a transmission strategy from the preset action space. Adaptive transmission module: Connected to the strategy optimization module, it receives the selected transmission strategy, constructs a transmission data packet with a dynamic payload structure according to the selected transmission strategy, and dynamically configures the physical layer transmission parameters of the narrowband IoT based on the payload size of the transmission data packet and the data urgency indicated by the selected transmission strategy to complete the data upload.
2. The Internet of Things interconnected wall-mounted water quality monitoring and purifying system according to claim 1, characterized in that: In the data correction module, the specific process of obtaining the predicted water quality parameter vector output by the digital twin model is as follows: After the data correction module is activated by a periodic monitoring signal or an abnormal event trigger signal, it acquires the original water quality reading vector of the current moment output by the water quality sensor, and obtains the historical water quality reading vector of the previous moment adjacent to the current moment, the equipment operating status parameter vector representing the operating condition of the equipment at the previous moment, and the environmental parameter vector representing the external environmental conditions at the current moment. Among them, the equipment operating status parameter vector includes the remaining lifespan percentage of the filter element and the pump operating cycle information, and the environmental parameter vector includes the ambient temperature value and the temperature difference between the equipment inlet and outlet. The historical water quality reading vector of the previous moment, the equipment operating status parameter vector, and the environmental parameter vector are input together into a pre-trained digital twin model. The digital twin model contains a set of model parameters consisting of fixed parameters and adjustable parameters. It uses a nonlinear mapping function to perform comprehensive calculations on the input vectors of historical water quality readings from the previous moment, equipment operating status parameters, and environmental parameters. The nonlinear mapping function uses the historical water quality reading vector from the previous moment as the main input reflecting the time-series evolution of water quality parameters, the equipment operating status parameter vector as the auxiliary input reflecting the impact of the equipment's own operating status on water quality, and the environmental parameter vector as the auxiliary input reflecting the impact of external environmental conditions on water quality, generating and outputting a predicted vector of water quality parameters.
3. The Internet of Things interconnected wall-mounted water quality monitoring and purifying system according to claim 2, characterized in that: The process of generating and outputting the posterior state estimation vector as the correction result based on the extended Kalman filter algorithm is as follows: F1. Initialization and Prediction: Receive the predicted water quality parameter vector from the digital twin model and the original water quality reading vector at the current moment from the water quality sensor, and initialize the state vector and error covariance matrix required for the extended Kalman filter process. The state vector contains the true value components of the water quality parameters to be estimated and the sensor drift error components. Next, perform the prediction step calculation: Using a preset nonlinear state transition function, operate on the posterior state estimation vector obtained in the previous filtering cycle to obtain the prior state estimation vector for predicting the current state. Simultaneously, using the Jacobian matrix corresponding to the state transition function, the posterior error covariance matrix of the previous filtering cycle, and the preset process noise covariance matrix, calculate the prior error covariance matrix corresponding to the current moment according to the rule that the prior error covariance matrix is equal to the product of the Jacobian matrix and the posterior error covariance matrix of the previous filtering cycle, multiplied by the transpose of the Jacobian matrix, and then added to the process noise covariance matrix. F2. Adaptive Measurement Noise Adjustment and Gain Calculation: In the update step, the measurement noise covariance matrix at the current moment is first dynamically calculated. The calculation process is as follows: based on a preset baseline measurement noise covariance matrix, an adaptive adjustment coefficient, the squared Euclidean distance between the current original water quality reading vector and a theoretical observation vector, and an identity matrix are added. The theoretical observation vector is obtained by multiplying the preset observation matrix with the predicted water quality parameter vector. Subsequently, based on the prior error covariance matrix, the preset observation matrix and its transpose, and the calculated measurement noise covariance matrix at the current moment, the Kalman gain matrix is determined using the Kalman gain calculation formula. The specific calculation process is as follows: multiply the prior error covariance matrix with the transpose of the observation matrix to obtain an intermediate matrix A; calculate the inverse matrix of the matrix obtained by multiplying the observation matrix, the prior error covariance matrix, and the transpose of the observation matrix, and then adding it to the measurement noise covariance matrix at the current moment, denoted as intermediate matrix B; finally, multiply intermediate matrix A and intermediate matrix B to obtain the Kalman gain matrix. F3. State Update and Output: Calculate a new information vector, which equals the original water quality reading vector at the current time minus the predicted observation vector obtained by applying the observation function to the prior state estimation vector. Then, correct the prior state estimation vector using the Kalman gain matrix. The corrected posterior state estimation vector equals the prior state estimation vector plus the product of the Kalman gain matrix and the new information vector. Simultaneously, update the error covariance matrix to obtain the posterior error covariance matrix, whose value equals the identity matrix minus the product of the Kalman gain matrix and the observation matrix, and then multiplied by the prior error covariance matrix. The corrected posterior state estimation vector is the correction result. F4. Closed-Loop Fine-Tuning of Model Parameters: Based on the innovation vector sequence generated after filtering update, the adjustable parameter subset in the model parameter set of the digital twin model is fine-tuned online. The innovation vector sequence is composed of the innovation vectors calculated in step F3 for each filtering cycle in chronological order. The specific fine-tuning process is as follows: The innovation vector sequence is analyzed in real time. If the statistical mean of the innovation vector sequence or the square of its L2 norm continuously exceeds a preset threshold in multiple consecutive filtering cycles, it is determined that the digital twin model has prediction drift or the operating conditions have continuously changed, and the parameter fine-tuning process is triggered. In this fine-tuning process, firstly, based on the current innovation vector sequence, a model parameter adjustment amount is calculated with the goal of minimizing the norm of subsequent innovation vectors. Then, a preset normalized learning rate is multiplied by the model parameter adjustment amount to obtain the parameter fine-tuning amount. Finally, the parameter fine-tuning amount is applied to the adjustable parameter subset of the digital twin model to update the digital twin model.
4. The IoT-connected wall-mounted water dispenser water quality monitoring and purification system according to claim 3, characterized in that: In the data selection module, the lightweight long short-term memory autoencoder model is used to reconstruct and analyze the posterior state estimation vector sequence within a predetermined time period. The specific process of calculating the water quality anomaly score based on the calculated reconstruction error value and sequence volatility value is as follows: First, using a predefined fixed-length T as the time window, the system traces backward from the current time step, extracting the posterior state estimation vectors for T consecutive time steps and arranging them chronologically to construct the input sequence for the current time step. This input sequence is then fed into a pre-trained lightweight long short-term memory autoencoder network, which consists of an encoder network and a decoder network connected sequentially. The encoder network, composed of a long short-term memory recurrent neural network layer, encodes the input sequence into a fixed-dimensional context feature vector. The decoder network, also composed of a long short-term memory recurrent neural network layer, uses the context feature vector as its initial state to reconstruct a reconstructed output sequence that is completely identical to the input sequence in terms of time length and vector dimension. Then, for each posterior state estimation vector in the input sequence, the square of the Euclidean distance between it and the corresponding reconstructed output vector in the reconstructed output sequence is calculated, and the result is defined as the reconstruction error vector at that time step. The Euclidean norms of the reconstruction error vectors at all T time steps are summed, and then divided by the time window length T. The quotient is defined as the reconstruction error value for the current window. Next, the volatility value of the sequence is calculated based on T reconstruction error vectors. The specific process is as follows: Q1. Calculate the Euclidean norm of the reconstruction error vector at each time step within the current window; Q2. Divide the Euclidean norm calculated at each time step by the sum of the Euclidean norms at all times within the current window, thereby assigning a normalized weight coefficient to each time step. Q3. Calculate the sequence volatility value as the negative value of the weighted energy entropy of the normalized weight coefficients of the set; wherein, the calculation process of the weighted energy entropy is as follows: take the normalized weight coefficients of each time as the probability mass of that time, calculate the information entropy of these probability masses, and in the logarithmic operation of the information entropy, the proper number of the logarithm is formed by adding the normalized weight coefficients of that time to a preset normal coefficient. Finally, based on the reconstruction error value and the sequence volatility value, the water quality anomaly score is calculated using a preset synthesis rule. The synthesis rule is as follows: the reconstruction error value is used as the numerator, and the sum of the number 1 and the exponential function with the natural constant as the base is used as the denominator. The exponent of the exponential function is negative, and the product of a preset positive adjustment factor and the difference between the sequence volatility value and a preset real offset parameter is used. The result calculated using this rule is defined as the water quality anomaly score.
5. The IoT-connected wall-mounted water dispenser water quality monitoring and purification system according to claim 4, characterized in that: The specific operation to output the selected data, which includes the selected event type labels and the extracted key feature vectors, is as follows: First, the calculated water quality anomaly score is compared with a preset first threshold and a second threshold, where the first threshold is less than the second threshold. Based on the comparison result, the posterior state estimation vector at the current moment is labeled as one of the following three event types: When the water quality anomaly score is less than the first threshold, it is marked as a normal steady-state event; When the water quality anomaly score is greater than or equal to the first threshold and less than the second threshold, it is marked as a potential drift event; When the water quality anomaly score is greater than or equal to the second threshold, it is marked as an anomaly event; If the marked event type is an abnormal event, an abnormal event trigger signal is generated and sent to the data correction module; For the posterior state estimation vector labeled as a potential drift event or anomaly event, extract the context feature vector as the key feature vector from the context feature vector output by the encoder network of the lightweight long short-term memory autoencoder network. The output includes data containing the current event type label and the key feature vectors corresponding to the event type as a potential drift event or an anomaly event, which are used as the selected data.
6. The IoT-connected wall-mounted water dispenser water quality monitoring and purification system according to claim 5, characterized in that: In the strategy optimization module, operations are performed based on a reinforcement learning agent. This reinforcement learning agent aims to optimize the overall efficiency of information transmission value and resource consumption. The specific process of selecting a transmission strategy from a preset action space based on the current network state, device energy state, and event type label is as follows: First, the system receives selected data from the data selection module. Simultaneously, it collects the device energy status, representing the remaining available energy of the current device, and the current network status, representing the quality of the current narrowband IoT communication link. Based on event type markers and key feature vectors, a data value feature is generated through a feature encoding process. Next, a state-aware vector is constructed, consisting of three sequentially connected components: the first component is the device energy status, which is the percentage of the device's remaining battery power; the second component is the current network status, which is a sub-vector containing at least one parameter, such as estimated network latency and current received signal strength; and the third component is the data value feature. Next, a preset action space is defined, which consists of multiple candidate transmission strategies. Each candidate transmission strategy is a composite instruction, which includes a transmission decision dimension and a transmission strength dimension. The state-aware vector is input into a value evaluation network contained in the reinforcement learning agent. The value evaluation network is a deep neural network that outputs an evaluation value for each candidate transmission strategy in the preset action space, called the long-term comprehensive performance evaluation value. The calculation of the long-term comprehensive performance evaluation value is based on a preset reward function, which is set to a three-term weighted sum: the first term is the product of a positive weight coefficient and the information transmission value gain; the second term is the product of a negative weight coefficient and the energy resource consumption cost; and the third term is the product of a negative weight coefficient and the communication bandwidth resource consumption cost. Then, perform incremental decision-making and confidence threshold judgment: compare the long-term comprehensive performance evaluation values corresponding to all candidate transmission strategies, find the maximum and second largest values, and calculate the difference between the two. The difference is compared with a preset confidence threshold: If the difference is greater than the confidence threshold, the candidate transmission strategy with the largest long-term comprehensive performance evaluation value is directly selected as the final transmission strategy. If the difference is not greater than the confidence threshold, the decision is postponed and a waiting observation loop is triggered. In this loop, the updated current network status, especially the quality of the narrowband IoT communication link, is collected again, and the second component in the status perception vector is updated accordingly. The value assessment and comparison process is performed again until the difference is greater than the confidence threshold or the cumulative postponement reaches the preset limit. Then, the candidate transmission strategy with the largest long-term comprehensive performance evaluation value is selected as the final transmission strategy. Finally, the execution strategy distribution and closed-loop learning are as follows: P1. Output the final transmission strategy to the adaptive transmission module, which then performs the corresponding data transmission operation according to the final transmission strategy. P2. After the final transmission strategy is executed, calculate the actual immediate performance reward obtained from this decision based on the reward function; P3. The state perception vector, the selected final transmission strategy, the real-time performance reward, and the new state composed of the updated device energy state and the updated current network state collected after the decision is executed are stored together as a decision experience in an experience replay buffer. Multiple decision experiences are sampled from the experience replay buffer periodically to update the internal parameters of the value assessment network.
7. The IoT-connected wall-mounted water dispenser water quality monitoring and purification system according to claim 6, characterized in that: In the adaptive transmission module, the specific process of constructing a transmission data packet with a dynamic payload structure according to the selected transmission strategy is as follows: The system receives the final transmission strategy from the strategy optimization module, which includes a transmission decision dimension and a transmission strength dimension. First, based on the transmission decision dimension and the transmission strength dimension, a data urgency identifier is generated. Simultaneously, from the selected data output by the data selection module, the system obtains the application data unit to be sent, which includes event type markers and key feature vectors, as well as the available channel bandwidth estimate obtained in real time from the narrowband IoT communication unit interface. Then, based on the data urgency identifier and the available channel bandwidth estimate, an adaptive fragmentation threshold is dynamically calculated. The formula for calculating the adaptive fragmentation threshold is: the available channel bandwidth estimate multiplied by a preset target maximum transmission delay, and then multiplied by a positive load factor. Then, the payload construction decision is executed: If the data urgency level indicator is determined to be urgent, or the total size of the application data unit exceeds the adaptive fragmentation threshold, then the fragmentation transmission mode is enabled, and the application data unit is divided into multiple sub-data packets. At this time, the packet used for transmission is a sequence of sub-data packets composed of multiple sub-data packets in sequence; If the data urgency level is determined to be non-urgent and the total size of the application data units does not exceed the adaptive fragmentation threshold, then the aggregation transmission mode is enabled, and the application data unit to be sent is merged with other application data units in the cache queue that have the same or similar non-urgent level to form an aggregated data packet. At this time, the packets used for transmission are aggregated data packets; Finally, the completed sequence of sub-data packets or aggregated data packets used for transmission are collectively referred to as transmission data packets. The payload size of the transmission data packets and the internal priority label obtained by converting the data urgency identifier according to preset rules are output.
8. The IoT-connected wall-mounted water dispenser water quality monitoring and purification system according to claim 7, characterized in that: The specific process of dynamically configuring the physical layer transmission parameters of narrowband IoT based on the payload size of the transmitted data packets and the data urgency indicated by the selected transmission strategy is as follows: R1, Input and Acquisition: Receive the constructed transmission data packet and its payload size and internal priority label, and at the same time acquire the current transmission environment status of the narrowband IoT physical layer. The transmission environment status includes physical layer measurement parameters that characterize the quality of the current narrowband IoT communication link. R2, Cross-layer parameter collaborative optimization configuration: Based on payload size, internal priority label, and transmission environment status, the following configuration is performed: R2.1 Joint Optimization of Transmit Power: The final transmit power is composed of three parts: the base transmit power, the priority power increment, and the load adaptive compensation. The priority power increment is calculated by multiplying a preset power adjustment coefficient by the hyperbolic tangent function value of the internal priority label. The load adaptive compensation is calculated by multiplying a preset logarithmic compensation coefficient by the logarithmic value of the quotient of a base-2 load and a preset reference load. R2.2 Joint selection of modulation and coding strategies: Calculate the effective spectral efficiency index corresponding to each candidate modulation and coding strategy combination. This index is equal to the logarithm of the candidate modulation order (base 2) multiplied by 1 minus the estimated block error rate of the candidate coding strategy corresponding to the combination. Among all candidate combinations that meet the target packet error rate requirement, select the combination that minimizes the transmission time estimate as the final modulation and coding strategy. The transmission time estimate is equal to the payload size divided by the effective spectral efficiency index plus a fixed signaling overhead time. R2.3 Dynamic configuration of retransmission strategy: Dynamically set the maximum number of mixed automatic retransmission requests based on the data urgency identifier obtained by mapping from the final transmission strategy; R3, Perform transmission, collect feedback, and perform closed-loop updates: R3.1 Transmission Execution: The final transmit power, the final modulation and coding strategy, and the maximum number of hybrid automatic repeat requests are sent to the narrowband IoT communication unit, driving the communication module to send the data packets as parameters. R3.2 Enhanced Feedback Generation: After transmission is completed, the actual transmission results are collected, including whether the transmission was successful, the actual transmission delay, and the estimated actual energy consumption. Based on the actual transmission results, a multi-dimensional transmission performance feedback vector is calculated: the reliability feedback component of this vector takes a value of one when the transmission is successful and a value of zero when it fails; the timeliness feedback component of this vector is equal to the value of an exponential function with the natural constant as the base, where the exponent of the exponential function is the negative exponent of the actual transmission delay and the preset target maximum transmission delay; the energy efficiency feedback component of this vector is equal to the load size divided by the estimated actual energy consumption. R3.3 Closed-loop update: The multi-dimensional transmission performance feedback vector, the final transmission strategy that triggered this transmission, and the current network state before transmission obtained in step R1 are combined to form a transmission experience tuple; this transmission experience tuple is uploaded to the cloud or returned to the policy optimization module to update the value evaluation model of the reinforcement learning agent; at the same time, based on the channel measurement information in the actual transmission results, the available channel bandwidth estimation model used to calculate the adaptive fragmentation threshold is updated locally.
9. A method for water quality monitoring and purification in an IoT-connected wall-mounted water dispenser, applied to an IoT-connected wall-mounted water dispenser water quality monitoring and purification system as described in any one of claims 1-8, characterized in that: Specifically, the following steps are included: Step S1: In response to periodic monitoring or abnormal event triggering, obtain the original water quality reading vector and the predicted water quality parameter value vector at the current moment; The extended Kalman filter algorithm is used to fuse the two data and output the posterior state estimation vector. Step S2: Based on the posterior state estimation vector, perform time series reconstruction analysis using a lightweight long short-term memory autoencoder model to calculate the water quality anomaly score; label the data as event types according to the score, and feed back a trigger signal when it is labeled as an anomalous event; for each event type, extract the context feature vector as the key feature vector, and output the selected data containing the event type label and the key feature vector; Step S3: Based on the selected data, optimize the transmission strategy using a reinforcement learning agent; encode the event type label and key feature vector into data value features, and construct a state-aware vector by combining the device energy status and the current network status; Candidate transmission strategies are evaluated through a value assessment network, and the final transmission strategy is determined progressively based on the evaluation results and a pre-set confidence threshold. Step S4: Based on the final transmission strategy, dynamically construct the transmission data packets and determine their payload size; Based on the payload size and data urgency level identifier, the physical layer transmission parameters of the narrowband IoT are jointly optimized and the data is sent. Collect actual transmission results and calculate multidimensional transmission performance feedback vectors to update the value assessment model and channel estimation model.
10. A computer-readable storage medium, characterized in that, It stores a computer program that can be loaded by a processor and executed as described in claim 9.
