AN ABSTRACT OF THE THESIS OF Yimin Zenci for the degree of Master of Science in Industrial and Manufacturing Enciineerinci presented on MaY 5, 1993 Title: An Expert System For Softwood Lumber Grading Abstract approved: Dr. Sabah Randhawa The focus of this research is to develop a prototype expert system for softwood lumber grading. The grading rules used in the knowledge base of the system are based on Western Lumber Grading Rules 88 published by the Western Wood Products Association. The system includes 27 grades in Dimension, Select/Finish, and Boards categories. The system is designed to be interactive and menu- driven. The user input to the system consists of lumber size, grade category, and type, location and size of defects for each face. The system then infers the grade corresponding to each face, and an overall grade for the lumber. The system provides limited explanation capabilities. Evaluation of the system was performed using 85 samples of pre-graded Siberian larch 2x4x12s in Structural Light Framing category. The initial evaluation was performed using the two wide faces of boards. Results indicated a 60 percent match between the grade assigned by the human expert and the system. The largest cause of deviation was exclusion of defects on the two narrow faces. The knowledge base was expanded to include the two narrow faces; the match rate improved to 76.5 percent. Evaluations for other grading categories need to be conducted in the future to assess the adequacy of the knowledge base. The prototype development concentrates on selected defect characteristics for each grade. These characteristics are clearly defined and described in the rule book, and are usually the most frequently encountered defects on softwood lumber. The knowledge base needs to be refined and expanded if additional factors such as knot positions relative to each other, warp, manufacturing imperfections and clustering of defects are to be considered. (C) Copyright by Yimin Zeng May 5, 1993 All Rights Reserved An Expert System For Softwood Lumber Grading by Yimin Zeng A THESIS submitted to Oregon State University in partial fulfillment of the requirements for the degree of Master of Science Completed May 5, 1993 Commencement June 1993 APPROVED: Professor of Industrial and Manufacturing Engineering in charge of major Head of Department of Industrial and Manufacturing Engineering Dean of Gradua Sè'hdol Date thesis is presented May 5. 1993 Typed by Yimin Zeng for Yimin Zenci ACIOWLEDGEMENTB I wish to express my deepest gratitude and appreciation to my major professor, Dr. Sabah Randhawa, for his guidance, encouragement and support throughout the course of my graduate study. His tremendous patience and judicious suggestions made possible the successful completion of this thesis. I wish to thank Dr. Kenneth Funk and Dr. Eldon Olsen for contributing their time and expertise while serving on my graduate committee. My very special appreciations go to Dr. James Funk. He spent tremendous amount of time to teach me about lumber production and grading, and to help me to evaluate the system using real lumber. I would also like to thank Dr. Robert L. Ethington and Dr. Rakesh Gupta for providing me with lumber samples. I am grateful to my friend Mr. Johannes B. Forrer. The discussions with him always inspired me. I am deeply indebted to my wife, Yuan Zhong, for her love, understanding, encouragement and help in all aspects of my daily life and graduate studies. I am deeply indebted to my parents and sisters for their deep and eternal love, understanding, encouragement and support. TABLE OP CONTENTS CHAPTER1INTRODUCTION . . 1 CHAPTER 2 RESEARCH OBJECTIVES ............ 7 CHAPTER 3 LITERATURE REVIEW ....... . . . . . . 8 3.1 Programs Using Algorithmic Approach . . . 9 3.2 Programs Using Expert System Approaches . 12 3.2.1 Structure of Expert Systems . . 12 3.2.2 Expert Systems in Lumber Grading . 15 3.3 Systems Developed in Industry ....... 17 CHAPTER4BYSTEMDEVELOPMENT ............ 19 4.1 ProblemDomain .............. 19 4.1.1 Softwood Lumber Grading Practices 19 4.1.2 Grading Categories ....... 2]. 4.2 Knowledge Acquisition and Representation 31 4.2.1 Knowledge Acquisition ....... 31 4.2.2 Knowledge Representation ...... 32 4.3 Inference Mechanism ............ 38 4.4 Tool Selection .............. 43 4.5 Prototype Development ........... 48 4.5.1 Prototype Components ........ 48 4.5.2 Knowledge Base Implementation . 51 4.5.3 Grading Process, Input, and Output . 57 CHAPTER 5 EVALUATION AND ENHANCEMENTS ....... 67 5.1 System Evaluation ............ 67 5.2 System Improvement ............ 69 CHAPTER6CONCLUSIONS ................ 73 BIBLIOGRAPHY .................... 76 APPENDICES Appendix A. Source Code for Structural Light Framing Category ................ 7 8 Appendix B. Test Results Using Generated Data . . . 93 LIST OF FIGURES Figure Page 1.1. Flow chart of a typical sawmill ........ 2 1.2. Flow chart of a typical planer mill ...... 3 3.1. Basic structure of an expert system ...... 13 4.1. Grading categories, sub-categories, and grades included in this project ........ 22 4.2. Basic structure of the prototype ....... 49 4.3. Gradingprocess ............... 58 4.4. Opening window of the run-time version ofthesystein ................ 61 4.5. Dialog box for selecting input method ..... 62 4.6. Dialog box for entering lumber thickness . . . 62 4.7. Dialog box for confirming lumber dimension . . 62 4.8. Dialog box for selecting grade category . . . . 63 4.9. Dialog box for selecting dimension sub- categorr ................... 63 4.10. Dialog box for selecting lumber face ..... 64 4.11. Dialog box with partial defect list ...... 64 4.12. Dialog box with another partial defect list . . 65 4.13. Dialog box for entering knot type and location ................... 65 4.14. Dialog box for entering knot diameter ..... 66 4.15. System output display ............. 66 5.1. Evaluation results considering all factors .................... 68 5.2. Evaluation results when warp, manufacturing imperfections, and measurement bias were not considered................... 71 LIST OF TABLES Table Page 4.1. Grading categories .............. 21 4.2. Grade characteristics considered by the project for grades in Select/Finish's Selectsub-category .............. 24 4.3. Grade characteristics considered by the project for grades in Select/Finish's Finish sub-category .............. 25 4.4. Grade characteristics considered by the project for grades in Boards' Commons sub-category ................. 26 4.5. Grade characteristics considered by the project for grades in Boards' Alternate sub-category ................. 27 4.6. Grade characteristics considered by the project for grades in Dimensions' Light Framing sub-category ........... 28 4.7. Grade characteristics considered by the project for grades in Dimensions' Structural Light Framing sub-category ..... 29 4.8. Grade characteristics considered by the project for grades in Dimensions' Studsub-category ............... 30 4.9. Characteristics permitted and limiting provisions for CONSTRUCTION grade in Light Framing sub-category of dimension lumber . . . 35 4.10. Grading rules for the CONSTRUCTION grade represented using production rules ...... 36 4.11. Source files and their contents ........ 50 LIST OF APPENDICES TABLES Table Bi. Specifications of grades for a piece of Page lumber in the Dimension category (lumber size= 94 B2. Test results of grading the lumber in the Dimensioncategory ............... 95 B3. Specifications of grades for a piece of lumber in the Select/Finish category (lumber size = l"x8"x12') .......... 96 B4. Test results of grading the lumber in the Select/Finish category ........... 97 B5. Specifications of grades for a piece of lumber in the Boards category (lumber size = l"x8"x12') ........... 98 B6. Test results of grading the lumber in theBoardscategory .............. 99 AN EXPERT SYSTEM FOR SOFTWOOD LUMBER GRADING CHAPTER 2 INTRODUCTION Lumber sawiuilling is one of the oldest industries in America. In mills, logs are converted into lumber by sawing, edging and trimming operations (Williston, 1988). At the sawing station, logs are broken down into rough, unedged and untrimmed lumber. The rough lumber is then cut into green lumber in specified width and length at edging and trimming stations. Rough green lumber is then dried and surfaced into finished products. Figures 1.1 and 1.2 show the primary steps in sawmill and planer mills for lumber manufacturing. Configuration of different mills may vary depending upon the log supply and finished products. One of the most important issues concerning the lumber manufacturing industry is the efficiency of raw material usage. Lumber recovery, a term used to describe how much finished lumber is produced from a log or a given population of logs, is used as the primary measure for the performance of a sawmill. The trend is to use computer- based technology to optimize lumber recovery. Trimming and edging stations first used computer technology to obtain optimum cutting patterns of unedged and untrimmed lumber. Later, optimization techniques were used at log breakdown stations where the optimum log breakdown patterns are determined. 2 Raw Material Storage Debark! Buck Log Breakdown Edging Trimming Rough Green Lumber Grading/Sorting/Stacking Rough Green Lumber Storage Drying Dry Storage Figure 1.1. Flow chart of a typical sawmill 3 Unstacking Planing Grading and Trimming Sorting Stacking and Packing Storage Ship Figure 1.2. Flow chart of a typical planer mill The use of optimization techniques at the log breakdown stations has evolved from initially considering only one geometric dimension of a log to where three dimensional features of the log are now being considered. 4 However, currently available models make their "optimum" decisions based only on the log's or the board's geometrical dimensions. An important aspect ignored by the optimization models is the effect of log internal defect type, size, and location on final lumber grade (i.e., recovery and quality). The presence of defects needs to be considered in all manufacturing steps, especially in the log breakdown, edging and triimning operations. More value recovery is expected if an optimization system can combine both geometrical and quality information, and predict lumber grade when making cutting decisions. Natural log characteristics and manufacturing imperfections have a great impact on lumber quality. To provide specified quality levels for end-use, lumber must be graded according to its quality characteristics. Lumber grading is performed in a sawmill or a sawmill and planing mill, and is monitored by authorized agencies who publish grading rules which conform to the American Softwood Lumber Standards (ASLS, 1970). Traditionally, lumber grading is performed by trained human graders through visual inspection. Although computer aided manufacturing techniques have been widely used in modern sawmills, development of an automated lumber grading system was not initiated until recently because of the complexity of grading rules and the difficulties in the detection and recognition of defects using a machine vision system. 5 A lumber grading software package can be invaluable to the lumber manufacturing industry in the following aspects: 1. It can be linked to a log breakdown optimization program, such as SAW3D (Zeng, 1991), to improve lumber recovery. As mentioned before, lumber breakdown optimization programs have been used extensively in sawmills. After receiving log scanning data, the optimization system can determine optimum sawing, edging and trimming patterns to find the best lumber recovery from the given log. Nevertheless, such optimization systems do not consider external and internal defects of the log. As such, the resulting solution is not optimal. From a value stand point, an advanced log breakdown optimization system that considers log defects in addition to other characteristics will be able to provide better solutions. The lumber grading program can be embedded in a log breakdown program (such as SAW3D). 2. It can be coupled with a machine vision system to make an on-line automatic lumber grading system. An on- line automatic lumber grading system consists of two basic components, a machine vision system which performs as human eyes to capture the size and quality characteristics of lumber, and a grading software program which uses the information provided by the machine vision system to determine the grade of lumber. An integrated system should be able to provide more reliable and accurate grading [.1 results than a human grader, and it should be more economical than using .a human grader. 3. It can be used as an instruction tool to aid in training novices and upgrading knowledge of grading personnel. 7 CHAPTER 2 RESEARCH OBJECTIVES The objective of this research was to develop an expert system for softwood lumber grading. The primary objective of developing this system was to link it to a log breakdown optimization system, SAW3D (Zeng, 1991), so that the integrated system can consider both log geometric and quality information when making sawing, edging, and trimming decisions to optimize lumber recovery. Grading rules used in this system were based on "Western Lumber Grading Rules 88" published by the Western Wood Products Association. The research focused on feasibility analysis, and the conceptual and structure design of the system. Therefore, only selected grades and wood characteristics were included in the system. When SAW3D makes optimum log breakdown decisions, some defects such as manufacturing imperfections do not exist. Such defects were not included in the grading system. 8 CHAPTER 3 LITERATURE REVIEW Although the significance of computer lumber grading programs has been recognized and some researchers developed programs for lumber grading in the early 1970's (Hallock and Galiger, 1971), such programs have not been extensively used in industry. One possible reason for lack of use is that a prerequisite for a defect detection system is a machine vision system for lumber grading. Developing a reliable machine vision system is a difficult task. As research on machine vision has evolved, activity in the development of lumber grading programs has also increased. Some prototype automatic grading systems have been recently developed in the sawmill industry. Currently available computer grading programs have been developed for hardwood lumber grading, and use grading rules established by the National Hardwood Lumber Association (NHLA). There are two basic problems that exist while grading lumber: 1) the recognition of the type and seriousness of each defect, and 2) the calculation of usable areas. In grading hardwood lumber, all grades are based on the recognition of defects and the calculation of usable area. The focus of this research is softwood lumber, for which little has been developed in way of automatic grading systems. In contrast to hardwood lumber, softwood lumber grading is primarily based on the recognition of defects; only grades of Factory Lumber need to calculate usable area. Since grading problems for hardwood lumber and softwood lumber are very similar except for the differences in using different grading rules and grading procedures, it is worthwhile to review some of the research for hardwood lumber grading. 3.1 Programs Using Algorithmic Approach Most of the early programs were developed using an algorithmic programming approach. Although the expert system approach has an obvious advantage over the algorithmic approach, lack of good development tools and the requirement of expensive computing facilities prevented use of the expert system approach until recently. Hallock and Gauger (1971) developed a computer program for grading hardwood lumber. The program analyzes the board with its defects, finds the number of cuttings of the sizes permitted, and assigns a grade according to NHL rules. It classifies lumber according to six major classifications. The board and all its defects are described by rectangles in a Cartesian coordinate system; the X-Y coordinates of those rectangles are entered on a series of cards. Once the program receives the input data, 10 it begins the grading process by assigning the board a potential grade based on the board size. This is the highest possible grade for the board without considering defects. Then the defects are checked and the board is assigned a potentially lower grade because of the impact of defects. Next, sizes and number of usable areas are calculated, and the board is assigned the final grade. The program was developed in FORTRAN. The authors believed the program's accuracy to be well within NHLA tolerances. However, some limitations exist. For example, grading rules and procedures were all coded into the program algorithms. This programming practice makes modification and expansion of grading rules difficult. Additionally, the algorithms considered only one face of the board, whereas both faces of a board are evaluated in the actual grading process. Klinkhachorn et al. (1988) created a hardwood lumber grading program as part of an automated lumber process system. The program was implemented using FORTRAN 77 for an IBM PC or compatible. After reading in the board dimensions and defect types and their location on each face, the program assigns a potential grade to each face. Next the program calculates usable area to determine the final grade assigned to the board. This program improved upon the previous efforts by considering both faces of the board and applying a more flexible grading procedure which provides the option of admitting or excluding certain types 11 of defects when searching for cuttings. In addition, the program uses the BLOCK DATA feature of FORTRAN 77 to logically separate grading rules from the program logical code so that reconfiguration of the grading rules is easier. When grading rules need to be modified, only the data specified in the BLOCK DATA segment need to be changed. Klinkhachorn et al. (1989) presented a computer-aided instruction tool, named HaLT (Hardwood Lumber Training) for training hardwood lumber graders. The HaLT system incorporates a graphic user interface and explanation facility in the hardwood lumber grading program discussed above. The interface provides graphic views of the board including each side of the entire board with defects or the expanded view giving the detailed section of the board, asks questions, compares answers, and provides reasoning. The program runs on an IBM PC or compatible. The objective is to provide the lumber industry with an interactive learning tool to educate and train their graders on-site. Klinkhachorn et al. (1991) improved their previous program (Klinkhachorn et al, 1988) by converting the code from FORTRAN 77 to C, and restructuring it. The grading rules for various species, the mechanical dimensions of a board, the violations of the various rules, and the grade of the board are all mathematically represented in terms of program variables in data structure so that the program 12 data are logically separated from the program code. This enhances the program's capabilities, its adaptability and portability, and makes the restructuring of grading rules easier. 3.2 Programs Using Expert System Approaches 3.2.1 Structure of Expert Systems An expert system is a computer program that uses knowledge, facts, and reasoning techniques to solve problems that normally require the abilities of human experts. Expert system architectures include different components. However, certain components are common to most expert systems. These include a user interface, a knowledge base, and an inference engine. Figure 3.1 shows the basic structure of an expert system. The interface provides the communication between the user and the system. It allows the user to query the system, enter facts about a specific situation that is relevant to the system's subject domain, and receive advice, consultation and explanation. Many expert systems also accept new knowledge through the user interface. The knowledge base contains expert-level knowledge on the system's subject domain. The knowledge can be obtained from books and publications, and/or from one or more human experts, and is stored using a knowledge representation 13 scheme. The inference engine provides the reasoning capabilities of the system. It uses the domain specific knowledge in the knowledge base and facts provided by the user to infer new facts that may be conclusions to goals and subgoals as required by the system. The inference method is built into the inference engine, while the domain specific knowledge is contained in the knowledge base. The general problem solving knowledge and the domain specific User User Interface Inference Engine Knowledge Base Figure 3.1. Basic structure of an expert system 14 knowledge are separated, thus the same inference engine can be used to reason with different knowledge bases. In addition to those basic components, many expert systems have various supplemental components, including knowledge acquisition facilities, knowledge-base maintenance and update facilities, explanation facilities, self-training facilities, and validation tools. Expert system techniques are very appropriate to problems for which human expertise is required, which. need symbolic reasoning but cannot be easily handled numerically or algorithmically, or for which information required for a solution is incomplete or uncertain. The lumber grading problem is declarative rather than algorithmic in nature. The grading process involves symbolic rather than numeric reasoning. Maintaining and updating grading rules is required as criteria change over time, and from one mill to another. In some cases, data about a defect may be uncertain. If used as an instruction tool, explanation on the actions and conclusion would be necessary. All these facts indicate that while an algorithmic approach is possible, the expert system approach is more appropriate. Using the expert system approach for lumber grading has the following advantages over the algorithmic approach: 1. In knowledge-based systems, lumber data and grading rules are stored in a knowledge base which is decoupled 15 from the program logic. Hence, modification and expansion of grading rules can be made easily without affecting the program logic. 2. When used as a computer-aided instruction (CAl) tool, knowledge-based systems are more appropriate because they provide consultation and explanation capabilities required in training situations. 3. Rules-of-thumb used by grading experts can also be incorporated in the knowledge base to supplement the rules from publications, and to speed up the grading process as these may result in reducing the search space. Furthermore, due to the separation of the knowledge base from the program logic, customization of such rules can be easier. 3.2.2 Expert Systems in Lumber Grading Huang and sparrow (1989) developed a CAl tool for hardwood lumber grading using the expert system approach. The expert system consists of five main components: a knowledge base, an inference engine, a procedure for calculating the usable area, a user interface facility, and an explanation subsystem. The knowledge base contains facts and rules. Facts include lumber data, current data, and information derived from the rules. Rules are the conditions and restrictions for judging the grades of the boards. Knowledge is represented by rules and working memory elements. A forward-chaining inference mechanism is 16 used. The system was implemented using the LISP language and runs on the VAX 11/780 computer. The program facilitates the training of professional hardwood lumber graders by providing consultation and explanation of lumber grading procedure in an interactive question-answer process. Lumber data, including lumber dimensions, types and sizes of defects, need to be entered by the user. The program instructs the user in three steps: 1) to judge grades of the two faces based on a combination of defect types and sizes; 2) to judge grades of the two faces based on calculation of usable areas on both faces; and 3) to judge the overall grade of the board. At each step, it asks the user to determine a tentative grade, and then explains the user's mistakes, if any. Otherwise, it provides an explanation of the process of reaching the correct grade. The program reduces the training costs by decreasing the need to rely solely on an expensive human instructor, and increases the speed and retention rates of students because it offers a flexible time table that makes it more convenient for the student to work at his/her own pace. The knowledge base is limited in the system. Among over 100 types of hardwood lumber, only two types (walnut and poplar) were chosen for this initial work. Softwood lumber grading programs using the expert system approach have not been developed. 17 3.3 Systems Developed in Industry As mentioned before, lumber recovery optimization systems based on dimension scanning have been widely used in sawmills. While more complete geometric information is included in recent three-dimensional scanning and optimization systems, higher recovery is to be expected if the defect information along with the dimensional data is used in making cutting decisions. Though some corporations have been developing grade scanning and optimization systems which combine both dimension and quality information for logs and lumber in making optimum decisions, there is little information available in published literature. In addition to the difficulty of accessing information from industry, available papers focus on defect detection systems, as compared to implementing grading rules in their programs. This is not surprising since the development of real time defect detection systems has been a long time barrier in this area. VisionSmart Inc. of Canada developed a Grade-based Optimizer system which uses a camera to scan all features related to dimension and wane, and an X-ray sensor array to detect knots and other density related features such as compression wood and pitch pockets (Flatman and Bodell, 1989; Flatinan and Kenway, 1991; Kenway, 1990; Aune, 1991). Other features such as shakes, checks, holes, and 18 stains are detected by cameras operating under different lighting than the lighting for the camera used for dimension and wane. The system combines both profile and defect data and then determines optimum cutting solutions for maximum value return. The system can be used either for green lumber or for dry lumber. A Grade-Based Edger Optimizer was installed in MacMillan Bloedel's Alberni Pacific Division sawmill in March, 1989. The Edger Optimizer scans wet green lumber for grading features and based on the scanning data, uses a dynamic programming algorithm to determine an optimum edging solution. The Edger Optimizer showed a $160,000 return per month, as measured by the mill. A Grade-Based Trimmer Optimizer was also installed in CANFOR'S Fort St. John Mill in May 1990, where dry lumber is scanned after planing and the optimum trimming solutions calculated. The Coe Manufacturing Company developed the D*TEC GradeScan system that is able to detect knots, splits, pockets, stain and decay, as well as wane and dimensions1. The edger, trimmer and planer mill applications manufactured by the company have been equipped with the GradeScan system so that both defects and shape can be considered when optimizing for value recovery. The Coe Manufacturing Company. 1991. Company brochure. Portland, Oregon. 19 CHAPTER 4 SYSTEM DEVELOPMENT 4.1 Problem Domain 4.1.1 Softwood Lumber Grading Practices Lumber grading is performed in a sawmill or a planer mill by human graders. The graders evaluate each piece of lumber and make their decision according to grading rules as specified by regional association, proprietary, or national grading rules. The following çiescriptions are given in Western Lumber Grading Rules 88 (1988): The grading of lumber cannot be considered an exact science because it is based on either a visual inspection of each piece and the judgment of the grader or on such visual inspection and judgment combined with the results of method of mechanically determining the stiffness characteristics of structural lumber. The results are, however, sufficiently explicit to establish a maximum of 5 percent below grade as a reasonable variation between graders. In general, American Standard softwood lumber is classified according to use, manufacturing, and size 20 classifications. Grading of lumber is based upon a visual inspection and is primarily a judgment of end-use strength or appearance. Natural log characteristics which have an effect upon strength are, taken into account along with manufacturing imperfections. In most cases these include limiting provisions on characteristics such as stain, checks, grain, skip, cup, crook, wane, twist, knots, holes, pitch, pocket, split, steaks and patches, shakes, decay, and cutout. Definitions and detailed descriptions of these characteristics can be found in the Western Lumber Grading Rules 88 (1988). Grading rules applied to softwood lumber for domestic market are governed by National Bureau of Standards Voluntary Product Standard PS 20-70 (American Softwood Lumber Standard, 1970). All of the grading rule books which are published by grading organizations are based on this standard. The two largest grading organizations on the West Coast are the Western Wood Products Association (WWPA) and the West Coast Lumber Inspection Bureau (WCLIB). In 1986, nearly 35 percent of the nation's softwood lumber production was graded under WWPA supervision. This research project will use the grading rules published by the WWPA as described in the Western Lumber Grading Rules 88 (1988). 21 4.1.2 Grading Categories According to the WWPA, lumber is classified into one of the following five categories (Table 4.1) based on the size and end-use: Select and Finish lumber, Boards, Dimension, Timbers, and Factory lumber and related products. Table 4.1. Gradinci cateaories Name of category Nominal Size Judgment on Use EmphasisThickness Width Selects and Finish______________ 3/8" - 16/4" >= 2" appearance Boards 3/4" - 16/4" >= 2" appearance Dimension 2" - 4" >= 2" strength Timber >= 5" >= 5" strength Factory any any remanufac- turing Each major category is further grouped into many sub- categories and each sub-category includes many grades. Since the focus of this project is prototype development, it considers only grading rules for Select/Finish, Boards, and Dimension categories. Figure 4.1 show these categories and their sub-categories, and the grades selected for this project implementation. 22 Grading Category 8ub-categorv Grade B&BTR - l&2 CLEAR Selects C SELECT D SELECT Selects and Finish SUPERIOR FINISH h PRIME FINISH E FINISH Boards Dimension 1 COMMON 2 COMMON Commons 3 COMMON 4 COMMON 5 COMMON SELECI MERCHJNTABLE Alternate CONSTRUCTION Board STANDARD Grades UTILITY ECONOMY CONSTRUCTION Light STANDARD Framing UTILITY ECONOMY SELECT STRUCTURAL Structural NO. 1 Light NO. 2 Framing NO. 3 ECONOMY Stud STUD I ECONOMY Figure 4.1. Grading categories, sub-categories, and grades included in this project 23 Characteristics and limiting provisions for each grade include wood defects and manufacturing imperfections, and their type, size, location and distribution. Tables 4.2 to 4.8 give the characteristics for each grade as described by the rule book, and show the characteristics included in the scope of this project. There are two primary reasons for focusing on a subset of the grading rules. First, in many applications, not all characteristics listed in the rule book appear on lumber. At this initial development stage, only the most frequently occurring characteristics are included in the system. The focus was on conceptual design and testing the feasibility of the expert system approach. The system design is such that the knowledge base can be easily refined and extended. Second, the system is planned to be used as a component embedded into SAW3D (Zeng, 1991), a log breakdown optimization system. When SAW3D makes optimum breakdown decisions, manufacturing imperfections are not included. For example, warp, such as bow, crook, cup and twist, are not included. 24 Table 4.2. Grade characteristics considered by the project for grades in Select/Finish's Select sub- cateciory Character- istics Grade (Selects/Finish - Selects) B&BTR - l&2 CLEAR C SELECT D SELECT Stain Y Y Y Checks Y Y Y Splits N/A - Y N/A - Y Y Torn Grain N N N Skips N N N Cup N N N Crook N N N Wane Y Y Y Twist N N N Knots Y Y Y Holes N/A-Y Y Y Pitch Y Y Y Pockets Y Y Y Pitch Streak_____________ N/A N N Cutout N/A N/A N Y Listed in the rule book and considered by the project N : Listed in the rule book, but not considered by the project N/A : Not listed in the rule book and not considered by the project N/A - Y : Not listed in the rule book, but considered by the project 25 Table 4.3. Grade characteristics considered by the project for grades in Select/Finish's Finish sub- cateciory Character- istics Grade (Selects/Finish - Finish) SUPERIOR FINISH PRIME FINISH E FINISH Stain Y Y Y Checks Y Y Y Splits Y N/A - Y Y Torn Grain N N N Skips N N N Cup N N N Crook N N N Wane Y Y Y Twist N N N Knots Y Y Y Holes N/A-Y Y Y Pitch Y Y Y Pockets Y Y Y Pitch Streak_____________ N N N White Speck____________ N/A N N Cutout N N N Chip Marks N N N Y : Listed in the rule book and considered by the project N : Listed in the rule book, but not considered by the project N/A : Not listed in the rule book and not considered by the project N/A - Y : Not listed in the rule book, but considered by the project Table 4.4. Grade characteristics considered by the project for qrades in Boards' Commons sub-cateqory Character- istics Grade_(Boards - Commons) 1 COMMON 2 COMMON 3 COMMON 4 COMMON 5 COMMON Stain Y Y Y Y Y Checks Y y y y y Torn/Raised Grain_______ N N N N N Skips N N N N N Cup N N N N N Crook N N N N N Wane Y Y Y Y Y Twist N N N N N Splits y y y y y Streaks and Patches N/A N N N N Pitch Y Y Y Y y Pockets Y Y Y Y Y White Speck Honeycomb N/A N/A N N Y Unsound N/A N/A N N Y Shake N/A N N N N Roller Checks N/A N N/A N N Pith Y Y N/A N/A Y Knots Y Y Y Y Y Holes N/A-Y Y Y Y Y Y : Listed in the rule book and considered by the project N : Listed in the rule book, but not considered by the project N/A : Not listed in the rule book and not considered by the project N/A - Y : Not listed in the rule book, but considered by the project 27 Table 4.5. Grade characteristics considered by the project for grades in Boards' Alternate sub-category Character- istics Grade (Boards - Alternate) SEL- MERCH CONST STAND UTIL ECONOMY Stain Y Y Y Y Y Checks Y Y Y Y Y Torn/Raised Grain_______ N N N N N Skips N N N N N Cup N N N N N Crook N N N N N Wane Y Y Y Y Y Twist N N N N N Splits Y Y Y Y Y Streaks and Patches N N N N N Pitch Y N/A N/A N/A Y Pockets Y Y y y y White Speck Honeycomb________ N N/A N N Y Unsound Wood N N/A N/A N Y Shake N/A N/A N N N Roller Checks N N/A N/A N/A N Pith N/A N/A N/A N/A Y Knots Y Y Y Y Y Holes Y Y Y Y Y Burls N/A N/A N/A N N Y : Listed in the rule book and considered by the proj ect N : Listed in the the project N/A : Not listed in by the project rule book, but not considered by the rule book and not considered 28 Table 4.6. Grade characteristics considered by the project for grades in Dimensions' Light Framing sub- cateaorv Character- istics ______________ Grade (Dimension - Light Framing) CONST STAND UTIL ECONOMY Checks Y Y Y y Knots Y Y Y Y Holes Y Y Y Y Manufacture N N N N Pitch Y Y Y Y Pitch Streaks N N N N Pockets Y Y y y Shake N N N N Skips N N N Y Slopeof y y y y Splits Y Y Y Y Stain N N N N Wane Y Y Y Y Warp N N N N Unsound Wood N/A -Y Y I Y White Speck N/A N N N Y : Listed in the rule book and considered by the project N : Listed in the rule book, but not considered by the project N/A : Not listed in the rule book and not considered by the project N/A - Y : Not listed in the rule book, but considered by the project 29 Table 4.7. Grade characteristics considered by the project for grades in Dimensions' Structural Light Framing sub-category Character- istics Grade (Dimension - Structural Light Framing) SEL- STR NO.1 NO.2 NO.3 ECONOMY Checks Y Y Y Y Y Grain N N N N/A N Knots Y Y Y Y Y Holes Y Y Y Y Y Manufacture N N N N N Pitch Y Y Y Y Y Pitch Streaks N N N N N Pockets Y Y Y Y Y Shake N N N N N Skips N N N N N Slopeof Grain_______ Y Y Y Y Y Splits Y Y Y Y Y Stain N N N Y Y Wane Y Y Y Y Y Warp N N N N N Unsound Wood N/A-Y N/A-Y Y Y Y White Speck N/A N/A N N N Y : Listed in the rule book and considered by the project N : Listed in the rule book, but not considered by the project N/A : Not listed in the rule book and not considered by the project N/A - Y : Not listed in the rule book, but considered by the project 30 Table 4.8. Grade characteristics considered by the project for grades in Dimensions' Stud sub-category Character- istics Grade (Dimension - Stud) STUD ECONOMY Checks Y Y Grain N/A N/A Knots Y Y Holes Y Y Manufacture N N Pitch Y Y Pitch Streaks N N Pockets Y Y Shake N N Skips N N Slope of Grain Y Y Splits y y Stain N Y Wane Y Y Warp N N Unsound Wood Y y White Speck N N Y : Listed in the rule book and considered by the project N : Listed in the rule book, but not considered by the project N/A : Not listed in the rule book and not considered by the project N/A - Y : Not listed in the rule book, but considered by the project 31 4.2 Knowledge Acquisition and Representation 4.2.1 Knowledge Acquisition Knowledge acquisition deals with the issue of acquiring information about the problem domain. Knowledge used in problem solving may be based on experiences of one or more human experts, case histories, reference sources, etc. The key source of knowledge for this project is the grading rules. These are based upon the "Western Lumber Grading Rules 88" published by the Western Wood Products Association (1988). Compared with many other expert systems, the knowledge acquisition task for this project is relatively simple because most grading rules are well defined in the rule book. However, the rule book cannot give all the information required to perform the grading task accurately and efficiently. First, some of the rules are not explicitly defined. For example, certain grades allow "several" as the number of certain defects. However, "several" is not precisely defined. Second, the rule book just stipulates characteristics and limiting provisions, but not the grading procedures. In practice, grading procedures affect the speed with which lumber is graded. For instance, knots are the most frequently encountered defects. Looking for frequently encountered defects accelerates the grading process. Third, as mentioned 32 before, grading is more of an art than a science, and the results depend on the inspection and judgement of the grader. Five percent variation from standards is accepted as a reasonable difference between graders. Some mills and markets may use their local rules, and take advantage of the allowed variations. This may involve specific knowledge not documented in the rule book. Thus, the knowledge base using grading rules from the rule book can be refined based on actual grading practices. 4.2.2 Knowledge Representation The domain knowledge must be well organized and structured in the knowledge base, thus allowing the inference mechanism of the expert system to operate on it effectively and efficiently. There are many ways to represent domain knowledge, including production rules, frames, semantic networks, and first-order logic. Perhaps the most frequently used representation scheme is production rules. Production rules represent knowledge in the following form: IF (list of antecedents) AND OR NOT THEN (list of consequents or actions). 33 This format is almost identical to the description of grading rules stipulated in the rule book. Thus, the scheme of production rules is intuitively the best representation scheme for the domain knowledge for this project. The grading rules are of the following form: IF (list of characteristics permitted and limiting provisions) THEN Grade x. For example, consider the CONSTRUCTION grade in the Light Framing sub-category of dimension lumber. The characteristics permitted and limiting provisions for this grade are summarized in Table 4.9. These can be listed as the condition part of a production rule; the conclusion of the rule will be grade CONSTRUCTION if all the conditions are satisfied. However, such a single rule containing a description of all the characteristics will be inefficient because the inference process will be long. A better representation mechanism is to break down a single rule into several smaller rules where each component rule focuses on a distinct characteristic. Since the example in Table 4.9 has eleven components, the 11 rules shown in Table 4.10 may be used to represent the CONSTRUCTION grade. Finally, Rule 12 integrates the conclusions derived from 34 the individual sub-components. In this illustrative example, not all characteristics are included in the rules. For instance, spike knots and stains are not considered. Also, streaks and pockets are not listed because they have no impact on the grading result. Some rules, such as Rules 5, 7, and 11, need more details or other higher level rules to provide the antecedents. 35 Table 4.9. Characteristics permitted and limiting provisions for CONSTRUCTION grade in Light Framing sub-category of dimension lumber Character- Provisions istics Checks Surface seasoning checks not limited. Through checks at ends are limited as splits. Knots Sound, firm, encased and pith, must be tight and are permitted in the following sizes or their equivalent displacement: Unsound or Nominal Anywhere Loose Knots Width On Wide Face and Holes 2" 3/4" 5/8" 3" l&]./4" 3/4" 4" l&l/2" 1" Knots spiked entirely across the wide face are limited to a displacement of approximately 1/4 the cross section. Nanufacture Standard "E". Pitch and Not limited. pitch steaks Pockets, pitch Not limited. or bark Shake Several heart shakes up to 2' long, similar to seasoning checks, none through. Skips Hit and miss on 10% of the pieces. Slope of grain 1 in 6. Splits Equal in length to the width of the piece. Stain Stained sapwood. Firm heart stain or firm red heart. Wane 1/4 the thickness, 1/4 the width. 5% of the pieces may have wane up to 1/2 the thickness and 1/3 the width for 1/4 the length. Warp 1/2 of medium. Table 4.10. Grading rules for the CONSTRUCTION grade represented usinq production rules Rule 1: IF NO through checks at ends OR longest through check at end <= lumber width THEN Checks satisfy grade CONSTRUCTION Rule 2: IF NO firm knots on face OR (lumber width = 2" AND diameter of largest firm knot <= 0.75") OR (lumber width = 3" AND diameter of largest firm knot <= 1.25") OR (lumber width = 4" AND diameter of largest firm knot <= 1.5") THEN firm knots satisfy grade CONSTRUCTION Rule 3: IF NO loose knots on face OR (lumber width = 2" AND diameter of largest firm knot <= 5/8") OR (lumber width = 3" AND diameter of largest firm knot <= 3/4") OR (lumber width = 4" AND diameter of largest firm knot <= 1") THEN loose knots satisfy grade CONSTRUCTION Rule 4: IF NO holes on face OR (lumber width = 2" AND diameter of largest hole <= 5/8") OR (lumber width = 3" AND diameter of largest hole <= 3/4") OR (lumber width = 4" AND diameter of largest hole <= 1") THEN holes satisfy grade CONSTRUCTION Rule 5: IF manufacture standard is "E" THEN manufacture satisfies grade CONSTRUCTION Rule 6: IF NO shakes OR (NO through shakes AND length of largest shake <= 2') THEN shakes satisfy grade CONSTRUCTION 37 Table 4.10. (Continued) Rule 7: IF NO skips OR hit and miss on <= 10% pieces THEN skips satisfy grade CONSTRUCTION Rule 8: IF slope of grain <= 1/6" THEN slope of grain satisfies grade CONSTRUCTION RULE 9: IF NO splits OR length of longest split <= lumber width THEN splits satisfy grade CONSTRUCTION RULE 10: IF NO wane OR (thickness of wane <= 1/4 lumber thickness AND width of wane <= 1/4 lumber width) THEN wane satisfies grade CONSTRUCTION RULE 1.1: IF NO warp OR warp <= 1/2 medium THEN warp satisfies grade CONSTRUCTION RULE 12: IF checks satisfy grade CONSTRUCTION AND firm knots satisfy grade CONSTRUCTION AND loose knots satisfy grade CONSTRUCTION AND holes satisfy grade CONSTRUCTION AND manufacture satisfies grade CONSTRUCTION AND shakes satisfy grade CONSTRUCTION AND skips satisfy grade CONSTRUCTION AND slope of grain satisfies grade CONSTRUCTION AND splits satisfy grade CONSTRUCTION AND wane satisfies grade CONSTRUCTION AND warp satisfies grade CONSTRUCTION THEN grade is CONSTRUCTION 38 4e3 Inference Mechanism Given a knowledge base, an expert system performs inference or deduction to arrive at conclusions. For rule- base systems, the logic deduction is based on the following modus ponens: Given the rule: IF antecedent 1 AND antecedent 2 AND antecedent N THEN conclusion 1 and facts: antecedent 1 antecedent 2 antecedent N, it is possible to infer that conclusion 1 is true. Facts and rules are basic components of the knowledge base. The reasoning process involves looking for facts and using rules to arrive at conclusions. Inference strategies used in expert systems include backward chaining, forward chaining, breadth-first search, depth-first search, heuristic search, problem reduction, pattern matching, hierarchical control, unification, and event-driven control. Selection of a proper strategy for 39 an expert system depends on the knowledge representation scheme used in the system. Matching the task to the correct combination of knowledge representation and inference strategy is a complex task. For rule-based systems using production rules as the representation scheme, the major inference strategies used are backward chaining, forward chaining, or a combination of these two strategies. These strategies are primarily used to specify how rules contained in a knowledge-base are to be processed. Backward chaining is also called goal-driven inference. It begins with the selection of a goal using some selection criterion, then tries to prove that the goal is true. A goal is the conclusion of a rule. The process usually starts with matching existing facts with antecedents of that rule. If the required facts cannot be found, the inference engine then looks for rules that may have the required facts as their conclusions. This may direct the search process to sub-goals. If the required facts still cannot be found, the system may begin a query process if the facts can be obtained from the user. Otherwise the system will select another goal and repeat the process until a solution is found or there are no more goals to be checked. To illustrate how this strategy works, assume that there is a piece of lumber 2 inches in nominal thickness, 40 4 inches in width, and 10 feet long. There are no defects on its face except for a few well spaced firm knots. Assune that the largest knot has a diameter of 0.5 inches. The rules in Table 4.10 show that the grade of this piece of lumber is CONSTRUCTION in the light framing category of dimension lumber. The backward chaining process starts by selecting a grade from the 27 grades listed in Figure 4.1, and then tries to prove that this grade is the appropriate one. Assume that the grade selected is CONSTRUCTION. The system first looks for facts that are antecedents of Rule 12. Since these facts do not exist at this stage, it looks for rules 1 through 11 which have those facts as conclusions and tries to prove that rules 1 through 11 are true. To prove these rules, additional information is required. This can be obtained from the user, or by a search for more rules. Once rules 1 through 11 are proven to be true, all antecedents in Rule 12 are generated a.s new facts. This in turn proves that Rule 12 is true and the grading process is completed. If the selected initial grade is not CONSTRUCTION, the process may fail to find a solution; another grade may then be selected, and the process is repeated until a grade is found. This strategy is best suited for the problems with many initial facts but relatively few solutions. It has been successfully used for diagnostic problems. However, for the lumber grading problem, it is not the appropriate 41 method. One reason is that there are a large number of characteristics that need to be checked before a grade can be determined. It can be very inefficient if a wrong grade (a goal) is assumed. Another reason is that this inference mechanism is not analogous to the human grading process where conclusions are reached based on facts. The forward chaining inference mechanism, also called data-driven chaining or reasoning, starts with existing facts and works on deducing new facts that will eventually lead to the goal. The inference process works in the following cycle: 1) Matching rule(s): find all rules whose antecedents are satisfied by working storage (that is, where existing facts are stored). The collection of such rules is called the conflict set. 2) selecting rule(s): When more than one rule matches the facts, apply a conflict resolution strategy to determine which rule will be selected among those rules. Various conflict resolution strategies have been used for forward chaining systems, including: Do One: Select the first rule that matches the facts. Do All: Apply all the matching rules in one batch. 42 Do in Seauence: Apply the matching rules one at a time. Do the Most Specific: Select the more specific rule. Do the Most Recent: Select the one that matched a most recently derived fact. 3) Executing rule(s): the selected rule is proved, also called "fire the rule", and the working storage is updated with fact(s) of the newly fired rule. 4) The process is repeated until a solution is found or no more rules can be applied. For the lumber example used to illustrate backward chaining, the forward chaining process will start by collecting all the defect information, and storing it in the working storage (memory). It then tries to find all rules whose antecedents are matched with the existing facts. For the given data, it will conclude that antecedents of rules 1 through 11 exist in the working storage. Thus rules 1 through 11 are placed in the conflict set. Selection and firing of these 11 rules result in the facts that match the antecedents of Rule 12; these are then placed in the working storage. Now Rule 12 is also put into the conflict set because all of its antecedents are satisfied. Finally, firing Rule 12 results 43 in the CONSTRUCTION grade for the specified input data. The forward chaining procedure is best used to solve problems in which data is to be used as the starting point for problem solving. It is intuitively the most appropriate method for the lumber grading problem; it also matches the human grader's reasoning process. The inference used in this implementation is the forward chaining inference mechanism. 4.4 Tool Selection After identifying an appropriate knowledge representation scheme and inference mechanism, the next phase in the development process is to select the implementation software. Four options were considered for this project: conventional programming languages, knowledge engineering languages, knowledge-based programming tool kits, and knowledge-based programming shells. Conventional languages, such as C, C++ and Pascal, can be used to implement a knowledge-based system. They support a broad range of machine platforms. Compared with other options, they are very flexible and efficient in terms of execution speed and memory usage. The major disadvantage is that the development time is long requiring extremely large amount of coding. This option is obviously 44 not recommended for rapid prototyping and system design. Knowledge engineering languages, such as LISP and PROLOG, support symbolic manipulation and/or have built-in inference engines. They are very powerful and efficient when used on the right platforms such as LISP machines and work stations. However, the opposite is true on microcomputers. Since this project selected microcomputers as the implementation platform, this option also did not represent the best choice. Knowledge-based programming toolkits, such as KEE, OPS5, ART, Clips and Eclipse, are somewhat like high-level languages. While relieving the programmer from the burden of tedious coding by providing built-in knowledge representation schemes and inference engines, they do require some programming following their syntax so that maximum flexibility can be achieved. This option was considered appropriate for this project. Knowledge-based shells usually provide a complete development environments. The programmer does not need to do any real programming. However, they are usually expensive and have limited flexibility. This option was prohibitive due to the cost involved and the flexibility required by the project, particularly interaction with external systems. Several features were required of the development tool to be used. First, the tool should support rule-based 45 knowledge representation and a forward chaining inference mechanism. Second, the system should interact with C/C++ programs since the intended use of this product is to integrate it into SAW3D, a log breakdown optimization program written in C. Therefore, support of links between this project and any ANSI C/C++ compiler was considered to be an important feature of the development tool. Third, the tool should be run on an IBM-PC and support protected mode memory access. The knowledge base can potentially be so large that the 640k conventional memory limitation can become an obstacle. Fourth, the tool should be financially feasible. Other considerations included user interface and explanation facilities, ease of learning and use, documentation, and technical support. Considering the above factors, Eclipse, a commercial rule-based programming tool from The Haley Enterprise (The Haley Enterprise, 1991), was selected as the implementation tool for this project. Eclipse supports the features described above, including rule-based knowledge representation, a forward chaining inference engine, running under protected mode and integration with other applications. The syntax for Eclipse is derived from Inference Corporation' s ART (for Automatic Reasoning Tool), and is compatible with NASA'S Clips (for C Language Integrated Production System). The basic syntax uses LISP-like prefix 46 notation and parentheses. Eclipse uses the Rete Algorithm, which is one of the most efficient techniques for performing complex pattern matching of the type used in rule-based systems (Forgy, 1979, 1982). Although many other tools also use the Rete Algorithm, some benchmarks and applications have proven that Eclipse is superior to many other tools in terms of execution speed and program size2 (Brooke, 1992). For example, it runs four times as fast as Clips on 386 machines and requires roughly one half the memory of Clips. Eclipse supports more advanced functionality and better integration, especially on personal computers. It supports more powerful logical reasoning capabilities and provides more expressive pattern matching. One of Eclipse's best features is its integration capacity. It supports two-way integration, integrating other applications into Eclipse, and Eclipse into other applications. Other applications can be integrated into Eclipse by calling routines written in the C language, in some cases even Pascal or FORTRAN. Eclipse toolkits are provided with run-time libraries and source code necessary to construct applications which embed Eclipse. It allows declarative domain and procedural control knowledge to be explicitly separated and codified using rules or 2. The Haley Enterprise, Inc. 1992. Company brochure. Sewickley, PA. 47 procedures, retaining more of the advantages of a pure production system even when the requirement to procedurally control and embed a knowledge-base is implemented within any real application. The Microsoft Windows version of Eclipse has a real- time WYSIWYG (What You See Is What You Get) development interface. It provides knowledge base monitoring windows which can be used to simultaneously view the relations between facts and goals, and the match states of any number of rule sets, agenda, rules, joins, patterns, templates, relations, facts, matches, etc. Each of these views is supported in real time as commands or rules are executed. In effect, these modeless dialog windows allow full manipulation and monitoring of all knowledge base components, scheduling and pattern matching activities. The windows version also supports dynamic data exchange (DDE). This support provides more communication methods between Eclipse and other applications. Using this feature, Eclipse commands can be passed from other applications and Eclipse can issue commands to other applications. Eclipse can request and respond to requests for data from other applications. Dynamic link libraries (DLLs) are also provided in the Windows version. This research uses the Windows version of Eclipse. 48 4.5 Prototype Development Expert systems are best developed using an incremental prototyping methodology. A running prototype should be developed at an early stage. The prototype deals with a restricted portion of the problem domain; nonetheless, it will validate the feasibility and conceptual design of the system. After the prototype has been constructed, it can be extended into a fully functional system while its basic structure is preserved. 4.5.3. Prototype Components The prototype for this project has four basic components as shown in Figure 4.2. The user interface collects data from the user and provides the grading results. The inference engine is a built-in component of Eclipse. The knowledge base contains selected grading rules. The explanation facility consists of a set of rules for tracing back the facts upon which the grading results are based. At the beginning of system execution, the user loads the knowledge base, and then enters data describing lumber size and defect characteristics via the user interface. The inference engine tries to map the input data to one or more proper grades by performing the reasoning process on the input data and the knowledge base. Finally, the user 49 interface shows the final grades resulting from the matching process, along with explanations. The knowledge base is implemented in several source files. Each file contains grading rules for a sub-category of a category (see Table 4.11 for explanation). The user can load one or more of them, depending on the grading categories to be worked on. The user interface is implemented using rules and functions, and is contained in User Interface Inference Engine j Explanation Facility Knowledge Base Figure 4.2. Basic structure of the prototype 50 a separate file. Also, separate files contain output printing and some supplemental control strategies. Table 4.11 summarizes the file list used in the system. When using the Eclipse development toolkits, the development interface allows the system developer to watch how conclusions are reached and to monitor all facts in the knowledge base. Thus, an explanation facility is not necessary. However, the run-time version of the prototype does not include those knowledge-base debugging facilities. Table 4.11. Source files and their contents File Name Content Alt.clp Grading rules for ALTERMATE sub- category of BOARD Coinmons.clp Grading rules for COMMONS sub- category of BOARD Define.clp Definition of relations used to describe facts Finish.clp Grading rules for FINISH sub- category of SELECT/FINISH Lframe.clp Grading rules for LIGHT FRAMING sub-category of DIMENSION Query.clp Rules and functions for query interface. Select.clp Grading rules for SELECT sub- category of SELECT/FINISH Sframe.clp Grading rules for STRUCTURAL sub-category of DIMENSION Stud.clp Grading rules for STUD sub- category of DIMENSION System.clp Rules for system control, explanation, and output printing 51 Instead, a simple explanation facility is coded into a set of rules contained in the system.clp file to explain how the conclusions are reached. If used as an instruction tool, the prototype should be expanded by developing more detailed explanation features. 4.5.2 Knowledge Base Implementation The domain knowledge is described by objects, concepts, and relationships between them. The major objects in the problem domain are those defects considered by the system, including various types of stains, checks, splits, wane, knots, holes, pitch, and pockets. The major concepts are lumber grades. As discussed earlier, this system is a rule based system, in which the knowledge base consists of a collection of rules completely describing the relationships between the objects and concepts. In Eclipse syntax, the general format of a rule is as follows: (defrule rule_name "optional_comment" (pattern 1) (pattern 2) (pattern N) => (action 1) (action 2) (action 1.1)) 52 The first line is the rule header; "defrule" is a keyword indicating that this segment of code is a rule. Zero or more patterns are specified after the rule header. Each pattern consists of one or more fields. The patterns before the arrow symbol, "=>", are antecedents of an IF- THEN rule, and called the left-hand of the rule. The actions after "=>" are the THEN part of the IF-THEN rule, called the right-hand of the rule. Eclipse attempts to match the patterns of rules against existing facts. If all the patterns of a rule match facts, the rule is activated and put into an agenda (also called conflict set). The agenda is a collection of activated rules. Zero or more rules may be in the agenda. When more than one rule is in the agenda, Eclipse applies a conflict resolution procedure to select a rule to execute, called firing a rule. The actions following the arrow symbol will be executed when the rule in the agenda fires. Patterns, or antecedents of a rule are facts that are required to fire the rule. Facts are usually thought of as propositions, as in proposition calculus. A propositional fact is a fact that consists of a relation and one or more arguments following the relation. The relation is always in the first place in the fact with arguments following the relation. The relation describes how the argument relate to each other. For instance, a fact may be represented as (dia hole 0.5), where dia (for diameter) is the relation, hole and the 53 value of 0.5 are arguments. This pattern means that the hole has a diameter of 0.5 (inches). To illustrates how a rule is implemented in Eclipse, consider Rule 2 in Table 4.10. The rule is modified to accommodate knot description. As stated in Table 4.10, the rule only considers knot type (firm or loose), but not knot location (at edge or center line). However, some grades in the light framing sub-category need to consider both knot type and location. To keep the query interface consistent, Rule 2 is modified as follows: Modified Rule 2: IF NO firm knots at edge OR (lumber width = 2" AND diameter of largest firm knot at edge <= 0.75") OR (lumber width = 3" AND diameter of largest firm knot at edge <= 1.25") OR (lumber width = 4" AND diameter of largest firm knot at edge <= 1.5") THEN firm knots at edge satisfy grade CONSTRUCTION of Light Framing The rule is implemented in Eclipse as follows: (defrule CONST-LF-firin-edge-knot (declare (salience 1000)) (face ?) (category light-framing) (face_width ?width) (or (not (symptom firm_knot_at_edge)) (dia firm_knot_at_edge ?firiudia&: ( or (and (= ?width 2) (<= ?firmdia 0.75)) (and (= ?width 3) (<= ?firmdia 1.25)) (and (= ?width 4) (<= ?firmdia 1.5))))) => (assert (satisfy firm_edge_knot CONST-LF))) The name of this rule is CONST-LF-firiu-edge-knot. The patterns before "=>" look more complicated than the general 54 format described above because many Eclipse-defined functions are used. A function looks like a fact pattern. The entire function is surrounded by parentheses. The name of function precedes the arguments. The arguments for the function are patterns of facts or other functions. Here "declare", "or", "not", "and", and "assert" are names of functions which perform the functions implied by their names. Any field with the symbol ? means that value of this field is a variable. Comparing the modified Rule 2 and its Eclipse implementation, it becomes apparent that the first four patterns, or antecedents, within the implementation are not present in the modified Rule 2. These are supplemental patterns used for process control. The patterns after these process control patterns are just the Rule 2 expressed using Eclipse's syntax. An explanation of each component of the rule is given below. 1. (declare (salience 1000)): assigns a priority number to this rule. "Salience" is a keyword to indicate the priority of the rule, followed by a priority value. The system is driven by facts in the working memory. The system starts with matching the working memory facts with antecedents of rules. Once all antecedents of a rule are matched, that rule is put in the agenda. In many case more than one rule will be in the agenda waiting for firing. The system then applies a conflict resolution strategy to 55 fire those rules. However, sometimes priority ordering other than the Eclipse's predefined control strategy is necessary; "salience" orders the rule execution sequence. 2. (face ?): This has a special purpose. If both faces have the same defect characteristic described by a rule, without (face ?) once the first face has used in a rule, that rule will not be fired again for the second face, even if all the facts were present. This is due to the design of the Eclipse system. When grading different faces, ? in the pattern of (face ?) will have a different value. Therefore, even if no other facts in the rule change, the rule will still be activated because (face ?) pattern has changed. 3. (category light-framing): is used to prevent other grading categories from using this rule. This fact will be asserted into working memory during the query process when the user selects this category. Without using this pattern, Eclipse will try to match all antecedents of all grading rules, no matter what grading category the system is working on. That would be extremely inefficient. 4. (face_width ?width): is used to introduce variable ?width required in other patterns. 5. The patterns after (face_width ?width) and before "=>" are just statements of the modified Rule 2 in Eclipse syntax. They are written in compound logical "or", "not", and "and" format. The symbol "&:" has a special meaning. 56 The variable "?firmdia" before "&:" is tested in the calculations following "&:". For example, in the fact (dia firm_edge_knot 0.5), the ?firmdia is 0.5 If the lumber width is 2 inches, the ?firmdia will be tested to see whether the diameter of the knot is less than 0.75. The result will be true, and the system considers that the antecedent has been matched by the fact. If all the facts on the left-hand side of the rule are present in the working memory, the rule will be put on the agenda, and the new fact (satisfy firm_edge_knot CONST-LF) will be asserted into the working memory. 6. In the pattern of (satisfy firm_edge_knot CONST- LF), "satisfy" describes the relationship between the knot and the grade. Argument firm_edge_knot is an abstracted object, which is a combination of a knot object and its two attributes, type and location. Alternatively, the knot object can be represented using knot-type-value and knot- location-value triples, or using a knot template structure with type and location as its attributes. As a matter of fact, Eclipse has a "deftemplate" representation to support this kind of structure. Using deftemplate to represent a knot object was tried during prototyping, but was less preferable because of some inconvenience encountered in fact manipulation. All grading rules in the knowledge base have a similar structure. The query interface, system output, and system 57 controls are all implemented using such rules. To illustrate, Appendix A gives the Eclipse implementation of all grading rules for the Structural Light Framing category. 4.5.3 Grading Process, Input, and Output The system is menu-driven and interacts with the user through menus and a series of dialog boxes. The input process begins with loading the knowledge base and selecting the input method (interactively or loading a file containing facts). If the interactive input method is selected, a series of dialog boxes will guide the user to enter lumber size, select grade category and sub- categories, and specify the face where defects are located along with the defects' types, locations and sizes. The system then infers the grade corresponding to this face. Once the grade has been determined, the system allows the user to ask for explanation. The explanation provided by the system includes types of defects on the face, size of each defect, the grade each defect has satisfied, and the defects that determine the grade. The system determines the grade for each face separately and the overall grade. The flow chart in Figure 4.3 shows the grading process. Figures 4.4 to 4.15 explain the various menus and dialog boxes in details. Initially, the prototype only considered the two wide faces. After 58 Start Load knowledge base id fact file? Load fact file son andInput lumber dimension print output Select grade category End Select one or more subcategories Yes Work on facel? No Yes Work on face2 2 No No Find overall grade? End_D Reason Enter defect and characteristics print results chrocteristics Wont explona fect No from working Figure 4.3. Grading process (This prototype has been improved by including all four faces as described in Chapter 5) 59 prototype evaluation, the system was enhanced to consider all four faces (see Chapter 5). The system's initial window is shown in Figure 4.4. This window contains several pull-down menus for loading the knowledge base, cleaning memory space, and controlling system execution. The user can load a selected knowledge base into the system. Grading categories can be placed into one knowledge base, or several different knowledge bases, depending upon the user's preference. The development and maintenance of knowledge bases are done using Eclipse's development tool kits. Once the knowledge bases are error free, they can be saved as binary files. The run-time version of the system can only load knowledge bases in binary files. Binary files are efficient for fast loading and secure delivery. The system allows the user to input lumber characteristics in two ways: either by entering the facts during the query process, or by loading a fact file at the beginning of the session (Figure 4.5). Once the user selects to input facts interactively, a series of dialog boxes will pop up to guide the user to enter the facts. First, the user enters lumber thickness (Figure 4.6); this is followed by lumber width and length. Each input dialog box is followed by a confirmation dialog box (Figure 4.7) so that the user has a chance to modify the input data. 60 Next the system asks the user to select a grade category (Figure 4.8) and sub-categories in the category (Figure 4.9). Although the same piece of lumber may have more than one grade in different categories, the current version of the system does not consider grade overlap between different categories. However, the system allows the user to select one or all sub-categories in the category, that is, grade overlap is allowed between sub- categories. After selecting grade sub-categories, the user specifies the face of lumber to be graded (Figure 4.10) and then enters defects on this face. After a face has been graded, the dialog box in Figure 4.10 may again be used to specify another face. The overall grade is determined after both faces have been graded. Figures 4.1]. and 4.12 show the dialog boxes for entering defects. The defects shown in the figures include all defect types considered in the system. If the same defect type occurs more than once, only the worst defect is input. For example, if there are two holes, 0.1 inches and 0.5 inches in diameter, the larger hole (0.5 inches) is entered into the system. Once a defect type has been selected, a dialog box will pop up to ask for more detailed information about the defect type and location, as appropriate. Figure 4.13 shows a dialog box for entering information on knots. This 61 dialog box asks for knot type and location. The information in the dialog box may differ across grade categories as various categories consider knot types differently. The last piece of information required for a defect is its size, as shown in Figure 4.14. After all the defect data is entered, the user selects the no_more_defects item in Figure 4.12 to exit the input mode. The system maps the input data to appropriate grade(s). Figure 4.15 shows a an example output. The output includes each face grade based on the defect distribution on that face, the overall lumber grade, and the corresponding sub-category. Overlap between sub- categories is allowed; Figure 4.15 shows the grades for a piece of dimension lumber. {ile Lxecute stop help Figure 4.4. Opening window of the run-time version of the system Please select data input method load_tact_tile fact_tile_I oa d ed Figure 4.5. Dialog box for selecting input method enter lumber nominal thickness in inches Figure 4.6. Dialog box for entering lumber thickness Youve entered the following lumber size: 0 Nominal thIckness: 2 InNominal width: 4 InNomInal length: 8 ft Want to modify? I4. Figure 4.7. Dialog box for confirming lumber dimension 63 determine grade category sel cctlfinish jIiiIi4iE1[u1. boards Figure 4.8. Dialog box for selecting grade category determine dimension sub category light_framing structural_light_framing stud Figure 4.9. Dialog box for selecting Dimension sub- category 64 select face to work on Figure 4.10. Dialog box for selecting lumber face Select defect to enter holes wane splits checks grain pith Figure 4.11. Dialog box with partial defect list Select detect to enter grain pith decay stain pitch pockets Figure 4.12. Dialog box with another partial defect list select knot type and location fi rmkn ot_at_ce nte rI inc loose_knot_at_edge loose_knot_at_centerline Figure 4.13. Dialog box for entering knot type and location Figure 4.14. enter diameter of firm_knot_at_edge in inches o.1 Dialog box for entering knot diameter ace: Facel Grade: CONST Category: Light_framing ace: facel Grade: SEL-STR Category: Structural_light_Framing ace: Facel Crade: STUD Category: Stud ace: face2 Grade: NO.3 Category: Structural_light_framing ace: Face2 Grade: CONST Category: Light_Framing ace: Face2 Grade: STUD Category: Stud uerall Grade: CONST Category: Light_fraiinq uerall Grade: NO.3 Category: Structural_light_f raiiing uerall Grade: STUD Category: Stud Figure 4.15. System output display 67 CHAPTER 5 EVALUATION AND ENHANCEMENTS 5.1 System Evaluation The system was initially tested using generated input data. Simulated lumber and defect data were entered into the system. The resulting grades assigned by the system were compared with those assigned by using the rule book manually. All rules in the system were checked and 100 percent match was achieved for the simulated data. The test results are given in Appendix B. The system was then evaluated using real lumber. Eighty five samples of Siberian larch 2x4x12 lumber were used to evaluate the system. The samples had been graded by a human grader from the West Coast Lumber Inspection Bureau (WCLIB). All samples belong to the Structural Light Framing category. Among the five grades in this category, 20 sample pieces were randomly selected from 61 pieces of Select Structural lumber, 20 from 31 pieces of No.1, 20 from 53 No.2, 20 from 73 pieces of No.3, and 5 from 10 Economy. To test the performance of the system, defects on these pieces were measured by the author. These were then entered into the system. As shown in Figure 5.1, 60 percent of the samples (51 pieces) matched the original 0, 0 E .4- 0 I- 0) E z 68 Matched UM-1 UM-2 UM-3 UM-4 UM-5 UM-6 Before Modification After Modification Figure 5.1. Evaluation results considering all factorsgrades as judged by the human grader. A total of 31 pieces (36.5 percent) did not match the original grades because of limitations of the computer system, primarily not considering defects on the two narrow faces (edges), shake, warp, and manufacturing imperfections. An additional 3.5 percent samples (3 pieces) did not match the grades assigned because of measurement bias or the mismatch could not be explained. For example, a firm knot at edge on a piece was measured as being 1.1 inches in diameter, which made this piece No.2. However, for some reason the human grader assigned Select Structural grade to the piece. Since the human grader was not present, it was difficult to correlate some of the mismatched observations. If used as a sub-system of SAW3D, warp and manufacturing imperfections do not exist when SAW3D making decisions. If these defects are excluded, the matched rate between the grade assigned by the human grader and that assigned by the system is 72.9 percent. Although some marginal errors are introduced due to measurement bias, a difference of 40 percent requires modifications of the system to improve its performance. 5.2 System Improvement As shown in Figure 5.1, the largest cause of deviation between the grades assigned by the computer and those assigned by the human grader was exclusion of defects on the two narrow faces. Thus the focus of improvement was on including the narrow faces in the evaluation process. The system was improved to allow defects on narrow faces to be input and evaluated. The enhanced model allows rLi the user to input defects on all four faces, assigns a grade to each of the four faces, and then determines the overall grade. The eighty five samples tested earlier were again evaluated using the revised system. Figure 5.1 shows the grading results after the modification. The percentage of matched grades increased from 60 to 76.5 percent. The samples that did not match due to system limitations decreased from 36.5 to 17.6 percent. Samples which were assigned a grade different from that assigned by the human grader because of measurement error and unexplained differences increased from 3.5 to 59 percent. All 15 unmatched samples caused by system limitations are upgraded in the revised system because defects such as shakes, warp and manufacturing imperfections are not considered by the system. All five unmatched samples caused by measurement difference are downgraded because defect measurements are larger than those permitted by the original grades. Although warp and manufacturing imperfections also contributed to deviations in grade assignment, these are introduced as a result of the manufacturing process and do not exist before log breakdown. As such, they are not considered in a log breakdown model such as SAW3D. If the system is to be used for a log breakdown optimization system where warps and manufacturing imperfections are not 7]- present, the percentage of matched samples increases to 72.9 percent before the modification, and to 89.4 percent after the modification (Figure 5.2). However, if the system is to be used as an instruction tool or a component of an automatic grading system, warp and manufacturing imperfection are important factors that affect grading accuracy, and therefore need to be included in the system. The bias due to measurement error can be eliminated by having the individual who visually graded the samples also a, w a- E Ct 0) 1- 0 -a E z Matched UM-1 UM- UM-O Before Modification After Modification if no measure bias Figure 5.2. Evaluation results when warp, manufacturing imperfections, and measurement bias were not considered 72 measure the defects. In this case the matched samples represent 95.3 percent of the total boards (Figure 5.2). The nuiber of unmatched samples due to shake and not-well- spaced knots is very small. These may also depend upon wood species; inclusion of these factors will further improve the system accuracy. 73 CHAPTER 6 CONCLUSIONS A prototype expert system for softwood lumber grading was developed. The prototype can grade lumber for 27 grades in Dimension, Select/Finish, and Boards category. It can judge each of four faces of lumber individually and assign an overall grade based on the grades of the individual faces. The user interface helps to obtain facts about a piece of lumber, and provides grading results and explanations about how the conclusions are reached. The initial prototype considered only two faces of lumber. After an evaluation using real lumber samples, the prototype was modified to include all four faces resulting in significant performance improvement. The intended use of the system is in conjunction with SAW3D, a log breakdown optimization system, to determine optimum log breakdown decisions. SAW3D will provide this grading system with lumber size and defect characteristics information. The expert system determines the lumber grade and will then pass this information back to SAW3D where SAW3D will determine the lumber value based on the grade, and use it to arrive at optimum log breakdown decisions. This application represents a new direction for improving lumber production efficiency: optimization of cutting strategies using both lumber geometric and defect 74 information. The grading system can be used to build and maintain grading rules independently, and communicate with other components of the overall system in different ways. It can be embedded in the overall system, or it can exchange data with the system using Dynamic Data Exchange facility supported by MS-WINDOWS. The separation of the grading system from other parts of the overall system is very important. The knowledge base can be developed and maintained without interfering with any other program logic. This provides greater portability and flexibility of the grading system, and in turn simplifies the development and maintenance of the system. Areas for further research include: 1. The evaluation using real lumber was only performed for the Structural Light Framing sub-category of the Dimension. Such a evaluation should be done for all grading categories. 2. For rapid prototyping, the development concentrates on selected defect characteristics for each grade. The selected characteristics are clearly defined and described in the rule book, and are usually the most frequently encountered defects on softwood lumber. Once the specific use of the system is determined, the knowledge base should be refined and more rules should be added to the knowledge base with the help of human grading experts. For example, 75 knot positions relative to each other, shake, warp and manufacturing imperfections need to be considered. Clustering of defects is another important feature that may effect a grade, and thus may need to be included in the knowledge base. 3. As mentioned before, this system is to be used as a sub-system of SAW3D. The system may also be used as an instruction or training tool. When used as an instruction tool, a better user interface should be developed. A help facility should be added to guide the user at each step, and more detailed explanations should also be provided at each step. A graphic display of defect distribution and grade stamp bitmaps may be very helpful. The system may need to include some controls allowing the user to grade the lumber, and then judge the results using the knowledge base. 76 BIBLIOGRAPHY 1. American Lumber Standards Committee. 1970. American Softwood Lumber Standard. National Bureau of Standards, U.S. Department of Commerce, Washington, D.C. 2. Aune, Jan. 1991. X-Ray edger optimizer makes money at Macmillan Bloederl's Alberni Pacific Division. Proceedings of the 4th International Conference on Scanning Technoloav in the Wood Industry, pp. Aune-1 - Aune-2, San Francisco, CA. 3. Brooke, Tom. 1992. The art of production systems. Expert, 7(1):31-35. 4. Flatman, Carl, and Egan Bodell. 1989. Computer-aided lumber grader-optimizer system. Proceedings of the Third International Conference on Scanning Technology in Sawmilling, pp. XIX-1 to XIX-15, San Francisco, CA. 5. Flatman, Carl, and Daniel J. Kenway. 1991. Mill experience with high speed grade based optimizers. Proceedings of the 4th International Conference on Scanning Technolov in the Wood Industry, pp. kenway-1 to kenway-l4, San Francisco, CA. 6. Forgy, L. Charles. 1979. On the efficient implementation of production systems. Ph.D Thesis. Carnegie-Mellon University. 7. Forgy, L. Charles. 1982. Rete: a fast algorithm for the many pattern/many object match problem. Artificial Intelligence, 19(1) :17-37. 8. Haley Enterprise. 1992. Eclipse Reference Manual. The Haley Enterprise, Inc., Sewickley, PA. 9. Hallock, H., and L. Gauger. 1971. Grading hardwood lumber by computer. Res. Paper FPL-157. Forest Products Laboratory, Madison, WI. 10. Huang, S.S.L., and F.T. Sparrow. 1989. A computer- aided instruction tool for grading hardwood lumber. Forest Products Journal, 39(10) :39-42. 11. Kenway, J. Daniel. 1990. A supercomputer-based machine vision grading system and trimmer optimizer for dimension lumber. Proceedings of Process Control/Production Manaaement of Wood Products: Technoloav for the '90s, pp. 53-65, Athens, Georgia. 77 12. Klin]thachorn, P., J.P. Franklin, C.W. McMillin, R.W. Conners, and H.A. Huber. 1988. Automated computer grading of hardwood lumber. Forest Products Journal, 38(3) :67-69. 13. Klinkhachorn, P., C.J. Schwehiu, CW. McMillin, and H.A. Huber. 1989. HaLT: a computerized training program for hardwood lumber grading. Forest Products Journal, 39(2) :38-40. 14. Klinkhachorn, P., D. Yost, R. Kothari, C.W. McMillin, H.A. Huber. 1991. Computer lumber grading and HaRem for an automated lumber processing system. Proceedinas of the First International Conference on Automated Lumber Processing Systems and Laser Machining of Wood, pp. 173-181, Michigan State University, East Lansing, MI. 15. Western Wood Products Association. Western lumber grading rule 88. 1988. Portland, OR. 16. Williston, Edward M. 1988. Lumber manufacturing - The design and operation of sawmills and planer mills. Miller Freeman Publications, Inc. 17. Zeng, Y. 1991. Log breakdown using dynamic programming and 3-D log shape. M.S. thesis. Oregon State University, Corvallis, OR. APPENDICES 78 Appendix A. Source Code for Structural Light Framing Category , , , ------------------------------------------------------ ; This file contains rules for Structural Light Framing ; category of Dimension lumber grades. This category ; contains the following four grades: 1) SEL-STR (Select Structural, Structural Light Framing) ; 2) NO.1 (NO. 1, Structural Light Framing) 3) NO.2 (NO. 2, Structural Light Framing) 4) NO.3 (NO. 3, Structural Light Framing) 5) ECONOI1Y-SLF (Economy, Structural Light Framing) Validation of defects for each grade is checked by the ; rules separated from the grading rule. SE L-S TR GRADE ;----Rules to check validation of defects for SEL-STR ----- (defrule SEL-STR_firm_edge_knot "Firm knots at edge <= SEL-STR limit?" (declare (salience 1000)) (face ?) (category structural_light_framing) (face_width ?width) (or (not (symptom firm_knot_at_edge)) (dia firm_knot_at_edge ?firmdia&:( or (and (= ?width 2) (<= ?firmdia 0.375)) (and (= ?width 3) (<= ?firmdia 0.5)) (and (= ?width 4) (<= ?firmdia 0.75))))) => (assert (satisfy firm_knot_at_edge SEL-STR))) (defrule SEL-STR_firm_center_knot "Firm knots at center <= SEL-STR limit?" (declare (salience 1000)) (face ?) (category structural_i ight_f raming) (face_width ?width) (or (not (symptom firm_knot_at_centerline)) (dia firm_knot_at_centerline ?firmdia&:( or (and (= ?width 2) (<= ?firmdia 0.375)) (and (= ?width 3) (<= ?firmdia 0.5)) (and (= ?width 4) (<= ?firmdia 0.875))))) (assert (satisfy firm_knot_at_centerline SEL-STR))) 79 (defrule SEL-STR_loose_edge_knot "Loose edge knots <= SEL-STR grade limit?" (declare (salience 1000)) (face ?) (category structural_i ight_f raining) (face_width ?width) (or (not (symptom loose_knot_at_edge)) (dia loose_knot_at_edge ?loosedia&: ( or (and (= ?width 2) (<= ?loosedia 0.375)) (and (= ?width 3) (<= ?ioosedia 0.5)) (and (= ?width 4) (<= ?loosedia 0.75))))) => (assert (satisfy loose_knot_at_edge SEL-STR))) (defrule SEL-STR_loose_center_knot "Loose cnt knots <= SEL-STR grade limit?" (declare (salience 1000)) (face ?) (category structural_i ight_f raining) (face_width ?width) (or (not (symptom loose_knot_at_centerline)) (dia loose_knot_at_centerline ?loosedia&: ( or (and (= ?width 2) (<= ?loosedia 0.375)) (and (= ?width 3) (<= ?loosedia 0.5)) (and (= ?width 4) (<= ?loosedia 0.75))))) => (assert (satisfy loose_knot_at_centerline SEL-STR))) (defrule SEL-STR_hoie "Holes <= SEL-STR grade limit ?" (declare (salience 1000)) (face ?) (category structural_i ight_f raining) (face_width ?width) (or (not (symptom holes)) (dia hole ?holedia&:( or (and (= ?width 2) (<= ?holedia 0.375)) (and (= ?width 3) (<= ?holedia 0.5)) (and (= ?width 4) (<= ?holedia 0.75))))) => (assert (satisfy holes SEL-STR) )) (defrule SEL-STR_wane "Wanes <= SEL-STR grade limit ?" (declare (salience 1000)) (face ?) (category structural_light_framing) (lumber thickness ?thickness) (lumber_width ?width) (or (not (symptom wane)) (and (thickness wane ?thx&: ( <= 4.0))) (width wane ?wid&: ( <= ?wid => (assert (satisfy wane SEL-STR) )) ?thx (/ ?thickness (/ ?width 4.0))))) (defrule SEL-STR_split "Splits <= SEL-STR grade limit ?" (declare (salience 1000)) (face ?) (category structural_light framing) (lumber_width ?width) (or (not (symptom splits)) (length split ?splitlength&:(<= (- ?splitlength ?width) 0.000001))) => (assert (satisfy splits SEL-STR) )) I (defrule SEL-STR_check "Checks <= SEL-STR grade limit ?" (declare (salience 1000)) (face ?) (category structural_i ight_f raming) (lumber_width ?width) (or (not (symptom through_check_on_end)) (length through_check_on_end ?checklength&: (<= (- ?checklength ?width) 0.000001))) (assert (satisfy through_check_on_end SEL-STR) )) (defrule SEL-STR_slope "Slope within SEL-STR grade limit ?" (declare (salience 1000)) (face ?) (category structural_i ight_f raining) (or (not (symptom grain)) (slope_of_grain ?slope&:( <= ?slope (/ 1 12.0)))) => (assert (satisfy grain SEL-STR) )) Grading rule for grade of SEL-STR ----------- (defrule grade_SEL-STR "SEL-STR Grade" (declare (salience 900)) 81 (not (symptom decay)) (satisfy firm_knot_at_edge SEL-STR) (satisfy firm_knot_at_centerline SEL-STR) (satisfy loose_knot_at_edge SEL-STR) (satisfy loose_knot_at_centerline SEL-STR) (satisfy holes SEL-STR) (satisfy wane SEL-STR) (satisfy splits SEL-STR) (satisfy through_check_on_end SEL-STR) (satisfy grain SEL-STR) => (assert (grade Structural_light_framing SEL-STR 1))) NO. ]. GRADE Rules to check validation of defects for NO.1 ------ (defrule NO.1_firm_edge_knot "Firm knots at edge <= NO.1 grade limit ?" (declare (salience 800)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (face_width ?width) (or (not (symptom firm_knot_at_edge)) (dia firm_knot_at_edge ?knotdia&:( or (and (= ?width 2) (<= ?knotdia 0.5)) (and (= ?width 3) (<= ?knotdia 0.75)) (and (= ?width 4) (<= ?knotdia 1.0))))) => (assert (satisfy firm_knot_at_edge NO.1))) (defrule NO. 1_firm_center_knot "Firm knots at center <= NO.1 grade limit ?" (declare (salience 800)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (face_width ?width) (or (not (symptom firm_knot_at_centerline)) (dia firm_knot_at_centerline ?knotdia&: ( or (and (= ?width 2) (<= ?knotdia 0.5)) (and (= ?width 3) (<= ?knotdia 0.75)) (and (= ?width 4) (<= ?knotdia 1.5))))) => (assert (satisfy firm_knot_at_centerline NO.1))) (defrule NO.1_loose_edge_knot "Loose edge knots <= NO.1 82 grade limit ?" (declare (salience 800)) (face ?) (category structural 1 ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (face width ?width) (or (not (symptom loos (dia loose_knot_at (and (= ?width (and (= ?width (and (= ?width s_knot_at_edge)) edge ?knotdia&: ( or 2) (<= ?knotdia 0.5)) 3) (<= ?knotdia 0.75)) 4) (<= ?knotdia 1.0))))) => (assert (satisfy loose_knot_at_edge NO.1))) (defrule NO.1_loose_center_knot "Loose center knots <= NO.1 grade limit ?" (declare (salience 800)) (face ?) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (face_width ?width) (or (not (symptom loose_knot_at_centerline)) (dia loose_knot_at_centerline ?knotdia&: ( or (and (= ?width 2) (<= ?knotdia 0.5)) (and (= ?width 3) (<= ?knotdia 0.75)) (and (= ?width 4) (<= ?knotdia 1.0))))) => (assert (satisfy loose_knot_at_centerline NO.1))) (defrule NO. 1_hole "Holes <= NO.1 grade limit ?" (declare (salience 800)) (face 7) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (face_width ?width) (or (not (symptom holes)) (dia hole ?holedia&:( or (and (= 7width 2) (<= ?holedia 0.5)) (and (= ?width 3) (<= ?holedia 0.75)) (and (= ?width 4) (<= ?holedia 1.0))))) (assert (satisfy holes NO.1))) (defrule NO.1_wane "wanes <= NO.1 grade limit ?" 83 (declare (salience 800)) (face ?) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (lumber_thickness ?thickness) (lumber_width ?width) (or (not (symptom wane)) (and (thickness wane ?thx&: ( <= ?thx (/ ?thickness 4.0))) (width wane ?wid&:( <= ?wid (/ ?width 4.0))))) => (assert (satisfy wane NO.1))) (defrule NO.1_split "splits <= NO.1 grade limit ?" (declare (salience 800)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (lumber_width ?width) (or (not (symptom splits)) (length split ?splitlength&:(<= (- ?splitlength ?width) 0.000001))) => (assert (satisfy splits NO.1))) (defrule NO.1_check "checks <= NO.1 grade limit ?" (declare (salience 800)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (lumber_width ?width) (or (not (symptom through_check_on_end)) (length through_check_on_end ?checklength&: (<= (- ?checklength ?width) 0.000001))) => (assert (satisfy through_check_on_end NO.1))) (def rule NO.1_slope "slope is within NO.1 grade limit ?" (declare (salience 800)) (face ?) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (or (not (symptom grain)) 84 (Slope_of_grain ?slope&:(<= ?slope (1 1 10.0)))) => (assert (satisfy grain NO.1))) Grading rule for grade of NO.]. -------------- (defrule grade NO.1 "NO.1 Grade" (declare (salience 700)) (not (symptom decay)) (satisfy firm_knot_at_edge NO.].) (satisfy firm_knot_at_centerline NO.1) (satisfy loose_knot_at_edge NO.].) (satisfy loose_knot_at_centerline NO.].) (satisfy holes NO.].) (satisfy wane NO.1) (satisfy splits NO.].) (satisfy through_check_on_end NO.1) (satisfy grain NO.].) => (assert (grade Structural_light_framing NO.1 2))) NO . 2 GRADE ; ------ Rules to check validation of defects for NO.2 (defrule No.2_firm_edge_knot "Firm knots at edge <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (face_width ?width) (or (not (symptom firm (dia firm_knot_at_ (and (= ?width (and (= ?width (and (= ?width _knot_at_edge)) dge ?knotdia&:( or 2) (<= ?knotdia 0.625)) 3) (<= ?knotdia 0.875)) 4) (<= ?knotdia 1.25))))) => (assert (satisfy firm_knot_at_edge NO.2))) (defrule NO.2_firm_center_knot "Firm knots at center <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.]. 2)) (face_width ?width) (or (not (symptom firm_knot_at_centerline)) (dia firm_knot_at_ (and (= ?width (and (= ?width (and (= ?width => (assert (satisfy firm enter1ine ?knotdia&:( or 2) (<= ?knotdia 0.625)) 3) (<= ?knotdia 0.875)) 4) (<= ?knotdia 2.0))))) _knot_at_centerline NO.2))) 85 (defrule No.2_loose_edge_knot "Loose edge knots <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_i ight_framing) (not (grade Structural (not (grade Structural (face_width ?width) (or (not (symptom loos (dia loose_knot_at (and (= ?width (and (= ?width (and (= ?width light_framing SEL-STR 1)) _light_framing NO.1 2)) s_knot_at_edge)) _edge ?knotdia&:( or 2) (<= ?knotdia 0.625)) 3) (<= ?knotdia 0.875)) 4) (<= ?knotdia 1.25))))) (assert (satisfy loose_knot_at_edge NO. 2))) (defrule NO.2_loose_center_knot "Loose cnt knots <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (face_width ?width) (or (not (symptom loose_knot_at_centerline)) (dia loose_knot_at_centerline ?knotdia&: ( or (and (= ?width 2) (<= ?knotdia 0.625)) (and (= ?width 3) (<= ?knotdia 0.875)) (and (= ?width 4) (<= ?knotdia 2.0))))) => (assert (satisfy loose_knot_at_centerline NO. 2))) (defrule NO.2_hole "Holes <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (face_width ?width) (or (not (symptom holes)) (dia hole ?holedia&:( or (and (= ?width 2) (and (= ?width 3) (and (= ?width 4) (assert (satisfy holes NO.2))) I (defrule NO. 2_wane I 86 (<= ?holedia 0.625)) (<= ?holedia 0.875)) (<= ?holedia 1.25))))) "wanes <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_i ight_f raining) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (lumber_thickness ?thickness) (lumber_width ?width) (or (not (symptom wane)) (and (thickness wane ?thx&: ( <= ?thx (/ ?thickness 3.0))) (width wane ?wid&: ( <= ?wid (/ ?width 3.0))))) => (assert (satisfy wane NO.2))) (defrule NO.2_split "splits <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_i ight_f raining) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (lumber_width ?width) (or (not (symptom splits)) (length split ?splitlength&: (<= ?splitlength (* 1.5 ?width)))) => (assert (satisfy splits NO.2))) (defrule NO.2_check "checks <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) 87 (lumber_width ?width) (or (not (symptom through_check_on_end)) (length through_check_on_end ?checklength&: (<= ?checklength (* 1.5 ?width)))) (assert (satisfy through_check_on_end NO. 2))) (defrule NO.2_slope "slope is within NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (or (not (symptom grain)) (slope_of_grain ?slope&:(<= ?slope (/ 1 8.0)))) => (assert (satisfy grain NO.2))) (defrule NO.2_decay "decay <= NO.2 grade limit ?" (declare (salience 600)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (lumber_thickness ?thickness) (lumber_width ?width) (or (not (symptom decay)) (and (test (= ?thickness 2 )) (thickness decay ?thx&: ( <= ?thx (I ?thickness 3.0))) (width decay ?wid&: (<= ?wid (I ?width 3.0))))) (assert (satisfy decay NO.2))) (defrule gra (declare (satisfy (satisfy (satisfy (satisfy (satisfy (satisfy (satisfy Grading rule for grade of NO.2 ------------- e NO.2 "NO.2 Grade" (salience 500)) firm_knot_at_edge NO.2) firm_knot_at_centerline NO.2) loose_knot_at_edge NO.2) loose_knot_at_centerline NO.2) holes NO.2) wane NO.2) splits NO.2) (satisfy through_check_on_end NO.2) (satisfy grain NO.2) 88 (satisfy decay NO.2) => (assert (grade Structural_light_framing NO.2 3))) NO. 3 GRADE Rules to check validation of defects for NO.3 (defrule NO.3_firm_edge_knot "Firm knots at edge <= NO.3 grade limit ?" (declare (salience 400)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (face_width ?width) (or (not (symptom firm_knot_at_edge)) (dia firm_knot_at_edge ?knotdia&:( or (and (= ?width 2) (<= ?knotdia 0.75)) (and (= ?width 3) (<= ?knotdia 1.25)) (and (= ?width 4) (<= ?knotdia 1.75))))) => (assert (satisfy firm_knot_at_edge NO.3))) (defrule NO.3_firm_center_knot "Firm knots at center <= NO.3 grade limit ?" (declare (salience 400)) (face ?) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (face_width ?width) (or (not (symptom firm_knot_at_centerline)) (dia firm_knot_at_centerline ?knotdia&: ( or (and (= ?width 2) (<= ?knotdia 0.75)) (and (= ?width 3) (<= ?knotdia 1.25)) (and (= ?width 4) (<= ?knotdia 2.5))))) => (assert (satisfy firm_knot_at_centerline NO.3))) (defrule NO.3_loose_edge_knot "Firm knots at edge <= NO.3 grade limit ?" (declare (salience 400)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (face_width ?width) (or (not (symptom loose_knot_at_edge)) (dia loose_knot_at_edge ?knotdia&: ( or (and (= ?width 2) (<= ?knotdia 0.75)) (and (= ?width 3) (<= ?knotdia 1.25)) (and (= ?width 4) (<= ?knotdia 1.75))))) (assert (satisfy loose_knot_at_edge NO.3))) 1 89 (defrule NO.3_loose_center_knot "Firm cntknots at edge <= NO.3 grade limit?" (declare (salience 400)) (face ?) (category structural_i ight_f raining) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (face_width ?width) (or (not (symptom loose_knot_at_centerline)) (dia loose_knot_at_centerline ?knotdia&: ( or (and (= ?width 2) (<= ?knotdia 0.75)) (and (= ?width 3) (<= ?knotdia 1.25)) (and (= ?width 4) (<= ?knotdia 2.5))))) (assert (satisfy loose_knot_at_centerline NO.3))) I (defrule NO.3_hole "Holes <= NO.3 grade limit ?" (declare (salience 400)) (face ?) (category structural_light_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (face_width ?width) (or (not (symptom holes)) (dia hole ?holedia&:( or (and (= ?width 2) (<= ?holedia 0.75)) (and (= ?width 3) (<= ?holedia 1.25)) (and (= ?width 4) (<= ?holedia 1.75))))) => (assert (satisfy holes NO.3))) (defrule NO.3_wane "wanes <= NO.3 grade limit ?" (declare (salience 400)) 90 (face ?) (category structural 1 ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (lumber_thickness ?thickness) (lumber width ?width) (or (not (symptom wane)) (and (thickness wane ?thx&: ( <= ?thx (/ ?thickness 2.0))) (width wane ?wid&: ( <= ?wid (/ ?width 2.0))))) => (assert (satisfy wane NO.3))) (defrule NO.3_split "splits <= NO.3 grade limit ?" (declare (salience 400)) (face ?) (category structural_light_framing) (lumber_length ?length) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (lumber_width ?width) (or (not (symptom splits)) (length split ?splitlength&:(<= ?splitlength (/ (* 12 ?iength) 6.0)))) => (assert (satisfy splits NO.3))) (defrule NO.3_check "checks <= NO.3 grade limit ?" (declare (salience 400)) (face ?) (category structural_i ight_framing) (lumber_length ?length) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (lumber_width ?width) (or (not (symptom through_check_on_end)) (length through_check_on_end ?checklength&: (<= ?checklength (/ (* 12 ?length) 6.0)))) => (assert (satisfy through_check_on_end NO.3))) (defrule NO.3_slope "slope is within NO.3 grade limit ?" (declare (salience 400)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (or (not (symptom grain)) (slope_of_grain ?siope&:(<= ?slope (/ 1 4.0)))) => (assert (satisfy grain NO.3))) (defrule NO.3_decay "decay <= NO.3 grade limit ?" (declare (salience 400)) (face ?) (category structural_i ight_framing) (not (grade Structural_light_framing SEL-STR 1)) (not (grade Structural_light_framing NO.1 2)) (not (grade Structural_light_framing NO.2 3)) (lumber_cross_section ?iumberCS) (or (not (symptom decay)) (cross_section decay ?decaySize&: (<= ?decaySize (I ?lumberCS 3.0)))) => (assert (satisfy decay NO.3))) Grading rule for grade of NO.3 ------------ (defrule gra (declare (satisfy (satisfy (satisfy (satisfy (satisfy (satisfy (satisfy le_NO.3 "NO.3 Grade" (salience 300)) firm_knot_at_edge NO.3) firm_knot_at_centerline NO.3) loose_knot_at_edge NO.3) loose_knot_at_centerline NO.3) holes NO.3) wane NO.3) splits NO.3) (satisfy through_check_on_end NO.3) (satisfy grain NO.3) (satisfy decay NO.3) => (assert (grade Structural_light_framing NO.3 4))) ECONOMY -SLF GRADE ================== Grading rule for grade of ECONOMY-SLF ---------- (defrule grade_ECONOMY-SLF "ECONONY-SLF Grade" (declare (salience 200)) (face ?) (category structural_i ight_f: (not (grade Structurai_iight (not (grade Structural_light (not (grade Structurai_iight (not (grade Structural_light (not (symptom broken ends )) => raming) _framing SEL-STR 1)) framing NO.1 2)) framing NO.2 3)) _framing NO.3 4)) 92 (assert (grade Structural_light_framing ECONOMY 5))) ;======== END OF STRUCTURAL LIGHT FRAMING GRADES 93 Appendix B. Test Results Using Generated Data Tables Bi, B3, and B5 show the grade specifications. Data in each column in the upper section of these tables represent the limiting provisions on defects; the grades are listed in the lower section. An X in the lower section means that data in the column are limiting provisions for the grade in the row. The grading rules for each grade in the knowledge base were tested using facts entered through the interactive query process. These facts represent realistic data values. Tables B2, B4, and B6 show the resulting grades. These tables use a format similar to the rule specification tables (Tables Bi, B3, and B5). Each column contains data for a face of a lumber sample. Data in the top half of the table is the generated defect measurements (facts). Empty cells in a column reflect defects that do not exist in a sample. As in the specification tables, column and row intersections mean that the data (facts) in the column satisfies the grade in the row. Multiple Xs in a column means that the input data satisfy more than one grade. For example, a lumber sample with defects indicated in the first column of Table B2 satisfies CONST, NO.3, and STUD grades. 94 Table Bi. Specifications of grades for a piece of lumber in the Dimension category (lumber size = 2x4txlO) )efect Fype/Location easure imiting Provisions <= inches) firm-edge a____ 1 . 0.75 T 1 not firm-center a_____ 1 .5_ 2 2.5 0.875 1 .5_ 2 2.5 y 2.5 6 loose-edge d a_____ 1 2 2.5 0.75 1.25 1.75 y 1.75 6 loose-center a_____ 1 2 2.5 0.75 _1 2 2.5 y 2.5 6 lole d a_____ 1.25 1.5 y 0.75 _1 1.25 1.75 1.5 Vane hx___ _1 0.5 2(3 1 0.5 _1 0.5 2/3 1 y 2/3 2 wid 1 4/3 2 1 1 4/3 2 4/3 3 plft ength 4 6 6 4 4 6 20 8 30 heck through-on-end ength 4 6 6 y 4 4 6 20 8 30 )ecay hx none 2/3 area 8/3 none none 2/3 area 8/3 area 8/3wid none 4/3 y none none 4/3 y 3rain slope 1/6 1/41/4 1/12 1/10 1/8 1/4 an_n 1/4 ub- ategory Grade GONST ight STAND X raming UTIL X ECONOMY X SEL-STR X itructural NO.1 X ight NO.2 X raming NO.3 X ECONOMY X itud STUD X ECONOMY x X - Data in the column is the specification for the grade in the row. none - Not allowed any - No limitations area - Width x length 95 Table B2. Test results of grading the lumber in the Dimension category )efect Type/Location Measure fi =inchL (not firm-edge die 0.75 ____ 1 T5 firm-center die 2 0.875 1.5 2.5 loose-edge dia 1 2.5 0.75 1.75 1.75 loose-center dia 2 0.75 2 2.5 lole dia 1 1.25 1.5 0.75 1 1.25 1.75 1.5 Vane thx 0.5 0.6 1 0.5 0.5 0.6 1 0.6 wid 1 1.3 2 1 1 1.3 2 2 pIft length 4 6 6 4 4 6 20 8 )heck through-on-end length 4 6 6 4 4 6 20 8 )ecay thx 0.5 1 0.66 1 1 wid 1 2.6 1.33 2.6 2.6 rain slope 0.16 0.25 0.25 0.08 0.1 0.13 0.25 0.25 pub- ategory Grade ight raming CONST x r STAND X X UTIL X ECONOMY X X X tructuraI ight raming SEL-STA X X NO.1 X NO2 X NO.3 X X X X ECONOMY X X tud STUD X X X X X XX ECONOMY X X X 1) X indicates that input data in the column satisfies the grade in the row. 2) Blank cell means that no such characteristic exists. 3) For the same set of facts, grade overlaps are allowed. For example, facts in the first column match grades CONST, NO.3, and STUD. 4) The results satisfy the specification, indicating the system works well. Table B3. Specifications of grades for a piece of lumber in the Select/Finish category (lumber size = l"x8"x12') pet ect Type/Location Measure Limiting Provisions (<= inches) not tirm number * 2 * 2 any * 2 any any dia 0.5 0.75 any 0.75 any any fixed number none none * 4 none 4 6 dia none none 0.75 none 1 1.25 loose number none none none none none none dia none none none none none none oIe dia none none none none 1/16 0.75 Vane on face thx none none none none 0.25 0.75 wid none none none none 1 2 ength none none none none 24 48 on back thx 0.25 0.5 0.75 0.5 any any wid 0.5 1 2 1 any any ength 24 36 36 36 any any plft number none none any any any any length none none 24 24 24 48 Theck surface number 3 any any any any any wid 1/32 1/32 1/32 1/32 1/32 any length 4 4 4 4 10 any 'itch light wid none *area 576 any *area 576 any any length none any any any medium wid none none *area 768 none *area 768 any length none none none any heavy wid none none none none none any length none none none none none any 'ocket number *1 *2 *4 *4 4 6 width 1/16 1/16 1/16 1/16 1/16 area 4length 3 3 6 6 8 taln type light medium medium medium any any wid area 115.2 area 384 any any any any length any any any any pub- ategory Grade elect &BTR-1&2CLEAR C SELECT X DSELECT X inish SUPERIOR X PRIME X EFINISH X X - Data in the column is the specification for the grade in the row. none - Not allowed any No limitations area - Width x length * - Only one of the characteristics with symbol * in the same column is allowed. For example, grade B&BTR-1&2CLEAR allows 2 firm knots or 1 pocket. 97 Table B4. Test results of grading the lumber in the Select/Finish category )efect Type/Location Measure fact (<= inches)_____ (not firm number 2 2 dia 0.5 0.75 fixed number 4 6 dia 1 1.25 loose number dia dole die 1/16 0.75 vane on face thx 0.25 0.75 wid 1 2 length 24 48 on back thx 0.25 0.5 0.75 0.5 wid 0.5 1 2 1 length 24 36 36 36 put number 2 1 1 1 length 24 24 24 48 heck surface number 3 1 2 1 2 wid 1/32 1/32 1/32 1/32 1/32 length 4 4 4 4 10 itch light wid length medium wid 20 20 length 30 30 heavy wid length 'ocket number 2 4 6 width 1/16 1/16 1 length 3 8 3 itain type light medium medium medium wid 8 15 20 20 length 10 20 30 30 pub- ategoIy Grade elect I&BTR-1&2CLEAR C SELECT X DSELECT X X inish SUPERIOR X X X PRIME X X EFINISH X 1) X indicates that input data in the column satisfies the grade in the row. 2) Blank cell means that no such characteristic exists. 3) For the same set of facts, grade overlaps are allowed. For example, facts in the first column match grades B&BTR-l&2CLEAR and SUPERIOR. 4) The results satisfy the specification, indicating the system works well. Table B5. Specifications of grades for a piece of lumber in the Boards category (lumber size = l"x8"x12') )efect rype/Location Measure Limiting Provisions (<.. in) rirm-red dla 2.25 3 3.5 1W5 2.5 T not firm-black dia 0.75 1.25 7/3 16/3 1.25 2.5 3.5 16/3 loose dia none none 1.5 2.5 none 1.25 1.75 2.5 -lole dia none none 1.5 25 1/16 1.25 1.75 2.5 dane on face thx none none none 0.5 none 0.5 0.5 <1 wid none none none 1 none 1 4/3 2 length none none none 24 none 24 on back thx 0.5 0.5 2/3 any wid 1 4/3 2 _y any any length 36 48 72 any y_ pUt number 1 1 any any length 4 8 24 48 8 ..!_ 8 24 36 heck surface number 4 2 any any wld 1/32 1132 1/32 1/32 length 4 10 10 10 ith firm-heart wid 0.25 0.5 any ..! ? ? .!L ? ? ? length 24 72 any ? ? 7 ? ? light wid area 144 any any y_ any !k streak streak length any any any streak streak streak pitch medium wid none area 576 any any streak streak streak length none any y any streak streak streak heavy wid none none area 576 area none streak streak streak ylength none none 576 none streak streak streak y 'ocket number 2 3 any ! y any Lwidth 1/16 1/16 1/16 area 4 1/16 1/16 .i. ..!!i. length 3 6 12 12 12 _L itain type light medium medium !' medium ywid area 384 any any any length any any _y any _!L )ecay wid length none none area none none none samli y none none 144 _!i an an none none none small anub- :ategory Grade 1 COMMON 2 COMMON x ommons 3 COMMON X 4COMMON X 5 COMMON X SEL-MERCH x CONST X lternate STAND X UTIL X -- ECONOMY x X - Data in the column is the specification for the grade in the row. none - Not allowed any - No limitations area - Width x length Table B6. Test results of grading the lumber in the Boards category ii-. FJF YA'fli fli: I__ ------ - -- ;I II k'I -- -- li rr --_---- --_ [.i.J -- _________Lull I - 1) X indicates that input data in the column satisfies the grade in the row. 2) Blank cell means that no such characteristic exists. 3) For the same set of facts, grade overlaps are allowed. For example, facts in the first column match grades 1 COMMON and SEL-MERCH. 4) The results satisfy the specification, indicating the system works well.