# Modeling of Energy Demand in the Greenhouse Using PSO-GA Hybrid Algorithms

Authors: Jiaoliao Chen; Jiangwu Zhao; Fang Xu; Haigen Hu; QingLin Ai; Jiangxin Yang
Journal: Mathematical Problems in Engineering
 (2015)

---

## Abstract

Modeling of energy demand in agricultural greenhouse is very important to maintain optimum inside environment for plant growth and energy consumption decreasing. This paper deals with the identification parameters for physical model of energy demand in the greenhouse using hybrid particle swarm optimization and genetic algorithms technique (HPSO-GA). HPSO-GA is developed to estimate the indistinct internal parameters of greenhouse energy model, which is built based on thermal balance. Experiments were conducted to measure environment and energy parameters in a cooling greenhouse with surface water source heat pump system, which is located in mid-east China. System identification experiments identify model parameters using HPSO-GA such as inertias and heat transfer constants. The performance of HPSO-GA on the parameter estimation is better than GA and PSO. This algorithm can improve the classification accuracy while speeding up the convergence process and can avoid premature convergence. System identification results prove that HPSO-GA is reliable in solving parameter estimation problems for modeling the energy demand in the greenhouse.


---

## Body

## 1. Introduction

Greenhouses are used to grow crops for better quality and to protect them against natural environmental effects such as high or low temperature. The energy consumption is necessary to maintain a suitable temperature for crop production in the greenhouse. Modeling of energy demand in agricultural greenhouse is very important to maintain optimum inside environment and decrease energy consumption [1].Greenhouse is a complex system with nonlinear, random, and strong coupling uncertain features [2]. Mechanism modeling based on the physical processes uses unsteady heat and mass transfer to get the differential equations of greenhouse dynamic process [3–5]. But some physical parameters in the model are difficult to measure or changing with the crop growth and outside weather. Black-box modeling is obtained from input/output measurements of a dynamical system, without knowledge of its inner physical and chemical laws, and it has been widely applied for various items [6]. Neural networks, as the typical black-box, have been applied to model the greenhouse microclimate [7–9]. However, in the black-box model, it is impossible to train all possible data, which can result in overfitting.Systems identification is suitable in nonlinear systems for which a mathematical model is known and for which input/output data is available in the experiments but for which actual values of parameters in the model are unknown [10]. The evolutionary algorithms are model-based recognition methods and have been applied for uncertain optimization problems [11, 12]. Some researchers have applied global optimization methods for calibration parameters in greenhouse microclimate model, such as genetic algorithm (GA), ant colony optimization (ACO), and particle swarm optimization (PSO) [13–15]. Hasni et al. found that the performance of a greenhouse climate model using PSO is better than GA in terms of calculation time and accuracy of the results [16].Yet, PSO is easy to prematurely converge and lead to the undesired local solution. GA may require a large number of redundant iterations and result in long computing times and low problem-solving efficiency [17]. Algorithmic operators and parameters typically interact with one another nonlinearly; it is extremely hard to figure out the most optimal combinatorial strategy [18]. And the single algorithm defect makes it not suitable for the mutative greenhouse model [19]. HPSO-GA shows superiority compared with other single optimization methods, such as GA and PSO, and can overcome the disadvantages of particle swarm optimization and genetic algorithm [20].Therefore, this paper proposes a novel method for energy consumption prediction in the greenhouse based on the HPSO-GA. The parameters for physical model of energy demand are calibrated using HPSO-GA for the profound optimization performance in the nonlinear greenhouse system with surface water source heat pumps system.


## 2. Materials and Methods

### 2.1. Experiment Setup

A multispan glass greenhouse was employed in this experiment, and it was located in Jiangsu Province, China (longitude: 120°29′ east, latitude: 31°76′ north). This greenhouse is covered with a single layer of 4 mm thickness glass, 72 m length in the north-south direction, and 7.5 m height and consisted of 28 spans 4 m wide each. The outside air temperature, wind speed, and PAR were measured by a small weather station (GalCon, Eldarshany Co., Israel). The air temperatures at the height of 4 m from the ground of four positions inside were measured by sensors (HMT100, Vaisala Co., Finland). Inside air temperature was the average of 4 temperature sensors in the greenhouse. Surface water source heat pumps system was applied in the greenhouse. The energy consumption is measured by energy meter (HCM1158, Honeywell Co., Germany) according to the water flow rate and the difference of supply and return water temperatures. The data from the sensors were automatically recorded every 5 min by a data logger which we have developed. The experiment was carried out from June 2 to June 7, 2012.


### 2.2. Greenhouse Environment Model

Greenhouse environment model in the physical and physiological methods that take place inside greenhouses based on mass and energy balances, including the biological behavior of plants. Mathematical models of greenhouse microclimate are influenced by several elements of the greenhouse (heat flow and conduction, vapor diffusion, etc.) and the outside boundaries (solar radiation, air temperature, etc.), which is shown in Figure1. The thermal balance inside the greenhouse defines the rate of change of temperature, which can be transferred to calculate the energy supply requirements. Consider
(1)qst=ρaVCadTi(t)dt+ql(t)+qc(t)+qw(t)+qet+qpt-qtt,
where qs(t) is the energy supply over time in W, ρa is the air density in kgm−3, V is the volume of the greenhouse in m3, Ca is air specific heat in Jkg−1K−1, Ti(t) is air temperature inside the greenhouse over time in K, ql(t) is the energy flux due to the long wave thermal radiation over time in W, qc(t) is the heat flux through the cover over time in W, qw(t) is heat flux from ventilation and infiltration over time in W, qe(t) is the heat flux due to crop transpiration over time in W, qp(t) is the heat flux due to the convection between greenhouse air with soil and crop leaves over time in W, and qt(t) is the net solar radiation into greenhouse over time in W. Since the top windows and side windows are all closed when the cooling system is working, heat flux from ventilation qw can be ignored and t is time series variable.Figure 1
The thermal balance of greenhouse environment.The net solar radiation into greenhouseqt(t) can be described as follows according to radiation law:
(2)qtt=AsIatτa,
where As is the surface area of cover material in m2, Ia(t) is outdoor global radiation over time in Wm−2, and τa is cover material absorption coefficient.According to the nonlinear Stefan-Boltzmann law, the thermal long wave radiation exchange between interior and exterior can be written as follows:(3)ql(t)=ε12AsσTit4-Tskyt4,
where As is the area of covering in m2, σ is the Stefan-Boltzmann constant of 5.67 × 10−8 Wm−2K−4, Tsky(t) is sky temperature over time in K, and ε12 is the combined emissivity between the cover and sky, which is found from the individual emission coefficients ε1 and ε2:
(4)ε12=ε1-1+ε2-1-1-1.According to Aubinet [21], sky temperature related to temperature outside the greenhouse is expressed as follows:
(5)Tskyt=94+12.6ln⁡⁡eo-13k+0.341Tot,
where eo is actual air water vapor pressure outside in Pa, To(t) is temperature outside the greenhouse over time in K, and k is the sky clearness index, which is 2233 Pa and 39%, respectively, based on NASA Surface Meteorological and Solar Energy information [22].The greenhouse air exchanges energy and water vapor (condensation) with the inner surface of the cover and the cover exchanges energy with the outside air. The heat exchanged by conduction and convection between the cover and the air resulted from driving force for the exchange due to the temperature difference. The heat exchanged by internal thermal curtain and infiltration is also dependent on the inside and outside air temperature. Consider(6)qct=As·Kg·Kc·Tit-Tot,
where As is the area of greenhouse cover material in m2, Kg is the heat transfer coefficient in Wm−2K−1, and Kc is correct coefficient of internal thermal curtain and infiltration.The transport of energy from the leaf is in general defined in the same way as the heat transfer from other surfaces. The sensible heat fluxqe was expressed with respect to the temperature difference between inside air and canopy:
(7)qpt=AgρCpLAITvt-Titra.Latent heat flux due to crop transpiration in greenhouse can be described in terms of the crop canopy available energy and from the inside air saturation deficit, by means of the Penman-Monteith formula:(8)qet=Ag·λ·Et,(9)λE(t)=Ia(t)τaΔ+2LAI(ρca/rs)(es(t)-ea(t))Δ+γ(1+rc/ra),
where λ is the latent heat of vaporization (2.45 kJ/kg), Tv(t) is the canopy temperature over time in K, Cp is the specific heat of air at constant pressure, LAI is theplant canopy leaf area index, Ag is the area of ground in m2, E(t) is canopy transpiration rate over time in kgm−2s−1, es(t) is the saturated vapor pressure of the air (assumed at the leaf temperature) over time in Pa, ea(t) is the water vapor pressure of the air over time in Pa, rc and ra are the leaf aerodynamic and stomatal resistances of the leaves of 150 s/m and 290 s/m, respectively [23], γ is the psychometric constant of 0.0646 kPaK−1,  and  Δ is the slope of the water vapor saturation curve at Ti in PaK−1.Some parameters of the model are changing all the time or are not easy to measure, such as LAI,Kg, and Kc. The optimization method can be used to calibrate parameters according to root mean square error (Rmse) between the actual energy consumption and predicted values. The objective function of the algorithm estimation parameters is as follows:
(10)Rmse=1Max_t∑t=1Max_tqst,μ-qrealt2,
where qreal(t) is real energy consumption, Max_t is the maximum value in the time series, and μ is estimated parameter vector [LAI  kg  kc].


### 2.3. HPSO-GA Algorithm

In the present study, we propose the HPSO-GA, which could optimize the coefficients of equations with better performance. To better optimize the parameters of energy demand model in the greenhouse, an effective hybrid optimization algorithm is developed based on PSO and GA, which can fully combine the merits of these two methods without their drawbacks.A 4N population is generated for an m-dimension optimization problem. Randomly generated initial particle swarms η1,η2,η3,…,η4N calculate the fitness value according to formula (9). To maintain the stability of the individuals, the better individuals are kept to speed up the convergence. The 2N individuals with better fitness values are used in PSO evolution to create a new 2N population. Further, to avoid the particle from getting stuck in the local minimum, 2N individuals with worse fitness values are subjected to GA operation to create a new 2N population. Finally, the new 2N population by PSO is combined with the new 2N individuals by GA to form a new 4N population for the next generation optimization. When the algorithm reaches the maximum generation (max_n) or Rmse is less than the setting value (min_r), the best fitness value and best parameters are output. The flowchart for the HPSO-GA is shown in Figure 2.Figure 2
The flowchart for HPSO-GA.The PSO evolution consists of a swarm of particles and each particle represents a position in ann-dimensional space. The status of a particle in the search space is characterized by two factors, such as the position and velocity. Each particle is associated with a velocity and a memory of personal best position (pbest) and a memory of the best position (gbest). At each step, by using the individual pbest and gbest, a new velocity for the particle is updated by
(11)vin+1=w·vin+c1·r1·pbestin-ηin+c2·r2·gbestn-ηin.Based on the updated velocity, each particle changes its position as follows:(12)ηin+1=ηin+vin+1,
where vin is the velocity of the particle i in the nth iteration, w is inertia weight, ηin is current position vector, pbestin is the best previous position of this particle, gbestn is global best previous position among all the particles in nth iteration, r1 and r2 are two random variables with range [0,1], c1 and c2 are positive constant learning rates, and the particle i∈(1,4N).In order to increase the particles diversity and inhibit premature phenomenon, GA operators, crossover and mutation, are utilized in the HPSO-GA.m-dimension vector is converted into binary according to resolution ratio r. The crossover and mutation operation are shown in Figures 3 and 4, respectively.Figure 3
Crossover operation on the individuals.Figure 4
Mutation operation on the individuals.The parts ofη1 and η2 between crossover site 1 and crossover site 2 are exchanged. The crossover site is generated randomly and pc is the crossover probability. pm is the mutation probability in GA and the bits mutate randomly depending on pm. The 2N particle ηi′ is reborn by the GA operators. The velocity is assigned randomly and best previous position pbesti is set as ηi′′ for PSO evolution of the next generation.


## 2.1. Experiment Setup

A multispan glass greenhouse was employed in this experiment, and it was located in Jiangsu Province, China (longitude: 120°29′ east, latitude: 31°76′ north). This greenhouse is covered with a single layer of 4 mm thickness glass, 72 m length in the north-south direction, and 7.5 m height and consisted of 28 spans 4 m wide each. The outside air temperature, wind speed, and PAR were measured by a small weather station (GalCon, Eldarshany Co., Israel). The air temperatures at the height of 4 m from the ground of four positions inside were measured by sensors (HMT100, Vaisala Co., Finland). Inside air temperature was the average of 4 temperature sensors in the greenhouse. Surface water source heat pumps system was applied in the greenhouse. The energy consumption is measured by energy meter (HCM1158, Honeywell Co., Germany) according to the water flow rate and the difference of supply and return water temperatures. The data from the sensors were automatically recorded every 5 min by a data logger which we have developed. The experiment was carried out from June 2 to June 7, 2012.


## 2.2. Greenhouse Environment Model

Greenhouse environment model in the physical and physiological methods that take place inside greenhouses based on mass and energy balances, including the biological behavior of plants. Mathematical models of greenhouse microclimate are influenced by several elements of the greenhouse (heat flow and conduction, vapor diffusion, etc.) and the outside boundaries (solar radiation, air temperature, etc.), which is shown in Figure1. The thermal balance inside the greenhouse defines the rate of change of temperature, which can be transferred to calculate the energy supply requirements. Consider
(1)qst=ρaVCadTi(t)dt+ql(t)+qc(t)+qw(t)+qet+qpt-qtt,
where qs(t) is the energy supply over time in W, ρa is the air density in kgm−3, V is the volume of the greenhouse in m3, Ca is air specific heat in Jkg−1K−1, Ti(t) is air temperature inside the greenhouse over time in K, ql(t) is the energy flux due to the long wave thermal radiation over time in W, qc(t) is the heat flux through the cover over time in W, qw(t) is heat flux from ventilation and infiltration over time in W, qe(t) is the heat flux due to crop transpiration over time in W, qp(t) is the heat flux due to the convection between greenhouse air with soil and crop leaves over time in W, and qt(t) is the net solar radiation into greenhouse over time in W. Since the top windows and side windows are all closed when the cooling system is working, heat flux from ventilation qw can be ignored and t is time series variable.Figure 1
The thermal balance of greenhouse environment.The net solar radiation into greenhouseqt(t) can be described as follows according to radiation law:
(2)qtt=AsIatτa,
where As is the surface area of cover material in m2, Ia(t) is outdoor global radiation over time in Wm−2, and τa is cover material absorption coefficient.According to the nonlinear Stefan-Boltzmann law, the thermal long wave radiation exchange between interior and exterior can be written as follows:(3)ql(t)=ε12AsσTit4-Tskyt4,
where As is the area of covering in m2, σ is the Stefan-Boltzmann constant of 5.67 × 10−8 Wm−2K−4, Tsky(t) is sky temperature over time in K, and ε12 is the combined emissivity between the cover and sky, which is found from the individual emission coefficients ε1 and ε2:
(4)ε12=ε1-1+ε2-1-1-1.According to Aubinet [21], sky temperature related to temperature outside the greenhouse is expressed as follows:
(5)Tskyt=94+12.6ln⁡⁡eo-13k+0.341Tot,
where eo is actual air water vapor pressure outside in Pa, To(t) is temperature outside the greenhouse over time in K, and k is the sky clearness index, which is 2233 Pa and 39%, respectively, based on NASA Surface Meteorological and Solar Energy information [22].The greenhouse air exchanges energy and water vapor (condensation) with the inner surface of the cover and the cover exchanges energy with the outside air. The heat exchanged by conduction and convection between the cover and the air resulted from driving force for the exchange due to the temperature difference. The heat exchanged by internal thermal curtain and infiltration is also dependent on the inside and outside air temperature. Consider(6)qct=As·Kg·Kc·Tit-Tot,
where As is the area of greenhouse cover material in m2, Kg is the heat transfer coefficient in Wm−2K−1, and Kc is correct coefficient of internal thermal curtain and infiltration.The transport of energy from the leaf is in general defined in the same way as the heat transfer from other surfaces. The sensible heat fluxqe was expressed with respect to the temperature difference between inside air and canopy:
(7)qpt=AgρCpLAITvt-Titra.Latent heat flux due to crop transpiration in greenhouse can be described in terms of the crop canopy available energy and from the inside air saturation deficit, by means of the Penman-Monteith formula:(8)qet=Ag·λ·Et,(9)λE(t)=Ia(t)τaΔ+2LAI(ρca/rs)(es(t)-ea(t))Δ+γ(1+rc/ra),
where λ is the latent heat of vaporization (2.45 kJ/kg), Tv(t) is the canopy temperature over time in K, Cp is the specific heat of air at constant pressure, LAI is theplant canopy leaf area index, Ag is the area of ground in m2, E(t) is canopy transpiration rate over time in kgm−2s−1, es(t) is the saturated vapor pressure of the air (assumed at the leaf temperature) over time in Pa, ea(t) is the water vapor pressure of the air over time in Pa, rc and ra are the leaf aerodynamic and stomatal resistances of the leaves of 150 s/m and 290 s/m, respectively [23], γ is the psychometric constant of 0.0646 kPaK−1,  and  Δ is the slope of the water vapor saturation curve at Ti in PaK−1.Some parameters of the model are changing all the time or are not easy to measure, such as LAI,Kg, and Kc. The optimization method can be used to calibrate parameters according to root mean square error (Rmse) between the actual energy consumption and predicted values. The objective function of the algorithm estimation parameters is as follows:
(10)Rmse=1Max_t∑t=1Max_tqst,μ-qrealt2,
where qreal(t) is real energy consumption, Max_t is the maximum value in the time series, and μ is estimated parameter vector [LAI  kg  kc].


## 2.3. HPSO-GA Algorithm

In the present study, we propose the HPSO-GA, which could optimize the coefficients of equations with better performance. To better optimize the parameters of energy demand model in the greenhouse, an effective hybrid optimization algorithm is developed based on PSO and GA, which can fully combine the merits of these two methods without their drawbacks.A 4N population is generated for an m-dimension optimization problem. Randomly generated initial particle swarms η1,η2,η3,…,η4N calculate the fitness value according to formula (9). To maintain the stability of the individuals, the better individuals are kept to speed up the convergence. The 2N individuals with better fitness values are used in PSO evolution to create a new 2N population. Further, to avoid the particle from getting stuck in the local minimum, 2N individuals with worse fitness values are subjected to GA operation to create a new 2N population. Finally, the new 2N population by PSO is combined with the new 2N individuals by GA to form a new 4N population for the next generation optimization. When the algorithm reaches the maximum generation (max_n) or Rmse is less than the setting value (min_r), the best fitness value and best parameters are output. The flowchart for the HPSO-GA is shown in Figure 2.Figure 2
The flowchart for HPSO-GA.The PSO evolution consists of a swarm of particles and each particle represents a position in ann-dimensional space. The status of a particle in the search space is characterized by two factors, such as the position and velocity. Each particle is associated with a velocity and a memory of personal best position (pbest) and a memory of the best position (gbest). At each step, by using the individual pbest and gbest, a new velocity for the particle is updated by
(11)vin+1=w·vin+c1·r1·pbestin-ηin+c2·r2·gbestn-ηin.Based on the updated velocity, each particle changes its position as follows:(12)ηin+1=ηin+vin+1,
where vin is the velocity of the particle i in the nth iteration, w is inertia weight, ηin is current position vector, pbestin is the best previous position of this particle, gbestn is global best previous position among all the particles in nth iteration, r1 and r2 are two random variables with range [0,1], c1 and c2 are positive constant learning rates, and the particle i∈(1,4N).In order to increase the particles diversity and inhibit premature phenomenon, GA operators, crossover and mutation, are utilized in the HPSO-GA.m-dimension vector is converted into binary according to resolution ratio r. The crossover and mutation operation are shown in Figures 3 and 4, respectively.Figure 3
Crossover operation on the individuals.Figure 4
Mutation operation on the individuals.The parts ofη1 and η2 between crossover site 1 and crossover site 2 are exchanged. The crossover site is generated randomly and pc is the crossover probability. pm is the mutation probability in GA and the bits mutate randomly depending on pm. The 2N particle ηi′ is reborn by the GA operators. The velocity is assigned randomly and best previous position pbesti is set as ηi′′ for PSO evolution of the next generation.


## 3. Results and Discussion

According to formulas (1)–(8), the physical energy model in the experimental greenhouse is built in the Matlab/Simulink. The optimization algorithm is programmed in a Matlab M-file, which is used to calibrate estimated parameters vector μ in the Simulink simulation rapidly and efficiently. The ascertained parameters in the model and the HPSO-GA parameters are shown in Table 1.Table 1
The parameters in the greenhouse model and the HPSO-GA.
Parameters
Symbol
Value
Volume
V/m3
9958.4
Glass transmissivity
τ
0.86
Sky emissivity
ε
1
0.90
Glass emissivity
ε
2
0.90
Air density
ρ
a/kgm−3
1.2
Specific heat
C
a/Jkg−1K−1
1008
The size of the populations
4N
20
Dimension of the vector
m
3
Positive constant learning rates
c
1 and c2
1.4995
Crossover probability
p
c
0.1
Mutation probability
p
m
0.01
Resolution ratio
r
10
Evolution generation
max_n
200
Setting minimum value Rmse
Min_r
240000A computer with 2.35 GHz Core Duo processor and 2 GB RAM memory was used to run each optimization algorithm 10 times independently. The simulation data in Table2 shows the average of optimization results with three optimization algorithms. According to the best parameters, the prediction curve for energy consumption can be achieved in Figure 5.Table 2
Optimization results with three optimization algorithms.
Parameters
PSO
GA
HPSO-GA
K
g
6.61
6.69
6.18
K
c
0.65
0.78
0.75
LAI
4.08
5.16
5.25
Time spent (seconds)
189
677
156
Exit generation
86
115
73
Rmse
238525
239228
238914Figure 5
Simulated energy demand with three optimization algorithms and actual energy consumption.When the objective fitness value Min_r was set as 2.4 × 105, HPSO-GA decreases the exit generation. Computational time by HPSO-GA is 156 seconds, which is automatically recorded by the optimization software. Compared with PSO and GA, HPSO-GA saves time of 33 seconds and 521 seconds, respectively. In Figure 5 it can be observed that there is a deviation between the simulation value and actual energy consumption, particularly during the night. However the three optimization algorithms results were all fitted to actual energy consumption, which implies that three optimization algorithms are successful in estimating greenhouse model parameters.As seen in Table2, the HPSO-GA with better efficiency at estimating the parameters saves computational time of 21% and 77% compared with PSO and GA, respectively. When the max_n is set to be less than 80, the HPSO-GA gives a better estimation of energy consumption with a 15% significant level than PSO and with an 85% significant level than GA. When the max_n is more than 115, the objective fitness value optimized by HPSO-GA is similar to PSO and GA. The HPSO-GA can quickly obtain the optimal solution in the early evolution, since it speeds up the convergence process. During the optimization process of ten times, the local optimum has been resulted from PSO for more than two times, while it does not occur by HPSO-GA. Overcoming the undesired local solution, the reliability and stability of HPSO-GA are successfully approved in the parameters estimation applications of greenhouse model.


## 4. Conclusions

In this study, HPSO-GA is developed to estimate the indistinct internal parameters of greenhouse energy model, which is built based on thermal balance. Experiments were conducted to measure environment and energy parameters in a cooling greenhouse with surface water source heat pump system. Simulated energy consumption by the identified model using HPSO-GA is in agreement with the actual energy consumption, which proves that HPSO-GA can be used to predict the energy demand in the greenhouse. Compared with GA and PSO, HPSO-GA saves the optimization time of more than 21%, when the maximum generation is less than 80. The HPSO-GA shows excellent ability in solving parameter estimation problems in the greenhouse system, including the optimized speed and accuracy.



---

*Source: 871075-2015-02-23.xml*