Neural network-based system for detecting ammonia concentration of pig house for facility breeding of live pigs

By designing a neural network-based ammonia concentration detection system for pig sanctuary in pig facility breeding, using multiple prediction models and NARX neural networks for ammonia concentration correction, the problem of environmental regulation lag in the existing technology is solved, and the pigs are realized Accurate monitoring and regulation of environmental parameters in the house have improved pig health and production efficiency.

CN119129385APending Publication Date: 2024-12-13YANCHENG INST OF TECH +1

Patent Information

Application Number
CN202411129887.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

It is difficult for the prior art to accurately monitor and regulate the ammonia concentration in pig farming, especially the coupling effect of multiple environmental parameters is not fully considered, resulting in lagging environmental regulation and affecting the environmental quality of pig houses and pig health.

Method used

A neural network-based ammonia concentration detection system for pig farming pigs is designed. Through the pig house environmental parameter acquisition module and ammonia concentration detection module, the RBF network of FCM clustering, XGBoost extreme gradient enhancement prediction model, and BiGRU bidirectional Components such as the gated cycle unit, CEEMDAN decomposition model and VMD decomposition model are constructed to build a variety of prediction models, combined with the NARX neural network to dynamic correction and fusion of ammonia concentration to improve detection accuracy.

Benefits of technology

It realizes high-precision prediction and correction of ammonia, wind speed, temperature and humidity in pig houses, improves the prediction accuracy and model robustness of pig house environmental parameters, provides scientific basis to regulate the pig house environment at all times, and improves pig welfare Chemical breeding level and production efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119129385A_ABST
    Figure CN119129385A_ABST
Patent Text Reader

Abstract

The invention provides a live pig facility breeding hog house ammonia concentration detection system based on a neural network, and the system comprises a hog house environment parameter collection module and a hog house ammonia concentration detection module which are connected in sequence. Wherein the hog house environment parameter acquisition module is used for acquiring ammonia gas information, wind speed information, temperature information and humidity information in a hog house; and the pig house ammonia gas correction fusion sub-module is used for correcting the predicted ammonia gas concentration based on the predicted wind speed, the predicted humidity and the predicted temperature. The method analyzes the influence of pig house ammonia gas on pig health, considers the coupling effect of multiple environment parameters of the pig house, provides a temperature, humidity and wind speed correction fusion method of the pig house ammonia gas concentration, and aims to improve the detection precision of the pig house ammonia gas concentration of pig facility breeding.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of neural network, and in particular to a neural network-based ammonia concentration detection system for piggeries in pig breeding facilities. Background Art

[0002] Pig house environmental quality is crucial for healthy pig farming, directly impacting pig growth and the profitability of the pig industry. Pig farming facilities produce a large amount of harmful gases, such as ammonia, hydrogen sulfide, carbon dioxide, and methane. Ammonia concentration is a key indicator for evaluating pig house environmental quality. Ammonia is a colorless, toxic gas with a strong irritating odor, which can weaken pigs' immunity. Excessive ammonia concentrations can irritate the pigs' respiratory mucosa and conjunctiva, inducing various inflammations.

[0003] Currently, my country's intelligent monitoring and decision-making technologies for pig facility farming environments are relatively backward. The main difficulty lies in the fact that the pig farming environment is a multivariable, nonlinear, time-varying coupled system, with various environmental factors influencing and restricting each other, and the mechanism of action is complex. Therefore, it is urgent to use advanced intelligent sensing and intelligent decision-making technologies to explore monitoring methods for multiple environmental parameters in pig facility farming, achieve precise control of the pig house environment, ensure the healthy growth of pigs, and improve the level of welfare farming. This has important theoretical value and practical significance for my country's pig production.

[0004] Research has been conducted abroad on the application of artificial neural networks to detect ammonia concentrations in agricultural breeding environments, and domestic scholars have also conducted research on this topic. Ammonia concentrations are affected by environmental factors such as temperature, humidity, and ventilation within the piggery. While relying solely on monitoring equipment to obtain ammonia concentration data can yield data, there is a lag in control. Accurately and timely monitoring of ammonia concentration changes in agricultural breeding environments helps breeding managers understand the environmental quality of piggeries, providing a scientific basis for timely and precise regulation of the piggery environment, thereby improving the welfare of piggeries and the efficiency of pig production. However, these studies have not considered the coupling effects of multiple environmental parameters within the piggery and have focused on applying neural networks to detect ammonia concentrations within the piggery. Summary of the Invention

[0005] The present invention provides a neural network-based ammonia concentration detection system for pig houses in pig breeding facilities. The system analyzes the impact of ammonia in pig houses on the health of pigs, considers the coupling effect of multiple environmental parameters in the pig house, and proposes a temperature, humidity, and wind speed correction fusion method for the ammonia concentration in the pig house, aiming to improve the detection accuracy of the ammonia concentration in pig houses in pig breeding facilities.

[0006] The present invention provides a piggery ammonia concentration detection system based on a neural network in a piggery facility, comprising: a piggery environmental parameter acquisition module and a piggery ammonia concentration detection module connected in sequence;

[0007] Among them, the pig house environmental parameter collection module is used to collect ammonia information, wind speed information, temperature information, and humidity information in the pig house;

[0008] The pig house ammonia concentration detection module includes: a pig house ammonia prediction submodule, a pig house wind speed prediction submodule, a pig house temperature prediction submodule, a pig house humidity prediction submodule, and a pig house ammonia correction fusion submodule based on NARX neural network, which are connected in sequence;

[0009] The pig house ammonia prediction submodule is used to predict the ammonia concentration in the pig house based on ammonia information;

[0010] The pig house wind speed prediction submodule is used to predict the wind speed in the pig house based on the wind speed information;

[0011] The pig house temperature prediction submodule is used to predict the temperature in the pig house based on the temperature information;

[0012] The pig house humidity prediction submodule is used to predict the predicted humidity in the pig house based on humidity information;

[0013] The pig house ammonia correction fusion submodule is used to correct the predicted ammonia concentration based on the predicted wind speed, predicted humidity, and predicted temperature.

[0014] The present invention has achieved the following beneficial effects:

[0015] 1. According to the characteristics of the sample differences of pig house ammonia and pig house wind speed parameters, the present invention constructs an RBF network classifier for FCM clustering of pig house ammonia and an ART2 neural network classifier for K-means clustering of pig house wind speed to classify the multi-point sample parameters of pig house ammonia and pig house wind speed respectively, designs multiple combination prediction models for pig house ammonia and a DRNN neural network pig house ammonia prediction result reconstruction model, and also designs a wavelet packet decomposition model, an Elman neural network prediction model group and a DRNN neural network pig house wind speed prediction result reconstruction model for pig house wind speed; in the process of continuous forecasting of pig house ammonia and pig house wind speed, their characteristics in time and space are fully considered, and data with similar causes and relatively homogeneous are extracted from massive data, thereby establishing a more targeted prediction model that can better reflect any time period, thereby improving the prediction accuracy of pig house ammonia and pig house wind speed.

[0016] 2. The combined prediction model of the present invention establishes prediction sub-models based on three methods: the XGBoost extreme gradient boosting prediction model, the BiGRU bidirectional gated recurrent unit prediction model, and the ARIMA differential autoregressive moving average prediction model. These three methods implement nonlinear combined approximation of pig house ammonia gas, construct a combined prediction model, and predict pig house ammonia gas gas based on the MATLAB simulation platform. Case studies have shown that the combined prediction model can integrate information from a single prediction method, achieve information complementarity, improve model robustness, and the prediction results of integrating multiple methods are more scientific and accurate than those of a single prediction method.

[0017] 3. The present invention decomposes the nonlinear and non-stationary piggery temperature parameter time series into multiple intrinsic mode function (IMF) components and a residual r(t) through the CEEMDAN decomposition model. To avoid excessive intrinsic mode function (IMF) components significantly increasing the difficulty of model training and reducing prediction accuracy, the decomposed intrinsic mode function (IMF) components are reconstructed in phase space using permutation entropy to obtain subsequences, thereby reducing the complexity of the intrinsic mode function (IMF) components. The partial autocorrelation function and random forest are used to perform two-scale feature selection on the subsequences to obtain new subsequences. Each new subsequence is then used to construct an ELM extreme learning machine piggery temperature prediction model. Finally, the prediction results of each new subsequence are nonlinearly superimposed through the DRNN neural network to obtain the final piggery temperature output value. Case studies have shown that the proposed final prediction result has a high piggery temperature prediction accuracy.

[0018] 4. The present invention decomposes the pig house humidity into multiple IMFs and a residual r(t) through the pig house humidity VMD decomposition model. In order to avoid excessive IMF components significantly increasing the difficulty of model training and reducing prediction accuracy, fuzzy entropy is used to calculate the complexity of each component. According to the obtained fuzzy entropy value, components with similar fuzzy entropy values ​​are superimposed and merged to obtain a new subsequence, reducing the number of components. The high-frequency subsequence with complex fluctuation characteristics is used as the input of the LSTM neural network model with strong complex time series learning ability, and the medium and low-frequency subsequences with less complex fluctuation characteristics are used as the input of the LSSVR least squares support vector regression model. The output of the LSTM neural network model and the output of the LSSVR least squares support vector regression model are used as the input of the DRNN neural network humidity prediction result fusion model. The final humidity prediction value is output through the nonlinear superposition of the DRNN neural network. Case studies show that the proposed final prediction result has a high pig house humidity prediction accuracy.

[0019] 5. The dynamic correction fusion submodule of the pig house ammonia concentration of the present invention is composed of 8 dy / dt modules and a NARX neural network. The 8 dy / dt modules are divided into 4 groups, and 2 dy / dt units in each group are connected in series to form 4 change rate loops. The primary change rate and secondary change rate that directly affect the ammonia in the pig house are introduced into the NARX neural network training of the dynamic correction fusion submodule of the pig house ammonia concentration through the change rate loop 1. The primary change rate and secondary change rate of the wind speed, temperature and humidity that indirectly affect the ammonia in the pig house are introduced into the NARX neural network training of the dynamic correction fusion submodule of the pig house ammonia concentration through the change rate loops 2, 3, and 4, forming a new input vector, which has good nonlinear mapping ability and improves the generalization ability of the network, so that it has better correction accuracy and adaptability in the dynamic correction fusion submodule of the nonlinear pig house ammonia concentration than the traditional static neural network, thereby improving the prediction accuracy of the ammonia concentration in the pig house.

[0020] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.

[0021] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0023] Figure 1 A schematic diagram of a neural network-based ammonia concentration detection system for piggery facilities in an embodiment of the present invention;

[0024] Figure 2 Schematic diagram of a pig house multi-environmental parameter acquisition module in an embodiment of the present invention;

[0025] Figure 3 Schematic diagram of a pig house ammonia concentration detection module in an embodiment of the present invention;

[0026] Figure 4 This is a functional block diagram of the remote server monitoring software in an embodiment of the present invention;

[0027] Figure 5 This is a diagram showing the layout of the pig farm LoRa star network equipment in an embodiment of the present invention;

[0028] Figure 6 This is a planar layout diagram of the sensor nodes of the pig house multi-environmental parameter acquisition module in an embodiment of the present invention;

[0029] Figure 7 This is a planar layout diagram of the sensors of the pig house multi-environmental parameter acquisition module in an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0031] The present invention provides a system for detecting ammonia concentration in piggery facilities based on neural network. Figure 1 As shown, it includes: a pig house environmental parameter acquisition module and a pig house ammonia concentration detection module connected in sequence;

[0032] Among them, the pig house environmental parameter collection module is used to collect ammonia information, wind speed information, temperature information, and humidity information in the pig house;

[0033] The pig house ammonia concentration detection module includes: a pig house ammonia prediction submodule, a pig house wind speed prediction submodule, a pig house temperature prediction submodule, a pig house humidity prediction submodule, and a pig house ammonia correction fusion submodule based on NARX neural network, which are connected in sequence;

[0034] The pig house ammonia prediction submodule is used to predict the ammonia concentration in the pig house based on ammonia information;

[0035] The pig house wind speed prediction submodule is used to predict the wind speed in the pig house based on the wind speed information;

[0036] The pig house temperature prediction submodule is used to predict the temperature in the pig house based on the temperature information;

[0037] The pig house humidity prediction submodule is used to predict the predicted humidity in the pig house based on humidity information;

[0038] The pig house ammonia correction fusion submodule is used to correct the predicted ammonia concentration based on the predicted wind speed, predicted humidity, and predicted temperature.

[0039] The pig house ammonia prediction submodule includes: RBF network classifier of pig house ammonia FCM clustering, combined prediction model, and DRNN neural network pig house ammonia fusion model connected in sequence;

[0040] Among them, the combined prediction model is composed of the XGBoost extreme gradient enhancement prediction model, the BiGRU bidirectional gated recurrent unit prediction model, and the GM (1,1) grey prediction model.

[0041] The pig house wind speed prediction submodule includes: the ART2 neural network classifier of pig house wind speed K-means clustering, wavelet packet decomposition model, Elman neural network prediction model group, and DRNN neural network pig house wind speed fusion model connected in sequence;

[0042] Among them, the Elman neural network prediction model group is composed of multiple Elman neural network prediction models.

[0043] The pig house temperature prediction submodule includes: a sequentially connected pig house humidity CEEMDAN decomposition model, a permutation entropy reconstruction step, a two-scale feature selection step for the value sequence using partial autocorrelation function and random forest, an ELM extreme learning machine pig house temperature prediction model, and a DRNN neural network pig house temperature fusion model.

[0044] The pig house humidity prediction submodule includes: the pig house humidity VMD decomposition model, fuzzy entropy merging step, LSTM neural network pig house humidity prediction model, LSSVR least squares support vector regression machine pig house humidity prediction model, and DRNN neural network pig house humidity fusion model, which are connected in sequence.

[0045] The pig house ammonia correction fusion submodule includes: a rate of change loop and a NARX neural network pig house ammonia correction fusion model connected in sequence.

[0046] The RBF network classifiers for FCM clustering of ammonia in pig houses include:

[0047] For the pig house ammonia input vector x=(x1,x2,…,x M ) to perform fuzzy c-means clustering, and the obtained cluster center is used as the center c of the RBF function p , the number of clusters is used as the number of hidden layer nodes of the RBF network;

[0048] Calculate the distance d between each cluster center and the width σ of the RBF function p for:

[0049]

[0050] In the formula, d max is the maximum distance between cluster centers, k is the number of hidden layer nodes;

[0051] Calculate the distance between each pig house ammonia sample point and each cluster center using the Gaussian function k is the number of clusters, c p is the center of the p-th RBF function and calculates the output of the hidden layer node;

[0052] The output layer outputs the pig house ammonia category y j for:

[0053]

[0054] w in the formula jp is the connection weight between the hidden layer p neuron and the output layer j neuron, α j is the bias of the output layer, and L is the dimension of the output vector.

[0055] XGBoost extreme gradient boosting prediction models include:

[0056] Let D = {(x i ,y i )}(|D|=n,x i ∈R m ,y i ∈R), n is the number of pig house ammonia samples, m is the number of features contained in the sample, x i is the sample data, y i is the true value of the sample; the XGBoost model contains K CART trees, and the output is the sum of the K trees as the predicted value of the XGBoost model:

[0057]

[0058] in the formula is the predicted value of sample i, i is the number of trees, F is the set of CART trees, x i represents the feature vector of the i-th data point, f k is the function model of the i-th tree.

[0059] The BiGRU bidirectional gated recurrent unit prediction model includes:

[0060] BiGRU is composed of two unidirectional GRUs with opposite directions. The forward GRU moves from the beginning of the sequence to the end of the sequence, and the reverse GRU moves from the end of the sequence to the beginning of the sequence. Suppose the historical data sequence of ammonia in the pig house is x = {x1, x2…, x n}, the output formula is

[0061] h t(fwd) =G fwd (x t ,h t-1(fwd) )

[0062] h t(bwd) =G bwd (x t ,h t-1(bwd) )

[0063] h t(bi) =h t(fwd) ⊕h t(bwd)

[0064] In the formula, h t(fwd)is the state of the forward GRU, h t(bwd) is the state of the reverse GRU, ⊕ is h t(fwd) and h t(bwd) The connection symbol between t(bi) is the output of BiGRU.

[0065] The grey GM(1,1) prediction model is a modeling process that predicts pig house ammonia by accumulating irregular historical data of pig house ammonia to obtain a relatively regular generated data sequence. The data obtained by generating the predicted pig house ammonia grey GM(1,1) prediction model are then subtracted to obtain the predicted value of the original data. Assuming that the historical data sequence of pig house ammonia to be predicted is:

[0066] x (0) ={x (0) (1),x (0) (2),......,x (0) (n)}

[0067] After first-order accumulation, the new sequence generated is:

[0068] x (1) ={x (1) (1),x (1) (2),......,x (1) (n)}

[0069] in n represents the number of original data;

[0070] Then x (1) The sequence has an exponential growth law, that is, it satisfies the first-order linear differential equation:

[0071]

[0072] In the formula, a is the development gray number, which reflects x (1) and x (0) The development trend of u is the endogenous control gray number, which reflects the change relationship between the data. Solving the differential equation of the above formula gives x (1) The predicted ammonia value in pig houses is:

[0073]

[0074] The original sequence x is obtained by cumulative reduction of the following formula (0) The gray prediction model of ammonia in pig houses is:

[0075]

[0076] The working principle and beneficial effects of the above technical solution are:

[0077] The pigsty environment parameter acquisition module includes a terminal monitoring device, a network communication layer, and an application layer. The terminal monitoring device sends the detected multi-environment parameters of the pigsty to the network communication layer through LoRa wireless communication; the LoRa aggregation node of the network communication layer aggregates the environment information sent by each terminal monitoring device and then sends it to the upper computer server of the application layer through GPRS wireless communication; the upper computer server stores the acquired multi-environment parameters of the pigsty in the database for the prediction of the multi-environment parameters of the pigsty. The overall system structure is shown in Figure 2 and Figure 3 .

[0078] The terminal monitoring device includes multiple LoRa terminal acquisition points. The LoRa terminal acquisition point includes a pigsty temperature and humidity sensor, a carbon dioxide sensor, an ammonia sensor, a hydrogen sulfide sensor, a wind speed sensor, a PLC controller, a negative pressure fan for controlling the pigsty environment, a wet curtain, a heater, a gas purifier, and a touch screen. The pigsty environment information collected by the PLC is sent to the LoRa aggregation node through the LoRa wireless communication module. To avoid data collision, a time-division multiplexed LoRa star network is adopted. The software of the LoRa terminal acquisition point mainly realizes the acquisition and preprocessing of the multi-environment parameters of the pigsty, the control of the pigsty temperature, humidity, and harmful gases, and LoRa wireless communication. The software uses ladder diagram programming, which is simple and intuitive, improves the readability of the program, and thus gives play to the strong reliability of the device.

[0079] The application layer server monitoring software is based on the C / S architecture and is developed in the Visual Studio 2024 environment using the C#.Net language. Its functional structure is as shown in Figure 4 , and includes a pigsty ammonia concentration detection system, a pigsty environment monitoring system, and a network communication interface. The pigsty ammonia concentration detection system finally obtains the detection value of the pigsty ammonia concentration according to the outputs of the pigsty ammonia concentration prediction sub-module, the pigsty wind speed prediction sub-module, the pigsty temperature prediction sub-module, the pigsty humidity prediction sub-module, and the pigsty ammonia concentration correction sub-module. The pigsty environment monitoring system can view and manage the historical data of the multi-environment parameters of all pigsties in the pig farm. The network communication interface realizes the communication between the server and the client.

[0080] In specific applications, according to the actual situation of the pig farm, LoRa star networking is carried out for different types of pigsties, and the aggregation gateway is arranged in the pig farm management office, as shown in Figure 5 ; the sensor nodes are evenly arranged in a "field" shape in different types of pigsties to be detected, and the plane layout of the sensor nodes is as shown in Figure 6 ; the sensors are evenly arranged at three different heights of 0.5 meters, 1.0 meters, and 1.5 meters from the ground in different types of pigsties to be detected, and the plane layout of the sensors is as shown in Figure 7As shown in the figure, pigs at 0.5m and 1.0m may damage the sensor. In order to prevent the pigs from damaging the sensor, an acoustic and optical repellent is installed to warn and drive away the approaching pigs. The system can realize three-dimensional detection of environmental parameters of different types of pig houses.

[0081] 1. Design of pig house ammonia prediction submodule

[0082] The pig house ammonia prediction submodule includes: RBF network classifier for pig house ammonia FCM clustering, multiple combined prediction models and DRNN neural network pig house ammonia fusion model;

[0083] The pig house ammonia detection value is used as the input of the RBF network classifier of the pig house ammonia FCM clustering;

[0084] The RBF network classifier of the pig house ammonia FCM clustering classifies the pig house ammonia detection values, and the classified ammonia detection values ​​of each type of pig house serve as the input of the corresponding combined prediction model;

[0085] A. RBF network classifier for FCM clustering of ammonia in pig houses

[0086] The fuzzy-c means (FCM) clustering method determines the center, width, and number of hidden layer nodes of the RBF function, and a supervised learning method is used to train the output layer weights, which accelerates the training speed of the RBF network. The RBF network classifier designed by this patent has high classification accuracy and fast training speed.

[0087] The RBF network learning algorithm for FCM clustering of ammonia in pig houses is as follows:

[0088] ①. Input vector x=(x1,x2,…,x M ) to perform fuzzy c-means clustering, and the obtained pig house ammonia cluster center is used as the center c of the RBF function p , the number of clusters is used as the number of hidden layer nodes in the RBF network.

[0089] ②. Calculate the distance d between each cluster center and the width σ of the RBF function p for:

[0090]

[0091] In the formula, d max is the maximum distance between cluster centers, and k is the number of hidden layer nodes.

[0092] Calculate the distance between each pig house ammonia sample point and each cluster center using the Gaussian function k is the number of clusters, c p is the center of the p-th RBF function and calculates the output of the hidden layer node.

[0093] ③. Output layer outputs pig house ammonia category y j for:

[0094]

[0095] w in the formula jp is the connection weight between the hidden layer p neuron and the output layer j neuron, α j is the bias of the output layer, and L is the dimension of the output vector.

[0096] The number of input layer nodes of the RBF network designed in this patent is M, which is the eigenvalue of the data object, and the number of hidden layer nodes is k, which is the number of clusters.

[0097] The RBF network classifier of FCM clustering of pig house ammonia divides pig house ammonia into multiple types. Each pig house ammonia type serves as the input of the corresponding combined prediction model, and the output of each combined prediction model is the fusion prediction value of ammonia in that type of pig house.

[0098] B. Pig house ammonia combined prediction model

[0099] The pig house ammonia combination prediction model includes combination prediction model 1, combination prediction model 2 and combination prediction model N. Each combination prediction model includes the XGBoost extreme gradient enhancement pig house ammonia prediction model, the BiGRU bidirectional gated cyclic unit pig house ammonia prediction model and the GM (1,1) gray pig house ammonia prediction model, as well as the genetic algorithm variable weight addition of N prediction values ​​to obtain the value of the combination prediction model. The RBF network classifier of the pig house ammonia FCM clustering divides the pig house ammonia historical data into N types. The ammonia historical data of each type of pig house is used as the input of the combination prediction model of the corresponding class. Each combination prediction model realizes the prediction of ammonia in different types of pig houses, thereby improving the prediction accuracy of ammonia in pig houses. The output values ​​of the N combination prediction models are used as the input of the DRNN neural network pig house ammonia fusion model.

[0100] ①, XGBoost extreme gradient enhanced pig house ammonia prediction model

[0101] XGBoost is an integrated tree model with the advantages of fast training speed and high prediction accuracy. The XGBoost model is a modeling method that predicts the future ammonia level in a pig farm based on the historical data of ammonia level in the pig house being predicted. It analyzes the time series of ammonia level in the pig house being predicted. Let D = {(x i ,y i )}(|D|=n,x i ∈R m ,y i ∈R), n is the number of pig house ammonia samples, m is the number of features contained in the sample, x i is the sample data, yi is the true value of the sample. The XGBoost model contains K CART trees, and the output is the sum of the K trees as the predicted value of the XGBoost model:

[0102]

[0103] in the formula is the predicted value of the i-th sample, i is the number of trees, F is the set of CART trees, xi represents the eigenvector of the i-th data point, f k is the function model of the i-th tree.

[0104] By constructing an XGBoost model to predict ammonia in pig houses, the prediction of ammonia in the pig houses of this patent can be achieved, and an XGBoost extreme gradient enhancement prediction model corresponding to ammonia in pig houses can be constructed.

[0105] ②BiGRU bidirectional gated cycle unit pig house ammonia prediction model

[0106] Traditional recurrent neural networks (RNNs), long short-term memory (LSTMs), and gated recurrent units (GRUs) only record past information, while bidirectional gated recurrent units (BiGRUs) can retain past and future information and combine the two, allowing the prediction model to learn higher features from the pig house ammonia time series. This patent uses BiGRU to build a pig house ammonia prediction model. BiGRU consists of two unidirectional GRUs in opposite directions. The forward GRU moves from the beginning of the sequence to the end of the sequence, and the reverse GRU moves from the end of the sequence to the beginning of the sequence. Suppose the pig house ammonia historical data sequence is x = {x1, x2…, x n}, the output formula is

[0107] h t(fwd) =G fwd (x t ,h t-1(fwd) )

[0108] h t(bwd) =G bwd (x t ,h t-1(bwd) )

[0109] h t(bi) =h t(fwd) ⊕h t(bwd)

[0110] In the formula, h t(fwd) is the state of the forward GRU, h t(bwd) is the state of the reverse GRU, ⊕ is h t(fwd) and h t(bwd) The connection symbol between t(bi) is the output of BiGRU.

[0111] By constructing a BiGRU model to predict ammonia in pig houses, the prediction of ammonia in the pig houses of this patent can be achieved, and a BiGRU prediction model corresponding to ammonia in pig houses can be constructed.

[0112] ③GM(1,1) gray pig house ammonia prediction model

[0113] The GM(1,1) grey piggery ammonia prediction model is a modeling process that predicts piggery ammonia by accumulating irregular historical data of piggery ammonia to obtain a relatively regular generated data sequence. The data obtained by generating the predicted piggery ammonia GM(1,1) grey prediction model is then subtracted to obtain the predicted value of the original data. Assume that the historical data sequence of piggery ammonia to be predicted is:

[0114] x (0) ={x (0) (1),x (0) (2),......,x (0) (n)}

[0115] After first-order accumulation, the new sequence generated is:

[0116] x (1) ={x (1) (1),x (1) (2),......,x (1) (n)}

[0117] in n represents the number of original data.

[0118] Then x (1) The sequence has an exponential growth law, that is, it satisfies the first-order linear differential equation:

[0119]

[0120] In the formula, a is the development gray number, which reflects x (1) and x (0) The development trend of u is the endogenous control gray number, which reflects the change relationship between the data. Solving the differential equation of the above formula, we can get x (1) The predicted ammonia value in pig houses is:

[0121]

[0122] The original sequence x is obtained by cumulative reduction of the following formula (0) The gray prediction model of ammonia in pig houses is:

[0123]

[0124] By constructing a GM (1,1) grey pig house ammonia prediction model, the prediction of ammonia in the pig house according to this patent can be realized, and a GM (1,1) grey model corresponding to ammonia in the pig house can be constructed.

[0125] C. DRNN neural network pig house ammonia fusion model

[0126] The input of the DRNN neural network pig house ammonia fusion model is the output of multiple pig house ammonia combination prediction models, and the output of the DRNN neural network pig house ammonia fusion model is the fusion value output by multiple pig house ammonia combination prediction models.

[0127] Assume that the ammonia input vector of the DRNN network pig house is in is the input of the i-th neuron at time t, is the sum of the inputs to the jth recurrent neuron, is the output of the j-th recurrent layer. f(·) is a function of S, which is the Sigmoid function.

[0128] Then the output of the DRNN neural network output layer is:

[0129]

[0130] This patent uses the gradient method to correct the weights of the DRNN neural network, so that the predicted output of the DRNN neural network for ammonia in the pig house continues to approach the expected output.

[0131] 2. Design of pig house wind speed prediction submodule

[0132] The pig house wind speed prediction submodule includes: ART2 neural network classifier for pig house wind speed K-means clustering, multiple wavelet packet decomposition models, multiple Elman neural network prediction model groups and DRNN neural network pig house ammonia fusion model;

[0133] The pig house wind speed detection value is used as the input of the ART2 neural network classifier of the pig house wind speed K-means clustering;

[0134] The ART2 neural network classifier of the pig house wind speed K-means clustering classifies the pig house wind speed detection values, and the classified pig house wind speed detection values ​​of each type are used as the input of the corresponding wavelet packet model;

[0135] The wavelet packet model decomposes the wind speed detection value of each type of pig house after classification, and the decomposed low-frequency and high-frequency components serve as inputs of the corresponding Elman neural network prediction model group;

[0136] The outputs of the multiple Elman neural network prediction model groups are used as inputs to the DRNN neural network pig house ammonia fusion model;

[0137] A. ART2 neural network classifier for K-means clustering of pig house wind speed

[0138] The K-means algorithm is introduced into the ART2 neural network to correct the defect that only the neurons with the largest output value are selected to participate in subsequent calculations, thereby improving the classification accuracy of the ART2 neural network.

[0139] Define l category sample vector sets, and let the pig house wind speed category sample vector set be X={x (1) ,x (2) ,…,x (l)}, the category vector is n is the number of sample eigenvalues. The ART2 neural network learning algorithm for pig house wind speed K-means clustering is as follows:

[0140] ①. Initially set the range of the warning value ρ and select the warning value ρ. Use the ART2 neural network to perform initial classification on the input pig house wind speed data to obtain the number of categories l under the selected warning value ρ;

[0141] ②. Substitute the number of categories l obtained in step ① into the K-means algorithm and initialize the j-th cluster center z (j) , z (j) It is the mean vector of all samples in each category in step ①. Combined with the minimum distance criterion of the K-means algorithm, the input pig house wind speed data xi is reclassified and the classification is adjusted according to the following formula.

[0142]

[0143] N in the formula j, is the number of samples contained in the jth class.

[0144] ③. Calculate the sum of squares of the distances from each sample to the center of its category using the following formula: W .

[0145]

[0146] Judge J W Is it the minimum value? If it is the minimum value, output the result; otherwise, return to step ① and reselect the warning value ρ to continue the calculation.

[0147] B. Pig house wind speed wavelet packet decomposition model

[0148] Wavelet packet decomposition is an improved and effective decomposition method of wavelet decomposition. It can decompose high-frequency and low-frequency signals simultaneously and adaptively select the corresponding frequency band to match the signal spectrum according to the signal characteristics and analysis requirements. For the fluctuating signal of pig house wind speed, wavelet packet decomposition can highlight the signal's detailed features, extract useful information from the signal, and approximate any nonlinear function. The wavelet packet decomposition algorithm formula is:

[0149]

[0150] in the formula is the wavelet packet coefficient; j is the scale parameter, j∈{i,i-1,…,1}; l and k are translation parameters; n is the probability parameter; h k-2l 、g k-2l It is the low-pass and high-pass filter bank in wavelet packet decomposition.

[0151] The reconstruction algorithm is:

[0152]

[0153] In the formula, is the wavelet packet coefficient after wavelet packet reconstruction, Low-pass and high-pass filter banks for wavelet packet reconstruction.

[0154] Determining the number of wavelet packet decomposition layers is the key to wavelet packet decomposition. This patent uses a two-layer wavelet packet for decomposition, so that the pig house wind speed wavelet packet decomposition model decomposes the pig house wind speed time series data with fluctuation characteristics into multiple high-frequency components and one low-frequency component.

[0155] C. Elman neural network prediction model for pig house wind speed

[0156] The Elman neural network is a dynamic recursive neural network. It adds an association layer to the hidden layer on the basis of the BP network as a one-step delay operator to achieve the effect of memorizing the previous state, so that the system has the ability to adapt to time-varying characteristics and increase the global stability of the network. The structure of the Elman neural network is similar to a 4-layer BP neural network. The output of the hidden layer is self-connected to the input of the hidden layer through the delay and storage of the association layer. This self-connection method makes it sensitive to historical state data. The addition of the internal feedback network enhances the network's ability to process dynamic information, thereby achieving the purpose of dynamic modeling. In order to effectively solve the problem of approximation accuracy in pig house wind speed prediction and enhance the role of the association layer, this patent designs an improved Elman neural network pig house wind speed prediction model. Assume that the number of nodes in the input layer, hidden layer and output layer of the Elman neural network pig house wind speed prediction model are m, n and l respectively, and the output values ​​of the hidden layer, association layer and output layer of the network are:

[0157]

[0158] In the formula, w1 is the connection weight matrix from the association layer to the hidden layer, w2 is the connection weight matrix from the input layer to the hidden layer, w3 is the connection weight matrix between the hidden layer and the output layer, and w4 is the connection matrix from the association layer and the output layer to the output layer.

[0159] The number of nodes in the input layer, hidden layer and output layer of each Elman neural network pig house wind speed prediction model in this patent are 5, 11 and 1 respectively. The input of the Elman neural network is the classified historical data of pig house wind speed, and the output is the predicted value of each type of wind speed in the pig house, thereby realizing the classified prediction of pig house wind speed and improving the prediction accuracy.

[0160] D. DRNN neural network pig house wind speed fusion model

[0161] The input of the DRNN neural network pig house wind speed fusion model is the output of multiple pig house wind speed Elman neural network prediction model groups, and the output of the DRNN neural network pig house wind speed fusion model is the fusion value of the output of multiple pig house wind speed Elman neural network prediction model groups. The design method of the DRNN neural network pig house wind speed fusion model is similar to the design method of the DRNN neural network pig house ammonia fusion model of this patent and will not be repeated here.

[0162] 3. Design of pig house temperature prediction submodule

[0163] The pig house temperature prediction submodule includes a CEEMDAN decomposition model for pig house temperature, permutation entropy reconstruction, M extreme learning machine (ELM) prediction models, and a DRNN neural network prediction result fusion model. The CEEMDAN decomposition model decomposes the pig house temperature into an intrinsic mode function (IMF) and a residual (r(t). Permutation entropy reconstructs the decomposed intrinsic mode function in phase space and uses partial autocorrelation functions and random forests for two-scale feature selection to obtain a new subsequence. This new subsequence serves as the input to each extreme learning machine (ELM) prediction model. The output of each ELM prediction model serves as the input to the DRNN neural network temperature prediction result fusion model. The final temperature prediction value is output through nonlinear superposition of the DRNN neural network, thereby improving the prediction accuracy of pig house temperature.

[0164] A. CEEMDAN decomposition model of pig house temperature

[0165] During the decomposition process of the CEEMDAN algorithm, an adaptive Gaussian white noise sequence is added to the residual components, which overcomes the modal aliasing phenomenon of EMD and the Gaussian white noise problem of EEMD, and is suitable for analyzing nonlinear and non-stationary data sequences. The pig house temperature adaptive white noise complete ensemble empirical mode decomposition (CEEMDAN) can decompose the components with different characteristics in the pig house temperature time series data information to obtain multiple IMF components and a residual r(t), reflecting the different fluctuation information of the original pig house temperature signal. The adaptive Gaussian white noise added to the pig house temperature adaptive white noise complete ensemble empirical mode decomposition increases the number of IMFs, making the decomposed components gradually smoother. The decomposition process steps of the pig house temperature adaptive white noise complete ensemble empirical mode decomposition method for fattening pig house temperature time series data are as follows:

[0166] ①. Transform a Gaussian white noise w0ε i (t) is added to the original pig house temperature signal x(t) to generate a new signal x i (t)=x(t)+w0ε i (t)(i∈{1,...,I})

[0167] In the formula, w0 is the noise coefficient, ε i (t) is the white noise added for the i-th time, and I is the number of times the white noise is added.

[0168] ②. For a new signal x containing noise i (t) Perform EMD decomposition to obtain the first IMF component, which is the mean of the sequence components obtained after adding white noise I times

[0169] ③. Extract the first residual component r1(t)=x(t)-IMF1(t) from the original pig house temperature signal x(t).

[0170] ④. For r1(t)+w1E1(ε i (t)) is decomposed to obtain the second IMF component

[0171] E in the formula k (·) is the kth IMF component generated after the signal is decomposed by EMD.

[0172] ⑤. Repeat steps ③ and ④ to finally obtain the kth IMF.

[0173] ⑥. Until the final residual signal can no longer be decomposed, the final decomposed residual signal is

[0174] In this way, the adaptive white noise complete ensemble empirical mode decomposition model of pig house temperature decomposes the pig house temperature time series data into multiple IMF components and a residual r(t).

[0175] B. Permutation Entropy Reconstruction

[0176] The IMF reconstruction method based on permutation entropy is as follows: Assume {c1(t),c2(t),…,c i (t),…,c m (t)} represents the IMFs sequence obtained after the original fattening pig house temperature signal is decomposed by CEEMDAN, then c i The phase space reconstruction vector of (t) is:

[0177] C i (t)=(c i (t),c i (t+t),…,c i (t+(n-1)t))

[0178] In the formula, t is the delay coefficient and n is the embedding dimension.

[0179] Rearrange C in ascending order of n real numbers i (t) and satisfy:

[0180] (c i (t+(j1-1)t)≤c i (t+(j2-1)t)≤…≤c i (t+(j n -1)t))

[0181] According to the following formula, C i (t) is mapped into a set of symbolic vectors:

[0182] S(ξ)=(j1,j2,…,j n )

[0183] In the formula, ξ=1,2,…,l, and l≤n!, S(ξ) is a permutation of n!.

[0184] Calculate the probability of a symbol vector, with p1, p2, ..., p l express Then c i (t) The permutation entropy value is:

[0185]

[0186] In the formula, 1 / lnn! is the regularization coefficient.

[0187] Permutation entropy can effectively measure the complexity and randomness of the pig house temperature time series. Based on the similarity combination reconstruction idea, the original IMFs are reconstructed into RSCs to significantly reduce the complexity of the IMFs components. RSCs are calculated as:

[0188]

[0189] st|H pi -H p(i+j) |≤2(H pmax -H pmin ) / m

[0190] The partial autocorrelation coefficient PACF is used to calculate the possible input dimensions of all subsequences RSCs, and the random forest RF is used to eliminate irrelevant features, reduce the input dimension, and obtain the sequence with the optimal input dimension.

[0191] In MATLAB, the permutation entropy function PerEn(data,m,t) is called to perform permutation entropy reconstruction on the IMF obtained by the CEEMDAN decomposition model of pig house temperature to obtain multiple subsequences. Then, the partial autocorrelation function and random forest are used to perform two-scale feature selection on the subsequences to obtain multiple new sequences as the input of the ELM extreme learning machine pig house temperature prediction model.

[0192] C. Multiple ELM extreme learning machine pig house temperature prediction models

[0193] The input of the ELM extreme learning machine pig house temperature prediction model is the new sequence obtained by CEEMDAN decomposition, permutation entropy reconstruction, partial autocorrelation function and random forest subsequence two-scale feature selection. The output of multiple ELM extreme learning machine pig house temperature prediction models is the input of the DRNN neural network pig house temperature fusion model.

[0194] The ELM extreme learning machine is a single hidden layer feedforward neural network with a fast learning speed and good generalization ability. k ={x k ,y k}, k=1,2,…,M, M is the number of samples, x k 、y k are input data and true value respectively. Use activation function to approximate these M samples with zero error, and get the output o of ELM j for:

[0195]

[0196] In the formula, m is the number of hidden layer nodes, λ i is the connection weight between the hidden layer and the output layer, W i is the connection weight between the input layer and the hidden layer, bi is the bias vector, and f(·) is the activation function.

[0197] D. DRNN neural network pig house temperature fusion model

[0198] The input of the DRNN neural network pig house temperature fusion model is the output of multiple ELM extreme learning machine pig house temperature prediction models, and the output of the DRNN neural network pig house temperature fusion model is the fusion value of the outputs of multiple ELM extreme learning machine pig house temperature prediction models. The design method of the DRNN neural network pig house temperature fusion model can be similar to the design method of the DRNN neural network pig house ammonia fusion model in this patent, and will not be repeated here.

[0199] 4. Design of pig house humidity prediction submodule

[0200] The pig house humidity prediction submodule includes a pig house humidity VMD decomposition model, fuzzy entropy merging, an LSTM neural network pig house humidity prediction model, an LSSVR least squares support vector regression model, and a DRNN neural network pig house humidity prediction result fusion model. The pig house humidity VMD decomposition model decomposes the pig house humidity into the intrinsic mode function (IMF) and the residual r(t). Fuzzy entropy is used to calculate the complexity of each component. Based on the obtained fuzzy entropy value, components with similar fuzzy entropy values ​​are superimposed and merged to form a new subsequence. The high-frequency subsequences serve as the input to the LSTM neural network model, and the medium- and low-frequency subsequences serve as the input to the LSSVR least squares support vector regression model. The outputs of the LSTM neural network model and the LSSVR least squares support vector regression model serve as the input to the DRNN neural network humidity prediction result fusion model. The final humidity prediction value is output through nonlinear superposition of the DRNN neural network, thereby improving the prediction accuracy of pig house humidity.

[0201] A. VMD decomposition model of pig house humidity

[0202] The VMD method has a sparse characteristic when generating the main signal, which can effectively suppress modal aliasing. The VMD decomposition algorithm decomposes the original signal into k sub-modes u k , they are constrained to their center frequency ω k The VMD variational mode decomposition is suitable for the decomposition of humidity series in pig houses with large fluctuations and high noise. The specific algorithm steps are as follows:

[0203] ① Decompose the original pig house humidity signal f into discrete sub-modes u k (t)(k=1,2,3,…,K), ensuring that the sum of the estimated bandwidths of each mode is minimized;

[0204] ②、Each sub-mode u k (t) calculating the analytical signal by Hilbert transform;

[0205] ③Introducing the quadratic penalty factor α and the Lagrangian multiplication operator λ, the constrained problem is transformed into an unconstrained variational problem, and the augmented Lagrangian expression is obtained;

[0206] ④. The humidity modal components and center frequencies of each pig house can be obtained by using the cross-directional multiplier iteration method and Fourier transform.

[0207] In this way, the pig house humidity VMD decomposition model decomposes the pig house humidity time series data into multiple IMF components as the input of fuzzy entropy merging.

[0208] B. Fuzzy entropy merging

[0209] Fuzzy entropy is a dynamic algorithm that calculates the complexity and randomness of time series. It replaces the absolute amplitude difference with an exponential function to reduce the impact of data fluctuations on the prediction results, making the fuzzy entropy value change smoothly with the change of parameters. The steps of the fuzzy entropy algorithm are as follows:

[0210] ①, given the pig house humidity time series {x i}={x1,x2,…,x N}, construct an m-dimensional vector

[0211] in the formula is the reconstructed pig house humidity time series,

[0212] ②、Calculate vector and The distance between

[0213]

[0214] ③. Use fuzzy function Calculating vectors and The degree of similarity

[0215]

[0216] In the formula, r represents Similarity tolerance, n represents the boundary gradient;

[0217] ④. Calculating relationship dimensions And increase to m+1 dimension, repeat steps ①~③ to get

[0218] ⑤、Calculate fuzzy entropy S FE (m,n,r):

[0219]

[0220] In MATLAB, the fuzzy entropy function FuzzyEn(m,n,r) can be called to perform fuzzy entropy solution on the IMF obtained by the pig house humidity VMD decomposition model, and then the IMF components with similar fuzzy entropy values ​​are superimposed and merged to obtain high-frequency components and medium- and low-frequency components. In this way, the number of components can be reduced through fuzzy entropy recombination and merging, and the typical characteristics of similar components can be enhanced.

[0221] For high-frequency components with complex volatility, the LSTM model with strong complex time series learning ability is used, and the LSSVR model is used for medium and low-frequency components.

[0222] C. Multiple LSTM neural network pig house humidity prediction model

[0223] The Long Short-Term Memory (LSTM) neural network is a special type of recurrent neural network (RNN). LSTM predicts future changes in time series data by extracting historical features from it, making it suitable for processing and predicting time series data in various fields. It primarily consists of a memory cell and an input gate, an output gate, and a forget gate. The forget gate determines which information is discarded from the memory cell and is expressed as:

[0224] f t =σ(w fx x t +w fh h t-1 +w fc C t-1 +b f )

[0225] w in the formula fx 、w fh 、w fc and b f are the weight coefficient and bias of the forget gate respectively.

[0226] The input gate is responsible for deciding what information can be stored in the memory cell. The expression is:

[0227]

[0228] w in the formula ix 、w ih 、w ic and b i are the weight coefficient and bias of the input gate respectively. cx 、w chand b0 are the weight coefficient and bias of the candidate vector respectively.

[0229] The output gate determines what information will be output, and the expression is:

[0230]

[0231] w in the formula ox 、w oh 、w oc are the weight coefficients of the output gate, σ(·) is the sigmoid activation function, and tanh(·) is the hyperbolic tangent activation function.

[0232] The output of the multiple LSTM neural network pig house humidity prediction model is the predicted value of the pig house humidity data in the high frequency state, x1, x2,…, x n The high-frequency information of the pig house humidity historical data is obtained by VMD decomposition and fuzzy entropy merging. The output of multiple LSTM neural network pig house humidity prediction models is used as the input of the DRNN neural network pig house humidity fusion model.

[0233] D. Multiple LSSVR least squares support vector regression machine pig house humidity prediction model

[0234] The LSSVR least squares support vector regression model has strong generalization and global capabilities, overcoming the shortcomings of machine learning methods such as poor generalization, overfitting, and easy to fall into local optimality. The LSSVR least squares support vector regression model optimizes the quadratic programming problem into solving a system of linear equations, reducing the complexity of the solution and improving the calculation speed. Suppose the training sample set of the predicted value data of the medium and low frequency components of the pig house humidity is D = {(x i ,y i )|i=1,2,…,n},x i and y i are the input and output sample data respectively, and n is the number of samples. It maps the samples to a high-dimensional feature space through nonlinear mapping, and expresses the regression problem as a constrained optimization problem. The linear regression equation of the LSSVR least squares support vector regression machine is:

[0235]

[0236] In the formula, α i is the Lagrange multiplier, b is the bias, k(x,x i ) is a kernel function that satisfies the Mercer condition.

[0237] Kernel functions include global kernel functions and local kernel functions. Global kernel functions have strong generalization capabilities but weak learning abilities, while local kernel functions have strong learning abilities but weak generalization abilities. This patent combines the Poly kernel function with the RBF kernel function to construct a multi-kernel hybrid kernel function that is adaptable to multiple data sources. This approach overcomes the limitations of a single kernel function and improves the predictive capabilities of LSSVR.

[0238] K(x,x i )=λ·K poly (x,x i )+(1-λ)·K rbf (x,x i )=

[0239] λ·(x·x i +1) q +(1-λ)·exp(-||xx i || 2 / 2σ 2 )

[0240] In the formula, λ∈(0,1) is the weighting coefficient and σ is the bandwidth of the RBF kernel function.

[0241] The output of the pig house humidity prediction model using multiple LSSVR least squares support vector regression machines is the predicted value of the low-frequency component of the pig house humidity. Each intermediate node corresponds to a support vector, x1, x2,…, x n The medium and low frequency information of the pig house humidity historical data is obtained after VMD decomposition and fuzzy entropy merging. The output of multiple LSSVR least squares support vector regression machine pig house humidity prediction models is used as the input of the DRNN neural network pig house humidity fusion model.

[0242] E. DRNN neural network pig house humidity fusion model

[0243] The input of the DRNN neural network pig house humidity fusion model is the output values ​​of multiple LSTM neural network pig house humidity prediction models and the output values ​​of multiple LSSVR least squares support vector regression machine pig house humidity prediction models. The output of the DRNN neural network pig house humidity fusion model is a fusion of the output values ​​of multiple LSTM neural network pig house humidity prediction models and multiple LSSVR least squares support vector regression machine pig house humidity prediction models. The design method of the DRNN neural network pig house humidity fusion model can be similar to the design method of the DRNN neural network pig house ammonia fusion model in this patent, and will not be repeated here.

[0244] 5. Pig house ammonia correction fusion module

[0245] The pig house ammonia concentration correction fusion sub-module realizes the correction of the degree of influence of pig house wind speed, temperature and humidity on the ammonia concentration in the pig house, reflects the influence of the actual detection value changes of pig house wind speed, temperature and humidity on the ammonia concentration in the pig house, and improves the accuracy of pig house ammonia concentration detection.

[0246] A. Design of NARX neural network prediction fusion model

[0247] NARX (Nonlinear Auto-Regression with External Input Neural Network) is a dynamic feedforward neural network with predicted input parameters. It incorporates delay and feedback mechanisms to enhance its ability to retain historical data, enabling it to better handle complex time series data forecasts. The patented NARX neural network prediction model consists of an input layer, a hidden layer, an output layer, and input and output delays. Before application, the input and output delay orders and the number of hidden layer neuron nodes are determined. The current output of the NARX neural network prediction model depends not only on the past output S(tn), but also on the current input vector y(t) and the delay order of the input vector. The NARX neural network prediction fusion model structure includes an input layer, a hidden layer, an output layer, and a delay layer. The predicted input parameters are transmitted to the hidden layer via the delay layer. The hidden layer processes the input data and transmits it to the output layer. The output layer performs linear weighted processing on the hidden layer output data to obtain the final predicted output value. The delay layer delays the network feedback signal and the input layer output signal before sending them to the hidden layer. y(t) represents the input of the NARX neural network prediction fusion model at time t, m represents the order of the input delay; S(t) is the output of the NARX neural network fusion model at time t, n is the order of the output delay; the output of the jth hidden unit is:

[0248]

[0249] In the above formula, ω ji is the connection weight between the i-th input and the j-th hidden layer neuron, b j is the bias value of the jth hidden layer neuron, and the output S(t+1) of the NARX neural network prediction fusion model represents the predicted value of a:

[0250] S(t+1)=f[S(t),S(t-1),…,S(tn),y(t),y(t-1),…,y(t-m+1);W]

[0251] NARX neural networks, with their nonlinear mapping, robustness, and adaptability, are suitable for predicting complex time-series input parameters. Experiments have shown that the NARX neural network fusion model for piggery ammonia prediction can accurately predict piggery ammonia concentrations. Simulation results compared with those obtained with other neural networks show that the model established by this patented method achieves the smallest network size, the smallest prediction error, and the highest prediction accuracy when applied to piggery ammonia prediction, demonstrating the effectiveness of this method.

[0252] B. Design of pig house ammonia correction fusion submodule

[0253] The pig house ammonia correction fusion submodule consists of eight dy / dt sensors and a NARX neural network. The eight dy / dt sensors are divided into four groups, each with two dy / dt sensors connected in series to form rate loops 1, 2, 3, and 4. The output of the pig house ammonia prediction submodule serves as the input to rate loop 1 and the input to terminal a of the NARX neural network. The output of the connection between the two dy / dt sensors in rate loop 1 serves as the input to terminal c of the NARX neural network, and the output of rate loop 1 serves as the input to terminal b of the NARX neural network. The output of the pig house wind speed prediction submodule serves as the input to terminal d of the NARX neural network. The output of the connection between the two dy / dt sensors in rate loop 2 serves as the input to terminal f of the NARX neural network, and the output of rate loop 2 serves as the input to terminal e of the NARX neural network. The output of the pig house temperature prediction submodule serves as the input to rate of change loop 3 and the g-terminal input of the NARX neural network. The output of the two dy / dt connection terminals of rate of change loop 3 serves as the input to the i-terminal input of the NARX neural network, and the output of rate of change loop 3 serves as the input to the h-terminal input of the NARX neural network. The output of the pig house humidity prediction submodule serves as the input to rate of change loop 4 and the j-terminal input of the NARX neural network. The output of the two dy / dt connection terminals of rate of change loop 4 serves as the input to the l-terminal input of the NARX neural network, and the output of rate of change loop 4 serves as the input to the k-terminal input of the NARX neural network. The NARX neural network consists of 12 input nodes, namely a, b, c, d, e, f, g, h, i, j, k, and l, 20 hidden layer nodes, and 1 output node. The NARX neural network constructed in this patent adopts a three-layer network structure of 12-20-1. This patent uses the sparrow search algorithm (SSA) to optimize the weights and biases of the NARX neural network, making the NARX neural network have higher accuracy and generalization ability, and the predicted output of the NARX neural network continuously approaches the expected output.

[0254] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. A neural network-based ammonia concentration detection system for piggery facilities. It is characterized in that include: The pig house environmental parameter acquisition module and the pig house ammonia concentration detection module are connected in sequence; Among them, the pig house environmental parameter collection module is used to collect ammonia information, wind speed information, temperature information, and humidity information in the pig house; The pig house ammonia concentration detection module includes: a pig house ammonia prediction submodule, a pig house wind speed prediction submodule, a pig house temperature prediction submodule, a pig house humidity prediction submodule, and a pig house ammonia correction fusion submodule based on NARX neural network, which are connected in sequence; The pig house ammonia prediction submodule is used to predict the ammonia concentration in the pig house based on the ammonia information; The pig house wind speed prediction submodule is used to predict the predicted wind speed in the pig house based on the wind speed information; The pig house temperature prediction submodule is used to predict the predicted temperature in the pig house based on the temperature information; The pig house humidity prediction submodule is used to predict the predicted humidity in the pig house based on the humidity information; The pig house ammonia correction fusion submodule is used to correct the predicted ammonia concentration based on the predicted wind speed, predicted humidity, and predicted temperature.

2. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 1, It is characterized in that The pig house ammonia prediction submodule includes: RBF network classifiers of pig house ammonia FCM clustering, multiple combined prediction models, and DRNN neural network pig house ammonia fusion model connected in sequence; Among them, the combined prediction model is composed of the XGBoost extreme gradient enhancement prediction model, the BiGRU bidirectional gated recurrent unit prediction model and the GM (1,1) grey prediction model.

3. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 1, It is characterized in that The pig house wind speed prediction submodule includes: ART2 neural network classifier of pig house wind speed K-means clustering, wavelet packet decomposition model, Elman neural network prediction model group, DRNN neural network pig house wind speed fusion model connected in sequence; Among them, the Elman neural network prediction model group is composed of multiple Elman neural network prediction models.

4. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 1, It is characterized in that The pig house temperature prediction submodule includes: a sequentially connected pig house humidity CEEMDAN decomposition model, a permutation entropy reconstruction step, a dual-scale feature selection step for subsequences using partial autocorrelation function and random forest, an ELM extreme learning machine pig house temperature prediction model, and a DRNN neural network pig house temperature fusion model.

5. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 1, It is characterized in that The pig house humidity prediction submodule includes: the pig house humidity VMD decomposition model, fuzzy entropy merging step, LSTM neural network model, LSSVR least squares support vector regression machine model, and DRNN neural network pig house humidity fusion model, which are connected in sequence.

6. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 1, It is characterized in that The pig house ammonia correction fusion submodule includes: a rate of change loop and a NARX neural network connected in sequence.

7. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 2, It is characterized in that The RBF network classifiers for FCM clustering of ammonia in pig houses include: The ammonia input vector x = (x 1 ,x 2 ,…,x M ) to perform fuzzy c-means clustering, and the obtained cluster center is used as the center c of the RBF function p , the number of clusters is taken as the number of hidden layer nodes of RBF network; Calculate the distance d between each cluster center and the width σ of the RBF function p for: In the formula, d max is the maximum distance between cluster centers, k is the number of hidden layer nodes; Calculate the distance between each pig house ammonia sample point and each cluster center using a Gaussian function k is the number of clusters, c p is the center of the pth RBF function, and calculates the output of the hidden layer node; The output layer outputs the pig house ammonia category y j for: w in the formula jp is the connection weight between the hidden layer p neuron and the output layer j neuron, α j is the bias of the output layer, and L is the dimension of the output vector.

8. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 2, It is characterized in that XGBoost extreme gradient enhanced pig house ammonia prediction model includes: Let D = {(x i ,y i )}(|D|=n,x i ∈R m ,y i ∈R), n is the number of pig house ammonia samples, m is the number of features contained in the sample, x i is the sample data, y i is the true value of the sample; the XGBoost model contains K CART trees, and the output is the sum of the K trees, which is the predicted value of ammonia in the pig house of the XGBoost model: in the formula is the predicted value of the i-th sample, i is the number of trees, F is the set of CART trees, x i represents the feature vector of the i-th data point, f k is the function model of the i-th tree.

9. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 2, It is characterized in that The BiGRU bidirectional gated cycle unit pig house ammonia prediction model includes: BiGRU is composed of two unidirectional GRUs with opposite directions. The forward GRU moves from the beginning of the sequence to the end of the sequence, and the reverse GRU moves from the end of the sequence to the beginning of the sequence. Suppose the historical data sequence of ammonia in the pig house is x = {x 1 ,x 2 …,x n }, the output formula is h t(fwd) =G fwd (x t ,h t-1(fwd) ) h t(bwd) =G bwd (x t ,h t-1(bwd) ) h t(bi) =h t(fwd) ⊕h t(bwd) In the formula, h t(fwd) is the state of the forward GRU, h t(bwd) is the state of the reverse GRU, ⊕ is h t(fwd) and h t(bwd) The connection symbol between t(bi) is the output of BiGRU.

10. The neural network-based ammonia concentration detection system for piggery facilities as claimed in claim 2, It is characterized in that The grey GM (1,1) prediction model is a modeling process that predicts pig house ammonia by accumulating irregular historical data of pig house ammonia to obtain a relatively regular generated data sequence. The data obtained by generating the predicted pig house ammonia grey GM (1,1) prediction model is then subtracted to obtain the predicted value of the original data; assuming that the historical data sequence of pig house ammonia to be predicted is: x (0) ={x (0) (1),x (0) (2),......,x (0) (n)} After first-order accumulation, the new sequence generated is: x (1) ={x (1) (1),x (1) (2),......,x (1) (n)} in n represents the number of original data; Then x (1) The sequence has an exponential growth law, that is, it satisfies the first-order linear differential equation: In the formula, a is the development gray number, which reflects x (1) and x (0) development trend; u is the endogenous control gray number, which reflects the change relationship between the data; solving the differential equation of the above formula gives x (1) The predicted ammonia value of the pig house is: Through the cumulative reduction of the following formula, we can get the original sequence x (0) The gray prediction model of ammonia in pig houses is:

Citation Information

Patent Citations

  • method for predicting the concentration of ammonia gas in a hog house in a cold region based on empirical mode decomposition and an Elman neural network

    CN109583566A

  • Sow delivery time prediction system based on late pregnancy posture conversion characteristics

    CN112131927A

  • Fish feed detecting and formulating system

    CN113255739A

  • Live pig facility breeding environment comfort early warning system

    CN116029435A

Cited By

  • Full-automatic smoke detection method and tester

    CN120232784A

  • Coal gangue dump spontaneous combustion early warning system based on multi-data-source conjoint analysis

    CN121564860A

  • Landscape space environment quality evaluation method and system based on neural network

    CN122047513A

  • Pig stress simulation and removal processing method and system based on multi-dimensional environmental parameters

    CN122314432A

  • Pig stress simulation and relieving method and system based on multi-dimensional environmental parameters

    CN122314432B