# Optimizing Crop Yield and Reducing Energy Consumption in Greenhouse Control Using PSO-MPC Algorithm
## 3 Methodology
### Greenhouse Climatic Model  
The greenhouse climatic model that we adopted in this work is presented in [19], which was constructed on the basis of the assumptions presented in [19]. These assumptions include: (1) the absence of spatial differences in temperature, vapour pressure, and CO\({}_{2}\) concentration, and (2) dividing the greenhouse air into two compartments (below and above the thermal screen) to describe the effect of the thermal screen on the indoor climate. The model includes the following elements: the design elements depicted in Figure 2, a lumped cover description that combines the impact of different cover layers on the indoor climate, state variables for internal and external cover temperatures to describe the impact of cover insulation on indoor climate, a description of the far infrared radiation (FIR) transmission through the cover, which is necessary for films that partially transmit FIR, a description of both roof and side ventilation, a description of the impact of insect screens on ventilation rate, and a description of the near infrared radiation (NIR) absorption of both canopy and floor, which depends on the optical properties of the cover and floor.  
In this work, the state variables of the indoor greenhouse climate, such as temperature, CO\({}_{2}\) concentration, and vapor, are represented in the model. These state variables are critical for understanding and controlling the growing environment within the greenhouse. The dynamics of these state variables over time are expressed as differential equations (1) that take into account the relationships between different factors. These differential equations represent the rate of change of each state variable as a function of time, as shown in Figure 2. For example, the dynamics of temperature in the model are defined by a differential equation that takes into account factors such as the rate of heat exchange between the greenhouse and the outside environment, the rate of heat exchange between the greenhouse and the plants, and the rate of heat generation within the greenhouse due to lighting and other sources.  
Figure 1: Overview of the proposed methodology for greenhouse control.  
\[cap_{Air}\dot{T}_{Air}=H_{CanAir}+H_{MechAir}+H_{PipeAir}+H_{PasAir}+H_{BlowAir}+R_{Glob _{5}UnAir}\] \[-H_{AirFlr}-H_{AirOut}-H_{AirTop}-H_{AirOutpad}-L_{AirFog}\] \[cap_{VP_{Air}}VP_{Air}=MV_{CanAir}+MV_{PadAir}+MV_{FogAir}+MV_{BlowAir}-MV_{ AirTISre}-MV_{AirTop} \tag{1}\] \[-MV_{AirOut}-MV_{AirOutpad}-MV_{AirMech}\] \[cap_{CO_{2 Air}}\dot{C}\dot{O}_{2 Air}=MC_{BlowAir}+MC_{ExtAir}+MC_{PadAir}- MC_{AirCan}-MC_{AirTop}-MC_{AirOut}\]  
where \(T_{Air}\), \(VP_{Air}\) and \(CO_{2 Air}\) represent the greenhouse indoor air temperature, vapor pressure, and \(CO_{2}\) concentration. \(H\) represents the sensible heat flux density, \(MC\) represents the mass \(CO_{2}\)-flux density, and \(MV\) represents the mass vapour flux density; the definitions of every term are given in [19].  
By solving the differential equations that govern the dynamics of the greenhouse environment taking into account both outdoor meteorological conditions and controllable factors, it is possible to estimate the state variables of the greenhouse environment, such as temperature, \(CO_{2}\) concentration, and vapor pressure, which are important parameters for the crop growth. Moreover, these estimates can then be used to inform control strategies, allowing for the grower to maintain optimal growing conditions for the plants and maximize crop yield.