Tracking Control Method for Greenhouse Environment Prediction Model Based on Real-Time Optimization Error Constraints

: Model predictive control, without strict constraints on the control model, effectively overcomes problems, such as poor system dynamic quality caused by time delay, can improve control accuracy to a certain extent, and can directly process input and output constraints of the system online. It is applied in greenhouse system control. The appropriate objective optimization function and its corresponding constraint conditions have a direct impact on the solution of the optimal control rate of the model predictive control. In response to this issue, this paper proposes a simple and fast optimal predictive tracking control method. Based on the current prediction model of the greenhouse system, which reﬂects the dynamic relationship between various control equipment actions and greenhouse environmental factors, a multi degree of freedom discrete time state space model with tracking errors is established. Based on this model, in establishing the corresponding objective optimization function, the gradient descent theory and the two-norm deﬁnition are applied, and combined with actual constraints, iterative constraint conditions for real-time error tracking updates are established. Compared with traditional constraint ranges, a constraint function with real-time update characteristics is formed, achieving more accurate constraint conditions. By using rolling optimization and iterative methods, the optimal control rate corresponding to the minimum value of the objective optimization function within a ﬁnite time is solved. Through simulation examples, it is demonstrated that the model predictive control with optimization constraints can achieve a more accurate prediction and tracking control of indoor environmental parameters. This method has the advantages of simple control, energy-saving optimization, stable control, and accurate tracking, providing a reference for online real-time prediction and tracking control of future greenhouse environmental parameters.


Introduction
Greenhouses, as an important component of facility agriculture, occupy an important position in the process of agricultural modernization.The greenhouse system is a complex large-scale system that is not only affected by outdoor climate disturbances, but also related to the status and ability of indoor control equipment.Greenhouse environmental control equipment includes skylights, sunshades, wet curtains, fans, fill lights, hot air stoves, etc. [1].Greenhouse environmental factors include solar radiation, temperature, humidity, CO 2 concentration, and ventilation, among which temperature and humidity are the dominant factors of greenhouse microclimate.Therefore, solar greenhouses use the most control equipment and have the most complex control situations.For the field of greenhouse environmental control systems, effective predictive models and efficient Appl.Sci.2023, 13, 7151 2 of 22 control methods are very important and urgent.Many scholars at home and abroad have proposed many greenhouse control methods and conducted extensive research in the field of greenhouse environment [2][3][4][5].Because a greenhouse is a time-varying system with significant fluctuations in dynamic characteristics, traditional PID controllers have fixed parameters and weak control functions, making it difficult for the control results to meet practical needs.Scholars have proposed a series of control optimization algorithms for this [6][7][8].Fuzzy control is suitable for complex controlled objects that are difficult to establish accurate models.Due to the limitations of fuzzy control itself, fuzzy control can regulate multiple target environmental factors under multiple devices, but it leads to a decrease in control accuracy and dynamic performance.Increasing the complexity of fuzzy rules can improve accuracy, but the formulation of fuzzy rules relies more on the experience of expert management [9,10].Because the greenhouse environment is nonlinear and it is difficult to establish an accurate mathematical model, a system identification can be completed through the strong fitting ability of the neural network itself.Many literatures have applied neural network controls to greenhouse controls and achieved good control results [11][12][13].Because of the influence of biological processes, such as photosynthesis and transpiration, of indoor crops on production process.Therefore, many scholars have proposed the use of hierarchical control in greenhouse production processes [14,15].However, by introducing plant growth into the control process, the control cycle becomes longer and the algorithm complexity increases, resulting in more complex greenhouse operations.Therefore, hierarchical control is difficult to promote in ordinary greenhouse management.The greenhouse environmental factors are continuously changing, while the control quantities controlled by equipment are discrete.The greenhouse environmental control system can often be seen as a typical hybrid system.At present, hybrid system control methods for greenhouse microclimate environment control includes switching the system control, hybrid automaton control, and hybrid logic dynamic control [16,17].Model predictive control is a type of computer control algorithm that has emerged in the field of industrial process control.Predictive control is based on a predictive model, using a rolling optimization method to calculate the state input and output predictions of the model.At the same time, feedback correction is applied to the model to overcome the influence of controlled object modeling errors and uncertain factors, such as structure, parameters, and environment.Finally, based on a certain objective function, the optimal control input sequence in the control time domain is determined [18].Predictive control is widely used in various complex industrial process controls due to its advantages, such as the diversity of predictive models, the time-varying nature of rolling optimization, and the robustness of online correction.In greenhouse environmental controls, the use of predictive control can not only calculate the current equipment control status and the current environmental factors inside the greenhouse, but also predict the future state of greenhouse environmental factors, thereby determining the current control amount according to requirements, enabling the system to act in advance, effectively overcoming problems, such as poor dynamic quality caused by time delay, and improving control accuracy to a certain extent; additionally, it can directly process the input and output constraints of the system online [19].Many literatures have applied model predictive control methods to greenhouse environmental control research.Reference [1] proposed a method of using pseudo mechanism models to establish predictive models for greenhouses in four states, introducing energy consumption indicators to achieve a multi-objective predictive switching control of greenhouses.However, the modeling process is relatively complex.Reference [20] determined the unknown parameters of the greenhouse mechanism model through genetic algorithm, established an accurate temperature prediction model, and established energy and water consumption objective functions.But the modeling process is relatively complex.Reference [21] established an indoor temperature ARX model under different air outlet openings and established an objective function with temperature control error and skylight opening as constraints.The designed controller can effectively control the indoor temperature.Reference [22] proposed a global variable prediction model method for greenhouse large-coupling systems, with the economic benefits, management costs, and control errors of crops as objective functions.Through reasonable allocation, their respective weight ratios are determined.Reference [23] used the second-order Volterra series to simulate the greenhouse temperature system and designed a controller for the mechanical ventilation state of the greenhouse in the summer.Reference [24] introduces the model predictive control in the cooling and heating controls of greenhouses, establishing control accuracy and energy consumption as constraints to achieve optimal control of greenhouses.Model predictive control has no strict constraints on the control model-whether it is a state formula, neural network, or transfer functionas long as the model has a predictive function determine the current control amount by analyzing the historical operating status information, current operating status information, and predicted future operating status information of the equipment [25].Therefore, the solution of the optimal control rate for the model predictive control is crucial for establishing a suitable objective optimization function and establishing a reasonable constraint range [26,27].This paper proposes a new method for greenhouse model predictive controls, which adds tracking error state formulas to form a multi degree of freedom discrete time state space model.Based on the establishment of a suitable objective optimization function, the gradient descent theory is used to introduce the gradient of tracking error into the constraint conditions during the quadratic objective solving process.By combining the gradient descent learning rate and the gradient descent quadratic norm, the upper and lower bounds of the constraint function are derived.According to the control requirements, real-time data collection is used to update the constraint function in real-time, achieving the solution of the minimum value of the performance index function and the optimal control rate within a limited time.We optimize the constraint range, set reasonable constraint conditions, obtain the optimal solution at the current moment, and obtain the optimal predictive tracking control strategy.We make predictions based on real-time data to meet different decision-making requirements in the greenhouse environment control process.
In order to improve the accuracy of predicting greenhouse environmental factors and achieve simple, efficient, energy-saving, and fast tracking control, in this paper, a real-time optimization constraint method based on the model predictive control is proposed to realize the optimal predictive tracking control of greenhouse; the contribution mainly lies in the following four aspects: (1) Establish a prediction control model with the corresponding increment of the state variable in the model as the new variable.
(2) The total performance index function is constructed and transformed into the form of solving the optimal value of the quadratic function.The error tracking performance index function is constructed, and the gradient of tracking error is introduced into the error tracking constraint conditions by using the gradient descent theory.Combining the gradient descent learning rate and the gradient descent quadratic norm, the upper and lower bounds of the error tracking constraint function are derived.
(3) Using the rolling optimization and iterative method, the minimum value of the total performance index function and the corresponding optimal control rate are solved in a finite time.
(4) According to control requirements, real-time updates of error tracking constraint functions for predictive tracking control to meet different decision-making requirements in the greenhouse environment control process predict the output value of each future sampling time based on the value of the optimal control rate.The simulation results demonstrated the effectiveness and rationality of the control strategy, which can make corresponding adjustments in advance to the upcoming changes in the greenhouse environment and achieve energy-saving and efficient predictive tracking control.
The first part briefly introduces various predictive control methods and analyzes the advantages and disadvantages of these predictive control methods based on the characteristics of greenhouse environments.The analysis shows that the model predictive control has the characteristics of not requiring high model accuracy, but also realizing high quality control.In the second part, as greenhouse temperatures and humidity are important environmental factors for plant growth, a multi degree of freedom incremental model, including tracking error, was established using a general greenhouse temperature and humidity control model as an example.According to the actual environmental conditions, the optimization performance index function was established, which was transformed into the form of solving the optimal value of the quadratic form function.The upper and lower limits of the constraint function are derived by combining the gradient descent learning rate and vector two-norm, and the constraint conditions of the real-time tracking errors are established to realize the optimal tracking control strategy.In the third part, through the simulation of an example model and the comparison with the results of the traditional model predictive control, the effectiveness and practicability of this method are obtained.The fourth part discusses the advantages and disadvantages of this method compared to traditional predictive control.The fifth part is the summary section.

Model Predictive Control Methods
The method proposed in this article is to know the state space model, the current target error value and state increment value, and use the gradient descent theory to optimize the existing tracking error in real-time.It is then substituted into the established performance index function, and the predictive control method is used to solve the optimal predictive tracking control rate at future times.It is possible to predict future state values.Compared to the predictive control method mentioned earlier, it simplifies many steps and omits many influencing factors.
The overview of the proposed method was organized as follow: (1) based on the current discrete time state space model of the greenhouse environmental system, the state variables are transformed into their corresponding increments, and a tracking error discrete state space model is established to form a multi degree of freedom discrete time state space model.(2) The performance index function with the tracking error and control variable increment as variables is established, and it is transformed into the form of optimal value of quadratic form function. (3) Using the gradient descent theory, the gradient of the tracking error is introduced into the conventional constraints, and the upper and lower bounds of the constraints are determined by combining the learning rate of the gradient descent and the vector two-norm.We substituted the real-time data at the current time into the upper and lower bounds of the constraint conditions.(4) By iteratively updating the upper and lower bounds of the constraint conditions, the rolling optimization of predictive control is used to solve the optimal value of the quadratic form function, and the optimal tracking control rate at the future time is continuously obtained.

Greenhouse Environment Predictive Control Model
Temperature and humidity are important indicators to measure the greenhouse environment.The biggest obstacle for most greenhouse plants to develop diseases is caused by temperature and humidity being out of control.In order to promote the healthy growth of various vegetables in the greenhouse, establishing temperature and humidity prediction models is crucial for temperature and humidity regulation.The predictive control model for greenhouse temperature and humidity is as follows: Let e(k) and r(k) change according to the following Formulas ( 4) and ( 5): When  4) and ( 5),

Optimization Problem and Establishment of Performance INDEX Function
According to Equation (3), we establish the expression of its performance index function: According to Formulas ( 5) and ( 6), When C = I, according to Formulas ( 6) and ( 8), According to Formula ( 9), We substitute (10) into (7) and get the performance index function in finite time: The model predictive control is based on the dynamic model of the process, most of which are linear empirical models obtained through system identification.The characteristics of the model predictive control is to optimize the current time block every time, and then optimize the next time block.Therefore, the problem in ( 12) can be transformed into a finite time, and the optimization problem can be further transformed into an intuitive quadratic objective function to solve the minimum value of the performance index function in a fixed time period, as shown in Formula (13): According to the constrained conditions of (13), However, it is difficult to find the optimal solution, because it only sets a basic fixed value for the upper limit e(k) ≤ c and there is no real-time update constraint.Therefore, it is necessary to find a real-time constraint for e(k) -that is,

Establishment of Upper and Lower Bounds of Error Constraint Function Based on Gradient Descent Method
In the process of solving the quadratic objective, how to set reasonable constraints is very important for solving the predictive optimal tracking control.The main problem that may arise in constrained optimization is that propositions may not be feasible.In this case, the standard QP solver has to stop the calculation, and they can only output one information, such as if the proposition is not feasible, or may give some diagnostic information in some cases.It is obviously unacceptable to apply the suspended calculation results to the device.Therefore, when QP is used for predictive control, it is very important to try to avoid an infeasible problem or to provide an alternative method for calculating the control effect.These methods include: avoiding hard constraints on output; effectively managing the constraints defined at every moment; effectively managing the prediction time domain at each time; and using a non-standard solution algorithm.In fact, the set of active constraints changes in the process of optimization.Optimization constraints are very important for solving predictive optimal tracking control.

Gradient Establishment Based on Error Constraint
In order to ensure that the output tracking error decreases with time, gradient descent is introduced into the constraint function, and we make the error function in the constraint condition change along the gradient descent direction.As a constraint condition, it is necessary to find the constraint range of the error function so that the system output tracking error can be reduced quickly, the convergence speed can be accelerated, and the set value can be tracked as soon as possible.In order to ensure that the tracking error value of the system decreases as quickly as possible until it reaches zero, we establish constraint conditions, and the tracking error function value changes along the gradient descent direction as follows: It is necessary to determine the values of m and n.We set the error tracking performance index function as: 16) According to (19) and ( 8), we will get,

The Basis for Choosing the Learning Rate of Gradient Descent Method
Because the learning rate in the gradient descent is too large or too small, it has a direct impact on tracking error reduction.If it is too large, the optimal value cannot be found; and if it is too small, it will directly affect the speed of searching for the optimal value, reducing the convergence speed.Therefore, it is particularly important to find a suitable learning rate and its basis for the application effect of the gradient descent method.From the above derivation, the initial value and constraint range of the gradient descent learning rate are obtained.The gradient descent learning rate determination is as follows: When e(k) is the initial value of error and α 1 is the corresponding gradient learning rate at the current moment, on the basis of the gradient descent convergence characteristics, according to (24), ) The error decreases with the gradient, and the initial value satisfies Because of 0 (1 Because of The value range of n 1 depends on the control input constraints and convergence rate.Similarly, According to Formula ( 22), the situation of n n is the same as that of n 1 : The constraint condition of Formula ( 13) is converted to Formula (41),

Simulation Result and Analysis
In order to better achieve tracking control under different set values, based on different decision-making requirements in practice, the control rate of the model predictive control is solved using a different set of ranges of constraint function boundaries to achieve the optimal tracking control.The basic principle of the model predictive control is to predict the future dynamic behavior of the system under a certain control action based on the process model, and on this basis, according to the given constraints and performance requirements, solve the optimal control action and implement the current control in a rolling manner.Then, in each rolling process, real-time information is detected to correct the prediction of the future dynamic behavior of the system.In order to verify the effectiveness of the proposed method, a simulation verification was conducted on the discrete state space model of multivariate control of greenhouse environmental factors proposed in reference [28].The model structure is shown in Formula (3).Based on the model predictive control rolling optimization, combined with the gradient descent theory and the gradual reduction of error tracking quadratic norm, the corresponding learning rate that meets the conditions is derived from the above analysis, and the real-time constraint function is obtained, as shown in Formula (41).We use the predictive control model rolling optimization solution method to solve Formula ( 13).The optimal control rate is obtained by optimizing Formula ( 13), and the parameters of Formula (3) are selected as follows: Forecast length and control length are set to N = 4, with the initial condition In order to verify the effectiveness of this method, simulations were conducted under different output error constraint conditions, and four different scenarios were compared through simulation.The four situations are: (a1) m e(k) ≤ e(k + 1) ≤ n e(k) ; (a2) m e(k) ≤ e(k + 1) < e(k) ; (a3) e(k + 1) < e(k) ; (a4) p e(k) ≤ e(k + 1) ≤ q e(k) , 0 < p < q < m < 1 (a1) is the constraint condition for obtaining suitable optimized parameters under the method proposed in this article; (a2) is a constraint condition that only optimizes some parameters to obtain a lower bound; (a3) is a constraint condition that satisfies the basic conditions; (a4) is a constraint condition that is not within the appropriate parameter range after optimization.Based on the known parameters and their initial values, we obtain 0 < α < 0.221 from Formula (38).According to the control input constraints, ∆u(k) < a, the required range here is a = 10.According to Formulas ( 14), (15), and ( 35)-(40), we determine the upper and lower bounds of e(k + N) .We select m = 0.78 and n = 0.968 as appropriate parameters through simulation debugging.We complete the constraints on the upper and lower bounds corresponding to e(k + N) .In all of the simulation diagrams below, the horizontal axis represents the discrete sampling time, while the vertical axis represents the variation values of various variables themselves.The simulation results are shown in Figure 1a-d      Only the lower bound of e(k + N) is determined, but the specific upper bound value is not determined.The constraint range of e(k + is obtained, that is, 0.78 e(k + N − 1) ≤ e(k + N) < e(k + N − 1) .The simulation results are shown in Figure 2a-d.
In the process of the gradual zero error, the normal constraint conditions shall at least ensure that e(k + N) < e(k + N − 1) ; the simulation results are shown in Figure 3a-d.
If the constraint range is set outside of the allowable range, 0.62 e(k + N − 1) ≤ e(k + N) ≤ 0.76 e(k + N − 1) , although the range is set smaller, the loss is large and exceeds the control input range.The simulation results are shown in Figure 4a-d.In the process of the gradual zero error, the normal constraint conditions shall at le ensure that +  + − ; the simulation results are shown in Figure   If the constraint range is set outside of the allowable range,   If the constraint range is set outside of the allowable ran   (2) The simulation tracking predictive control results after the optimization of constraint conditions in case of parameter disturbance.
To verify the applicability of the proposed method, a model with parameter pert bations was simulated, as shown in Formula (42), and the simulation results are shown Figure 5a-d.The discrete state space model with perturbation is shown in Formula ( 4( ) (2) The simulation tracking predictive control results after the optimization of the constraint conditions in case of parameter disturbance.
To verify the applicability of the proposed method, a model with parameter perturbations was simulated, as shown in Formula (42), and the simulation results are shown in Figure 5a-d.The discrete state space model with perturbation is shown in Formula (42).
From Figure 5, it can be seen that compared with the model without parameter perturbations, the error tracking and prediction results have not changed.According to the simulation results, the proposed method made the increment of state variables and tracking errors converge rapidly, and the total control input amount did not change much compared with the constraint condition parameters in the case where the boundary of e(k + N) was not determined.
In order to demonstrate the effectiveness of the proposed method and compare it with different situations where the boundary was not analyzed and calculated, the simulation results are shown in other figures.From the simulation results of the above five scenarios, it can be seen that in the first scenario, the specific numerical constraints were clarified, the state incremented, the tracking error quickly converged, the output quickly reached the expected goal, and the control input increment was within the allowable range.The second and third cases indicated that there was no specific numerical constraint range, but only a separate upper or lower bound was determined.The state increment and tracking error could not converge quickly, the output could not achieve the expected goal quickly, and the control input increment was within the allowable range.The fourth case indicated that the constraint conditions were not within a specific numerical range.Although the state increment, tracking error, and output converge quickly, achieving the expected goal faster than the first case, the control input increment was not within the allowable range, and the control loss increased.The fifth case indicated that for the method with disturbance parameters, the specific numerical constraints were specified, the state incremented, tracking error quickly converged, the output quickly reached the expected goal, and the control input increment was within the allowable range, which was basically the same as the first case.Based on the simulation results of the above five scenarios, it can be seen that the method determined the upper and lower bounds of the constraint conditions, as shown in Figure 1.Compared with other scenarios, only the upper or lower bounds of the constraint conditions were determined, as shown in Figures 2 and 3, and the upper and lower bounds of the constraint conditions were arbitrarily set, as shown in Figure 4.This indicates that the state variable increment, tracking error, control increment, and performance index function in Figure 1 were shown in Figure 6a-d, which can converge more quickly and output variables can be quickly tracked, and it can meet the requirements of the performance index functions and control inputs not exceeding the range.In order to illustrate the effectiveness of the proposed method and compare it with the solution of the traditional model predictive control, it can be seen from the simulation in Figure 7a-d that the solution of the traditional model predictive control, without adding optimization constraints, had an unstable convergence of state increment and tracking error, large fluctuation, slow rate of convergence, and the convergence did not reach the predetermined accuracy.(2) The simulation tracking predictive control results after the optimization of constraint conditions in case of parameter disturbance.
To verify the applicability of the proposed method, a model with parameter pert bations was simulated, as shown in Formula (42), and the simulation results are shown Figure 5a-d.The discrete state space model with perturbation is shown in Formula (42  From Figure 5, it can be seen that compared with the model without parameter perturbations, the error tracking and prediction results have not changed.According to the simulation results, the proposed method made the increment of state variables and tracking errors converge rapidly, and the total control input amount did not change much compared with the constraint condition parameters in the case where the boundary of + was not determined.range.In order to illustrate the effectiveness of the proposed method and compare it with the solution of the traditional model predictive control, it can be seen from the simulation in Figure 7a-d that the solution of the traditional model predictive control, without adding optimization constraints, had an unstable convergence of state increment and tracking error, large fluctuation, slow rate of convergence, and the convergence did not reach the predetermined accuracy.

Discussion
This article investigated the applicability and effectiveness of real-time optimization error constraints in greenhouse model predictive controls.Although the constraint conditions in the traditional model predictive control have clear constraint ranges, this method did not effectively manage the constraints defined at each moment, and the constraints were not updated in real-time.From the simulation results and analysis, it can be seen that the appropriate constraint range had a significant impact on the optimal value and convergence speed of each iteration of the model predictive control.The method proposed in this article was based on the determination of the current tracking error, current environmental parameter settings, and current greenhouse temperature and humidity changes.Based on the prediction model, the greenhouse was predicted and tracked, and the simulation effect was relatively ideal.
Compared with the traditional control algorithm, the advantage of this method was its predictive ability in general.The local optimal solution was obtained by establishing the objective optimization function and the corresponding constraints.From Figures 2-4, it can be seen that the model predictive control had advantages.However, adding some reasonable optimization constraints can make the model predictive control effect more ideal.From Figure 5, it can be seen that adding disturbances to the model is also applicable.From Figure 6, it can be seen that for the target loss, the convergence speed of this method is superior to other situations.The results showed that the proposed method can predict and track the environmental parameters of a greenhouse, improve the state increment, tracking error, control increment, and the target loss convergence speed of the model predictive control.There are still some shortcomings in this paper: 1. this article only verified the effectiveness of the proposed gradient descent combined with the two-norm method for optimizing constraint conditions.There was no discussion or comparison of optimizing results using different methods.2. Although the simulation used a prediction model established based on actual data and had good predictive performance in practice, the simulation did not use experimental data.

Conclusions
In order to improve convergence speed, reduce prediction tracking error, quickly reach the set value, achieve stable control, and solve the optimal prediction tracking control strategy, the characteristics of this method was that as long as the discrete state space model of the current greenhouse environmental system, the target setting values, the incremental values of the current state variables, and the tracking error values were known, the tracking environmental factors can be predicted.The method was simple, fast, efficient, economical, and suitable for short-term predictive tracking control.This method was not only applicable to predictive tracking control of greenhouse environment systems, but also provided a reference basis for the predictive tracking control of other systems.
(a) Incremental change of state (b) Variation of error variable (c) Output variable change
(d) Control incremental changes
(a) Incremental change of state (b) Variation of error variable (c) Output variable change
although the range is set smaller, the loss is large and exceeds the control input range.The simulation results are shown in Figure4a-d.

Figure 3 .
Figure 3.The simulation results of the predictive tracking with the constraint range e(k + N) < e(k + N − 1) .
although the range is set smal the loss is large and exceeds the control input range.The simulation results are shown Figure 4a-d.(a) Incremental change of state (b) Variation of error variable
a) Incremental change of state

Figure 5 .
Figure 5.The simulation results of the error tracking predictive control with the parameter perturbations and constraint range 0.78 e(k + N − 1) ≤ e(k + N) ≤ 0.968 e(k + N − 1) .
(a) Comparison of temperature increment changes (b) Comparison of humidity increment changes (c) Comparison of temperature error tracking changes (d) Comparison of humidity error tracking changes

Figure 7 .
Figure 7.The comparison of the output results between the traditional model predictive control and the model predictive control with optimization constraints.