Next Article in Journal
Open Remote Sensing Data in Digital Soil Organic Carbon Mapping: A Review
Previous Article in Journal
Improved Lightweight Zero-Reference Deep Curve Estimation Low-Light Enhancement Algorithm for Night-Time Cow Detection
Previous Article in Special Issue
Development of a Decision Support System for Animal Health Management Using Geo-Information Technology: A Novel Approach to Precision Livestock Management
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Research on Predictive Control Method of Pigsty Environment Based on Fuzzy Control

College of Engineering and Technology, Jilin Agricultural University, Changchun 130118, China
*
Author to whom correspondence should be addressed.
Agriculture 2024, 14(7), 1004; https://doi.org/10.3390/agriculture14071004
Submission received: 13 May 2024 / Revised: 15 June 2024 / Accepted: 24 June 2024 / Published: 26 June 2024

Abstract

:
At present, most of the environmental control systems of pigsties use direct control methods; when factors, such as temperature and humidity, exceed the set threshold value, the corresponding actuator is turned on for regulation. However, such methods have problems such as low control accuracy, high energy consumption, and untimeliness. In order to save on energy consumption and improve control accuracy, this paper takes the predicted value, set value, and current detection value of the internal environment of a pigsty as input, and combines fuzzy control and direct control methods to realize the predictive control of the pigsty environment. The test results show that, compared with the direct control method, the fuzzy predictive control method can make fluctuations in the internal temperature and humidity of the pigsty less close to the set threshold value, while the ammonia concentration hardly exceeds the set threshold value. The results show that predictive control can more accurately control the internal environment of the pigsty and reduce energy costs by about 20%. Therefore, this method can provide scientific and effective environmental control methods for agricultural production processes, such as livestock breeding and greenhouse cultivation, in semi-confined spaces.

1. Introduction

Studies have found that a good breeding environment (with a suitable temperature, relative humidity, low concentration of harmful substances, etc.) can improve the immunity and stimulate the growth potential of pigs, thereby obtaining considerable economic benefits [1]. A poor indoor environment will affect animal health and productivity [2]. The pig breeding environment is mainly composed of temperature, humidity, light, and harmful gases in the pigsty.
The internal temperature of the pigsty is very important for the growth, development, and reproduction of pigs [3,4,5,6]. When the ambient temperature exceeds the upper limit of its thermal neutral zone, pigs will experience heat stress. The physiological effects of heat stress on pigs are comprehensive and are mainly concentrated in the following aspects: (1) the breeding failure of breeding sows in summer increases; (2) the body fat of the offspring of breeding sows in summer increases; and (3) the growth rate of fattening pigs in summer slows down [7]. At the same time, high temperature has a very significant impact on the body temperature, heart rate and behavior of pigs. It can speed up the heart rate, increase the body temperature, and reduce the activity of pigs. Related studies have proved that compared with the comfortable temperature, when the temperature is higher, the daily food intake of pigs decreases, the daily weight gain decreases, and the meat ratio increases [8]. Related studies have shown [9] that, under high temperature conditions of 28–35 °C, the daily food intake of fattening pigs is 24.1–29.7% lower than the standard daily food intake; the daily weight gain is 6.8–28% lower than the expected daily weight gain.
When the temperature is low, pigs need to consume more energy for heat production to ensure the normal body temperature, which in turn leads to a decrease in average daily weight gain and an increase in food intake, which reduces the conversion efficiency of feed. Some scholars believe that a cold environment has a significant impact on the weight gain and survival rate of pigs [10].
When the temperature is appropriate, the influence of humidity on pigs is small and negligible, but when the temperature is not within the appropriate range, high or low humidity will have an adverse effect on pigs. The effect of humidity on pigs is often a synergistic effect produced under high temperature conditions [11].
In addition, due to livestock manure, many pollutants [12] will be produced in the pigsty, including NH3, CO2, H2S, etc., among which NH3 and H2S are irritating to pigs. Once the harmful gas reaches a certain concentration, it will cause adverse effects on the production performance and health of pigs [13,14], and even behaviors such as biting of ears and wagging of tails. Therefore, while controlling the temperature and humidity inside the pigsty, ventilation is required to ensure that the concentration of harmful gases inside the pigsty does not exceed the specified range. Among the environmental factors inside the pigsty, H2S is mainly produced by the decomposition of sulfur-containing organic matter. Therefore, concentrations of H2S in poultry houses are higher, but lower in pigsties. Therefore, this paper considers temperature, humidity and NH3 in the pigsty as the main control factors.
With the rapid development of science and technology, the control methods of the pigsty environment have gradually changed. It has been proved that intelligent breeding plays an important role in improving production efficiency, protecting the environment, reducing labor costs, and reducing the probability of epidemics [15,16]. Therefore, the original manual control method has been replaced by various intelligent systems. Scholars have begun to use microcontrollers and the Internet of Things [17,18,19,20] to directly control the environment of livestock and poultry houses. However, such control methods only work when the current environment is detected beyond the set threshold value, and the environment in the pigsty cannot be accurately controlled within a certain range. Therefore, predictive control methods have begun to be applied in the field of environmental control [21].
In order to achieve precise control of the environment in the pigsty and achieve the purpose of saving energy, this paper introduces a fuzzy control method. In recent years, fuzzy control has been proven to have good performance in the field of control and has gradually been used in temperature control [22,23], wind speed control [24], predictive control [25], and other issues. Therefore, this paper calculates the coupling relationship between ventilation and temperature and humidity changes on the basis of accurate environmental prediction [26], combined with fuzzy control and direct control methods [27,28], using the predicted value, detected value, and set value of environmental factors as input and the control time of the corresponding actuator as output in order to realize predictive control of the pigsty environment.

2. Coupling Relationship

In the process of precise control of the internal environment of the pigsty, interaction between environmental parameters is inevitable. This paper fully considers the temperature and humidity changes caused by ventilation and solves the coupling relationship. In northern China, in winter or when the external temperature and humidity are lower than in the pigsty, ventilation will cause a decrease in temperature and humidity. Therefore, in the ventilation process, the temperature and humidity drop needs to be calculated based on the ventilation time, so as to switch on the heating and humidification equipment, and temperature and humidity compensation, to achieve the purpose of precise control. This paper took the pigsty of Jilin Agricultural University Teaching Base in Quango County, Song yuan City, Jilin Province as an example to conduct research, and constructed a ventilation–temperature compensation model and a ventilation–humidity compensation model. The details are as follows:
The Goff–Gratch formula was used to calculate the saturated vapor pressure of water vapor. This formula was recommended by the World Meteorological Organization in 1966 and is considered one of the most accurate formulas in recent decades. The details are as follows [29]:
1 g e w = 10.79586 ( 1 T 0 / T ) 5.02808 lg ( T / T 0 ) + 1.50475 × 10 4 1 10 8.2969 ( T / T 0 1 ) + 0.42873 × 10 3 10 4.76955 ( 1 T 0 / T ) + 0.78614
where e w is the saturated water vapor pressure (hPa), T 0 is the three-phase point temperature of water (273.16 K), T = 273.15 + t _ now , t _ now is the current temperature (°C).
Moisture content refers to the mass (g) of water vapor mixed in dry air per kilogram of mass, which can be calculated based on the saturated water vapor pressure. It is publicized as follows:
d = 622 e w × H / ( P s e w H )
where d is the current moisture content, H is the relative humidity, P s is atmospheric pressure, the general value is 101,325 Pa.
Set the volume of the pigsty to V ( m 3 ) , the ventilation volume of the fan to be turned on to L ( m 3 ) , the temperature in the pigsty at time t is T i n ( ° C ) , the humidity is R H i n ( % ) , the air density is ρ i n ( kg / m 3 ) , the moisture content is d i n ( g / kg ) , the temperature outside the pigsty is T o u t ( ° C ) , the humidity is R H o u t ( % ) , the air density is ρ o u t ( kg / m 3 ) , the moisture content is d o u t ( g / kg ) , and d s is the moisture content corresponding to the set humidity. Then, after ventilation, when humidity compensation is not performed, the moisture content in the pigsty is approximately as follows:
d i n t + 1 = d p r e t + 1 d i n t × L V + d o u t t × ρ o u t ρ i n × L V
The amount of water vapor brought out of the pigsty through ventilation and the amount of water vapor brought into the pigsty can be obtained. The humidity compensation formula is as follows:
H c = ρ i n × V × d s ( t ) d i n ( t + 1 )
where the unit of humidity compensation coefficient H c is g.
After the fan is turned on, when the temperature compensation is not performed, the temperature in the pigsty is as follows:
t i n t + 1 = ρ o u t × L × t o u t + ρ i n × V L × t p r e ρ o u t × L + ρ i n × V L
Therefore, according to the heat brought out by the ventilation, the temperature compensation formula can be obtained as follows:
Q C = C × ρ i n × V × t s t t i n t + 1
where C is the specific heat of the air, under normal circumstances C = 1030   J / ( kg ° C ) , Q C is the heat compensation coefficient, and t s is the set temperature value.
When the temperature and humidity compensation formula is obtained, the operating time of the heating and humidification equipment needs to be calculated based on the power of the heating and humidification equipment. For humidification equipment, assuming that the total amount of atomization of the equipment Hum is 100 kg/h, the atomization efficiency is 27.78 g/s, and the required humidification time can be calculated based on the humidity compensation coefficient. The formula is as follows:
T r h = H c H u m × 1000 3600
When using the temperature compensation formula to control the opening time of the heating equipment, it needs to be calculated based on the heat taken away by the ventilation combined with the heating power. It should be noted that the temperature compensation formula only applies when the temperature outside the pigsty is lower than the temperature inside the house. It is assumed that the heating power Pt of the equipment is 100 kw, that is, 100,000 J/s; the calculation formula for the length of time is as follows:
T t = Q c P t × 1000

3. Predictive Decoupling Fuzzy Control Model

At present, the internal temperature and humidity control of the pigsty is mainly based on direct control, which is semi-intelligent control. The on–off control of the equipment is based on the detected value to ensure that the internal environmental factors of the pigsty are within the corresponding threshold value. However, due to the hysteresis of temperature changes in the house, the direct control method cannot stably control the temperature in the house, and the energy consumption is large. Therefore, this paper conducted fuzzy control research on the environment of the pigsty based on the prediction results of known environmental factors in the building. Taking the pigsty as an example, in the pigsty, the air temperature is required to be 20–25 °C, the relative humidity is 60–70%, the upper limit of NH3 concentration is 20 mg/m3, the upper limit of CO2 concentration is 1300 mg/m3, and the upper limit of H2S concentration is 8 mg/m3. The fuzzy control process is as follows [30]:

3.1. Define Variables

The principle of fuzzy control will not be repeated in this article. The control process can be divided into four stages: fuzzing, establishing a rule base, fuzzing reasoning, and anti-fuzzing. When selecting input parameters, the deviation e and deviation change rate Δe of the corresponding variable from the set value are generally selected as the input of the control model, but in the process of predictive control of the pigsty environment, it is not reasonable to ignore the role of the predicted value. Therefore, in order to achieve predictive control, the difference between the predicted temperature and the set temperature is defined as the predicted deviation (e), and the difference between the set temperature and the current temperature is defined as the environmental deviation (ec). The predicted deviation and the environmental deviation are used as input variables. Humidity control is the same as NH3 concentration control.

3.2. Input Volume Blur

In the process of blurring the input factor, it is necessary to determine the physical domain, quantitative factor, and fuzzy domain of the input variable based on the set value. In the environmental prediction control system of the pigsty, the corresponding physical domain and quantitative factors are set according to the prediction deviation (e) of the pigsty, as shown in Table 1. Considering that the internal environment of the pigsty may be affected by many factors, the physical field is set to be large to meet the needs of drastic changes in the predicted values. Here, in order to make the fuzzy theory domain of each environmental factor the same, by setting different quantification factors, the physical theory domain is quantized into the same fuzzy theory domain, so that each environmental factor can use the same set of fuzzy rules, thereby simplifying the design difficulty of the fuzzy controller. The fuzzy domain of the deviation of each environmental factor was set to [−3,−2,−1,0,1,2,3]. The fuzzy control language was {NB, NM, NS, ZO, PS, PM, PB}, where the calculation formula of the quantification factor is shown below:
K = X max X min x max x min
where X max , X min are the upper and lower limits of the physical domain. x max , x min are the upper and lower limits of the fuzzy domain.
Similarly, the fuzzy domain of environmental deviation (ec) was set to [−3,−2,−1,0,1,2,3]. The fuzzy control language was {NB, NM, NS, ZO, PS, PM, PB}, and the physical domain and quantitative factors of environmental deviation are shown in Table 2. In this paper, the triangle membership function was selected to blur the input variables.
MATLAB2020B was used to design three fuzzy controllers for temperature, humidity, and NH3 concentration, respectively. Where E represents the prediction deviation, that is, the difference between the predicted value and the set value, EC represents the environmental deviation, U1 represents the amount of control over the heater, U2 represents the amount of control over the humidifier, and U3 represents the amount of control over the fan. However, the range of U1, U2 and U3 needs to be set according to the actual control time. Because the prediction interval is 5 min, and the change in environmental factors is delayed, the maximum time to control the corresponding equipment is not greater than 3 min. The specific control time needs to be calculated based on the change value of environmental parameters. Taking temperature as an example, the physical domain is set to [−10,10], that is, with the set point as the center, the span of change on both sides is 10, which can be understood as the need to heat up or cool down 10 °C operation, the calculated operation time required is the range of the output change. When the pigsty needs to be heated up, control the operation of the heater to increase the temperature in the house. However, when it is necessary to cool down, if the temperature in the pigsty is higher than the temperature outside the house, control the operation of the fan so that the cold air enters the house; if the temperature inside the pigsty is lower than the temperature outside the house, the operation of the fan will cause the hot air to enter the pigsty and the cooling cannot be completed. At this time, the operation of the air cooler needs to be controlled to achieve the purpose of cooling. When controlling humidity, we need to choose to turn on the fan or humidifier, according to the situation. When the NH3 concentration is controlled, the fan can be turned on by the control.
When setting the fuzzy domain, the range of the output needs to be considered comprehensively. Taking temperature as an example, the output result of temperature corresponds to the heater, fan, and refrigerator, that is, it corresponds to the three adjustment methods of heating, ventilation and cooling, and cooling and cooling. The running time of each adjustment method is different. Among them, the heating produces a control result through a fuzzy controller. The refrigeration and cooling can be directly controlled by the refrigerator. When cooling down through ventilation, it is necessary to comprehensively consider the temperature inside and outside the pigsty and the amount of ventilation for calculation. When the temperature inside and outside the pigsty is different, the threshold range of the ventilation time is different, and the temperature and humidity compensation time range caused by ventilation cannot be accurately calculated. Therefore, fuzzy control is combined with direct control, and the operating time of the fan is calculated when the temperature inside and outside the fan and the set temperature are known.
When heating, according to the domain of temperature physics, it can be seen that the maximum heating range is set to [13,23], that is, the maximum time required for a temperature rise needs to be calculated as the threshold range of the output U1. The calculation formula is as follows:
t _ a d d T = C × ρ i n × V × ( T max T min ) P max
where T max , T min represents the maximum and minimum values within the temperature range, respectively, and the molecules in the equation represent the heat required to heat up. P max represents the maximum heating power of the heater, and t _ a d d T is the boundary value of the fuzzy domain of U1.
When cooling down through ventilation, the required amount of ventilation can be calculated from Equation (5), and then the ventilation time can be obtained. The approximate calculation formula is as follows:
t _ v e n T = ( t p r e t s ) × ρ i n × V ( t s t o u t ) × ρ o u t + ( t p r e t s ) × ρ i n L max
where t s represents the set temperature value in the house, and L max represents the maximum ventilation rate per second. According to the final calculated t _ v e n T , the on–off work of the equipment can be completed.
When cooling down through the refrigerator, because the cooling effect is related to the temperature outside the house, the condensation temperature and other factors, it is more difficult to formulate a specific formula; therefore, a refrigerator with a constant temperature function is used for temperature control, and the final model only outputs the opening and closing status instructions of the refrigerator. The final temperature fuzzy control setting is shown in Figure 1:
When performing the fuzzy design of humidity, the principle of heating is the same as that of heating. When calculating the set temperature of 23 °C, the amount of water vapor required for humidity to rise from 45% to 65%, combined with the amount of atomization of the humidifier, the maximum humidification time can be calculated. Derived according to Equations (1)–(4), the specific formula is as follows:
t _ a d d r h = ( d max d min ) × ρ i n × V P r h × 1000 3600
where d max , d min represents the moisture content at 65% and 45% humidity, respectively. P r h represents the amount of atomization of the humidifier, in Kg/H.
When using ventilation to reduce humidity, the principle is the same as that of ventilation and cooling. The required amount of ventilation needs to be calculated based on the moisture content inside and outside the pigsty and the set value of the humidity in the house, and then the ventilation time is obtained, which is directly controlled. Derived from Equation (3), the approximate calculation formula for the ventilation time is as follows:
t _ v e n r h = V × ( d s d p r e ) d o u t × ρ o u t ρ i n d i n L max
where d s represents the moisture content corresponding to the set humidity. According to the final calculated t _ v e n r h , the on–off work of the equipment can be completed.
The final humidity fuzzy control setting is shown in the Figure 2:
When performing the fuzzy design of NH3 concentration, it is necessary to calculate the maximum time required to reduce the ammonia gas in the pigsty from 20 mg/m3 to 10 mg/m3. During the calculation process, if the NH3 concentration outside the pigsty is regarded as 0, it can be considered that the proportion of air that needs to be exchanged is 50%. Therefore, the approximate calculation formula for the ventilation time is as follows:
t _ v e n = ( 1 N s N max ) × V L max
where N max , N s represent the highest and set NH3 concentration, respectively.
The final NH3 concentration fuzzy control setting is shown in Figure 3:

3.3. Fuzzy Control Rule Design

When the temperature, humidity and NH3 concentration of the pigsty are controlled separately, the temperature and humidity in the pigsty need to be regulated if they exceed or falls below the threshold value, while the NH3 concentration only needs to be adjusted if it exceeds the threshold value. Therefore, the regulation rules are shown in Table 3, Table 4 and Table 5. The basic rules for setting fuzzy regulation are as follows:
(1) Temperature control rules
When the predicted temperature exceeds the set threshold value, there are three situations of NB, NM, and NS in the E of the temperature fuzzy controller. When the temperature in the pigsty is higher than that outside the house, the fan needs to be turned on to adjust the temperature in the house. At this time, according to the Ec situation, the fan is operated for heat dissipation. When the fan is running, it will cause the humidity and NH3 concentrations in the pigsty to decrease. At this time, according to the humidity caused by the air exchange caused by the operation of the fan, the humidifier is switched on to perform humidity compensation to ensure that the humidity is within the appropriate threshold value. Therefore, U1 is ZO at this time, and the running time of U3 needs to be derived and calculated according to Equation (11).
When the predicted temperature is lower than the set threshold value, there are three situations of PS, PM and PB in the E of the temperature fuzzy controller. At this time, the heater needs to be turned on to increase the temperature in the room. Therefore, at this time, according to the situation of E and EC, U1 is selected between ZO, PS, PM and PB.
When the predicted temperature is the same as the set temperature, the operating modes of U1 and U3 are selected according to the Ec. When the environmental deviation is NB, NM or NS, the value is less than 0, that is, the current temperature in the room is higher than the set temperature; therefore, at this time it is necessary to calculate the U3 running time and calculate the humidity compensation. When the deviation changes to PB, PM, or PS, the change is greater than 0, that is, the current temperature in the room is lower than the set temperature. At this time, U1 can be turned on for temperature compensation;
(2) Humidity control rules
When the predicted humidity exceeds the set threshold value, there are three situations of NB, NM and NS in the E of the humidity fuzzy controller. At this time, the fan needs to be turned on to adjust the humidity in the house. At this time, according to the Ec situation, the fan is operated for dehumidification. When the fan is running, it will cause the temperature in the pigsty and the concentrations of NH3 to decrease. At this time, it is necessary to calculate the heat in the pigsty taken away by the fan, turn on the heater, and perform temperature compensation to ensure that the temperature remains basically constant during the operation of the fan. Therefore, U2 is ZO at this time, and U3 is calculated according to Equation (13).
When the predicted humidity is lower than the set threshold value, there are three situations of PS, PM, and PB in the E of the humidity fuzzy controller. At this time, the humidifier needs to be turned on to increase the humidity in the house. Therefore, at this time, according to the situation of E and EC, U2 selects between ZO, PS, PM and PB.
When E is ZO, the operating mode of U2 is selected according to Ec and the operating time of U3 is calculated. The principle is the same as that of temperature regulation;
(3) NH3 concentration regulation rules
When the predicted NH3 concentrations exceed the set threshold value, there are three situations of NB, NM, and NS in the NH3 fuzzy controller E. At this time, according to the situation of E and Ec, the fan needs to be turned on to reduce the NH3 concentrations in the house. As above, the operation of the fan will cause the temperature and humidity in the pigsty to decrease. In order to keep the temperature and humidity within the due threshold, the heater and humidifier need to be turned on according to the ventilation conditions to compensate for temperature and humidity.
When E is ZO, such as when EC is PB, PM, PS or ZO, no regulation is required. When EC is NB, NM, or NS, the NH3 concentrations are higher than the set standard value, we need to turn on the fan for ventilation. At this time, we need to turn on the humidifier and heater for temperature and humidity compensation.
Table 3. Temperature fuzzy control table.
Table 3. Temperature fuzzy control table.
E
NBNMNSZOPSPMPB
EcNBZOZOZOZOZOZOZO
NMZOZOZOZOZOZOZO
NSZOZOZOZOZOZOPS
ZOZOZOZOZOZOPSPM
PSZOZOZOZOPSPMPM
PMZOZOZOPSPMPMPB
PBZOZOPSPMPMPBPB
Table 4. Humidity fuzzy control table.
Table 4. Humidity fuzzy control table.
E
NBNMNSZOPSPMPB
EcNBZOZOZOZOZOZOZO
NMZOZOZOZOZOZOZO
NSZOZOZOZOZOZOPS
ZOZOZOZOZOZOPSPM
PSZOZOZOZOPSPMPM
PMZOZOZOPSPMPMPB
PBZOZOPSPMPMPBPB
Table 5. Fuzzy control table of NH3 concentrations.
Table 5. Fuzzy control table of NH3 concentrations.
E
NBNMNSZOPSPMPB
EcNBPBPMPMPSPSZOZO
NMPMPMPSPSZOZOZO
NSPMPSPSZOZOZOZO
ZOPSPSZOZOZOZOZO
PSPSZOZOZOZOZOZO
PMZOZOZOZOZOZOZO
PBPBPMPMPSPSZOZO
According to the rules described in Table 3, Table 4 and Table 5, the fuzzy control surfaces of greenhouse, humidity and NH3 concentrations are designed as shown in Figure 4, Figure 5 and Figure 6.

3.4. Output De-Fuzzing

The value obtained through the fuzzy control rule needs to be de-blurred before the final precise value can be obtained as the output. The commonly used methods of de-blurring are generally the center of gravity method, the maximum membership method, the weighted average method, etc. In this paper, the center of gravity method is used to de-blur the output. This method takes the membership function curve and the center of the abscissa siege area to obtain the final output of the fuzzy model. The calculation formula is as follows:
V 0 = V v × μ v ( v ) d v V μ v ( v ) d v
After completing the writing of the fuzzy control rules, according to the temperature and humidity control rules, the multivariate decoupling fuzzy controller inside the pigsty is built, as shown in Figure 7. The main idea is as follows: Use MATLAB’s simulink to build the main controller, read the real-time data of the environmental factors through the From Workspace module, and take the set value, predicted value, and current value of the environmental factor as the initial input. After processing, they are used as the input of the fuzzy controller, and the corresponding output can be obtained. Sum the corresponding outputs of the temperature and humidity controllers with the temperature and humidity compensation caused by the ventilation conditions, respectively, to obtain the final heating and humidification control amount, and the on–off of the refrigerator depends on the comparison of the temperature inside and outside the house. When the temperature outside the pigsty is higher, if the predicted temperature exceeds the threshold value, we need to turn on the refrigerator to cool down the inside of the pig house. In addition, due to the overlap of ventilation caused by cooling, dehumidification and reducing ammonia concentrations, and the acting environment is consistent, the ventilation time is not superimposed. The largest ventilation value is selected as the final ventilation time and used to calculate the temperature and humidity compensation time.

4. Field Experiment

The field tests were conducted in Qianguo County, Songyuan City, Jilin Province. Part of the hardware is shown in Figure 8, placed at a height of 1.5 m from the ground. A total of 4 temperature and humidity sensors, 2 CO2 sensors, 1 light sensor, and 2 multi-gas all-in-one louver boxes (mainly used to detect NH3 concentrations) were placed in the house. Outside the house, 1 temperature and humidity sensor and 1 light sensor were placed. After the system was built, hardware and software testing was carried out, including serial port transceiver testing, Lora module testing, and upper computer function testing, to measure the actual control effect based on the changes in the internal environmental factors of the pigsty.
There are two pigsties at the test site. The scale of the pigsties is the same, each with 20 pigs. The test time was from 18:00 on 29 July to 18:00 on 30 July 2023. The environmental control equipment in the pigsty has a refrigerator, humidifier, fan and heater. The power is as follows: refrigerator 2 kw (2 pcs), humidifier 3 kw (4 pcs), heater 15 kw (4 pcs) fan 370 w (4 pcs). House 1 is for direct control, and the opening of fans and other equipment is determined by the system according to the actual situation. House 2 is a predictive control pig house, and the environmental detection and control system of the pig pigsty constructed in this paper is used for regulation. The temperature changes in the two pigsties and the temperature outside the pigsty are shown in Figure 9, the humidity changes are shown in Figure 10, and the NH3 concentration changes are shown in Figure 11.

5. Results Analysis and Discussion

The automatic environmental detection and control time interval of the two pigsties is 5 min. The direct control rules of house 1 are as follows: turn on the refrigerator when the temperature exceeds 25 °C; turn on the fan when the temperature is lower than 20 °C and the temperature outside the pigsty is higher than inside the house; if the temperature inside the pigsty is higher than outside the house, turn on the heater; turn on the fan when the humidity exceeds 70% or the NH3 concentrations are higher than 10; and turn on the humidification device when the humidity is lower than 65%. After the corresponding actuator is working, it will stop working when the detected environmental factors meet the set value, until the next automatic detection, when the corresponding actuator will be selected to open according to the environment in the house.
As can be seen from the figure above, due to the long interval between detection and control, the actuator of house 1 is turned off immediately after the environment in the pigsty meets the set threshold value, and the operation of fan equipment, natural ventilation in summer, and pig movement will cause the temperature in the pigsty to rise and exceed the set value. Therefore, the environment in the pigsty will exceed the set threshold value during the next inspection, and it is concluded that the direct control method of house 1 cannot finely control the temperature and humidity in the house. At the same time, the functional effects of equipment operation have the opposite effect. For example, when the temperature outside the pigsty is high and the temperature and humidity inside the pigsty are high, the fan and the refrigerator need to be turned on, but the opening of the fan causes the temperature in the pigsty to rise. At this time, the running time of the refrigerator increases to reduce the temperature, which increases the power consumption to a certain extent. The predictive control of house 2 can control the temperature and humidity parameters more finely. However, the NH3 concentrations of house 1 are more stable. The reason for this is that when the system detects that the humidity exceeds 70% or the NH3 concentrations are higher than 10, the fan is turned on for ventilation, and the humidity control accuracy in the pigsty is low, causing the fan to be turned on for a long time, causing a large amount of NH3 to be discharged out of the house. Although the concentration of harmful gases in the pigsty does not exceed the set value, it also leads to drastic changes in temperature and humidity in the house.
At the same time, it can be seen from the figure that, compared with the state of movement of pigs during the day, the internal environment of the pigsty is relatively stable when the pigs are sleeping (about 10:00 p.m.–6:00 a.m.). The reason for this is that when the pigs are sleeping, there is less heat production, water play, defecation, and urination, and the environment outside the pigsty is closer to the pig growth environment at this time; therefore, the environmental changes fluctuate less often. The internal environmental parameters of house 2 are relatively stable throughout the day.
In order to compare the energy-saving situations, the power consumption of the two pigsties was calculated based on the equipment turned on, as recorded by the system. As can be seen from Table 6, the power consumption of pigsty 2 is lower compared with pigsty 1 and is reduced by 20.5%. The reason for this is that the direct control system of house 1 will adjust the environment of the detection point to a set threshold value, but it does not consider the temperature rise caused by ventilation, the delay in temperature adjustment, and the humidity rise caused by the evaporation of water at high temperatures, causing the equipment to stop running so that the environment in the house will still change drastically. At the next detection point, all equipment still needs to be turned on for environmental control. While the environmental control accuracy in the pigsty is low, the power consumption is high.
In other research related to predictive control, Chengxiang Kang et al. combined prediction with fuzzy control to control the wind speed, improving drying uniformity and reducing the time required for kelp drying [23]; Naji Abdenuri et al. combined fuzzy control with temperature prediction to realize the control of the internal temperature of solar indirect desiccant [24]. However, both of the above studies only control a single factor. Hua Jin et al. basically realized environmental control through the internal temperature and humidity prediction and fuzzy control methods of pigsties but did not consider the coupling relationship between temperature and humidity changes. The main control factor was mainly set to temperature, there is less consideration of humidity, and the control of harmful gases is not considered [25]. In this paper, the changes in temperature, humidity and NH3 in the pigsty are comprehensively considered, and the fuzzy control, environmental prediction, and direct control methods are combined. The proposed environmental prediction control system of the pigsty based on fuzzy control was investigated using on-site comparative experiments. The precise control of the environmental parameters in the pigsty was basically realized, and the energy consumption was low.

6. Conclusions

This paper proposes a predictive control method of a pigsty environment based on fuzzy control, in view of the shortcomings of the direct control method. The main contributions are as follows:
(1) In view of the changes in temperature and humidity caused by ventilation in pigsties, this paper proposes ventilation–temperature and ventilation–humidity compensation formulas to provide the basis for precise environmental control;
(2) This paper combines fuzzy control and direct control methods to build a predictive decoupling fuzzy control model;
(3) The comparative experimental results show that, compared with the direct control method, the control model proposed in this paper can control the environment in the pigsty more accurately, and the energy consumption is reduced by about 20%. It can provide a new idea for environmental control in semi-confined spaces that is different than direct control. It can save energy and reduce consumption, realize efficient use of resources, and meet the sustainable development requirements of modern agriculture.

Author Contributions

Conceptualization, F.Z and Y.Z.; methodology, Y.Z. and W.Z.; software, Y.Z. and T.G.; validation, T.G. and S.W.; formal analysis, L.Z.; investigation, Y.Z.; resources, F.Z. and L.Z.; data curation, Y.Z. and S.W.; writing—original draft preparation, Y.Z. and W.Z.; writing—review and editing, F.Z. and L.Z.; visualization, Y.Z. and W.Z.; supervision, T.G. and S.W.; project administration, F.Z. and L.Z.; funding acquisition, F.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This study was funded by the Jilin Provincial Science and Technology Development Plan Project, No. 20210202054NC.

Institutional Review Board Statement

The study did not require ethical approval.

Informed Consent Statement

Informed consent was obtained from all subjects involved in the study.

Data Availability Statement

The data presented in this study are available on request from the corresponding author. They are restricted to experimental results.

Acknowledgments

We thank the Jilin Provincial Science and Technology Development Plan Project (No. 20210202054NC) for financial support, and Jilin Agricultural University for providing an experimental site for us to conduct field experiments.

Conflicts of Interest

The authors declare no conflicts of interest.

Nomenclature

e w Saturated water vapor pressure
T 0 The three-phase point temperature of water
t _ now Current temperature
d Moisture content
H Relative humidity
P s Standard atmospheric pressure
V Pigsty volume
L Turn on the ventilation volume of the fan
T i n Temperature in the house at time t
R H i n Humidity in the house at t time
ρ i n Air density in the house
d in Moisture content in the house
T out Temperature outside the house
R H out Humidity outside the house
ρ o u t Air density outside the house
d out Moisture content outside the house
d s Set the moisture content corresponding to the humidity
d p r e t + 1 Predict the moisture content corresponding to the humidity at t + 1 time
t p r e Predict the temperature
H c Humidity compensation coefficient
C Specific heat of air
Q C Heat compensation coefficient
t s Set temperature value
H u m Total atomization
T r h Required humidification time
P t Heating power
T t Required heating time
e Prediction deviation
e c Environmental deviation
X max , X min The upper and lower limits of the domain of physics
x max , x min The upper and lower limits of the fuzzy domain
T max , T min Maximum and minimum values in the temperature range
P max Maximum heating power of the heater
L max Maximum air volume per second
t _ a d d T Maximum heating time
t _ v e n T Ventilation to reduce temperature time
t _ a d d r h Maximum humidification time
t _ v e n r h Ventilation to reduce temperature time
t _ v e n Maximum ventilation and ammonia removal time
d max , d min Moisture content at 65% and 45% humidity
P r h The amount of atomization of the humidifier

References

  1. Zhang, X.F.; Pan, J.J.; Zhao, B.; Kong, X.Y.; Ma, X.; Yi, Z.Y.; Wang, M.; Li, H.Q. Performance investigation of a solar/biomass based multi-generation system in pig farm. Appl. Therm. Eng. 2023, 231, 121013. [Google Scholar] [CrossRef]
  2. Albright, J.L. History and future of animal welfare science. J. Appl. Anim. Welf. Sci. 1998, 1, 145–148. [Google Scholar] [CrossRef]
  3. Collin, A.; van Milgen, J.; Dubois, S.; Noblet, J. Effect of high temperature on feeding behaviour and heat production in group-housed young pigs. Brit. J. Nutr. 2001, 86, 63–70. [Google Scholar] [CrossRef] [PubMed]
  4. Aarnink, A.J.A.; Verstegen, M.W.A. Nutrition, key factor to reduce environmental load from pig production. Livest. Sci. 2007, 109, 194–203. [Google Scholar] [CrossRef]
  5. Yuanan, H.; Hefa, C.; Shu, T. Environmental and human health challenges of industrial livestock and poultry farming in China and their mitigation. Environ. Int. 2017, 107, 111–130. [Google Scholar]
  6. Pexas, G.; Mackenzie, S.G.; Jeppsson, K.H.; Olsson, A.C.; Wallace, M.; Kyriazakis, I. Environmental and economic consequences of pig-cooling strategies implemented in a European pig-fattening unit. J. Clean. Prod. 2021, 290, 125784. [Google Scholar] [CrossRef]
  7. Liu, F.; Zhao, W.; Le, H.H.; Cottrell, J.J.; Green, M.P.; Leury, B.J.; Dunshea, F.R.; Bell, A.W. Review: What have we learned about the effects of heat stress on the pig industry? Animal 2022, 16, 100349. [Google Scholar] [CrossRef]
  8. Johnson, J.S.; Abuajamieh, M.; Sanz Fernandez, M.V.; Seibert, J.T.; Stoakes, S.K.; Nteeba, J.; Keating, A.F.; Ross, J.W.; Rhoads, R.P.; Baumgard, L. Thermal Stress Alters Postabsorptive Metabolism During Pre- and Postnatal Development. In Climate Change Impact on Livestock: Adaptation and Mitigation; Springer: New Delhi, India, 2015; pp. 61–79. [Google Scholar]
  9. Quiniou, N.; Dubois, S.; Noblet, J. Voluntary feed intake and feeding behaviour of group-housed growing pigs are affected by ambient temperature and body weight. Livest. Prod. Sci. 2000, 63, 245–253. [Google Scholar] [CrossRef]
  10. Carroll, J.A.; Burdick, N.C.; Chase, C.J.; Coleman, S.W.; Spiers, D.E. Influence of environmental temperature on the physiological, endocrine, and immune responses in livestock exposed to a provocative immune challenge. Domest. Anim. Endocrinol. 2012, 43, 146–153. [Google Scholar] [CrossRef]
  11. Huynh, T.T.T.; Aarnink, A.J.A.; Verstegen, M.W.A.; Gerrits, W.J.J.; Heetkamp, M.J.W.; Kemp, B.; Canh, T.T. Effects of increasing temperatures on physiological changes in pigs at different relative humidities. J. Anim. Sci. 2005, 83, 1385–1396. [Google Scholar] [CrossRef]
  12. Banhazi, T.M.; Stott, P.; Rutley, D.; Blanes-Vidal, V.; Pitchford, W. Air exchanges and indoor carbon dioxide concentration in Australian pig buildings: Effect of housing and management factors. Biosyst. Eng. 2011, 110, 272–279. [Google Scholar] [CrossRef]
  13. Shin, H.; Kwak, Y.; Jo, S.K.; Kim, S.H.; Huh, J.H. Applicability evaluation of a demand-controlled ventilation system in livestock. Comput. Electron. Agric. 2022, 196, 106907. [Google Scholar] [CrossRef]
  14. Lee, C.; Giles, L.R.; Bryden, W.L.; Downing, J.L.; Owens, P.C.; Kirby, A.C.; Wynn, P.C. Performance and endocrine responses of group housed weaner pigs exposed to the air quality of a commercial environment. Livest. Prod. Sci. 2005, 93, 255–262. [Google Scholar] [CrossRef]
  15. Neethirajan, S. The role of sensors, big data and machine learning in modern animal farming. Sens. Bio-Sens. Res. 2020, 29, 100367. [Google Scholar] [CrossRef]
  16. Ojo, R.O.; Ajayi, A.O.; Owolabi, H.A.; Oyedele, L.O.; Akanbi, L.A. Internet of Things and Machine Learning techniques in poultry health and welfare management: A systematic literature review. Comput. Electron. Agric. 2022, 200, 107266. [Google Scholar] [CrossRef]
  17. Du, Q.; Miao, Y.; Zhang, Y.; Lee, G. Design of Intelligent Monitoring System of Chicken House Environment Based on Single-chip Microcomputer. MATEC Web Conf. 2018, 227, 02008. [Google Scholar] [CrossRef]
  18. Lahlouh, I.; Rerhrhaye, F.; Elakkary, A.; Sefiani, N. Experimental implementation of a new multi input multi output fuzzy-PID controller in a poultry house system. Heliyon 2020, 6, e04645. [Google Scholar] [CrossRef]
  19. Zhao, Y.; Nan, X.; Tang, X.; Yang, L.; Xiong, B. Development and application of animal building environmental control system. In Proceedings of the 10th International Livestock Environment Symposium (ILES X), Omaha, NE, USA, 25–27 September 2018. [Google Scholar]
  20. Chigwada, J.; Mazunga, F.; Nyamhere, C.; Mazheke, V.; Taruvinga, N. Remote poultry management system for small to medium scale producers using IoT. Sci. Afr. 2022, 18, e01398. [Google Scholar] [CrossRef]
  21. Jin, H.; Meng, G.; Pan, Y.; Zhang, X.; Wang, C. An Improved Intelligent Control System for Temperature and Humidity in a Pig House. Agriculture 2022, 12, 1987. [Google Scholar] [CrossRef]
  22. Di, Q.; Yuanliang, L.; Chuangyao, Z.; Yize, D.; Bingye, S.; Angui, L. Thermal response and performance evaluation of floor radiant heating system based on fuzzy logic control. Energy Build. 2024, 313, 114232. [Google Scholar]
  23. Zhe, Y.; Lingchuan, Z.; Yun, L.; Yunwei, H.; Aojin, L.; Jianyu, L.; Chen, L.; Chuan, L. Dynamic fuzzy temperature control with quasi-Newtonian particle swarm optimization for precise air conditioning. Energy Build. 2024, 310, 114095. [Google Scholar]
  24. Chengxiang, K.; Guochen, Z.; Qian, Z.; Gang, M.; Hongmin, G.; Tong, Y.; Ran, L.; Xiuchen, L.; Cheng, Z. Control of multi-energy drying system: Optimal weighted combination prediction of moisture content and fuzzy compensation of wind speed. Therm. Sci. Eng. Prog. 2024, 50, 102503. [Google Scholar]
  25. Naji, A.; Ahmed, Z.; Issam, S.; Said, D. Model identification and fuzzy control of the temperature inside an active hybrid solar indirect dryer. Sol. Energy 2022, 231, 328–342. [Google Scholar]
  26. Zhang, Y.; Zhang, W.; Wu, C.; Zhu, F.; Li, Z. Prediction Model of Pigsty Temperature Based on ISSA-LSSVM. Agriculture 2023, 13, 1710. [Google Scholar] [CrossRef]
  27. Gao, L.; Er, M.; Li, L.; Wen, P.; Jia, Y.; Huo, L. Microclimate environment model construction and control strategy of enclosed laying brooder house. Poult. Sci. 2022, 101, 101843. [Google Scholar] [CrossRef]
  28. Enriko, I.K.A.; Putra, R.A. Automatic Temperature Control System on Smart Poultry Farm Using PID Method. Green Intell. Syst. Appl. 2021, 1, 37–43. [Google Scholar] [CrossRef]
  29. Available online: https://blog.csdn.net/weixin_42107374/article/details/115973202?ops_request_misc=%257B%2522r-quest%255Fid%2522%253A%2522170546329916800211576443%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=170546329916800211576443&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~rank_v31_ecpm-5-115973202-null-null.142^v99^pc_search_result_base2&utm_term=Goff-Gratch%E5%85%AC%E5%BC%8F&spm=1018.2226.3001.4187 (accessed on 1 July 2023).
  30. Chu, J.R.; He, Z.; Wang, W.H.; Li, B.R.; Yang, G. Fuzzy control of temperature in gas flow control system based on mixed cold and hot gases. Int. Commun. Heat Mass Transf. 2023, 148, 107048. [Google Scholar] [CrossRef]
Figure 1. Design of temperature fuzzy control.
Figure 1. Design of temperature fuzzy control.
Agriculture 14 01004 g001
Figure 2. Humidity fuzzy control design.
Figure 2. Humidity fuzzy control design.
Agriculture 14 01004 g002
Figure 3. Design of fuzzy control of NH3 concentration.
Figure 3. Design of fuzzy control of NH3 concentration.
Agriculture 14 01004 g003
Figure 4. Temperature fuzzy control rule surface.
Figure 4. Temperature fuzzy control rule surface.
Agriculture 14 01004 g004
Figure 5. Humidity fuzzy control rule surface.
Figure 5. Humidity fuzzy control rule surface.
Agriculture 14 01004 g005
Figure 6. NH3 concentration fuzzy control rule surface.
Figure 6. NH3 concentration fuzzy control rule surface.
Agriculture 14 01004 g006
Figure 7. Decoupling fuzzy control model.
Figure 7. Decoupling fuzzy control model.
Agriculture 14 01004 g007
Figure 8. Field installation of the system.
Figure 8. Field installation of the system.
Agriculture 14 01004 g008
Figure 9. Comparison of temperature changes in pigsty.
Figure 9. Comparison of temperature changes in pigsty.
Agriculture 14 01004 g009
Figure 10. Comparison of humidity changes in pig houses.
Figure 10. Comparison of humidity changes in pig houses.
Agriculture 14 01004 g010
Figure 11. Comparison of NH3 concentration changes in pig houses.
Figure 11. Comparison of NH3 concentration changes in pig houses.
Agriculture 14 01004 g011
Table 1. The physical domain and quantitative factors of the prediction deviation of environmental parameters.
Table 1. The physical domain and quantitative factors of the prediction deviation of environmental parameters.
Environmental ParametersSet ValueField of PhysicsQuantification Factor
Temperature (°C)23[−10,10]3/10
Humidity (%)65[−20,20]3/20
NH3 (mg/m3)10[−10,10]3/10
Table 2. Environmental parameter deviation setting value, physical domain, and quantitative factor.
Table 2. Environmental parameter deviation setting value, physical domain, and quantitative factor.
Environmental ParametersSet ValueField of PhysicsQuantification Factor
Temperature (°C)0[−3,3]1
Humidity (%)0[−5,5]3/5
NH3 (mg/m3)0[−10,10]3/10
Table 6. Power consumption comparison.
Table 6. Power consumption comparison.
Pigsty 1Pigsty 2
Power consumptionFanHumidifierCoolertotalFanHumidifierCoolertotal
7.44821.276.56.43618.460.8
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zhu, F.; Zhang, Y.; Zhang, W.; Gao, T.; Wang, S.; Zhou, L. Research on Predictive Control Method of Pigsty Environment Based on Fuzzy Control. Agriculture 2024, 14, 1004. https://doi.org/10.3390/agriculture14071004

AMA Style

Zhu F, Zhang Y, Zhang W, Gao T, Wang S, Zhou L. Research on Predictive Control Method of Pigsty Environment Based on Fuzzy Control. Agriculture. 2024; 14(7):1004. https://doi.org/10.3390/agriculture14071004

Chicago/Turabian Style

Zhu, Fengwu, Yuqing Zhang, Weijian Zhang, Tianshi Gao, Suyu Wang, and Lina Zhou. 2024. "Research on Predictive Control Method of Pigsty Environment Based on Fuzzy Control" Agriculture 14, no. 7: 1004. https://doi.org/10.3390/agriculture14071004

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