Constrained Discrete Model Predictive Control of a Greenhouse Relative Humidity

In this paper, we present a Constrained Discete Model Predictive Control (CDMPC) strategy application for relative humidity control. In this sense, and for our system inside humidity dynamics description, a green-house prototype is engaged and a state space form which fits properly a set of collected data of the greenhouse humidity dynamics is presented as mathematical model. This latest is used for the CDMPC starategy application, which purpose is to select the best control moves based on an optimization procedure regarding the constraints on the control. By the means of Matlab/ Simulink and Yalmip toolbox algorithms, numerical simulations were held to proove the effectiveness of the controller, garanteeing both the constraints feasibility and system stability.


INTRODUCTION
Agricultural greenhouses industry is nowadays considered as one of the most important and hightech structures of all agrifood industry. In fact seeking agricultural biodiversity, sustainable, highperforming and protectable yields, has led to a variety of advanced technologies adoption such as highly controlled and smart greenhouses.
The environmental parameter control indooor greenhouses has known a considerable attention in the last few years (Moufid and Bennis, 2019). The main reasons for this increasing interest are mainly related to different factors one can cite agronomic and financial ones.
In fact, various are the methods that have been treated regarding the control design of the climatic conditions of the greenhouses, hence several scientific reaserchers and teams have experienced this techniques to study and enhance greenhouses control outstanding, we can cite: neuronal networks control (Mohamed and Hameed, 2018;Taki et al., 2016) predictive control (Gandhi and Thakker, 2020). In addition to the fuzzy control (Xu et al., 2020;Guerbaoui et al., 2013), optimal control (Lijun et al., 2018) and many other strategies that have been discussed in many research articles.
In control theory application, Model Predictive Control (MPC) has been always considered as one of the most emerging control technique. Due to its advantages, this strategy has been used in various industrial and automation process control (Wang et al., 2017) , for instance the greenhouses climate control (Ding et al., 2018) and reference therein.
Moreover, (MPC) is engaged in a large variety of systems, the main reason of its utility is its simplicity of use which makes it appicable for single, multivariable, linear and nonlinear systems, and allows constraints notion incorporation when synthesising the control law Faiz and Benzaouia, 2019) and many others as well .
The problem treated in our framework, is related to control task of the relative humidity under greenhouse, hence model predictive control is choosen as a modern control strategy to overcome this problem The objectif of the control technique, is to calculate an objective funnction over a finite horizon, while satisfying the constraints on the control notion, using Yalmip optimization as a novel toolbox (Lofberg, 2004) together with Simulink, which allows a certain minimization regarding overheads and unwanted calculations.
The remainder of the prensent paper is structured as follows, In the second section the greenhouse model identification and a reminder of CDMPC purposes and controller strategy regarding the constraints notions, will be presented, in addition to the main control algorithm. The third section will be dedicated to simulation results and discussion related to the (CDMPC)design strategy and synthesis. In the last section, some conclusions will be provided.

The Greenhouse System Prototype Description
In order to give an insight of our system, Figure 1 presents the experimental greenhouse engaged as support in this work, which is a prototype installed at the Laboratory of Electronics, Automatics and Biotechnology (LEAB), Faculty of Sciences, Meknes, Morocco. This system's main construction is beeing a single wall polyethylene design, equipped with two LM35DZ temperature sensors that provide indoor and outdoor measurements of temperature and two HIH-40 00-003 Honeywell indoor and outdoor relative humidity sensors. In addition, a heating system and a fan are installed to insure the appropriate climate for the system' s inside climatical environement. For con- trol and data acquisition aims, the mentionned sensors and actuators are connected to a control and acquisition cards attached to a personal computer (Eddahhak et al., 2007). In the first place, an acquisition data card of the familly NI-PCI6024E from Advantech is installed to ensure the different actuator orders. Besides, two other cards are also installed and respectivelly dedicated to the signals conditionning and the sensors as well as the hole system protection. In a second place; the tasks of supervision of measured indoor and outdoor climate variables; are provided as a historical database using Labview, and the control task is managed under Matlab/Simulink software.

Mathematical Modelling
In this section, a mathematical model of indoor humidity has been presented. For this aim, the state space model that describes the greenhouse inside humidity dynamic response to the installed actuators; is revealed. The adopted model will enable us to modify the behavior of the plant in order to suit our needs in term of reference signal tracking and control rendering.
For controller synthesis and behavior aims, a plant model has to be obtained. Hence the system model is estimated by the means of collected data from the experimental greenhouse where the N4sid algorithm is used to identify the plant in discrete time state space model.
For linear subspace identification and for simplicity, the class of systems to be considered is linear discrete-time systems with external disturbances of the form: Where x k , u k , y k , w k present respectivelly the state, input, output and the output measurement noises vectors, A, B, C, D, K denote respectivelly the state, input, output and estimated noise matrix.
As an advantage of the N4sid method, a prediction error based on a the Best Fit (BF) percentage related to the output reproduced by the model is provided, and the adopted formula used in this regard is presented as follows (Carrión et al., 2011): where y,ŷ and y are respectivelly the measured, the predicted model and the mean of the output y .

Relative Humidity Response to Actuators
In this section, we aim to use a set of collected data in order to have the linear models that will be engaged for mathematical identification.

Relative humidity Response to heater
Herein, we describe the evolution of indoor relative humidity by exciting the system with a step input of 2.5 Volts that was sent to the heater, till reaching a steady state. Using experimental data for 5 seconds as sampe time and the N4sid algorithm under Matlab, the evolution of the measured and simulated inside relative humidity and the discrete time state space model matrix are as follows. As is shown, the inside humidity reaches 51%, where the initial value is 71 to 74% . The model best fit is 94%, hence the simulated and experimental resulting outputs are closely matching each other, which is obviously seen from the fit accuracy. Regarding the N4sid algorithm and "(1)", the discrete linear time invariant system with 6 states is definedned as follows: The index 'h' refers to the heater as first actuator for the system state space identification.

Relative humidity Response to the fan
Similarly, we excite the system with a step input of 2.6 Volts that was sent to the fan, in order to visualise the indoor relative humidity evolution, we notice; for the same sample time, which is 5 seconds; that the humidity increases reaching by that a steady state. In this case, the evolution of the measured and simulated inside humidity is depicted in " Fig. 3" : As clearely shown, the indoor relative humidity attends to reach its 72.3%, where the initial value is 59%. The model best fit this time is 80.65 %. The identified discrete-time system model, with 5 states, was presented as follows: The index 'f' denotes the fan as input actuator used in the system state space identification.
The identified state space models, show that the system is stable, controllable and observable.

Brief Remainder of Constrainded (MPC) and Optimization Problem Principles
Model Predictive Control, is an iterative finite horizon control strategy, based on an optimization problem of a difinite plant model (Santana et al., 2020). Its main task is that it allows a cost function calculation to obtain the performances of the controller in the future based on the current real or estimated plant state x k and a serie of future inputs u k at each discrete sampling time (k). Due to their importance, the optimization task and the cost function are primordial in predictive control strategy, hence their contribution allows the calculation of the best series of control inputs u k , which results in a minimal cost to keep the reference good tracking. For the control purposes, having a cost that describes how our control strategy will be in the future is the most important task to take into consideration. Therefore, a function is adopted as follows (3): (3) Where x k and u k are the current state and control input, respectivelly. In order to get an optimal inputs sequence u * k , the cost function of u k has to be minimized, hence an optimal control problem is defined as follows: The integration of the cost function (4), is chosen to be quadratically dependent on the control input and the state or output. In this sense, an optimization proplem cost function of the form (5), is calculated.
Here N, Q and R represent respectively the prediction horizon and the positive-semi definite penality matrix. For more details about (LQR)and Quadratic programming Parameters choice, the reader can refer to (Outanoute et al., 2016) and included references.

(MPC) and the notion of Constraints
The real objective of a (CMPC) lies in computing optimal control actions for systems that includes the constraints notion (Hamidane et al., 2020). For clarification, the constraints regarding MPC cotroller, could be defined as a set of limits on the systems states and/or input-output variables, presented as follows: x ≤ x k ≤ x and u ≤ u k ≤ u In the presence of constraints, MPC control's logic and algorighm are unchangeable, however the optimization should suit the control strategy purposes, in such a way that the inputs are computed to be as optimal as possible to guarantee closed-loop stability notion. In this sense, the cost function of the optimization task (5) is reexpressed as follows: Figure 4: Conceptual model of the CDMPC strategy Where the suffix "min" and "max" are the lower and upper inputs constraints.

The Adopted Controller
The control strategy used in this framework is a (CDMPC) formulation for greenhouse humidity control, it is presented as a Quadratic Programming (QP) problem solved at each sample time. The general and conceptual presentaion of the control method is depicted in figure 4 In addition, the constraint on the control notion regarding the system dynamics is brought into the cost function for MPC formulations. This latest will penalize any deviation regarding the systems output which is the inside humidity; and the input as well trying to have the optimal control sequence. The constrained optimization problem used in this framework aims to obtain the control inputs u h and u f , i.e., heater and fan, while the cost function was selected to be quadratically dependent on the systems error e k = r − Cx k , where r is the reference value, and the control input u k , regaring the system dynamics and control constraints. For this aim, the cost function used, is expressed as: Here, MPC is implemented repeatedaly, firstly current states x k are presented, then, a sequence of future optimal control predicted actions is calculated where its first element is extracted and applied back to the plant, hence, for each system model presentation, a Matlab function script of the optimization problem algorithm and a simulation model under Simulink were engaged. Matlab2018b/ Yalmip (Lofberg, 2004) were used as basic for the algorithm and simulation developement. The CDMPC Algorithm using yalmip optimization toolbox for the humidity control, is summarized as follows: Algorithm 1 CDMPC for RHint control algorithm Inputs: Current reference, current state Output: The optimal control inputs u h or u f 1: Set the systems discrete state space model referring to 2.3 2: Define and initialize the QP penality matrices and the MPC prediction horizons for the heater and fan cases 3: Identify the reference, states and control as sdp variables 4: Initiaize the reference, the objective and constraints 5: for k = 1 : N h //N f 6: Solve the optimization problem (8) respecting the constraints along the prediction horizons N h or N f 7: endfor 8: Extract the first element of the optimal control and apply it back to the plant. 9: end

Simulation Results and discusions
In order to illustrate the (CDMPC) performances, some numerical simulations were carried out. For this purpose, we have engaged Model Predictive Control algorithm using YALMIP Toolbox in MAT-LAB/Simulink. Using above (QP) algorithm, an optimization script function was develloped and the QUADPROG was choosen as a solver in this case. For simulation purposes under Simulink an interpreted Matlab function block was used for the controller and the plant models representation. To remind, the control objective is to maintain the output y k of inside humidity RHint, as close as possible to the reference, without exceeding normalized boundries 50% ≤ RHint ≤ 75% , besides, the main reason for both identification and control partition, i.e., heater and fan cases of study, was based essentially on how our system works in real life, taking into account futur real time impplementations.
In order to evaluate the proposed control approach; for both scenarios, i.e., for the heater and the fan; the inputs are constrained to evolve between 0 ≤ u h ≤ 5 as voltage applied to the heater and 0 ≤ u f ≤ 4.5 as voltage applied to the fan. The penality weights were chosen scalars as follows Q h = 100 and R h = 0.1 for the first system and Q f = 100 and R f = 0.01 for the second one, the prediction horizons were set to N h = 40 and N f = 40. As a sample time, T s was set to 5 seconds. Figure 5 describes the evolution of External reletive humidity for 9 minutes, this evolution shows that the external humidity varies between a range 61% to 64%. In one hand, in Figure 6 and Figure7 and for the first case, the heater's behavior under constraints and the inside's relative humidity response to the heater input control, are presented. It is clearelly shown that the heater behaves normally in the presence of constraints, hence it attempts his maximum/ minimum voltage power without exceeding the upper and lower constraints limits. In Figure 7 the control task was achieved, here the Humidity decreases from 76% and tracks smoothly its set point point. In another hand, Figure 8 and Figure 9 show respectively, the fan as a second actuator's behavior, in addition to the control task in presence of constraints for the inside humidity control. It is remarquable that the fan control signal, tends to respect the input constraints and does not exceed 4.5 Volts. However, several stopping moments are observed, which contributes to power saving and actuator durability. Figure 9 presents the control mission, which is eventually noticed in the internal humidity setpoint tracking, respecting the desired humidity percentage limits. We can notice that the humidity increases from about 59% to attend the setpoint variation range which is 64% to 65%. It is worth noting that, the control method prooves a good performance in presence of the constraints on the control, despites some damping comportemnt regarding the control action behavior at the first few seconds. In general, one might resume that the control task in form of simulation results was succesfully granteed.
As main futur perspectives, the application and enhancement of the proposed control strategy and its real time implementation will be taken in charge, hoping that these initiatives can lead us to novel results.

Conclusion
In this paper, we have shown a Constrained Discrete Model Predictive Control (CDMPC) for discrete time linear SISO system applicaton for relative humidity control. Necessary and sufficient conditions for the synthesis of the elaborated controller that ensure the desired reference signal tracking and control of inside greenhouse humidity; respecting the constraints on the controlled inputs condition; have been treated using a (QP) optimization algorithm with numerical simulations by the means of new optomization toolbox as Yalmip.
We have shown that the presented control problem application is solved for the SISO greenhouse system as a case of study. For a futur task, one of our perspectives would be the application and the real time implementation of these approachs for Multi-Input Multi-Output (MIMO) systems and for other climatic parameters control as well.