A Takagi-Sugeno Fuzzy Model for Greenhouse Climate

-This paper investigates the identification and modeling of a greenhouse's climate using real climate data from a greenhouse installed in the LAPER laboratory in Tunisia. The objective of this paper is to propose a solution to the problem of nonlinear time-variant inputs and outputs of greenhouse internal climate. Combining fuzzy logic technique with Least Mean Squares (LMS), a robust greenhouse climate model for internal temperature prediction is proposed. The simulation results demonstrate the effectiveness of the identification approach and the power of the implemented Takagi-Sugeno Fuzzy model-based algorithm.

INTRODUCTION Greenhouse cultivation is a way to protect plants from bad meteorological conditions and to take advantage of the internal climate to guarantee the high quality and the low cost of production. Optimal management of the greenhouse climate is the most appropriate way to meet the needs of industrial agricultural production. This management is essentially based on the efficient use of solar energy, air heating, ventilation, and cooling. For these reasons, greenhouse modeling is very difficult in terms of the non-linearity that describes the function between the outputs (internal humidity, internal temperature) and the inputs (external temperature, external humidity, solar radiation, wind speed, etc.) [1]. In order to develop a control technique, a good model of the greenhouse is needed for simulation and for real time control. Various methods have been proposed in the past for modeling a greenhouse. In the literature, there are two main categories of mathematical modeling techniques for real processes [2]: physical modeling and system identification. The first is based on the physical laws involved in the process and the second on the analysis of the input-output data of the model. In [3][4][5][6], the dynamic temperature model is based on the energy balance. The physical model of a greenhouse by researching thermal radiation and ventilation was developed in [7]. The modeling of the system was described from the process of mass-energy exchange in [8]. Authors in [9] studied the heat exchange by internal convection, plant transpiration, and natural ventilation to establish a greenhouse model. Authors in [10] analyzed the auto-regressive models with external data based on the GDGCM model. In [11], the modeling of the internal temperature of the greenhouse was based on a hybrid system. Identification based on Takagi-Sugeno (TS) fuzzy model was used in [12]. In [13], clustering was utilized to acquire the main modeling greenhouse parameters. In [14], hierarchical strategy was used to minimize the number of fuzzy rules in the modeling of the system. Fuzzy modeling based on neural network learning techniques was developed in [15,16]. To obtain the consequence of the rules, we can see the use of least squares for the modeling in [17,18]. In [19], calculus of variations and nonlinear optimization-based algorithm for optimal control of hybrid systems with controlled switching were utilized. In this paper, principal focus is given on the modeling phase. The paper is dedicated to the modeling of a class of nonlinear dynamic processes by merging local linear models. These local linear models are the fuzzy models of TS type [20]. The output of these fuzzy systems is obtained by simple interpolation of locally approved linear models. This approach allows a linguistic interpretation of the fuzzy rules. On the other hand, classical methods of linear control can be applied to local fuzzy models [21,22]. The information system from fuzzy models can be used by a great variety of command methodologies. Thus, the performance of control depends heavily on the accuracy of the model used. Therefore, a large part of the design effort must be dedicated to modeling. So, our objective is to have the simulation results of a Fuzzy Inference System (FIS) that seeks to generate a linguistic model optimized by back-propagation and the least mean squares algorithm for predicting the climate of the greenhouse.

A. Description of the Experimental Greenhouse
The actual greenhouse is located at the Laboratory of Application for Energy Efficiency and Renewable Energies (LAPER). The external structure of the greenhouse is oriented east-west and has the form of a chapel, as illustrated in Figure  1. The geometric characteristics of the greenhouse are: length = 150cm, width = 100cm, height = 115cm.

B. Description of the Measuring Equipment
The database is obtained using the following equipment: • The air temperature is measured by an LM35 sensor, with an accuracy of 0.4°C in the temperature range between -24°C and 48°C.
• The relative humidity is measured by a SY-230 sensor. These sensors have an accuracy of about 3% in the measurement range between 0 and 95%.
• A pyranometer type LPYRA03 was used to measure the global solar radiation level on a horizontal surface. Its accuracy is about 5%, its measuring range from 0 to 2000W/m 2 and its typical sensitivity about 10µV(W/m 2 ).

III. TAKAGI-SEGUNO FUZZY MODEL
A. Basic Structure Fuzzy logic can provide an interesting alternative to mathematical modeling for many physical processes that are too complicated to be described by precise and simple mathematical equations or formulas. There are several classes of fuzzy systems, the most commonly used are the Mamdani fuzzy systems [12] and the TS fuzzy systems. The particularity of these systems is that the consequence of each rule does not correspond to a fuzzy set but to a local model of the system to be estimated. The TS model is composed of if-then rules with fuzzy antecedents and mathematical functions in the consequent part [23]. The antecedents of fuzzy sets divide the input space into a number of fuzzy regions, while the consequent functions are used to describe the behavior of the system in these regions [24]. For an i th rule, a TS fuzzy system has the following form: where x(k) represents the state vector and M i represents the vector of the fuzzy set of the i th rule. The output of the TS model corresponds to every rule. Therefore, it is necessary to attribute a weight to describe the similarity ratio of each rule to the actual behavior of the process: i w x k is the product of all the membership degrees of the i th rule, which shows the weight of this rule in the whole model. Therefore, the output can be defined by the weighted average of all rules: Thus, in the whole TS fuzzy system, the weighting of the element x(k ) is described in the form : So, the output of the TS model is: B. Fuzzy Clustering Fuzzy clustering consists on identifying natural groupings of data from a large data set to produce an accurate representation of a system's behavior. It is useful to divide a fuzzy data set into a certain number of groups by mapping membership probabilities to each object [25]. The membership of each data item to each group is illustrated by the membership matrix with size c×l for grouping the data set where u αβ corresponds to the membership degree of the β th (β=1,2,…l) element to the α th clustering. In the present matrix, there are several limitations: The objective function during the clustering is defined as: where ( ) 1 c V = v ,...,v represents a vector whose elements represent the center of each clustering, m is the weight factor with a usual value of 2. The Euclidean distance between the β th element and the center of the α th fuzzy clustering is defined by: where v α calculates the center of α th clustering while u αβ renews the membership degree of each element. In the clustering process, the iteration will be completed when the convergence condition is satisfied [26] or the iteration time is reached.

C. Parameter Estimation
Generally, it is recommended to start with a linear model and determine the structure of the system based on the available tools to use the best model possible as a starting point for the nonlinear modeling. This is possible with the TS models' ability to use the local linear models obtained by fuzzy identification and interpolate them with each other to optimize the nonlinear structure of the system and obtain optimal results. The most common way to identify the parameters is the Least Mean Squares (LMS) method. However, different rules play a different role in the TS fuzzy model. For this reason, the ordinary LMS method should be applied [12]. Firstly, the consequence must be rewritten in the following form: where x(k +1) is the output of this rule and x and u are the system inputs. Thus, the data can be described as follows: The parameters of an ordinary LMS identification are determined by the following equation: where θ i represents the consequent parameter vector and Q i represents the weight matrix that contains the weight of all the data:

RESULTS
The main objective of fuzzy identification is to improve the accuracy acquired by a nonlinear physical model. For this simulation, a database was recorded on October 5, 2020 at the LAPER laboratory to do the greenhouse fuzzy modeling. The sampling rate was fixed to 15s. From the obtained data we have fixed 2 membership functions for the inside temperature, the outside temperature, the humidity, and the solar radiation. The data of each input will be classified and indexed using the C-Mean Fuzzy algorithm and then they will be approximated by trapezoidal membership functions. The results obtained for each input are represented by Figures 2-5, designating the membership functions of the discrete fuzzy model as well as the groupings established by the C-Mean Fuzzy algorithm. For each input, we select a small number of clusters to minimize the number of rules in the TS fuzzy system. MATLAB environment, when the trapezoidal membership function is adopted. The architecture consists of 32 fuzzy rules.
In the preliminary experiments, the proposed architecture proved to be sufficiently capable of extracting the climate model of the greenhouse from the control actuators and meteorological data. Figure 6 presents the flow chart of the internal climate prediction by FIS.    T k +1 = a + a T k + a T k + a RH k +a RH k + a R k + a V k + a Q k (14) where T i is the internal temperature, T e is the external temperature, RH i is the internal humidity, RH e is the external humidity, R s is the solar radiation, V i is the internal air speed, and Q ch is the heat delivered by the thermal system.
Subsequently, the practical results show that the fuzzy identification system generated with the LMS method is more accurate than the dynamic modeling ( Figure 9) because a good convergence to the real data of the Figure 7 may be observed. Moreover, in Figure 8, we notice that the error is of the order of 1% proving the efficiency of the proposed system, since the classical dynamic modeling reaches an error value of 2%-4% ( Figure 10). In order to evaluate the result quantitatively, the VAF function [27] was adopted, to compare the difference degree between two signals. This function is given as follows: where y 1 represents the real data, y 2 represents the simulation result, and var is the variance.  [5], we notice that our fuzzy system is more accurate. A good agreement has been obtained between the calculated and the measured data, which indicates the efficiency of our proposed model in comparison with other methods.  Difference between the temperature inside the greenhouse and the output of the fuzzy model. Fig. 9.
Inside temperature of the greenhouse and the output of the dynamic model.

V. CONCLUSION
This paper proposes a greenhouse model method based on a TS fuzzy model using the Fuzzy C-means algorithm for clustering and the LMS method for adjusting the model. This method has the following advantages: it allows modifying the hierarchical structures by adding or removing a sub-model or rules at any time without the need to repeat the whole identification process and to use all the collected data. These sub-models have similar correspondences in the physical modeling, which represent the contributions of the process mechanisms involved in the global process. The comparison of the results obtained by the fuzzy model and the experimental results confirmed the efficiency and the accuracy of the proposed model in predicting the internal greenhouse climate.
In following work, we intend to integrate the developed model in an adaptive control system in order to obtain increased production and quality of horticultural products and to reduce energy consumption.