Indoor air quality predictive maintenance method and system combined with attention mechanism

By extracting local features and long-term dependencies from air quality data using the CNN-BiLSTM-MHA model and combining it with a multi-head self-attention mechanism, the problem of insufficient prediction in air quality management in existing technologies is solved, achieving high-precision prediction and proactive maintenance.

CN121901596APending Publication Date: 2026-04-21NANJING UNIV OF INFORMATION SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING UNIV OF INFORMATION SCI & TECH
Filing Date
2025-11-19
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing indoor air quality management methods cannot effectively predict potential pollution risks and are unable to fully capture key features in multi-source sensor data, resulting in maintenance delays.

Method used

The CNN-BiLSTM-MHA model, which incorporates an attention mechanism, is used to extract local feature sequences through a one-dimensional convolutional neural network, learn long-term dependencies through a bidirectional long short-term memory network, and dynamically allocate weights using a multi-head self-attention mechanism to predict the air quality index and generate maintenance strategies.

Benefits of technology

It achieves high-precision air quality forecasting, provides three-level early warning and real-time maintenance intervention strategies, improves the predictability and proactivity of air quality management, and reduces health risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121901596A_ABST
    Figure CN121901596A_ABST
Patent Text Reader

Abstract

The invention discloses an indoor air quality predictive maintenance method and system combined with an attention mechanism, and the method comprises the steps: collecting multi-dimensional index data in real time through arranging a multi-source sensor, and constructing a time series data set after the normalization of a sliding window; a one-dimensional convolutional neural network is sequentially adopted to extract local pollution mutation features, a bidirectional long-short-term memory network is adopted to capture forward and reverse long-term dependence, and then a multi-head self-attention mechanism is utilized to dynamically weight key time slices and feature dimensions; using the trained model to predict an air quality index in a future time period, and determining normal / mild / serious three-level early warning; and the prediction result is accessed to the building digital twin platform in real time, the three-dimensional model is driven to synchronously display the regional risk, and the time sequence influence of different maintenance strategies such as air exhaust increasing and purification starting is rehearsed. Experiments show that the performance of the method on a real data set is superior to that of LSTM, CNN and other models, early warning can be achieved, and manual intervention requirements can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of indoor air quality monitoring and maintenance technology, and in particular relates to a predictive maintenance method and system for indoor air quality that incorporates an attention mechanism. Background Technology

[0002] Existing indoor air quality management methods largely rely on real-time monitoring and threshold triggering mechanisms, which cannot effectively predict potential pollution risks, leading to maintenance delays. Furthermore, traditional prediction methods struggle to fully capture key features from multi-source sensor data, making high-precision predictive maintenance impossible. Summary of the Invention

[0003] Purpose of the invention: This invention provides a predictive maintenance method and system for indoor air quality that combines an attention mechanism. It aims to model multi-dimensional environmental parameters through deep learning and an attention mechanism to achieve high-precision prediction of air quality change trends, and to build a digital twin model to simulate maintenance strategies generated based on the prediction results, thereby helping maintenance personnel to formulate appropriate predictive maintenance strategies.

[0004] Technical solution: This invention provides a predictive maintenance method for indoor air quality that incorporates an attention mechanism, comprising:

[0005] Collect multidimensional air quality index data and real air quality index data of building interiors and preprocess them to construct a time series dataset. Divide the time series dataset into training set and test set according to a preset ratio.

[0006] A CNN-BiLSTM-MHA model was built, and a one-dimensional convolutional neural network was used to extract local feature sequences. The extracted local feature sequences were then input into a bidirectional long short-term memory network to learn long-term dependencies along the forward and backward time dimensions to obtain hidden state feature sequences. A multi-head self-attention mechanism was used to dynamically assign weights to the hidden state feature sequences at different time slices and different feature dimensions.

[0007] The mean squared error between the air quality index predicted by the CNN-BiLSTM-MHA model and the actual air quality index in the training set is used as the loss function to iteratively train the CNN-BiLSTM-MHA model and obtain the trained CNN-BiLSTM-MHA model.

[0008] The test set is input into the trained CNN-BiLSTM-MHA model to obtain the predicted air quality index for future periods, and compared with the preset health or degradation threshold to output a three-level warning level and corresponding maintenance intervention strategy.

[0009] The predicted air quality index, warning level, and maintenance intervention strategies for future periods are transmitted in real time to the building digital twin platform, which simultaneously displays the regional risk status and simulates the impact of different maintenance intervention strategies on air quality.

[0010] Furthermore, the construction of the time series dataset includes:

[0011] Multidimensional air quality index data are collected by sensors in different functional areas of the room at a preset sampling frequency; the collected multidimensional air quality index data are preprocessed to obtain standardized data, the preprocessing includes any one of linear interpolation of missing values, outlier removal and min-max normalization; a sliding time window mechanism is used to combine standardized data from several consecutive time steps into an input sample to construct a time series dataset for model training and prediction.

[0012] Furthermore, the step of extracting local feature sequences using a one-dimensional convolutional neural network includes: inputting the training set into the one-dimensional convolutional neural network, and extracting local feature sequences through convolutional layers, pooling layers, and fully connected layers; the local temporal features include concentration abrupt change features and trend fluctuation features; the convolutional layers use a sliding convolution mechanism to perform local perception and extract short-term temporal features, the pooling layers use a max pooling strategy to downsample the feature maps output by the convolutional layers, and the fully connected layers map the feature maps output by the pooling layers into fixed-dimensional feature vectors as local feature sequences.

[0013] Furthermore, the step of inputting the extracted local feature sequence into a bidirectional long short-term memory network to learn long-term dependencies along the forward and backward time dimensions to obtain a hidden state feature sequence includes: processing the local feature sequence from front to back along the time dimension using a forward long short-term memory network, and processing the local feature sequence from back to front along the time dimension using a backward long short-term memory network; concatenating the forward hidden state and the backward hidden state at each time step to construct the hidden state at that time step; and constructing the hidden state feature sequence based on the hidden states at each time step.

[0014] Furthermore, the method of dynamically assigning weights to the hidden state feature sequence at different time slices and different feature dimensions using a multi-head self-attention mechanism includes:

[0015] The multi-head self-attention mechanism calculates the attention score of each historical time step relative to the current time step by performing a dot product operation between the query vector and the key vector, and dynamically allocates weights from the time dimension.

[0016] By using multiple attention heads in parallel processing, each attention head uses an independent linear projection matrix to map the hidden state feature sequence to different feature subspaces, so that different attention heads focus on different combinations of feature dimensions and dynamically allocate weights from the feature dimensions.

[0017] Furthermore, the output of the three-level warning level and the corresponding maintenance intervention strategy includes: inputting the test set into the trained CNN-BiLSTM-MHA model, outputting the predicted air quality index for future periods, comparing the predicted air quality index for future periods with a preset health threshold or degradation trend threshold, mapping it to the three-level warning level, determining normal when the predicted air quality index is in the range of [0, 100], determining low severity fault when the predicted air quality index is in the range of (100, 200], determining high severity fault when the predicted air quality index is in the range of (200, 500], and generating the corresponding maintenance intervention strategy according to the level.

[0018] Furthermore, the synchronous display of regional risk status and the pre-simulation of the impact of different maintenance intervention strategies on air quality in the building digital twin platform include:

[0019] The predicted future air quality index, the three-level warning level, and the corresponding maintenance intervention strategies will be connected in real time to the BIM-based building digital twin platform;

[0020] In the 3D model of the digital twin platform, the air quality risk status is displayed synchronously in the corresponding floor and room areas using color gradients, flashing, or pop-up windows.

[0021] The pollutant diffusion trend after the implementation of different maintenance intervention strategies is simulated on a digital twin platform, and the temporal impact of each maintenance intervention strategy on air quality improvement is pre-simulated.

[0022] The present invention also provides an indoor air quality predictive maintenance system incorporating an attention mechanism, comprising:

[0023] The data acquisition module is used to collect multi-dimensional air quality index data and real air quality index in the building interior and preprocess them to build a time series dataset. The time series dataset is divided into training set and test set according to a preset ratio.

[0024] The model building module is used to build the CNN-BiLSTM-MHA model. It uses a one-dimensional convolutional neural network to extract local feature sequences. The extracted local feature sequences are then input into a bidirectional long short-term memory network to learn long-term dependencies along the forward and backward time dimensions to obtain the hidden state feature sequences. A multi-head self-attention mechanism is used to dynamically assign weights to the hidden state feature sequences at different time slices and different feature dimensions.

[0025] The training module is used to iteratively train the CNN-BiLSTM-MHA model on the training set by using the mean squared error between the air quality index predicted by the CNN-BiLSTM-MHA model and the actual air quality index in the training set as the loss function, so as to obtain the trained CNN-BiLSTM-MHA model.

[0026] The testing module is used to input the test set into the trained CNN-BiLSTM-MHA model, obtain the predicted air quality index for future periods, compare it with the preset health or degradation threshold, and output the three-level warning level and the corresponding maintenance intervention strategy.

[0027] The digital twin module is used to transmit the predicted air quality index, warning level and maintenance intervention strategy for future periods to the building digital twin platform in real time, simultaneously display the regional risk status, and simulate the impact of different maintenance intervention strategies on air quality in the building digital twin platform.

[0028] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above method.

[0029] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described method.

[0030] Beneficial effects: This invention provides a predictive maintenance method and system for indoor air quality that combines attention mechanisms. By introducing attention mechanisms, it enhances the ability to identify key pollutants, achieves accurate prediction and proactive maintenance, avoids health risks caused by air quality fluctuations, and improves system operating efficiency. Attached Figure Description

[0031] Figure 1 This is a framework diagram for a digital twin platform.

[0032] Figure 2 This is a block diagram of the CNN-BiLSTM-MHA model structure.

[0033] Figure 3 This is a UI diagram of an indoor air quality predictive maintenance system platform.

[0034] Figure 4 The figure shows the accuracy curves obtained from experiments conducted on the Woodlands dataset using CNN, LSTM, BiLSTM, and the CNN-BiLSTM-MHA model in normal scenarios.

[0035] Figure 5The graph shows the accuracy curves obtained from experiments conducted on the Woodlands dataset using CNN, LSTM, BiLSTM, and the CNN-BiLSTM-MHA model under normal conditions.

[0036] Figure 6 The image shows the recall curves obtained from experiments conducted on the Woodlands dataset using CNN, LSTM, BiLSTM, and the CNN-BiLSTM-MHA model under normal conditions.

[0037] Figure 7 The image shows the F1 score curves obtained from experiments conducted on the Woodlands dataset using CNN, LSTM, BiLSTM, and the CNN-BiLSTM-MHA model under normal conditions.

[0038] Figure 8 The image shows a comparison of F1 scores obtained from experiments conducted on the Redhill dataset using CNN, LSTM, BiLSTM, and CNN-BiLSTM-MHA models under normal, mild, and severe fault conditions.

[0039] Figure 9 The image shows a comparison of F1 scores obtained from experiments conducted on the Sengkang dataset using CNN, LSTM, BiLSTM, and CNN-BiLSTM-MHA models under normal, mild, and severe fault conditions.

[0040] Figure 10 The image shows a comparison of F1 scores obtained from experiments conducted on the Lakeside dataset using CNN, LSTM, BiLSTM, and CNN-BiLSTM-MHA models under normal, mild, and severe fault conditions. Detailed Implementation

[0041] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. After reading the present invention, any modifications of the present invention in various equivalent forms by those skilled in the art will fall within the scope defined by the appended claims.

[0042] Example 1

[0043] This invention provides a predictive maintenance method for indoor air quality that incorporates an attention mechanism, comprising:

[0044] Collect multidimensional air quality index data and real air quality index data of building interiors and preprocess them to construct a time series dataset. Divide the time series dataset into training set and test set according to a preset ratio.

[0045] A CNN-BiLSTM-MHA model was built, and a one-dimensional convolutional neural network was used to extract local feature sequences. The extracted local feature sequences were then input into a bidirectional long short-term memory network to learn long-term dependencies along the forward and backward time dimensions to obtain hidden state feature sequences. A multi-head self-attention mechanism was used to dynamically assign weights to the hidden state feature sequences at different time slices and different feature dimensions.

[0046] The mean squared error between the air quality index predicted by the CNN-BiLSTM-MHA model and the actual air quality index in the training set is used as the loss function to iteratively train the CNN-BiLSTM-MHA model and obtain the trained CNN-BiLSTM-MHA model.

[0047] The test set is input into the trained CNN-BiLSTM-MHA model to obtain the predicted air quality index for future periods, and compared with the preset health or degradation threshold to output a three-level warning level and corresponding maintenance intervention strategy.

[0048] The predicted air quality index, warning level, and maintenance intervention strategies for future periods are transmitted in real time to the building digital twin platform, which simultaneously displays the regional risk status and simulates the impact of different maintenance intervention strategies on air quality.

[0049] In this embodiment,

[0050] Multidimensional air quality index data are collected by sensors in different functional areas of the room at a preset sampling frequency; the collected multidimensional air quality index data are preprocessed to obtain standardized data, the preprocessing includes any one of linear interpolation of missing values, outlier removal and min-max normalization; a sliding time window mechanism is used to combine standardized data from several consecutive time steps into an input sample to construct a time series dataset for model training and prediction.

[0051] Specifically, multi-source environmental sensors are deployed in different functional areas of the building to continuously collect multi-dimensional air quality index data such as temperature, humidity, carbon dioxide concentration, PM2.5, and VOCs at a frequency of 5 seconds to 1 minute. The collected data undergoes linear interpolation for missing values, outlier removal, and min-max normalization to obtain standardized data. A sliding time window mechanism is used to combine standardized data from T consecutive time steps into one input sample, with the window sliding step size less than T to form sample overlap. Based on this, a time series dataset suitable for model training and prediction is constructed. The dataset is then divided into a training set and a test set in an 8:2 ratio.

[0052] like Figure 2 As shown, the CNN-BiLSTM-MHA model is built, including:

[0053] The training set is input into a one-dimensional convolutional neural network, and local feature sequences are extracted through convolutional layers, pooling layers, and fully connected layers. The local temporal features include concentration change features and trend fluctuation features. The convolutional layers use a sliding convolution mechanism to extract short-term temporal features through local perception. The pooling layers use a max pooling strategy to downsample the feature maps output by the convolutional layers. The fully connected layers map the feature maps output by the pooling layers into fixed-dimensional feature vectors as local feature sequences.

[0054] The local feature sequence is input into a bidirectional long short-term memory network. The forward long short-term memory network processes the local feature sequence from front to back along the time dimension, and the backward long short-term memory network processes the local feature sequence from back to front along the time dimension. At each time step, the forward hidden state and the backward hidden state are concatenated to construct the hidden state at that time step. The hidden state feature sequence is constructed based on the hidden states at each time step.

[0055] The hidden state feature sequence is input into the multi-head self-attention mechanism, and the attention score of each historical time step relative to the current time step is calculated by the dot product operation of the query vector and the key vector, and the weights are dynamically allocated from the time dimension.

[0056] By using multiple attention heads in parallel processing, each attention head uses an independent linear projection matrix to map the hidden state feature sequence to different feature subspaces, so that different attention heads focus on different combinations of feature dimensions and dynamically allocate weights from the feature dimensions.

[0057] Specifically, each sample in the training set is converted into an input vector and fed into a one-dimensional convolutional neural network. The vector is then processed sequentially through convolutional layers, pooling layers, and fully connected layers to extract local feature sequences of the pollutant concentration sequence. These local feature sequences include concentration abrupt change features (early fault signals) and trend fluctuation features (fault development trends). The convolutional layers are configured with customized one-dimensional convolutional kernels and utilize a sliding convolution mechanism to perform local perception on the input vector, capturing short-term temporal patterns. The feature mapping process of the convolutional layers satisfies the following formula:

[0058] ;

[0059] in, As the activation function, conv1D performs a one-dimensional convolution operation. It is the input vector at time step t. This represents the kernel weights at time step t. The kernel bias represents the convolutional kernel bias at time step t;

[0060] The pooling layer is located downstream of the convolutional layer. It uses a max pooling strategy to downsample the feature map output by the convolutional layer in order to reduce the feature dimension and suppress overfitting.

[0061] The fully connected layer is cascaded with the pooling layer to flatten the pooled multidimensional feature map and map it into a fixed-dimensional feature vector to construct a local feature sequence.

[0062] The extracted local feature sequences are input into a bidirectional long short-term memory network (BiLSTM), which learns long-term dependencies synchronously in the forward and backward directions along the time dimension, captures the dynamic evolution patterns and intrinsic correlation structures in the local feature sequences, and outputs the hidden state feature sequences.

[0063] The bidirectional long short-term memory network comprises a forward long short-term memory network and a backward long short-term memory network, which have the same structure and operate independently. Each long short-term memory unit updates its state according to the forget gate, input gate, and output gate.

[0064] The forgetting gate controls the degree to which existing memory states are retained. Memory states are information carriers of the forward long short-term memory network and the backward long short-term memory network, used to store and transmit long-term dependent information. The formula is:

[0065] ;

[0066] The input gate controls the degree to which new information is written and generates candidate memory states, using the following formula:

[0067] ;

[0068] ;

[0069] Memory state updates are achieved by fusing historical memory states with candidate memory states, using the following formula:

[0070] ;

[0071] The output gate controls the output level of the hidden state, and the formula is:

[0072] ;

[0073] ;

[0074] in, It is the forgetting gate of time step t. It is the input gate for time step t. It is the output gate of time step t. For creating candidate memory states at time step t, To update the memory state at time step t, The hidden state at time step t. For activation function, It is a local feature sequence at time step t. For the weight of the forget gate, To offset the forget gate, For the input gate weights, For input gate bias, For candidate memory state weights, Bias for candidate memory states For the output gate weights, The output gate weights;

[0075] Two independent long short-term memory networks for a given sequence X = { , , … The sequence of the forward LSTM starts from... arrive The sequence of the backward LSTM from arrive Where T is the length of the sequence. This is the input at time step t. At each time step, BiLSTM concatenates the forward hidden state and the backward hidden state to construct the hidden state for that time step, and constructs the hidden state feature sequence based on the hidden state at each time step.

[0076] A multi-head attention mechanism is used to calculate attention weights using the query vector Q, key vector K, and value vector V, where:

[0077] The query vector Q represents the query information at the current time step, which is used to match the key vectors of historical time steps;

[0078] The key vector K represents the index information at each historical time step and is used to calculate the relevance score with the query vector;

[0079] The value vector V represents the actual feature information at each historical time step, which is used for weighted fusion to generate the output representation;

[0080] Single-head attention calculates attention weights based on Q, K, and V vectors, using the following formula:

[0081] ;

[0082] in, It is the dimension of the K vector. Used to scale the dot product result and prevent gradient vanishing;

[0083] The multi-head self-attention mechanism employs h attention heads for parallel computation. Each attention head maps Q, K, and V to different feature subspaces through independent and learnable linear projections to capture diverse contextual information. The formula is as follows:

[0084] ;

[0085] in, and , , It is the parameter matrix corresponding to Q, K, and V;

[0086] The multi-head self-attention mechanism outputs a weighted and fused contextual feature vector, enabling dynamic weight allocation to the hidden state feature sequence. Therefore, by employing the multi-head self-attention mechanism, weights can be dynamically allocated to the hidden state feature sequence at different time steps and in different feature dimensions, giving higher attention to key pollution events or implicit degradation patterns, thereby fusing fine-grained contextual information and enhancing prediction and discrimination capabilities.

[0087] The CNN-BiLSTM-MHA model was trained on the training set. In this embodiment, PyTorch 2.0.1 was used as the deep learning framework, and the best model performance was achieved through hyperparameter tuning: the convergence step size of the optimization algorithm was set to 0.0001, the training iterations were 500, and 64 samples were processed in each optimization step to balance memory usage and training stability; both the convolutional layer and the long short-term memory network layer were set to 2 layers, with 32 neurons in each layer, and the adaptive moment estimation (Adam) was selected as the optimization function to achieve efficient and stable convergence; the effectiveness of the proposed method was verified by comparative analysis of statistical indicators such as time series plots, confusion matrix, and training time.

[0088] The training process sequentially involves model initialization, forward propagation, loss calculation, and backpropagation optimization: the training data is randomly shuffled and divided into multiple batches, each containing 64 samples, and the data is iteratively input into the model batch by batch; each batch of data undergoes nonlinear transformation by convolutional layers, temporal modeling by a bidirectional long short-term memory network, and weighted fusion by a multi-head self-attention mechanism, and finally the prediction result is output by a fully connected layer; after calculating the loss function between the predicted value and the true label, the gradient is calculated using the backpropagation algorithm, and the model parameters are updated using the Adam optimizer; the above process is repeated until all batches are traversed to complete one epoch of training, for a total of 500 epochs until the model converges.

[0089] The test set is input into the trained CNN-BiLSTM-MHA model, which outputs the predicted air quality index for future periods. The predicted air quality index for future periods is compared with the preset health threshold or degradation trend threshold and mapped to a three-level warning level. When the predicted air quality index is in the range of [0,100], it is judged as normal; when the predicted air quality index is in the range of (100,200], it is judged as a low-severity fault; and when the predicted air quality index is in the range of (200,500], it is judged as a high-severity fault. Based on the level, the corresponding maintenance intervention strategy is generated.

[0090] In addition, mean absolute error (MAE) and root mean square error (RMSE) are calculated to evaluate the prediction results of the original composite index. Classification metrics, including accuracy, precision, recall, and F1 score, are used to evaluate the performance of the classification model. Determining whether the model has met training expectations is achieved by examining its performance superiority and robustness. This invention uses different prediction periods, severity levels, and dataset segments to evaluate model performance. The prediction period is adjusted by setting test sets of different lengths, while the training dataset remains unchanged.

[0091] The predicted future air quality index, the three-level warning level, and the corresponding maintenance intervention strategies will be connected in real time to the BIM-based building digital twin platform;

[0092] In the 3D model of the digital twin platform, the air quality risk status is displayed synchronously in the corresponding floor and room areas using color gradients, flashing, or pop-up windows.

[0093] The pollutant diffusion trend after the implementation of different maintenance intervention strategies is simulated on a digital twin platform, and the temporal impact of each maintenance intervention strategy on air quality improvement is pre-simulated.

[0094] Specifically, the predicted air quality index, the three-level warning level, and the corresponding maintenance intervention strategy for the future time period are transmitted in real time to a BIM-based building digital twin platform. This platform adopts a layered architecture, such as... Figure 1As shown, it includes: a physical layer, a virtual layer, a digital twin layer, and a decision support layer. The physical layer consists of IoT sensors deployed in various functional areas of the building, collecting and uploading air quality data in real time via multi-mode communication protocols such as Wi-Fi / Bluetooth / 4G / 5G / Zigbee / LoRaWAN. The virtual layer uses iScan2BIM technology to convert the physical building into point cloud data, and generates a 3D BIM model through spatial area division and artificial intelligence reconstruction, realizing a digital twin of the building space. The digital twin layer integrates a cloud platform and a CNN-BiLSTM-MHA prediction model to clean and analyze the real-time operating data uploaded by the physical layer, generating predictive maintenance instructions. The decision support layer displays the prediction results in the corresponding floor and room areas of the 3D model in a color gradient, flashing, or pop-up manner to synchronously display the air quality risk status, and rehearses the temporal impact of different maintenance strategies (such as increasing exhaust ventilation, activating purification, etc.) on the pollutant diffusion trend in the virtual space. Figure 3 As shown, users can interactively query the remaining time of pollution forecasts for each area, maintenance recommendations, and the effectiveness of strategy implementation through the platform, thus realizing a shift from a passive monitoring to a proactive decision-making operation and maintenance model.

[0095] To verify the stability and universality of the proposed method, the data collection system was deployed in four buildings in Singapore (Woodlands, Redhill, Sengkang, and Lakeside) for four months, collecting over 170,000 real data points. Different prediction durations (10 minutes, 30 minutes, and 60 minutes) and anomaly severity were set, and comparative experiments were conducted with CNN, LSTM, and BiLSTM models to evaluate accuracy, precision, recall, and F1 score. The comparative experimental results in Woodlands under normal scenarios are as follows: Figures 4-7 As shown in the figure, the CNN-BiLSTM-MHA model proposed in this invention has the highest accuracy, recall, and F1 score. The F1 scores of the CNN, LSTM, BiLSTM, and CNN-BiLSTM-MHA models are compared on the Redhill, Sengkang, and Lakeside datasets under normal, mild, and severe fault conditions. Figures 8-10 As shown in the figure, the CNN-BiLSTM-MHA model proposed in this invention improves the F1 score by 8%-15% compared to LSTM and CNN models, especially in the prediction of severe anomalies, achieving early warning and reducing the need for manual intervention.

[0096] Traditional methods are mostly reactive, triggering alarms only after pollution occurs. This invention, by fusing CNN, BiLSTM, and the multi-head self-attention mechanism (MHA), extracts local abrupt changes and long-term temporal dependencies from air quality data, enhancing the model's ability to model complex nonlinear dynamic changes. Furthermore, by predicting future air quality indices and combining this with a three-level early warning mechanism, it achieves proactive warning and intervention, preventing the impact of deteriorating air quality on public health. Experimental results on multiple real-world building datasets in Singapore demonstrate that the CNN-BiLSTM-MHA model outperforms LSTM and CNN models in terms of performance metrics, particularly excelling in predicting severe pollution events.

[0097] Furthermore, by integrating with a building digital twin platform, this invention can simulate the effects of different maintenance strategies (such as turning on purification equipment and adjusting the ventilation system) on air quality in a virtual space, helping maintenance personnel to formulate optimal strategies and avoid blind operations and waste of resources.

[0098] Example 2

[0099] Based on Embodiment 1, the present invention also provides an indoor air quality predictive maintenance system incorporating an attention mechanism, comprising:

[0100] The data acquisition module is used to collect multi-dimensional air quality index data and real air quality index in the building interior and preprocess them to build a time series dataset. The time series dataset is divided into training set and test set according to a preset ratio.

[0101] The model building module is used to build the CNN-BiLSTM-MHA model. It uses a one-dimensional convolutional neural network to extract local feature sequences. The extracted local feature sequences are then input into a bidirectional long short-term memory network to learn long-term dependencies along the forward and backward time dimensions to obtain the hidden state feature sequences. A multi-head self-attention mechanism is used to dynamically assign weights to the hidden state feature sequences at different time slices and different feature dimensions.

[0102] The training module is used to iteratively train the CNN-BiLSTM-MHA model on the training set by using the mean squared error between the air quality index predicted by the CNN-BiLSTM-MHA model and the actual air quality index in the training set as the loss function, so as to obtain the trained CNN-BiLSTM-MHA model.

[0103] The testing module is used to input the test set into the trained CNN-BiLSTM-MHA model, obtain the predicted air quality index for future periods, compare it with the preset health or degradation threshold, and output the three-level warning level and the corresponding maintenance intervention strategy.

[0104] The digital twin module is used to transmit the predicted air quality index, warning level and maintenance intervention strategy for future periods to the building digital twin platform in real time, simultaneously display the regional risk status, and simulate the impact of different maintenance intervention strategies on air quality in the building digital twin platform.

[0105] In this embodiment,

[0106] The data acquisition module collects multidimensional air quality index data at a preset sampling frequency through sensors in different functional areas of the room; the collected multidimensional air quality index data is preprocessed to obtain standardized data, the preprocessing includes any one of linear interpolation of missing values, outlier removal, and min-max normalization; a sliding time window mechanism is used to combine standardized data from several consecutive time steps into an input sample to construct a time series dataset for model training and prediction.

[0107] Specifically, multi-source environmental sensors are deployed in different functional areas of the building to continuously collect multi-dimensional air quality index data such as temperature, humidity, carbon dioxide concentration, PM2.5, and VOCs at a frequency of 5 seconds to 1 minute. The collected data undergoes linear interpolation for missing values, outlier removal, and min-max normalization to obtain standardized data. A sliding time window mechanism is used to combine standardized data from T consecutive time steps into one input sample, with the window sliding step size less than T to form sample overlap. Based on this, a time series dataset suitable for model training and prediction is constructed. The dataset is then divided into a training set and a test set in an 8:2 ratio.

[0108] like Figure 2 As shown, the model building module is used to build the CNN-BiLSTM-MHA model, including:

[0109] The training set is input into a one-dimensional convolutional neural network, and local feature sequences are extracted through convolutional layers, pooling layers, and fully connected layers. The local temporal features include concentration change features and trend fluctuation features. The convolutional layers use a sliding convolution mechanism to extract short-term temporal features through local perception. The pooling layers use a max pooling strategy to downsample the feature maps output by the convolutional layers. The fully connected layers map the feature maps output by the pooling layers into fixed-dimensional feature vectors as local feature sequences.

[0110] The local feature sequence is input into a bidirectional long short-term memory network. The forward long short-term memory network processes the local feature sequence from front to back along the time dimension, and the backward long short-term memory network processes the local feature sequence from back to front along the time dimension. At each time step, the forward hidden state and the backward hidden state are concatenated to construct the hidden state at that time step. The hidden state feature sequence is constructed based on the hidden states at each time step.

[0111] The hidden state feature sequence is input into the multi-head self-attention mechanism, and the attention score of each historical time step relative to the current time step is calculated by the dot product operation of the query vector and the key vector, and the weights are dynamically allocated from the time dimension.

[0112] By using multiple attention heads in parallel processing, each attention head uses an independent linear projection matrix to map the hidden state feature sequence to different feature subspaces, so that different attention heads focus on different combinations of feature dimensions and dynamically allocate weights from the feature dimensions.

[0113] Specifically, each sample in the training set is converted into an input vector and fed into a one-dimensional convolutional neural network. The vector is then processed sequentially through convolutional layers, pooling layers, and fully connected layers to extract local feature sequences of the pollutant concentration sequence. These local feature sequences include concentration abrupt change features (early fault signals) and trend fluctuation features (fault development trends). The convolutional layers are configured with customized one-dimensional convolutional kernels and utilize a sliding convolution mechanism to perform local perception on the input vector, capturing short-term temporal patterns. The feature mapping process of the convolutional layers satisfies the following formula:

[0114] ;

[0115] in, As the activation function, conv1D performs a one-dimensional convolution operation. It is the input vector at time step t. This represents the kernel weights at time step t. The kernel bias represents the convolutional kernel bias at time step t;

[0116] The pooling layer is located downstream of the convolutional layer. It uses a max pooling strategy to downsample the feature map output by the convolutional layer in order to reduce the feature dimension and suppress overfitting.

[0117] The fully connected layer is cascaded with the pooling layer to flatten the pooled multidimensional feature map and map it into a fixed-dimensional feature vector to construct a local feature sequence.

[0118] The extracted local feature sequences are input into a bidirectional long short-term memory network (BiLSTM), which learns long-term dependencies synchronously in the forward and backward directions along the time dimension, captures the dynamic evolution patterns and intrinsic correlation structures in the local feature sequences, and outputs the hidden state feature sequences.

[0119] The bidirectional long short-term memory network comprises a forward long short-term memory network and a backward long short-term memory network, which have the same structure and operate independently. Each long short-term memory unit updates its state according to the forget gate, input gate, and output gate.

[0120] The forgetting gate controls the degree to which existing memory states are retained. Memory states are information carriers of the forward long short-term memory network and the backward long short-term memory network, used to store and transmit long-term dependent information. The formula is:

[0121] ;

[0122] The input gate controls the degree to which new information is written and generates candidate memory states, using the following formula:

[0123] ;

[0124] ;

[0125] Memory state updates are achieved by fusing historical memory states with candidate memory states, using the following formula:

[0126] ;

[0127] The output gate controls the output level of the hidden state, and the formula is:

[0128] ;

[0129] ;

[0130] in, It is the forgetting gate of time step t. It is the input gate for time step t. It is the output gate of time step t. For creating candidate memory states at time step t, To update the memory state at time step t, The hidden state at time step t. For activation function, It is a local feature sequence at time step t. For the weight of the forget gate, To offset the forget gate, For the input gate weights, For input gate bias, For candidate memory state weights, Bias for candidate memory states For the output gate weights, The output gate weights;

[0131] Two independent long short-term memory networks for a given sequence X = { , , … The sequence of the forward LSTM starts from... arrive The sequence of the backward LSTM from arrive Where T is the length of the sequence. This is the input at time step t. At each time step, BiLSTM concatenates the forward hidden state and the backward hidden state to construct the hidden state for that time step, and constructs the hidden state feature sequence based on the hidden state at each time step.

[0132] A multi-head attention mechanism is used to calculate attention weights using the query vector Q, key vector K, and value vector V, where:

[0133] The query vector Q represents the query information at the current time step, which is used to match the key vectors of historical time steps;

[0134] The key vector K represents the index information at each historical time step and is used to calculate the relevance score with the query vector;

[0135] The value vector V represents the actual feature information at each historical time step, which is used for weighted fusion to generate the output representation;

[0136] Single-head attention calculates attention weights based on Q, K, and V vectors, using the following formula:

[0137] ;

[0138] in, It is the dimension of the K vector. Used to scale the dot product result and prevent gradient vanishing;

[0139] The multi-head self-attention mechanism employs h attention heads for parallel computation. Each attention head maps Q, K, and V to different feature subspaces through independent and learnable linear projections to capture diverse contextual information. The formula is as follows:

[0140] ;

[0141] in, and , , It is the parameter matrix corresponding to Q, K, and V;

[0142] The multi-head self-attention mechanism outputs a weighted and fused contextual feature vector, enabling dynamic weight allocation to the hidden state feature sequence. Therefore, by employing the multi-head self-attention mechanism, weights can be dynamically allocated to the hidden state feature sequence at different time steps and in different feature dimensions, giving higher attention to key pollution events or implicit degradation patterns, thereby fusing fine-grained contextual information and enhancing prediction and discrimination capabilities.

[0143] The training module trains the CNN-BiLSTM-MHA model on the training set. In this embodiment, PyTorch 2.0.1 is used as the deep learning framework, and the best model performance is achieved through hyperparameter tuning: the convergence step size of the optimization algorithm is set to 0.0001, the training iteration is 500 times, and 64 samples are processed in each optimization step to balance memory usage and training stability; both the convolutional layer and the long short-term memory network layer are set to 2 layers, with 32 neurons in each layer, and the adaptive moment estimation (Adam) is selected as the optimization function to achieve efficient and stable convergence; the effectiveness of the proposed method is verified by comparative analysis of statistical indicators such as time series plots, confusion matrix, and training time.

[0144] The training process sequentially involves model initialization, forward propagation, loss calculation, and backpropagation optimization: the training data is randomly shuffled and divided into multiple batches, each containing 64 samples, and the data is iteratively input into the model batch by batch; each batch of data undergoes nonlinear transformation by convolutional layers, temporal modeling by a bidirectional long short-term memory network, and weighted fusion by a multi-head self-attention mechanism, and finally the prediction result is output by a fully connected layer; after calculating the loss function between the predicted value and the true label, the gradient is calculated using the backpropagation algorithm, and the model parameters are updated using the Adam optimizer; the above process is repeated until all batches are traversed to complete one epoch of training, for a total of 500 epochs until the model converges.

[0145] The testing module inputs the test set into the trained CNN-BiLSTM-MHA model and outputs the predicted air quality index for future periods. It compares the predicted air quality index for future periods with the preset health threshold or degradation trend threshold and maps it to a three-level warning level. When the predicted air quality index is in the range of [0,100], it is judged as normal; when the predicted air quality index is in the range of (100,200], it is judged as a low-severity fault; and when the predicted air quality index is in the range of (200,500], it is judged as a high-severity fault. Based on the level, the corresponding maintenance intervention strategy is generated.

[0146] In addition, mean absolute error (MAE) and root mean square error (RMSE) are calculated to evaluate the prediction results of the original composite index. Classification metrics, including accuracy, precision, recall, and F1 score, are used to evaluate the performance of the classification model. Determining whether the model has met training expectations is achieved by examining its performance superiority and robustness. This invention uses different prediction periods, severity levels, and dataset segments to evaluate model performance. The prediction period is adjusted by setting test sets of different lengths, while the training dataset remains unchanged.

[0147] The digital twin module will connect the predicted future air quality index, the three-level warning level, and the corresponding maintenance intervention strategy to the BIM-based building digital twin platform in real time;

[0148] In the 3D model of the digital twin platform, the air quality risk status is displayed synchronously in the corresponding floor and room areas using color gradients, flashing, or pop-up windows.

[0149] The pollutant diffusion trend after the implementation of different maintenance intervention strategies is simulated on a digital twin platform, and the temporal impact of each maintenance intervention strategy on air quality improvement is pre-simulated.

[0150] Specifically, the predicted air quality index, the three-level warning level, and the corresponding maintenance intervention strategy for the future time period are transmitted in real time to a BIM-based building digital twin platform. This platform adopts a layered architecture, such as... Figure 1 As shown, it includes: a physical layer, a virtual layer, a digital twin layer, and a decision support layer. The physical layer consists of IoT sensors deployed in various functional areas of the building, collecting and uploading air quality data in real time via multi-mode communication protocols such as Wi-Fi / Bluetooth / 4G / 5G / Zigbee / LoRaWAN. The virtual layer uses iScan2BIM technology to convert the physical building into point cloud data, and generates a 3D BIM model through spatial area division and artificial intelligence reconstruction, realizing a digital twin of the building space. The digital twin layer integrates a cloud platform and a CNN-BiLSTM-MHA prediction model to clean and analyze the real-time operating data uploaded by the physical layer, generating predictive maintenance instructions. The decision support layer displays the prediction results in the corresponding floor and room areas of the 3D model in a color gradient, flashing, or pop-up manner to synchronously display the air quality risk status, and rehearses the temporal impact of different maintenance strategies (such as increasing exhaust ventilation, activating purification, etc.) on the pollutant diffusion trend in the virtual space. Figure 3 As shown, users can interactively query the remaining time of pollution forecasts for each area, maintenance recommendations, and the effectiveness of strategy implementation through the platform, thus realizing a shift from a passive monitoring to a proactive decision-making operation and maintenance model.

[0151] To verify the stability and universality of the proposed method, the data collection system was deployed in four buildings in Singapore (Woodlands, Redhill, Sengkang, and Lakeside) for four months, collecting over 170,000 real data points. Different prediction durations (10 minutes, 30 minutes, and 60 minutes) and anomaly severity were set, and comparative experiments were conducted with CNN, LSTM, and BiLSTM models to evaluate accuracy, precision, recall, and F1 score. The comparative experimental results in Woodlands under normal scenarios are as follows: Figures 4-7As shown in the figure, the CNN-BiLSTM-MHA model proposed in this invention has the highest accuracy, recall, and F1 score. The F1 scores of the CNN, LSTM, BiLSTM, and CNN-BiLSTM-MHA models are compared on the Redhill, Sengkang, and Lakeside datasets under normal, mild, and severe fault conditions. Figures 8-10 As shown in the figure, the CNN-BiLSTM-MHA model proposed in this invention improves the F1 score by 8%-15% compared to LSTM and CNN models, especially in the prediction of severe anomalies, achieving early warning and reducing the need for manual intervention.

[0152] Traditional methods are mostly reactive, triggering alarms only after pollution occurs. This invention, by fusing CNN, BiLSTM, and the multi-head self-attention mechanism (MHA), extracts local abrupt changes and long-term temporal dependencies from air quality data, enhancing the model's ability to model complex nonlinear dynamic changes. Furthermore, by predicting future air quality indices and combining this with a three-level early warning mechanism, it achieves proactive warning and intervention, preventing the impact of deteriorating air quality on public health. Experimental results on multiple real-world building datasets in Singapore demonstrate that the CNN-BiLSTM-MHA model outperforms LSTM and CNN models in terms of performance metrics, particularly excelling in predicting severe pollution events.

[0153] Furthermore, by integrating with a building digital twin platform, this invention can simulate the effects of different maintenance strategies (such as turning on purification equipment and adjusting the ventilation system) on air quality in a virtual space, helping maintenance personnel to formulate optimal strategies and avoid blind operations and waste of resources.

Claims

1. A predictive maintenance method for indoor air quality that incorporates attention mechanisms, characterized in that, include: Collect multidimensional air quality index data and real air quality index data of building interiors and preprocess them to construct a time series dataset. Divide the time series dataset into training set and test set according to a preset ratio. A CNN-BiLSTM-MHA model was built, and a one-dimensional convolutional neural network was used to extract local feature sequences. The extracted local feature sequences were then input into a bidirectional long short-term memory network to learn long-term dependencies along the forward and backward time dimensions to obtain hidden state feature sequences. A multi-head self-attention mechanism was used to dynamically assign weights to the hidden state feature sequences at different time slices and different feature dimensions. The mean squared error between the air quality index predicted by the CNN-BiLSTM-MHA model and the actual air quality index in the training set is used as the loss function to iteratively train the CNN-BiLSTM-MHA model and obtain the trained CNN-BiLSTM-MHA model. The test set is input into the trained CNN-BiLSTM-MHA model to obtain the predicted air quality index for future periods, and compared with the preset health or degradation threshold to output a three-level warning level and corresponding maintenance intervention strategy. The predicted air quality index, warning level, and maintenance intervention strategies for future periods are transmitted in real time to the building digital twin platform, which simultaneously displays the regional risk status and simulates the impact of different maintenance intervention strategies on air quality.

2. The indoor air quality predictive maintenance method incorporating attention mechanisms according to claim 1, characterized in that, The constructed time series dataset includes: Multidimensional air quality index data are collected by sensors in different functional areas of the room at a preset sampling frequency; the collected multidimensional air quality index data are preprocessed to obtain standardized data, the preprocessing includes any one of linear interpolation of missing values, outlier removal and min-max normalization; a sliding time window mechanism is used to combine standardized data from several consecutive time steps into an input sample to construct a time series dataset for model training and prediction.

3. The indoor air quality predictive maintenance method incorporating attention mechanisms according to claim 2, characterized in that, The method of extracting local feature sequences using a one-dimensional convolutional neural network includes: inputting the training set into the one-dimensional convolutional neural network, and extracting local feature sequences through convolutional layers, pooling layers, and fully connected layers; the local temporal features include concentration abrupt change features and trend fluctuation features; the convolutional layers use a sliding convolution mechanism to perform local perception and extract short-term temporal features, the pooling layers use a max pooling strategy to downsample the feature maps output by the convolutional layers, and the fully connected layers map the feature maps output by the pooling layers into fixed-dimensional feature vectors as local feature sequences.

4. The indoor air quality predictive maintenance method incorporating attention mechanisms according to claim 3, characterized in that, The step of inputting the extracted local feature sequence into a bidirectional long short-term memory network to learn long-term dependencies along the forward and backward time dimensions to obtain a hidden state feature sequence includes: processing the local feature sequence from front to back along the time dimension using a forward long short-term memory network, and processing the local feature sequence from back to front along the time dimension using a backward long short-term memory network; concatenating the forward hidden state and the backward hidden state at each time step to construct the hidden state at that time step; and constructing the hidden state feature sequence based on the hidden states at each time step.

5. The indoor air quality predictive maintenance method incorporating attention mechanisms according to claim 4, characterized in that, The method of dynamically assigning weights to the hidden state feature sequence at different time slices and different feature dimensions using a multi-head self-attention mechanism includes: The multi-head self-attention mechanism calculates the attention score of each historical time step relative to the current time step by performing a dot product operation between the query vector and the key vector, and dynamically allocates weights from the time dimension. By using multiple attention heads in parallel processing, each attention head uses an independent linear projection matrix to map the hidden state feature sequence to different feature subspaces, so that different attention heads focus on different combinations of feature dimensions and dynamically allocate weights from the feature dimensions.

6. The indoor air quality predictive maintenance method incorporating attention mechanisms according to claim 1, characterized in that, The output of the three-level warning level and the corresponding maintenance intervention strategy includes: inputting the test set into the trained CNN-BiLSTM-MHA model, outputting the predicted air quality index for future periods, comparing the predicted air quality index for future periods with a preset health threshold or degradation trend threshold, mapping it to the three-level warning level, determining normal when the predicted air quality index is in the range of [0,100], determining low severity fault when the predicted air quality index is in the range of (100,200], determining high severity fault when the predicted air quality index is in the range of (200,500], and generating the corresponding maintenance intervention strategy according to the level.

7. The indoor air quality predictive maintenance method incorporating attention mechanisms according to claim 1, characterized in that, The synchronous display of regional risk status and the pre-simulation of the impact of different maintenance intervention strategies on air quality in the building digital twin platform include: The predicted future air quality index, the three-level warning level, and the corresponding maintenance intervention strategies will be connected in real time to the BIM-based building digital twin platform; In the 3D model of the digital twin platform, the air quality risk status is displayed synchronously in the corresponding floor and room areas using color gradients, flashing, or pop-up windows. The pollutant diffusion trend after the implementation of different maintenance intervention strategies is simulated on a digital twin platform, and the temporal impact of each maintenance intervention strategy on air quality improvement is pre-simulated.

8. A predictive maintenance system for indoor air quality incorporating attention mechanisms, characterized in that, include: The data acquisition module is used to collect multi-dimensional air quality index data and real air quality index in the building interior and preprocess them to build a time series dataset. The time series dataset is divided into training set and test set according to a preset ratio. The model building module is used to build the CNN-BiLSTM-MHA model. It uses a one-dimensional convolutional neural network to extract local feature sequences. The extracted local feature sequences are then input into a bidirectional long short-term memory network to learn long-term dependencies along the forward and backward time dimensions to obtain the hidden state feature sequences. A multi-head self-attention mechanism is used to dynamically assign weights to the hidden state feature sequences at different time slices and different feature dimensions. The training module is used to iteratively train the CNN-BiLSTM-MHA model on the training set by using the mean squared error between the air quality index predicted by the CNN-BiLSTM-MHA model and the actual air quality index in the training set as the loss function, so as to obtain the trained CNN-BiLSTM-MHA model. The testing module is used to input the test set into the trained CNN-BiLSTM-MHA model, obtain the predicted air quality index for future periods, compare it with the preset health or degradation threshold, and output the three-level warning level and the corresponding maintenance intervention strategy. The digital twin module is used to transmit the predicted air quality index, warning level and maintenance intervention strategy for future periods to the building digital twin platform in real time, simultaneously display the regional risk status, and simulate the impact of different maintenance intervention strategies on air quality in the building digital twin platform.

9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.