Diagnosis and Grading of Grain Initial Quality

Diagnosis and Grading of Grain Initial Quality

Copyright © IFAC Mathematical and Control Applications in Agriculture and Horticulture, Hannover, Germany, 1997 DIAGNOSIS AND GRADING OF GRAIN INITIA...

1MB Sizes 0 Downloads 56 Views

Copyright © IFAC Mathematical and Control Applications in Agriculture and Horticulture, Hannover, Germany, 1997

DIAGNOSIS AND GRADING OF GRAIN INITIAL QUALITY

Amadou NDIA YE, Laurent PERON and Francis FLEURAT -LESSARD

INRA, Laboratoire des Insectes des Denrees, BP 81, F 33883 Villenave d'Ornon, France

Building up an expert system enabling initial grading of cereal grain quality is presented. The system, easily changeable, is reasoning from experts knowldege about quality deterioration during grain storage. Knowledge was represented as asbtract objects. These objects were inter-related by abstract operations, and scaled into a common space of qualities .. A certitude coefficient was affected to each scaled objects and operations in relation to error risk given by experts. These coefficients were then propagated accross the whole process. The separation between the knowledge base, inference engine, and user interface renders the system fully evolutive. Keywords: Computer, Decision support systems, Expert systems, Quality control.

and an integration of all measures allows an objective determination of the initial grain quality. Applying this principle, it was defined a qualitative method of diagnosis and grading of wheat at delivery in order to allow an optimal preservation during all storage duration.

1. INTRODUCTION

The requirements for cereal grain quality have progressed during recent years faster than the improvements of stored grain preservation technologies. Management of post-harvest grain quality is a new challenge. Recently, several pest control systems have been developed to support the control of stored grain pests (insects and mites) (Flinn & Hagstrum, 1990 ; Wilkin et aI., 1991 ; Longstaff & Cornish, 1994 ; Pasqual & Mansfield, 1988 ; Jones et al. 1993). These systems are dealing with identification of insect pest species of stored grain and with reasoning the control means. Today, current research focuses on preservation and grading of grain initial quality (Ndiaye & Fleurat-Lessard, 1994a,b). In this field, each store-keeper uses his own method to evaluate and grade the initial quality, since it does not exists any tool to help in rapid grading at a delivery to a grain store. Grain quality grading implies both a correct assessment of grain initial quality and of its final use. The main difficulty encountered in rapid grading lies in the accurate evaluation of the grain initial quality (Wrigley et aI., 1994 ; Maier, 1995). One of the most commonly used method is grading according to grain variety (Morris & Raykowski, 1994). A variety is implicitely linked to specific properties, these properties being associated to a smart range of final utilisations. But it can happen that the properties of a variety (of wheat for example) may change from one farming area to another on one side, and on the other side, from one year of harvest to another. Grain properties can be measured through standard tests that are more or less fast. Each test gives an indication on grain quality,

This paper deals with, first, the representation of expert scientific knowledge on post-harvest grain preservation, and reasoning on this knowledge, second, the graphical user interface, and the associated solution to allow its parametrising according to the system changes. 2. REPRESENTATION OF KNOWLEDGE In a grain silo, the grain initial quality diagnosis is done from either objective measurements (temperature, moisture content, etc.), and sensorial tests (smell, colour, etc.). The results of diagnosis are not only related to grain quality and grade, but also to its condition the complementary tests to be done in order to increase the precision of the assessment, to the final utilisations incompatible with the grain initial condition, to the alteration risks for prolonged storage, and to the storage technical route for safe preservation of the initial grain quality during the storage period. The data and the expected results were represented as abstract objects, and the cognitive operations that allow to compute the results from these data as abstract operations.

219

2.1 Abstract objects

This reasoning might be splitted as: 1. a projection of the temperature and moisture content into a qualitative values space; 2. a deduction of the various grain status from the qualitative value of measures; 3. a prediction of the grain alteration risk from the measure values; 4. a deduction of the storage operations needed to keep the initial grain quality, from the qualitative value of measures and alteration risk levels.

Measures and observations were the primary data, and were distinguished from the computed objects (the results), for which the certitude level associated to the computed value was evaluated. The data were three slots objects (T, Id, X), where T is the type measure or observation, Id the identifier for the objet, and X the measured or observed value. Example 1:

To reproduce and systematize this reasoning, it was chosen a representation of the heterogeneous space of measures and observations as homogeneous quality spaces, and six abstract operations were determined, necessary and sufficient for quality diagnosis and grain grading.

(measure temperature 10) (measure moisture-content 18) (measure ergosterol-content 17) (measure proteins-content 12) (measure visible-living-insects 0) (observation smell musty)

The qualities spaces. One of the main issues in using abstract operators in order to make formal computing from measures and observations, was the translation of heterogeneous data into a homogeneous computing space. Work done on qualitative reasoning, and particularly the Dual formalism developed by Guerrin (1995), seemed particularly efficient to solve this problem. Applying this formalism, it became possible: • to project measures and observations involved in the computing of initial grain grading into a seven elements qualities space EQ = {vvl, vi, I, m, h, vh, vvh} dealing with conditions and storage risks for grain quality degradation (Table 1). • to project measures and observations involved in the computing of grain grading into a qualities space EC whose number of elements is a function of the grain to grade and of the grading method. Example of soft wheat grading quality space with eight final elements {aI , a2, a3 , bI, b2, c, dI , d2}, describing the different uses of wheat floor for food processing (Table 2). • to determine simply the computing operators on these two types of qualities spaces.

The results were four slots objects (T, Id, X, C), where T is the object type, here quality, grade, condition, incompatible-utilisation, alteration-risk or storage-operation, Id is the identifier for the object, X the computed value and C the certitude level assigned to the computed value. Example 2: (quality intrinsic-physico-chemical vvl 0.87) (quality sanitary-safety I 0.74) (quality for-food-processing vvh 0.95) (quality of-grain vvl 0.82) The type measure is a numerical data, and the others - observation, quality, grade, storage-operation, incompatible-utilisation, alteration-risk and condition - are symbolic ones. Each type was defined in a limited interval which was either continuous (e.g. for the temperature) or discrete. The hypothesis of closed world assumption, presented by Reiter (1981) was considered true, which implied that for each object, its possible range of variation was known inside the system.

The computing operators. The operators which can make the link between the human-experts knowledge in the qualities spaces were defined. These operators were build up as ad hoc decision tables. They enabled to put into words the projection laws for measures and observations into the quality spaces, and the combination laws within these spaces. These laws are associated with weighing factors ranging from zero to one (Tables 3,4 and 5).

2.2 Abstract operations

For instance, a store-keeper who would receive grain at 26 °C temperature, and 16% moisture content, would understand that grain condition is hot and humid, and would conclude that there is a high risk of grain alteration by insects or micro-organisms, and certainly would decide to cool or dry this grain in order to decrease the alteration risk.

220

Table 1: General structure of gualities sl2ace EQ

Interpretation

vvl very bad very hot too high too humid

vi bad hot very high

h good fresh low d!:X

m

mediocre half-heated high humid

average normal

vh very good cold very low ve!:X d!:X

vvh excellent very cold null ve!:X ve!:X ~

Table 2: General structure of gualities sl2ace EC

_-_ _-_

ofEC ...Flements .. .. Interpretation

al

a2

Improver

Wheat flour, Pastry

a3 Continuous bread making, Intemsive kneading

bI

b2

Rusks, Accelerated Sandwich loaf, kneading German bread making

Table 4: Example of combination table (sg-mc) of moisture content (MC) and specific gravity (SG) of soft wheat into the Qualities space EQ.

Table 3 : Examl2le of I2rojection table (g-O of the temperature measures et) into the gualities space EQ Variable Temperature (t)

Measure (0C) t$4 4 < t:5 8 8 < t:5 15 15 < t $ 20 20 < t $ 25 25 < t:5 30 30 < t

Qualitative value vvh vh h m I vI vvl

c dl d2 Biscuits Genoises, Wafer secs, Sables, Gateau de biscuit Standard savoie, Petits kneading beurres

Weighing factor 0.9 0 .9 0.9 0 .9 0 .9 0 .9 0.9

SG

sg-mc I m h

vi vvl vvl vvl

m h

MC m I m vh

h vI m h

vh vI I m

vvh vI I I

Table 5: The wheighing tactors (WF) associated to the values of Table 4.

SG

WF m m h

vi I I I

I I I

MC m 0 .8

h 0.9 0.8 I

vh I I I

vvh I 0.9 I

the representative objects for the primary objects, and the non-existence of the object representative for the result. Its effect was a change of the system space status in adding to it a representative object for the result.

The operations. Six abstract operations were defined: Projection, Induction, Deduction, Reduction, Prediction and Criticism. They took one argument (Projection and Induction ), two arguments (Reduction) , or either one or two arguments (Deduction, Prediction, Criticism) . An abstract operation is a relation between one or two objects the primary data used for the computing -, an object to be computed - the result -, and an operator to be executed in order to get the value of the object to be computed. The form of a single argument operation was (T, TD, IdD, TR, IdR, op) where T is the type of the operation. Here, Projection, Induction , Deduction or Criticism, TD, the type of the primary object, IdD, the identifier of the primary objet, TR the type of object resulting from computation, IdR, the identifier of the computed resulting object, and op, the operator to be used to compute the value of the resulting object

Example 3: Projection of temperature {(measure temperature 10) AND NOT(quality temperature ? ?) } !*precondition*! (Projection measure temperature quality temperature !*operation*! q-t) {(measure temperature 10) AND (quality temperature h 0.9)} !*postcondition*!

Propagation of uncertitude.In this situation of an expert domain, events are not necessarily repeatable, and the exact mathematical form for the uncertitude

Appl ying an operation is submitted to preconditions that were: The existence in the system status space of

221

and the relative frequence of errors are unknown. The human expert gave wheight factors to his decision

rules in associating them with a subjective probability which came from his own expertise.

Table 6: Field of awlication of an operation defmed by the types of objects usable as data and the type of resulting objects:

Operation

arity

Primary

Result

Projection

measure observation

quality! grade quality! grade

Induction

quality grade

quality grade

Reduction

2

(quality, quality) (grade, grade)

quality grade

Prediction

2

(measure! observation, measure! observation)

alteration risk

Deduction

1!2

(observation, [observation]) (quality, [quality]) (state, [state])

measure! state quality! state storage operation! complementary test! incompatible utilisation

Criticism

I !2

(quality! grade! state! alteration risk, [quality! grade! state! alteration risk))

state

DI : Visible dead insects

D

© X xx-yy

Abstract object - m_xx: mesure xx - XX : quality xx Abstract operation X: Operation '1(: Reduction XX-YY: operatof I : Induction r

lp:

EC : Ergosterol content HS : Hidden stages of insects JR : Impurity rate U : Visible Jiving insecLo;; MC : Moisture content PI : Presence of insects PM : Presence of micm.. organisms Q : grain initial Quality Qipc : intrinsic & physic~ chemical Quality

Qss : sanitary & safety Quality Qp : processing Quality SW : Specific we ig ht

VS : Visible stages of insects W : bread making quality ZI : Zelcn y index

~ ~

Projection

Figure I: Example of an initial grain quality diagnosis process First, whether the operation is applied to objects without associated certitude factor, second, whether the operation is applied to objects associated to certitude factors. The following definitions were introduced:

These confidence levels were represented by wheighing factors, one associated to each operator, and as certitude factors (Shortliffe et at. , 1985), one associated to each computed object. These factors ranged from zero to one. Their propagation was done following experimental laws established from the number and types of objects to which each operation is applied. It was distinguished between two cases:

CF the certitude factor to compute;

222

CFi the certitude factor associated to the i th object used as an argument of the operation to be applied; N the total number of arguments of the operation to be applied associated to a certitude factor; WF the weighing factor of the operator to be executed; C the confidence level linked to the likelihood of an event, symbolised by the presence of one or several objects in the system status space.

interface has to be built up in order to facilitate parametrizing. The description for the windows and data is loaded at run time. This description is divided in two parts, the manipulated objects (the static part), and their behaviour (the dynamic part). The static part. This part describes all the objects involved. They are the manipulated entities (numbers, insect names, colors, etc.) and the displayable graphical objects (buttons, windows, etc.). These latter objects, at least for some of them, can be associated to a manipulated entity.

ifN=O else {N>O} where f is a function that combinated the CF's, and defined in function of the pair [operation, type of the object to compute] .

This part is written in a language designed to non computer scientists. It is very simple, yet complete. It is close to French, but easily localisable since all the terms used are grouped in a small, independant portion of code.

Then the certitude factor was computed with the formula:

Each action onto the graphical interface is associated to a fact, specified in the description. At run time, these facts are transmitted to the expert system, which becomes informed of what the user does.

CF=CxWF

3. THE USER INTERFACE The dynamic part. This part describes the behaviour of the graphical objects and of the entities of the static part, and their relations. This description allows actions to start when some conditions become true. This part uses the expert system language, which was chosen because it is perfectly adapted to this task.

This part is concerned with the graphical user interface, which allows the user to ignore totally the expert system language, and to exchange intuitively with it. 3.1 The interface ergonomy

This description is a list of couples (condition; action). As stated above, every user act on the graphical interface generates a fact into the knowledge base. When one of the conditions becomes true, the corresponding action is executed (as Common Lisp foreign function calls for example).

For easy learning and using by a non computer specialist, this interface used Windows™ standard controls, as buttons, lists, etc . . These controls were organized following the classical style of Windows™ applications. This interface can be completely controlled with the mouse, and many ergonomical details make it easier to use (as spin-boxes to help entering numbers, insects photographs allowing quick identifying, etc.).

3.3 Software architecture

Once all the needed or available data were entered, the system computed the results and displayed them in natural language (as in a logical sentence « The grain quality is considered as very good. »).

The expert system is written in CLIPS (Giarratano & Riley, 1994), and the graphical interface is written in CLOS (Steele 1990). The execution model for the application is based on the client and server model. The expert system acts as the client and monitors the application, and the graphical interface, as the server.

Over the keywords or groups of keywords displayed with emphasis, the user can ask questions, for instance What is? (for the group grain quality), or Why? (for the group very good). This was done with a simple mouse click on the word(s) displayed with emphasis. When several questions are available, a menu is displayed, allowing the user to choose the question. 3.2 Parametrizing the data entry interface

The client sends requests (orders) to the server, which have a return value. Each value corresponds to the request result. For instance, after a number entry order, the server would return the value actually entered. This return of a value is done in the expert system language, as a fact. It is then the expert system's reponsibility to instanciate this fact, which may then be involved in the automatic rule launching process.

As the system may be regularly changed, to follow the progress in measuring tools and techniques, or to work with a new type of grain, the graphical user

223

4. CONCLUSION

in the australian central grain-handling system. AI Applications, 8, 13-23. MAIER D.E., (1995). Grain Quality Task Force, Quality Grain Needs TLC Grain Quality Newsletter, 16, 3-6. MORRIS CF., RA YKOWSKI J.A., (1994). A computer-aided approach to the evaluation of wheat grain and flour qUality. Computers and Electronics in Agriculture, 11, 229-237. NDIA YE A., FLEURAT-LESSARD F., (1994). Research on an expert system for appropriate management of the quality of stored grain for food and feed processing. Proceedings 94 Int. symp. and exhib. on quality offoodstuffs from cereal grains and oil seeds. Beijing, Nov. 94, Xie Guifang & Ma Zhongdeng. Ed.,537-540. PAS QUAL G.M., MANSFIELD J., (1988). Development of a Prototype Expert System for Identification and Control of Insect Pests. Computers and Electronics in Agriculture, 2, 263-276. REITER R., (1981). On closed world data bases. in Reedings in Artificial Intelligence, Webber & Nilsson Ed., Los Altos, CA. 119-140. STEELE GUY L., Jr., (1990). Common Lisp the Language, 2d edition. Digital Press. SHORTLIFFE E.H, BUCHANAN B.G., (1985). A model of inexact reasoning in medecine. in Rule-based Expert Systems, Addison Wesley, 233-262. WILKIN D.R., MUMFORD J.D., NORTON G., (1991). The role of expert systems in current and future grain protection. Proceedings 5th Int. Working Con! Stored Product Protection, Bordeaux, Sept. 90, 3, Fleurat-Lessard & Ducom Ed., 2039-3046. WRIGLEY CW., GRAS P;W ., BASON M.L., (1994). Maintenance of grain quality during storage - prediction of the conditions and period of 'safe' storage. Proceedings 6th Int. Working Con! Stored Product Protection, Canberra, April 94, 2, 666-670. CAB International, Wallingford.

In implementing a prototype for this knowledge based system in CLIPS and CLOS on a PC running Windows™, we have realized the clear distinction between the knowledge-base, the inference engine, and the user interface. The knowledge base contains declarations for the abstract operations, for the operators, and for the associations between the certitude factors computing methods, the operations, and the type of the object to compute. Example 4: Declaration in CLIPS for the Reduction operation

(deffacts operation-reduction (reduction quality technological quality intrinsic-and-sanitary quality grain qt-xx)

The inference engine contains all the control mechanisms for the operations declared in the knowledge base, and an operation is started as soon as its preconditions are satisfied. Concerning the user interface, we are currently working on an implementation of non monotonous reasoning, which would allow the user to make mistakes while entering data and to correct them without disturbing the reasoning of the inference engine.

ACKNOWLEDGEMENT~

Part of this project has been financially supported by the CONSEIL REGIONAL D'AQUITAINE.

REFERENCES FLINN P.W ., HAG STRUM D.W. , (1990). Stored Grain Advisor : a knowledge-based system for management of insect pests of stored grain. Al Applications, 4, 44-52. GIARRATANO 1., RILEY G., (1994). Expert Systems, Principles and Programming. PWS Publishing Company, Boston, MA. GUERRIN F., (1995). Dualistic algebra for qualitative analysis. Qualitative Reasoning Workshop, Amsterdam, May 95. JONES T.H., MUMFORD J.D ., COMPTON J.A.F., NORTON G.A, TYLER P.S., (1993). Development of an expert system for pest control in tropical grain stores. Postharvest Biology and Technology, 3, 335-347. LONG STAFF B.C , CORNISH P., (1994). PestMan : A decision support system for pest management

224