欢迎您访问《智慧农业(中英文)》官方网站! English

Smart Agriculture ›› 2026, Vol. 8 ›› Issue (1): 148-155.doi: 10.12133/j.smartag.SA202506033

• 信息处理与决策 • 上一篇    

基于自适应Kalman滤波与GWO-LSTM-Attention的温室温湿度预测方法

蔡玉琴(), 刘大铭(), 徐琴, 李波洋, 刘博杰   

  1. 宁夏大学 电子与电气工程学院,宁夏 银川 750000,中国
  • 收稿日期:2025-06-25 出版日期:2026-01-30
  • 基金项目:
    宁夏自然科学基金项目(2024AAC03090)
  • 作者简介:

    蔡玉琴,硕士研究生,研究方向为新一代网络技术与机器人智能控制。E-mail:

  • 通信作者:
    刘大铭,硕士,教授,研究方向为嵌入式系统与物联网技术。E-mail:

Greenhouse Temperature and Humidity Prediction Method Based on Adaptive Kalman Filter and GWO-LSTM-Attention

CAI Yuqin(), LIU Daming(), XU Qin, LI Boyang, LIU Bojie   

  1. School of Electronic and Electrical Engineering, Ningxia University, Ningxia 750000, China
  • Received:2025-06-25 Online:2026-01-30
  • Foundation items:Natural Science Foundation of Ningxia Hui Autonomous Region(2024AAC03090)
  • About author:

    CAI Yuqin, E-mail:

  • Corresponding author:
    LIU Daming, E-mail:

摘要:

[目的/意义] 针对温室温湿度预测中多传感器数据融合可靠性低、传统模型忽略温湿度动态耦合,以及参数调优依赖人工经验等问题。 [方法] 首先,对传统卡尔曼(Kalman)滤波算法实施改进,通过动态调整过程噪声协方差和观测噪声协方差,结合新息方差动态分配多传感器权重。其次,针对温湿度的强耦合性及其协同控制的需求,构建多输出长短期记忆-注意力机制(Long Short-Term Memory -Attention, LSTM-Attention)模型,以温湿度协同预测为目标,引入注意力机制自适应加权关键环境因子,并采用灰狼优化算法(Grey Wolf Optimizer, GWO)自动对超参数进行寻优。 [结果和讨论]] 提出的自适应卡尔曼滤波算法在多点温湿度融合中的平均绝对偏差分别为1.59 ℃和8.64%,比传统卡尔曼滤波算法分别降低1.24%、8.57%。以该算法融合结果作为模型训练集,模型在温湿度预测中决定系数R2分别达到98.2%和99.3%,比传统Kalman提升4.7%和4.3%。GWO-LSTM-Attention模型的温湿度预测均方根误差分别为0.776 8 ℃和2.056 4%,比LSTM、LSTM-Attention时间序列预测模型分别降低15.6%、6.6%,湿度分别降低29.2%、5.7%。 [结论] 提出的自适应卡尔曼融合算法能够有效抑制异常值影响,可在非平稳环境变化下实现多传感器数据可靠融合。在温室多环境因子预测中,GWO-LSTM-Attention模型温湿度预测值在未来可作为控制温室环境的重要参考,进而实现对温室环境的实时调控。

关键词: 日光温室, 卡尔曼滤波, 灰狼优化算法, 长短期记忆神经网络, 注意力机制

Abstract:

[Objective] Acquiring valid data is a critical part for establishing accurate greenhouse prediction models. However, simple averaging and weighted averaging are commonly used to process multi-sensor data in current research, but these methods are often ineffective against sensor noise interference. Additionally, greenhouse temperature and humidity exhibit strong coupling characteristics that necessitate coordinated control strategies. Prevailing studies predominantly train separate models for temperature and humidity prediction, which risks generating physically inconsistent results (e.g., simultaneous high temperature and high humidity), using it as the basis for control may lack reliability. Furthermore, the multi-dimensional environmental factor data in greenhouses has the characteristics of large volume and high computational cost. In the training process of the traditional LSTM model, parameters are manually adjusted based on human experience. When dealing with high-dimensional data, the model's convergence is slow and it is prone to getting stuck in local optima. [Methods] To address multi-point data fusion challenges, the traditional Kalman filtering algorithm was improved by dynamically adjusting the process noise covariance (Q) and observation noise covariance (R), while adaptively assigning weights to multiple sensors based on the innovation. This adaptation was achieved by monitoring the innovation sequence—the difference between observed and predicted measurements. Furthermore, the algorithm utilized the innovation covariance to assign adaptive weights to multiple sensors. Sensors with consistently smaller innovations which indicated higher reliability, were assigned greater weights. This mechanism enabled the system to swiftly identify and mitigate the impact of abnormal sensor readings, thereby ensuring robust and accurate fusion of multi-sensor data and providing a reliable foundation for subsequent model training. To address the strong coupling between temperature and humidity and their collaborative control requirements, a multi-output LSTM-attention model was developed for joint temperature-humidity prediction within a unified architecture. This model employed an attention mechanism to adaptively weight critical environmental factors, thereby resolving physical constraint violations inherent in univariate forecasting approaches. The multi-dimensional nature of greenhouse environmental data often leads to high computational costs during model training. In traditional practices, the hyperparameters of LSTM models were often manually tuned based on experience, a process that was not only inefficient but also prone to suboptimal convergence and local optima traps, especially with high-dimensional data. To overcome this limitation, the grey wolf optimizer (GWO) was integrated to automatically perform hyperparameter optimization search and efficiently search for the optimal combination of key hyperparameters, such as the number of hidden units, learning rate, and dropout rate. [Results and Discussions] The adaptive Kalman filtering algorithm proposed achieved mean absolute deviations (MAD) of 1.59 ℃ and 8.64% for multi-point temperature and humidity fusion, respectively. Compared to the traditional Kalman filter algorithm, these represented reductions of 1.24% and 8.57%. The algorithm enabled swift identification of abnormal sensors and effectively mitigated their impact. When utilizing the fusion results of this algorithm as the model training dataset, the R2 values for temperature and humidity predictions reached 98.2% and 99.3%, respectively. This constituted an increase of 4.7 and 4.3 percentage points compared to results obtained using the Kalman filter, demonstrating that the algorithm provided a highly reliable data foundation for model training. Furthermore, the GWO-LSTM-Attention model trained on this data yielded root mean square errors (RMSE) of 0.776 8 and 2.056 4 for temperature and humidity prediction, respectively. Compared to the LSTM and LSTM-Attention time-series prediction models, the temperature RMSE was reduced by 15.6% and 6.6%, while the humidity RMSE saw reductions of 29.2% and 5.7%. This reflects the role of the GWO algorithm in enhancing model generalization capability and convergence efficiency. [Conclusions] The proposed adaptive Kalman fusion algorithm effectively integrates multi-sensor data, demonstrating robustness in handling sensor noise, outliers, and non-stationary environmental fluctuations. For predicting multiple greenhouse environmental factors, the developed GWO-LSTM-Attention model provides reliable forecasts across diverse time horizons. This study can provide a highly accurate prediction tool for greenhouse environment control. The combined prediction results could directly support the coordinated control of ventilation and irrigation equipment in the future, thereby reducing energy consumption.

Key words: solar greenhouse, Kalman filter, grey wolf optimization algorithm, long short-term memory neural network, attention mechanism

中图分类号: