Expert System for Greenhouse Production Management

Greenhouse is a kind of agricultural building structure with glass or plastic roof, where the vegetables or flowers can grow well year round by controlling the inside climatic environment. Fig. 1 shows commercial multispan greenhouses in China. The closed environment of a greenhouse has its own unique requirements, compared with outdoor production. Pests and diseases, and extremes of heat and humidity, have to be controlled, and fertigation is necessary to provide water and nutrients. Significant inputs of heat and light may be required, particularly with winter production of warm-weather vegetables. So greenhouse cost-effectiveness can not be ignored. Fig. 1. Modern commercial greenhouses


System configuration
Modular design method is adopted to configurate the expert system and every independent module is combined by master module. Main modules of the expert system include inference diagnosis module, database management module, cosultation module, decision on environment control, text browsing module and help module. Correspondingly, system software structure is shown as Fig. 3.

Inference and Diagnosis Module
This is the core part of the expert sytem, which deals with the diagnosis of common pest/disease and nutrient deficiency for greenhouse crops. It can draw a diagnosis conclusion step by step and provide prevention and treantment mothed for user's reference. www.intechopen.com

Database Management Module
The module is used for creating, editing and modifying knowledge and database. The known data, knowledge and rules of the expert system are also created, edited and modified through the module.

Text Browsing Module
The module describes the botanical and physiological features of several typical greenhouse crops in text. Cultivation techniques and requirements of environment are also involved.

Consultation Module
It includes both pest/disease and nutrient deficiency consultation modules. The module provides users with the type of pest/disease or nutrient deficiency and the expert system goes into the details such as symptom, occurrence regularity, prevention and treatment, and related pictures.

Decision of Environment Control Module
There are two decision modes for greenhouse environment control, suiting for different occasions. One is on-line decision mode and the other is off-line decision mode. Under the on-line mode the expert system is integrated with the environment information collection system, based on which real-time environment control strategy can be worked out to complete the adjustment of greenhouse environment for good growth of crops. Under the off-line mode users input the present environment and crop information by hand and the expert system gives proper decision alternatives for user's reference.

Database management
Among consultation module, cultivation techniques is called through text mode, and pest/disease, nutrient deficiency and chemicals are based on data dictionary, which result from large amount of searched basic data. For example, intuitive description of disease symptom and its pictures can be given by the system according to user's selection of different diseases. Moreover, diagnosis module is also based on symptom, but the symptom is represented by particular knowledge. Here production rule knowledge representation based on relational database is adopted, and the knowledge is represented through database tables.
First, E-R model is established, which is an abstraction of real world. E-R model extracts common characteristics and neglects nonessential details, and describes the characteristics accurately using all kinds of concepts. There are three abstractions. a. Classification defines a certain concept as a type of a group of objects, which have the common features and behaviours. Take tomato as an example, classification model is described in Fig. 4. b. Aggregation is defined as a component part of a type. An entity is the aggregation of several attributes. In Fig. 5, the relationship between symptom and different parts is an aggregation. c. Generalization is defined as a certain subset relationship between different types, which includes subtype and supertype. Generalization model is described in Fig. 6. Then, E-R model is transformed into relational model, following the principle: one entity type is transformed into one relational schema, so entity attribute is relation attribute and entity code is relation code. The transformed data model is listed below. Diseases: Title Symptom recognition Occurrence regularity Prevention/treatment Pictures Pests: Title Damage symptom Morphological feature Prevention/treatment Pictures Finally, the memory size of each data table field is determined, data and knowledge is recorded, and database is built. When using the database, maintenance of adding, deletion and updating is needed.

Design of knowledge base 3.2.1 Acquisition of knowledge
The source of knowledge is kinds of books, scientific reports and pictures. The reliability of the expert system depends on the quality of knowledge, so accuracy of fact description need to be guaranteed. The knowledge of greenhouse tomato growth barriers is briefly illustrated as follows.
1. Symptom description with natural language Tomato barrier symptom is described with simple natural language, and a piece of knowledge table is made. For example, as for the case of phosphorus deficiency, symptom and diagnosis is described as follows.
Crop title: Tomato Symptom: older leaves etiolating with purple brown spots Older leaves dropping off easily Short small plant Thin stem Olive green leaves Violet Leaf Venation on the back Diagnosis: Phosphorus deficiency Simple language helps to purify and order the knowledge, and forms a description and diagnosis table. Even though there is large number of tomato growth barriers, the most common symptoms and easily-recognized symptoms are listed in Table 1, with which a series of targets (conclusion) can be decided for every barrier. All described symptoms and important facts are linked to the targets, and then proper diagnosis rules are obtained. 2. Rules of knowledge base Representation of system symptom is based on the form of Object-Attribute-Value (OAV), which is suitable for developing any expert system based on rules. Most of the symptoms have one or several attributes and each attribute has at least one value. All the possible attributes and values of each symptom are collected and prepared. Knowledge in description/diagnosis table is used to relate disease with its symptom. In the table the columns represent diagnosis and the rows represent symptom. Rules conformed to given column or row units are found out from rules of knowledge base. In addition, if a disease needs to be recognized by several rules, the attribute of the disease will appear in  Table 2. Relation between tomato symptom and nutrient deficiency

Knowledge representation method
Knowledge base is essential to expert system and its structure and performance influence the accuracy and efficiency of problem solving. At the same time proper knowledge representation method may enhance the performance of knowledge base.

www.intechopen.com
The knowledge within the expert system is represented and organized by the following types: descriptive knowledge, data knowledge and rule knowledge. Production knowledge representation based on database is used to strengthen the relation among knowledge and to reduce the number of production rules. Rule base is the knowledge memory of specific field, and its representation is If < premise > then < conclusion > λ which means the reliability of conclusion is λ when premise comes into existence. λ=1 for accurate inference, and λ varies within [0,1] for inaccurate inference. < premise > is the conjunction of facts and assertion. Semantic model of the rules is expressed as Fig. 8. Based on above semantic model, relational database and knowledge inference, rules are represented by relational database. Rule premise and conclusion are separated, and put into different database. Rules and related information is stored in rule premise base, and its structure is as follows.
Number of rules Rule premise Meet or not?
Rule conclusion and related information is stored in rule conclusion base, and its structure is as follows.

Number of rules Rule conclusion Number of premise Number of auxiliary contentment
Take a complete production rule as an example, if < premise 1 >, < premise 2 >, < premise 3 > then < conclusion > which means number of premise is three and conclusion can be made only when all the three premises meet the requirements.

Establishment of knowledge base
1. Knowledge base of pest/disease diagnosis Besides rule premise base and rule conclusion base, dictionary base is designed to make knowledge base management easier by storing premise, conclusion and code of the rule base. Its structure is dictionary (fact number, facts, known or not) Knowledge base is essential to expert system and its structure and performance influence the accuracy and efficiency of problem solving. At the same time proper knowledge representation method may enhance the performance of knowledge base. The above three bases are structured through a table in Fig. 9

Organization of knowledge base
Knowledge base is organized by database management mechanism of SQL Server 2000, since knowledge is represented through relational database table. This kind of organization has the following advantages. 1. Knowledge base and inference engine are mutually independent, and the internal variation of organizational structure of knowledge base does not affect inference engine. 2. Expansion, maintenance and modification of knowledge are easily done with the help of database. 3. Rule files can be transformed into database files so that the normative and flexibility of knowledge representation are improved. 4. Multimedia knowledge representation is achieved through setting fields of picture, sound and animation in the conclusion base.

Design of inference engine
Inference engine may control and coordinate the whole expert system for greenhouse production management. The knowledge used for inference is accurate, and inference conclusion is definite.

Diagnosis of pest/disease and nutrient deficiency
Occurrence and development of pest/disease and nutrient deficiency are restricted by many factors, and here cropping system, growth season, temperature and humidity, and time are considered. Diagnosis of pest/disease and nutrient deficiency is based on symptom. The diagnostic flow chart is shown in Fig. 10. The inference engine is built up with structured query language and forward inference is adopted. According to the given facts, rule premise database is searched to find out the matched record. The matching process is shown in Fig. 11. For example, when users input information (pupae; oval shape), auxiliary number of rule is not reduced to 0 after inference. The inference conclusion is: greenhouse whitefly and liriomyza sativae blanchard, and detailed information of the two pests is listed. Final decision will be made by watching and judging the further features.   Fig. 11. Flow chart of matching record

Environment control decision based on models
Different combinations of environment control actuators are listed in Table 3 (for summer) and Table 4 (for spring and autumn).    In Table 3 and Table 4, 1 stands for the status "Open" of the actuators, while 0 stands for the status "Closed" of the actuators. The inference process is described as Fig. 12. First, users input environment information and the status of actuators manually or automatically through greenhouse environment information collection system. With photosynthetic model and knowledge of crop growth appropriate environment parameters can be figured out. At the same time current environment inside the greenhouse is judged to make sure it conforms to the proper range. Then keep the current status of the actuators. Otherwise, inference of environment control decision must be done in order to output the optimal environment control decision for users' reference.

Integration of environment information collection with expert system
To integrate obtained models and knowledge, especially current environment and crop information with greenhouse management expert system for vegetables and make better decisions, real-time environment information collection system is indispensable.

Overall design of environment information collection system
As a sub-system of greenhouse management system, environment information collection system provides expert system with real-time environment information and help to make proper environment control decisions.

Design requirements
The sub-system can collect environment information inside and outside greenhouses independently. All the information is stored in database, and can be used for greenhouse management expert system. The climatic parameters include temperature, relative humidity, light intensity and data of CO 2 concentration wind speed, wind direction and rainfall can also be collected by reserved extensible channels and interfaces for future purpose.
The system needs separate monitoring and unified management

System functions
For greenhouse environment control, single chip microcomputer receives climatic data from kinds of sensors, carries out logical operation and judgement with expert system, and then makes control decisions to adjust greenhouse environment. Meanwhile, it can help growers to analyze history dada and mine good management strategies. The specific functions are listed as follows: Real-time monitoring greenhouse environment; Updating the environment information database for expert system; Information output and display with text, graph table or printout; Alarming in case of extreme occasions or crop stress.

System configuration
Environment information collection system consists of sensors, data collection module and monitoring software. System configuration is shown in Fig. 13. Each of the sensors is connected with data collection modules to obtain environment parameters inside and outside greenhouses. All data collection modules communicate with monitoring system (PC) through RS232/485 converter. Monitoring software is developed with configuration software, which is easily customized and interactive. Fig. 13. Configuration of greenhouse environment information collection system

System hardware design
Selected sensors are used to measure temperature, relative humidity and light intensity. Integrated temperature and humidity sensor LT/W/S and light intensity sensor LT/G adopt advanced circuit module to transmit signals, and output standard voltage and current, which can be switched by jumping lines. Specification of sensors is shown in Table 5. 8 channels can be linked to data collection module RM4018 and communicate with monitoring computer through the interface of RS485. RM4018 adopts MCU of AT89C2051, 12-bit A/D chip ADS7822 and multiplexer chip MPC508. Photoelectric isolation is used to enhance anti-jamming.

System software design
The software of greenhouse environment information acquisition system is developed on the platform of configuration software PCAuto3.1, which is a kind of special software for data collection and process control. PCAuto3.1 has flexible configuration not programming mode and can provide customers with friendly interface and easy operation. Configuration software consists of project manager, development system, interface running system, real-time database, I/O driver, network communication program, serial communication program, dialing communication program and web server program.
The software of greenhouse environment information acquisition system includes real-time display, text and graph output, database management and system parameters setting. The main window is shown in Fig. 14.
The database of the software is called by the model base and environment control system, and then control decision can be made based on it. First, database files of ACCESS is created, entitled data.mdb. Then the database form is correlated with configuration software form by the command of dynamic link library---SQLCreateTable. And one record of environment information is inserted by the command of dynamic link library---SQLInsert. Finally, expert system directly calls real-time ACCESS database files to be processed for making control decisions.

System implementation
According to measuring requirement, sensors were put on proper locations and connected with the data collection modules. And the data collection modules were connected with a computer in which monitoring and control software had been installed The system automatically recorded environment information at a certain interval and was put into expert system by the ACCESS database files. The system ran for 20 days with no software or hardware failures and successfully supported greenhouse management system with proper decision-making.

Application examples of expert system
The operation of the expert system is simple and easy through menu-driven mode. Given functions include, 1. Consultation of basic cultivation information, dealing with botanical characteristics, requirements of growth environment and cultivation techniques during each growth stage. 2. Consultation of frequent pest/disease and nutrient deficiency symptom in greenhouses and chemicals for prevention and treatment. 3. Diagnosis and recognition of pest/disease and nutrient deficiency. 4. Decision on greenhouse environment control for on/off-line operation mode. Fig. 15 shows the main interface of the expert system, consisting of title bar, menu bar and shortcut bar. Users can select corresponding functions by clicking them.

Example of disease diagnosis
The general process of diagnosis is briefly described through tomato diseases. Fig. 16 is one of the subforms for diagnosis of tomato diseases. Tomato diseases are diagnosed by their damage symptoms, which have much difference according different growing parts such as leaves, stems and fruits. Users observe the tomato plant on site carefully, and then choose corresponding parts suffering potential diseases in the expert systen. Finally the diseases and their prevetion/treatment motheds are inferred by the expert system. Fig. 16. Interface diagnosis for tomato diseases Fig. 17, symptom selection dialogue box, will come out when clicking on "Leaf", affected position, in Fig. 16. Then all the disease symptoms related to tomato leaf will appeare in the list box of "selected knowledge or data". After proper selection the knowledge or data will be put into the list box of "selected inference knowledge". Here we choose three pieces of knowledge: "water-stain diseased spots, V-shape extended inwards from leaf edge", "drab or tawny spots" and "with grey mold layer", and save it as a database file. For the fruit part, the operation is the same as the leaf part (see Fig. 18). At the same time another database file is created. Fig. 18. Dialogue box of fruit symptom selection After the above two-step selection, click the botton "Inferring" and the conclusion will be made in Fig. 19 by calling the knowledge base of disease diagnosis. The inference result shows that the tomato plant suffers grey mold, whose detailed information is listed in Fig. 19. If only insufficient information is input, several inference conclusions may be obtained for user's reference and selection. www.intechopen.com

Example of greenhouse environment control decision 5.2.1 On-line decision
When users choose on-line decision mode the system collects environmental information inside and outside the greenhouse automatically. Fig. 20 shows both inside and outside environment parameters, including temperature, humidity and light intensity. The information is updated every a certain period. The current status of each environment controlling actuator is also shown. According to the specific crops cultivated in greenhouse, optimal environment conditions, irrigation span and recommended actuating alternatives will be decided through the expert system, wihich is shown in Fig. 21.

Off-line decision
Manual decision is carried out when users input the information of greenhouse environment and actuator status by hand, not through the collection system of environment information. Users may estimate and input light intensity at five levels due to no radiometer available (see Fig. 22). Base on above information off-line decision could be made in Fig. 23.

Acknowledgements
We sincerely thank Professor Xiliang Zhang and Mr. Zuohua Li for their contributions to the development of greenhouse environment information collection system and pest/disease www.intechopen.com