<figure><img src="image_1.png" /></figure>

HAL
open science

# Design of Greenhouse Environmental Parameters Prediction System

Haokun Zhang, Heru Xue

<figure><img src="image_2.png" /></figure>

## To cite this version:

Haokun Zhang, Heru Xue. Design of Greenhouse Environmental Parameters Prediction System. 4th Conference on Computer and Computing Technologies in Agriculture (CCTA), Oct 2010, Nanchang, China. pp.502-507, 10.1007/978-3-642-18333-1_59. hal-01559575

HAL Id: hal-01559575

https://inria.hal.science/hal-01559575

Submitted on 10 Jul 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_3.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Design of Greenhouse Environmental Parameters Prediction System

Haokun Zhang¹, Heru Xue¹

¹College of computer & information Engineering,
Inner Mongolia Agricultural University,
Hohhot, Inner Mongolia, P. R. China
E-mail: tonyzhhk@163.com

**Abstract.** This paper designs an environmental parameters prediction system based on web for greenhouse. The system is designed using the MVC framework, and includes monitoring module and prediction module. The system can obtain the main environmental parameters from sensors, such as light, temperature, humidity, CO₂ and so on. Based on mass and energy balance principle, the prediction module of the system can predict the parameters of the greenhouse environment each day. The system displays the measured real-time data and the predicted data for the users to manage greenhouse easily. This paper provides a specific method to realize an intelligent management system for greenhouse.

**Keywords:** Greenhouse environmental prediction, Prediction model, MVC framework, Intelligent management system

## 1 Introduction

Solar greenhouse is a unique greenhouse structure in China, with low cost, low running cost, good insulation and high efficiency advantages. But the current level of greenhouse environmental control is lower, and the greenhouse environmental control is still a manual control-oriented. It is difficult to adjust to the best environment for crop growth. This paper designs an environmental parameters prediction system realizing a function of remote monitoring and early warning. The system provides reliable and accurate greenhouse environmental parameters for users to manage the greenhouse.

With the development of the Internet and WWW technology, Web has become the interactive interface for most software users. WWW is considered the most successful information system. In particular the development of dynamic Web technologies having come a long way, WWW is becoming the mainstream of various types of information system development platform. Dynamic Web system structure is a three-tier client/server model. In the three-tier system architecture, Web browser occupies client layer, database server and other external service account the service layer, and occupy the middle layer is the Web server and server extensions. Three-tier structure
makes the dynamic Web browser users can access the existing database resources,
and enhances the system interactivity.

This paper designs a web-based system, which implements the B/S design pattern
and three-tier structure to shield underlying network and provides the users a friendly
and consistent interface.

## 2 System Designing

The environmental parameters prediction system is based on B/S design pattern of the dynamic three-tier architecture of Web systems[1]. The users request to the server by submitting a form in a browser. The server calls the data in the database after receiving the requests, and the results are returned to the users.

Using software engineering, the system is divided into different functional modules, according to the setting of the types of the greenhouse environmental parameters and the processes and characteristics of greenhouse environmental parameters monitoring and prediction. The system implements functions of monitoring and predicting the greenhouse environmental parameters and provides an interactive platform for users. The structure of system is shown as fig. 1.

<figure><img src="image_4.png" /><figcaption>Fig. 1. System flow chart</figcaption></figure>

The system includes the following functions:

Function of login and registration. Before using this system, users need to register and login. After users submit the registration information successfully, the system returns the registration information to the users. This function is designed to manage the system for users.

Function of environment monitoring. This function implements transmission and display of the environmental parameters and stores the parameters in the database. The system sends the parameter data to the users' browsers using the web server. The function can show the environmental parameter data in a table and also can draw a line chart of the data to users.

Function of environment prediction. The implement of this function is base on
solar greenhouse environment model, which uses mass and energy balance equations
to describe the climate in the greenhouse. The function can predict the greenhouse environmental parameters everyday. Input parameters need by this function submitted, the prediction is calculated based on environmental prediction model, and the prediction results is displayed in a table or a line chart to users.

# 3 System Implementation

In the development of the system, JSP technology and DAO technology are used. JSP technology is based on Java, and can create dynamic Web pages supporting cross-platform and cross-server. Following the object-oriented design, JSP programming is easy and independent of web browsers[2-3]. In developing web information systems, JSP technology is widely used.

## 3.1 MVC Architecture

MVC is a "Model-View-Controller" in the abbreviation. MVC applications always have three parts, which are Model, View and Controller. Event leads to changes coursed by Controller in Model or View, or changes both at the same time. If Controller changes the data or properties of Models, all Views automatically update. Similarly, if Controller changes the View, the View gets data from the Model to refresh itself.

## 3.2 Access to Database

This system is designed to use Access desktop database. All operations on access to database are packaged in a separated Java class named by DB.java, in which all member functions are defined as static functions, such as Connection getConn(), getStatement(Connection conn), getResultSet(Statementstmt, String sql) and so on.

The following statement can implement the access to database:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

conn =DriverManager.getConnection("jdbc:odbc: driver={Microsoft Access Driver (*.mdb)};DBQ=path");

The "path" in the above sentence is the variable of the physical path of the data file.

## 3.3 Implementation of Functions

### 3.3.1 Environment Monitoring

This function deals with the data get from sensors, and displays the data in web pages. Implementation of the function depends on the deployment of sensors. After sensors working successfully, greenhouse environmental parameters stored in the Access
database are obtained by this module. The system uses AUTO-22 greenhouse environmental data collector. According to the need of the greenhouse environmental model, twenty-one sensors are used. The attributes of the table created in the database is shown as table 1.

<table><caption>**Table 1.** Meaning of the database table attributes</caption><thead><tr><td>Attributes</td><td>Meaning</td><td>Attributes</td><td>Meaning</td></tr></thead><tbody><tr><td>temp1</td><td>inner surface temperature of back slope 1#</td><td>temp2</td><td>outdoor humidity 2#</td></tr><tr><td>temp3</td><td>outdoor horizontal solar illuminance 3#</td><td>temp4</td><td>Outdoor wind speed 4#</td></tr><tr><td>temp5</td><td>Outdoor environmental temperature 5#</td><td>temp6</td><td>Outdoor wind direction 6#</td></tr><tr><td>temp7</td><td>Inner surface temperature of back wall 7#</td><td>temp8</td><td>Inner surface temperature of second wall 8#</td></tr><tr><td>temp9</td><td>Outer surface temperature of insulation 9#</td><td>temp10</td><td>Outer surface temperature of first wall 10#</td></tr><tr><td>temp11</td><td>Outer surface temperature of wall 11#</td><td>temp12</td><td>Outer surface temperature of back slope 12#</td></tr><tr><td>temp13</td><td>Indoor environmental humidity 13#</td><td>temp14</td><td>Indoor soil moisture 14#</td></tr><tr><td>temp15</td><td>Indoor solar illuminance of soil surface 15#</td><td>temp16</td><td>Concentration of CO2 16#</td></tr><tr><td>temp17</td><td>Indoor temperature of air 17#</td><td>temp18</td><td>Crop canopy temperature 18#</td></tr><tr><td>temp19</td><td>Inner surface temperature of Translucent membrane 19#</td><td>temp20</td><td>soil surface Temperature 20#</td></tr><tr><td>temp21</td><td>Deep soil temperature 21#</td><td></td><td></td></tr></tbody></table>

The system uses a JavaBean named Condition to set and get data from the database. DAO of the system obtains data from the table in database and stores it in a list consisted of objects of Condition. JSP pages read the list to display the data in browsers.

Query statement of access: `sql=select top "+pageSize+" * from temp_humi_0` where id not in (select top "+(size)+" id from temp_humi_0 order by id asc)

The “pagesize” in above sentence is a variable to define the number of data item in a page. The “size” variable presents “(pageNo-1)*pagesize”.

To display the data in a line chart, this system needs JFreeChart, which is an open chart drawing library on Java platform[4]. JFreeChart is programmed completely by Java Language, and designed for the use of applications, applets, servlets and JSP. The system needs the JFreeChart package to draw line chart. Add jfreechart-1.0.6.jar, gnujaxp.jar and jcommon-1.0.10.jar in lib directory.

Procedure of generating chart in this system:

1). Create a dataset to include the data displayed in a line chart, which is stored in database.

2). Create an object of JFreeChart to present the chart to be shown.

3). Output the chart.
### 3.3.2 Environmental prediction.

Calculating of each prediction module is developed by Matlab. With the component of Matlab Builder for Java, package the function of prediction module calculated in Matlab into a Java component. This Java component can be called in JSP web system. Taking the solar prediction module an example, package the file named shortwaveradiation.m into a file named shortwaveradiation.jar. Including this new file in the project, the system can call this prediction function.

Matlab Builder for Java (known as Java Builder) is an extension of Matlab Compiler. Java Builder packages Matlab functions into one or more Java classes. Matlab functions are packaged into Java classes, and can be called by Java applications.

Implementation of environmental prediction function is based on greenhouse environmental model[5]. The model integrates solar model, air temperature model, air humidity model and CO2 Concentration model to build an overall prediction model for greenhouse environment. The model needs local weather forecast information. With the forecast information, indoor solar illuminance, air temperature, air humidity, CO2 concentration, soil temperature and soil moisture can be realized.

By inputting values of cloud and local time, solar illuminance prediction function calculates the total flux of solar radiation $I_o$ which has reached surface of the greenhouse, and the total flux of solar radiation $I_{\text{冠层}}$ which has reached the crop canopy. The function also calculates solar radiation energy absorbed and reflected by crop canopy $Q_{\text{rd-c}}$, solar radiation energy absorbed by surface of soil $Q_{\text{rd-s}}$, solar radiation energy absorbed by inner and outer surface of back slope $Q_{\text{rd-ri}}$ and $Q_{\text{rd-ro}}$, and solar radiation energy absorbed by inner and outer surface of back wall $Q_{\text{rd-bi}}$ and $Q_{\text{rd-bo}}$.

Variables calculated in solar illuminance prediction function are needed in air temperature prediction model. The model is based on thermal balance equations such as indoor air thermal balance equation, indoor soil thermal balance equation, back slope thermal balance equation, back wall thermal balance equation and so on. Take the indoor air thermal balance equation as an example, the equation is

$$ 
\begin{aligned}
\rho f_{\text{air}} V_a \frac{dT_a}{dt} &= -Q_{\text{air-c}} - Q_{\text{air-s}} - Q_{\text{air-r}} - Q_{\text{air-b}} - Q_{\text{air-f}} + Q_{\text{air-b}} - Q_{\text{air-s}} \\
&= -A_1 \cdot \alpha_{\text{air-c}} (T_a - T_r) - A_2 \cdot \alpha_{\text{air-s}} (T_a - T_r) - A_3 \cdot \alpha_{\text{air-r}} (T_a - T_r) \\
&\quad - A_4 \cdot \alpha_{\text{air-b}} \cdot (T_a - T_s) - A_5 \cdot \alpha_{\text{air-f}} \cdot (T_a - T_s) + A_6 \cdot h_{\text{air}} (T_p - T_a) - \rho f_{\text{air2}} \phi_{\text{air-c}} (T_a - T_a)
\end{aligned}
\quad (1)
$$

Greenhouse temperature prediction model can predict indoor air temperature, crop canopy temperature, surface of soil temperature and so on. Greenhouse solar illuminance prediction model can predict crop canopy flux of solar radiation. They are the known conditions for prediction of greenhouse CO2 dynamic prediction model.

Mean values in hours per day of crop canopy flux of solar radiation, crop canopy temperature, surface of soil temperature, air temperature, concentration of CO2, and inner surface temperature of translucent membrane obtained by sensors, and measured values each hour per day of outdoor temperature, outdoor humidity are the known
conditions for greenhouse air humidity prediction model. The function of prediction is shown as fig. 2.

<figure><img src="image_5.png" /><figcaption>**Fig. 2.** Greenhouse environmental prediction model calculating flow chart</figcaption></figure>

## 4 Conclusion

The system designed by this paper can provide high-precision data of changes of greenhouse environmental parameters to greenhouse managers. The system realizes remote monitoring and prediction via Web and provides an actual method to realize precision agriculture. The system is an application system for greenhouse environmental parameters prediction.

**Acknowledgements.** This study has been funded by Inner Mongolia Natural Science Foundation Projects (Contract Number: 20080404).

## References

1. Jin Shenglang: Study on remote control system for the greenhouse based on B/S model. Packaging and food machinery, 2008, vol.26, No.3, pp. 15--19

2. Zhou Ning, Fang Hao, Li Jiechong: Design and Implementation of Intelligent Business Expanding Expert System Based on JSP Technology. Guangdong Electric Power, 2007, Vol.20, No.3, pp. 57--66

3. Sigrimis,N.: Computer integrated management and intelligent control of greenhouse. Fourteenth 1999, IFAC World Congress, Beijing, PRC

4. JFreeChart API Documentation, http://www.jfree.org/jfreechart/api/javadoc/index.html

5. Li Wei, Dong Renjie, Tang Chuzhou, Zhang Shumin: A Theoretical Model of Thermal Environment in Solar Plastic Greenhouses with One-Slope. Transactions of the CSAE, 1997, No.2, pp. 160--163