Next Article in Journal
Theoretical Perspectives on the Gas-Phase Oxidation Mechanism and Kinetics of Carbazole Initiated by OH Radical in the Atmosphere
Previous Article in Journal
A Kernel Density Estimation Approach and Statistical Generalized Additive Model of Western North Pacific Typhoon Activities
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Prediction Model of Carbon Dioxide Concentration in Pig House Based on Deep Learning

1
College of Animal Science and Technology, China Agricultural University, Beijing 100193, China
2
National Key Laboratory of Animal Nutrition, Beijing 100193, China
3
College of Artificial Intelligence, Nanjing Agricultural University, Nanjing 210031, China
4
College of Engineering, Nanjing Agricultural University, Nanjing 210031, China
5
Faculty of Engineering and Information Technology, University of Technology Sydney, Sydney, NSW 2007, Australia
*
Author to whom correspondence should be addressed.
Atmosphere 2022, 13(7), 1130; https://doi.org/10.3390/atmos13071130
Submission received: 30 April 2022 / Revised: 7 July 2022 / Accepted: 13 July 2022 / Published: 17 July 2022
(This article belongs to the Section Biosphere/Hydrosphere/Land–Atmosphere Interactions)

Abstract

:
The air environment (e.g., high concentration of carbon dioxide) in a pig house will affect the health conditions and growth performance of the pigs, and the quality of pork as well. In order to reduce the cumulative concentration of carbon dioxide in the pig house, the prediction model was established by the deep learning method to predict the changes of the carbon dioxide cumulative concentration in a pig house. This model will also be used for the real-time monitoring and adjustment of the concentration of carbon dioxide of the pig house. The experiment was designed to collect environmental parameters (e.g., temperature, humidity, wind speed, and carbon dioxide concentration) data in the pig house for several months. The ensemble empirical mode decomposition–gated recurrent unit (EEMD–GRU) prediction model was established in the prediction of carbon dioxide concentration in the pig house. The results show that compared with the other models, the prediction accuracy of the EEMD–GRU model is the highest, and the root mean square error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and r-squared (R2) of carbon dioxide concentration in autumn and winter are 123.2 ppm, 88.3 ppm, 3.2%, and 0.99, respectively. The RMSE, MAE, MAPE, and R2 for carbon dioxide concentration are 129.1 ppm, 93.2 ppm, 5.9%, and 0.76 in spring and summer. The prediction model proposed in this paper can effectively predict the concentration of carbon dioxide in the pig house and provide effective help for the precise control of the pig house environment.

1. Introduction

China has the highest pig slaughter and pork consumption in the world. According to the data of the National Bureau of Statistics of China, in 2021, China’s pig slaughtered 670 million pigs, and its pork production was 529.6 million tons [1]. However, compared with developed countries, the environmental conditions of pig houses in China are relatively poor, which seriously affects the efficient breeding of pigs [2]. Carbon dioxide (CO2) is produced due to pig respiration and manure emissions. High concentrations of CO2 can cause problems such as lethargy, loss of appetite, and decreased resistance in pigs [3,4]. Therefore, it is necessary to know the change of CO2 concentration in pig houses, and if the CO2 concentration exceeds the breeding standard, the staff can take effective ventilation and other environmental control measures to remove CO2 in advance, so as to ensure the relative stability of the comfortable environmental conditions of the pig house, which is of great significance for improving the pig house environment and improving the welfare of pig breeding.
Scholars have proposed many methods to predict CO2 concentration in animal houses, which are mainly divided into two categories: methods based on an emission mechanism model and methods based on artificial intelligence [5]. The method based on the emission mechanism model mainly predicts the CO2 concentration in the house through the principle of material conservation. This method needs to consider the CO2 produced by animals breathing and their feces, and the ventilation mode in the house to establish the CO2 concentration balance equation [6,7]. However, this method requires sophisticated experimental data. The stability and practicability of the model also need to be improved, considering its low accuracy of the prediction rate. Meanwhile, the artificial intelligence method trains a large number of historical CO2 concertation data through artificial intelligence algorithms to obtain the prediction model, which has high prediction accuracy and good versatility. The model is mainly divided based on machine learning and deep learning methods. Machine learning models include decision trees [8], support vector machines [9], autoregressive integrated moving average [10], and multiple linear regression [11]. Some scholars optimize the machine learning prediction model through other algorithms to reduce the model error [12]. Although machine learning methods can capture nonlinear relationships in temporal data to a limited extent, it is difficult to adapt to large-scale temporal data. Methods based on deep learning can utilize data more effectively and fully mine the linear and nonlinear features hidden in spatiotemporal sequence data. Doval et al. [13] used the weighted nearest neighbor (WNN) analysis model to study the CO2 concentration in a weaned-piglet house. The experimental results showed that the WNN model could be applied to the dynamic prediction of CO2 in the livestock and poultry houses. Xie et al. [14] used the adaptive neuro-fuzzy inference system (ANFIS) to predict the ammonia concentration in a pig house in winter and summer, which improved the accuracy and timeliness of the prediction of ammonia concentration in pig houses and provided support for the early environmental warning. Guo et al. [5] predicted ammonia concentration in chicken houses based on dual-stage attention-based (DA)-recurrent neural network (RNN) and the long short-term memory (LSTM) algorithm, which predicted the change trend of ammonia concentration in a chicken house. Feature extraction and parameter selection are key parts of artificial intelligence predictive models [15]. Ouaret et al. [16] predicted indoor formaldehyde concentration by extracting features by spectral band decomposition. Yang et al. [17] used empirical mode decomposition (EMD) to decompose the ammonia concentration data in pig houses at different scales, and extracted the local feature information of the ammonia concentration data series in pig houses, and the prediction accuracy and efficiency were improved.
To sum up, there are few studies related to the prediction of CO2 concentration in pig houses; the model accuracy is not high and there is an inability to adequately extract relevant features. Since the accuracy of existing prediction models cannot meet the needs of precise regulation of pig house environments [18], this paper takes CO2 experimental data in a pregnant-pig house (Academician Workstation in ChengdeJiuyun Agricultural and Live-stock Co., Ltd., Hebei, China) as the research object, and puts forward the ensemble empirical mode decomposition–gated recurrent unit (EEMD–GRU) prediction model to improve the performance of the CO2 concentration prediction model in pig houses. The GRU model is optimized by the EEMD algorithm, which makes it easier to extract features from the model compared to the EMD algorithm, mine the time relationship in the data, and improve the model prediction accuracy and convergence speed, so that the staff can set measures to eliminate CO2 in advance. The model presented in this paper also proposes effective support for the environmental monitoring, regulation, and scientific management of pig houses.

2. Materials and Methods

2.1. Data Collection

The pregnant-pig house used in the following experiment is located in Fengning Pig Research Unit of China Agricultural University (Academician Workstation in Chengde Jiuyun Agricultural and Livestock Co., Ltd., Chengde, China). Data on temperature, humidity, wind speed, and CO2 concentration in the pig house were collected. The size of this pig house is 12 m × 8 m. There are 30 gestation sows in the pig house that adopted double-row limit bars and concrete floors; moreover, the pig house has an aisle in the middle and a drain in the back. Pigs were raised head-to-head. The environmental sensors were placed in the center of the pig house, and the height of the sensors was 1.5 m from the ground. The instrument information is shown in Table 1.
The CO2 sensor was calibrated with a hand-held CO2-concentration detector. The accuracy of the temperature, humidity, and wind speed sensors was relatively stable, so they were not calibrated. The pig house adopted the ventilation method of the frequency conversion fan. The fan had 4 gears set according to the change of temperature. The minimum ventilation rate per hour in the pig house in summer and winter is 0.3 m3/kg and 0.6 m3/kg, respectively, in China [19]. The hourly ventilation rates of the experimental pig house in summer and winter were 0.38 m3/kg and 0.67 m3/kg, which met the requirements.
In this experiment, the data collected by sensors mainly included the temperature, humidity, wind speed, and CO2 concentration inside the pig house. The data from 2 November 2018 to 18 February 2019 were used as the experimental data set for autumn and winter. The data from the 2 March to 27 June 2019 were used as the experimental data set for spring and summer. The sensor collected data every 10 min, and 15,666 autumn and winter data points and 12,336 spring and summer data points were collected in total.

2.2. Data Preprocessing

For subsequent data processing and model building, the weighted average of 6 data points measured within 1 h was processed. A 2611 h autumn and winter data set and a 2056 h spring and summer data set were constructed. Table 2 shows the internal environmental parameters of the pig house in autumn and winter every hour from 2 November 2018 to 18 February 2019.

2.2.1. Data Interpolation

The sensor may have been affected by its own hardware conditions and sophisticated environmental factors in the pig house, and sometimes mechanical faults occurred, resulting in data loss. In order to make the time series information of the data set complete for further processing, it is necessary to interpolate and fill the missing data. In this experiment, the missing data were filled with the average data of one hour before the missing time and one hour after the missing time.

2.2.2. Data Normalization

In order to improve the convergence speed and accuracy of the algorithm and improve the performance of the proposed model (e.g., establishment, learning, training, and prediction), the normalization of the CO2 concentration, temperature, humidity, and wind speed values were applied before further process. Data normalization compares the features between different dimensions of the data set on the same dimension, eliminating the differences between the features in different dimensions and orders of magnitude. The normalization methods include linear function normalization and zero mean normalization. In this experiment, the maximum and minimum normalization method was used to preprocess the environmental data of the pig house during the autumn and winter, and spring and summer.

2.3. Prediction Model of CO2 Concentration

2.3.1. BP Model

A back-propagation (BP) neural network is a multilayer feed-forward neural network using the error back-propagation algorithm, which consists of three parts: input layer, hidden layer, and output layer [20].

2.3.2. GRU Model

Hochreiter et al. [21] proposed the LSTM artificial neural network algorithm, which can solve the problems of gradient explosion and gradient disappearance generated by RNN in the process of processing long-sequence data information so that it has better performance in longer data sequences. It adds a memory gate function to the original RNN to control the memory value. The activation function is used to determine whether the memory gate is open or not and determine whether the output of the previous step needs to be added to the calculation of the current layer. LSTM is a relatively special RNN variant structure, which becomes two transfer states based on a single transfer state of RNN: one is the cell state, and the other is a hidden state with an optional memory function.
Chung et al. [22] proposed GRU. The GRU neural network is a variant based on the LSTM pair structure, including only an update gate and a reset gate. The GRU structure is shown in Figure 1. The update gate composed of the input gate and the forget gate in the LSTM model can control the continuation of the memory before and after the input and output, filter and update the data input at the current moment, reduce the training time, and ensure that the phenomenon of overfitting does not easily occur. The GRU changes the basic unit of RNN, can reduce the problem of gradient disappearance, more deeply capture the connection between hidden layers, and process long-sequence data, which makes up for the deficiency that RNN is only sensitive to short-sequence data. It has the advantages of low complexity and fast calculation speed. In the GRU structure, recurrent neural units (basic unit of RNN) are used to form a certain depth of the neural network structure.
The update gate is used to control the degree to which the state information at the previous moment can enter the next state. The larger the value of the update gate, the more information is retained at the previous moment. The calculation formula of the update gate z t is shown in Equation (1). The h t and X t are multiplied by the weight matrix and added together, and then the sigmoid activation function acts on the two to convert the real number vector ranging from 0 to 1, which is used as the gate control state.
z t = σ ( W z · [ X t , h t 1 ] )
where σ is the sigmoid activation function; Wz is the update gate weight; X t is the input value of the current state; and h t 1 is the activation value at the previous moment.
The reset gate r t is used to control the amount of information that the current state has of the previous state. The larger the value of the reset gate, the more information is written in the previous state. The h t 1 and Xt are, respectively, multiplied by the weight matrix and added, and then the sigmoid activation function acts on them to convert a real number vector ranging from 0 to 1, which is used as the gate control state. The calculation formula of the update gate r t   is shown in Equation (2).
r t = σ ( W r · [ X t , h t 1 ] )
where Wr is the update gate weight.
The state information ht at time t is formed by a compromise between the state h t 1 at the previous time and the candidate hidden state h ˜ t . h ˜ t is shown in Equation (3). The principle is that the reset gate acts on h t 1 first. The result obtained is multiplied by the weight matrix and added to the result of multiplying X t and the weight matrix, and then the tan h function is used to convert a real vector ranging from −1 to 1, which is used as the candidate hidden state h t value of h ˜ t .
h ˜ t = tan h · ( W h ˜ · [ X t , r t · h t 1 ] )
where t a n   h is the t a n   h activation function.
In the final information output part, the information in the hidden layer that is less relevant to the current moment in the previous moment is discarded, and the updated content input at this moment is retained. The output value h t is obtained, as shown in Equation (4).
h t = z t · h t 1 + ( 1 z t ) · h ˜ t

2.3.3. EMD

The GRU prediction model has fewer parameters and a faster convergence speed. Combined with EMD, the accuracy of the prediction results can be significantly improved [23]. The EMD algorithm decomposes the signal into many separate intrinsic mode functions (IMF) and a residue (RES). The decomposed signal includes many single-component signals, and each single-component signal contains only one oscillation mode, which is more intuitive [24]. The principle is that the signal can be decomposed according to the local characteristics of the time series of the signal data itself without using the basis function. The decomposed IMF needs to meet two requirements [25]:
(1) The number of maximum points, minimum points, and zero points in the IMF should be equal, or at most should have one difference.
(2) The mean envelope of the IMF signal is zero and it is symmetrical about the upper and lower envelopes of the time axis.
However, EMD decomposition has its shortcomings and limitations, and the phenomenon of modal aliasing will occur, which is when the time width between two consecutive zero-crossing points in the signal, between two consecutive peaks, or between two consecutive peaks on the curvature is not equal, or the same time scale appears in different IMFs [26]. Moreover, different models have different iterative stopping conditions, and the IMF sequences obtained under different standards are also different.

2.3.4. EEMD

In order to solve the problems brought by the EMD method, the EEMD method was proposed to make up for the defects and deficiencies of EMD. In the EMD, the important reason for the phenomenon of modal aliasing is the uneven distribution of the extreme points of the original signal, and the distribution of the extreme points in the original signal has an important influence on the acquisition of the IMF sequence. Therefore, in the EEMD, white noise is added to the signal to be decomposed, and the signals of different time scales are automatically distributed to their appropriate reference time scale, and the signal is uniformly distributed in the white noise background in the entire time-frequency domain, thus avoiding the phenomenon of modal aliasing [27]. At the same time, the white noise has zero mean value. After the signal is averaged many times, the noises can cancel each other out, and the result after the integrated averaging can be used as the final IMF result.
The steps of EEMD are as follows:
(1) Add the Gaussian white noise signal n ( t ) with constant standard deviation and zero mean to the signal to be decomposed X ( t ) to obtain the Equation (5) after adding white noise.
X ( t ) = X ( t ) + n ( t )
(2) The newly obtained sequence to be decomposed is processed by EMD to obtain several IMF sequences and residual sequence r ( t ) . The process is shown in Equation (6).
y ( t ) = I M F s + r ( t )
(3) Repeat the above (1) (2) steps m times, adding a different normal distribution white noise sequence each time.
(4) Perform integrated averaging processing on each group of I M F s components obtained by EMD decomposition each time to eliminate the influence caused by white noise, and then a final group of I M F s sequences as shown in Equation (7) can be obtained.
I M F s ¯ = 1 m n = 1 m I M F s

2.3.5. EEMD–GRU

The CO2 sequence was decomposed by EEMD. The original data sequence was decomposed into multiple IMF subsequences by EEMD decomposition. Therefore, it is necessary to select a neural network model that is more convenient to operate and runs faster. Neural network models that can predict time series include the BP model, the RNN model, the LSTM model, and the GRU model. Compared with the LSTM model and the RNN model, the GRU model has a simpler network structure and fewer parameters, and can solve problems such as gradient disappearance and gradient explosion. Therefore, the GRU model was selected in this experiment to model and predict the CO2 IMF sequence and environmental data after EEMD decomposition. A regular term is added to constrain the network parameters and limit the complexity of the model, thereby preventing the model from overfitting [28]. The flow of the EEMD–GRU model is shown in Figure 2.

2.4. Model Parameter Settings

This experiment was based on the Ubuntu 16.04 operating system with Inter (R) Core (TM) i5-6500 CPU @ 3.20 GHz × 4, 16 G memory, NVIDIA GeForce GTX 750 Ti graphics card, and used the Python language environment and built TensorFlow and Keras frameworks. In this experiment, the CO2 concentration in the next hour was predicted by CO2 concentration, temperature, humidity, and wind speed in the first two hours. The parameters of the EEMD–GRU model and the comparative model were set as follows. The parameter settings of the BP model in this comparative experiment are shown in Table 3.
In this experiment, the parameter settings in the GRU model and the EEMD–GRU model were the same, as shown in Table 4.

2.5. Model Evaluation Index

After the model was built and trained, the prediction results of the model needed to be verified by validation indexes to evaluate the advantages and disadvantages of the model. In this experiment, mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), and r-squared (R2) were used to verify the performance of the prediction model of CO2 concentration in pig house.
MAE is used to indicate the average absolute error between the predicted value and the actual value, it is a linear fractional expression, and all individual features have equal difference weights on the mean. In other words, MAE directly averages the difference between the predicted value and the actual value. RMSE is used to express the difference between the predicted value and the actual value, standard deviation can be used to measure the discreteness of a set of numbers, and root mean square error can measure the discrete degree of the whole time series sample. In general, MAE is less than or equal to RMSE. For the difference of larger variables, RMSE will punish more heavily than MAE. MAPE can describe accuracy because mean absolute percent error itself is often used as a statistical measure of forecast accuracy. A MAPE of 0% indicates a perfect model, and a MAPE of greater than 100% indicates a poor model. R2 reflects the proportion of the total variance of the dependent variable that can be explained by the independent variable through the regression relationship. The closer R2 is to 1, the better the regression fitting effect is.

3. Results and Discussion

3.1. Results and Analysis

3.1.1. Decomposition Result of EEMD

Due to the obvious nonlinearity and instability of CO2 concentration data in the pig house, in order to facilitate the subsequent establishment of the GRU model for prediction, the EEMD method was used to decompose the data. EEMD could deal with the nonlinear data of CO2 concentration and could reduce the impact of different frequency time series coupling in the original CO2 time series. EEMD decomposed a nonstationary CO2 sequence into a number of CO2 subsequences. Each CO2 subsequence was integrated with the temperature, humidity, wind speed, and other parameters in the first two hours and normalized as the input characteristics to establish the GRU model. Finally, some results predicted by the model were linearly added to obtain the final CO2 prediction results. In this paper, the CO2 concentration data set of the pig house in autumn and winter was taken as an example. After data preprocessing, EEMD decomposition was carried out. The CO2 concentration data of the pig house in autumn and winter were taken as data inputs, and the subsequence and residual of CO2 concentration were taken as outputs. The result of EEMD decomposition is to decompose the CO2 concentration series into nine components. The results are shown in Figure 3.
It can be seen that EEMD decomposes the original signal into nine IMF components and a residual RES component, which can clearly see the difference between the high-frequency component and the low-frequency component in the sequence. The change trend of the original signal can be analyzed by the IMF component. The frequency of each component from high to low is IMF1, IMF2, IMF3, …, IMF9, RES. The four sequences of IMF1IMF4 have high frequency and random disorder, which reflect the influence of environmental uncertainty on CO2 concentration characteristics in the pig house.

3.1.2. Results of Model Prediction

In this experiment, EEMD–GRU model was used to predict the CO2 concentration in a pig house during the autumn and winter, and spring and summer. The data set was divided in chronological order; the first 70% of the data set was selected as the training set, and the last 30% was selected as the validation set. The eight parameters (CO2 concentration, temperature and humidity, and wind speed in the first two hours) were used as the input characteristics. The BP model and the GRU model were established to predict the CO2 concentration in the next 1 h. RMSE and MAE were used as the evaluation indexes for comparative experiments.
The prediction results of CO2 concentration in the pig house during the autumn and winter, and spring and summer by the BP model is shown in Figure 4. The scatter diagram of CO2 data of the BP model in the pig house is shown in Figure 5.
Comparing the CO2 concentration values in Figure 4 and Figure 5, it can be found that the overall CO2 concentration value during autumn and winter is relatively large, and the value fluctuates between 1000 and 4000 ppm, while the CO2 concentration value during spring and summer is relatively low, and the overall value fluctuates between 250 and 1250 ppm. The reason is that the outdoor temperature is low during autumn and winter, and short ventilation time is used to ensure that the temperature inside the pig house is within the appropriate range. Therefore, it leads to poor air mobility inside and outside the house, and a large amount of CO2 is discharged with the respiration and feces of pigs. So, the CO2 concentration during autumn and winter is higher than that during spring and summer.
The predicted value of CO2 concentration during autumn and winter by the BP model is basically consistent with the actual value, with an RMSE value of 382.0 ppm and an MAE value of 328.2 ppm. The BP model has good forecasting results for the overall trend of daily CO2 concentration change, but the prediction error is large at the wave peak and valley, where the change is severe. Especially in the prediction model of spring and summer, the data fluctuate greatly, resulting in a great prediction error. The BP model has a relatively poor prediction ability for CO2 concentration during spring and summer, with an RMSE value of 223.5 ppm and an MAE value of 192.7 ppm, and the difference between the predicted value and the actual value reaches the maximum value of about 350 ppm at 160 h.
The prediction results of CO2 concentration in the pig house during the autumn and winter, and spring and summer by the GRU model are shown in Figure 6 and Figure 7.
It can be seen from Figure 6 and Figure 7 that the prediction ability of the GRU model is better than that of the BP model for the CO2 concentration in the pig house during autumn and winter, with an RMSE value of 299.0 ppm and an MAE value of 169.0 ppm, with a maximum error of about 200 ppm. As can be seen from Figure 7, for the CO2 concentration in the pig house during spring and summer, the predicted result curve of the GRU model is more in line with the actual curve than the BP model. Compared with BP model, the GRU model has an obvious improvement in prediction trend and prediction error, but the prediction error at the wave peak and valley is still large. The error is reduced, the RMSE is 151.841 ppm, and the MAE is 101.1 ppm. Especially in the time range from 0–90 h and 220–300 h, the two curves can basically coincide. However, it can be seen that the maximum error is about 175 ppm, and the prediction accuracy needs to be further improved.
The prediction results of CO2 concentration in the pig house during the autumn and winter, and spring and summer by EEMD–GRU model are shown in Figure 8 and Figure 9. It can be seen from Figure 8 that the prediction results of the EEMD–GRU model are more accurate than those of the BP model and the GRU model, and the predicted result curve and the actual curve can basically overlap at more time points without an obvious lag question. The EEMD–GRU model can not only accurately predict the variation trend of daily carbon dioxide concentration, but also has a small prediction error regarding the wave peak and valley. For the CO2 concentration of the pig house during autumn and winter, the two curves basically overlap, the RMSE is 123.2 ppm, and the MAE is 88.3 ppm. There is only a slight error at 450 h, and the other times basically overlap, and the prediction effect is good. For the CO2 concentration in the pig house during spring and summer, the two curves basically overlapped, with an RMSE value of 129.1 ppm and an MAE value of 93.2 ppm. By intuitively judging the prediction result curve and comparing the error RMSE and MAE obtained by each model, it can be found that the EEMD–GRU model has better prediction ability, a smaller error rate, and higher accuracy than the BP model and the GRU model.

3.2. Discussion

It can be seen from the above analysis that the prediction effect of the EEMD–GRU model is the best. In order to accurately measure the improvement effect of the model compared with the other two models, the RMSE, MAE, MAPE, and R2 errors of the three models are compared. The prediction errors of the BP model, the GRU model, and the EEMD–GRU model for the CO2 concentration of the pig house during the autumn and winter, and spring and summer, are shown in Table 5. A comparison of prediction errors is shown in Figure 10 and Figure 11.
It can be seen that compared with the BP model and GRU model, in the prediction of CO2 concentration in pig houses during the autumn and winter, and spring and summer, the error between the predicted value and the actual value based on the EEMD–GRU model is the smallest, and the RMSE, MAE, and MAPE are smaller as well, and the R2 is biggest. It shows that the EEMD–GRU model has the highest accuracy and the best fit. Most importantly, the proposed model achieved the better prediction results in the prediction of CO2 concentration in the pig house.

4. Conclusions

Considering that the environmental monitoring system in the pig house can only monitor real-time environmental parameters but can not predict the changes of harmful gases in the house in advance, this paper proposed a CO2 prediction model based on EEMD–GRU and the collected data of CO2 concentration, temperature and humidity, and wind speed. After preprocessing the data set by using data interpolation and data normalization, EEMD was used to decompose the CO2 data, and its subsequences were integrated with the environmental data to increase the dimension. The GRU model was established by combining the CO2 subsequence with the parameters of temperature, humidity, and wind speed in the first two hours, and the prediction of the CO2 concentration in the pig house during the autumn and winter, and spring and summer was realized. At the same time, a comparative experiment between the BP model and the GRU model was established to predict the CO2 concentration in the pig house. The results show that the prediction model of CO2 concentration in pig house based on EEMD–GRU has the best effect compared with the BP and GRU model, which can accurately predict the CO2 concentration of pig house in the next 1h, and breeders can adjust the ventilation system in advance. This reduces the carbon dioxide concentration in the pig house and avoids the adverse effects of the accumulation of harmful gases such as CO2 on the health of pigs, and provides a method for the precise regulation and management of the pig house environment.
In future follow-up research, this model can be applied in other applications. In addition to the prediction of carbon dioxide concentration in pig houses, it can also be used for prediction research of warm environmental parameters such as temperature, humidity, and other harmful gases.

Author Contributions

Conceptualization, J.Z. and X.Z.; data curation, J.Z. and J.W.; formal analysis, J.Z., S.Y. and J.W.; funding acquisition, J.Z.; methodology, J.Z., S.Y., Z.X. and X.Z.; project administration, J.Z.; visualization, S.Y. and W.L.; writing—original draft, J.Z., S.Y., Z.X., W.L., Y.B. and X.Z.; writing—review and editing, C.Y., X.Z. and W.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by National Key R&D Program of China (2021YFD1300202), National Key R&D Program of China (2016YFD0500506), S and T Program of Hebei (199A7310H), and Key Research and Developmental Program of Shandong Province (2019JZZY020308).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

The authors are grateful to Master’s student Hang Gao from China Agricultural University for his assistance, and thank all other participants for technical support.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Liu, H.; Chen, Y. Development status, future development trend and suggestions of pig industry in 2021. Chin. J. Anim. Sci. 2022, 58, 204–209. [Google Scholar]
  2. Chen, J.; Feng, T.; Huang, S.; Hao, W.; Huo, J.; Zhu, W. Research on recognition of piggery environmental status based on D-S evidence theory. J. Chin. Agric. Mech. 2021, 42, 50–54. [Google Scholar]
  3. Wang, P.; Wang, C.; Xuan, C.; Ji, B.; Zong, Z. Research status of the detection and control methods of harmful gases in pig houses. Heilongjiang Anim. Sci. Vet. Med. 2017, 521, 53–57, 292. [Google Scholar]
  4. Guo, L.; Zhao, B.; Jia, Y.; He, F.; Chen, W. Mitigation Strategies of Air Pollutants for Mechanical Ventilated Livestock and Poultry Housing—A Review. Atmosphere 2022, 13, 452. [Google Scholar] [CrossRef]
  5. Guo, X.; Lian, J.; Li, H.; Sun, K. Ammonia concentration forecasting algorithm in layer house based on two-stage attention mechanism and LSTM. J. China Agric. Univ. 2021, 26, 187–195. [Google Scholar]
  6. Chen, Z.; Ma, Z.; Cheng, Q.; Liu, J. Greenhouse gas emissions from dairy industry in North China using holistic assessment approach. Trans. Chin. Soc. Agric. Eng. 2014, 248, 225–235. [Google Scholar]
  7. Zong, C.; Zhang, G.; Feng, Y.; Ni, J. Carbon dioxide production from a fattening pig building with partial pit ventilation system. Biosyst. Eng. 2014, 126, 56–58. [Google Scholar] [CrossRef]
  8. Ding, L.; Lv, Y.; Li, Q.; Wang, C.; Yu, L.; Zong, X. Prediction Model of Ammonia Emission from Chicken Manure Based on Fusion of Multiple Environmental Parameters. Trans. Chin. Soc. Agric. Mach. 2022, 53, 366–375. [Google Scholar]
  9. Yang, B.; Li, H.; Zhang, Y.; Liu, L.; Lu, W. Establishment and Verification of Multivariate Linear Regression Model for Prediction of Ethanol Concentration. Mod. Electron. Tech. 2012, 35, 153–156. [Google Scholar]
  10. Yusuf, R.O.; Noor, Z.Z.; Abba, A.H.; Hassan, M.A.A.; Majid, M.R.; Medugu, N.I. Predicting methane emissions from livestock in Malaysia using the ARIMA model. Manag. Environ. Qual. Int. J. 2014, 25, 584–599. [Google Scholar] [CrossRef]
  11. Xiao, X.; Chen, C. Establishment and Verification of Multivariate Linear Regression Model for Prediction of Ethanol Concentration. Infrared Technol. 2021, 43, 1228–1233. [Google Scholar]
  12. Bao, L.; Chen, H.; Guo, J.; Yuan, Y.; Li, X. Application of SVM Based on Improved Particle Swarm Optimization Algorithm in Methane Measurement. Chin. J. Sens. Actuators 2017, 30, 1454–1458. [Google Scholar]
  13. Doval, R.B.; Arango, T.; Velo, R.; Ortega, J.A.; Femandez, M.D. Prediction of carbon dioxide concentration in weaned piglet buildings by wavelet neural network models. Comput. Electron. Agric. 2017, 143, 201–207. [Google Scholar]
  14. 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. Hazard. Mater. 2017, 325, 301–309. [Google Scholar] [CrossRef] [PubMed]
  15. Saini, J.; Dutta, M.; Marques, G. Indoor air quality prediction systems for smart environments: A systematic review. J. Ambient. Intell. Smart Environ. 2020, 12, 433–453. [Google Scholar] [CrossRef]
  16. Ouaret, R.; Ionescu, A.; Petrehus, V.; Candau, Y.; Ramalho, O. Spectral band decomposition combined with nonlinear models: Application to indoor formaldehyde concentration forecasting. Stoch. Environ. Res. Risk Assess. 2018, 32, 985–997. [Google Scholar] [CrossRef]
  17. Yang, L.; Liu, C.; Guo, Y.; Deng, H.; Li, D.; Duan, Q. Concentration in fattening piggery based on EMD-LSTM. J. Agric. Mach. 2019, 50, 353–360. [Google Scholar]
  18. Han, G.; Xie, Q.; Xu, Y.; Wang, L. Advances in environmental monitoring technology and methods for piggery. Chin. J. Anim. Sci. 2021, 57, 18–25. [Google Scholar]
  19. GB/T 17824.3-2008; Environmental Parameters and Environmental Management for Intensive Pig Farms. Ministry of Agriculture of the People’s Republic of China: Beijing, China, 2008.
  20. Li, J.; Cheng, J.; Shi, J.; Huang, F. Brief Introduction of Back Propagation (BP) Neural Network Algorithm and Its Improvement. Adv. Comput. Sci. Inf. Eng. 2012, 169, 553–558. [Google Scholar]
  21. Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
  22. Chung, J.; Gulcehre, C.; Cho, K.; Bengio, Y. Gated feedback recurrent neural networks. Int. Conf. Mach. Learn. 2015, 37, 2067–2075. [Google Scholar]
  23. He, Q.; Hu, Z.; Xu, H.; Song, W.; Du, Y. SST prediction method based on EMD-GRU model. Laser Optoelectron. Prog. 2021, 58, 1–16. [Google Scholar]
  24. Wang, X.; Xu, X.; Zhang, T.; Gao, C. Gas load forecasting method based on integrated deep learning algorithms. Comput. Syst. Appl. 2019, 28, 47–54. [Google Scholar]
  25. Li, H.; Hao, H.; Sun, L. TImproved algorithm for empirical mode decomposition with independent elements. J. Harbin Inst. Technol. 2009, 41, 245–248. [Google Scholar]
  26. Huang, N.E.; Shen, Z.; Long, S.R.; Wu, M.C.; Shih, H.H.; Zheng, Q.; Yen, N.C.; Tung, C.C.; Liu, H.H. The empirical mode decomposition and the Hilbert spectrum for nonlinear and non-stationary time series analysis. Proc. R. Soc. A Math. Phys. Eng. Sci. 1998, 454, 903–995. [Google Scholar] [CrossRef]
  27. Ning, L.; Xia, J.; Zhan, C.; Zhang, Y. Runoff of arid and semi-arid regions simulated and projected by CLM-DTVGM and its multi-scale fluctuations as revealed by EEMD analysis. J. Arid. Land 2016, 8, 506–520. [Google Scholar] [CrossRef] [Green Version]
  28. Hawkins, D. The problem of overfitting. J. Chem. Inf. Comput. Sci. 2004, 44, 1–12. [Google Scholar] [CrossRef]
Figure 1. GRU structure.
Figure 1. GRU structure.
Atmosphere 13 01130 g001
Figure 2. Flow figure of EEMD–GRU model.
Figure 2. Flow figure of EEMD–GRU model.
Atmosphere 13 01130 g002
Figure 3. Decomposition result of EEMD.
Figure 3. Decomposition result of EEMD.
Atmosphere 13 01130 g003
Figure 4. Prediction results of BP model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Figure 4. Prediction results of BP model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Atmosphere 13 01130 g004
Figure 5. Scatter plot of BP model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Figure 5. Scatter plot of BP model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Atmosphere 13 01130 g005
Figure 6. Prediction results of GRU model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Figure 6. Prediction results of GRU model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Atmosphere 13 01130 g006
Figure 7. Scatter plot of GRU model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Figure 7. Scatter plot of GRU model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Atmosphere 13 01130 g007
Figure 8. Prediction results of EEMD–GRU model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Figure 8. Prediction results of EEMD–GRU model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Atmosphere 13 01130 g008
Figure 9. Scatter plot of EEMD–GRU model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Figure 9. Scatter plot of EEMD–GRU model. Note: The data on the left are autumn and winter, the data on the right are spring and summer.
Atmosphere 13 01130 g009
Figure 10. Comparison of prediction errors during autumn and winter.
Figure 10. Comparison of prediction errors during autumn and winter.
Atmosphere 13 01130 g010
Figure 11. Comparison of prediction errors during spring and summer.
Figure 11. Comparison of prediction errors during spring and summer.
Atmosphere 13 01130 g011
Table 1. The instrument information of the pig house.
Table 1. The instrument information of the pig house.
EquipmentRangeModelManufacturers
CO2 sensor0–5000 ppmCO2 SENSORBig Herdsman Co., Ltd., Qingdao, China
temperature and humidity sensor40–70 °C and 0–100%HTV 597Big Herdsman Co., Ltd., Qingdao, China
wind speed sensor PDHPuxindun Co., Ltd., Shijiazhuang, China
CO2 calibration--HCK200-CO2-01Shenzhen Kechuang Heng Electronic Technology Co., Ltd., Shenzhen, China
environmental controller--BH 8118Big Herdsman Co., Ltd., Qingdao, China
Table 2. The environmental parameters of the pig house.
Table 2. The environmental parameters of the pig house.
TimeCO2 (ppm)Temperature (°C)Humidity (%)Wind Speed (m/s)
2 November 2018 0:001024.09.450.90.27
2 November 2018 1:001008.09.051.20.27
2 November 2018 2:00982.18.450.40.29
2 November 2018 3:00958.68.250.50.26
2 November 2018 4:00930.07.950.90.27
18 February 2019 14:001253.314.641.70.29
18 February 2019 15:001250.114.643.90.29
18 February 2019 16:001298.415.154.20.26
18 February 2019 17:002122.618.571.10.23
18 February 2019 18:003101.119.670.90.18
Table 3. BP model parameter.
Table 3. BP model parameter.
ParameterParameter Value
Training set70% of all data sets
Test set30% of all data sets
OptimizerAdam
Exponential Decay Rate for First Moment Estimation0.9
Exponential Decay Rate of Second Moment Estimation0.999
Epsilon1 × 10−8
Hidden layer activation functionRelu
Number of network layers3
Number of hidden layer nodes1015
Epochs500
Output layer activation functionLinear
Learning rate0.001
Table 4. GRU parameter.
Table 4. GRU parameter.
ParameterParameter Value
Training set70% of all data sets
Test set30% of all data sets
OptimizerAdam
Regularity coefficient on weight0.001
Regularity coefficient on cyclic kernel0.005
Number of GRU units40
Full connection layers1
Number of neurons in fully connected Layer1
Epochs200
Batchsize128
Table 5. Comparison of prediction errors of the three models.
Table 5. Comparison of prediction errors of the three models.
SeasonModelRMSE (ppm)MAE (ppm)MAPER2
Autumn and winterBP382.0328.217.4%0.89
Autumn and winterGRU299.0169.09.6%0.93
Autumn and winterEEMD–GRU123.288.33.2%0.99
Spring and summerBP223.5192.721.7%0.58
Spring and summerGRU151.8101.117.8%0.66
Spring and summerEEMD–GRU129.193.25.9%0.76
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Zang, J.; Ye, S.; Xu, Z.; Wang, J.; Liu, W.; Bai, Y.; Yong, C.; Zou, X.; Zhang, W. Prediction Model of Carbon Dioxide Concentration in Pig House Based on Deep Learning. Atmosphere 2022, 13, 1130. https://doi.org/10.3390/atmos13071130

AMA Style

Zang J, Ye S, Xu Z, Wang J, Liu W, Bai Y, Yong C, Zou X, Zhang W. Prediction Model of Carbon Dioxide Concentration in Pig House Based on Deep Learning. Atmosphere. 2022; 13(7):1130. https://doi.org/10.3390/atmos13071130

Chicago/Turabian Style

Zang, Jianjun, Shuqin Ye, Zeying Xu, Junjun Wang, Wenchao Liu, Yungang Bai, Cheng Yong, Xiuguo Zou, and Wentian Zhang. 2022. "Prediction Model of Carbon Dioxide Concentration in Pig House Based on Deep Learning" Atmosphere 13, no. 7: 1130. https://doi.org/10.3390/atmos13071130

APA Style

Zang, J., Ye, S., Xu, Z., Wang, J., Liu, W., Bai, Y., Yong, C., Zou, X., & Zhang, W. (2022). Prediction Model of Carbon Dioxide Concentration in Pig House Based on Deep Learning. Atmosphere, 13(7), 1130. https://doi.org/10.3390/atmos13071130

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop