Application analysis of ANFIS strategy for greenhouse climate parameters prediction: Internal temperature and internal relative humidity case of study

. The present paper, introduces Adaptive Neuro Fuzzy Inference System (ANFIS) as one of the most mature and intelligent methods to predicte internal temperature and relative humidity of a greenhouse system. To conduct the application of the proposed strategy, an experimenntal greenhouse equipied with several sensors and actuators is engaged. In this sense a data base was collected during a period of day time where the temperature and relative humidity dynamics were observed inpresence of others climatic parameters and the actuators’ actions. The results demonstrate that by using ANFIS method, the predictions match the target points with a good accuracy . Therefore, the e ﬀ ectiveness of the strategy in term of both inside climate parameters’ prediction is guaranteed.


Introduction
Nowadays, the agriculture domain faces several challenges, especially in term of hard climate conditions and the water deficit for any outdoor cultivation type. Hence, it has been admitted that greenhouses take a leading role in facing such obstacles, in fact, greenhouses have the ability to maintain the adequate micro climate for cultivated indoor crops, in addition to shield those latests from any climate weather excess and unwanted pests and leaks [1].
From a modelisation point of view, greenhouses are considered to be nonlinear complex systems, the dynamic coupling between different parameters such as, the inside air temperature, the outside temperature, the air velocity, the relative humidity, in addition to the outdoor meteorological conditions, make the modelling and control of inside climate parameters more computationally difficult to be ensured. For an adequate control and system management regarding such conditions, it is necessary to create and identify models that guarantee the system stability and that maintain its own properties.
Modelling greenhouse's comportement and dynamics is an interesting aspect since it represents the main task for any choosen control strategy. In fact, the comlexity and nonlinearity of greenhouses as buildings have encouraged researchers to think about more accurate identification technique in this sense, three major types of identifaction paradigms are commonly proposed: White box models, gray box model and black box models [2]. The first type is mostly based on mass/energy consevation principles and describes the systems from a physical knowledge, where a large set of parameters are included, hence, resulted models are inacurate and the implemetation of such * e-mail: Hamidanehafsa@gmail.com boxes are difficult to be acheived. Grey box models in there part are based on sets of differential equations presented in form of a state space presntation derived from the physical laws that describe the system dynamics. In addition this technique of identification uses estimation techniques to estimate the unknown parameters included in the model. However, a major challenge of gray box modeling is that it relies on robust parameter estimation methods, which require more care related to the training process of data sets. The third modelling paradigm is black box method, this type of modelling is a data driven model based completely on measured data without incorporating any equation of physical dynamics regarding the system. They can be presented as parametric linear models such as Auto Regressive (AR), Auto Regressive with eXogenous inputs (ARX), Auto Regressive with Moving Average and eXogenous inputs (ARMAX) etc..., or as nonparametric/parametric nonlinear ones such as kNearest Neighbors (kNN), Gaussian Processes (GP), Random Forest (RF), Artificial Neural Network (ANN), Genetic Algorithm (GA),Adaptative Neuro-Fuzzy Inference System (ANFIS) and many other techniques for more details the reader is referd to [4].
ANFIS is now considered to be among the most commonly used AI models, therfore, recentely many are the areas that have emphasized the improvement of ANFIS performance by implementing it within multiple projects and domains. For instance, in buildings such as greenhouse's and especially for climate prediction aims. From the greenhouse perspective, inside temperature and relative humidity take a leading role in the process of identification depending on the type of cultivation and crops, however these parameters are mostly affected; in a way or another; by a number of factors and phenomena such as the  [3].
In this sense, the present paper aimed to investigate the prediction of internal temperature and internal humidity of the greenhouse as a complexe system, using both, ANFIS strategy as an intelligent alternative and historical data for external climatic parameters and actuators' operation regarding the Schefflera cultivation planted in the real greenhouse.
The remainder of this paper is organized as follows, Some preliminaries regarding ANFIS strategy will be presented in section 2. Section 3 will step through materials and methods including the experimental greenhouse presentation and data preparation. The results of this paper will be discussed in section 4. In section 5, conclusions will be provided.

Brief insight:
An ANFIS structure: ANFIS network is a data driven technique that engages Neural Network strategy to solve approximation problems of complexe systems. In addition a set of input and output variables are incorporated to generate fuzzy inference based on fuzzy reasoning with the If-Then rules proposed by Takagi and Sugeno, its structure is generally composed of five main layers [5]. Its principle is based on fuzzy logic and neural network method where inputoutput variables, a set of rules, and fuzzy inference system take a part in the process of systems' behavior forcasting. For simlicity a structure of two inputs and single output is depicted in Figure 1 where x, A i and µ Ai present respectivelly the input to node i, the variable associated with the node function and the membership function of Ai. The standard form of µ Ai (x) is as follows: σ and C present the parameters of the Gaussian function.
-The second layer: Every node is presented to fix and its role is to calculate the weights ω i of a generated rule. The weightt of each node is given by: -The third layer: For every i th node in this layer, the average of the i th rule's weight to the sum of weights of all the rules is calculated. The formula is presented as follows: -The fourth layer: The ratio of every weight calculated in layer 3 , is then multiplied by its associated function in the fourth layer: where p i , q i and r i , present the resulted parameters set.
-The fifth layer: Herein, the sum of the previous outputs in the last layer, the resulted output is given by: It is worth mentionnig that the application of ANFIS models has been considered in various areas we can cite health, industry, finance etc... Its different paradigms utilities [6] are: Pattern classification, time series prediction, regression, fault detection and industrial problems.

Learning/ training algorithms:
For any ANFIS, the training of models is a compulsory step to take into account, for this aim, various are the algorithms that are commonly employed in training process models based on neural networks and fuzzy systems. In general, the utility of the mentionned algorithms is that they allow the resulted answer to be adapted to the objective for which they are aimed. Among these algorithms we can find: Backpropagation: A widely used training algorithm regarding ANFIS models, this method permits to determine a vector of weights, that optimizes(minimize) the model's training error repeatedely. In a simple way, the aim of this technique is to find a set of weights that minimizes the output of the network error, in a way to map the inputs to the outputs in a correct manner. This tehcnique is based on the so-called gradient descent optimization algorithm, the reader can be refered to [7].
Genetic Fuzzy neural networks: Genetic Algorithms are considered to be as optimization algorithms that solve a given problem based on natural selection. The search strategy adopted in genetic algorithms is considered to be structured and random and works using a group of points instead of a single point. They mostly have the ability to identify environmental factors which results on optimal solutions [8]- [10].
Deep learning: Beeing one of the sub-categories of machine learning, deep learning is considered to be one of the automatic learning techniques that gives the computers the opportunity to learn based on examples [11] [12]. The advantage of this algorithm, is that for traditional neural networks, three or less hidden layers are supported by the network, while for the case of deep learning, the network can contain an enormous number of hidden layers.
Hybrid optimization: Hybrid is generaly based on backpropagation for the parameters with the input membership functions, and the least squares estimation method for the parameters in association with the output membership functions [13][14] More algorithms and methods are engaged in this sence,we mention: • Evolving and on-line algorithm

ANFIS metrics and fitness functions:
In order to validate the efficiency and the prediction performance of the propesed strategy, some fitness functions named also statistical variables [15] [16], are generally used to determine how well the predicted values and observed values match each others. These functions are namely, Mean Square Error (MSE), Root Mean Square Error (RMSE) and the correlation factor R 2 , that are described in Equations (7)- (9).
Where N, x obs,i , x pred,i andx obs,i refer respectivelly to, the number of data sets, the observed or actual output, the predicted or aproximated output and the average of the present points.

Prototype of the Experimental Greenhouse
The greenhouse engaged in the present article is dipected in Figure 2, it is an experimental greenhouse prototype, located at the department of physics, Faculty of Sciences, Meknes, Morocco. The system is a single wall polyethylene construction, equipped with two temperature sensors and two humidity sensors that provide respectivelly indoor and outdoor temperature and relative humidity measurements. Aditionally, two actuators presented as a heating system and a ventilator are installed as well in order to insure an adequate inside climate for the greenhouse plants. Data acquisition and control tasks are insured by the means of an acquisition cards attached to a personal computer where the mentionned sensors and actuators are connected. This card is installed to manage the different actuator orders. In addition, a protection and signal conditionning cards are also installed to guarantee the hole system protection. In a second place; the tasks of supervision of measured indoor and outdoor climate variables; are provided in form of historical database sets using Matlab/Simulink as software. More details about the different components and their roles are provided in Table 1.

Data setting and preparation
In the first stage,the historical data set used for temperature and relative humidity prediction was collected and obtained from the real greenhouse prototype as detailled in subsection 3.1 . Data were collected for two hours and a half successively during the early afternoon, 5 seconds was used as sample time Ts. In total, the whole experimental data set was 2200 samples that was devided into two categories: training part samples that represent 70% of the data and the testing part which describe 30% of the set.
For internal temperature prediction case, and for both, training and testing processes, the inputs were respectively chosen to be: the external temperature (T ex ), the external relative humidity (Rh ex ), the internal relative humidity (Rh in ), the fan and the heater actions (F), (H), while the output was selected to be the internal temperature (T in ). For internal relative humidity prediction case, and for both processes as well, the inputs were: the external temperature (T ex ), the internal temperature (T in ), the external relative humidity (Rh ex ), the fan and the heater actions (F), (H) respectively, and the output was set to be the internal relative humidity (Rh in ). Figure 3 and Figure 4 show the structure of ANFIS models regarding the inside temperature and relative humidity prediction. Herein, the training part was dedicated to generate the best network while the testing part had the functionality to validate the performance of each model concerning the temperature and relative humidity.

Results and discusions
In order to validate the proposed identification strategy, results were performed in form of simulations. It is worth reminding that the goal of this paper is the identification of time series of the greenhouse inside temperature and relative humidity, taking into account the effect of the other climatic parameters and the actuators' actions. In this study, Data collection and simulation developpement were obtained using a Core 3 personel computer with 4G of RAM. Figure 5 shows the evolution of external temperature and external relative humidity during the same period of data collection, it is noticable that these latests evoluate between a range of 22 • C and 25 • C for temperature and a range of 62% and 70% for humidity.
With this end in view, two cases were studied: Figure 5. External temperature and relative humidity

Temperature case: T in prediction
For a period of 2 hours and a half of time and a sample time of 5 seconds, 2200 Data were collected and performed to validate the ANFIS strategy for the case of temperature prediction, As it is seen, Figure 6 shows the training/ testing processes for the internal temperature data in response to the effects of the other climatic parameters and both actuators' actions, while Figure 7 validates the accuracy of the strategy. We can notice that the predicted internal temperature matchs the observed or real one. It is remarkable   Figure 8 shows the evolution of the error (RMSE) of the training process, herein the error decreases from 0.3888 to take 0.3872.

Relative humidity case: Rh in prediction
For the same period of time, 2200 Data were collected for the humidity prediction case, As depicted in Figure 9, the training/ testing processes for the internal relative humidity data is similar to the temperature one in response to the same actuators and climatic variations for the other parameters, hence this time, the accuracy for the humidity prediction decreases compared to the temperature case as it is clearely seen from Figure 10, despite this, we can remark that the predicted internal relative humidity fits the observed one in an acceptable manner. In addition to that, Figure 11 shows the evolution of the error (RMSE) regarding the training process, we notice that the error decreases to be setlled to 0.6320. The ANFIS models' details and fitting metrics for both, internal temperature and internal relative humidity are presented respectively in Table 2, Table 3 and Table 4.  Figure 11. Anfis model RMSE for humidity case during training

Conclusion
In this paper, we have developed two ANFIS models in a way to predict the comportement of the major climate parameters under greenhouses, which are the internal temperature and the internal relative humidity. The statistical metrics of the proposed method showed satisfactory results, temperature case prediction had the highest accuracy with 0.3880 RMSE and 0.9298 R², while the prediction of relative humidity performances was described to be less satisfactory than the temperature case with 0.6336 RMSE and 0.8862 R². One can conclude that overall, the results performed in the present paper demonstrate the advantage of using Anfis based prediction strategy for greenhouse climate prediction and/or for climate control purposes.