# Optimizing Crop Yield and Reducing Energy Consumption in Greenhouse Control Using PSO-MPC Algorithm
## 4 Experimental Studies  
Our proposed algorithm was evaluated on the basis of the configuration of a real greenhouse (as described in [19]) and using actual weather conditions around the location of the greenhouse (as described in [24]). The weather conditions included outdoor global irradiation, outdoor air temperature, outdoor vapor concentration, outdoor CO\({}_{2}\) concentration, and outdoor wind speed for 10 days. Using this information along with greenhouse specification details, we applied the greenhouse climatic model as mentioned in Section 2 to simulate the indoor climate. The results of the comparison between indoor and outdoor climatic factors (such as temperature, vapor pressure, relative humidity, and CO\({}_{2}\) concentration) are presented in Figure 2. Additionally, we used the obtained indoor climatic factors to simulate the crop yield using a biophysical model. The simulation included different parameters related to crop growth, such as organ dry weight and leaf area index, which are presented in Figure 3.  
Figure 3: Parameters related to crop growth obtained through the crop yield model.  
For implementing the PSO algorithm to optimize the MPC objective function as in (3), we used the MATLAB optimizer toolbox [25] with a population size of 10 and 5 generations. Parameter \(\gamma\) in (3) was set to 8. The parameters of the biophysical model and greenhouse climate model were the same as those used in [19; 20]. The PSO algorithm was applied to find the optimal greenhouse controllable parameters, including heating from the boiler, heating to grow pipes, lighting from top/interlights, and ventilation from the roof. All values were within the range of [0,1]. An example of the objective function value variations with respect to the iteration number of PSO is shown in Figure 4. As the iteration number increases, the objective function value decreases, indicating that better solutions of controllable parameters are obtained, minimizing the objective function.  
We tested our PSO-MPC algorithm for greenhouse control over different time intervals of 21, 41, and 61 h. To compare its effectiveness, we implemented the rule-based control algorithm proposed by [22] using the same greenhouse climatic and biophysical models. We calculated the yield, energy cost, and energy efficiency (defined as the ratio of energy cost to yield) for both control algorithms. The comparison results are presented in Tables 1-3. Our analysis reveals that the PSO-MPC algorithm consistently outperformed the rule-based approach in terms of energy efficiency, indicating that less energy was consumed to achieve the same yield. These results demonstrate that the PSO-MPC control approach offers superior energy savings compared to the rule-based method.  
In our study, we compared the performance of two different optimization algorithms, PSO and GA, for objective function optimization within an MPC framework. PSO is a heuristic optimization method inspired by the behavior of social swarms, while GA is a genetic algorithm based on natural selection and evolution principles. To ensure a fair comparison, we used the same population size and generation for both algorithms. Additionally, we performed multiple trials and conducted a statistical analysis.  
Table 4 presents the mean and standard deviation of crop yield and consumed energy obtained by each algorithm. It is evident that, under the same population size and generation settings, the GA failed to effectively solve the MPC, leading to a decrease in crop yield (indicated by the negative growth). In contrast, the PSO algorithm was successful in finding the optimal solution for the MPC framework, leading to high positive growth. These results demonstrate that the PSO algorithm was more effective than the GA in optimizing the objective function within the MPC framework.  
Figure 4: Objective function values with respect to PSO iterations.