Hog house environment intelligent control system and method based on Internet of Things
By collecting and processing multiple sensor data in the pig house environmental control system, using sliding window technology and weighted average calculation, a monitoring model is constructed and control instructions are generated, which solves the problem that the existing system fails to effectively consider the differences in pig life habits and environmental data, and achieves higher accuracy environmental monitoring and regulation.
Patent Information
- Application Number
- CN202510130692.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-06
- Publication Date
- 2025-05-06
AI Technical Summary
The existing pig house environmental control system fails to effectively consider the differences in pig life habits and environmental data in each time period, resulting in insufficient monitoring accuracy.
Through multiple sensors, data inside and outside the pig house is collected, stored and processed locally, and sent to the cloud for backup using Internet of Things technology. Using sliding window technology and weighted average calculation, multiple monitoring models are constructed to output the predicted values of environmental data, and control instructions are generated based on the prediction results to adjust environmental parameters.
It improves the accuracy of environmental monitoring of pig houses, can respond more accurately to pigs' actual needs, reduce environmental regulation errors, and improve breeding efficiency.
Smart Images

Figure CN119937696A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent management of Internet of Things, and in particular to an intelligent control system and method for a pig house environment based on the Internet of Things. Background Art
[0002] In my country, many pig farming companies have adopted highly intensive breeding models to improve production efficiency and pursue maximum commercial benefits. The quality and control of pig house environment have become the focus of attention in the pig farming industry. The pig house environment covers many aspects such as air temperature, relative humidity, and concentrations of gases such as ammonia and carbon dioxide. Once the environmental parameters are abnormal, the health of pigs will be threatened.
[0003] With the vigorous development of the Internet of Things and artificial intelligence technologies, pig house environmental control technology has gradually matured and been applied. For example, in the article "Optimization of Pig House Environmental Control Strategy and Energy Consumption Analysis Based on Deep Reinforcement Learning", it is proposed to build a pig house intelligent environmental control system with the help of Internet of Things technology and deep reinforcement learning. The system is based on WiFi wireless transmission, RS-485 and RS-232 serial communication technology, and has developed a pig house environmental control system based on STM32 microcontroller. Its architecture includes three layers: perception layer, transmission layer and application layer. By connecting to environmental sensors and cameras, it can monitor pig house environmental data. This system aims to achieve more accurate and low-energy pig house environmental optimization control, thereby improving environmental quality, enhancing the level of intelligent environmental management of pig farming enterprises, reducing operating energy consumption, and improving economic benefits.
[0004] However, the data uploaded to the cloud by the systems in the above literature are all the average values of all the data collected by the corresponding sensors within a certain period of time. The model makes predictions based on the average value of all data, but does not take into account the living habits of pigs and the differences in environmental data in each time period, and also ignores the important value of these factors for model training and prediction. Summary of the invention
[0005] The present invention takes into account the living habits of pigs and the degree of influence on environmental data in each time period, thereby improving monitoring accuracy.
[0006] The technical solution provided by the present invention is: a method for intelligently controlling a pig house environment based on the Internet of Things, the method comprising: Collect environmental data inside and outside the pig house through multiple sensors, store the environmental data set locally, and send it to the cloud for backup using IoT technology; Setting a sampling frequency so that the data acquisition device reads the environmental data collected by the sensor according to the sampling frequency, wherein the environmental data includes one or more of temperature, humidity, NH3 concentration, and CO2 concentration; Add corresponding type labels to each type of environmental data to form an environmental data set, and divide the environmental data set into multiple data subsets according to different type labels; Selecting multiple data from the data subset through a sliding window, calculating the weighted average of each type of environmental data, wherein the multiple weighted averages constitute a corresponding type of environmental feature value set; The environmental characteristic value set includes one or more of a temperature data characteristic value set, a humidity data characteristic value set, an NH3 concentration characteristic value set, and a CO2 concentration data characteristic value set; Construct multiple monitoring models, input the preprocessed environmental characteristic value set as input variables into the corresponding monitoring model, and output the predicted value of environmental data through the environmental monitoring model, wherein the monitoring model includes one or more of a temperature monitoring model, a humidity monitoring model, an NH3 concentration monitoring model, and a CO2 concentration data monitoring model; Build control logic to output control instructions. After receiving the control instructions, the environmental control device performs corresponding operations to adjust environmental parameters and feedback operation log information.
[0007] Preferably, the sampling frequency is set so that the data acquisition device collects various environmental data according to the set sampling frequency, including: Setting the data collection frequency in the data collection device; Establish data connection between data acquisition equipment and temperature sensor, humidity sensor, NH3 concentration sensor, and CO2 concentration sensor; The data acquisition device collects data from the temperature sensor, humidity sensor, NH3 concentration sensor, and CO2 concentration sensor according to the set data acquisition frequency and stores it locally; The corresponding type label is added to each type of environmental data to form an environmental data set, including: Add temperature type label and collection time label 1 to the collected temperature data; Add humidity type label and collection time label 2 to the collected humidity data; Add NH3 type label and collection time label three to the collected NH3 concentration data; Add CO2 type label and collection time label to the collected CO2 concentration data; The collected temperature data, humidity data, NH3 concentration data, and NH3 concentration data constitute an environmental data set and are stored locally.
[0008] Preferably, the environmental data set is divided into a plurality of data subsets according to different type labels, including: After sorting the temperature data with temperature type labels according to the collection time label, a temperature data subset is formed; After sorting the humidity data with humidity type labels according to the second collection time label, a humidity data subset is formed; After sorting the NH3 concentration data with NH3 type labels according to the three acquisition time labels, a subset of NH3 concentration data is formed; The CO2 concentration data with CO2 type labels are sorted according to the collection time label four to form a CO2 concentration data subset.
[0009] Preferably, the sliding window is used to select multiple data from the data subset, and the weighted average values of various types of environmental data are calculated. The multiple weighted average values constitute a corresponding type of environmental feature value set, including: Set multiple time periods and set different weights according to different time periods; A plurality of data are selected from the temperature data subset, the humidity data subset, the NH3 concentration data subset and the CO2 concentration data subset through the sliding window H, and the weighted average of the data in the corresponding sliding window is calculated using the weight corresponding to each time period; The weighted average values calculated under multiple sliding windows are divided into temperature data feature value set, humidity data feature value set, NH3 concentration feature value set and CO2 concentration data feature value set according to type labels.
[0010] Preferably, the setting of multiple time periods and setting different weights according to different time periods include: The 24 hours of a day are divided into multiple time periods, specifically: Divide the 24 hours of a day into multiple time periods according to the time points, specifically into five time periods: 0:00-6:00, 6:00-10:00, 10:00-16:00, 16:00-19:00, and 19:00-24:00; Configure weight a1 for the time period from 0:00 to 6:00; Configure weight a2 for the time period from 6:00 to 10:00; Configure weight a3 for the time period from 10:00 to 16:00; Configure weight a4 for the time period from 16:00 to 19:00; Configure weight a5 for the time period from 19:00 to 24:00.
[0011] Preferably, the method of selecting a plurality of data from the temperature data subset, the humidity data subset, the NH3 concentration data subset and the CO2 concentration data subset through the sliding window H, and calculating the weighted average of the data in the corresponding sliding window using the weight corresponding to each time period, includes: Assume that the temperature data subset is ; The humidity data subset is ; The NH3 concentration data subset is ; The CO2 concentration data subset is ; Through the sliding window, we can Extract multiple data, specifically: Extract multiple temperature data from a subset of temperature data: ,in ; Extract multiple humidity data from the humidity data subset: ,in ; Extract multiple NH3 concentration data from the NH3 concentration data subset: ,in ; Extract multiple CO2 concentrations from a subset of CO2 concentration data: ,in ; calculate arrive Weighted average under time length, where H=| - |, specifically: Substitute the extracted temperature data, humidity data, NH3 concentration data, and CO2 concentration data into the following formulas: , respectively obtain the weighted average of temperature data , weighted average of humidity data , weighted average of NH3 concentration data , weighted average of CO2 concentration data ;in, , Indicates the corresponding weight The amount of data, Indicates the corresponding The amount of data.
[0012] Preferably, the weighted average values calculated under the multiple sliding windows are divided into a temperature data feature value set, a humidity data feature value set, an NH3 concentration feature value set and a CO2 concentration data feature value set according to the type label, including: The weighted average of temperature data under multiple sliding windows constitutes the temperature data feature value set ; The weighted average of humidity data under multiple sliding windows constitutes the humidity data feature value set ; The weighted average of NH3 concentration data under multiple sliding windows constitutes the characteristic value set of humidity data ; The weighted average of CO2 concentration data under multiple sliding windows constitutes the characteristic value of humidity data ;in, is the number of eigenvalues.
[0013] Preferably, the construction of multiple monitoring models, inputting the preprocessed environmental feature value set as an input variable into the corresponding monitoring model, and outputting the predicted value of the environmental data through the environmental monitoring model, includes: Build a temperature monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the temperature monitoring model; Build a humidity monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of humidity monitoring model; Constructing NH3 concentration monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the NH3 concentration monitoring model; Constructing a CO2 concentration monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the NH3 concentration monitoring model; Setting temperature safety thresholds , Humidity safety threshold 、NH3 concentration safety threshold and CO2 concentration safety threshold ; if , , , Then the corresponding high temperature alarm signal, high humidity alarm signal, high NH3 concentration alarm signal and high CO2 concentration alarm signal are output; The control logic is constructed to output a control instruction. After the control instruction is received by the environment control device, an operation corresponding to the control instruction is executed to adjust the environment parameters, including: Construct the control vector: ,in, They represent humidity control variable, temperature control variable, CO2 control variable and NH3 control variable respectively; If a high humidity alarm signal and / or a high temperature alarm signal is received, the control vector and / or Set to 1; otherwise, set to 0; If the NH3 concentration is too high alarm signal and the CO2 concentration is too high alarm signal are received, the control vector and / or Set to 1; otherwise, set to 0; if =1 and =0, a control instruction 1 is issued, wherein the control instruction 1 is used to start the drying equipment; if =1 and =0, a control instruction 2 is issued, wherein the control instruction 2 is used to start the air conditioning equipment; if =1 and =1, multiple control instructions 2 are issued to start multiple air conditioners; if , then a control instruction three is issued, and the control instruction three is used to start the ventilation equipment.
[0014] The present invention also provides an intelligent control system for a pig house environment based on the Internet of Things, and the system is used to execute the intelligent control method for a pig house environment based on the Internet of Things.
[0015] The present invention also provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the method for intelligent control of a pig house environment based on the Internet of Things.
[0016] Beneficial effects of the present invention: 1. The present invention determines the sampling frequency according to the actual requirements of pig growth and environmental control, and sets it in the data acquisition device through programming or configuration interface to ensure that the clock of the device is accurate to ensure the correctness of the time label. The temperature, humidity, NH3 concentration and CO2 concentration sensors have Internet of Things functions and are connected to the data acquisition device wirelessly. The data acquisition device receives data from each sensor at a set frequency, adds a type label and a collection time label to each data, and then stores the collected data locally. Finally, these data are integrated into a structured environmental data set to ensure that the environmental data in the pig house is accurately collected, labeled and stored, providing a reliable data basis for the system, which not only helps to monitor the status of the pig house in real time, but also optimizes the breeding environment and improves breeding efficiency through historical data analysis.
[0017] 2. In the present invention, a day is divided into different time periods, and time period labels are added to the collected environmental data to distinguish the time periods to which the data belongs. At the same time, a weight is assigned to each time period, and the weight reflects the degree of influence of the pig's activities on the environmental conditions during the time period. The data in each time period is selected using the sliding window technology, and the weight is applied to the data in each sliding window to calculate the weighted average. The calculated weighted average is used as the feature value to construct a feature set. The environmental monitoring model is trained with the feature set as the input variable. Based on the prediction results of each trained monitoring model, the control model will output corresponding control instructions to control the ventilation equipment to reduce humidity or adjust the temperature equipment to maintain a suitable temperature. In this way, the system can respond to the actual needs of pigs more accurately and improve breeding efficiency. The use of weighted average makes environmental control more refined and better adapts to the different activity patterns and environmental needs of pigs.
[0018] 3. In the present invention, for a sliding window spanning a time period, a weighted average is calculated according to the time period and weight. This method can ensure that even if the sliding window spans two different time periods, the weighted average reflecting the actual situation can be accurately calculated, thereby ensuring the reliability of the characteristic values input to the model and the accuracy of environmental control. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 The present invention is a flow chart of an intelligent control method of a pig house environment based on the Internet of Things. DETAILED DESCRIPTION
[0020] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art can think of other obvious variations. The basic principles of the present invention defined in the following description can be applied to other embodiments, variations, improvements, equivalents, and other technical solutions that do not deviate from the spirit and scope of the present invention.
[0021] It is to be understood that the term "one" should be understood as "at least one" or "one or more", that is, in one embodiment, the number of an element may be one, while in another embodiment, the number of the element may be multiple, and the term "one" should not be understood as a limitation on the quantity.
[0022] Please combine Figure 1 The present invention provides a method for intelligently controlling a pig house environment based on the Internet of Things, comprising the following steps: Step 1: Arrange multiple temperature sensors, humidity sensors, NH3 concentration sensors, and CO2 concentration sensors with IoT communication functions in the pig house to collect environmental data inside and outside the pig house; Step 2: Set the sampling frequency of the data acquisition device through the host computer so that the data acquisition device can obtain the data in the distributed temperature sensor, humidity sensor, NH3 concentration sensor, and CO2 concentration sensor according to the set sampling frequency, and then add a corresponding type label to each type of data. The collected temperature data, humidity data, NH3 concentration data, and NH3 concentration data constitute an environmental data set and store it locally; The addition of various types of tags includes the following steps: Add temperature type label and collection time label 1 to the collected temperature data; Add humidity type label and collection time label 2 to the collected humidity data; Add NH3 type label and collection time label three to the collected NH3 concentration data; Add the CO2 type label and collection time label to the collected CO2 concentration data.
[0023] Step 3: Divide the environment dataset into multiple data subsets according to different type labels, which specifically includes the following steps: After sorting the temperature data with temperature type labels according to the collection time label, a temperature data subset is formed; After sorting the humidity data with humidity type labels according to the second collection time label, a humidity data subset is formed; After sorting the NH3 concentration data with NH3 type labels according to the three acquisition time labels, a subset of NH3 concentration data is formed; The CO2 concentration data with CO2 type labels are sorted according to the collection time label four to form a CO2 concentration data subset.
[0024] Step 4: Store the locally stored temperature data, humidity data, NH3 concentration data, and NH3 concentration data locally, or package the data according to actual needs and send it to the cloud for backup via WiFi or wired network; Step 5: Select multiple data from the data subset through a sliding window, calculate the weighted average of each type of environmental data, and the multiple weighted averages constitute the corresponding type of environmental feature value set. The specific steps are as follows: Set multiple time periods and set different weights according to different time periods; A plurality of data are selected from the temperature data subset, the humidity data subset, the NH3 concentration data subset and the CO2 concentration data subset through the sliding window H, and the weighted average of the data in the corresponding sliding window is calculated using the weight corresponding to each time period; The weighted average values calculated under multiple sliding windows are divided into temperature data feature value set, humidity data feature value set, NH3 concentration feature value set and CO2 concentration data feature value set according to type labels.
[0025] The step of setting multiple time periods and setting different weights according to different time periods specifically includes the following steps: The 24 hours of a day are divided into multiple time periods, specifically: Divide the 24 hours of a day into multiple time periods according to the time points, specifically into five time periods: 0:00-6:00, 6:00-10:00, 10:00-16:00, 16:00-19:00, and 19:00-24:00; Configure weight a1 for the time period from 0:00 to 6:00; Configure weight a2 for the time period from 6:00 to 10:00; Configure weight a3 for the time period from 10:00 to 16:00; Configure weight a4 for the time period from 16:00 to 19:00; Configure weight a5 for the time period from 19:00 to 24:00; By studying the physiological behavior of pigs, their activity patterns during the day, such as resting, eating, and moving, are determined. Based on the results of behavioral analysis, a day is divided into different time periods, such as morning feeding time, noon rest time, and evening activity time. Time period labels are added to the collected environmental data so that it can be distinguished which data belongs to which time period; the environmental data of each time period is also different, and the data of each time period has different effects on the value of the model and the effect of model regulation.
[0026] A plurality of data are selected from the temperature data subset, the humidity data subset, the NH3 concentration data subset and the CO2 concentration data subset through the sliding window H, and the weighted average of the data in the corresponding sliding window is calculated using the weight corresponding to each time period, including: Assume that the temperature data subset is ; The humidity data subset is ; The NH3 concentration data subset is ; The CO2 concentration data subset is ; Through the sliding window, we can Extract multiple data, specifically: Extract multiple temperature data from a subset of temperature data: ,in ; Extract multiple humidity data from the humidity data subset: ,in ; Extract multiple NH3 concentration data from the NH3 concentration data subset: ,in ; Extract multiple CO2 concentrations from a subset of CO2 concentration data: ,in ; calculate arrive Weighted average under time length, where H=| - |, specifically: Substitute the extracted temperature data, humidity data, NH3 concentration data, and CO2 concentration data into the following formulas: , respectively obtain the weighted average of temperature data , weighted average of humidity data 、Weighted average of NH3 concentration data , weighted average of CO2 concentration data ;in, , Indicates the corresponding weight The amount of data, Indicates the corresponding The amount of data.
[0027] A sliding window technique is used to select data from each time period. The size of the sliding window can be adjusted as needed to ensure there are enough data points for accurate statistical analysis. Each time period is assigned a weight that reflects the degree to which the pig's activities during that time period affect environmental conditions. For example, feeding time may generate more heat and humidity and therefore have a higher weight.
[0028] Apply weights to the data in each sliding window and calculate the weighted average. The calculated weighted average is used as the feature value to construct the feature set. These feature values represent the average state of environmental conditions in different time periods, taking into account the influence of pigs' activities. The use of weighted averages makes environmental control more refined and can better adapt to the different activity patterns and environmental needs of pigs.
[0029] In this embodiment, in the weighted averaging process, the corresponding weight is applied to the data in each time period. If the sliding window is completely within one time period, the weight of the time period is directly used; if the sliding window spans two time periods, the corresponding weight is assigned according to the different time periods.
[0030] For sliding windows that span time periods, the weighted average is calculated based on the time periods and corresponding weights. For example, if the sliding window is from 5:59 to 6:09, assuming the weight of the early feeding time period is 0.8 and the weight of the active time period is 0.9, then the one-minute data from 5:59 to 6 o'clock uses 0.8 (weight a1), and the nine-minute data from 6 o'clock to 6:09 uses 0.9 (weight a2).
[0031] In this embodiment, the environmental feature set includes one or more of a temperature data feature value set, a humidity data feature value set, an NH3 concentration feature value set, and a CO2 concentration data feature value set; The weighted average values calculated under multiple sliding windows are divided into temperature data feature value set, humidity data feature value set, NH3 concentration feature value set and CO2 concentration data feature value set according to the type label, including: The weighted average of temperature data under multiple sliding windows constitutes the temperature data feature value set ; The weighted average of humidity data under multiple sliding windows constitutes the humidity data feature value set ; The weighted average of NH3 concentration data under multiple sliding windows constitutes the characteristic value set of humidity data ; The weighted average of CO2 concentration data under multiple sliding windows constitutes the characteristic value of humidity data .
[0032] Construct multiple monitoring models, input the preprocessed environmental feature value set as input variables into the corresponding monitoring model, and the environmental monitoring model outputs the predicted value of the environmental data. The monitoring model includes one or more of a temperature monitoring model, a humidity monitoring model, an NH3 concentration monitoring model, and a CO2 concentration data monitoring model. The specific steps are as follows: Build a temperature monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the temperature monitoring model; Build a humidity monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of humidity monitoring model; Constructing NH3 concentration monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the NH3 concentration monitoring model; Constructing a CO2 concentration monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the NH3 concentration monitoring model; Setting temperature safety thresholds , Humidity safety threshold 、NH3 concentration safety threshold and CO2 concentration safety threshold ; if , , , The corresponding high temperature alarm signal, high humidity alarm signal, high NH3 concentration alarm signal and high CO2 concentration alarm signal are output.
[0033] Similarly, when the temperature and humidity are lower than the temperature safety threshold , Humidity safety threshold When a certain value is reached, a low temperature and dryness alarm is issued. In this embodiment, a low temperature and dryness alarm can be issued when the temperature is 5 degrees Celsius lower than the temperature safety threshold and the humidity is 5% lower than the humidity safety threshold.
[0034] In this embodiment, a temperature monitoring model, a humidity monitoring model, an NH3 concentration monitoring model, and a CO2 concentration data monitoring model are constructed, and the data collected by each sliding window are weighted averaged and preprocessed (including normalization) to form a corresponding feature value set, and the feature set is used as an input variable to train the environmental monitoring model.
[0035] The data in the feature value set (data at multiple time points) is input into the corresponding type of monitoring model, and the prediction results are output, including the predicted temperature value, humidity value, NH3 concentration value and CO2 concentration value. After comparing with the corresponding safety threshold, the corresponding alarm signal is issued.
[0036] Constructing control logic for outputting control instructions. After the control instructions are received by the environment control device, the operation corresponding to the control instructions is executed to adjust the environment parameters and feedback the operation log information. Specifically, the steps include: Construct the control vector: ,in, They represent humidity control variable, temperature control variable, CO2 control variable and NH3 control variable respectively; If a high humidity alarm signal and / or a high temperature alarm signal is received, the control vector and / or Set to 1; otherwise, set to 0; If the NH3 concentration is too high alarm signal and the CO2 concentration is too high alarm signal are received, the control vector and / or Set to 1; otherwise, set to 0; if =1 and =0, a control instruction 1 is issued, wherein the control instruction 1 is used to start the drying equipment; if =1 and =0, a control instruction 2 is issued, wherein the control instruction 2 is used to start the air conditioning equipment; if =1 and =1, multiple control instructions 2 are issued to start multiple air conditioners; if , then a control instruction three is issued, and the control instruction three is used to start the ventilation equipment.
[0037] Read the operation log of each device and obtain the working status of each device to determine whether the device is working normally.
[0038] That is to say, based on the model's prediction results, the control model will output corresponding control instructions, such as adjusting the ventilation system to reduce humidity, or adjusting the temperature equipment to maintain a suitable temperature. After the control device executes the instruction, the system will collect new environmental data and feed it back to the corresponding monitoring model. Through continuous data analysis, the weight distribution and control strategy can be further optimized.
[0039] The present invention also provides an intelligent control system for a pig house environment based on the Internet of Things, and the system is used to execute the intelligent control method for a pig house environment based on the Internet of Things.
[0040] The present invention also provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the method for intelligent control of a pig house environment based on the Internet of Things.
[0041] The embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. The embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part, and / or installed from a removable medium. When the computer program is executed by the central processing unit (CPU), the above-mentioned functions defined in the method of the present application are executed. It should be noted that the above-mentioned computer-readable medium of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of an electrical, magnetic, optical, electromagnetic, infrared segment, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more wire segments, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, electrical wire, optical cable, RF, etc., or any suitable combination of the foregoing.
[0042] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0043] Those skilled in the art should understand that the embodiments of the present invention described above and shown in the accompanying drawings are only examples and do not limit the present invention. The objectives of the present invention have been fully and effectively achieved. The functional and structural principles of the present invention have been demonstrated and explained in the embodiments. Without departing from the principles, the implementation methods of the present invention may be deformed or modified in any way.
Claims
1. A method for intelligent control of pig house environment based on the Internet of Things, characterized in that: The method comprises: Collect environmental data inside and outside the pig house through multiple sensors, store the environmental data set locally, and send it to the cloud for backup using IoT technology; Setting a sampling frequency so that the data acquisition device reads the environmental data collected by the sensor according to the sampling frequency; Add corresponding type labels to each type of environmental data to form an environmental data set, and divide the environmental data set into multiple data subsets according to different type labels; Selecting multiple data from the data subset through a sliding window, calculating the weighted average of each type of environmental data, wherein the multiple weighted averages constitute a corresponding type of environmental feature value set; Construct multiple monitoring models, input the preprocessed environmental feature value set as input variables into the corresponding monitoring model, and output the predicted value of the environmental data through the environmental monitoring model; Build control logic to output control instructions. After receiving the control instructions, the environmental control device performs corresponding operations to adjust environmental parameters and feedback operation log information.
2. According to the method of intelligent control of pig house environment based on Internet of Things in claim 1, it is characterized in that: The setting of the sampling frequency so that the data acquisition device reads the environmental data collected by the sensor according to the frequency includes: The environmental data includes one or more of temperature, humidity, NH3 concentration, and CO2 concentration; Setting the data collection frequency in the data collection device; Establish data connection between the data acquisition device and the temperature sensor, humidity sensor, NH3 concentration sensor, and CO2 concentration sensor; the data acquisition device collects data from the temperature sensor, humidity sensor, NH3 concentration sensor, and CO2 concentration sensor according to the set data acquisition frequency, and stores the data locally; The corresponding type label is added to each type of environmental data to form an environmental data set, including: Add temperature type label and collection time label 1 to the collected temperature data; Add humidity type label and collection time label 2 to the collected humidity data; Add NH3 type label and collection time label three to the collected NH3 concentration data; Add CO2 type label and collection time label to the collected CO2 concentration data; The collected temperature data, humidity data, NH3 concentration data, and NH3 concentration data constitute an environmental data set and are stored locally.
3. The method for intelligently controlling a pig house environment based on the Internet of Things according to claim 1 is characterized in that: The environmental dataset is divided into multiple data subsets according to different type labels, including: After sorting the temperature data with temperature type labels according to the collection time label, a temperature data subset is formed; The humidity data with humidity type labels are sorted according to the second collection time label to form a humidity data subset; After sorting the NH3 concentration data with NH3 type labels according to the three acquisition time labels, a subset of NH3 concentration data is formed; The CO2 concentration data with CO2 type labels are sorted according to the collection time label four to form a CO2 concentration data subset.
4. The method for intelligently controlling the pig house environment based on the Internet of Things according to claim 3 is characterized in that: The method selects multiple data from the data subset through the sliding window, calculates the weighted average of each type of environmental data, and the multiple weighted averages constitute a corresponding type of environmental feature value set, including: The environmental characteristic value set includes one or more of a temperature data characteristic value set, a humidity data characteristic value set, an NH3 concentration characteristic value set, and a CO2 concentration data characteristic value set; Set multiple time periods and set different weights according to different time periods; A plurality of data are selected from the temperature data subset, the humidity data subset, the NH3 concentration data subset and the CO2 concentration data subset through the sliding window H, and the weighted average of the data in the corresponding sliding window is calculated using the weight corresponding to each time period; The weighted average values calculated under multiple sliding windows are divided into temperature data feature value set, humidity data feature value set, NH3 concentration feature value set and CO2 concentration data feature value set according to type labels.
5. The method for intelligently controlling the pig house environment based on the Internet of Things according to claim 4 is characterized in that: The setting of multiple time periods and setting different weights according to different time periods include: Divide the 24 hours of a day into multiple time periods according to the time points, specifically into five time periods: 0:00-6:00, 6:00-10:00, 10:00-16:00, 16:00-19:00, and 19:00-24:00; Configure weight a1 for the time period from 0:00 to 6:00; Configure weight a2 for the time period from 6:00 to 10:00; Configure weight a3 for the time period from 10:00 to 16:00; Configure weight a4 for the time period from 16:00 to 19:00; Configure weight a5 for the time period from 19:00 to 24:
00.
6. The method for intelligently controlling the pig house environment based on the Internet of Things according to claim 5 is characterized in that: The method selects a plurality of data from the temperature data subset, the humidity data subset, the NH3 concentration data subset and the CO2 concentration data subset through the sliding window H, and calculates the weighted average of the data in the corresponding sliding window using the weight corresponding to each time period, including: Assume that the temperature data subset is ; The humidity data subset is ; The NH3 concentration data subset is ; The CO2 concentration data subset is ;in, Indicates the number of data; Through the sliding window, we can Extract multiple data, specifically: Extract multiple temperature data from a subset of temperature data: ,in ; Extract multiple humidity data from the humidity data subset: ,in ; Extract multiple NH3 concentration data from the NH3 concentration data subset: ,in ; Extract multiple CO2 concentrations from a subset of CO2 concentration data: ,in ; calculate arrive Weighted average under time length, where H=| - |, specifically: Substitute the extracted temperature data, humidity data, NH3 concentration data, and CO2 concentration data into the following formulas: , respectively obtain the weighted average of temperature data , weighted average of humidity data , weighted average of NH3 concentration data , weighted average of CO2 concentration data ;in, , Indicates the corresponding weight The amount of data, Indicates the corresponding The amount of data.
7. The method for intelligently controlling a piggery environment based on the Internet of Things according to claim 6 is characterized in that: The weighted average values calculated under the multiple sliding windows are divided into a temperature data feature value set, a humidity data feature value set, an NH3 concentration feature value set and a CO2 concentration data feature value set according to the type label, including: The weighted average of temperature data under multiple sliding windows constitutes the temperature data feature value set ; The weighted average of humidity data under multiple sliding windows constitutes the humidity data feature value set ; The weighted average of NH3 concentration data under multiple sliding windows constitutes the characteristic value set of humidity data ; The weighted average of CO2 concentration data under multiple sliding windows constitutes the characteristic value of humidity data ,in, is the number of eigenvalues.
8. The method for intelligently controlling a piggery environment based on the Internet of Things according to claim 1, characterized in that: The method of constructing multiple monitoring models, inputting the preprocessed environmental feature value set as an input variable into the corresponding monitoring model, and outputting the predicted value of the environmental data through the environmental monitoring model includes: The monitoring model includes one or more of a temperature monitoring model, a humidity monitoring model, an NH3 concentration monitoring model, and a CO2 concentration data monitoring model; Build a temperature monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the temperature monitoring model; Build a humidity monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of humidity monitoring model; Constructing NH3 concentration monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the NH3 concentration monitoring model; Constructing a CO2 concentration monitoring model: ,in, is the intercept, is the regression coefficient, is the error term, represents the number of input variables, It is the input variable of the NH3 concentration monitoring model; Setting temperature safety thresholds , Humidity safety threshold 、NH3 concentration safety threshold and CO2 concentration safety threshold ; if , , , Then the corresponding high temperature alarm signal, high humidity alarm signal, high NH3 concentration alarm signal and high CO2 concentration alarm signal are output; The control logic is constructed to output a control instruction. After the control instruction is received by the environment control device, an operation corresponding to the control instruction is executed to adjust the environment parameters, including: Construct the control vector: ,in, They represent humidity control variable, temperature control variable, CO2 control variable and NH3 control variable respectively; If a high humidity alarm signal and / or a high temperature alarm signal is received, the control vector and / or Set to 1; otherwise, set to 0; If the NH3 concentration is too high alarm signal and the CO2 concentration is too high alarm signal are received, the control vector and / or Set to 1; otherwise, set to 0; if =1 and =0, a control instruction 1 is issued, wherein the control instruction 1 is used to start the drying equipment; if =1 and =0, a control instruction 2 is issued, wherein the control instruction 2 is used to start the air conditioning equipment; if =1 and =1, multiple control instructions 2 are issued to start multiple air conditioners; if , then a control instruction three is issued, and the control instruction three is used to start the ventilation equipment.
9. An intelligent control system for pig house environment based on the Internet of Things, characterized in that: The system is used to execute an intelligent control method for pig house environment based on the Internet of Things as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the intelligent control method of a pig house environment based on the Internet of Things as described in any one of claims 1 to 8.
Citation Information
Cited By
Pig group environment temperature control method and system
CN121187388A