Temperature prediction of intensive pig house based on time series and multivariate models
-
摘要:目的
从挖掘猪舍历史环境参数数据时序信息角度出发,提出基于时间序列模型和多元模型序列的猪舍温度预测模型。
方法采取缺失部分环境因子统计预测,评估猪舍环境中相对湿度、二氧化碳浓度、氧气浓度等环境因子对温度预测的影响程度。针对猪舍温度时间序列进行数据预处理,滤除错误值和缺失值,采用时间序列模型构建基于门控循环单元网络(Gated recurrent unit,GRU)的猪舍温度预测模型,采用多元模型建立基于梯度提升决策树(Extreme gradient boosting,XGBoost)缺失值重要程度的猪舍温度预测模型。将该预测模型用于预测广东省某集约化猪场母猪分娩舍温度,并与循环神经网络(Recurrent neural network, RNN)模型、反向神经网络(Back propagation neural network, BPNN)模型进行对比试验。
结果对比温度预测值与实测值发现,基于GRU模型对应的猪舍温度均方根误差和平均绝对误差分别为0.25和0.19 ℃,平均绝对百分比误差为0.65%;基于XGBoost多元模型的猪舍温度均方根误差和平均绝对误差分别为1.21和0.71 ℃,平均绝对百分比误差为2.50%。在时间序列的温度预测模型中,GRU模型表现出更优的预测效果;在多元模型的温度预测中,XGBoost模型的预测效果更优。
结论本研究使用的GRU模型在时间维度上对母猪分娩舍温度的变化起到了预警作用,确定了各种环境参数对温度的影响程度,为养殖环境的精细调控提供了参考。
Abstract:ObjectiveOn account of history environmental factors such as temperature and humidity in farrowing houses, based on the data of a farrowing house of a modern pig farm in Guangdong Province, the temperature prediction model of pig house was studied based on time series and multivariate models.
MethodThe effects of relative humidity, carbon dioxide concentration, oxygen concentration and other environmental factors on temperature prediction in pigsty was evaluated by statistical prediction of missing part environmental factors. Data preprocessing was carried out for the time series of piggery temperature to filter out the error value and missing value. The time series model was used to construct the temperature prediction model of piggery based on gated recurrent unit (GRU). Based on extreme gradient boosting (XGBoost), the temperature prediction model of missing value importance degree in pigsty was established using multivariate model. The prediction model was applied to predict the temperature of a farrowing house of an intensive pig farm in Guangdong Province, and compared with the recurrent neural network (RNN) model and back propagation neural network (BPNN) model.
ResultComparing the predicted value with the measured value, root mean square error (RMSE), mean absolute error (MAE) and mean absolute percent error (MAPE) of the GRU model were 0.25 ℃, 0.19 ℃ and 0.65% respectively, while RMSE, MAE and MAPE of the XGBoost multicomponent model were 1.21 ℃, 0.71 ℃ and 2.50% respectively. For temperature prediction based on time series models, GRU model showed better prediction effect. The XGBoost model was better in temperature prediction for multivariate model.
ConclusionThe CRU model used in this study plays an early warning role on the temperature change of the farrowing house in time dimension, and the influence degree of various environmental parameters on temperature is also determined, which provides a reference for the fine regulation of the breeding environment.
-
图 1 循环神经网络结构图
h(t−1)为上一个传输下来的状态;x(t)为当前节点的输入;z(t)为控制更新的门控;r(t)为控制重置的门控;$\tilde h\left( {\rm{t}} \right)$为重置后的数据;h(t)为当前的隐藏状态
Figure 1. Cyclic neural network structure diagram
h(t−1) is the last state transferred down; x(t) is the input for the current node; z(t) is a gating control for controlling updates; $ \tilde h\left( {\rm{t}} \right)$ is the reset data; h(t) is the current hidden state
图 4 试验分娩舍侧、俯视图及各区域节点分布
1:湿帘, 2:负压风机, 3:屋顶小窗,4:地沟,5:限位栏,6:传感器从节点(舍外),7:传感器从节点(出风口区域),8:传感器从节点(母猪呼吸区域),9:传感器从节点(仔猪呼吸区域),10:网关主节点,11:保温灯
Figure 4. Side and top views of test farrowing pig house and node distribution in each region
1:Wet curtain, 2:Negative pressure fan, 3:Roof window, 4:Trench, 5:Limit column, 6:Sensor slave node(outisde), 7:Sensor slave node(outlet area), 8:Sensor slave node(sow breathing area), 9:Sensor slave node(piglet breathing area), 10:Gateway master node, 11:Heat lamp
表 1 温度预测试验中GRU和RNN时间序列模型的指标1)
Table 1 Indexes of GRU and RNN time series models in temperature prediction test
模型 Model RMSE/℃ MAE/℃ MAPE/% GRU 0.25 0.19 0.65 RNN 0.31 0.24 0.84 1)RMSE:均方根误差,MAE:平均绝对误差,MAPE:平均绝对百分比误差 1)RMSE:Root mean square error, MAE:Mean absolute error, MAPE:Mean absolute percent error 表 2 温度预测试验中多元模型的指标1)
Table 2 Indexes of multivariate model in temperature prediction test
模型 Model RMSE/℃ MAE/℃ MAPE/% XGBoost 1.21 0.71 2.50 BPNN 0.89 0.72 2.54 LR 1.25 0.89 3.14 1)RMSE:均方根误差,MAE:平均绝对误差,MAPE:平均绝对百分比误差 1)RMSE:Root mean square error, MAE:Mean absolute error, MAPE:Mean absolute percent error 表 3 温度预测试验中变量缺失的XGBoost和BPNN多元模型的Score值
Table 3 Score values of XGBoost and BPNN multivariate models with missing variables in temperature prediction test
缺失变量Missing variable Score XGBoost BPNN CO2浓度 CO2 content 0.415 0.435 O2浓度 O2 content 0.407 0.426 相对湿度 Relative humidity 0.428 0.475 节点编号 Node ID 0.433 0.481 -
[1] 汪开英, 苗香雯, 崔绍荣, 等. 猪舍环境温湿度对育成猪的生理及生产指标的影响[J]. 农业工程学报, 2002, 18(1): 99-102. doi: 10.3321/j.issn:1002-6819.2002.01.026 [2] 冯霞, 王思珍, 曹颖霞, 等. 饮水温度对断奶仔猪生产性能和养分表观消化率的影响[J]. 家畜生态学报, 2011, 32(3): 40-44. doi: 10.3969/j.issn.1673-1182.2011.03.010 [3] 秦琳琳, 马国旗, 储著东, 等. 基于灰色预测模型的温室温湿度系统建模与控制[J]. 农业工程学报, 2016, 32(S1): 233-241. [4] KÖNIG M, HEMPEL S, JANKE D, et al. Variabilities in determining air exchange rates in naturally ventilated dairy buildings using the CO2 production model[J]. Biosystems Engineering, 2018, 174: 249-259. doi: 10.1016/j.biosystemseng.2018.07.001
[5] 王德福, 黄会男, 张洪建, 等. 生猪养殖设施工程技术研究现状与发展分析[J]. 农业机械学报, 2018, 49(11): 1-14. doi: 10.6041/j.issn.1000-1298.2018.11.001 [6] 杨飞云, 曾雅琼, 冯泽猛, 等. 畜禽养殖环境调控与智能养殖装备技术研究进展[J]. 中国科学院院刊, 2019, 34(2): 163-173. [7] 黄凯, 唐倩, 沈丹, 等. 冬季猪舍内温湿度与有害气体分布规律研究[J]. 畜牧与兽医, 2019, 51(7): 35-41. [8] XIE Q, NI J, BAO J, et al. A thermal environmental model for indoor air temperature prediction and energy consumption in pig building[J]. Building and Environment, 2019, 161: 106238. doi: 10.1016/j.buildenv.2019.106238
[9] 韩建军, 南少伟, 李建平, 等. 基于随机森林算法的粮堆机械通风温度预测及控制研究[J]. 河南工业大学学报(自然科学版), 2019, 40(5): 107-113. [10] RONG L, AARNINK A J A. Development of ammonia mass transfer coefficient models for the atmosphere above two types of the slatted floors in a pig house using computational fluid dynamics[J]. Biosystems Engineering, 2019, 183: 13-25. doi: 10.1016/j.biosystemseng.2019.04.011
[11] BEDI J, TOSHNIWAL D. Empirical mode decomposition based deep learning for electricity demand forecasting[J]. IEEE Access, 2018, 6: 49144-49156. doi: 10.1109/ACCESS.2018.2867681
[12] XIE Q, NI J, SU Z. A prediction model of ammonia emission from a fattening pig room based on the indoor concentration using adaptive neuro fuzzy inference system[J]. Journal of Hazardous Materials, 2017, 325: 301-309. doi: 10.1016/j.jhazmat.2016.12.010
[13] DASKALOV P, ARVANITIS K, SIGRIMIS N, et al. Development of an advanced microclimate controller for naturally ventilated pig building[J]. Computers and Electronics in Agriculture, 2005, 49(3): 377-391. doi: 10.1016/j.compag.2005.08.010
[14] LITAGO J, BAPTISTA F J, MENESES J F, et al. Statistical modelling of the microclimate in a naturally ventilated greenhouse[J]. Biosystems Engineering, 2005, 92(3): 365-381. doi: 10.1016/j.biosystemseng.2005.07.015
[15] NORTON T, GRANT J, FALLON R, et al. Optimising the ventilation configuration of naturally ventilated livestock buildings for improved indoor environmental homogeneity[J]. Building and Environment, 2010, 45(4): 983-995. doi: 10.1016/j.buildenv.2009.10.005
[16] ANDONOV K, DASKALOV P, MARTEV K. A new approach to controlled natural ventilation of livestock buildings[J]. Biosystems Engineering, 2003, 84(1): 91-100. doi: 10.1016/S1537-5110(02)00218-0
[17] 杨柳. 基于多尺度信息融合的猪舍环境控制系统设计[D]. 西安: 陕西科技大学, 2019. [18] 李立峰, 武佩, 麻硕士, 等. 基于组态软件和模糊控制的分娩母猪舍环境监控系统[J]. 农业工程学报, 2011, 27(6): 231-236. doi: 10.3969/j.issn.1002-6819.2011.06.042 [19] 谢秋菊, 苏中滨, NI J Q, 等. 猪舍环境适宜性模糊综合评价[J]. 农业工程学报, 2016, 32(16): 198-205. doi: 10.11975/j.issn.1002-6819.2016.16.028 [20] HEMPEL S, KÖNIG M, MENZ C, et al. Uncertainty in the measurement of indoor temperature and humidity in naturally ventilated dairy buildings as influenced by measurement technique and data variability[J]. Biosystems Engineering, 2018, 166: 58-75. doi: 10.1016/j.biosystemseng.2017.11.004
[21] WANG Y, DONG H, ZHU Z, et al. CH4, NH3, N2O and NO emissions from stored biogas digester effluent of pig manure at different temperatures[J]. Agriculture, Ecosystems & Environment, 2016, 217: 1-12.
[22] DE SOUZA G B J, ROSSI L A, MENEZES D S Z. PID temperature controller in pig nursery: Spatial characterization of thermal environment[J]. International Journal of Biometeorology, 2018, 62(5): 773-781. doi: 10.1007/s00484-017-1479-x
[23] 陈昕, 唐湘璐, 李想, 等. 二次聚类与神经网络结合的日光温室温度二步预测方法[J]. 农业机械学报, 2017, 48(S1): 353-358. doi: 10.6041/j.issn.1000-1298.2017.S0.054 [24] 杨亮, 刘春红, 郭昱辰, 等. 基于EMD-LSTM的猪舍氨气浓度预测研究[J]. 农业机械学报, 2019, 50(S1): 353-360. [25] RODRIGUEZ M R, LOSADA E, BESTEIRO R, et al. Evolution of NH3 concentrations in weaner pig buildings based on setpoint temperature[J]. Agronomy, 2020, 10(1): 107. doi: 10.3390/agronomy10010107
[26] FERREIRA P M, FARIA E A, RUANO A E. Neural network models in greenhouse air temperature prediction[J]. Neurocomputing, 2002, 43(1): 51-75.
[27] 陈英义, 程倩倩, 方晓敏, 等. 主成分分析和长短时记忆神经网络预测水产养殖水体溶解氧[J]. 农业工程学报, 2018, 34(17): 183-191. doi: 10.11975/j.issn.1002-6819.2018.17.024 [28] 王文广, 赵文杰. 基于GRU神经网络的燃煤电站NOx排放预测模型[J]. 华北电力大学学报(自然科学版), 2020, 47(1): 96-103. [29] CHEN C, ZHU W, STEIBEL J, et al. Recognition of aggressive episodes of pigs based on convolutional neural network and long short-term memory[J]. Computers and Electronics in Agriculture, 2020, 169: 105166. doi: 10.1016/j.compag.2019.105166
[30] FERREIRA L B, DA CUNHA F F. New approach to estimate daily reference evapotranspiration based on hourly temperature and relative humidity using machine learning and deep learning[J]. Agricultural Water Management, 2020, 234: 106113. doi: 10.1016/j.agwat.2020.106113
[31] 曾志雄, 董冰, 吕恩利, 等. 猪舍环境无线多点多源远程监测系统设计与试验[J]. 农业机械学报, 2019, 51(2): 1-10. doi: 10.6041/j.issn.1000-1298.2019.02.001 [32] 俞守华, 区晶莹, 张洁芳. 猪舍有害气体测定与温度智能控制算法[J]. 农业工程学报, 2010, 26(7): 290-294. doi: 10.3969/j.issn.1002-6819.2010.07.051 [33] 郑旭曼. 基于集成学习的O3浓度逐小时预测模型研究[D]. 上海: 华东师范大学, 2018. [34] 邹伟东, 张百海, 姚分喜, 等. 基于改进型极限学习机的日光温室温湿度预测与验证[J]. 农业工程学报, 2015, 31(24): 194-200. doi: 10.11975/j.issn.1002-6819.2015.24.029 [35] 李婷, 季宇寒, 张漫, 等. 基于PLSR和BPNN方法的番茄光合速率预测比较(英文)[J]. 农业工程学报, 2015, 31(S2): 222-229. [36] LIANG J, LI W, BRADFORD S, et al. Physics-informed data-driven models to predict surface runoff water quantity and quality in agricultural fields[J]. Water, 2019, 11(2): 200. doi: 10.3390/w11020200
[37] 朱虹, 李爽, 郑丽敏, 等. 基于粒子群算法的生猪养殖物联网节点部署优化研究[J]. 农业机械学报, 2016, 47(5): 254-262. doi: 10.6041/j.issn.1000-1298.2016.05.034 [38] 左志宇, 毛罕平, 张晓东, 等. 基于时序分析法的温室温度预测模型[J]. 农业机械学报, 2010, 41(11): 173-177.