Intelligent Pasture Cloud Management System Based on Fuzzy Mathematics PID Control

In current China, especially in western provinces, pasture management is largely backward and has low level of automation, and intelligent pasture systems are urgently needed to improve efficiency of management process and reduce operating cost. An intelligent pasture cloud management system based on fuzzy PID control algorithm is proposed in this paper, which consists of management platform software, transmission equipment, intelligent control module and information acquisition module. The sensors acquisition environment parameters are uploaded to the cloud server, fuzzy PID control is performed on the cloud server, and the control parameters are delivered to the intelligent control module for reasonable and effective environmental regulation, such as the temperature and humidity of the pasture. Pasture administrators can check pasture status at any time for remote pasture management, and the pasture environment can be automatically and intelligently regulated. After simulation experiments, we prove that our system is effective.


Introduction
As the scale of modern pasture grows, traditional pasture management, which mainly requires human labor, could not efficiently handle the task.However, in present China, especially in China's western provinces, most of the pasture control systems still remain in the manual or semiautomatic operation of the administrator, and the automation level is low, which requires updating to a more intelligent and automotive management [1] .
In this paper, an intelligent pasture control system based on cloud management is proposed.The sensors acquisition environment parameters are uploaded to the cloud server, fuzzy PID control is performed on the cloud server, and the control parameters are delivered to the intelligent control module for reasonable and effective environmental regulation, such as the temperature and humidity of the pasture [2] .The system can accurately collect data, real-time alarm, intelligently control based on PID control algorithm based on fuzzy mathematics, thereby reducing labor costs and ensuring the healthy growth of livestock [3] .
The rest of this paper is organized as following: Section 2 gives an overview of our pasture management system, Section 3 describes our fuzzy PID control in detail, Section 4 validates our proposal and Section 5 concludes the paper.

System Overview
Intelligent pasture cloud management system mainly consists of information collection system, communication system, server system, administrator access system, and intelligent control system.The system structure diagram is shown in Figure 1.Information acquisition system includes temperature and humidity sensors, gas concentration sensors, and human infrared sensors.It collects various environmental data, such as temperature, humidity and ammonia concentration, which are uploaded to the web page in real time.It also detects the human body's infrared light.The range of temperature is 0~50°C.The range of humidity is 20%~90%RH.The range of ammonia concentration is 10~1000PPM.Human body infrared sensor module always outputs high level within 3 seconds after someone is detected, and buzzer sounds at this time.
In the communication system, the Raspberry Pi communicates with the STM32 via Bluetooth, and Raspberry Pi communicates with the server via the Socket protocol.The server runs the server program and opens the port with 6666, and the Raspberry Pi works as the client to connect the server.The communication data are packaged and parsed in JSON format.
The server system is configured by Apache, Red5 server, Control server, and NFS server.
The administrator control web page receives and delivers parameters in real time.There are five pages: Home Page Introduction, Smart Control, Weather Information, Car Manager, and About Us.The client on the browser requests to access the server, and then server returns the result to the client.At this time, the front page is updated.The webpage is made up of four languages: HTML, JavaScript, PHP, and MySQL.Data is stored in the database for user inquiry.Remotely controlled commands are stored in a file in JSON data format [4] .
Intelligent control module includes fans, lights, water pumps and other equipment, and can be remotely controlled by web to perform management of the ranch.When the temperature and humidity of the ranch house are too high, the fan is automatically turned on.When the ammonia gas is too heavy, the water pump is automatically turned on for flushing to realize automatic management of the ranch [5] .

Selection of Algorithm
Since the temperature control object often exhibits nonlinearity, and it changes irregularly with time, there is a certain lag in the control effect of temperature.If PID control is used, it is difficult to gain decent results.In order to use PID to perform real-time monitoring and control, a fuzzy control algorithm is proposed.In the algorithm, the expert knowledge is organized into rules to simplify the control process through experience, and the classic and modern control theory are combined to achieve better control effects.The temperature and humidity in the room are the subjects of study, and the use of fuzzy algorithms controls the central air-conditioning [6] .Using MATLAB simulates gets the temperature self-adjusting system based on fuzzy algorithm.The self-adjusting performance of the fuzzy control rule is applied to the temperature control system, so as to make up for the defect that the ordinary temperature control system cannot solve the temperature change, and continuously improve the performance of the temperature control system to achieve the desired effect.

the Principle of the Algorithm
The fuzzy controller is designed using MATLAB FIS toolbox.The inputs of the controller are e and ec , and the outputs are three parameters p K , i K and d K of PID controller.The membership functions use Z-type, triangular and S-type membership functions, respectively.
Gravity method is adopted as a clear method.Since e and ec have 7 fuzzy divisions each, the fuzzy rules have at most 49 rules.The fuzzy rules use the AND method [7] .The fuzzy PID control schematic is shown in Figure2.
Assuming that the temperature control system is designed to increase the temperature from 0 to 40 degrees, the system error e and the rate of change of the error rate ec are defined as the domain of the fuzzy set.Both e and ec are {-40, 40}.

Determine the Fuzzy Subset of Parameters
The fuzzy subsets of the input variables e and ec , and the output values p K , i K and d K are set to {NB, NM, NS, Z, PS, PM, PB}, which correspond to the scope of the above domain respectively, and then set to the fuzzy function of MATLAB [8] .

Establish a Suitable Fuzzy Rule Table
The role of PID parameters [9] : p K : Increasing p K can speed up the response and reduce the steady-state error, but it is easy to produce overshoot and affect stability.
i K : Increasing i K is beneficial to reducing the steady-state error, but it is easy to make the system respond to lag and the dynamic quality becomes worse.d K : Increasing d K can improve the dynamic quality of the system, but it will be sensitive to hum and affect system stability.
The following tables are the fuzzy control tables for each of the three parameters p K

Correction Parameters
According to the membership degree assignment table of each fuzzy subset and the fuzzy control model of each parameter, a fuzzy synthesis reasoning is used to design the fuzzy rule table of PID parameters, and the correction parameters are found into the following formula [10] .
( ) During online operation, the control system completes the online self-correction of PID parameters through the processing of the results of fuzzy rules, table lookups and operations.

Simulation Experiment Based on Fuzzy PID Control
The temperature control system decides to use a twodimensional controller structure, that is, using the error e and the rate of change of the error ec as input signals,  According to the fuzzy relationship between the three parameters of the PID controller and the deviation e and the change of the deviation ec , the e and ec are continuously detected during the operation.Through the pre-determined relationship, the fuzzy inference method is used to modify the three parameters of the PID controller online so that the PID parameters can be self-tuned.MATLAB simulation algorithm flow chart is shown in Figure 4.The following figure is the response curve of the temperature after pure PID control and fuzzy PID control, in which the blue line is the steady state value of 40, the red line is the fuzzy PID response curve, and the sky blue System fuzzypid: 2 inputs, 3 outputs, 49 rules e ( 7) ec ( 7) Kp ( 7) Ki ( 7) Kd ( 7 From the figure we can see that, compared with pure PID, fuzzy PID overshoot is small, the speed to reach steady state is fast, and it is better than pure PID control under the same control requirements.

5.Conclusion
An intelligent pasture cloud management system is proposed for research and development of modern largescale breeding pastures environment control.The system is mainly controlled by the temperature and humidity index.It can reasonably and efficiently adjust the parameters of the pasture environment so that the livestock lives in a suitable environment, and ranchers can remotely manage ranches, which realized intelligent and automated management of pastures.Using fuzzy PID algorithm to control the temperature and humidity has the characteristics of high control accuracy, good steady-state performance and small overshoot.The adaptability to the controlled parameters is relatively strong and the control effect is good.

Fig. 2 .K
Fig. 2. Schematic diagram of fuzzy PID control to the domain and the corresponding 7-segment rule segmentation, a total of 49 rules can be generated, as shown in Figure3.

Table 1 .
p K

Table 3 .
d K Δ fuzzy rule table d K