Development and Evaluation of A Comprehensive Greenhouse Climate Control System Using Artificial Neural Network

Development of controlled environment in greenhouse is of prim importance for out of season production, increasing yield and enhancing the quality of produce. Due to high cost and impossibility of continuous human attendance in greenhouse, it is desirable to control the greenhouse environment by employing automatic control devices. In This study, the greenhouse conditions were controlled by using artificial neural network (ANN). First, an experimental greenhouse was built and equipped with control instruments. Then by using electronic sensors, some climatic parameter data (temperature, humidity, carbon dioxide and light index) were measured and saved during five minute periods. In the next stage, three types of ANN including feed forward neural networks with multiple delays in the input, two-layer neural network with a feedback from hidden layer and input delay and three-layer neural network with two feedbacks from hidden layers and input delay were trained by 66% of the recorded data, and were evaluated by using the remaining data. The three-layer neural network with two feedbacks from hidden layers and input delay was able to better predict humidity and light index of the greenhouse with MSE,s of 0.025 and 0.032, respectively. Temperature and infrared index were better predicted by using the feed forward neural networks with multiple delays in the input with MSE,s of 0.016 and 0.017, respectively. In all cases, training time was less than 14 minutes and simulation time being always less than 0.2 second, makes using neural network feasible for automatic control of greenhouse.


Introduction
Greenhouse is a structure in which temperature, humidity, light and carbon dioxide are controllable. Inside greenhouses most plants can be grown throughout the year, especially out of season and some products could be prematurely ripened and kept for a full or part of a year during adverse climatic conditions [1]. The degree of thermal control depends on the type of plants that are propagated or grown [2]. Temperature affects photosynthesis, breathing, evapotranspiration, vegetative growth and leaf color of plants inside the greenhouse. Intensity, duration of radiation and quality of light is important for plants and varies depending on plant type [1]. Proper relative humidity enhances leaf vigor and freshness. High humidity along with high temperature causes propagation of fungi and other plant diseases. Controlling the concentration of carbon dioxide can increase yield [2].
ANN is a soft computing technique that by learning process and employing simple processors by the name of neurons tries to establish a correlation between input space (input layer) and the target space (output layer) by discovering the inherent relations among data. The hidden layers process the data received from input layer and produce answer in the output layer. Each network is trained by receiving some examples. Training is a process that eventually ends up to learning. Network learning is terminated when the connection weights between the layers are changed until the difference between predicted and the target (experimental) is reduced to permissible limits. The trained neural network can be used for predicting outputs relevant to a set of new data. Regarding to the structure of artificial neural network, its main characteristics include high processing rate, learning ability through pattern presentation, ability to generalize the knowledge after learning, flexibility in dealing with un-desired errors and not making any significant interruption in case of damage in any part of network connections due to distribution of the connection weights in the network [3].
Seginer et al. [4] used neural network for modeling greenhouse climate. They used experimental data from a few research greenhouses for training the neural network and found a proper approach for predicting the greenhouse inside Universal Journal of Control and Automation 1(1): 10-14, 2013 11 climatic conditions by acquiring outside conditions and employing control equipments.
Linker et al. [5] conducted optimum CO 2 control in a greenhouse modeled with ANN and they used data gathered during a two summer month period from a small greenhouse to train the neural network. Their model was reduced to minimum size by predicting separately carbon dioxide concentration and temperature and by eliminating any unessential input. The resulting model not only fitted the data well, they also seemed qualitatively correct.
Linker et al. [6] later used a robust controller for simultaneous control of air temperature and carbon dioxide concentration in a greenhouse. In this study the control process was divided into two control loops, the first maintaining the temperature by adjusting the ventilation and the second maintaining the CO 2 concentration by adjusting the enrichment. Performance of this system in an experimental greenhouse showed the capability of this control system to meet the requirements.
Trigui et al. [7] used a control algorithm with two sub-programs designed for tomato production greenhouse. The sub-programs were employed to establish equilibrium between tomato yield and reducing energy cost for heat, moisture and carbon dioxide injection. The sub-programs were also used to adjust the predicted external climatic parameters (solar radiation, temperature, wind velocity and relative humidity). The main goal of creating this algorithm was to develop a program for continuous adjustment of greenhouse climate conditions to maximize crop yield. According to this study, daytime temperature is the most important factor affecting energy consumption and yield.
Ferreira et al. [8] used a radial basis function neural network to model the inside air temperature of a hydroponic greenhouse as a function of outside air temperature. They used both off-line and on-line methods to train the neural network as well as employing radial basis functions.
Frausto and Pieters [9] used ANN for modeling greenhouse temperature. They found a balance between the number of neurons in the hidden layer of a neural network and the number of iterations for model training that caused optimum performance of this network over a complete year.
Coelho et al. [10] used a temperature optimization algorithm for prediction and control of greenhouse air temperature. In this approach, time variant parameters and recursive identification techniques were used for real time evaluation of predicted values.
Fourati and Chtourou [11] used recursive identification and feed forward neural network for greenhouse control. This method was based on a multilayer feed forward neural network that was trained for dynamic process control.
Ehert et al. [12] used ANN modeling to predict cuticle cracking in greenhouse peppers and tomatoes. They were able to predict the results of the first and fourth weeks of production with correlation coefficients of 0.71 and 0.70 for peppers and 0.70 and 0.64 for tomatoes, respectively.
Patil et al. [13] modeled tropical greenhouse temperature by auto regressive and ANN models. They evaluated variables like outside temperature, sun radiation, relative humidity and cloud conditions to predict greenhouse climate. The results showed that when series tuning was done for fixed temperatures rather than fixed during time, the model performed better. Dariouchy et al. [14] predicted internal parameters of greenhouse tomatoes of semi-arid regions by ANN. Comparison of their predicted and experimental data showed that ANN is suitable for predicting greenhouse climate conditions.
He and Ma [15] modeled greenhouse humidity by means of ANN and principal component analysis. This study was conducted in winter and the factors affecting internal humidity including external temperature, humidity, wind speed and radiation as well as internal temperature, angle of widows opening and ratio of shades opening were investigated.
The objective of this study was to develop and evaluate a comprehensive greenhouse climate control using three types of artificial neural network models to predict greenhouse climate control system.

Materials and Methods
For conducting this research an experimental greenhouse (5 × 3 m) was built (Figure 1), the necessary instruments were installed and all experimental stages were executed. The greenhouse was located at Shiraz University College of Agriculture with geographical coordinates 52º 46´ Long. W, 29º 50` Lat. N and elevation 1810 m asl.
For providing necessary humidity and coolness, an evaporative cooling system comprising of a small water pump and three sheets of cooling pads were employed. Heating and lighting was provided by electric heater and light bulbs. Ventilation was provided by variable opening windows. A pressurized carbon dioxide cylinder was used to enrich the concentration of carbon dioxide inside the greenhouse by manual releasing during 5 second intervals. Sun light radiation was at two levels; with and without sunroof shades.  The climatic conditions inside and outside the greenhouse were measured and monitored by electronic sensors that were calibrated on a regular basis. Technical specifications of the sensors are presented in Table 1. A wind direction and speed sensor was installed outside the green house and other sensors for measuring relative humidity, carbon dioxide concentration, infra-red light, visible light and air temperature were employed inside and outside of the greenhouse. For data acquisition system, all sensor outputs should be presented in frequency. Humidity sensor output was in frequency but Carbon Dioxide detection sensor and Infra-red sensor outputs were changed from voltage to frequency by electronic circuits shown in figures 2 and 3, respectably.
All of the sensors were connected to an electronic data acquisition device (Figure 4).
In the data acquisition circuit U1 is ATmega16 microcontroller from AVR family that measures each sensor frequency and temperature output. U3 and U6 are multiplexer for switching between sensors and U4 is used to display number of selected sensor in bar-graph U5. A LCD was used to show sensor data. Red LED (D1) shows that data sampling is ongoing. U2 is a memory for saving data acquisition and data handing, delay between sampling and reading sensor output calculated by microcontroller.   For data acquisition, in the first step sensor number one in multiplexer was selected and then 500 millisecond later next sensor was selected. After measuring all sensor data, they are recordable and visible. During every five minute delay time Universal Journal of Control and Automation 1(1): [10][11][12][13][14]2013 13 set by the microcontroller, data observing and saving was possible. The five minute delay intervals were selected in order to have sufficient time for the sensors to gain stable output. At the end of each five minute, climate conditions of the greenhouse was modified by changing the control devices (side windows, heaters, water pump etc. by assigning random numbers provided by Matlab software 2010. At the end of data acquisition, the measured data were transferred to an office computer for further processing.
For prediction of greenhouse climate conditions at any later stage, artificial neural networks in Matlab 2010 software used. For determining the most suitable ANN in this study, the following types with three different architectures were used and compared: the feed forward neural network with several delays in input, two layers with one feedback from hidden layer and delay in input and finally, three layers neural network with two feedbacks from hidden layer and delay in input.
The inputs to each network were current condition of the control instruments and sensors' outputs and network outputs were measured values (temperature, light, moisture and carbon dioxide) at later stage.
Data collection was performed at three nonconsecutive days (Feb. 7, 9 and 16, 2012) from 10 am to 8 pm. On the third day of data collection (Feb. 16) shades were installed to study the effect of sunshine shade on greenhouse conditions. The resulting data were first recorded and later, analyses of the neural networks were performed using the recorded data.
Training of the neural network was performed after transforming the data. Visible light and infra red sensor data were first modified by logarithm function due to their vast variations.

Results and Discussion
In the feed forward neural network with multiple delays in input, the effect of the number of neurons in hidden layer and number of delays in input for different variables were evaluated. The results of the evaluation indicating the number of neurons and number of delays in input that resulted in the best MSE is shown in Table 2.
In the two-layer neural network with one feedback from hidden layer and delay in input the effect of the numbers of neurons in hidden layer and delays in input were evaluated. The results of the evaluation indicating the number of neurons and number of delays in input that resulted in the best MSE is shown in Table 3.
In the three-layer neural network with two feedbacks from hidden layers and delay in input, the number of neurons in hidden layer and delays in input were changed. The results of the evaluation indicating the number of neurons and number of delays in input that resulted in the best MSE is shown in Table 4. Considering the index of MSE in the study of the three evaluated neural networks, the most suitable network for prediction of the status of each climatic parameter in the next time interval is as following: For predicting relative humidity, the three-layer network with two feedbacks from hidden layers and delay in input with 7 neurons in the first layer, 7 neurons in the second layer and 6 delays in input is the best choice. Infra-red index was better predicted by feed forward network with multiple delay in input, 5 neurons in hidden layer and 4 delays in input. The light index was better predicted with 4 and 3 neurons in hidden layer and 6 delays in input and using the three-layer neural network with two feedbacks from hidden layers and delay in input. Prediction of greenhouse temperature was better performed using feed forward neural network having 7 delays in input and 5 neurons in hidden layer.

Conclusion
The overall results indicate that controlling greenhouse climatic conditions is feasible using ANN. Three-layer neural network with two feedbacks from hidden layers and delay in input provided a better description of relative humidity and light index. Feed forward neural network with multiple delays in input was able to better predict temperature and infra-red index. Greenhouse temperature and recognition of its variation trend was well predicted by neural network. Recognition of variation trends of all studied parameters was satisfactory and the errors in predictions were insignificant. In all cases simulation time was very smaller than data collection time which indicates the feasibility of performing simulation during data acquisition.