Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Development of a knowledge-based hierarchical control structure for process automation Wickramarachchi, Nalin K. 1995

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata


831-ubc_1995-983655.pdf [ 4.43MB ]
JSON: 831-1.0081032.json
JSON-LD: 831-1.0081032-ld.json
RDF/XML (Pretty): 831-1.0081032-rdf.xml
RDF/JSON: 831-1.0081032-rdf.json
Turtle: 831-1.0081032-turtle.txt
N-Triples: 831-1.0081032-rdf-ntriples.txt
Original Record: 831-1.0081032-source.json
Full Text

Full Text

DEVELOPMENT OF A KNOWLEDGE-BASED HIERARCHICAL CONTROLSTRUCTURE FOR PROCESS AUTOMATIONByNalin K. WickramarachchiBSc. (Hons), Moratuwa, Sri Lanka; MSc., London, U.K., 1988A THESIS SUBMITTED IN PARTIAL FULFILLMENT OFTHE REQUIREMENTS FOR THE DEGREE OFDOCTOR OF PHILOSOPHYinTHE FACULTY OF GRADUATE STUDIESDepartment ofMECHANICAL ENGINEERINGWe accept this thesis as conformingrequired standardh).•THE UNIVERSITY OF BRITISH COLUMBIAMarch 1995© Nalin K. Wickramarachchi, 1995In presenting this thesis in partial fulfilment of the requirements for an advanceddegree at the University of British Columbia, I agree that the Library shall make itfreely available for reference and study. I further agree that permission for extensivecopying of this thesis for scholarly purposes may be granted by the head of mydepartment or by his or her representatives. It is understood that copying orpublication of this thesis for financial gain shall not be allowed without my writtenpermission.(Signature)Department of____________________The University of British ColumbiaVancouver, CanadaDate (0 MDE-6 (2188)AbstractFuzzy logic is applicable in representation and processing of knowledge in some types ofknowledge-based control. The technique is particularly useful when the plant that is tobe controlled is complex, incompletely known, and difficult to model either analyticallyor experimentally, but when a knowledge base is available in the form of if—then rulescontaining fuzzy descriptors. The standard practice of applying fuzzy logic in controlsystems is to replace a conventional direct controller with a rulebase and an inferencemechanism that is based on fuzzy set theory. Thus, in the standard fuzzy logic control,the knowledge-based controller is located in the low-level control loop itself.In the present research, a significantly different approach to standard fuzzy logic control, one that is particularly useful in process automation, is considered. The knowledge-based control system developed in this research has a hierarchical architecture, whereknowledge-based decision making that depends on fuzzy logic, is employed for high-levelfunctions like process monitoring, tuning, and supervisory control, leaving the low-leveldirect control to conventional controllers. It is argued that since fuzzy logic is primarilya method of artificial intelligence, the proper place for such a tool would be the upperlevels of a hierarchy rather than in low-level direct control, where the fastest and mosthigh-resolution data processing take place.A general model for a hierarchical fuzzy system is introduced, which uses transitionaland combinational operators. Some characteristics of these operators are explored. Hierarchical fuzzy systems are shown to be characterized by several heuristic features suchas information resolution, fuzziness of information, and the required data processingintelligence. Some preliminary relationships between these parameters are explored.11It is argued that fish processing is one application where the knowledge-based hierarchical control system that is developed in this research, is appropriate. The rationalefor this choice is given. As the application testbed of the developed technology, an automated workcell for fish processing that has been developed in the Industrial AutomationLaboratory is employed. An on-line system is implemented for monitoring and tuning ofthe workcell, which incorporates computer vision, knowledge based tuning, servomotoroperation, and conveyor control. The attractiveness of employing fuzzy logic in the context of a data processing hierarchy is illustrated, by means of a case study of application,where large quantities of low-level information that is generated by various sensors areabstracted through the use of fuzzy-logic based processing. The resulting informationthat has a lower resolution but more amenable to knowledge-based decision making, permits one to perform more intelligent data processing at a reduced computational burden,and by making use of available experience and expertise on the particular process plant.111Table of ContentsAbstractTable of Contents ivList of Figures ixList of TablesNomenclature xiiiAcknowledgement xvii1 Introduction 11.1 Objectives of the Research and Accomplishments 11.2 Proposed Approach and Rationale 41.3 Intelligent Control 101.4 Fuzzy Systems 131.5 Knowledge-Based Systems 141.6 Hierarchical Control is1.7 Overview of Thesis 172 Literature Survey 182.1 Fuzzy Logic and Fuzzy Sets 182.2 Fuzzy Logic and Control 202.3 Hierarchical Control and Expert Systems 23iv3 Fuzzy Control and Hierarchical Systems 283.1 Introduction 283.1.1 Fuzzy Sets and Fuzzy Logic 293.1.2 Operations Involving Fuzzy Sets 313.1.3 Linguistic Variables 323.1.4 Approximate Reasoning 333.2 Fuzzy Logic Control (FLC) . . . 343.2.1 Fuzzy Control Rules 363.3 Hierarchical Fuzzy Systems (HFS) 383.4 Fuzzy Resolution 443.5 Measure of Fuzziness 553.5.1 Fuzziness of Inference 583.6 Properties of the Transition and Combination Operators 604 Lab oratory Implementation—Software Development 644.1 An Overview of the Laboratory Workcell 654.2 Hierarchical Control Structure 664.2.1 Realization 704.3 Information Preprocessing 734.3.1 Preprocessor for camera images 734.3.2 Preprocessor for servomotor response 804.3.3 Preprocessor for cutter load profile 844.3.4 Preprocessor for conveyor speed profile 894.4 Knowledge Acquisition and Representation 894.4.1 Types of fuzzy control rules 934.4.2 Fuzzy rulebase for the workcell 94v4.5 Implementation of Inference Engine 1004.5.1 The relational table 1034.5.2 Max-mm inference 1074.6 User Interface to the Workcell 1094.6.1 The main menu 1104.6.2 The sensor menu 1104.6.3 The preprocessor menu 1134.6.4 The workcell status menu 1134.6.5 The knowledge base menu 1134.6.6 The decisions menu 1164.6.7 The controller menu 1164.6.8 The devices menu 1165 Laboratory Implementation—Hardware development 1195.1 The Iron Butcher 1195.2 Fish Processing Workcell — An Overview 1215.2.1 Primary vision subsystem 1245.2.2 Conveyor 1245.2.3 Cutter assembly 1265.2.4 Servomotor selection 1295.2.5 Drive amplifiers for the servomotors 1305.3 Sensors and Associated Circuitry 1305.3.1 Secondary vision subsystem 1315.3.2 Speed and position sensors 1325.4 Hardware for Interfacing and Data Processing 1365.4.1 GPB-1 image processing system 136vi5.4.2 DMC-620 two-axis servomotor controller 1395.4.3 I/O interfacing board PCL-812 1415.5 Integrated Hardware Configuration 1426 A Case Study of System Performance 1446.1 Tuning of Servomotors 1446.2 Performance of Rulebase for Workcell Tuning 1496.3 Performance of Rulebase for Assessment of Product Quality 1547 Conclusion and Future Work 1587.1 Conclusion 1587.2 Significance of the Work 1607.3 Limitations 1607.4 Future Work 161Bibliography 163Appendices 169A User Manual and Reference 169A.1 An Overview 170A.2 Interfacing Hardware 171A.3 Files 172A.4 Operation 174A.5 Compilation and Linking 176A.6 Reference Guide 177A.6.1 Main module — fishmain.c 177A.6.2 Hardware driver module — fishdrv.c 180viiA.6.3 Sensor module — fishsens.c 186A.6.4 Preprocessor module — fishfilt.c 188A.6.5 Status module— fishstat.c 193A.6.6 Knowledge base module — fishsknow.c 196A.6.7 Decisions module — fishdecn.c 197A.6.8 Layout module — fishlay.c 199B DMC Controller Program Listing 201viiiList of Figures1.1 Control Hierarchy of an Automated Workcell 51.2 A Generalized Knowledge-Based, Hierarchical System 73.1 Graphical Representation of a Set. (a) Crisp Set (b) Fuzzy Set 303.2 Fuzzy Representation of a Load on a Motor 333.3 General Configuration of a Fuzzy Logic Controller 353.4 Realization of Fuzzy Implication with a MISO Rulebase 393.5 A Hierarchical Fuzzy System with Two Layers 413.6 A Generalized Model of a Hierarchical Fuzzy System 423.7 Qualitative Relationships of Information Resolution, Fuzziness of Information and Cycle Time of Processing with Level of Hierarchy 433.8 An Example of Graphical Representation of Fuzzy Resolution. (a) CoarseResolution. (b) Fine Resolution 443.9 Fuzzification Under Equidistant and Triangular Membership Functions. 463.10 Fuzzy Inference Under Monotonically Incrementing Rules 483.11 Magnitude of f(m) for Different Values of m1 and m3 513.12 Magnitude of f(m) Under Equidistant Triangular Membership Functions 523.13 Magnitude of f(m) with Incremental Input ax 533.14 Index of Fuzziness as Measured Using Hamming Distance 583.15 Index of Fuzziness for the Inference of a Monotonic Rulebase 593.16 Index of Fuzziness of an Inference as a Function of Input membership.. 613.17 Control Inference and its i-cut 62ix4.1 Hierarchical Monitoring/Control System for the Workcell 674.2 An Image of a Processed Fish. (Image Size = 512x480 pixel) 694.3 Software Modules in the Workcell 714.4 Raw Image of a Processed Fish Where Processing Quality is Acceptable 754.5 Raw Image of a Processed Fish Where Processing Quality is Unacceptable 754.6 (a) Region of Interest After Processing the Image of Acceptable Cut. (b)Cutting Contour for the Same Image 764.7 (a) Region of Interest After Processing the Image of Unacceptable Cut.(b) Cutting Contour for the Same Image 764.8 Arc-Length Profile for the Acceptable Cut 774.9 Arc-length Profile for the Unacceptable Cut 774.10 Membership Functions for Generating the Context of Visual Quality. . 794.11 Membership Function for Generating the Context of Cutting Accuracy. 794.12 Typical Servomotor Response Parameters. (a) Underdamped Case (b)Overdamped Case 814.13 Membership Functions for Servomotor Performance Indices 844.14 Percent Load versus Slip for the Induction Motors 854.15 Typical Load Profiles of the Two Cutter Blades 864.16 Membership Functions for the Cutter Load Context 874.17 Membership Functions for Conveyor Performance 904.18 Output Space Partitioning for the Rulebase of Servomotor Tuning 954.19 Frequency Domain Specifications (Design Parameters) As Applicable tothe Rulebase for Servomotor Tuning 964.20 Output Space Partitioning for the Quality Assessment Rulebase 994.21 Output Space Partitioning for the Rulebase of Workcell Tuning 1024.22 The Main Menu of the User Interface of the Workcell 111x4.23 The Sensor Menu of the User Interface of the Workcell 1124.24 The Preprocessor Menu of the User Interface of the Workcell 1144.25 The Status Menu of the User Interface of the Workcell 1154.26 The Knowledge Base Menu of the User Interface of Workcell 1175.1 The “Iron Butcher” 1205.2 Schematic Diagram of the Fish Processing Workcell 1225.3 Speed Control Loop for the Conveyor 1255.4 Cutter Assembly 1285.5 Speed Sensing Hardware 1345.6 Functional Block Diagram of the OPB-1 Image Processing Board 1385.7 Control Loop Implementation Using the DMC-620 Controller 1395.8 Hardware Configuration of the Overall Control System of the Workcell 1436.1 Servomotor Tuning Performance—Initially Overdamped System 1466.2 Servomotor Tuning Performance—Initially Underdamped System 1486.3 Cutter Load Profiles 1516.4 Fuzzy Linguistic Context for Cutter Load Profiles 1526.5 Fuzzy Linguistic Inferences of the Rulebase for Workcell Tuning 1536.6 Raw Images of Processed Fish As Captured by the Secondary CCD Camera. 1556.7 Arc-Length Profiles of the Processed Fish Images in Figure 6.6 1566.8 Fuzzy Linguistic Context for the Images of Processed Fish in Figure 6.6 . 1566.9 Fuzzy Linguistic Inference of Quality of Product for Images in Figure 6.6 . 157xiList of Tables4.• • • . 130• • . . 132• . • • 135• • . . 136145145147147150Different Kernals Used in Convolution OperationsContext Database for the Servomotor PerformanceContext Database for Cutter PerformanceContext Database for the Conveyor PerformanceConsequent (Action) Variables for Servomotor Tuning.Rulebase for Servomotor TuningRulebase for Assessment of Product QualityRulebase for Workcell TuningCut_load_mem[i] U] - Representation of the Fuzzy Variable “cut_load”.Servomotor ParametersServomotor Torque Requirements .Specifications of the Servomotor EncodersSpeed Sensor SpecificationsParameters of the Ultrasonic SensorContext for Servomotor Responses in Figure 6.1Inferences of the Rulebase for Responses in Figure 6.1 . .Context for Servomotor Responses in Figure 6.2Inferences of the Rulebase for Responses in Figure 6.2 .6.5 Numerical Parameters Resulting from Preprocessing Cutter Load Profiles.6.6 Quality Indicative Indices for the Images of Fish in Figure 6.6 155xiiNomenclatureSymbol Descriptiona Acceleration of a servomotor.a Distance between two successive modal points in the input space.A Lead compensator zero.Aa The a-cut of a fuzzy set A.A The crisp set nearest to a fuzzy set A.b Distance between two successive modal points in the output space.C’ The th fuzzy state of a fuzzy consequent variable C1Context at level-n of a hierarchy.e Efficiency of lead-screw mechanism.The th fuzzy state of a fuzzy antecedent variable E1e Inference (action) of level-n of a hierarchy.F Complement of a fuzzy set F.F A fuzzy set.Filter for preprocessing sensory information from’the j level to thelevel of a hierarchy.f(m) Nonlinear control term in the equation for control action of a rulebase.f(n) A smoothing filter function.FR Friction force.Ca,f Gain at crossover frequency.Gd Disturbance input to the reference model.xliiG(jw) Transfer function of lead compensator.Knowledge base of level-n of a hierarchy.Gr Transfer function of a reference model.Hd Generalized Hamming distance between two fuzzy sets.112 Normalized Hamming distance between two fuzzy sets.Euclidean distance between two fuzzy sets.H Normalized Euclidean distance between two fuzzy sets.H1(A) Entropy of a fuzzy set A.i An index of integer value.‘a Index of asymmetry.If(A) Index of fuzziness of a fuzzy set A.I Index of secondary peak load.Index of secondary peak time.j An index of integer value.J Moment of inertia of moving parts cutter assembly.k An index of integer value.K Gain of lead compensator.K2 Integral gain of lead compensator.Lm& Maximum load on the bottom cutter blade.Lmt Maximum load on the top cutter blade.Average cutter load as a percentage.L8 Secondary peak load.m Mass of moving parts of cutter assembly.MA Distribution of modal points in input space.xivMB Distribution of modal points in output space.m Value of membership corresponding to th fuzzy Number of fuzzy partitions in the input Number of fuzzy partitions in the output space.p Pole of the digital compensator transfer function.q Zero of the digital compensator transfer function.r Pitch of a lead-screw.Rxy A fuzzy relation in the Cartesian product space of X x Y.Sensory information vector at level-i of a hierarchy.s Frequency in complex domain.S Overshoot of a response.Percentage overshoot of a response.T Cycle time of data acquisition.T Maximum torque of servomotors.T,. Rise time of a response.U A universe of discourse of a set.u Control action inferred from a rulebase.A general element in a universe of discourse U.Vav Average conveyor speed.Speed fluctuations of conveyor.A general element in a universe of discourse V.A general element in a universe of discourse W.x Value of an input to a fuzzy rulebase.a Ratio of compensator pole to zero.xvSx Incremental input to a fuzzy rulebase.Membership function of a fuzzy set F.,uF(u) Membership of an element u1 to a fuzzy set F.Damping ratio.T8 Time of secondary peak load.Phase lead at crossover gain frequency.Wcog Frequency at crossover gain.wd Damped natural frequency.Undamped natural frequency.In addition, the symbol ® is used to denote fuzzy transitional operator which couldbe broadly defined as an operation of data abstraction. Similarly, the symbol e is usedto denote fuzzy combination which could be broadly defined as a data fusion operation.xviAcknowledgementI would like to express my thanks to Dr. C. W. de Silva for his constant supervision andguidance throughout this research. Thanks are also due. to my supervisory committeemembers, Dr. R. C. Cosine, Dr. V. J. Modi, Dr. C. C. H. Ma, and Dr. F. Sassani.Funding for this research was provided by grants to Dr. de Silva from the AdvancedSystems Institute of B.C., B. C. Packers, Ltd., and from the Natural Sciences and Engineering Research Council of Canada. I would like to express my gratitude to them too.I would also like to thank my friend and colleague Dr. Lalith Carnage for his assistancein providing technical support throughout the research period.xviiChapter 1IntroductionIn this introductory chapter, first the main goals of the research are outlined. Thenthe primary accomplishment that have been made during the course of the researchare summarized. The approach that has been taken in achieving the research goals isindicated. Also the rationale for taking that specific approach is highlighted. Finally, thescope of the research field that encompasses the present work is presented. It will includea brief description on the significance of the three inter-disciplinary subjects which are ofinterest in the current research; namely, hierarchical control, fuzzy systems theory, andknowledge based systems.1.1 Objectives of the Research and AccomplishmentsA principal objective of the proposed research is to extend the scope of fuzzy tuning, asfirst applied by de Silva and MacFarlane (1988), and further extended by de Silva (1991a),to the area of hierarchical control. In fuzzy tuning, as proposed by these researchers, theexpert system that is based on fuzzy logic resides outside the conventional control ioopand takes the form of a knowledge base for optimal tuning. Such a fuzzy tuner worksby observing the process output and adjusting the control parameters of the controllerto effect remedial actions if necessary. This planned extension seems quite intuitive inthat the functional hierarchy of a complex intelligent control system could be naturallyassociated with a parallel and hierarchical body of knowledge. In accomplishing thisresearch objective, it is proposed to formulate an analytical framework for a hierarchical,1Chapter 1. Introduction 2fuzzy-control system in general terms and then develop a suitable control structure forthe system. It is planned to demonstrate the practicality of the work by implementingthe control structure in an automated fish processing machine.Knowledge representation is fundamental in any knowledge-based control system, andis addressed in the present research. Specifically, the use of linguistic if-then rules thatcontain fuzzy descriptors will be considered. Formulation of such a “fuzzy rule-base”for a given level of hierarchy of the system, is very much governed by the sub-goalspertaining to that level. Generally, these sub-goals may be expressed qualitatively in alinguistic or verbal form, as expressed by human operators. Although experienced plantoperators or production engineers could usually express such knowledge in a linguisticform, these statements cannot be converted into an analytical, quantitative form or intocrisp algorithms due to the vague, incomplete, and imprecise nature of such knowledge.One way of transcribing such knowledge is to use fuzzy linguistic variables in the contextof a set of fuzzy if—then rules. A major difficulty encountered in this situation is that thestatus of the process or the plant that is being controlled is usually available as analogsignals of high resolution. A method has to be devised to enable conversion of such vastamounts of crisp information into a form that is compatible with the context information(typically, fuzzy linguistic variables) in the rule-base at a specific level of the systemhierarchy. In other words, the low-level information has to be properly preprocessedand combined to generate the context for each level of the hierarchy. The nature ofthe associated “transition” and “composition” operations [de Silva, 1991b] have to bestudied. Also, there are some intuitive characteristics of a knowledge system whichrelate to the hierarchical structure of that system. For example, information resolutionand precision that are needed for effective decision making tend to decrease with thehierarchical level. In decision making based on fuzzy reasoning, the concept of fuzzyresolution [de Silva, 1991a} will be useful in this context. Also, the level of intelligence thatChapter 1. Introduction 3is needed for decision making generally increases with the hierarchical level. Furthermore,event durations tend to increase and as a result the associated control bandwidth willdecrease with the hierarchical level. These are important considerations in modeling,analyzing, and developing a hierarchical control system, which will be addressed in thepresent research.Since the practical objective of the present work is to develop a knowledge-basedhierarchical control system for an industrial process, it is clear that the performance ofthe hierarchical system in terms of speed, accuracy, and stability is a crucial consideration. The analytical framework, modeling approaches, and control structures that aredeveloped in the present research should satisfy these requirements.The research presented here has a direct practical significance in improving the performance of process industries through the introduction of advanced technology of intelligentcontrol. In particular, as an industrial application, performance improvement of existing process plants in the fish processing industry, by means of autonomous supervisorycontrol, will be considered. In particular, performance improvement will be achievedby introducing a knowledge-based hierarchical control structure. The particular controlstructure will have knowledge acquisition, representation, and processing capabilities atthe upper levels and will contain low-level controllers for the individual components (e.g.,cutters, conveyors, grippers, feeders, etc.,), with associated sensors and signal conditioning hardware. The control structure will be intelligent and adaptive and will provide adegree of autonomy to the plant. Also, programmability and the availability of a multitude of components that can perform different tasks, at the lowest level of the controlstructure, will make the overall system more flexible. In an automated process thatemploys the specific control structure, accuracy and throughput improvements will beachieved by means of high-speed devices that can be accurately controlled with appropriate sensory feedback at the lowest level and with intelligent monitoring, tuning, andChapter 1. Introduction 4supervisory control at the upper levels.In summary, this thesis proposes a methodology to bridge the two approaches ofsystem analysis; namely, hierarchical systems theory and fuzzy systems theory, for thespecific purpose of industrial process automation. A generalized model will be developedsuch that fuzzy systems analysis could be incorporated into a hierarchical system. Thismodel will be general enough to be useful in most industrial process automation applications. Also, hierarchical fuzzy systems are shown to be characterized by several heuristicfeatures such as information resolution, fuzziness of information, and data processingintelligence. Some preliminary relationships between these parameters will be explored.These ideas will be applied and tested by developing an on-line quality control and monitoring system for a prototype fish processing workcell which has been implemented inthe laboratory.1.2 Proposed Approach and RationaleThe levels in a hierarchical structure can be viewed from various points of view. Thenature of tasks carried out and the type of information handled, the level of resolutionof the data that is available and the information that is required, and the bandwidthand event duration are considerations that can be used to rank various levels in a controlhierarchy. The present research will address these considerations in a general framework.Also, application of the developed technology in an industrial fish processing workcellwill be accomplished. The degree of fuzziness will be viewed here as a primary means ofclassifying information and knowledge for various levels in the hierarchy. In particular,the concept of fuzzy resolution will be addressed.Consider the hierarchical structure shown in Figure 1.1 for a fish processing workcell.The end objective of the workcell may be to cut salmon for various requirements (e.g.,Chapter 1. Introduction 5butchering for fresh and frozen markets, filleting, and portion control for canning), andto grade fish products (e.g., herring roe). In this context, raw product recovery or yield,throughput rate, product quality, and aesthetic features become important subgoals.For a particular task such as head removal of a batch of salmon, the mechanical processinvolves feeding whole salmon into the machine (conveyor), grasping and holding-downeach salmon separately on the conveyor, sensing for the purpose of establishing the cuttinglocations, and cutting the salmon according to information derived from the sensors.Level 3Data BaseControl/MonitoringKnowledge BaseWorkcell FuzzyStatus InferencesLevel 2Preprocessing of Context DefuiticationSensory Data GenerationSensory Parameter Update,Information Tuning/Reference CommandsLevel 1______________________________________________________Quality Thickness Load Geometric Conveyor Cutter PlatformMonitoring Sensor Sensors Sensory Controls Controls ControlsCamera CameraFigure 1.1: Control Hierarchy of an Automated Workcell.Various components of the workcell have to be properly commanded and coordinatedin consistency with the particular (mechanical) processing task, and furthermore theoverall system has to be monitored at appropriate levels for performance evaluation andpter 1. Introduction 6perhaps for feedback control.The hierarchical structure shown in Figure 1.1 has three levels. While the functionsassigned to each level in this structure are not arbitrary, it is not difficult to increase thenumber of levels and enhance the functional distribution, thereby producing a more elaborate control structure. The present structure is adequate however, for the applicationsconsidered at present. First consider the degree of resolution of information at variouslevels of the hierarchy. At the highest level (Level 3), the database contains proceduralor linguistic information where the required degree of information resolution is relativelylow, yet degree of intelligence that is required to handle this information and make properdecisions would be high. As one proceeds down the hierarchy, the information resolutionhas to increase, and in particular, the best possible resolution should be used for low-levelcontrol (e.g., servo control) of the workcell components.A high level of fuzziness may be tolerated at upper levels of the control hierarchy,which incorporates more intelligent decision making, while even a slight fuzziness at thelowest level can lead to inaccurate and slow control. In this context the meaning of fuzzy‘resolution is important. Specifically, the total number of fuzzy states that are inherent ina variable represents the fuzzy resolution of that variable. For instance, suppose that theknowledge base at some level of the control hierarchy is expressed by the set of linguisticrules:[If E then if E then if E then C and C and .. C] (1.1)where the condition variable (antecedent) e may assume m discrete fuzzy states E, E,,••, E for i = 1, 2,.. , m and similarly each action variable (consequent) c3 may assumer discrete fuzzy states C, CJ, ., C for j = ,p. Note that the integer value m,represents the fuzzy resolution of E and similarly r represents the fuzzy resolution of C.Here, as the fuzzy resolution of a variable increases, the information resolution associatedChapter 1. Introduction 7with that variable also increases, and the corresponding knowledge base becomes moreappropriate for a lower level of the control hierarchy. Also related to a particular levelof control hierarchy are information (sensing, control, processing) bandwidth and eventduration. Specifically, the bandwidth will decrease and the event duration will increasewith the level of hierarchy.Figure 1.2: A Generalized Knowledge-Based, Hierarchical SystemA specific control structure of the type shown in Figure 1.1 may be modeled in amore fundamental and generalized manner, for the purpose of modeling and analysis.Consider a generalized hierarchy shown in Figure 1.2, within the specific context offuzzy control. This particular structure of information transfer and control can have avariety of applications including the ones that were outlined previously. The notationis used to denote the functional and control knowledge base at a particular (say, t1)level of the hierarchy, and it may contain structured information in the form of linguistice—n,1Functional/ControlKnowledge Base_Ge—nKnowIede-BasedActionsSensoryInformationChapter 1. Introduction 8fuzzy rules. The knowledge base receives instructions and inferences from the upperlevels and also data, information, and specialized knowledge from sensory feedback andknowledge sources at the present level and the lower levels. When information is receivedfrom a lower level, a pre-filter or an interpreter (denoted by E) will be necessary. Thishierarchical structure is operationally expressed as,= n ® [(E, 0 n) (En,n—i 0 (En,1 0 1) $ n+1j (1.2)Since intelligence may be considered as the capacity to acquire and meaningfully apply knowledge within the context of interpretation of data and information, perception,reasoning, learning and inference from incomplete knowledge (see, for example, De Silva,1995), it is directly related to the definition of the transitional operator 0 and the combinational operator , in equation (1.2). In the context of fuzzy inference, then, theseoperators can be interpreted within the framework of the compositional rule of inference[Zadeh, 1973]. Present research addresses these basic considerations of knowledge-basedhierarchical systems, and is expected to eventually lead to a general architecture andtheory for such systems.The hierarchical system that will be developed in the course of this research, as ageneral model, will be implemented in a laboratory fish processing workcell. The objectiveof the control system of this industrial machine is to improve the overall efficiency andquality of fish processing while maintaining a required throughput rate. This objectivecould be broken down into specific sub-goals such as minimizing wastage, maintaininghigh cutting quality, operating workcell components at a high speed but at requiredaccuracy levels and within the limits of their design specifications, and optimizing theperformance of the low level controllers. Although the specific problem of developinga fuzzy-logic based hierarchical system for a fish processing workcell in the IndustrialAutomation Laboratory, is addressed as a practical implementation and illustration, theChapter 1. Introduction gmethodology developed in the present research is general enough for application in abroader class of knowledge-based hierarchical systems.A multitude of sensors are installed in the workcell to facilitate the acquisition ofdata and information, for the knowledge base to infer the current status. These sensorsrange from simple microswitches for sensing the presence of a fish to video camerasfor observing cutting quality. The control system should be capable of carrying outdifferent tasks according to specifications, base on the conditions that are monitored.Such tasks could be organized into several groups according to their functionality. Forexample certain tasks would require high level of intelligence while some others mightbe quite straightforward and might not require an explicit knowledge base. As a result,the control structure has to be arranged in a functional hierarchy where various levelsuse appropriate rule-based inferencing techniques to generate control commands. It isthis functional hierarchy that is important in modeling and analysis of the system, buta hardware hierarchy would be useful from the point of view of system integration.The fuzzy rulebase for each hierarchical level is developed in a separate softwaremodule to facilitate future modifications and to maintain flexibility of the overall system.Special attention has been given to the development of a user interface for the fishprocessing workcell. Since the system is intended for use by machine operators on shopfloor, rather than by engineers and computer experts, it is essential that the interface issimple, robust, and user friendly. These aspects will be given due considerations in thepresent application.Due to the somewhat out of date technology that is currently in use for sensing thegill position of fish in present head-removal machinery, millions of dollars worth salmonis wasted annually. This happens when a salmon being inaccurately positioned with respect to the cutter blades so that the cutting location is beyond the collar bone [De Silva,Chapter 1. Introduction 101990]. Also, the basic tasks involved in fish processing such as butchering, cleaning, skinning, and filleting are monotonous, tedious, and generally unpleasant. In view of theseundesirable working conditions and also due to low wages, it has become increasinglydifficult to attract highly skilled and experience labour into the fish processing industry.It is therefore obvious that we need to explore ways of capturing human experience infish processing and automating it through advanced technology. Automation will alsohelp improve the reliability of operations and achieve higher standards of production.In summary, a general framework for knowledge based hierarchical systems will bedeveloped in the context of industrial process automation. This system will be demonstrated through implementation of an on-line monitoring and quality control interfacefor a prototype fish processing machine. A three-level hierarchy which is based primarily on the dual concepts of information resolution and fuzzy linguistic representation ofinformation, will be developed to handle the problem of vague or incomplete knowledgeassociated with human expertise. It is shown that the complex system analysis whichgenerally suffers from the problem of combinatorial explosion of information can benefitfrom a knowledge based hierarchical approach. Also the difficulties of dealing with vagueor incomplete information would be solved by a knowledge based approach. Fish processing industry in general can benefit from these advanced technologies by improvingthe efficiency and quality of their end products while saving on cost of expertise.1.3 Intelligent ControlIntelligent control is an interdisciplinary subject which encompasses areas like control systems theory, artificial intelligence, and operations research [deSilva, 1995]. The conventional control theory usually centers around regulation or stable operation of dynamicalsystems under various feedback criteria. A good a-priori knowledge of the system to beChapter 1. Introduction 11controlled is a standard requirement that is commonly assumed in conventional controlstrategies. Such techniques are however, proved to be seriously inadequate for providingproper control when the process is complex and ill-defined, and the control may haveto be performed based on available knowledge and human experience; for example, inseeking a particular goal under imprecise or incomplete information. Some reasons thatconventional control paradigms alone are incapable of delivering expected performancein complex plants are,1. Classical control theory is well suited for system analysis and design only when afairly accurate model of the system is available.2. Issues concerning operator behavior and operator interface are not incorporatedinto classical design.3. Multivariable and self-tuning controllers are based not only on theoretical controllaws but also to a large extent on heuristics.4. Most practical, optimal-control designs need the application of heuristics in theform of expert controllers.5. Artificial intelligence allows incorporation of human expertise and knowledge intocontroller design, which is typically not the case with conventional control.These problems can be circumvented to some extent by requiring that the feedbackcontrol loop contains an intelligent means; specifically, expert knowledge and a decisionmaker that are capable of dealing with the complexity of the situation. That is, aknowledge-based decision maker is required in the feedback loop. The knowledge base willrepresent the control knowledge that is available to perceive the status of the plant andthe outside world and to perform appropriate control actions. Sensory information is usedChapter 1. Introduction 12in two ways; off-line to generate a knowledge base, and on-line to trigger the reasoningprocess. An inference engine will make the control decisions using the knowledge-baseand the current status in the database, typically as determined by sensory data. Availableinformation has to be put in perspective for determining future strategies as well as forgenerating necessary information for planning and control.With the advent of inexpensive but powerful computers, it has been possible to incorporate “knowledge-based reasoning” into the feedback loop of a control system, by meansof appropriate software. This approach has been extremely popular with the researchersof “Fuzzy Logic Control (FLC)” where an FLC is introduced directly into the feedbackloop of a control system. While this method has been applied with great success to somespecific control situations, it would seem inappropriate that a knowledge-base that dealsprimarily with abstract data should transact directly with a control ioop that usuallydeals with real analog signals or crisp measurements. This disparity arises principallydue to the difference in the resolution of information that is processed by these two typesof systems. The issues concerning information resolution will be a main topic that willbe addressed in the current research.It has been previously suggested that intelligent feedback control is best employedif the knowledge-based system is separated from the conventional feedback ioop andplaced in an outer loop, in a higher supervisory capacity [de Silva and MacFarlane,1988]. This naturally leads us to a hierarchical control system where the principle ofincreasing intelligence with decreasing precision [Saridis, 1988] applies. This principleenables us to distribute knowledge of an intelligent control system among different levelsof a control hierarchy. For instance, intelligent tasks such as planning, scheduling andresource management could be designated to higher levels since those functions needless-precise but more-abstract information.Chapter 1. Introduction 131.4 Fuzzy SystemsThe theory of fuzzy systems provides an alternative approach for system analysis whiledeparting substantially from the conventional techniques that are based on crisp algorithms. It originated out of the contention that conventional quantitative techniques, nomatter how precise they may be, are intrinsically unsuited for dealing with humanisticsystems, or for that matter any system whose complexity is comparable to that of humanistic systems [Zadeh, 1973]. The theory of fuzzy logic is based on the premise thatthe key elements in human thinking are not numbers but labels of fuzzy sets; i.e., classesof objects in which transition from membership to non-membership is gradual ratherthan abrupt. This definition of fuzzy logic makes it a quite desirable tool for reasoningwith inherently vague and imprecise human knowledge, making possible the use of suchknowledge in systems where intelligent decision making is crucial.Control systems engineering is conventionally considered as an area of hard (nonflexible) algorithmic methodology, rather than soft computing methodology. Nevertheless, control of complex industrial plants has been a key area of successful applicationof fuzzy logic, commencing with the work of [Mamdani, 1974] and [Assilian, 1974] asoutlined in Chapter 2 of this thesis. In this class of applications, the tacit knowledge ofcontrol engineers, in the form of verbal statements have been transcribed as fuzzy rulesand used in conjunction with fuzzy inferencing methods to form a control policy. Theperformance of these early fuzzy linguistic controllers was so impressive that it motivatedmany researchers to apply fuzzy logic in a multitude of control problems thereafter.Most early attempts of applying FLC in complex processes were focused on using afuzzy decision making algorithm to derive control commands explicitly, based on feedbackinformation and the desired output states. This type of control could perform effectivelyonly for plants with large time constants where control commands are updated at aChapter 1. Introduction 14relatively low rate. When controlling fast, high-bandwidth processes, these direct andin-the-loop FLC’s fail due to the inherent delay and impreciseness introduced at thelowest level, into the plant by the controller.A different approach to the use of in-the-loop FLC was introduced by De Silva andMacFarlane (1988, 1989), where a fuzzy rule-based algorithm carries out the tuning ofa conventional controller, by monitoring and comparing the actual and desired performance. The system in this case has two layers. The lower layer has an ordinary feedbackloop integral with the process (plant) and a conventional regulator. The regulator hasadjustable parameters which are set by the upper layer. The adjustments are based onthe expert human knowledge pertaining to the plant that is being controlled and theassociated control expertise, and is captured as a fuzzy linguistic rulebase. To simplifythe low-level servo controller in the case of a nonlinear plant, a linearizing feedback loopmay be introduced as well [de Silva and MacFarlane, 1988; 1989]. In theory, there is nolimit to the number of layers that such a system can accommodate. Specifically, if the information processing requires higher degrees of intelligence, such tasks could be assignedlevels further higher up the hierarchy. In this manner, a hierarchy whose functionality isdistributed along the line of degree of intelligence could be devised.1.5 Knowledge-Based SystemsArguably, intelligence may be defined as the capacity to represent, use, and acquireknowledge in order to perceive, reason, plan or act in relation to various activities withrespect to our environment. Learning, and managing with incomplete information and inunfamiliar situations are important here. In this sense, an intelligent control system mustbe capable of representing and acquiring knowledge about the plant to be controlled aswell as the environment in which the plant operates. The control system must then beChapter 1. Introduction 15able to reason with this knowledge, and plan and carry out control actions on the plantsuch that the system is driven in a direction so as to fulfill the underlying objectives.The main components of a knowledge-based system are the inference engine, theknowledge base, one or more databases, and the user interface. A proper representationand reasoning system for the knowledge base must be selected and in the process weshould address such questions as those given below, with respect to the control problemwe are attempting to solve:i. What knowledge/experience do we possess concerning the plant?ii. What knowledge do we require to control the plant? Does the knowledge containimprecise or incomplete information?iii. What methods and tools support the acquisition and representation of such knowledge in the form of a knowledge base?iv. What kind of reasoning strategies seem appropriate for the task domain in orderto come up with control strategies?A necessary part of any knowledge-based system is its user interface through whichthe user will be able to monitor the current status of the process, and to interact withthe inferences. Any redundancy or conflict in the knowledge-based inferences shouldbe determined and resolved appropriately. Means are available for automatic conflictresolution, which can be incorporated in the reasoning mechanism [de Silva, 1995].1.6 Hierarchical ControlDecentralized or distributed control is useful in complex, large-scale systems with a variety of functional requirements. Hierarchical control is a common architecture that fallsChapter 1. Introduction 16within this class of control. Hierarchical control has been proposed by Albus (1982),Mystel (1988) and others for complex control situations such as robotic manipulators,and industrial process control. This class of control is particularly relevant when variouscontrol functions in the system can be conveniently ranked into different levels dependingon their functionality. Our particular focus in the current research is the control of industrial processes where feedback signals are derived from a multitude of different typesof sensors.In order to investigate the benefits of hierarchical control in process applications, consider three systems that are being developed in the Industrial Automation Laboratory:A fish processing workcell that uses a straight V-cut, a robotic contour cutting system,and a herring roe grading system. Many aspects are common to all three systems. Forexample, some of the system components (cameras, image processing systems, conveyors,etc.) are similar. Accordingly, the nature of low level control (e.g., servo control) willbe similar. Also the functions of each system may be arranged in a hierarchical manner;for example, Task Representation —* Subtask Description —* Component Coordination—f Low-Level Operation. Then, instead of developing three separate systems, we shouldbe able to develop a single hierarchical control system that is general enough to incorporate all three systems and perhaps several additional systems. Furthermore, due to thehierarchical nature of the control structure, various aspects of “control intelligence” canbe effectively incorporated at different levels of the system.By making the control structure less application-specific we will be able to handle many processes within a process plant in a planned and coordinated manner. Theprogrammability of the tasks that can be controlled with such a system, will provideflexibility. The knowledge and intelligence that are integrated into various levels of thesystem will provide increased adaptability and autonomy to the system. The throughputrate and accuracy of the process are improved through fast devices with accurate control.Chapter 1. Introduction 171.7 Overview of ThesisA review of the literature related to this thesis is presented in Chapter 2, which focusesmainly on the three major areas of interest, namely, Fuzzy Systems, Hierarchical Control,and Expert Systems. The history of application of fuzzy logic in control systems is brieflysurveyed and the uniqueness of the present approach emphasized.Chapter 3 describes the mathematical developments which play a significant role inthe application of fuzzy logic in control systems. Issues concerning hierarchical datarepresentation and resolution of fuzzy information are explored. A generalized model forknowledge-based hierarchical control is discussed and related problems are summarized.The implementation of the methodologies presented in the previous chapters, in relation to an automated fish processing workcell, is detailed in chapters 4 and 5. Thefirst of these two chapters will be on software development, which will present the techniques adopted to implement the knowledge base and fuzzy inference engine. It will alsodemonstrate the strategies used in the preprocessing stage of sensory information andthe construction of the workcell context in a fuzzy linguistic format. The user interfaceand the related aspects are also outlined. Chapter 5, which is on hardware developmentsgives a detailed description regarding the hardware that is necessary to implement areal-time working prototype in the laboratory. Needs of both computing and mechanicalhardware are discussed.Chapter 6 presents some important results obtained during the trial runs of the prototype workcell. The performance of the monitoring and tuning knowledge base is illustrated through data acquired during on-line experimentation with the laboratory prototype. Chapter 7 concludes the thesis, where accomplishments of the present researchare summarized and further work that could be undertaken to continue and enhance thepresent work, are outlined.Chapter 2Literature SurveyAn extensive survey has been carried out on the literature relevant to fuzzy logic control.This chapter summarizes the relevant work. It also outlines some publications on thesubject of hierarchical control and knowledge-based techniques. Most up-to-date researchpublications in the field of fuzzy logic exist primarily in the form of research papers, andin the following discussion, only the most relevant publications are considered.2.1 Fuzzy Logic and Fuzzy SetsZadeh (1965), in his pioneering paper, makes it clear that fuzzy logic is a tool for reasoningwith inherently imprecise concepts of systems engineering, and that the tool is basedon and expected to model human linguistic reasoning. Representation of vagueness orimprecision is therefore clearly relevant to and falls well within the intended purposeof fuzzy logic. The classical approach for studying uncertain or imprecise systems isthrough the use of probability theory and statistical techniques. In his first paper onfuzzy logic Zadeh (1965) proposes an alternative approach that is particularly suitablefor representing vague reasoning of human decision making process. He remarks in oneof his early papers on fuzzy logic {Zadeh, 1972b} thatIn general complexity and precision bear an inverse relation to oneanother in the sense that as the complexity of a problem increases, the possibility of analyzing it in precise terms diminishes. Thus ‘fuzzy thinking’ may18Chapter 2. Literature Survey 19not be deplorable, after all, if it makes possible the solution of problems whichare much too complex for precise analysis.Later, Zadeh has developed in detail a model for approximate reasoning [Zadeh, 1973and 1983] with vague data. Rather than regarding the human reasoning process as itselfan approximation of some more refined and exact logical process that could be carriedout perfectly with mathematical precision, he has suggested that the essence and powerof human reasoning is in its capability to grasp and use inexact concepts directly. Zadehargues that attempts to model or emulate the human reasoning process by formal systemsof increasing precision will lead to decreasing validity and relevance.A general introduction to the foundations of fuzzy logic is presented in a very clearand concise manner by [Zadeh, 1973]. By relying on the use of fuzzy linguistic variablesand fuzzy algorithms, Zadeh describes approximate, yet effective, means of describingthe behavior of systems which are too complex or too ill-defined to be handled by precisemathematical analysis. In this paper, Zadeh introduces definitions of such terms aslinguistic variables, fuzzy sets, fuzzy relations and the compositional rule of inference.Foundation of Fuzzy Reasoning [Gains, 1975]: This paper extensively discussesthe rationale behind the need for fuzzy logic in complex-system analysis and the application of fuzzy theory to real world problems. While introducing the basic operations offuzzy set theory, it also provides an excellent discussion on fuzzy inference, hedges, andtruth values.Fuzzy Reasoning and the Logic of Uncertainty [Gains, 1976]: This paper attempts to define fuzzy logic and fuzzy reasoning independent of the conventional logic.A possible relation between fuzzy logic and probability theory is also discussed at length.Chapter 2. Literature Survey 202.2 Fuzzy Logic and ControlThe work of Assilian (1974), Mamdani (1974), and Mamdani and Assilian, (1975) commenced the successful application of fuzzy logic in the control of complex industrial plants.While investigating learning algorithms for adaptive control of a nonlinear, multivariableplant (a prototype steam engine), they found that many learning schemes failed to evenbegin to converge on a reasonable time scale. A fuzzy linguistic method was developedby them to prime the learning controller with an initial policy in order to speed up adaptation. In their work, the verbal statements of engineers were transcribed as fuzzy rulesand used in conjunction with the compositional rule of inference, to form a control policy.Note that the fuzzy knowledge module was an integral part of the direct control loop inthat application.The performance of these early fuzzy logic controllers was so successful that theyinspired a range of studies such as those for a sinter plant [Carter and Hague, 1976], for aheat exchanger [Ostergaard, 1976], and for a hot water bath [Kickert and Lemke, 1976].Fuzzy Logic Control of a Heat Exchanger Process• [Ostergaard, 1976]: Thiswork explains at length a real world application of fuzzy logic in process control. Theexperimental heat exchanger process they investigated in that work had two input variables; the power delivered to the electric heating element and the hot-water flow rate.The output variables were the inlet temperature of the hot water and the outlet temperature of the cold water . The controller based on fuzzy linguistic rules, adjusted thetwo input variables so that the two output variables take on the chosen set-point values.Ostergaard also compares the performance of his fuzzy logic controller with that of aconventional proportional-integral (P1) controller. In the comparison of the two controlstrategies he states that the characteristics of the fuzzy controller are as good as thoseof the P1 controller. This, he argues, is a very promising conclusion with respect to theChapter 2. Literature Survey 21applicability of fuzzy logic to process control. Another important observation he makes isthat due to the comparatively large time it takes for the execution of the fuzzy algorithmon a computer (in this case 45 seconds), only processes with rather large time constantscan be controlled by on-line fuzzy algorithms. Again, the fuzzy knowledge system in hisapplication was directly in the low-level control loop.Application of a Fuzzy Controller in a Warm Water Plant [Kickert andLauta Lemke, 1976]: This work is a case study of designing a controller based on vague,human knowledge and fuzzy reasoning. Fuzzy algorithms on linguistic rules describing thecontrol strategy of the plant operators are applied to control the temperature of a warmwater tank. Several different strategies employed by human operators are implementedin fuzzy logic and the results are compared with each other. Here too, fuzzy logic hasbeen used for direct low-level control.Theoretical and Linguistic Aspects of Fuzzy Logic Control [Braae and Rutherford, 1979]: This is a theoretical paper motivated by the successful applications of fuzzylogic controllers by various researchers to a variety of complex and ill-defined processes.Initially the controller is analyzed by traditional nonlinear algebraic methods which areparticularly useful in stability studies. However this approach suffers from the limitationthat an algebraic model cannot directly deal with the linguistic aspects of a fuzzy logiccontroller. This leads to the introduction of a more concise and hence more powerfulnotation for representing the linguistic rules that describe the fuzzy logic controller. Theso-called linguistic models that arise from this notation are shown to be extremely usefulfor modeling highly nonlinear low order systems and for determining explicitly, the rulesof optimal fuzzy logic controllers.A Linguistic Self-Organizing Process Controller [Procyk and Mamdani, 1979]:A heuristic controller for a dynamic process is presented in this paper, whose controlpolicy is able to evolve and improve automatically. The heuristics of the controllerChapter 2. Literature Survey 22take the form of a set of linguistic decision rules which are expressed quantitatively andmanipulated by using theory of fuzzy sets. A series of experiments is described whichshows that the controller can be applied to a wide range of different processes that can bemultivariable and also nonlinear. The work demonstrates the robustness of the controller.The authors suggest that this form of controllers can find effective applications in thosecomplex systems which have been too difficult to control or which in the past have hadto rely on the experience of a human operator. Fuzzy logic is used in the direct controlloop in this work as well.Fuzzy Control Theory: A Nonlinear Case [Ying, Suer and Buckley, 1990]: Thiswork analyses the performance of a simple, fuzzy controller with linear and nonlineardefuzzification algorithms. The authors prove theoretically that such a fuzzy controller,a very elementary one with two inputs: error and rate of change of error, and a nonlineardefuzzification algorithm is equivalent to a non-fuzzy, nonlinear proportional-integral(PT) controller with proportional and integral gains changing with error and rate ofchange of error about a set point. Furthermore, it is shown that this fuzzy controller isapproximately equivalent to a conventional linear PT controller if a linear defuzzificationalgorithm is employed. Simulations are carried out to show that the performance of thefuzzy controller is almost the same as that of the PT controller when first order or secondorder linear processes are being controlled. More importantly, the simulations illustratethat the fuzzy controller is stable when a nonlinear process is introduced, whereas thePT controller is unstable. The fuzzy controller is converted, here, into a conventionalin-the-loop controller for analytical purposes.Fuzzy Logic in Control Systems : Parts I and II [Lee, 1990]: This is a surveyof the current status of research and development in the area of fuzzy logic controllers(FLC). A general methodology for constructing an FLC and assessing its performanceare described and problems that need further studies are pointed out. The first partChapter 2. Literature Survey 23of the paper is devoted to an analysis of structural parameters of FLC, and a briefsummary of fuzzy set theory, fuzzification strategies and construction of a rulebase forFLC. Part II of the paper addresses some issues relating to decision making in FLC,which include definition of fuzzy implication, compositional operator, interpretation offuzzy linguistic hedges, fuzzy inference mechanism and defuzzification strategies. Finally,the author presents some unsolved problems and discusses further challenges in this field.The study is limited to low-level, direct control.2.3 Hierarchical Control and Expert SystemsTheory of Hierarchical, Multilevel Systems [Mesaroviè, Macho and Takahara,1970]: This book reports the earliest attempt to develop a systematic theory for largescale systems where the systems themselves consist of a family of hierarchically arrangedsubsystems. In the first part of the book, various hierarchical systems from several fieldsare discussed. It is shown that the description of these systems can be given in terms ofthree basic underlying concepts, namely, level of abstraction (or associated difficulty orsignificance of modeling), level of complexity of decision making, and level of priority ofaction. All three concepts are formalized into the framework of a mathematical theoryof general systems. Formulation of the “coordination problem”, which appears to be ofcentral importance for any distributed or hierarchical system, is also presented.In the second part of the book, a mathematical theory of coordination is developed.A two-level system is considered with n decision (control) units in the first level and asingle decision unit in the second level. Coordination is defined as a decision problem ofthe second level with the objective of influencing the first level so as to promote a goaldefined for the entire system. A detailed theory of coordination is then developed for thesystems that are described in a specific mathematical framework.Chapter 2. Literature Survey 24Decision Making at a Level of Hierarchical Control for Unmanned Robots[Isik and Mystel, 1986]: A model for an intelligent, mobile, autonomous system equippedwith vision and low level sensors to cope with unknown obstacles is presented in thispaper, as a hierarchy of decision making for motion planning and control. The worlddescription is based on linguistic variables that assume values from possible intervalscorresponding to the membership grade of a fuzzy set. The decision making is carriedout as in the case of a production system, but with a fuzzy database. Fuzzy set operatorsare used to select the commands for optimal motion execution. At the end, the authorsassert that the awareness of the environment in the autonomous control problem, basedon visual sensing and recognition, is inherently descriptive rather than analytical. Thefinite problem space of a linguistic representation is instrumental in reducing the size ofthe problem therein. The tradeoff in the presented approach, however, is the accuracy ofrepresentation and consequently the precision of motion.The Role of Fuzzy Logic in the Management of Uncertainty in ExpertSystems [Zadeh, 1983]: This work suggests a systematic approach to the managementof information that is imprecise or incomplete, using the premise of fuzzy logic andfuzzy sets. Management of uncertainty is an intrinsically important issue in the designof expert systems because much of the information in the knowledge base of a typicalexpert system is imprecise, incomplete or not totally reliable. An alternative approachsuggested in this paper, is based on the use of fuzzy logic since it provides a systematicframework for dealing with fuzzy quantities; for example, “most”, “many”, “few”, “notvery many”, “almost all”, and “about 0.8”. As indicated in the paper, in this way, fuzzylogic subsumes both predicate logic and probability theory, and makes it possible to dealwith different types of uncertainties within a single conceptual framework.The Role of Hierarchical Knowledge Representation in Decision Makingand System Management [Rasmussen, 1985]: The knowledge representation of aChapter 2. Literature Survey 25decision maker in control of a complex system can be structured in several levels ofabstraction in a functional hierarchy. The author reviews the role of such an abstractionhierarchy in a supervisory control system. The relationship between the abstractionhierarchy and the decision strategies is discussed and the implications in the design ofdecision support systems are presented. The paper argues that an explicit descriptionof the functional properties of the system to be controlled, in terms of an abstractionhierarchy, is necessary for a consistent design of database and user interface of a decisionsupport system. In summary, this paper argues strongly that data abstraction; i.e.,extracting high level information from high resolution data, is a necessary step in anyscheme of hierarchical knowledge representation.Analytic Formulation of the Principle of Increasing Precision with Decreasing Intelligence for Intelligent Machines [Saridis, 1989]: This work providesan analytical formulation of the principle of increasing precision with decreasing intelligence (IPDI). The author contends that IPDI constitutes a fundamental principle inhierarchically intelligent control. The principle is derived from a probabilistic model anddemonstrated with respect to a three-level structure representing the organization, coordination, and execution hierarchies. The approaches necessary to implement the IPDIprinciple on an intelligent machine are also discussed.Knowledge-based Control Structure for Robotic Manipulators [De Silva andMacFarlane, 1988]: This paper proposes a three-level hierarchical control structure forrobotic manipulators, integrating knowledge-based soft control with conventional hardcontrol algorithms. The rationale for assigning soft control to a higher level of the hierarchy stems from the observation that knowledge-based control such as fuzzy control, whendirectly included in the servo loop, has produced unsatisfactory performance in researchrobots. Also, conventional servo control alone is known to be inadequate for nonlinearand high-speed processes including robots. Besides, practical knowledge regarding a highChapter 2. Literature Survey 26speed control system cannot be achieved through human-in-the-loop or manual control,and such knowledge is critical for a knowledge-based controller. These considerationsalong with the fact that human experts can very effectively perform tuning functions inprocess control, form the basis for the control structure proposed in this work.The rulebase of the fuzzy controller consists of expert knowledge in the form of linguistic if-then rules for servo tuning. Those rules are stored as a fuzzy decision table afterapplying necessary fuzzy set operations to the linguistic variables and their membershipfunctions. The ability to be able to represent implicit knowledge of human experts,flexibility of control structure and relative ease of further development and modificationare the major advantages of the proposed method. Furthermore, in the particular approach, all of these are achieved while retaining the precision and speed of a conventionalservo controller. The work has been further enhanced and elaborated in a subsequentmonograph by the authors [de Silva and MacFarlane, 1989].An Analytical Framework for Knowledge-Based Tuning of Servo Controllers [De Silva, 1991a]: This is a theoretical work that investigates the knowledge-based tuner of a two-level control structure in which a conventional PID servo controllerthat occupies the lower level is tuned by a fuzzy logic tuner at the upper level. Theknowledge-based tuner is first expressed in the conventional fuzzy logic formulation ofa linguistic rulebase to which the compositional rule of inference could be applied. Theconcepts of rule dissociation, fuzzy resolution and resolution relationships are developedas an analytical framework for the tuning problem. Computational requirements forthe system are analyzed to show that a substantial reduction in computational effort ispossible through this analytical framework. An example of tuning a PID controller of anonminimum-phase plant with transport delay is presented to illustrate the applicationof these concepts.Chapter 2. Literature Survey 27Fuzzy Information and Degree of Resolution within the Context of a Control Hierarchy [De Silva, 1991b]: This is a study of a hierarchical control structure fromthe view points of the degree of information resolution and the fuzziness of knowledgebase at various levels of the hierarchy. The specific control system considered in thepaper is a workcell for automated processing of fish. In particular, the relation betweeninformation resolution and fuzziness of knowledge base in connection with the level ofhierarchy is addressed. Further considerations are given to the duration of event cyclesand bandwidth of control. Application of theses concepts to sensing, monitoring andfunctional coordination within the hierarchical structure is also considered.The literature summarized above is considered to be the most relevant for the presentwork. In the interest of conciseness some other work that is related is not listed. Also,recent extensions to the work summarized above are available, and some of these will bementioned in the subsequent chapters. A good coverage of the basic concepts, analyticalconsiderations, and application of fuzzy logic in control is found in the book de Silva(1995).Chapter 3Fuzzy Control and Hierarchical SystemsThis chapter presents some results from the theory of fuzzy control that are relevant to thepresent application of hierarchical systems. First, mathematical preliminaries involvedin fuzzy sets and systems are introduced and subsequently, some results are extended toincorporate useful principles of hierarchical systems such as information resolution anddata abstraction. The issues arising from fuzzy supervisory control (e.g., tuning), asopposed to direct fuzzy control, are given special attention.3.1 IntroductionThe fuzzy logic control (FLC), which is based on fuzzy logic, provides a systematic meansof formulating an automatic control strategy, starting from expert knowledge usuallyexpressed in the form of linguistic control rules. Since the first appearance of Zadeh’sseminal papers on the linguistic approach [Zadeh, 1968; 1973] and system analysis basedon the theory of fuzzy sets [Zadeh, 1971; 1972], fuzzy control has emerged as a highlyactive area of research in the application of fuzzy set theory [Zadeh, 1965]. Recentapplications in this field include automatic system for train operation [Yasunobu, etal. 1983; Yasunobu and Miyamoto, 1985], operation of an automatic container crane[Yasunobu and Hasegawa, 1987], automobile-transmission control [Kasai and Morimoto,1988], and the development of control hardware based on fuzzy logic [Yamakawa, 1987].The success of these and other such applications is testimonial to the effectiveness offuzzy control in the context of complex and ill-defined processes, and particularly those28Chapter 3. Fuzzy Control and Hierarchical Systems 29that can be controlled by a skilled human operator who has the experience but may lackan explicit analytical knowledge of their underlying dynamics.3.1.1 Fuzzy Sets and Fuzzy LogicBefore the introduction of the FLC, following is a brief summary of some of the basicconcepts of fuzzy set theory and fuzzy logic which will be needed in the subsequenttreatments of the FLC. An in-depth discussion may be found in Zadeh (1965; 1973),Kaufmann (1975), and de Silva (1995).Let U be a collection of objects denoted by a general element u. If U containsall possible elements of interest in a particular problem domain, then it is called theuniverse of discourse, which could be either discrete or continuous. If the cardinalityofUisn,theni=1,2,...,n.Definition 1 : Fuzzy Set. A fuzzy set F in a universe of discourse U is defined by amembership function uF which takes values in the interval [0, 1]. Specifically this may berepresented by the mapping, p’ : U —* [0, 1].A fuzzy set may be viewed as a generalization of the concept of an ordinary set whosemembership function only takes two values {1, 0} corresponding to whether an elementbelongs to the set or does not belong to it respectively. This concept is illustratedgraphically in Figure 3.1, where a crisp set and a fuzzy set are depicted in terms of theirmembership functions.Hence, A fuzzy set F in U may be characterized by a set of ordered pairs of a genericelement u and its membership function:I uU} (3.1)Chapter 3. Fuzzy Control and Hierarchical Systems 30Figure 3.1: Graphical Representation of a Set. (a) Crisp Set (b) Fuzzy Set.When the universe of discourse U is continuous, a fuzzy set F is written concisely as,F= J uF(u)/U (3.2)uEUWhen U is discrete, a fuzzy set F is represented as,F=(3.3)Definition 2 : Support set. The support of a fuzzy set F is the crisp set formed bythe collection of all elements u e U such that iF(u) > 0.Definition 3 : Fuzzy Singleton. A fuzzy set whose support set is a single point (oran element) in U is referred to as a fuzzy singleton. Typically, but not necessarily, theassociated membership grade is unity; iF = 1.0.(a) (b)Crisp Set Fuzzy SetUniverse )c, Universe (k)NFuzzyBoundaryVenn Diagram Representation.1Elements of XSupport setMembership Function Representation.i Elementsof XChapter 3. Fuzzy Control and Hierarchical Systems 313.1.2 Operations Involving Fuzzy SetsSuppose that X and Y are two fuzzy sets defined in U with known membership functionsIx and y respectively. The set theoretic operations of union, intersection, and complement involving these fuzzy sets are defined in terms of their membership functions asfollows:Definition 4 : Union. The union operation, denoted by U (i.e., X U Y), is definedpointwise for all u U by the membership function PXUY, where/1XUy(U) = max{IIx(u),IIy(u)} (3.4)Definition 5 : Intersection. The intersection operation, denoted by fl (i.e., X fl Y),is defined pointwise for all u e U by the membership function tLXny, where1UXflY(U) = min{px(u), y(u)} (3.5)Definition 6 : Complement. The complement operation, denoted by an overbar (i.e.,.), is defined pointwise for all u E U by the membership function 4u1, whereILx(u) = 1 — Ix(u) (3.6)Definition 7 : Cartesian Product. Let X1,X2 ... ,X, be fuzzy sets defined independently in Ui, U2, ... , U respectively. The Cartesian product of X1,X2, ... , X,. is afuzzy set defined in the product space X1 x X2 x ... x X, with the membership function1xx2...x, whereIx1 xX2 ...x(ui, u2, ... , u) = min{tx1(ui),X2(u2), ... , I.Lx(u)} (3.7)Definition 8 : Fuzzy Relation. An n-ary fuzzy relation is defined as a fuzzy set R inthe cartesian product space U1 x x U with the membership function tR(u1, ... u)specifying the relative strength of the relation between the corresponding elements.Chapter 3. Fuzzy Control and Hierarchical Systems 32= {((ui,... u),.uR(u1, ... u,j) I (u1, ... u) e U1 x •.. x U} (3.8)where, the notation given by equation 3.1 is used.Definition 9 : Max-Mm Composition. Let R and S be fuzzy relations defined inU x V and V x W respectively. The composition of R and S, usually denoted by R o 5,is a fuzzy relation in U x W, and is given by the membership function LLROS, wherePRoS = max min{uR(u,v),.us(v,w)}, u E U, v E V, w E W (3.9)V3.1.3 Linguistic VariablesAs noted previously the use of fuzzy sets provides a basis for representing some vagueand imprecise notions of a natural language. In particular, we can employ fuzzy logic torepresent linguistic variables. The concept of fuzzy linguistic variables is best illustratedby an example. Suppose that the percentage load on an electric motor is interpreted asthe fuzzy linguistic variable “load”. The universe of discourse U for this variable willbe the closed interval of percentages; U = [0, 1001. We can now define several linguisticterms where each term is characterized by a membership function (i.e., a fuzzy set) inthe universe of discourse U. For instance, let the term set be defined as follows:Term-set(load) = {very low, low, moderate, high, very high}.We may subjectively interpret “very low” as a load smaller than 30%, “low” as aload around 40%, “moderate” as a load close to 50%, and so on. These terms canbe characterized by fuzzy sets whose membership functions are shown in Figure 3.2.Note that here, either triangular or trapezoidal membership functions are employed, forsimplicity.Chapter 3. Fuzzy Control and Hierarchical Systems 33MembershipGradeFigure 3.2: Fuzzy Representation of a Load on a Motor.In the context of hierarchical data processing, fuzzy linguistic interpretations couldbe viewed as a means of data abstraction. In other words, the information resolutionof the original stream of data could be reduced significantly, yet the intelligent contentof information is more suitable for knowledge-based processing. For example, instead ofreferring to load as an algebraic variable with very high resolution (limited only by theprecision of the measurements), we can use the linguistic terms such as low, moderate,and not very high to represent a whole range of loads without loss of substance in a high-level decision-making process. In fact, for a human being such terms enhance the contentof information (as opposed to resolution) or the meaning of the variable, because a highinformation resolution can be distracting and an effort would be needed to extract theuseful information from such information. Issues concerning information resolution andits importance to the current application will be further pursued later in this chapter.3.1.4 Approximate ReasoningThe inferencing technique of fuzzy logic could be considered as a generalization of theclassical rule of implication of modus ponens. It is also referred to as “approximateVery High30 40 50 60 70 PercentageLoadChapter 3. Fuzzy Control and Hierarchical Systems 34reasoning” since the implications are derived on the basis of approximate matching ofthe given premises with the antecedents of a rule. Let us first consider the classical ruleof modus ponens:Rule: If x is A then y is B.Premise: x is A.Consequence: y is B.The corresponding implication in fuzzy logic may be written as,Rule: If x is A then y is B.Premise: x is A’.Consequence: y is B’.The mechanism for fuzzy implication is based on the compositional rule of inferencesuggested by Zadeh (1973), whereby the unknown fuzzy set B’ can be inferred from theknown fuzzy sets A, A’, and B.Definition 10 : Max-Mm Compositional Rule of Inference. Let R be a fuzzyrelation in U x V, and x be a fuzzy set of data (context) also defined in U, then themax-mm compositional rule of inference asserts that the fuzzy set y defined in V may beinferred by the context x using the max-mm composition: thus,y = xoR (3.10)where x o R is the max-mirt composition of x and R as given in Definition 9.3.2 Fuzzy Logic Control (FLC)Application of fuzzy logic for the control of a dynamical system involves four basic steps;namely, development of the knowledge base, fuzzification of context information, application of the knowledge base through the inference engine, and defuzzification of theChapter 3. Fuzzy Control and Hierarchical Systems 35inference. Figure 3.3 shows the general configuration of an FLC in relation to a directcontrol ioop. It should be noted that this particular configuration is characterized by theknowledge base and the inference engine being an integral part of the control loop.Figure 3.3: General Configuration of a Fuzzy Logic Controller.The fuzzification part of the FLC accomplishes the conversion of measured values ofinput variables into suitable linguistic terms which could be interpreted as fuzzy subsetsin the universe of discourse of each measurement. Scaling or non-dimensionalization mayalso be involved in this phase such that all fuzzified variables have a uniform universe ofdiscourse.The knowledge base comprises the expert knowledge pertaining to the applicationdomain and aimed at achieving the control goal. Basically, the knowledge base consistsof a fuzzy rulebase and other definitions such as membership functions required for theinterpretation of data. The rulebase characterizes the control goal and control policy ofthe domain experts in the form of fuzzy linguistic if—then rules.The inference engine contains the logic needed for decision-making. It implementsKnowledge Base andDecision-MakingLogicFuzzificationInterfaceDefuzzificationInterfaceUControl InputChapter 3. Fuzzy Control and Hierarchical Systems 36the fuzzy implication and the rule of inference in fuzzy logic; in particular, the compositional rule of inference. The status of a database, which provides the current statusof the process variables (the context), will trigger the inference engine, which will leadto application of the compositional rule of inference. It is argued that the use of fuzzyconcepts would enable the FLC to simulate the capabilities of human decision-making.The output of the inference engine would be fuzzy sets indicating the required controlactions.The defuzzification block at the end of the knowledge base represents the conversionnecessary to yield crisp control actions from the inferred fuzzy control actions. A linearscaled mapping may also be required at this stage in order to match the control actionswith the acceptable range of parameters of the control hardware.3.2.1 Fuzzy Control RulesIn the case of an FLC, a model of the dynamic system which may be needed in conventional control, is replaced by a set of linguistic conditional statements which are knownas fuzzy if—then rules. Usually, these rules are developed on the basis of expert knowledgeand takes the following form:If (conditions are true) then (consequences to be fired).In an FLC, the “conditions” usually represent the process status and the “consequences” are the control actions. For example, a multi-input-multi-output (MIMO) fuzzylogic controller will have its fuzzy control rules in the following format:Rule 1: IfaisA1 andbisB1 and ... thenuisU1andvis V1 and...,Rule 2: IfaisA2 and bisB2 and ... thenuisU2andvis V2 and...,(3.11)Rulen: IfaisAandbisBand... thenuisUandvisVand...,Chapter 3. Fuzzy Control and Hierarchical Systems 37where a, b, etc. are linguistic variables representing process variables and similarly,u, v, etc. are linguistic variables representing control variables. A1,B, U, and V (i =1, 2,. . . , n) are linguistic values (fuzzy sets) in the universes of discourse A, B, U, and Vrespectively.A fuzzy control rule such as “If x is X then y is Y “ is implemented as a fuzzyrelation of “implication”. While there are many definitions for fuzzy implications, thepresent work employs the one due to Mamdani (1974) as defined below.Definition 11 : Fuzzy Implication. If A and B are fuzzy sets defined in U and V,with the membership functions and ILB, respectively, then the fuzzy implication R =(x is A) implies (y is B) is a fuzzy relation in U x V with the membership function R,whereR=UxV= JUxV’= I Ih(A_+B)(u,V)/(U,V).‘UXV= J min(1LA(u),B(v))/(u,v) (3.12)UxVNow, the th rule in the MIMO rulebase of equation 3.11 may be represented as thefollowing fuzzy implication [Lee, 1990]:RJMQ=(AjxBtx...)_-*(uj+vj+...) (3.13)where the antecedent of RMIMO forms a fuzzy set (A x B1 x .) and the consequent isthe union of m independent control actions (u + V1 +.). From this it follows that theMIMO rulebase R may be represented as the union of several multi-input single-outputChapter 3. Fuzzy Control and Hierarchical Systems 38(MISO) rulebase modules.R = UR:MIMOOü[(AxBx...w1 (3.14)j=1 1=1where, w = {u1,vi,. .. } having m terms.Thus, the rulebase of an FLC consists of several sub-modules with each composed ofn fuzzy control rules given in terms of multiple variables of process state and a singlecontrol action. This particular structure also helps reduce the complexity of softwareduring implementation, since the overall dimensions of the matrices representing thefuzzy relational implication are reduced accordingly. Figure 3.4 shows graphically, therealization of fuzzy inferencing under two-input, single-output, fuzzy rulebase with twocontrol rules.3.3 Hierarchical Fuzzy Systems (HFS)As mentioned in Chapter 1, the fuzzy logic controller described in the previous sectionhas many disadvantages when applied for control environments where the control bandwidth is large and the required precision is high. This difficulty is primarily caused bythe introduction of soft computing methodology in the form of a fuzzy knowledge base,directly into the control ioop. Despite the loss of precision, a more fundamental objection that may be raised against the use of direct fuzzy control is as follows. While fuzzylogic itself does not provide a control strategy, in the conventional sense, the success ofChapter 3. Fuzzy Control and Hierarchical SystemsFigure 3.4: Realization of Fuzzy Implication with a MISO Rulebase.current applications of PLC is mainly due to the fact that they represent a very effectivecontrol strategy captured in essence from human experts and formulated as a knowledgebase. Since a knowledge base falls primarily in the domain of artificial intelligence, itis principally incompatible with the type information that is processed at the level of adirect control ioop.In the light of these contentions, it is reasonable to expect that fuzzy logic may servea more appropriate purpose if employed in the capacity of supervisory control in a hierarchical structure. Hierarchical control systems were first introduced as a means ofcoping with the complexity of large and difficult control tasks [Mesarovic, 1970]. Fuzzy391.00Rule 1w1.0-Lc1.000U V wRule 2wInferenceChapter 3. Fuzzy Control and Hierarchical Systems 40logic on the other hand, was also put forward as a means of coping with the complexity[Zadeh, 1965, 1973]. While hierarchical systems provide a methodology suitable for handling the structural complexity, fuzzy logic provides a methodology suitable for handlingthe complexity of data processing at high levels. Hence, these two techniques should beconsidered complementary to each other and the conjunction of the two methods shoulddeserve further studies within the context of knowledge-based hierarchical control.The principal structural features of a hierarchical fuzzy system (HFS) which is themain focus of this thesis are shown in Figure 3.5. The fuzzy, linguistic, knowledge base ofFigure 3.5 performs supervisory control on the conventional control loop which occupiesthe lower level of the hierarchical structure. It monitors the process performance andinfers any tuning actions according to the expert knowledge in its rulebase. Althoughonly two layers are shown in Figure 3.5, in practice, there can be as many layers as thecomplexity and the required intelligence for data processing necessitate. In other words,more layers could be added at the top if further high-level (more intelligent) tasks are tobe performed.The hierarchical fuzzy system implements its knowledge base in the same way as doesa conventional low-level fuzzy controller. The fuzzification and defuzzification interfacesare, however, semantically different from their counterparts in the FLC. This differencearises mainly due to the fact that fuzzification in HFS makes use of the data abstractioncapability inherent to fuzzy systems in order to reduce the data processing dimensionalityor resolution and complexity. As a result, fuzzification in HFS may involve more intelligent data processing rather than a simple use of rules of thumb. Depending upon thelevel of hierarchy, defuzzification may or may not be necessary in order to interface thepresent inference with the immediately lower level of the hierarchy. In order to highlightthese differences, a generalized model for the HFS has been developed, as described inChapter 1, and its configuration is shown in Figure 3.6.Chapter 3. Fuzzy Control and Hierarchical Systems 41DefuzzificationInterfaceFuzzificationInterfaceFigure 3.5: A Hierarchical Fuzzy System with Two Layers.The knowledge base at a general level n of an HFS is denoted by G in Figure 3.6.Here, denotes the sensory information that is originating at the jth level of the hierarchy,while denotes the control/tuning inferences of the flt level. The preprocessor blocksdenoted by represent the data interpretation that is generally necessary to generatea context that is suitable for and compatible with the particular knowledge base. Thesubscripts i and j are used to mean that the preprocessor converts sensory data (si) fromlevel j into a context (ci) at level i.The functionality of the HFS may be expressed logically in the following notation= i 0 Ffl (3.15)where, a transitional operator 0 has been introduced to represent the function of datapreprocessing. A fuzzy transitional operator could be broadly defined as an operation ofdata abstraction.The context C at level n is the aggregate of individual contributions from each streamKnowledge Base andDecision-MakingChapter 3. Fuzzy Control and Hierarchical Systems 42Figure 3.6: A Generalized Model of a Hierarchical Fuzzy System.of data preprocessing. Thus,EBc_1ecee (3.16)where, a combinational operator e is introduced to account for the fuzzy combination ofdata, which could be broadly defined as an information fusion operation.Finally, the inferences from the flt level of the hierarchy are given by the rule of fuzzyimplication,= C o C,-, (3.17)Although the exact mathematical interpretations of the transitional (0) and combinational (e) operators depend on the specific application, it is possible to highlightcertain common characteristics that should be shared by such operators in the context ofe—IN-IFunctional/ControlKnowledge Basee—nKnowledge-BasedActionsn-2SensoryInformationChapter 3. Fuzzy Control and Hierarchical Systems 43hierarchical systems [De Silva, 1991b]. In particular, at larger values of n (i.e., top levels), the conversion of information from high resolution to low resolution is accomplishedby the 0 operator. This transition is usually accompanied by a corresponding increasein fuzziness of information and the knowledge (structured information) ascribed to thevariable. A high degree of fuzziness may be tolerated at higher levels of the hierarchy,while even a slight fuzziness at the lowest level can lead to inaccurate control. Theserelationships are qualitatively illustrated in Figure 3.7. Furthermore, at higher levels,cycle time of processing will be longer and information abstraction and interpretationbecome more prominent than direct processing.Figure 3.7: Qualitative Relationships of Information Resolution, Fuzziness of Informationand Cycle Time of Processing with Level of Hierarchy.Consequently, fuzzy resolution and degree of fuzziness of information are issues thatare very important in the current study of hierarchical fuzzy systems. In the sequel, theseparameters are examined on a more vigorous mathematical basis.InformationResolutionFuzziness ofInformationLevel of HierarchyChapter 3. Fuzzy Control and Hierarchical Systems 443.4 Fuzzy ResolutionA fuzzy linguistic variable in the antecedent of a fuzzy rulebase forms a fuzzy inputspace with respect to a certain universe of discourse, while that in the consequent ofthe rulebase forms a fuzzy output space. The number of partitions or fuzzy states thatexist in the input or the output space determines the fuzzy resolution of that variable.This is equivalent to finding how many primary terms should exist in the term set of afuzzy variable. Two cases of coarse and fine fuzzy resolutions are illustrated in Figure 3.8where two fuzzy partitions of the same normalized universe [-1, +11 are shown.MembershipNL NM NS :E PS PM PL-1 +1 Variable(b)Figure 3.8: An Example of Graphical Representation of Fuzzy Resolution. (a) CoarseResolution. (b) Fine Resolution.In order to study the effect of the resolution of context (response) variables on theoutput (inference) of a fuzzy rulebase, let us assume, without loss of generality, that bothinput and output spaces to be normalized in the range [-1, +1]. The membership functions are assumed to be triangular or trapezoidal, equidistant and symmetrical aroundthe mid point as in Figure 3.8(b). This assumption reflects the current practice for mostcontrol applications of fuzzy logic. Another important feature of such membership functions is that for a crisp measurement z, we have only two non-zero fuzzy states that areMembershipN P(a)Chapter 3. Fuzzy Control and Hierarchical Systems 45simultaneously possible and satisfying the condition:PA(X) + ILA+(Xi) = 1 (3.18)as clear from Figure 3.8. For simplicity, let us first consider a set of rules of the form,Rulei: If x is A theny is B2.where A2 and B2 are fuzzy sets defined in the universes of discourse X and Y, respectively.A fuzzy SISO rulebase of this form is of particular interest in the context of hierarchicalsystems, since much of the human-supervisory (e.g., tuning-type) knowledge could beformulated in this manner through rule dissociation, as described in [De Silva, 1991a].Let n (usually an odd number due to the symmetry about the membership axis) bethe number of partitions in the normalized input space of [—1, +11 in X. Then,(3.19)denotes the distance between two successive modal (peak membership) points on theinput space in Figure 3.9, and the base length of the triangular membership functionsbecomes 2a. The distribution M of modal points along the input space is given by,MA = {_(nx — 1)a, ... , —2a, —a, 0, a, 2a, ... , (n — 1)a} (3.20)Now, as noted before, for a particular crisp input measurement x of a fuzzy set A, thefuzzification will yield only two fuzzy states, say A_1 and A, with non-zero membershipvalues, say m3_1 and m. This happens since there are only two support sets of fuzzystates overlapping at any given point in the input space of the rulebase, as shown inFigure 3.9. Assuming, without any loss of generality, that the input x falls betweena(j — 1) and a(j), we can write:(3.21)11 Sx=Chapter 3. Fuzzy Control and Hierarchical SystemsMembership46rn1rn11(J-2)a (j-1)a(j-1/2)aja (j*1)a Input xFigure 3.9: Fuzzification Under Equidistant and Triangular Membership Functions.where Sx is the distance between the input x and the crossover point (j — )a, and j isan integer given by,j E {_(n — 1), ..., —1, 0, +1, ..., — i)} (3.22)The first term of the R.H.S of equation 3.21 marks the exact middle point between a(j—l)and a(j). This is also the intersection point between the two membership functions A_1and A3. From the basic geometry of the triangular membership functions, we have themembership grades at point x, corresponding to the two overlapping fuzzy states as,m,= ( + (3.23)(3.24)Moreover, these two membership values are related through the equation 3.18, thus,m_1 + m = 1 (3.25)Chapter 3. Fuzzy Control and Hierarchical Systems 47The decision making is achieved by applying the max-mm compositional rule of inference to the rulebase (i = 1, 2,. ..,p) as follows,ILB’(y) = max min[tA(x), 1LLB(y)] (3.26)i__i. .. pHere B’ C Y is the fuzzy set inferred by the rulebase. Since, from the previous resultit is known there are only two membership degrees in X that are non-zero, the aboveequation reduces to,PB’(y) = max [min(mj_l,ILBk_l), min(mj,/LBk)] (3.27)where Bk_i and Bk are fuzzy sets defined in the output space Y, and the operationswithin the square brackets are carried out for each rule i of the rulebase. That means,there are only two fuzzy states, corresponding to the antecedents of A,_1 and A1, fromeach rule i that will contribute towards the output inference. If the rulebase is viewedas a sequence of monotonically incrementing rules [see De Silva, 1991a], as usually thecase in tuning-like knowledge bases, and if antecedents form two adjacent fuzzy sets,then the consequents Bk_i and Bk are either identical or adjacent in the output spaceY. Therefore, Figure 3.10 shows, in general, the membership functions corresponding tothe inference given by equation (3.27).Let n, (usually an odd number) be the number of partitions in the normalized outputspace of [—1, +11. Thenb = 2 (3.28)fly — 1denotes the distance between two successive modal points on the output space in Figure 3.10. The base length of the triangular membership functions becomes 2b. TheChapter 3. Fuzzy Control and Hierarchical Systems 48MembershipkbFigure 3.10: Fuzzy Inference Under Monotonically Incrementing Rules.distribution M of modal (peak-membership) points along the output space is given by,MB = {_(m — 1)b, ... , —2b, —b, 0, b, 2b, ... , — 1)b} (3.29)Hence, the control output u is obtained by defuzzifying the fuzzy set B’ which isdepicted as depicted as the shaded area in Figure 3.10. By using the centroid method ofdefuzzification, we getfB’.ydy 330UfB’.dy (. )By considering the two shaded areas of PQUVP and RSTUR separately, it is possibleto obtain an explicit formula for the control action u. For the area FQUVP, we haveArea (Ak_i) = (3b + 3b — 2bm_i)m_i= (3.31)Centroid (yk_1) = [(k-2)b+(k+1)b]= (k_)bm1,/\\Bk /i’7 \/\/ \(k-2)b (k-1)b (k+ 1 )b Output y(3.32)Chapter 3. Fuzzy Control and Hierarchical Systems 49Similarly, for the area RSTUR, we haveArea (Ak) = (2b— 2bm_i + 2b — 2bm) (m — m_1)= b(2—m_i—m)(m—m_i) (3.33)Centroid (yk) = (k)b (3.34)Thus, when (mi_i. 0.5 mi), the control u of the overall shaded area of inference isgiven by,Ak_i X Yk—i + Ak X YkU =Ak1 + Ak— b(3— m_i)m_i x (k — 1/2)b + b(2 — m_1—m)(m— mi_i) x (k)b— b(3— m_i)mj_i + b(2 — m_1— má)(mj — mi_i)= b (k—+b (1 — m_1)2— (1 — rn)2 (335)2 2 m_i+2m—mThe control action u, when (m 0.5 mi_i), is obtained by interchanging m_1 andm with a sign change in the last term of equation (3.35).= b — 1’ — b (1 — m)2 — (1 — m_i)2 (3.36)\. 2) 2 m + 2mg_i — m_1Also, by using similar considerations, we can obtain the control u when both m_1 andm3 are greater than 0.5. Specifically, we have— b (k — + 1, 8(m — mi_i) — 4(m — m,_i) (3 37— \. 21 2 8(m+m_i)—4(m,+m_1 — 1In equations (3.35) through (3.37), k is an integer given byk E {_(m — 1), ..., —1, 0, +1, ..., — i)} (3.38)Note that equations (3.35) through (3.37) are valid only for uniformly distributed triangular membership functions as shown in Figure 3.9. For generality, above equationsChapter 3. Fuzzy Control and Hierarchical Systems 50for control action u are considered to assume that m_1 and m3 are independent. Fortriangular, equidistant membership functions, however, equation (3.25) holds true andhence, by substituting in either equation (3.35) or (3.36) the control u becomes,u__b(k_.) +[1 -,,j_’m] (3.39)Thus, we can obtain an incremental control law relating an input Sx to the output u,by substituting equation (3.23) in equation (3.39):/ i\ b 8aSx 1 1u=bk_) + 2 5a2—4Sx —a<Sx<a (3.40)The control action u in equations (3.35) to (3.37) is given as the sum of two terms. Thefirst term represents the center of the interval of fuzzy inference from the rulebase. Theterm within the square brackets, say f(m), denotes the contribution from the membershipfunctions. Figure 3.11 shows the magnitude of this term f(m), for all possible values ofm,_1 and m3. Note that as f(m) changes from —ito +1, the control variable u changesfrom b(lc — 1) to b(k).For the special case of equidistant triangular membership functions, f(m) becomesa function of the single parameter m, as given in equation (3.39), and its magnitude isplotted in Figure 3.12 against m.Finally, Figure 3.13 is a plot of f(m) as a function of the incremental input Sx(equation (3.40)) in the range — a < Sx < a, where a is the intermodal spacing of theinput space.Summary and Remarks: The main result obtained so far is summarized below, andsome important remarks are made regarding the implications of this result. The overallinput/output relation of the rulebase is governed by equations 3.21, and 3.40. For easeof reference, these equations are reproduced below.x = a(_) + 6x, —a<Sx<a (3.41)-S.oq CD AZI-S‘-A CD 0 I-iCD 3 0 CD CI, :3- V 0 0NonlinearControlTerm1(m)CD 3 0 CD U) V01 I.Chapter 3. Fuzzy Control and Hierarchical Systems 520.8 :0.6.E : :e0.2.C.0 . . . .o 0 . .(U . . . . . .O : :0.2C0 . . . .2 :—0.4—0.6—0.8.—1 I I I I I I I I0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9Membership m(j)Figure 3.12: Magnitude of f(m) Under Equidistant Triangular Membership Functions.Chapter 3. Fuzzy Control and Hierarchical Systems 53a/412Ct0,CC0z—a/2 -a14 0Normalized Input delta—xFigure 3.13: Magnitude of f(m) with Incremental Input Sx.a/2Chapter 3. Fuzzy Control and Hierarchical Systems 54/ 1’\ b 8aSx 1 1= b—+ 2 5a2 — 45x2 ‘ — a < Sa < a (3.42)The following observations could be made regarding the importance of these equationsto the rulebase. As before, f(m) refers to the nonlinear control term within the squarebrackets of equation 3.42.i. The mapping between the two set of integers j and k, say M(j, k), determines theoverall relationship of an input x to the output u.ii. The fuzzy linguistic rulebase captures the relationship M(j, k) in terms of its if—then rules. In fact, it is the problem specific knowledge that is contained in therelation M(j, k).iii. Neglecting the membership dependent term f(m) in equation 3.42, the relationM(j, k) would be identical to a scheme of gain scheduling. For example, when theinput is in the range [a(j — 1), a(j)], the output would be given by b(k—iv. The contribution from fuzzy logic is evident from the nonlinear control term f(m)which effectively makes smooth the transition from one range of input to the other.In other words, inference from the fuzzy rulebase would be piece-wise continuousas long as the input is piece-wise continuous within the range of a single rule.v. The property (iv) will guarantee globally the piece-wise continuity of the output,if the rules are monotonically The surface plot in Figure 3.11 illustrates the variation of the nonlinear controlterm f(m) where the magnitude changes smoothly over the range [—1, +11 for allpossible values of m_1 and m3.Chapter 3. Fuzzy Control and Hierarchical Systems 55vii. For the special case of equidistant triangular membership functions, the variationof f(m) is not only smooth but also nearly linear as shown in Figure 3.13. Notethat, in this case, when the input varies in the range [a(j — 1), a(j)], the outputwill vary almost linearly in the range [b(k — 1), b(k)].viii. The intermodal spacing of the output space (b) acts as a gain parameter for theoutput. Therefore, larger values of b (i.e., coarse resolution) tend to amplify theeffect of the incremental input Sx on the output.ix. The output u depends only on the normalized incremental input (6x/a), but otherwise u is independent of the intermodal spacing of the input space a. This occurssince triangular membership functions are linear in relation to the term (Sz/a).3.5 Measure of FuzzinessAs observed earlier in this Chapter, information preprocessing in a hierarchical frameworkincreases the fuzziness of information qualitatively while decreasing the resolution ofthe resulting information. The transitional operator in equation 3.15 is associated withthis transformation of fuzziness of information. Although the exact interpretation ofthis operation depends on the particular application at hand, it is obvious that theinformation required to build the context of the knowledge base should be much fuzzierin general than the low-level information. In the following, some expressions that havebeen developed in the literature to quantify the fuzziness of information are consideredin the framework of a rule-based hierarchical structure.The following definitions concerning the similarity of two fuzzy sets are first introduced [Kaufmann, 1975].Definition 12 : Generalized Hamming Distance. Let A and B be two fuzzy setsChapter 3. Fuzzy Control and Hierarchical Systems 56defined in the universe of discourse X with cardinality n; i.e.,/LA(Z2), /IB(X) e [0,1], i = 1,2, ... ,n (3.43)The generalized Hamming distance between the two fuzzy sets is given by,Hd(A, B)=tLA(X)—ILB(Xi) I (3.44)where 0 Hd(A,B) 7.Definition 13 : Euclidean Distance. Let A and B be two fuzzy sets defined in theuniverse of discourse X with cardimality m. The Eucleadian distance between the twofuzzy sets is given by,He(A, B) {A(X)— PB(i)}2 (3.45)where 0 He(A,B)The Hamming distance and Euclidean distance are usually normalized as given below,such that each measure is in the range [0, 1]:H(A,B) = Hd(A,B) (3.46)H(A,B) = He(kB) (3.47)Definition 14 : An a-cut of a Fuzzy Set. Let A be a fuzzy set defined in the universeof discourse X. Then, the a-cut of A, demoted by A, is a crisp set in X, such that,ILAa(Xi) = 1, if fLA(X) aILAa(Xi) = 0, if ILA(x) <awhere a is a scalar in the range [0, 1]. In other words, a-cut of A is a crisp set thatcontains all the elements of A which have a membership grade greater than or equal tothe specified value of a.Chapter 3. Fuzzy Control and Hierarchical Systems 57Also, let us define a crisp set A such that it is the closest approximation to the fuzzyset A. Such a set could be obtained by the following substitutions to the membershipfunction:= 1, if A(x) 0.5= 0, if 1UA(xi) < 0.5This is is known as the i-cut of the fuzzy set A.Now we can define an “Index of Fuzziness” in terms of the Hamming distance betweena fuzzy set A and its i-cut (nearest crisp set) A.Definition 15 : Index of Fuzziness. If A is a fuzzy set in X and A is its nearest crispset, then the index of fuzziness 1(A), in the case of a discrete universe, is given by:1(A) = H(A, A) (3.48)where n is the cardinality of the set A. When the universe of discourse X is continuous,we have:2 ‘‘If(A)= J H(A,A)dx (3.49)v—a a2 f”= j IILA(x)—pA(x)I dx (3.50)v—a awhere (b — a) is the span of the support set of A.Figure 3.14 depicts a fuzzy set A and its cut (nearest crisp set) A. Hence, the areaunder the shaded region illustrates the index of fuzziness of A.Measure of Fuzziness as Entropy: Another measure of fuzziness is fashioned according to Shannon’s entropy of uncertainty and information, which was originally proposedChapter 3. Fuzzy Control and Hierarchical Systems 58MembershipGrade1.01Figure 3.14: Index of Fuzziness as Measured Using Hamming Distance.for probability functions. The Shannon entropy states that for a system with N numberof independent states with the associated probabilities of Pi, P2, ... , PN, the entropy ofthe system is defined by,N,PN) = —p1np (3.51)Similarly, the entropy of a fuzzy set is defined as follows [Debuca and Termini, 1972]:Definition 16 : Entropy of Fuzzy Sets. If A is a fuzzy set in X and A is its complement fuzzy set, then the fuzziness measure of entropy H1(A), is given by:H(A) = — > [4x) log2 ILA(Xj) + (xi) log2 ILA(X)1 (3.52)where n is the ca’rdinality of the universe X.3.5.1 Fuzziness of InferenceAs we did in the case of fuzzy resolution, let us start with a rulebase where the rulereads like If x is A2 then y is B, as typically used in supervisory control (e.g., tuningChapter 3. Fuzzy Control and Hierarchical Systems 590.5(k÷ 1 )b Output Variable- YFigure 3.15: Index of Fuzziness for the Inference of a Monotonic Rulebase.applications). Let us also assume equidistant triangular membership functions for bothinput and output spaces as illustrated in figures 3.9 and 3.10. It was shown in the previoussection that the inference from such a rulebase takes the form of the shaded area shownin Figure 3.10. We can now apply the index of fuzziness as defined in equation (3.50) tothe inference of Figure 3.10. Hence, the shaded area of Figure 3.15 indicates the indexof fuzziness for the particular case where the governing memberships are m_1 and m1.Since we assume that the membership functions are equidistant and triangular, thefollowing relation holds true in the subsequent analysis:m_1 + m = 1 (3.53)Computation of the index of fuzziness is now a straightforward matter, as given bythe shaded area in Figure 3.15. Only two different cases need to be considered wherem_1 is less than 0.5 and m1 is greater than or equal to 0.5. When m,_1 < 0.5, weMembership1.0m1rn11(k-2) bI(k-i) b (k) bChapter 3. Fuzzy Control and Hierarchical Systems 60have21(B) = [Shaded Area]2b 2— (2m_1 + 2m_1 + 1)= (2m_1 + 2mg_i + 1), m1_ <0.5 (3.54)where B’ is the fuzzy set representing the inference and 3b is the span of the supportset of B’. Since the equation (3.53) is valid for all values of m_1, the fuzziness whenm3_1 0.5, could be obtained by substituting (1 — mi_i) for m_1 in this equation;specifically,If(B’) = {2(1 —m_i)2+2(1 —m_i)+ 1}= (5— 6m_1 + 2m_1), m1_ 0.5 (3.55)The index of fuzziness of inference is plotted against the membership grade m_1 inFigure 3.16. The fuzziness of the inference is a minimum when m_1 is either zero orunity. This is the case where the inference falls exactly on the center of a fuzzy term. Forall other values, the fuzziness becomes higher with a peak at the point where m_1 = 0.5.Correspondingly, the inference becomes most fuzzy, (i.e., most ambiguous) when theinput x falls exactly in the middle of two adjacent fuzzy terms. This is also the crossoverpoint where two adjacent rules of the rulebase fire with equal strength.3.6 Properties of the Transition and Combination OperatorsIn this section some properties of the general operators of transition (0) and combination(ED) are identified, within the context of knowledge-based hierarchical model given byequations (3.15) through (3.17). Further details are found in [de Silva, 1993].Chapter 3. Fuzzy Control and Hierarchical SystemsCa)C0CoCoaCNNLI610 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9Membership of Input to Knowledge BaseFigure 3.16: Index of Fuzziness of an Inference as a Function of Input membership.Chapter 3. Fuzzy Control and Hierarchical Systems 62MembershipOutput Space YFigure 3.17: Control Inference and its i-cut.Consider decision making with multiple rules according to compositional rule of inference. Suppose that a set of low-level signals are measured and fuzzified to yieldmembership grades m, (i = 1, 2,.. . , n). Also assume that the membership function ,of the control inference C is triangular and symmetric in the output universe of discourseof Y, as shown in figure 3.17.Since the knowledge base uses the fuzzy states corresponding to m1 as the context,the control inference from each rule of the rulebase, with respect to these measurements,will correspond to the shaded area C’ in figure 3.17. Next, consider decision makingaccording to the max-mm compositional rule of inference. The fuzziness of the controlinference is given by,1(C’)= LEYI Ic’(y) — 1Lc,2(y) dy (3.56)where C,2 is the half-cut of the control inference, as indicated by the rectangular pulsein figure 3.17. Using the properties of max-mm composition, equation (3.56) could be1.00.5c;,2Chapter 3. Fuzzy Control and Hierarchical Systems 63re-written as,If(C’)=max {Itc(Y)] — max [ILc,2(Y)] I dy (3.57)where Y is the universe of discourse of inference C. equation (3.57) follows from the factsthat,C’=CuCu•..uC,’, (3.58)and,a-cut(A U B) = [a-cut(A)] U [a-cut(B)] (3.59)Now, using the mathematical inequality,max (xi)— max (y) max— I (3.60)iwe have,If(C’)< j max Ic(y) — ic,2(Y) I dy (3.61)This results states that the fuzziness of an inference is bounded by the individualinference having the maximum fuzziness envelop.Chapter 4Laboratory Implementation—Software DevelopmentThe material presented in this chapter describes the implementation of the knowledge-based hierarchical system that is developed in the thesis, in a prototype fish processingworkcell. The workcell has been developed by us in the Industrial Automation Laboratory, as a useful industrial application of advanced automation technology. For thepurpose of clarity, the presentation is organized into two broad categories; namely, hardware development and software development. The present chapter focuses mainly on thesoftware aspects of the fish processing workcell, and the next chapter will be devoted tothe related hardware developments.The present chapter describes the implementation of a hierarchical system for monitoring and supervisory control of the prototype fish processing workcell. The layers ofthe monitoring/control system are architectured by closely following the principles laidout in Chapter 3, where fuzzy control was discussed in the context of a hierarchicalsystem. The design of the software modules for the workcell takes a similar approach,parallel with the implementation of the control hierarchy. The present chapter will firstintroduce the particular architecture adopted for the hierarchical system. The rest of thechapter will in turn introduce information preprocessing, context development, knowledge acquisition and representation, implementation of fuzzy rulebase, inference engine,and defuzzification strategies. It will also briefly explain the user interface that enablesthe user to interact, on-line, with the operation of the workcell. A detailed user manualfor the workcell is given in the Appendix A.64Chapter 4. Laboratory Implementation—Software Development 654.1 An Overview of the Laboratory WorkcellThe existing technology of fish processing, and the present head-removal machinery inparticular, have been established around the turn of the century and have not been improved or modified drastically since then. These machinery exhibit many deficiencies,as detailed in section 5.1 in Chapter 5, causing wastage worth millions of dollars annually. Also due to the tedious, and generally unpleasant working conditions, it hasbecome increasingly difficult to attract highly skilled and experienced labour into thefish processing industry. It has therefore become obvious that we need to explore waysof capturing human experience in fish processing and automating it through advancedtechnology. Automation will also help improve the efficiency of operations and achievehigher standards of production.The primary objective of the workcell for automated processing of fish is to improve the yield and quality of the processed fish through extensive use of machine vision,robotics, and intelligent controls [de Silva, 1990]. Increasing the throughput without compromising these goals is highly desirable. In the prototype workcell, a cutter assemblymanipulated by a robotic controller carries out the heading (head removal)—the first operation in a canning or filleting line of production. The information for cutter positioningis obtained through an image processing system (primary vision system) that is housedin a 486-based computer, which analyses images of fish on-line to detect and locate theposition of the gill plate, thereby accurately determining the cutting locations [Riahi andde Silva, 1990]. These locations are then communicated to a robotic-type two-axis motorcontroller which positions the cutter assembly both horizontally and vertically for theoperation of head removal. In addition, the workcell comprises many auxiliary components such as a conveyor for carrying fish, an active unit for holding fish while cutting,and various other sensors, and electronic hardware for monitoring and control purposes.Chapter 4. Laboratory Implementation—Software Development 66Also, a secondary vision system, with a camera at the leaving end of the conveyor, hasbeen installed in order to facilitate the evaluation of quality of processed fish. A detaileddescription of these hardware is given in Chapter 5.4.2 Hierarchical Control StructureA fully automated fish processing workcell will incorporate a multitude of componentswhich have to be controlled and properly coordinated in order to obtain satisfactoryoverall performance. The plant operation will involve many different types of actionssuch as sensing, image processing, direct control, performance monitoring and componentcoordination. Furthermore, an intelligent agent operating at the supervisory capacitymust be able to perform such high-level assignments as goal description, decompositionof a goal into sub-tasks, and sub-task allocation [de Silva, 1991b]. These actions maybe ranked into several levels depending on the nature of data generated or informationprocessed at a particular level. The degree of information resolution plays a vital rolein the organization of different layers of an intelligent hierarchical control system [Isikand Mystel, 1986; Saridis, 1988; de Silva and MacFarlane, 1988; 1989]. The hierarchicalmonitoring/control system developed on the basis of these principles for the prototypefish processing workcell is schematically shown in Figure 4.1. Although the three-levelhierarchy shown is quite adequate for the purpose of the present workcell, there is nolimit in theory to the number of layers in a hierarchy of this type. In particular, it shouldbe noted that the performance of the system can be arbitrarily enhanced by the additionof layers with more intelligence at the top of the hierarchy, albeit at a cost of complexityand speed of operation.The goal: The principal goal of the intelligent control system that has been developed isto maximize the yield (meat recovery) while processing fish, while meeting other desirableChapter 4. Laboratory Implementation—Software Development 67Level 2Preprocessing of Context DefuzzificationSensory Data L GenerationSensoryInformationParameter Update,Tuning/Reference CommandsFigure 4.1: Hierarchical Monitoring/Control System for the Workcell.Chapter 4. Laboratory Implementation—Software Development 68subgoals such as: maintaining a high cutting quality, attaining a sufficient throughputrate, keeping system parameters and operating conditions of various components withinspecifications, and improving performance of low-level controllers, individually.The nature of these goals is mostly qualitative or descriptive and as such they canhardly be transcribed into a set of quantitative specifications or crisp algorithms. Experienced plant operators, on the other hand, find it quite easy to verbalize what issatisfactory and what is not, after observing the performance. Such knowledge in theform of operator experience and expertise may be captured and expressed in a fuzzylinguistic rulebase as will be explained later in this chapter.Flow of information and the level of hierarchy: In a typical knowledge-based control application such as the present workcell, the higher the hierarchical level, the moreintelligent the control tasks. Specifically, the higher levels in general deal with qualitative,vague, incomplete or imprecise information and yet must come up with decisions thatare acceptable to a human expert and satisfactory in terms of the overall performance.Consequently, some intelligence will be needed for interpretation and processing of information at higher levels of the hierarchy. In contrast, the lower levels of the hierarchytypically consist of hard-wired controllers and sensors that need precise and algorithmicinformation.Hierarchical ordering: Consider the control structure shown in Figure 4.1, that hasbeen developed for the prototype workcell in the Industrial Automation Laboratory. Thelowest level of the hierarchy is occupied by the various controllers and sensors that providefeedback information for process control. The information generated at this level fallsinto three broad categories:(i). Visual data from the CCD cameras,Chapter 4. Laboratory Implementation—Software Development 69Figure 4.2: An Image of a Processed Fish. (Image Size = 512x480 pixel).(ii). Position and speed data from the encoders, and(iii). Cutter load data from the induction motors.These three streams of data are characterized by the following features;(i). Large volume of individual data points collected,(ii). Produced in rapid succession, and(iii). Precise and of high resolution.For example, Figure 4.2 shows an image obtained by the secondary (quality monitoring) camera after a successful cutting operation. The image contains almost 250 kbytesof information and is generated every 0.5 seconds, thus representing an information rateof about 500 kB/s. for the camera alone.Chapter 4. Laboratory Implementation—Software Development 70The second level of the hierarchy is a data processing level where the high-resolutioncrisp data from the sensors are filtered to furnish an abstract representation of the currentstate of the workcell. This stage could essentially be considered as a preprocessor whichformulates the context database reflecting the current status of the workcell. The contextis made up of fuzzy sets defined over appropriate linguistic variables. Each stream of inputdata is filtered through a dedicated preprocessor which identifies the trends and patternsof a set of predetermined parameters. The operations performed by the preprocessors mayinclude averaging, peak detection, pattern recognition, and computation of performanceattributes such as rise time, damping ratio, and settling time. Finally, these parametersare interpreted according to some subjective criteria of performance evaluation and thentranscribed into fuzzy sets. Section 4.3 details the entire process of building the contextdatabase from each category of input data stream.At the top level of the hierarchy is the knowledge base and the inference engine whichmakes decisions on the basis of the current context of the workcell. This level performsthe most intelligent tasks that have been incorporated into the prototype workcell. Theknowledge base may be considered as a collection of expert instructions on how to improve the yield while maintaining the product requirements and keeping the individualcomponents at their optimum performance. The information at this level, including theinferences, is exclusively represented by fuzzy sets or fuzzy linguistic variables. The details of knowledge representation and realization of inference engine are described laterin section RealizationThe control hierarchy described primarily in this chapter has been realized in severalC language programming modules. Selection of the language C for realization of theworkcell software was particularly influenced by factors such as;Chapter 4. Laboratory Implementation—Software Development 71Figure 4.3: Software Modules in the Workcell.• Availability of low-level machine instructions in “C” facilitates easy interfacing withthe low-level controllers.• Fast speed of execution and the availability of support for a graphical user interface.The modular development of software closely resembles the architecture of the controlhierarchy in such a way that every module is identified with a particular function inthe hierarchy. Each module was realized separately in “C” and after debugging andtesting, all the modules were compiled and linked together to build a single executablefile, WORKCELL.EXE. Figure 4.3 illustrates the functions assigned to different softwaremodules and their layout in relation to the data flow between them. The functionaldescription of each system module is given below:i. Sensor (Input) Module: Reading of the input ports of the data acquisitionboard, recording the position responses of the servomotors, and capturing of imagesChapter 4. Laboratory Implementation—Software Development 72of processed fish are carried out in this module. In order to reduce the effect ofnoise and ripple, all analog-to-digital-conversion (A/D) ports are read many timesin rapid succession and the average is taken. All data are then converted intoproper engineering units and passed over to the preprocessor module.ii. Preprocessor Module: This module contains the software required to interpretthe sensor readings as explained before. Specifically, it transcribes crisp, sensoryinformation into a linguistic form as required by the fuzzy knowledge base.iii. Knowledge Base: This module contains the rule-set and the fuzzy relationalmatrix derived from it. Since the relational matrix could be computed off line, themodule simply stores the matrix in the form of a multidimensional array with eachdimension corresponding to either an antecedent or a consequent variable. The sizeof this array is determined by the resolution of each fuzzy variable and the totalnumber of such variables.iv. Decisional Module: Application of the compositional rule of inference is carriedout in this module. The center of gravity method is applied to obtain a crisp valueand the output is passed on to the actuator(output) module.v. Actuator (Output) Module: The crisp values of the consequent variables arescaled before writing them into the output ports of the D/A within the PCL-812board (see section 5.4.3), such that the analog signals produced could be directly interfaced with the corresponding servo amplifiers. The passing of tuning commandsto the DMC-620 controller (see section 5.4.2) is also handled in this module.The overall control of variable passing between modules and sequencing of variousactions are coordinated by a main module which incorporates all the modules into asingle program. At run time, the user can monitor the workcell through a menu-drivenChapter 4. Laboratory Implementation—Software Development 73user interface, which facilitates interactive monitoring of each condition variable of theworkcell. Also, data may be stored, if needed, for off-line analysis and further evaluation.4.3 Information PreprocessingThis section describes in detail the preliminary processing carried out on the input datastreams; namely, the visual images, servo-motor position data, and cutter-load profiledata. It also describes the process of building a fuzzy-context database from the preprocessed information.4.3.1 Preprocessor for camera imagesThe primary purpose of the image preprocessor is to extract context information fromthe raw images that will eventually lead to the determination of high-level informationsuch as the quality of processing or the quality of end product.The problem of assessing the quality of a fish product is mostly aesthetic in nature.It differs peculiarly from the apparently similar problem of evaluating the quality ofmanufacture of an industrial component. In the latter case, the quality could be gaugedthrough direct measurement of dimensions and to a lesser extent by the detection ofsurface defects. The quality of processed fish, in contrast, is not amenable to simplequantification based on a few dimensions, shapes or surface defects. At least in theory, however, it could be considered as a complex combination of such features. In thefollowing, several of these features are considered as qualitative or imprecise estimatesthat approximately indicate quality and hence parameterized by means of fuzzy linguisticvariables.The top-level knowledge base of the hierarchical system that was explained previously,will derive two context variables from the visual information, namely, the accuracy ofChapter 4. Laboratory Implementation—Software Development 74Table 4.1: Different Kernals Used in Convolution Operations:(a) for Smoothing. (b) for Sobel Filtering.cut and quality of cut. The accuracy of cut can be considered deterministic since it isthe measured difference between the gill position as gauged by the primary vision systemand the position of cut as determined by the secondary vision system. The quality of cutwill be assessed based on the following geometric features:i. Depth of solid section of cut.ii. Smoothness of cutting contour.iii. Smoothness of surface over the cutting region.Image acquisition and processingA well-designed lighting system is crucial in the acquisition of a good image which is thefirst step of processing. We have designed a structured lighting system specially to flushout unnecessary details from the background as well as such details of the fish body asscales and dirt, while retaining salient features from the cutting region. Figures 4.4 and4.5 show such images of two separate processed fish; the former illustrating a typical cutof acceptable quality and the latter somewhat unacceptable quality.The image is smoothed by using a 3 x 3 binomial convolution kernal in order to reducethe effects of noise and irregularities. Since smoothing could wipe out some cuttingirregularities which are of interest, convolution with a smoothing kernal has been appliedonly twice over the entire image. Application of the smoothing kernal shown in Table 4.1Chapter 4. Laboratory Implementation—Software Development 75Figure 4.4: Raw Image of a Processed Figure 4.5: Raw Image of a ProcessedFish Where Processing Quality is Ac- Fish Where Processing Quality is Unceptable. acceptable.results in the transformation given by equation (4.1).F(i,j) = [S(i—1,j—1) + 2S(i,j—1) + S(i+1,j—1) +2S(i—1,j) + 4S(i,j) + 2S(i+1,j) +S(i—1,j+1) + 2S(i,j+1) + S(i+1,j+1)] (4.1)where, S(i,j) is the (i,j)ti pixel of the original source image and F(i,j) is that of thefiltered (smoothed) image.The image is then thresholded at a fixed gray level of mid-range (128) to accentuatethe body of the fish and the cutting region. Sobel filtering given by equation (4.2), withthe kernal in Table 4.1, is carried out on the thresholded image in order to highlight theedge features in both directions X and Y of the image.L(i,j)= I F(i—1,j—1) + 2F(i,j—1) + F(i-I-1,j—1)— F(i—1,j+1) — 2F(i,j+1)— F(i+1,j+1)...+...Chapter 4. Laboratory Implementation—Software Development 76Figure 4.6: (a) Region of Interest Af- Figure 4.7: (a) Region of Interest After Processing the Image of Acceptable ter Processing the Image of UnacceptableCut. (b) Cutting Contour for the Same Cut. (b) Cutting Contour for the SameImage. Image.F(i—1,j—l) + 2F(i—1,j) + F(i—1,j+1)— F(i+1,j—1) — 2F(i+1,j) — F(i+1,j+1) I (4.2)The regions of interest of each fish after these two operations are shown in Figures 4.6and 4.7, respectively. Segmentation and labeling is then performed over the area ofinterest shown in Figures 4.6(a) and 4.7(a). The cutting contours shown in Figures 4.6(b)and 4.7(b), respectively can be easily extracted since they represent the object with themaximum area in each segmented image.In order to recognize and compute the quality parameters indicated by the images inFigures 4.6 and 4.7, the image data are converted into “arc-length” profiles as shown inFigures 4.8 and 4.9, respectively. The arc-length is measured along the cutting contourstarting from the lower left corner. For the purpose of measurements, the X and Yimage pixels are considered as the basis of the Cartesian coordinate system. The distancebetween adjacent pixels in both horizontal and vertical directions is reckoned as the unitlength and in diagonal directions as \/ of the unit length.Chapter 4. Laboratory Implementation—Software Development 7700a.480Figure 4.8: Arc-Length Profile for the Figure 4.9: Arc-length Profile for theAcceptable Cut. Unacceptable Cut.The resulting arc-length profiles retain some of the angular properties of the originalcutting contours. The data for the arc-lengths can be readily derived from the chaincodes for the corresponding contours of Figures 4.6(b) and 4.7(b). Although the arc-lengths in Figures 4.8 and 4.9 are profiled against the Y-pixel coordinates, a similar setof profiles (not shown) could be obtained for the X-pixel coordinates at the same time,without additional computational burden.Indicative features of qualityThe arc-length profiles are made up of somewhat linear curve segments where certainpoints of interest on the cutting contour could be easily located. These features of interestfor the purpose of assessing quality are: Point a which signifies the beginning of the cutcontour, Point b - the depth of solid cut, and Point c - the end of cutting contour. Thecharacteristic arc-length profile of a good, symmetric cut is shown in Figure 4.8 whileFigure 4.9 characterizes an asymmetric and jagged cut contour. An algorithm whichsearches for gross maxima and minima was used to recognize the points of interests;namely, points a, b, and c, from the rest of the curve. These points give the X, and YContour-Length 1200Chapter 4. Laboratory Implementation—Software Development 78coordinates of salient points of the cut contour. Now, the following quality indicativeindices can be defined:Index of depth of solid cut D (4.3)Yafwhere,Ybc - depth of solid cut from b to c in pixel coordinates.Yaf - height of fish from a to f in pixel coordinates.YbcIndex of smoothness of cut contour S = -—-- (4.4)bcwhere,lbc - arc-length from b to c.A larger value for D signifies a better cut while a larger value for S signifies asmoother cut. The smoothness of the surface over a cutting region is strongly indicatedby the number of labeled image objects in the region of interest, as illustrated by theFigures 4.6 and 4.7.Index of smoothness of cutting region Sr = N1 (4.5)where, N1 - number of labeled image objects within the region of interest.The Figure 4.7(a) contains twice as many image objects as Figure 4.6(a). Whichsignifies, for example, the roughness of the cutting region of fish in Figure 4.5. Ideally, inthe case of perfect operation of the plant, the left side of a cutting contour should be freeof debris or loose objects. Otherwise, an incomplete cut would be implied and is readilyobserved on its image.Chapter 4. Laboratory Implementation—Software Development 79MembershipMembership GradeGrde1 0 Acceptable Unacceptable1.0 P22L Modere Good_.X1 X3 QualityX1 X2Cut AccuracyAttribute (mm)Figure 4.10: Membership Functions for Figure 4.11: Membership Function forGenerating the Context of Visual Qual- Generating the Context of Cutting Acity. curacy.Building the visual context databaseComputation of quality-indicative indices is the first step of preprocessing carried out onthe raw images of fish. The next step is to assign proper membership functions for thefuzzy sets characterizing the relative importance of each indexing parameter and buildinga fuzzy linguistic context representing the quality-indicative indices as its variables.Altogether there are four fuzzy context variables, three obtained from the quality-indicative indices and one from cut accuracy, in the visual context database. The fuzzycontext for the quality-indicative features of D, S, and Sr is generated by using a uniform membership function for all three variables as shown in Figure 4.10. The resultingfuzzy variables are CuLdepth, CuLcontour, and Cut_surface, respectively. All three variables have a primary fuzzy term set of Poor, Moderate, and Good which is defined over auniverse of discourse given by the real interval [0, 1.0]. The fuzzy variable Cut_accuracyis generated from the value of the cutting accuracy using the membership function ofFigure 4.11 and has a primary term set of Acceptable and Unacceptable, which is definedover a millimeter scale.Chapter 4. Laboratory Implementation—Software Development 804.3.2 Preprocessor for servomotor responseThe control and monitoring computer receives feedback from the two servomotors thatdrive the cutter assembly and the vertical positioning platform, in the form of positioninformation via DMC-620 controller (section 5.4.2). This information is filtered by theservomotor preprocessor and the following performance parameters, as applicable, areextracted:i. Rise time—time to reach 95% of the step input.ii. Damping ratio.iii. Damped natural frequency, if underdamped.iv. Overshoot, if underdamped.v. Offset at steady state.Figure 4.12 shows the significance of the above parameters for two typical cases ofresponses where one is underdamped and the other is overdamped.Since forthcoming processing involves finding maxima and minima, it is imperativethat the stream of position data be filtered to remove any effect of noise and local disturbances. Consequently, the following 2’ order binomial-filter function was used tosmooth out the servo-response data prior to further processing.f(n) = [x(n-1) + 2x(n) + x(n+1)] (4.6)The next step of processing is to locate the turning points of the response curve ofFigure 4.12, i.e., the points a, b, c and the corresponding time instants ta, tb, t, and soon. This is done by means of an algorithm which searches for zero crossings of the firstderivative of the step response. The rise time (Tr) is then taken to be the time it takesChapter 4. Laboratory Implementation—Software Development 81(a)Response(Encoder Pulses)Overshoot(S)_______________________________________________\/Rise Time Step Input(tr) (T)Half-Cycle (t) =JJ.. Time(b)Response(Encoder Pulses)Offsetj (F)7/ Step InputTimeFigure 4.12: Typical Servomotor Response Parameters. (a) Underdamped Case (b)Overdamped Case.Chapter 4. Laboratory Implementation—Software Development 82for the response to reach 95% of the step input. The overshoot (Sr) is calculated at pointa as a percentage of the step input. The steady-state error, which is computed as thepercentage offset (Fr), is determined by comparing the average of the last third of theresponse with the step input. With reference to the servomotor response in Figure 4.12,now the following performance parameters can be estimated:Rise time (7’,.) = (4.7)Percentage overshoot (Sr)= () X 100% (4.8)Damped natural frequency (wd) = — (4.9)1n2(S/T)Damping ratio=+(4.10)In the equations (4.7) through (4.10), the dominant mode of the servomotor response isassumed to be second order—an assumption quite justifiable for the servomotors of theprototype workcell, whose block diagram is given in Figure 5.7. The equation (4.10) isobtained by re-arranging the terms of the more familiar equation for the overshoot of asecond order system in term of its damping ratio; thus,I rEOvershoot (S/T) = e (4.11)In the next step of data preprocessing, the performance parameters computed by theequations (4.7) through (4.10) are compared with those of a reference model. This modelis considered as the desired response or the specification or reference model and not as amodel of a true physical system that may be realized. For the servomotor system of theprototype workcell, the following second order plant, with appropriate parameters hasbeen used as the reference model:2=+ Gd (4.12)(s2 + 2ws + w,)Chapter 4. Laboratory Implementation—Software Development 83where, w,, and are, respectively, the undamped natural frequency and the dampingratio. The term Gd represents external disturbances and can be regarded as a fixed offsetfor all practical purposes.The knowledge base for servomotor tuning contains a set of rules prescribing whattuning actions should be taken when the actual response of the system deviates fromthe specifications. In the case of an intelligent tuner, this deviation is expressed inqualitative terms, signifying the experience of an expert. Hence, the context databasefor the servomotors has fuzzy linguistic variables symbolizing the qualitative estimates ofhow the performance can deviate from the desired conditions. This is accomplished firstby comparing each actual performance parameter with the corresponding parameter ofthe reference model according to equation (4.13), and then using the resulting index tofuzzify each performance attribute into one of five primary fuzzy sets.jth attribute of modelIndex of deviation for jth attribute = 1 — h (4.13)attribute of servomotorEach index of deviation corresponds to one antecedent variable in the rulebase and isdefined such that when the actual performance is within specification, the index is zero,and for the worst-case performance the index becomes unity. These numerical values arethen fuzzified into membership functions of the five different primary fuzzy sets shownin Figure 4.13. These data processing operations eventually result in a set of five fuzzycondition variables standing for each performance attribute, as shown in column 1 ofTable 4.2, and a set of five primary fuzzy sets (column 2) that each variable can assume.The database in fact contains two sets of such variables, one each for the cutter positioningsérvomotor and the platform positioning servomotor.Chapter 4. Laboratory Implementation—Software Development 84MembershipPerformanceattributeFigure 4.13: Membership Functions for Servomotor Performance Indices.4.3.3 Preprocessor for cutter load profileThe purpose of the cutter-load-profile preprocessor is to extract certain high-level information pertaining to the performance of the cutter blades during the period of cuttingaction of the workcell. For this end, the speeds of both top and bottom cutter blades aremonitored through sensors and circuitry which are described in Section 5.3.2. The goalis to derive eventually from these data, such context information as peak and averageload on the cutter motors, symmetry of feeding of fish into the cutter, and the presenceof any undesirable lateral movement (slip) of fish while cutting takes place.The speeds of the induction motors that drive the cutter blades are first convertedinto corresponding slip values and then to the percentage nominal loads by means ofequations (4.14) and (4.15). The latter equation assumes that the motor operates in theTable 4.2: Context Database for the Servomotor Performance.1.0Poor Mod. In Over spec.Context Database of Per- rise_time, damped_na.turaLfrequency, damping_ratio,formance Attributes overshoot, offsetPrimary Term Set for Each over_specification, in_specification, moderate, poor,Performance Deviation unsatisfactoryChapter 4. Laboratory Implementation—Software Development 85Figure 4.14: Percent Load versus Slip for the Induction Motors.linear region of its load-slip curve, as indicated in Figure 4.14. This assumptiontrue in general for all commercially available induction motors of type ‘D’, such asused in the workcell.Synchronous speed — Measured shaft speedMeasured slip (Sm) = (4.14)Synchronous speedwhere the synchronous speed for the given induction motors is 3600rpm.Percent load (Lv) = Measured slip (Sm) x 100% (4.15)Slip at full load (sc)A typical load profile obtained after these preliminary data processing operations isshown in Figure 4.15, where the load on each of the two cutter blades during a typical cutting operation is plotted against time. The load-profile data contain interference or noisecreated by the process of frequency to analog conversion, which usually appear as easilyvisible ripples on the load profile. The order binomial filter given by equation (4.16)was used in order to screen out the effect of these ripples before further processing.f(n) [x(n—2) + 4x(n—1) + 6x(n) + 4x(n+1) + x(m+2)]Load PercentageOperatingregion1000 Slip at Full Load 1.0 Slipholdsthose(4.16)Chapter 4. Laboratory Implementation—Software Development 86aCaC-)a00-Ja0Figure 4.15: Typical Load Profiles of the Two Cutter Blades.Now, the following parameters can be easily measured from the two individual profiles:peak load, average load, magnitude of secondary peaks if present and their times ofoccurrence with respect to the first peak.While the average load of each curve over a single cutting cycle signifies the averageload on the induction motors, the difference of magnitudes between the two peak loadsof top and bottom blades is typically an indication of the degree of asymmetry in feedingfish into the cutter. The presence of secondary peaks may indicate slipping of fish whilecutting action takes place, and hence, improper holding by the gripper. A secondarypeak spaced closely to the primary peak is a common feature in most of the cut profiles,indicating the load variations when the blades are cutting through bones rather thanmeat. This feature however, can be set apart from the undesirable secondary peaks dueto improper holding simply by timing the secondary peaks with respect to the primaryone and then ignoring the ones that are sufficiently close to the primary peak. The timingof secondary peaks is hence crucial in recognizing the presence of improper holding.For the purpose of context generation, the non-dimensional indices given below arecomputed using the parameters illustrated in Figure 4.15. The subscripts t and b denoteLmTop BladeBottom BladeLts .- TimeChapter 4. Laboratory Implementation—Software Development 87MembershipGrade1.0Figure 4.16: Membership Functions for the Cutter Load Context.the top and bottom blades respectively, and 1/T is the feed rate of fish on the conveyor.Cut load percentage (L) = (Lmt + Lmb) (4.17)ILmtLmbIIndex of asymmetry (Ia) i , r r \ (4.18)iLmt + .LJmb)Secondary peak load index (I) = L8 (4.19)(Lmt + Lm&)Index of secondary-peak time (Its) = (4.20)The indices for secondary peak load (I) and time of secondary peak load (Its) are computed for both top and bottom blades, separately. These indices are fuzzified using themembership functions shown in Figure 4.16, and then the following rulebase submodule isused in conjunction with the compositional rule of inference, to generate the membershipfunctions of Slip_at_top_blade and Slip_at_bottom_blade:• If secondary peak load (Its) is present and secondary peak load index (I) ismedium then slip is moderate.40 80 120Chapter 4. Laboratory Implementation—Software Development 88Table 4.3: Context Database for Cutter Performance.Context Dtabase of Cutter Performance Primary Term Set for Each VariablePercent_cut_load Small, Medium, LargeIndex_ of_asymmetry Small, Medium, LargeComposite_slip Small, Moderate, Large• Else if secondary peak load (I) is present and secondary peak load index (I) ishigh then slip is large.• Else slip is small.The knowledge base has only one antecedent variable representing the slip at theblades. In order to generate the context of composite slip, the two membership functions of Slip_attop_blade and Slip_at_bottomblade are composed further by the followingrulebase module:• If slip at top blade is large or slip at bottom blade is large then composite slip islarge.• Else if slip at top blade is moderate or slip at bottom blade is moderate thencomposite slip is moderate.• Else if slip at top blade is small and slip at bottom blade is small then compositeslip is small.These preprocessing operations eventually result in a set of three fuzzy-status variables, which stand for the cutter performance as depicted in column 1 of Table 4.3.Column 2 shows the primary fuzzy terms that each variable can assume.Chapter 4. Laboratory Implementation—Software Development 89Table 4.4: Context Database for the Conveyor Performance.Context of Conveyor Performance Primary Term SetConveyor_speed Low, Medium, HighSpeedfluctuations Small, Medium, Large4.3.4 Preprocessor for conveyor speed profileThe purpose of the preprocessor for conveyor speed profile is to extract certain high-level information pertaining to the performance of the drive unit of the conveyor duringthe operation of the workcell. Since the conveyor speed is measured directly throughdedicated hardware as described in Chapter 5, the degree of preprocessing required onthis channel of information is minimal. Two items of context data are extracted fromthe conveyor speed samples, which are acquired during every cycle of fish processing;specifically,inAverage speed (Va,,) (4.21)k=1Speed fluctuations (Vs) = maxk_l(vkt)mink_l(vkt) (422)where, T = ntis the cycle time of processing. Table 4.4 shows the resulting fuzzyvariables which represent the status of the conveyor. The partitioning of the input spaceinto primary sets that are given in column 2 of Table 4.4, is shown in Figure Knowledge Acquisition and RepresentationThe knowledge base of a fuzzy control system is primarily comprised of a linguisticrulebase. The rulebase together with the inferencing mechanism makes up the productionengine which carries out reasoning using the knowledge base, and intermediates therelation between the database (input space) and the inferences (output space). TheChapter 4. Laboratory Implementation—Software Development 90Figure 4.17: Membership Functions for Conveyor Performance.reasoning process is triggered by the context data in the database, and may be thoughtof as a matching process of the “context” to the condition parts of the rules. In thecontext of a hierarchical structure, the database is essentially a conceptual abstractionof the current status of the process, expressed with respect to the corresponding fuzzylinguistic variables. The derivation of such a database through the use of informationpreprocessors was discussed in the previous section in relation to the prototype fishprocessing workcell. This section describes the development of the rulebase which, byacting on the current context, will assess the performance of the workcell and the qualityof finished product. The rulebase will also infer remedial actions where necessary.A fuzzy rulebase is characterized by a collection of linguistic statements of expertknowledge that is usually expressed in the form of if—then rules. Such rules are easilyimplemented by fuzzy conditional statements in fuzzy logic. In the fields of processcontrol and system tuning, there are at least four possible sources for the derivation offuzzy control rules (Lee, 1990). Following is a brief discussion of these four methods withparticular attention to their usefulness in relation to the industrial application that isconsidered in the present thesis.1.020 30 Speed (cm/sec)Chapter 4. Laboratory Implementation—Software Development 911) Expert experience and control engineering knowledge: This method treatsthe process state as the antecedent variables of the fuzzy control rules and the process control variables as the consequent. The most common formulation involvesan introspective verbalization of human expertise. Another approach includes interrogation of experienced operators using a carefully designed questionnaire. Thiswill allow us to form a system of fuzzy control-rules for a particular applicationdomain.The present application has a rulebase module for servomotor tuning, that hasbeen formulated entirely on the basis of this method, particularly by employing thecontrol engineering knowledge of servomotor tuning. Experimentation was initiallycarried out on the servomotors [Barley, 1992] to acquire experience on the effectof specific control parameters over the performance, and this experience was thenformulated as a fuzzy linguistic rulebase.2) Based on the operator’s control actions: In many types of industrial, man-machine control systems, the input-output relations are not tractable with sufficient precision to make it possible to employ classical control theory for analyticalmodeling, experimental modeling, and simulation. Most of the subsystems in ourexperimental system (fish processing workcell) are prime examples for this typeof intractable control systems. Skilled human operators can however control suchsystems quite successfully without using an explicit analytical/quantitative model.It has been shown that a human operator in effect employs a set of fuzzy if—thenrules to control the process [Sugeno and Murakami, 1984].The rulebase modules used in tuning such parameters as the conveyor speed andthe hold-down force had t,o be developed on the basis of this method. Due to thelack of prior experience in certain aspects of the automated workcell, some rulesChapter 4. Laboratory Implementation—Software Development 92were tested on a trial-and-error basis and then this experience was utilized for finetuning of the rulebase.3) Based on learning: This approach refers to the ability to create fuzzy control rulesand modify them automatically based on previous experience. Such systems aretypically organized in a hierarchy consisting of two rulebases. The first one is atypical rulebase of a fuzzy control system while the second one is a set of metarules which exhibits a human-like learning ability to create and modify a generalrulebase, depending on the desired performance of the system.Although this method is not currently used in our experimental workcell, it is anattractive proposition as a possible enhancement to the rulebase. When modifyingthe rulebase for ascertaining the quality of finish product, for example, a self-learning rulebase would be of significant use due to the subjective nature of theparticular task involved.4) Based on the fuzzy model of the process: If a linguistic description of thedynamic characteristics of a controlled process is available, then it may be viewedas a fuzzy model of the process. Based on this fuzzy model, we can generate a setof fuzzy control rules for attaining optimal performance of the dynamic system. Inpractice this approach tends to be somewhat more complicated and a systematicdesign methodology has not yet been fully developed. This approach however hasshown to deliver better performance and reliability [Takagi and Sugeno, 1985]. Dueto the lack of such linguistic characterization of our workcell processes, this methodhas not been used in the rulebase of the workcell.Chapter 4. Laboratory Implementation—Software Development 934.4.1 Types of fuzzy control rulesTwo types of fuzzy-control rules, namely, state evaluation fuzzy control rules and predictive (object evaluation) fuzzy control rules, are currently in use in the design of fuzzycontrollers. The most widely used format of control rules is the state evaluation type,which in the case of multi-input-single-output (MISO) systems, are characterized as acollection of rules of the form;Rule 1: If a is A1 and b is B1 ..., then z is Z1Rule n: If a is A and b is B ..., then z is Z,,,where a, b,..., and z are linguistic variables representing the process state variables andthe control variable respectively. A1,B,.. . , Z are the linguistic values that the fuzzyvariables a, b,. . . , z can assume in the universes of discourse U, V,. . . , W, respectively, fori=1,2,...,m.The predictive fuzzy control [Yasunobu, et al,, 1983] is a fuzzy algorithm which predicts present and future control actions and evaluate control objectives. A typical rulecan be described as,Rulei: If(uisU—.-*(aisAandbisB)) then uisUwhere a and b are performance indices for the evaluation of jth rule. The most likelycontrol rule is selected through predicting the result (a and b) corresponding to everycontrol command U.The rulebase of our prototype workcell has been implemented entirely in the formof state-evaluation fuzzy control rules. The predictive format could not be used in theChapter 4. Laboratory Implementation—Software Development 94Variable Description Symbolw09 Frequency at cross-over gain FRCOG4’cof Phase lead at cross-over gain frequency PHCOFG0f Gain at cross-over frequency GNCOFwz0 Frequency value at low frequency cross- LFCOGover gainsystem development stage due to lack of complete knowledge of system dynamics. Suchan advance knowledge, even though counterproductive in the present application, is vitalin formulating the performance indices in a predictive scheme.4.4.2 Fuzzy rulebase for the workcellThe fuzzy rulebase for our prototype fish processing workcell has been constructed largelyas a collection of MISO state evaluation rules. This follows from the result of Chapter 3that any MIMO fuzzy system could be broken down into a number of MISO systems,without loss of generality. In the following, we describe these rules, their development,and use with respect to the objectives of servomotor tuning, workcell monitoring, andvisual quality assessment.Rulebase for servomotor controlTuning of servomotors under the control environment of DMC-600 has been studied previously by Barley (1992). The following rulebase was developed by applying this controlengineering knowledge to the workcell in an on-line basis. The antecedent variables (i.e.,the condition or status of the servomotors) and the fuzzy values that each variable canassume are given in Table 4.2. The consequent (i.e., action) variables represent certaindesign attributes that have to be tuned in order to achieve a desired performance. Thesedesign attributes relate to the frequency domain specifications of a lead compensator asTable 4.5: Consequent (Action) Variables for Servomotor Tuning.Chapter 4. Laboratory Implementation—Software Development 95MembershipGrade________I_______NL PLX1 X3 X5 +1 Design AttributeFigure 4.18: Output Space Partitioning for the Rulebase of Servomotor Tuning.illustrated in Figure 4.19. Each of these consequent variables, as listed in Table 4.5, canassume one of five possible fuzzy states that are defined over a normalized output space[-1.0, +1.01, as shown in Figure 4.18.Those consequent variables that do not appear in some of the rules in Table 4.6 mustbe considered as not contributing to the tuning of the servomotor controller. In otherwords, they all take the fuzzy value ze (zero) in the output space. The design attributesare updated by the incremental values that the above rulebase infers. The resultingvalues are then mapped to the controller parameters of equation (4.23), which representsthe frequency domain transfer function of a lead compensator; i.e.,G(jw) = K 0 <a < 1 (4.23)where, K is the gain parameter of the compensator, while A and aA are time constantsassociated with the lead compensator. The equations (4.24) through (4.26) complete themapping procedure from design attributes to the controller parameters.a1 — sin(40j) (4 241 + sin(cb0f)A=(4.25)Chapter 4. Laboratory Implementation—Software Development 96G)C0-90“+9fN\ç‘ZJ__0.1 0Log901.0 10 100Frequency (rad/s)øcofCi) 1000 10,0000.1 1.0 10 100 1000 10,000-180Frequency (rad/s)Figure 4,19: Frequency Domain Specifications (Design Parameters) As Applicable to theRulebase for Servomotor Tuning.Chapter 4. Laboratory Implementation—Software Development 97Table 4.6: Rulebase for Servomotor Tuning.If Rise_time is Unsatis. then frcog is ni & phcof is ni & gncof is plelse if Rise_time is Poor then frcog is ns & phcof is ns & gncof is pselse if Rise_time is Moderate then frcog is ns & phcof is ns & gncof is pselse if Rise_time is In_spec, then frcog is ze & phcof is ze & gncof is zeelse if Rise_time is Over_spec, then frcog is ps & phcof is ps & gncof is nsIf Damping_ratio is Unsatis. then frcog is ni & phcof is p1 & gncof is p1else if Damping_ratio is Poor then frcog is ns & phcof is ps & gncof is pselse if Damping_ratio is Moderate then frcog is ns & phcof is ps & gncof is pselse if Damping_ratio is In_spec, then frcog is ze & phcof is ze & gncof is zeelse if Damping_ratio is Over_spec, then frcog i5 PS & phcof is ns & gncof is nsIf Overshoot is Unsatis. then frcog is ni & phcof is 1 & gncof is plelse if Overshoot is Poor then frcog is ns & phcof is ps & gncof is pselse if Overshoot is Moderate then frcog is ns & phcof is ps & gncof is pselse if Overshoot is In_spec, then frcog is ze & phcof is ze & gncof is zeelse if Overshoot is Over_spec, then frcog is ps & phcof is ns & gncof is nsIf Offset is Unsatis. then gncof is p1 & lfcog is p1else if Offset is Poor then gncof is p1 & lfcog is pselse if Offset is Moderate then gncof is ps & lfcog is pselse if Offset is In_spec, then gncof is ps & lfcog is zeelse if Offset is Over_spec, then gncof is ze & lfcog is nsIf Dmp_nat_freq. is Unsatis. then gncof is plelse if Dmp_nat_freq. is Poor then gncof is pselse if Dmp_nat_freq. is Moderate then gncof is pselse if Dmp_nat_freq. is In_spec, then gncof is zeelse if Dmp_nat_freq. is Over_spec, then gncof is nsChapter 4. Laboratory Implementation—Software Development 98K = G0f I (4.26)Here, q!cof = phase lead at cross-over gain frequency, WcQg = frequency at cross-over gain,and Gf = gain at cross-over frequency. In addition, the controller has an integratorbranch with the transfer function,G(jw) = (4.27)where the gain parameter K: is given by,= I G0 (4.28)The above procedure of parameter update is repeated for both the cutter servomotorand the platform servomotor. The rulebase for servomotor tuning operates independentlyon the separate context databases of the two servomotors, producing inferences for tuningeach servomotor independently.Rulebase for product quality assessmentThe finished product quality of the workcell is assessed primarily on the basis of visual context that was developed earlier through preprocessing image data from the secondary CCD camera. Namely, the features that indicate quality are (a) Accuracy of cut(Accuracy), (b) Depth of solid cut section (Depth), (c) Smoothness of cutting contour(Contour), and (d) Smoothness of surface over cutting region (Surface).The inference of the current rulebase is a single fuzzy variable indicating the quality ofthe finished product as one of two possible fuzzy outcomes of either Acceptable or Unacceptable, as shown in Figure 4.20. The rulebase has been devised to mimic the judgementof a human expert who assesses the quality of fish products by visual inspection. Therulebase module utilized in the workcell for this purpose is shown in Table 4.7.Chapter 4. Laboratory Implementation—Software Development 99MembershipGr dePoor Moderate Good1.0Visual QualityFigure 4.20: Output Space Partitioning for the Quality Assessment Rulebase.Table 4.7: Rulebase for Assessment of Product Quality.• IF Accuracy is Unacceptable and Depth is Amy and Contour is Any and Surface isAny THEN Quality is Unacceptable.• IF Accuracy is Acceptable and Depth is Good and Contour is Good and Surface isGood THEN Quality is Acceptable.• IF Accuracy is Acceptable and Depth is Good and Contour is Moderate and Surfaceis Good THEN Quality is Acceptable.• IF Accuracy is Acceptable and Depth is Moderate and Contour is Moderate andSurface is Moderate THEN Quality is Acceptable.• IF Accuracy is Acceptable and Depth is Poor and Contour is Any and Surface isAny THEN Quality is Unacceptable.• IF Accuracy is Acceptable and Depth is Any and Contour is Poor and Surface isAny THEN Quality is Unacceptable.• IF Accuracy is Acceptable and Depth is Any and Contour is Any and Surface is PoorTHEN Quality is Unacceptable.Chapter 4. Laboratory Implementation—Software Development 100In the rulebase module of Table 4.7, the term Any in the antecedent variables refersto the conjunction of all possible values in that variable. For example, Depth is Any isequivalent to the conjunction of Depth is Poor or Depth is Moderate or Depth is Good.Rulebase for workcell tuningThe rulebase for workcell tuning operates on the context derived from the low-levelsensory measurements of conveyor speed, cutter load, and information on slip at thecutter. This database consists of the following fuzzy antecedent variables; (a) percentagecutter load (Cutload), (b) composite slip at cutter (Slip), (c) average conveyor speed(Speed), and (d) conveyor speed fluctuations (Fluctuations). The consequent or actionvariables are the tuning inferences; namely, (a) the change in conveyor speed (Speedchange), and (b) the degree of grasping (Hold-down). It should be noted that while theinference on conveyor speed is incremental, the inference on grasping, i.e., the hold-downforce, is absolute. In addition, the absolute conveyor speed is limited by two upperand lower bounds set through the defuzzifying algorithm. Table 4.8 shows the rulebasemodule adopted for tuning of the workcell.Although Table 4.8 depicts the rulebase as an MIMO system, the workcell implementsthe two inferences individually in the form of two independent MISO systems. Figure 4.21shows the partitioning of the two fuzzy output spaces corresponding to the respectiveinferences of change of conveyor speed and hold-down force.4.5 Implementation of Inference EngineThe inference engine is an essential mechanism for knowledge-based control and it issolely responsible for generating inferences corresponding to the current context of theworkcell. The database which contains the current context and the rulebase which holdsChapter 4. Laboratory Implementation—Software Development 101Table 4.8: Rulebase for Workcell Tuning.IF Cutload is Low and Slip is Small and Fluctuations is Not Large and Speed is LowTHEN Speed change is Pos. Large and Hold-down is Soft.• IF Cutload is Low and Slip is Small and Fluctuations is Not Large and Speed isMedium THEN Speed change is Pos. Small and Hold-down is Soft.• IF Cutload is Lou and Slip is Small and Fluctuations is Not Large and Speed is HighTHEN Speed change is No Change and Hold-down is Soft.• IF Cutload is Medium and Slip is Small and Fluctuations is Not Large and Speed isLow THEN Speed change is Pos. Small and Hold-down is Soft.• IF Cutload is Medium and Slip is Small and Fluctuations is Not Large and Speed isMedium THEN Speed change is Pos. Small and Hold-down is Soft.• IF Cutload is Medium and Slip is Small and Fluctuations is Not Large and Speed isHigh THEN Speed change is No Change and Hold-down is Soft.• IF Cutload is High and Slip is Small and Fluctuations is Not Large and Speed is LowTHEN Speed change is No Change and Hold-down is Moderate.• IF Cutload is High and Slip is Small and Fluctuations is Not Large and Speed isMedium THEN Speed change is Neg. Small and Hold-down is Moderate.• IF Cutload is High and Slip is Small and Fluctuations is Not Large and Speed isHigh THEN Speed change is Neg. Large and Hold-down is Moderate.• IF Cutload is High and Slip is Small and Fluctuations is Not Large and Speed isMedium THEN Speed change is Neg. Small and Hold-down is Moderate.• IF Cutload is Any and Slip is Moderate and Fluctuationsis Not Large and Speed isMedium THEN Speed change is Neg. Small and Hold-down is Moderate.• IF Cutload is Any and Slip is Moderate and Fluctuations is Not Large and Speed isLarge THEN Speed change is Neg. Large and Hold-down is Moderate.• IF Cutload is Any and Slip is Large and Fluctuations is Not Large and Speed is AnyTHEN Speed change is Neg. Large and Hold-down is Tight.• IF Cutloq4 is Any and Slip is Any and Fluctuations is Moderate and Speed is MediumTHEN Speed change is No Change and Hold-down is Moderate.• IF Cutload is Any and Slip is Any and Fluctuations is Moderate and Speed is LargeTHEN Speed change is Neg. Small and Hold-down is Moderate.• IF Cutload is Any and Slip is Any and Fluctuations is Large and Speed is Any THENSpeed change is Neg. Small and Hold-down is Tight.Chapter 4. Laboratory Implementation—Software Development 102Figure 4.21: Output Space Partitioning for the Rulebase of Workcell Tuning.the domain-specific knowledge are two important components that are used by the inference engine. The fact that there is no chaining mechanism involved simplifies the processof inferencing under the context of fuzzy logic. Unlike the conventional production engines where forward or backward chaining is essential for their inference mechanism,fuzzy logic employs the Compositional Rule of Inference [Zadeh, 1973] as the inferencing scheme, where every rule has a certain contribution towards the final outcome. Thestrength of this contribution is determined by the relative strength of the membershipfunctions involved.The implementation of compositional rule of inference is based on the following mathematical preliminaries, which define the basic steps involved in fuzzy implication:Cartesian product: Let A1,. . . , A be fuzzy sets in U1,. . . , U respectively. Then theCartesian product of A1,.. . , A is a fuzzy set in the product space U1 x x U, withthe membership function,I.LA1x. .xA(u1,. .,u) = min[A(u1),. . . (4.29)MembershipGradeNL NSMembershipGrade1.0ModerateX5 +1-1 Xi X2 X3 X4Change of Conveyor Speed Hold-down ForceFuzzy relation: An n-ary fuzzy relation (R) is a fuzzy set in U1 x ... x U, and canChapter 4. Laboratory Implementation—Software Development 103be expressed as,= {[(ui,...,u), /tR(u1,”,u)] I Ui, ,Un EU1 X X U} (4.30)Sup-mm composition: Let Rand S be fuzzy relations in Ux V and Vx W, respectively.Then the composition of R and S, denoted by R o S, is a fuzzy relation defined by,RoS = UUXW(U,W)= max mm [R(u,v),s(v,w)] (4.31)vEV uEU JU’ EWCompositional rule of inference: Let R be a fuzzy relation in U x V, and x be afuzzy set in U. Then the max-mm compositional r’ule of inference asserts the fuzzy set yin V implied by x, as= xoR (4.32)where x o R is the max-mm composition of x and R as defined by equation (4.31).4.5.1 The relational tableEvery rule in the knowledge base of a fuzzy system describes a relation between theantecedent and consequent variables of the particular rule. The degree of strength ofthis relation is fuzzy and can be expressed in the form of a relational table with themagnitude defined as in equation (4.30).If the knowledge base contains a total of N antecedent (condition) variables and Mconsequent (action) variables, then the whole rulebase could be expressed by a relationaltable of dimension (N + M). In practice, however, this approach has many drawbackssuch as large processing time and difficulty of maintenance. Instead, since the wholerulebase could be partitioned into several multi-input-single-output modules, each suchChapter 4. Laboratory Implementation—Software Development 104module could be designated by a relational table of dimension (m + 1), where n is thedimension of the input space; i.e., the total number of different antecedent variables thatcontribute towards the single output variable.The relational table is constructed by applying fuzzy composition to the membershipfunctions of each variable of the rulebase. Therefore, the most elementary implementation of a fuzzy system is the fuzzy variable which is represented in the workcell by a twodimensional array of (p x d) elements, where p is the number of primary fuzzy terms(partitions) of the variable and d is the number of discretization levels. The numberof primary fuzzy sets p, defined over a particular universe of discourse, depends on thelevel of granularity of the desired control. Usuaily, in practice, p is assigned a numberfrom the range 2, 3, 5, and 7. The number of discretization levels d essentially refers tothe quantization of the continuous universe of a fuzzy variable. The particular choice ofquantization level has a direct influence on how fine a control can be achieved. Consequently, d should be large enough to provide an adequate approximation and yet smallenough to save memory storage. For example, if every fuzzy variable has an identicallevel of discretization of d, then the size of the relational table of a rule module would bewhich could become extremely large for moderate values of d. The workcell uses adiscretization level of 11 for most of its fuzzy variables.Consider, as an example, the representation of the fuzzy variable cut_load, wherep = 3 (low, medium, high) and d = 11. Table 4.9 shows how the membership functionswhich are illustrated in Figure 4.16 for the variable cut_load, are stored as a 3 x 11 arrayof elements.Once the membership functions for all antecedent variables and for the single consequent variable of the rulebase module are defined as above, the relational table could beconstructed as explained in the following example:Let us consider a rulebase fragment with the two antecedent variables, cut_load andChapter 4. Laboratory Implementation—Software Development 105Table 4.9: Cut_load_mem[i][j] - Representation of the Fuzzy Variable “cut_load”.0 1 2 3 4 5 6 7 .8 9 10Low 1.0 1.0 1.0 0.7 0.3 0.0 0.0 0.0 0.0 0.0 0.0Med 0.0 0.0 0.0 0.3 0.7 1.0 0.7 0.3 0.0 0.0 0.0High 0.0 0.0 0.0 0.0 0.0 0.0 0.3 0.7 1.0 1.0 1.0slip, and a single consequent variable, speed, as shown below.Rule 1 : IF (cut_load = low) AND (slip = small) THEN (speed pos_large)Rule 2 : IF (cutload = med) AND (slip = small) THEN (speed = pos_small)Rule 3 : IF (cutioad = high) AND (slip = small) THEN (speed = neg_small)The primary term sets of each fuzzy variable are first enumerated such that an arrayreference appears linguistically equivalent to the corresponding clause in a particular rule.For example, the membership value for the clause cut_load = low could be referenced ascut_load_mem[lowj.enum {low, medium, high} cut_load_terms;enum {small, moderate, large} slip_terms;enum {neg_large, neg_small, zero, pos_small, pos_large} speed_terms;The relation table is then built by applying each and every rule to all possible combinations of input values. That is, for a single instance of input values, the correspondingrule-firing strengths are calculated in accordance with the fuzzy norms of AND, OR,NOT, and THEN, for every rule. The maximum value of these firing strengths is thenChapter 4. Laboratory Implementation—Software Development 106assigned to the corresponding instance of input combination. This procedure is repeatedfor all possible instances in input space as follows:for C cut_load = 0; cut_load < d; cut_load++ )for C slip = 0; slip < d; slip++ )for C speed = 0; speed < d; speed++ ){rulel = minimum C cut_load_mem[low] [cut_load],slip_mem [small] [slip],speed_mem[pos_large] [speed] );rule2 = minimum C cut_load_mem[medium] [cut_load],slip_mem[snall] [slip],speed_mem[pos_small] [speed] );rulel = minimum C cut_load_mem[high] [cut_load],slip_mem [small] [slip],speed_mem[neg_small] [speed] );rule_speed [cut_load] [slip] [speed]= maximum C rulel, rule2, rule3 );where, rule_speed is the three-dimensional relational table which connects the two-dimensional input space (cut_load x slip) to the single output (speed).Chapter 4. Laboratory Implementation—Software Development 1074.5.2 Max-mm inferenceIn real world control applications, typical inputs are fuzzy singletons, however, the presentrealization of the workcell supports the more general fuzzy compositional rule of inference.Specifically, the inferencing mechanism in the workcell assumes the inputs to be fuzzyvariables with a broad support set rather than a single element.The first step of inferencing is to form the join or the Cartesian product of the inputvalues according to equation (4.29). For the previously given input example, we canwrite,for C cut_load = 0; cut_load < d; cut_load++ )for C slip = 0; slip < d; slip++ ){join [cut_load] [slip] = minimum C in_cut_load [cut_load],in_slip[slip] );where, join is the two dimensional input vector in the universe of discourse (cut_load xslip), and in_cut_load and in_slip are the membership functions corresponding to the input(condition) variables cut_load and slip, respectively. Then we can apply the compositionalrule of inference of equation (4.31) to the input vector join and relational table rule_speed,as follows to obtain the fuzzy inference of speed:for C cut_load = 0; cut_load < d; cut_load++ )for C slip = 0; slip < d; slip++ )for C speed = 0; speed < d; speed++ ){mm = minimum C rule_speed[cut_load] [slip] [speed],Chapter 4. Laboratory Implementation—Software Development 108join [cut_load] [slip] );out_speed [speed]= maximum C out_speed[speed], mm );where out_speed is the inference of speed expressed in terms of a membership functionwith the discretization level d. Depending on the level of abstraction, this inference maybe either defuzzified and used as a control variable or it may be used as a fuzzy input toa higher-level knowledge base of the system hierarchy.Defuzzification: The workcell implements the centroid method of defuzzification forall its outputs. This method takes the center of area of the membership function after assigning suitable weights to all discretized points in the corresponding universe ofdiscourse.d(out_speed[i] x weight _speed[iJ)Output = d (4.33)out _speed[i]where, weight_speed is a weighting function defined at every discretization point of themembership function out_speed. As an example, since the membership function out_speedrefers to the change of speed in either positive or negative sense, the weighting functionweight_speed takes the form,weight_speed =[—5,...,—1,0,1,...,5]The control variables will be further scaled by a sensitivity factor before they aretransmitted to the respective controllers.Chapter 4. Laboratory Implementation—Software Development 1094.6 User Interface to the WorkcellIn the present implementation, the complexity of operation and the large quantity ofinformation available for monitoring necessitate that the workcell employs a user friendlymachine-human interface. The hierarchical structure of the control system itself providesa good starting point for a hierarchically-layered menu-driven user interface. The Mainmenu which is the top level of the user interface, provides a graphical representation thatis analogous to the hierarchy of the workcell. At any level of the interface hierarchy, theuser can select and open up a lower level of the hierarchy or an item in the same level, inorder to monitor or interrogate a particular level or a device in the workcell. A detaileddescription of each level of this interface appears later in this section.Since the fish processing workcell is expected to be installed in an industrial process-plant environment, where it is used by ordinary semi-skilled machine operators ratherthan computer experts, it is imperative that the software and user interface exhibit agreat degree of robustness against abuse by users. The robustness of system software canbe improved only after a large number of trial runs in an actual plant environment. Amenu driven user interface on the other hand, provides a shield against abuse since userscan select only a pre-determined set of actions. The user interface of the workcell alsodisables many unused keys from the user console in order to reduce the risk of inadvertentinputs to the critical system software.The workcell also provides a fully fledged data logging facility so that the user could,at a later time, recall and examine system performance of a previous run. This featureenables the workcell to save automatically the measurements from all feedback sensorsincluding the images from the COD camera. The user can enable or disable the datalogging facility at will and also set the path and the filenames for saving data.Chapter 4. Laboratory Implementation—Software Development 1104.6.1 The main menuThis is the top level of the interface by which the user interacts with the workcell. Itshows a graphical representation of the hierarchical control structure, and also performsthe function of a menu. At this level the user can select and open up a lower level of thehierarchy for monitoring or interrogation. The available selections are; the sensor level,pre-processor level, status/context level, knowledge base level, decision level, actuatorlevel, and device level. Also, a task-allocation level is provided for the user to set theoperational tasks such as; starting the workcell, logging data, and recalling saved data.Figure 4.22 shows the layout of the main menu, with the current selection highlighted.4.6.2 The sensor menuThis menu represents the lowest level of the hierarchy where sensor readings are monitored. In the present application, the sensor menu has a choice of five sensors to selectfrom, each of which will graphically display the selected sensor signal. The availablesensors are,1. Cutter load profile as measured from the induction motor speed sensors.2. Conveyor speed profile as measured from the conveyor encoder.3. Secondary CCD camera image of processed fish.4. Servomotor response profile for the platform.5. Servomotor response profile for the cutter.The images of processed fish are displayed on a separate monitor by itself while allother sensor readings are displayed graphically on the same monitor where the sensormenu appears. Figure 4.23 shows the appearance of the sensor menu, with the selectionfor cutter load profile highlighted.Chapter 4. Laboratory Implementation—Software Development 111FISH AUTOMATION U 0 N K-C E L LTASK ALLOCATIONitri E,itr=I:e- :ItJ irij E::=E:.:it rfrI,/:r[.:NFigure 4.22: The Main Menu of the User Interface of the Workcell.Chapter 4. Laboratory Implementation—Software Development 112SENSOR READINGS- Conveyor Camera-2 Platform CutterSpeed Image Response Responseiso Bet bladefFop:.blade..0 05 10 1520Tixae [see.),ircy:;=SeIecL iten Ezc.=FEtur, i: rair rInuFigure 4.23: The Sensor Menu of the User Interface of the Workcell.Chapter 4. Laboratory Implementation—Software Development 1134.6.3 The preprocessor menuAt the preprocessor level of the hierarchy, each stream of sensor reading is processedand reduced to a few parametric values suitable for fuzzification at a higher level. Thepreprocessor menu displays these parameters with a graphical equivalent of the processedreadings. As a result, the preprocessor menu closely resembles the sensor menu in termsof input selection. Figure 4.24 shows the preprocessor menu, with the camera-image signal selected. For this particular selection, the preprocessor shows the quality-indicativeparameters calculated from the raw images, while the image monitor shows the intermediate steps in processing the raw image.4.6.4 The workcell status menuThis menu reports the current status of the workcell from the view point of the knowledge base level of the hierarchy. In other words, the context database of the workcellcould be monitored through the status menu. Since the workcell context is furnishedas a fuzzy linguistic database, this level shows the fuzzy variables corresponding to eachcategory of inputs. The primary term set and the membership in each set satisfied by theinput variables are shown with a suitable color coding. The context is divided into fourmenu-selectable categories; namely, cutting quality, visual quality, platform response,and cutter response. Figure 4.25 illustrates the status menu when the cutter responseis highlighted. In this case, for example, the menu shows the membership functionscorresponding to the performance of the cutter servomotor in each monitored parameter.4.6.5 The knowledge base menuThis menu enables the user to view the content of the entire rulebase of the workcell.At the top of the window, the user can select a particular module of the rulebase forChapter 4. Laboratory Implementation—Software Development 114I PIW-PROCESSOHS FOR LOU LEIJEL DATALoad I_________IPlatforr I Cutter IProfile] ...- Servo i ServoSolid depth of cut = B.638?Snoothness of cut contour =Smoothness of cut surface = A.73U8801200t.rii Ec P;ttiiri tc rri.iri rrieriu0 ArclarigthFigure 4.24: The Preprocessor Menu of the User Interface of the Workcell.Chapter 4. Laboratory Implementation—Software Development 115FUZZY CONTEXT FOR THE NNOULEDGE-BASECutting Uisual Piatforn -Ljualit!J Iualiti Response -N PR MDIN 0 N PR MDIN 0rAirAlRise Time Dmp. Nat. FreqN PR MOIN 0Damping RatioMDIN01flRMDINOvershoot OffsetHEY TERMS:UN - Unsatisfactory response.PR - Poor response.lID - Moderate response.IN - Response is within specs.OI.J- Response is ouer specs..rroy.=SeItc iirn EFturn t main rnrI.4Figure 4.25: The Status Menu of the User Interface of the Workcell.Chapter 4. Laboratory Implementation—Software Development 116viewing, and as a result, the rules corresponding to the selected module will appear atthe bottom half of the window. Figure 4.26 shows the knowledge base menu, with therulebase module corresponding to the conveyor-speed adjustments highlighted.4.6.6 The decisions menuThe decisions menu displays the inferences of the knowledge base in its raw form of fuzzylinguistic sets. The appearance of this menu resembles that of the workcell-status menuexcept that for each output category only one fuzzy variable, representing the inferredvalue, is displayed. There are five menu-selectable fuzzy outputs; namely, conveyor speed,holding force, visual quality of cutting, tuning parameters of platform servomotor, andtuning parameters of cutter servomotor. The inferences are displayed in the form of fuzzyvariables with the membership in each set of the primary term set highlighted.4.6.7 The controller menuThis is essentially identical to the decisions menu, except that the decisions of the knowledge base are now displayed as crisp values resulting from the defuzzification and scalingoperations on the original fuzzy inferences. Since these values are then directly downloaded to the respective controllers, the controller menu in effect provides the user witha facility to view the current values of the tuning parameters.4.6.8 The devices menuThis menu provides the user with a graphical display of the layout of various componentsin the workcell. The display is quite similar to the diagram in Figure 5.2. The devicesdisplay also shows the data flow paths between the monitoring/control computers andthe sensors and actuators of the workcell.Chapter 4. Laboratory Implementation—Software Development 117KNOWLEDGE BEPRESENTAT ION - RULE BASE1. If CTLD is X and SLIP is ‘I then (lISP is A and HLDM is U.2. If DEPTH Is K and SMOOTH is ‘I then FINISH is A.3. If CTSM is X and PLOF is V then PLPG IsA and PLIT is B.4. If CTAC is K and CTOF Is V then CTPG IsA and CTIT is B.5. If CTOS Is X then CTPG is A and CTDT is B.6. If CTSP Is K then CTPG IsA and CTDT is B.7. If PLOS is K then PLPG is A and PLDT Is C.U. If PLSP is K then PLPG IsA and PLDT is B.1. If CTLD Is low and SLIP is snail then DCNSP Is pos. large and HLDNis soft.2. If CTLD Is med. and SLIP is snail then DCNSP Is pos. snail andHLDN is soft.3. If CTLD is high and SLIP Is small then DCNSP is no change and HLDNis soft.4. If CTLD is not high and SLIP Is moderate then DCNSP is neg. smalland HLDN is moderate.5. If CTLD is high and SLIP Is moderate then DCNSP is neg. large andHLDN Is moderate.6. If SLIP is large then DCNSP is negative large.ftiii E::r=Feti_irn fr riIn rneru_iFigure 4.26: The Knowledge Base Menu of the User Interface of Workcell.Chapter 4. Laboratory Implementation—Software Development 118A user manual for the workcell: A detailed user manual for the workcell of thepresent application is presented in Appendix A. The operational features of the workcellare discussed from the viewpoints of both hardware and software. To facilitate softwaremaintenance and modification in the future, complete descriptions on data structuresand functions used in the workcell software are listed in the user manual.Chapter 5Laboratory Implementation—Hardware developmentThis chapter describes the hardware developments pertaining to the implementation ofthe prototype fish processing workcell in the Industrial Automation Laboratory. Architecture of the control hierarchy and the related features of software, as described in Chapter 4 have a close correspondence with important features of hardware of the workcell.In order to help understand these characteristics, and also the functional requirements ofthe workcell, a brief overview of the prototype workcell is given at the beginning of thechapter. The rest of the chapter will introduce a conventional fish processing machineknown as the iron butcher, and will detail the cutter design, motor selection, and additional data processing hardware such as the vision processor and the servo controller.Furthermore, this chapter will include description of the hardware sensors that are usedto determine process status of the workcell.5.1 The Iron ButcherThe machine that is commonly used in the fish processing industry for head cuttingis known as the “Iron Butcher”. The machine has been first designed and built at theturn of the century and has seen little modification or improvement since then, despiteits continuous and widespread usage in the industry up to the present time. Figure 5.1illustrates the prominent components of this early iron butcher. As can be expected froman early 20th century machine, the iron butcher is purely a mechanical device employingfriction to detect the gill of a fish and a tactile engagement mechanism to align the119Chapter 5. Laboratory Implementation—Hardware development 120Figure 5.1: The “Iron Butcher”.collarbone with the cutter blades. Due to lack of active sensing and feedback control,this simple mechanism proved to cause considerable amount of wastage by frequentlyover-feeding the fish into the cutter. This problem occurs when the mechanical foot (seeFigure 5.1) engages with the body of a fish before reaching the collarbone and therebypushing the fish too much into the cutter. On some occasions under-feeding occurs, andthis happens when the foot slips over the collarbone and gill plate. As a result the fish isnot pushed adequately into the cutter, resulting in the need to reprocess fish manually.In the salmon processing industry of British Columbia alone, for example, the wastageof useful meat due to poor butchering has been estimated at 25 million dollars annually.The Industrial Automation Laboratory has undertaken research aimed at addressingthe above deficiencies of the iron butcher by employing modern technology to detect andposition fish accurately at the cutter. The control and monitoring subsystem studied inthis thesis was developed as a part of this effort to bring in new automated technologyto the fish processing industry.Cutter KnifeChapter 5. Laboratory Implementation—Hardware development 1215.2 Fish Processing Workcell — An OverviewThe prototype fish processing workcell that has been developed in the Industrial Automation Laboratory is intended for butchering (or head removal), which is the first phaseof processing a fish in an automated production line. The prototype workcell incorporates computer vision, robotic technology, and knowledge-based hierarchical control intoa flexible processing plant. The objective of the workcell is to process fish accuratelyand efficiently while meeting the tough quality standard of the market. An automatedplant is also expected to be flexible enough, so as to respond swiftly to the changingpatterns of demand in the marketplace. The butchering phase has traditionally been themost wasteful part of the processing cycle and the new automated plant is intended tominimize the wastage during this stage of processing by maximizing the meat recovery.It will also optimize the throughput without compromising on the aforementioned goals.Figure 5.2 schematically highlights the principal mechanical parts and the low-levelcontrol and communication components of the prototype fish processing workcell. Thethree mechanical subsystems that are depicted in Figure 5.2 are, the conveyor whichcarries fish from the feeding point to the cutter, a maneuverable cutter assembly foreffecting the butchering process, and a grasping device which holds down fish whilesliding along with the conveyor.During a typical operation of butchering, an image of a fish on the conveyor is grabbedby the primary vision system, after being triggered by means of an object-detection sensormounted on the conveyor. The primary vision workstation then analyses the image forthe purpose of detecting and establishing the cutting locations that are later utilizedin the lateral positioning of the cutter in alignment with the collar bone [Riahi and deSilva, 1990]. As each fish enters the imaging station an ultrasonic displacement sensormeasures the thickness of the fish at or near the general area of the collar bone. This0 I I2SecondcxyVisionSystemPrimayVstonSystemFigure5.2:SchematicDiagramoftheFishProcessingWorkcell.I-’Chapter 5. Laboratory Implementation—Hardware development 123measurement is needed to align the fish in the vertical direction so that each fish isdelivered symmetrically into the cutter blades. These locations are then communicatedto the control/monitoring computer which subsequently commands the servo motorsplaced at the cutter assembly to move to the proper locations. The two servo motorsare controlled through a two-axis add-on board for robotic motor control that is pluggedon to the monitoring/control computer. The cutter assembly also comprises two circularblades arranged in a V-shape and driven by two independent high-speed induction motorsthrough flexible coupling. Both vertical and horizontal alignments of each fish with thecutter blades are designed to minimize the wastage of useful meat during the butcheringoperation. The grasping mechanism prevents the possibility of any unwanted lateralmovement of fish across the conveyor while they are being transported from the imagingstation up to cutting platform.The typical throughput is 2 butchering actions per second, leaving only 500 ms foreach sequence of operations. Since image capturing and primary image processing takesabout 300—400 ms, the cutter positioning mechanism is required to have a respond timein the order of 100 ms.The research presented in this thesis is principally concerned with the monitoring andquality control of the fish processing workcell. The primary image processing and dataanalysis for the detection of cutting locations have been successfully carried out and theresults published by the other members of the research team [Gamage, 1993]. In order todevise an effective quality control system, many other sensors are employed in the workcellin addition to its primary components. A CCD camera is mounted at the exit end ofthe cutting station, which provides a secondary image processor with visual informationon the quality of the cutting process. Several other optical sensors, as described later inthis chapter, supply the speed and load information to the monitoring/control computer.The performance of the servo motors is monitored through direct, on-line interrogationChapter 5. Laboratory Implementation—Hardware development 124of the programmable servo motor controller card, by the monitoring system.5.2.1 Primary vision subsystemThe primary vision subsystem is responsible for fast and accurate detection of the gillposition of a fish, on the basis of an image of the fish as captured by the primary CCDcamera. This subsystem is comprised of:(i). Primary CCD camera for grabbing an image,(ii). Ultrasonic sensor for height measurement,(iii). Trigger switch for detecting a fish on the conveyor,(iv). GPB-1 image processing board for image analysis,(v). PCL—I/O board for data communication,(vi). 486/50 MHz PC as the host machine.The implementation of hardware and software of this subsystem has been underintense research from the very beginning of the development of the workcell. This partof research has now been successfully completed and the results published elsewhere[Gamage, 1993]. From the view point of monitoring and quality control, it suffices tonote that the primary vision system is capable of reliably detecting and calculating thecutting locations in approximately 300 to 400 milliseconds. It then communicates theselocations to the monitoring/control computer. Since the cycle time is 500 ms, this leavesabout 100 ms, after setting aside 50 ms as the margin of safety, for the control system tocarry out positioning of servo motors.5.2.2 ConveyorThis is the only component that has been retained from the original iron butcher when itwas reconfigured as an automated workcell. The conveyor is responsible for moving fishChapter 5. Laboratory Implementation—Hardware development 125continuously from the feeding-end to the cutter. The fish are carried by means of pushlugs that are placed on a set of chains around the conveyor. The conveyor has a linearspeed of 2 lugs per revolution of the drive shaft, and the distance between two adjacentlugs is 22.8cm (9 in). The conveyor shaft is driven by a variable-speed DC motor througha belt drive.The speed requirements of the conveyor are primarily governed by the fish processingspeed. Assuming a throughput of 2 fish/s, the following specifications are used for themotion of the conveyor;(i). Linear speed = 45.6 cm/s(ii). Drive shaft speed = 1 rev/s(iii). Speed fluctuations = less than 5 percent.(iV). step response : This is not critical as the conveyor is continuously driven. The rise time should bereasonably short (25 s) however, in orderto minimize starting delays and to limit inrush current at the drive amplifier.Monitoring/ControlComputerFigure 5.3: Speed Control Loop for the Conveyor.Chapter 5. Laboratory Implementation—Hardware development 126The actuator motor for the conveyor is a separately-excited, 115V, 1.5hp, DC motor.The armature current rating is 12A, although the motor is utilized at a much lowercurrent level under normal operating conditions. Speed control of the conveyor motor iseffected through the use of a pulse-width-modulated (PWM) amplifier. Figure 5.3 shows,in schematic form, the arrangement employed for the control of conveyor speed. Detailsof the amplifier for the conveyor motor are as follows:Model : ESA - 10/75, GAULType : Pulse-width-modulationVoltage : 2575 VDcCurrent : 1OA continuous/25A peakGain : Adjustable 0.3’—0.8 A/V.The 12 bit digital speed command is first converted into an analogue signal in therange of O5 VDC by the PCL-812 Input/Output interface board. This signal is then fedinto the PWM amplifier which converts the voltage to a pulse-width-modulated currentfor driving the motor. The conveyor speed is sensed by means of an optical encoderattached to the drive shaft and the control loop is closed through the control/monitoringcomputer.5.2.3 Cutter assemblyThe purpose of the cutter assembly is twofold. First, it is responsible for horizontalplacement of the cutter blades in less than approximately lOOms on issuing a positioningcommand. This horizontal placement makes sure that the cutter blades are alignedaccurately with the collarbone of the fish to be processed. The cutter assembly shouldalso carry out the vertical placement of the platform, simultaneously, such that eachfish is delivered symmetrically into the cutter. The accuracy of position control in theChapter 5. Laboratory Implementation—Hardware development 127horizontal direction (X-axis) must be ±0.1 mm, while that for the vertical direction (Yaxis) is ±0.5 mm. In order to realize these requirements the components of the cutterassembly are specified as follows:(i). DC permanent magnet motor for the X-axis: Model 500/1000B GAUL, Voltage= 64VDc, Peak Torque = 5.1 N.m, Continuous Torque = 1.11 N.m, Moment ofInertia = 1.9 x i0 kg.m2, and Maximum Speed = 3750 rpm.(ii). DC permanent magnet motor for the Y-axis: Model 50/1000 GALIL, Voltage =32VDc, Peak Torque = 1.45 N.m, Continuous Torque = 0.21 N.m, Moment ofInertia = 2.6 x iO kg.m2,Maximum Speed = 3750 rpm.(iii). A backlash-free lead-screw arrangement for the X-axis with 1/2 inch pitch.(iv). A backlash-free lead-screw arrangement for the Y-axis with 1/4 inch pitch.(v). Two circular blades, each 6 inch in diameter, arranged in a V-configuration andmounted on the X-axis of the cutter assembly.(vi). Two high-speed induction motors: 3ph, 230V, 3600rpm, 1.5hp. and two flexibleshafts for individually coupling induction motors to the cutter blades.(vii). Speed and position feedback sensors for the electric motors.Figure 5.4 shows the arrangement of these components into a single cutter assembly. In order to meet the position control requirements of the workcell, the followingspecifications are imposed on the X-axis and the Y-axis motors, respectively;Chapter 5. Laboratory Implementation—Hardware developmentServomotorfor PlatformPositioningOpticalEncoderOpticalEncoderServomotorFor CutterPositioningThe step response should be critically damped with no oscillations. Overall settlingtime should be better than 100 ms, while the offset error at steady state should be lessthan 0.1 mm.128Flexible ShaftInduction Motorfor Top BladePlatform CutterGuidewayInduction Motorfor Bottom BladeFigure 5.4: Cutter Assembly.X-axis (cutter position) servomotor:Time between two cutsCutting durationTime available for positioningTotal mass movedMaicimum strokePosition accuracy= 500 ms.= 300—400 ms.= 100 ms.= 9kg.= 25.4 mm.= ±0.1 mm.Chapter 5. Laboratory Implementation—Hardware development 129Table 5.1: Servomotor Parameters.Y-axis (platform position) servomotor:Time available for positioningTotal mass moved (against gravity)Maximum strokePosition accuracy= 100 ms.= 2kg.= 12.5 mm.= ±0.5 mm.In this case as well, the step response should be critically damped with no oscillations.Overall settling time should be better than 100 ms, with a negligible offset error at steadystate.5.2.4 Servomotor selectionOnce a suitable lead-screw mechanism has been selected and a proper velocity profile isassumed, the maximum torque requirements (T) of the servomotor could be calculatedusing the following formula [de Silva, 1989];T=[J+i_] + r..FR (5.1)where, the parameters are as described in column 1 of Table 5.1.Table 5.1 shows the parameter values of the particular motor/lead-screw combinationthat has been selected. In each case, the acceleration has been computed based on a triangular velocity profile and a total travel time of 100 ms is used for completion of a singleParameter X-axis Y-axisMass moved(m) 9 kg. 2 kg.Rotational Inertia(J) 1.9 x 1O kg.m2. 2.6 x iO kg.m2.Lead-Screw Pitch(r) 2.02 x iO m/rad. 1.01 x iO m/rad.Efficiency(e) 75 % 75 %Acceleration(a) 10.16 ms2. 5.08 ms2.Frictional Force(FR) negligible 2 kg.Chapter 5. Laboratory Implementation—Hardware development 130Table 5.2: Servomotor Torque Requirements.j Parameter X-axis Y-axisMax. torque(T) 2.4 Nm. 0.32 Nm.Speed(s) 2400 rpm. 2400 rpm.stroke. Substitution of these parameters in equation (5.1) yields the maximum torqueand speed requirements, as given in Table 5.2, for the the two servomotors. Comparisonof these requirements with the characteristics of the selected motors confirms that theselected motors are capable of driving the load according to the specifications.5.2.5 Drive amplifiers for the servomotorsThe two servomotors are coupled to the servomotor controller through a matching pairof amplifiers. Both amplifiers are of the PWM type, working on a primary line voltageof 115VAc and 60Hz. The governing characteristics of the amplifiers are as follows:X-axis: Output = 64VDc, 7A continuous/1OA peak, Gain = 1.0 A/V, Maximum signalinput = 1OVDc.Y-axis: Output = 32VDc, 4A continuous/5A peak, Gain 0.5 A/V, Maximum signalinput = 1OVDc.The cutter motor control is achieved through the DMC-620 two-axis programmableservomotor controller, which communicates directly with the control/communicationcomputer via a PC-AT bus. The characteristics of the DMC-620 servomotor controllerare described later in this chapter.5.3 Sensors and Associated CircuitryThe monitoring and control computer keeps an on-line record of the current status of theworkcell at all times. This information forms the context database of the workcell and itChapter 5. Laboratory Implementation—Hardware development 131comprises of such details as the conveyor speed measurements, load profile on the cutterblades, servomotor performance and visual quality of processed fish. In order to facilitatecollection of this information, the workcell is equipped at appropriate places, with varioussensing devices which feedback the status information into the control computer. Thefollowing sections describe these sensors and the related hardware.5.3.1 Secondary vision subsystemThis subsystem is responsible for the acquisition and processing of visual informationpertaining to the quality of processed fish that leave the cutting station. This subsystem,hence, functions as an intelligent sensor in providing a high level information feedbackinto the monitoring/control computer. The hardware associated with this subsystem islisted below.(i). A CCD camera at the exit-end, for grabbing images of processed fish,(ii). A GPB-1 image processing board for visual data analysis,(iii). A 486/33MHz PC as the host machine, which doubles as the monitoring/controlcomputer.The CCD camera acquires images of processed fish under the direct control of thehost computer which determines the proper instance to trigger the camera by timing theduration it takes for the cutting operation to complete. The image is then transferredto the image buffer in the GPB board for further processing. In this case, however,image processing is accomplished to extract high level information such as the quality ofprocessed fish. This requires a comparatively large processing time, for example, about1 sec. for each image. As a result, this high level processing is not carried out for eachfish on the conveyor, instead, only a representative sample is processed for each batch ofChapter 5. Laboratory Implementation—Hardware development 132Pararieter ]_X-axis Y-axisEncoder Type Incremental, Quadrature Incremental, QuadratureOutput 1000 pulses/rev 1000 pulses/rev.Counts 4000 counts/rev 4000 counts /rev.Accuracy + 1 count. + 1 count.Lead-screw 2 rev/inch 4 rev/inchfish. Extraction of high level information through image processing is discussed in detailin Chapter 4 where the hierarchical organization of information processing is considered.5.3.2 Speed and position sensorsComponents that need speed sensing are the conveyor, the servo motors and the inductionmotors that drives the cutter blades. The servo motors also need position sensing forprecision placement control. Cutting loads on the two circular blades are computedindirectly through slip measurement of the induction motors, which necessitates speedsensing on the rotors of the two induction motors. Both position and speed of theservomotors are monitored by means of incremental-type optical encoders that are anintegral part of the motor itself. The speeds of all other components of the workcell aremonitored through a two-stage signal conversion method where shaft encoders provide afrequency signal proportional to the speed of the shaft and then a frequency-to-analogue(F/A) converter stage provides a voltage signal proportional to the frequency.The specifications of the position sensing mechanism that has been implemented forthe servo motors are given in Table 5.3. Since the servomotor controller (DMC-620) hasan accuracy of ±1 quadrature count, the position resolution of the X-axis is given by,linch 1 revResolution = — x2 rev 4000 countTable 5.3: Specifications of the Servomotor Encoders.Chapter 5. Laboratory Implementation—Hardware development 133— 1 inch 25.4 mm8000 count X 1 inch= 0.003 mm/count (5.2)Similarly, the position resolution of the Y-axis servomotor is calculated to be 0.0015mm/count. It follows that both axes have a position resolution well in excess of therequired value of 0.1 mm.Figure 5.5 depicts the circuitry associated with the speed sensing mechanism of theconveyor and the induction motors. In the case of induction motors, reflective type optical object sensors are used as shaft encoders while the conveyor shaft is directly coupledto an incremental type optical encoder to provide frequency signals. Three different F/Aconverters facilitate simultaneous measurement of the three speed channels—two for theinduction motors corresponding to the top and bottom blades and one corresponding tothe conveyor. Each F/A converter is designed based on the LM2917 monolithic frequency-to-voltage converter that provides a linear operating range and a gain adjustable throughexternal components R and C of Figure 5.5(c). The parameters pertaining to the resolution of the speed measurements are given in Table 5.4. The corresponding resolutionof conveyor speed measurement is calculated as,cm lrps 1HzResolution = 45.72— x —— x x 4.88mV.rev 512 Hz 12.5mV= 0.035cm/sec. (5.3)Since the nominal speed of the conveyor is 25 cm/s the resolution as computed hereis better than 1 %. Similarly, for the induction motors we have,lrps 1 HzResolution =-— x x 4.88mV.Chapter 5. Laboratory Implementation—Hardware development 134Induction MotorShaftReflectiveSegmentsLED-PhototransistorPairPulseOutputQuadrature PulseOutput(c)Pulse Generation for Induction MotorSpeed MeasurementsPulse Generation for ConveyorSpeed MeasurementsFigure 5.5: Speed Sensing Hardware. (a) Optical Encoder for a. Cutter Blade, (b) OpticalEncoder for Measuring Conveyor Speed, (c) Circuit diagram of the Frequency-to-AnalogConverter for an Optical Encoder.(a) (b)Conveyor OpticalShaft EncoderPowerInputChapter 5. Laboratory Implementation—Hardware development 135Table 5.4: Speed Sensor Specifications._Parameter Conveyor Induction motorType Incremental encoder Optical object sensorCounts/rev. 512 8Displacement/rev. 45.7 cm/rev n/aAID conversion 12 bit 12 bitA/D output ± 10 V. + 10 V.AID resolution 4.88 mV. 4.88 mVF/A gain 12.5 mV/Hz. 12.5 mV/Hz= 0.0503 rps.= 3.02 rpm. (5.4)At the nominal speed of 3600 rpm, this represents a resolution better than 0.1 %. Alsothis translates to a 2 % resolution for load of the induction motors.Measurement of thicknessThe primary visual subsystem cannot derive information regarding the thickness of fishsince the primary CCD camera is mounted vertically, directly above the fish as theyenter the conveyor. The thickness of fish is required however, in order to adjust thevertical position of the platform, as has been described previously. This lack of thicknessinformation in the visual image is rectified by means of an ultrasonic displacement sensorthat is mounted along side the primary COD camera, which provides an analogue voltagesignal proportional to the distance from the sensor to the top surface of a fish. The readingof the ultrasonic sensor is simultaneously registered every time an image is snapped, andsince the distance from the ultrasonic sensor head to the conveyor bed is fixed and known,the height of the fish could be easily computed from this measurement. Table 5.5 liststhe relevant parameters of the ultrasonic device.Chapter 5. Laboratory Implementation—Hardware development 136Table 5.5: Parameters of the Ultrasonic Sensor.Parameter ValueType Analogue Ultrasonic Proximity sensorRange 10cm to 75cm, adjusted to 24cm to 32cm.Input Power 1030 VDc. 50 mA.Output 05 VDC.Response Speed 50 ms.Bandwidth 20 Hz.Repeat Accuracy 1 % of full scale5.4 Hardware for Interfacing and Data ProcessingSeveral modules of special purpose hardware have been integrated into the monitoringand control computer to enable communication with external hardware as well as toprovide additional processing capabilities for the host computer. These modules include,(i). GPB-1 image processing board,(ii). DMC-620 two-axis servomotor controller, and(iii). PCL-812 I/O interfacing board.All these modules are plugged into the PC/AT bus and hence, they accommodatedirect communications with the host computer. The following sections describe thesalient features of these modules that are of interest for monitoring and control purposesof the workcell.5.4.1 GPB-1 image processing systemThe CPB-1 is the hardware portion of a single-slot image processing system that can behoused in a PC/AT host computer. It interfaces to the host processor through a blockof 64 I/O addresses and provides programmability through a library of extensive imageChapter 5. Laboratory Implementation—Hardware development 137processing subroutines. Figure 5.6 schematically illustrates the internal arrangement ofthe GPB-1 board. From the view point of the user the two most important parts ofthe board are the core and the memory banks. The on-board memory is divided into 4image banks and each bank contains 3 planes, giving a total of 12 memory banks. Eachbank of memory can hold a full camera image from one color channel of either red(R),green(G), or blue(B). A special display buffer, consisting of three more memory bankscorresponding to R, 0, and B channels, facilitates the displaying of the composite image.Image processing is accomplished through the core of the GPB board, which reads animage from the memory, processes it according to the function specified in the programand then writes the result into a new memory bank. The size of each bank of imagememory is 512 columns by 512 rows (pixels) by 8 bit (grey-level resolution). At anytime, a subset of this matrix may be defined as the region of interest in order to limitthe area of an image that will be processed, thereby reducing the amount of processingtime that is consumed. The processing speed of the core is 4Ons/pixel, or equivalently,700 MIPS is achievable in image processing by the GPB board.The image source can be either one of four video (NTSC) composite signals (RS-170)from CCD cameras, or directly from the data-bus of the host. The latter method allowsthe host machine to display images that have been saved from earlier sessions, whilecamera inputs provide on-line (live) imaging capabilities. An image in a memory bankcan be moved, under software control, to a special display memory which will convertthe image into a standard VGA format for displaying on a video monitor.The workcell in our laboratory is equipped with two GPB-1 processors, one for primary image processing and the other for visual data monitoring. A dedicated VGAmonitor is attached to the secondary GPB-1 processor (Figure 5.2) such that the usercan visually supervise the images of processed fish. Capturing an image from the cameraChapter 5. Laboratory Implementation—Hardware development 138HostComputerControl BusInput MemorytizeSync. DetectorFigure 5.6: Functional Block Diagram of the GPB-1 Image Processing Board.-4Data BusVRGBMemory Bank 1Memory Bank 2Memory Bank 3Memory Bank 4Mask PlaneMemoryMemoryMemorySync.GenerationCCD CameraChapter 5. Laboratory Implementation—Hardware development 139Figure 5.7: Control Loop Implementation Using the DMC-620 Controller.takes about 33ms. and the ensuing processing time depends on the required degree of image understanding. In the case of quality evaluation through vision, the captured imageundergoes smoothing, thresholding, filtering, and labeling before some useful informationon the quality is extracted. These image processing operations and further preprocessing,as described in Chapter 4, takes close to 1 second. At the present level of development,a cycle time in the order of few seconds is considered adequate for monitoring purposessince any improvement to this figure is likely to increase the cost of additional processingpower and hence can make the workcell economically unattractive.5.4.2 DMC-620 two-axis servomotor controllerThe DMC-620 is a PC-bus compatible digital controller card for servomotors, whichutilizes an encoder for both position and velocity feedback. A basic digital control loop,a command interpreter, and a communication interface are combined into this card.Figure 5.7 shows the basic control components implemented in each of the two controlloops of the DMC-620.RTLChapter 5. Laboratory Implementation—Hardware development 140The digital compensator has the discrete (Z-transform) transfer function,D(z) = K::; + z-l (5.5)and FA in Figure 5.7 is a simple feedforward gain which boosts the output to the motorby an amount proportional to the commanded acceleration. Both transfer functions D(z)and F(z) are fully programmable in the sense that all the characteristic parameters K,p, q, K, and FA are adjustable on the fly, through the PC-bus communication interface.Similarly, the torque limit block (TL) in Figure 5.7 has an adjustable deadband and asaturation limit.The DMC-620 controller can operate in various modes of servo-motion includingindependent, profiled positioning of each axis, incremental positioning (commands areinterpreted with respect to the current position), jogging (constant speed operation),and coordinated motion of two axes (synchronized operation of the two axes). For theworkcell operation, independent profiled motion of the two servomotors is used. In thismode, the acceleration (AC), the slew speed (SP) and the end position (absolute—PA orrelative—PR) for each axis are specified in advance. With a motion command of begin(BG), the controller generates a trapezoidal or triangular velocity profile and a positiontrajectory. A new position output is generated every 1 ms. The motion is deemedcomplete when the target position has been reached by the controller.Communication between the DMC-620 and the host PC is in the form of ASCIIcharacters, where data are sent and received via READ and WRITE registers of thecontroller card, which map into the I/O space of the host computer. A C-languagecallable high level library of subroutines has been developed for the purpose of presentapplication, particularly, to handle the communication between the controller and theworkcell. The commands that are required to position the cutter servo and the platformservo are collected into a single program file (See appendix B) and down loaded into theChapter 5. Laboratory Implementation—Hardware development 141DMC-620 in the beginning of the workcell operation. During each cycle of operation,this program reads the position commands that are sent to it from the primary imageprocessing subsystem and then converts them to the respective DMC position commands.Once the position commands are issued, the program jumps back to the starting addressand waits for the next command from the primary imaging subsystem.Simultaneously to the motion of the servomotors, the monitoring and control computer keeps track of the position response of the two motors through its own communication interface to the controller. This computer also intervenes with the compensatortransfer function in order to update or tune the parameters of the compensator if suchan action has been demanded by the knowledge-based control system. Such high leveldecision making procedure has been described in Chapter I/O interfacing board PCL-812The PCL-812 is a high speed, multi-function data acquisition card for PC/AT compatiblecomputers. The principal features of interest are its 12-bit successive approximation A/Dconverter with a maximum sampling rate of 30 kHz, two 12-bit D/A output channels, and16 TTL compatible digital input and 16 digital output channels. Also a programmabletimer/counter enables precise trigger control for A/D data conversion. Two such dataacquisition cards serve the workcell, one for the primary image processing subsystem andanother for the control/monitoring subsystem.The cutting locations as determined by the primary image processing are communicated to the control computer via the digital output ports of one of the I/O cards.The hand-shaking mechanism for this data transfer (Send, Receive, and Acknowledgefunctions) is automatically handled by the program that is down loaded to the DMC-620controller (See Appendix B for details). The analogue output of the ultrasonic sensoris also read by means of the A/D ports of the same I/O card in the primary imagingChapter 5. Laboratory Implementation—Hardware development 142subsystem.The analogue inputs corresponding to the three speed signals from the conveyor, andthe top and bottom blades of the cutter are digitized by means of the ADC at a rate of 30kHz, through the I/O card in the monitoring computer. Each sample of the blade speedcomprises of the average of 100 readings and for the conveyor 20 readings are averagedfor each sample. The averaging process is particularly important since it smoothes outripples in the analogue signals that are inherently present in the output of a frequency toanalogue converter. At this rate of conversion, a sampling frequency of 100 Hz is easilyachieved for all three speed channels.The analogue output that drives the conveyor motor is derived through the D/Aconverter of the PCL-812. A 12-bit D/A conversion to a maximum of 1OVDc yields aresolution of 4.8mV, which is quite adequate for the control of the conveyor motor.5.5 Integrated Hardware ConfigurationThe hardware configuration of the overall system with all peripheral devices integratedinto a single workcell, is shown in Figure 5.8. Altogether two 486 PCs are dedicated tothe computations associated with the workcell in addition to the several special-purposeprocessors that are linked to the system buses. This configuration can comfortably deliverthe expected performance of 2 fish/s throughput rate, with a cutting position accuracyof 1.0 mm and acceptable product quality, as determined by the knowledge-based assessment system, at an overall cost of about $25,000 for the control system hardware.Chapter 5. Laboratory Implementation—Hardware development 143AT-Bus AT-BusMonitoring/Control Station Primary Vision StationFigure 5.8: Hardware Configuration of the Overall Control System of the Workcell.PC486/33MHzChapter 6A Case Study of System PerformanceIn this chapter, a case study of system performance, obtained by experiments carried outon the fish processing workcell, is presented. The effect of data preprocessing on differentchannels of input streams is illustrated. Inferences obtained and the actions taken bythe knowledge base for different cases of workcell context are also given. Specifically,the performance of the knowledge base under different conditions, such as servomotorresponses of cutter and platform, cutter load profiles, and visual data from the inspection(secondary) camera, is presented. The result obtained in each case is discussed.6.1 Tuning of ServomotorsThis section presents a case study of performance of the rulebase for servomotor tuning (Table 4.6) that has been implemented in the prototype workcell as described inSection 4.4.Several test runs were carried out on the cutter servomotor in order to investigatethe behavior of the rulebase for servomotor tuning. A series of step inputs of magnitude4000 encoder pulses was applied to the cutter servomotor, and the response was preprocessed to obtain the context database. Then, using this information as the contextfor the rulebase, a new set of parameters for the lead compensator (see equation 4.23)was inferred. These parameters were then converted to their digital equivalent and thecorresponding parameters of the servomotor controller DMC-620 were updated to reflectthe new values. This procedure was repeated for each test input.144Chapter 6. A Case Study of System Performance 145Table 6.1: Context for Servomotor Responses in Figure 6.1. UN- Response is unsatisfactory, PR - Poor, MD - Moderate, IS - Within Specification, OS - Over Specification.Performance Context DatabaseParameter (a) (b) (c) (d) (e) (f)Rise Time UN IS IS IS IS ISDamping Ratio UN MD IS OS IS ISDamped Natural Frequency UN MD IS IS OS OSOvershoot OS UN MD OS OS OSOffset UN MD OS OS OS OSTable 6.2: Inferences of the Rulebase for Servomotor Tuning for Responses in Figure 6.1.Controller Z-domain ValueParameter (a) (b) (c) (d) (e) ] (f)Gain 0.413 1.666 8.678 13.605 18.482 19.551Pole -0.7950 -0.5675 -0.7950 -0.8232 -0.8485 -0.8485Zero 0.9783 0.9483 0.9783 0.9830 0.9844 0.9844Initially overdamped system: Figures 6.1(a) through (f) show six consecutive responses of the cutter servomotor for a series of step inputs of magnitude 4000 encoderpulses, while on-line tuning procedure as outlined in the preceding paragraph is active.For this test, the initial controller parameters have been selected such that the cutter servomotor exhibits an overdamped response in the beginning. Table 6.1 shows the context,generated by the preprocessor for the servomotor response. The columns (a) through (f)of Table 6.1 lists the context generated for the responses in Figures 6.1(a) through (f),respectively.Table 6.2 shows the controller parameters inferred by the rulebase for the responsecurves shown in Figure 6.1. The values listed have been already converted to Z-domain.Initially underdamped system: Figures 6.2(a) through (f) show six consecutive responses of the cutter servomotor for a series of step inputs of magnitude 4000 encoderpulses. For this test, the initial controller parameters have been selected such that theChapter 6. A Case Study of System Performance5000146____(a)____ ____600(.5000____(b)_____________600C0 50 100 150 200 250 30Time(ms)(d)“0 50 100 150 200 250 300Time(ms)(c)50001)Da30008CLii 200010004quu300O.: z.:z:z0 50 100 150 200 250 31Time(ms)(e)600C50001) 50 100 150 200 250 3Time(ms)0(f).t,,wuaa53000Lii 200010001.5000400G3000W 20001000/“0 50 100 150 200 250 300Time(ms)Figure 6.1: Performance of the Rulebase forSystem.“0 50 100 150 200 250 300Time(ms)Servomotor Tuning—Initially OverdampedChapter 6. A Case Study of System Performance 147Table 6.3: Context for Servomotor Responses in Figure 6.2. UN - Response is unsatisfactory, PR - Poor, MD - Moderate, IS - Within Specification, OS - Over Specification.Performance Context DatabaseParameter (a) (b) (c) (d) LL 1Rise Time OS IS OS ISDamping Ratio PR PR MD MD IS ISDamped Natural Frequency IS MD IS IS IS ISOvershoot UN UN UN UN UN ISOffset OS OS OS OS OS OSController Z-domain ValueParameter (a) (b) j (c) (d) (e) (f)Gain 3.0939 4.3373 5.8941 8.2921 12.306 19.985Pole 0.1298 0.0388 -0.0494 -0.1523 -0.2747 -0.4234Zero 0.7750 0.8094 0.8380 0.8666 0.8954 0.9245platform servomotor exhibits an underdamped response in the beginning. Table 6.3 showsthe context, generated by the preprocessor for the servomotor response. As for the previous case, Table 6.3 lists the context generated for the responses in Figures 6.2(a) through(f), respectively. Similarly, Table 6.4 shows the controller parameters (in Z-domain)inferred by the rulebase for the response curves shown in Figure 6.2.Discussion: The performance of the rulebase for servomotor tuning, as illustrated inFigures 6.1 and 6.2, is quite satisfactory for the purpose of the present workcell. Therulebase managed to bring the servomotor response to comply with the specificationswithin about 5 to 6 cycles of tuning. It should be noted that, for the purpose of aboveexperiments, the initial controller parameters were set significantly off their normal operating values. In practice, however, perfect tuning is achieved much faster since operatingconditions usually do not change too far off their normal values.Table 6.4: Inferences of the Rulebase for Servomotor Tuning for Responses in Figure 6.2.Chapter 6. A Case Study of System Performance 148500040003O00W 20001000(a)100 150 20 250 3(Time(ms)(c)50004000030008CW 20001000____(b)50 1 0 150 200 250 3(Time(ms)(d)bUUL:: . ...5000/ “—7D3000W2000100050 100 150 200 250 3(Timems)(e)U)a.30008CLU 200010000j..........::..............50 100 150 200 250 300Time(ms)(f)5000z03000W 20001000OUVL,5000Ar,nr‘tv.JvU)Da3000LU 20001000.1“0 50 100 150 200 250 300 “0 50 100 150 200 250Time(ms) Time(ms)Figure 6.2: Performance of the Rulebase for Servomotor Tuning—Initially UnderdampedSystem.Chapter 6. A Case Study of System Performance 149The performance shown in Figures 6.1 and 6.2 was obtained for the cutter servo-motor (X-axis) that has been installed in the prototype workcell. This servomotor ischaracterized by a very high inertia load, arising due to the mass of the cutter assemblyattached to the lead-screw, and a small amount of damping. Also, there is a perturbationload acting on the servomotor due to the flexible shafts of the induction motors that areattached to the cutter assembly (see Figure 5.4). Furthermore, this perturbation loadvaries in magnitude with the movement of the servomotor.A rulebase, identical to the one for X-axis, carries out tuning on the platform (Y-axis)servomotor in the present workcell. Experiments conducted on the Y-axis servomotorhave shown that the performance is very much similar to those shown in Figures 6.1 and6.2. In this case, however, perfect tuning is achieved in fewer number of cycles since theY-axis servomotor consists of a much smaller inertia load.6.2 Performance of Rulebase for Workcell TuningThis section presents a case study of performance of the rulebase for workcell tuning (Table 4.8) that has been implemented in the prototype workcell as described in Section 4.4.First, several cutter load profiles were obtained through experimentation. Then, by theuse of cutter-load preprocessor, a context database, corresponding to each load profile,was generated. The rulebase for workcell tuning was next used to obtain the inferencespertaining to the conveyor speed and hold-down force.Figures 6.3(a) through (d) show four cutter load profiles corresponding to experimental fish cutting operations carried out on the fish processing workcell in our Laboratory.Each plot in Figure 6.3 has been obtained under different operating conditions of holdingforce and conveyor speed, as indicated in the title accompanying each of them. Thenumerical parameters resulting from the preprocessing of these cutter load profiles areChapter 6. A Case Study of System Performance 150Load Mean Load Asymmetry JrY Peak(%)/Time(s) JJ9I Peak(%)/Time(s)Profile % % Top Bottom Top Bottom(a) 118 47 146/0.58 91/0.67 33/1.22 None(b) 149 22 166/0.44 133/0.48 71/1.85 None(c) 55 11 58/0.70 52/0.70 None 32/1.93(d) 65 7.6 63/0.72 68/0.78 62/0.79 Noneshown in Table 6.5. The corresponding fuzzy linguistic context generated by the cutter-load preprocessor is shown in Figures 6.4(a) through (d).The rulebase for workcell tuning has two fuzzy inferences; namely, the change ofconveyor speed and the magnitude of hold-down (grasping) force. Figure 6.5(a) through(d) illustrate the corresponding inferences when this rulebase operates on the contextshown in Figure 6.4.Discussion: In this section, the performance of the rulebase for workcell tuning wasinvestigated with respect to four different cases of cutter load profiles.Figure 6.3(a) shows a case where the conveyor speed is higher than normal, as canbe gauged from the higher than normal peak load. Also, in this case, it is obvious thatthe fish has been fed asymmetrically into the cutter since the peak loads correspondingto the top and bottom load profiles do not match in magnitude. Also note that thetwo peak values do not occur simultaneously because of the slight offset that has beenprovided in the placement of the two circular blades such that the two blades can overlapeach other so as to make a complete cut. The load profile of the top blade (solid curve)also shows a slight degree of slipping as can be seen from the higher than normal trailingpart of the cutting region of the load profile. The fuzzy linguistic context obtained afterpreprocessing the load profile confirms those visual observations as can be seen fromFigure 6.4(a). The inferences corresponding to this context, shown in Figure 6.5(a),Table 6.5: Numerical Parameters Resulting from Preprocessing Cutter Load Profiles.Chapter 6. A Case Study of System Performance 151Figure 6.3: Cutter Load Profiles (Solid Curve - Load on Top Blade, Dashed Curve - Loadon Bottom Blade).20015011005010; (a) Asymmetric Load / High Speed2 04 06 08 112 14 16 18150jIOO502200: (b) Poor Holding! very High Speed00200O8iU0 0.2 0.4 0.6 0.8122122 I .. 1 (c) Poor holding! Moderate Speed13’ 80112 14 16 18 2(d) Satisfactory Cut! Moderate Speed1E))”Time (sec.)Chapter 6. A Case Study of System Performance 152SM MD LG LG SM MD LG4080120 0 102540 05(b)SM MD LG SM MD LG0 4080120 0 102540 0 1(c)MembershipGradeSM MD LG j SM MD LG SM MD LG10 4080120 0 2540 0 135(d)MembershipGrade1.0Cutter Load (Percentage) Cut Asymmetry (Percentage) Composite SlipFigure 6.4: Fuzzy Linguistic Context for Cutter Load Profiles. SM- Small, MD- Moderate, LG - Large.(a)MembershipGradebershipradeMenC1.00SM MDSM MD LG0MD LG MD LG0 40 80 120 0 10 25 40 0 1 3 5Chapter 6. A Case Study of System Performance 153Membership(a) Grade_______PL+11•0Membership MembershipGrade Grade_____1______MembershipGradeModerate(b)0 2MembershipGrade1.0Membership(c) GradeNL Soft Moderate Ti ht0.3 0.6 +1 0 2Membership Membership(d) Grade GradePS PL 1.0‘N1 0Change of Conveyor Speed Hold-down Force8Figure 6.5: Fuzzy Linguistic Inferences of the Rulebase for Workcell Tuning.Chapter 6. A Case Study of System Performance 154suggest to reduce the speed and to increase the hold-down force moderately. Theseinferences comply with the expected behavior of the rulebase for workcell tuning.Figures 6.3(b) and (c) illustrate two cases where slipping occurs towards the tail end ofthe cutter load profiles. Here, again, the fuzzy linguistic context shown in Figures 6.4(b)and (c) captures these information as expected. Consequently, the rulebase suggests tightholding and a reduced speed, as can be seen from Figures 6.5(b) and (c).Figure 6.3(d) shows a satisfactory cut at a moderate conveyor speed. It is importantto note, in this case, that the two closely placed peaks visible on the load profile of thetop blade are not interpreted by the preprocessor to indicate slipping, as the case shouldbe. The corresponding inferences suggest a soft holding force and a slight increase inconveyor speed—to take into account the fact that the capacity of cutter motor is underutilized in this particular case.6.3 Performance of Rulebase for Assessment of Product QualityThis section presents a case study of performance of the rulebase for assessment of product quality (Table 4.7). This rulebase employs the information obtained from the secondary (inspection) CCD camera to derive an inference pertaining to the visual qualityof the processed fish. The implementation of this rulebase in the prototype workcell wasdescribed in Section 4.4.Figure 6.6(a) shows an image of a processed fish where the product quality is acceptable, while Figure 6.6(b) illustrates a case where the product quality is not very acceptable. Figures 6.7(a) and (b) show the arc-length profiles obtained through preliminaryprocessing of the raw images in Figures 6.6(a) and (b), respectively. After preprocessingthe arc-length profile of each image separately, we get the quality indicative indices (seeSection 4.3.1) listed in Table 6.6, and the corresponding fuzzy linguistic context shownChapter 6. A Case Study of System Performance 155Figure 6.6: Raw Images of Processed Fish As Captured by the Secondary CCD Figure 6.8.The inference of the rulebase for the assessment of product quality is a membershipfunction expressed in terms of three primary fuzzy sets of Poor, Moderate, and Good.The product quality, as assessed by the rulebase, for the two images of fish in Figure 6.6is shown in Figures 6.9(a) and (b), respectively.Discussion: In this section, the performance of the rulebase for the assessment ofproduct quality was investigated with respect to two different images of processed fish.Figure 6.6(a) is an image of a processed fish with a clearly visible cut section. Thedepth and the breadth of the cut section are comparatively large and the surface near thecutting region is smooth. Also, the cut is readily discernible from the body of the fish bya smooth contour. Consequently, this cut is assessed as of good quality. PreprocessingTable 66: Quality Indicative Indices for the Images of Fish in Figure 6.6.Parameter Image (a) Image (b)Depth of Solid Cut Section 0.6387 0.3834Smoothness of Cut Contour 0.6977 0.5501Smoothness of Cut Surface 0.7300 0.4500(a) (b)Chapter 6. A Case Study of System Performance 156Ca,‘C0.480(a) (b)Figure 6.7: Arc-Length Profiles of the Processed Fish Images in Figure 6.6.(a)MembershipGradePR MD GD0.50 0.4(b)MembershipGrade0.4 0.5MDGDDepth of Solid Cut Smoothness of Cut Contour Smoothness of Cut SurfaceFigure 6.8: Fuzzy Linguistic Context for the Images of Processed Fish in Figure 6.6. PR- Poor, MD - Moderate, GD - Good.PR0.6 0 0.4 0.5 0.6GD./ ///0 0.4 0.5 0.6MD GD0.6 0 0.4 0.5 0.6Chapter 6. A Case Study of System Performance 157(a) (b)MembershipGrde1.0 Moderate 1.0 Poor ModerateGood0Product Quality Product QualityFigure 6.9: Fuzzy Linguistic Inference of Quality of Product for Images in Figure 6.6.of the image in Figure 6.6(a) returns the fuzzy linguistic context shown in Figure 6.8(a),which clearly agrees with the visual observations mentioned before. Running the rulebasefor the assessment of product quality over this context returns a fuzzy linguistic value ofGood, as shown in Figure 6.9(a), which complies well with the expected outcome.Figure 6.6(b) illustrates a cut which has a comparatively small cut section, as canbe gauged from the poor depth of the cut. Also, the cutting region is not as smoothas in the previous case. As a result, this cut exemplifies a product of somewhat poorquality. The context corresponding to this image, shown in Figure 6.8(b), confirms theseobservations. Consequently, the rulebase returns a fuzzy linguistic value close to Poor,as shown in Figure 6.9(b), which is an agreeable outcome for this particular case.Chapter 7Conclusion and Future Work7.1 ConclusionThis thesis investigated a methodology to bridge the two approaches of system analysis;namely, hierarchical systems theory and fuzzy systems theory, for the specific purpose ofindustrial procçss automation. This approach is particularly suitable when the plant tobe controlled is complex, incompletely known, and difficult to model either analyticallyor experimentally. It was argued that rather than being competitive, those two methodsof system analysis are complementary to each other and that they could be implementedconcurrently to improve the quality and efficiency of a real world industrial plant. Aparticular model was developed such that the fuzzy system analysis could be incorporated into a hierarchical system. Also, this model is general enough to be useful in manyindustrial process automation applications. Hierarchical fuzzy systems were shown tobe characterized by several heuristic features such as information resolution, fuzziness ofinformation, and data processing intelligence. Some preliminary relationships betweenthese parameters were also explored. The degree of fuzziness was considered as a primary means of classifying information and knowledge for various levels in the hierarchy.In particular, the concept of fuzzy resolution was employed for the representation ofknowledge.The practical goal of the current research was to apply the theory developed in thisthesis to the particular case of industrial automation of fish processing. Industrial fish158Chapter 7. Conclusion and Future Work 159processing is a typical example for a process where feedback information involves complexdata processing, and also, analytical modeling of the plant is difficult. Integration ofcomputer vision, knowledge-based techniques, and robotic servo manipulators into thefish processing workcell was accomplished through the use of information preprocessors,in the context of the generalized hierarchical fuzzy system. Based on the results of sometrials conducted on the prototype fish processing workcell which has been developed inour laboratory, the following conclusions were made.i. Overall yield (recovery rate) of fish processing could be increased by about 2-3%by using computer vision for accurate positioning of the cutter. This translatesinto an annual saving of about $10 million to 15 million, for the industry in BritishColumbia.ii. It is possible to achieve the industry standard throughput of 2 fish/sec. in anautomated fish processing workcell even when time for image processing is takeninto account.iii. On-line monitoring and control of the overall system could be accomplished by theextensive use of knowledge-based techniques in a fuzzy logical context, and therebyreducing the degree of complexity of processing low-level data.iv. The methodology developed in the present research is general enough to be useful inmany other applications of industrial automation, where a process plant is complexand difficult to model, yet, expert knowledge is available as to the proper operationof the plant.Chapter 7. Conclusion and Future Work 1607.2 Significance of the WorkMost applications in industrial process automation require feedback information, typically, from a large number of sensory devices. Processing and integration of such sensory information have always been the subject of much research work. The generalizedhierarchical fuzzy system proposed in this thesis makes integration of sensory information relatively easy. It also makes the context, generated by the sensory information,amenable for further intelligent processing—a requirement that is quite important in process automation.Fish processing industry in particular, will benefit from the present research throughthe increased efficiency, adaptability, and autonomy provided in the new automatedworkcell for fish processing. Also, the capability of the new workcell to incorporatehuman expertise into its knowledge base will enhance the usefulness of the new automatedsystem.It should be noted that although fuzzy logic itself does not provide a control strategyin the conventional sense, most of the present day applications use fuzzy logic in place ofthe conventional controller in the control loop. The success of those controllers could beattributed to the ability of fuzzy logic to capture the knowledge of human experts andconvert it into an effective control law. Fuzzy logic can incorporate a multitude of sensorinformation into its knowledge base relatively easily since an FLC compromises precisionfor the simplicity of control algorithm.7.3 LimitationsApplication of fuzzy logic in the capacity of supervisory control is relatively scarce inthe literature. As the present thesis argues, fuzzy logic would be able to perform animportant role in this capacity too, because fuzzy logic is primarily a tool of knowledgeChapter 7. Conclusion and Future Work 161engineering, whatever way it is used either in direct control or hierarchical control.The development of the knowledge base for the fish processing workcell was hamperedby the lack of facilities for batch processing of fish in the laboratory. Most test runs werecarried out on the basis of a single cut at a time. This made it difficult to investigatethe effects of rulebase coupling where context information and the inferences are sharedbetween the rulebase modules.7.4 Future WorkMuch work remains to be done to achieve a more comprehensive theory of hierarchicalfuzzy systems. Specifically, the effect of fuzzy resolution on knowledge representation andthe usefulness of fuzzification as a tool of data abstraction have to be examined muchmore rigorously.The present work was completed exclusively within a laboratory environment. Development of the prototype workcell, implementation of hardware and software, and testingwere carried out during a period of about four years. Before transferring the technologyto a fish processing plant, however, much more rigorous testing have to be carried out.Since the workcell is supposed to be operated by shop floor assistants, rather than computer experts, it is important that software is robust and stable. Although robustness ofuser interface has been greatly increased by selectively enabling only the required keysof the keyboard, the stability of software could be tested only by passing the systemthrough a series of batch processing sessions.The workcell currently uses a fixed knowledge base. Any modification or addition tothe rulebase has to be accomplished by re-compiling the knowledge-base module of thesoftware package. A better approach would be to implement a programmable interfaceto the rulebase so that the user could modify the rules on-the-fly.Chapter 7. Conclusion and Future Work 162Extending the present rulebase by adding a self-learning module would be an important improvement to the prototype fish processing workcell. Such a system will greatlysimplify the process of fine tuning of an existing rulebase.Bibliography[1] Albus, J. S., McLean, C., Barbera, A., and Fitzgerald, M., (1982). An Architecturefor Real Time Sensory-Interactive Control of Robots in a Manufacturing Environment. Proc. .4th IFAC/IFIP Symp. on Information Control Problems in Manufacturing Environment, Gaithersburg, MID, October 1982.[2] Anderson, T. R. and Nielson, S. B., (1985). An Efficient Single Output Fuzzy ControlAlgorithm for Adaptive Applications. Automatica, Vol. 21, No. 5, pp. 539-545.[3] Appelbaum, L. and Ruspini, E. H., (1985). ARIES : An Approximate ReasoningInference Engine. Approximate reasoning in expert systems. eds: Gupta M., KandelA., Bendler W., and Kiszka J. B., North-Holland, pp. 745-765.[4] Assilian, S., (1974). Artificial Intelligence in the Control of Real Dynamic Systems.PhD thesis, Queen Mary College, University of London.[5] Baas, S. M. and Kwakernaak, H., (1977) Rating and Ranking of Multiple-AspectAlternatives Using Fuzzy Logic. Automatica, Vol. 13, pp. 47-58.[6] Baldwin, J. F., (1980). An Automated Fuzzy Reasoning Algorithm. Fuzzy sets andpossibility theory, pp. 169-195.[7] Benlahcen, D. and Lamotte, M., (1981). A Fuzzy Automation Synthesis Method.Automatica, Vol. 17, No. 2, pp. 297-306.[8] Braae, M. and Rutherford, D. A., (1979). Theoretical and Linguistic Aspects of theFuzzy Logic Controller. Automatica, Vol. 15, pp. 553-577.[9] Burdzy, K. and Kiszka, J. B., (1983). The Reproducibility Property of Fuzzy ControlSystems. Fuzzy sets and systems, Vol. 9, pp. 161-171.[10] Carter, G. A. and Hague, M. J., (1973). Fuzzy Control of Raw Mix Permeabilityat A Sinter Plant. Discrete systems and fuzzy reasoning, eds: Mamdani E. H. andGains B. R., Queen Mary College, University of London, Workshop proceedings.[11] Czogala, E. and Pedrycz, W., (1981). Some Problems Concerning the Constructionof Algorithms of Decision Making in Fuzzy Systems. mt. j. man mach. studies, Vol.15, pp. 201-221.163Bibliography 164[12] Czogala, E. and Pedrycz, W., (1981). On Identification in Fuzzy Systems and ItsApplications in Control Problems. Fuzzy sets and systems, Vol. 6, pp. 73-83.[131 Czogala, E. and Pedrycz, W., (1982). Control Problems in Fuzzy Systems. FuzzySets and Systems, Vol. 7, pp. 257-273.[14] Czogala, E., (1983). A Generalized Concept of A Fuzzy Probabilistic Controller.Fuzzy sets and systems, Vol. 11, pp. 287-297.[15] Czogala, E. and Pedrycz, W., (1983). On the Concept of Fuzzy Probabilistic Controllers. Fuzzy sets and systems, Vol. 10, pp. 109-121.[16] De Luca, A. and Termini, S., (1972). A definition of a non-probabilistic entropy inthe setting of fuzzy sets theory. Information and Control, No. 20, pp. 301-312.[17] De Silva, C. W. and MacFarlane, A. G. J., (1988). Knowledge-based Control Structure for Robotic Manipulators. Proc. IFAC Workshop on Al in Real-Time Control,Swansea, U.K.[18] De Silva, C. W., (1989). Control Sensors and Actuators, Prentice Hall, EnglewoodCliffs, NJ.[19] De Silva, C. W. and MacFarlane, A. G. J., (1989). Knowledge-based Control withApplication to Robots, Springer-Verlag, Berlin.[20] De Silva, C. W., (1990). Research Laboratory for Fish Processing Automation.Robotics and Manufacturing, Vol 3, ASME Press, New York, pp 935-940.[21] De Silva, C. W., (1991a). An Analytical Framework for Knowledge-Based Tuning ofA Servo Controller. Engineering applications in artificial intelligence, Vol. 4, No. 3,pp. 177-189.[22] De Silva, C. W., (1991b). Fuzzy Information and Degree of Resolution Within theContext of A Control Hierarchy. Proc. IECON’91, Kobe, Japan, pp. 1590-1595.[23] De Silva, C. W. and Wickramarachchi, N., (1992a). Use of Intelligent Tuning ina Hierarchical Control System for Automated Fish Processing. Proc. IFAC Symp.A CASF, Grenoble, France, pp. 139-144 (Invitation).[24] De Silva, C. W. and Wickramarachchi, N., (1992b). Knowledge-Based Developmentfor An Intelligent Control System of A Process Workcell. Intelligent Control Systems,DSC-Vol. 45, ASME, New York, pp. 113-119.[25] Dc Silva, C. W., (1993). Knowledge Base Decoupling in Fuzzy Logic Control Systems. Proc. American Control Conference, San Francisco, California, Vol. 1, pp760-764.Bibliography 165[26] De Silva, C. W., (1993). Hierarchical Processing of Information in Fuzzy Logic Control Applications. Proc. 2nd IEEE Conf. on Control Applications, Vancouver, B.C.,Vol. 1, pp 457-461.[27] De Silva, C. W., (1995). Intelligent Control: Fuzzy Logic Applications, CRC Press,Boca Raton, FL.[28] Di Nola, A., Pedrycz, W., and Sessa, S., (1985). Fuzzy Relation Equations andAlgorithms of Inference Mechanism in Expert Systems. Approximate reasoning inexpert systems, eds: Gupta M., Kandel A., Bendler W., and Kiszka J. B., North-Holland, pp. 355-367.[29] Dubois, D. and Prade, H., (1980). Fuzzy Sets and Systems, Academic Press.[30] Findeisen, W., Bailey, F. N., Brdys, M., Malinowsky, K., Tatjewski, K., and Wozniak, A., (1982). Control and Coordination in Hierarchical Systems. John Wiley &Sons, New York.[31] Gains, B. R., (1976). Fuzzy Reasoning and the Logics of Uncertainty. IEEE Proc.6 mt. Symp. multiple-valued logic, pp. 179-188.[32] Gains, B. R., (1977). Foundation of Fuzzy Reasoning. Fuzzy automata and decisionprocess, eds: Guptha M., Saridis N., and Gains R., North-Holland, pp. 19-75.[33] Gains, B. R. and Cohout, L. J., (1977). The Fuzzy Decade : A Bibliography ofFuzzy Systems and Closely Related Topics. Fuzzy automata and decision process,eds: Gupta M., Saridis, and Gains R., North-Holland, pp. 403-490.[34] Goguen, J. A., (1975). On Fuzzy Robot Planing. Fuzzy sets and their application tocognitive and decision process, eds: Zadeh L. A., Fu K. S., Tanaka K. and ShimuraM., Academic Press, New York, pp. 429-447.[35] Hajjaji, A. E., and Rachid, A., (1994). Explicit Formulas for Fuzzy Controllers.Fuzzy Sets and Systems, Vol. 62, pp. 135-141.[36] Hirota, K. and Pedrycz, W., (1983). Analysis and Synthesis of Fuzzy Systems bythe Use of Probabilistic Sets. Fuzzy sets and systems, Vol. 10, pp. 1-13.[37] Hirota, K., Arai, Y., and Pedrycz, W., (1985). Robot Control Based in Membershipand Vagueness. Approximate reasoning in expert systems, eds: Gupta M., KandelA., Bendler W., and Kiszka J. B., North-Holland, pp. 621-635.[38] Huang, L. J. and Tomizuka, M., (1990). A Self-Paced Fuzzy Tracking Controller forTwo Dimensional Motion Control. IEEE trans. syst. man and cybern., Vol. 20, No.5, pp. 1115-1123.Bibliography 166[39] Isik, C. and Mystel, A., (1986). Decision Making at A Level of A Hierarchical Controlfor Unmanned Robot. Proc. IEEE mt. conf robotics and automation, Vol. 3, pp.1772-1778.[40] Kasai, Y., and Morimoto, Y., (1988). Electronically Controlled Continuously Variable Transmission. Proc. mt. Congress on Transportation Electronics, Dearborn, MI,USA.[41] Kaufmann, A., (1975). Introduction to the Theory of Fuzzy Subsets. Academic Press,New York.[42] Kickert, W. J. M. and Van Nauta Lemke, H. R., (1976). Application of A FuzzyController in A Warm Water Plant. Automatica, Vol. 12, pp. 301-308.[43] Kiszka, J. B., Gupta, M., and Nikiforuk, P. N., (1985). Some Properties of ExpertControl Systems. Approximate reasoning in expert systems, eds: Gupta M., KandelA., Bendler W., and Kiszka J. B., North-Holland, pp. 283-306.[44] Kloeden, P. E., (1982). Fuzzy Dynamical Systems. Fuzzy sets and systems, Vol. 7,pp. 275-296.[45] Kwakernaak, H., (1979). An Algorithm for Rating Multiple-Aspect AlternativesUsing Fuzzy Logic. Automatica, Vol. 15, pp. 615-616.[46] Lee, C. C., (1990). Fuzzy Logic in Control Systems: Part I. IEEE Trans. syst. manand cybern., Vol. 20, No. 2, pp. 404-425.[47] Lee, C. C., (1990). Fuzzy Logic in Control Systems: Part II. IEEE Trans. syst. manand cybern., Vol. 20, No. 2, pp. 426-435.[48] Mamdani, E. H., (1974). Application of Fuzzy Algorithms for Control of SimpleDynamic Plant. Proc. lEE, 121, pp. 1585-1588.[49) Mamdani, E. H. and Assilian, 5., (1975). An Experiment in Linguistic Synthesiswith a Fuzzy Logic Controller. hit. J. man machine studies, 7, pp. 1-13.[50] Mandic, N. J., Scharf, E. M. and Mamdani, E. H., (1985). Practical Application ofA Heuristic Fuzzy Rule-Based Controller to the Dynamic control of A Robot Arm.lEE Proc., Vol. 132, Pt. D, No. 4, July, pp. 190-203.[51] Mesarovic, M. D., Macho, D. and Takahara, Y., (1970). Theory of HierarchicalMultilevel Systems. Academic Press, New York.[52] Mystel, A., (1988). Intelligent Control in Robotics. Journal of robotic systems, Vol.5, No. 4, pp. 269-308.Bibliography 167[53] Ostergaard, J. J., (1976). Fuzzy Logic Control of A Heat Exchanger Process. No.7601, Electrical Power Engineering Dept., Technical University of Denmark, Lyngby,Jan.[54] Procyk, T. J. and Mamdani, E. H., (1979). A Linguistic Self-Organizing ProcessController, Automatica, Vol. 15, pp. 15-30.[55] Raman, B. and Kerre, E. E., (1985). Application of Fuzzy Programming to ShipSteering. Approximate reasoning in expert systems, eds: Gupta, M., Kandel, A.,Bendler, W., and Kiszka, J. B., North-Holland, pp. 719-730.[56] Riahi, N. and De Silva, C. W., (1990). Fast Image Processing for the Gill PositionMeasurement in Fish, Proc. IECON’90, Pacific Grove, CA, Vol 1, pp. 476-481.[57] Rine, D. C., (1985). Some Applications of Multiple-Valued Logic and Fuzzy Logic toExpert Systems. Approximate reasoning in expert systems, eds: Gupta, M., Kandel,A., Bendler, W., and Kiszka, J. B., North-Holland, pp. 407-434.[58] Saridis, G. N., (1988). Knowledge Implementation: Structure of Intelligent ControlSystems. Journal of robotic systems, Vol. 5, No. 4, pp. 255-268.[59] Shimura, M., (1975). An Approach to Pattern Recognition and Associative MemoriesUsing Fuzzy Logic. Fuzzy sets and their application to cognitive and decision process,eds: Zadeh, L. A., Fu, K. S., Tanaka, K., and Shimura, M., Academic Press, NewYork, pp. 449-477.[60] Takagi, T. and Sugeno, M., (1985). Fuzzy Identification of Systems and Its Application to Modeling and Control. IEEE Trans. syst. man cybern., Vol. SMC-15, No.1, pp. 116-132.[61] Tong, R. M., Beck, M. B., and Latten, A., (1980). Fuzzy Control of Activated SludgeWastewater Treatment Process. Automatica, Vol. 16, pp. 659-701.[62] Wu, Q. M. and de Silva, C. W., (1993). The Effect of Fuzzy Resolution in ServoTuning. Proc. 2nd IEEE Conf. on Control Applications, Vancouver, B.C., Vol. 1, pp77-82.[63] Xu, C. W., (1989). Decoupling Fuzzy Relational Systems - An Output FeedbackApproach. IEEE trans. syst. man and cybern., Vol. 19, No. 2, pp. 414-418.[64] Yamakawa, T., (1987). Fuzzy Controller Hardware System. Proc. 2nd IFSACongress, Tokyo, Japan, July.Bibliography 168[65] Yasunobu, S., Miyamoto, S., and Ihara, H, (1983). Fuzzy Control for AutomaticTrain Operation systems. Proc. th IFAC/IFIP/IFORS mt. Congress on Control inTransportation Systems, Baden-Baden, April.[66] Yasunobu, S., and Miyamoto, S., (1985). Automatic Train Operation by PredictiveFuzzy Control. Industrial Application of Fuzzy Control, M. Sugino, Ed., Amsterdam,North-Holland, pp. 1-18.[67] Yasunobu, S., and Hasegawa, T., (1987). Predictive Fuzzy Control and its Application for Automatic Container Crane Operation System. Proc. 2nd IFSA Congress,Tokyo, Japan, July, pp. 349-352.[68] Ying, H., Siler, W. and Buckley, J. J., (1990). Fuzzy Control Theory : A NonlinearCase. Automatica, Vol. 26, pp. 513-520.[69] Zadeh, L. A., (1965). Fuzzy Sets. Information and control, No. 8, pp. 338-353.[701 Zadeh, L. A., (1968). Fuzzy Algorithm. Information and Control, No. 12, pp. 94-102.[71] Zadeh, L. A., (1971). Toward a Theory of Fuzzy Systems. Aspects of Network andSystems Theory, R. E. Kalman and N. DeClaris, Eds. New York, Holt, Rinehart andWinston, pp. 469-490.[72] Zadeh, L. A., (1972a). A Rationale for Fuzzy Control. ASME Trans. Dynam. Syst.Measure. and Control, Vol. 94, pp 3-4.[73] Zadeh, L. A., (1972b). Fuzzy Languages and Their Relation to Human Intelligence.Proc. mt. Conf. on Man and Computer, Bordeaux, France, pp 130-165.[74] Zadeh, L. A., (1973). Outline of A New Approach to the Analysis of ComplexSystems and Decision Process. IEEE Trans. syst. man and cybern., Vol. SMC-3,No. 1, Jan.[75] Zadeh, L. A., (1975). Calculus of Fuzzy Restrictions. Fuzzy sets and their applicationto cognitive and decision process, eds: Zadeh, L. A., Fu, K. S., Tanaka, K., andShimura, M., Academic Press, New York, pp. 429-447.[76] Zadeh, L. A., (1976). The Role of Fuzzy Logic in the Management of Uncertaintyin Expert Systems. Fuzzy sets and systems, Vol. 11, pp. 199-227.Appendix AUser Manual and ReferenceThis appendix provides a technical manual and a reference guide to the workcell — aninteractive on-line program for monitoring/control of the fish processing workcell thathas been developed in the Industrial Automation Laboratory. The workcell programis designed to perform control and monitoring of the automated fish processing workcellwith minimum amount of human supervision during normal operation of the machine.It also presents a user friendly menu driven man-machine interface such that an averagemachine operator in the industry could easily learn to operate the prototype workcell.The first section of the user manual is an overview of the functionality of the workcell.The next two sections list the hardware and software (files) required for the successfuloperation of the workcell program. It then explains in detail the operation of the workcellprogram from the user’s point of view. This manual also contains information concerningthe compilation and linking of the workcell program, starting from the original sourcecode. This information must be consulted before attempting to modify or improve onthe existing source code.The reference section details the different source modules and the purpose of variousfunctions contained therein. A comprehensive description of functions and data structures used in these modules is given in lieu of the source code, a complete listing of whichwould have taken a prohibitively large space.169Appendix A. User Manual and Reference 170A.1 An OverviewWorkcell is a supervisory level control program for the prototype fish processing workcellthat has been developed in the Industrial Automation Laboratory. Workcell runs onstandard DOS 5.x environment in a PC platform with VGA video support. Several otherhardware devices must be available on the ISA bus interface for the workcell to operatein its full capacity, as identified in Section A.2.At the data acquisition level, workcell constantly monitors all the signals that arereceived from the fish processing workcell. These signals include conveyor speed, speed ofthe cutter blades, servomotor positions of the cutter and platform, and CCD camera images. In addition it receives trigger signals and position information through the primaryimage processing station. The data that are acquired during every cutting operation arepreprocessed and a fuzzy database is constructed to represent the current status of themachine. Next, workcell carries out the compositional rule of inference on the basis ofthe knowledge base incorporated into it. The resulting inferences are then used to tunethe various controller parameters of the machine so that the performance is optimized.The user is provided with an easy to use interface such that all the intermediate stepsfrom data acquisition to tuning of controllers could be monitored from the console.Workcell was developed on a 33MHz 486 PC/AT computer, using additional hardware on its ISA bus interface to facilitate interaction with the external sensors. Thesource code was written in C, compiled with Microsoft C v6.0, and linked with MicrosoftSegmented Executable Linker v5.31. In addition, library routines for the external device GPB-1, supplied by the respective vendor, have been used in the process of linking.Driver libraries for the other devices such as DMC-620 and PCL-820 were implementedby the author in C source code.Appendix A. User Manual and Reference 171A.2 Interfacing HardwareIn addition to the external signal processing hardware described in Chapter 5, the following computing and interfacing devices must be supported by the host machine for theproper operation of the workcell.GPB-1: The Sharp GPB-1 image processing card interfaces with the host machinethrough a 16 bit ISA bus expansion slot. The communication is achieved by ablock of 64 I/O addresses starting at 010011. The video input is an NTSC composite signal (RS-170). It can also load an image to its memory through its businterface. The output is designed to display images on a standard VGA monitor.All image processing is done by using a 512 column by 512 row by 8 bit imagememory.DMC-620: The GAUL DMC-620 controller is a two-axis programmable servomotorcontroller card that interfaces with the host machine through a 16 bit ISA expansionslot. The communication is carried out through a two byte block at I/O address03E811. DMC-620 holds the servomotor control program in its memory and canexecute it on its own, without intervention from the host processor.PCL-812: This is a standard I/O interface card complete with several A/D and D/Achannels. It is used for receiving and sending analog and digital signals to variouscomponents of the fish processing workcell. The control port addresses start at022011 in the I/O space and continues through next 16 bytes.Workcell has been compiled with direct in-line floating point mathematics libraries,and therefore requires a 80387 compatible math-coprocessor for its floating point mathematics. In the present platform of a 486DX microprocessor, this requirement is satisfiedby its built-in math-coprocessor.Appendix A. User Manual and Reference 172A.3 FilesThe following executable and data files are necessary at run time for the proper operationof workcell program:workcell.exe- Main program executable.dmcdload.exe - DMC-620 program down-loader.workcell.gll- DMC-620 servomotor controller program..\data\fllename.dat- Data files (ASCII)..\data\filename.img- Image files (BINARY).c:\c600\source\samples\*.fon- Font files for graphics mode text.Also, the following font files are required by the workcell at run time, courb.fon,dialog.fon, helvb.fon, and tmsrb.fon. These file must be present in the default font pathas listed above.The DMC-620 program down-loader, dmcdload.exe, could be replaced with the vendorsupplied utility program talk2bus.exe, if desired. All data corresponding to some of theprevious fish processing experiments have been logged under the directory data. Thesensory data are contained in .dat files in ASCII format, while the corresponding imagesof processed fish are stored in .img files with matching basenames. Since secondary imageprocessing was added later in the development of the workcell, some of the data files donot have a corresponding image file.The following source, include, and library files are necessary for the successful compilation of the main executable workcell.exe from the original source code:Appendix A. User Manual and Reference 173fish*.c- Source modules in C code. Altogether there are eight (8)modules; namely, fishmain.c, fishsens.c, fishdrv.c, fishfilt.c,fishstat.c, fishknow.c, fishdecn.c and *.obj - Object files resulting from compiling individual source modules in the above list. Although not necessary for compiling,these files will significantly improve the speed of linking whenincremental modifications are attempted.workcell.h- Function prototypes. Required by fishmain.c.workcell.dcn - Decision table for servomotor tuning rulebase. Required byfishdecn. c.workcell.mem- Membership function descriptor tables for rulebase. Requiredby fishknow. c.gpblarge.lib - Library for GPB image processing routines.timer.lib - Library for timing routines.gpb.h - Include file for GPB routines.windw.h - Include file for GPB routines.elibdef.h - Include file for GPB routines.timer.h - Include file for timer routines.linkobj.lst - List of object files to be linked. Required by the makefile.makefile - Make file for workcell. Required by the program maintenanceutility nmake to build the executable file workcell.exe.In addition, the default C-library for large memory model executables— llibc7.lib isalso required to be present in the default library path. This library should support directin-line floating point mathematics.Appendix A. User Manual and Reference 174A.4 OperationBefore starting the workcell, the servomotor controller program must be down loaded tothe DMC-620 memory. This program is stored in the file workcell.gll. The following stepswill accomplish the downloading and then start the main user interface for workcell.(i) Change working directory to d:\workcell.(ii) If on-line operation is intended, then download workcell.gll using the followingcommand, (for demonstration mode of operation this step can be ignored),> dmcdload workcell.gllThe vendor supplied utility program talk2bus could also be used for downloading.It is recommended that for debugging and verification of DM0 software, user shouldinvoke the utilities provided with talk2bus.(iii) Start the workcell by typing,> workcellWorkcell starts up with the main menu as shown in Figure 4.22. By selecting andopening the cTask Allocation’ submenu from the main menu, user can choose either theon-line operation mode or the demonstration mode. Selection of menu items are donethrough the cursor movement (arrow) keys. The currently selected item is displayed byhighlighting it from the background. The selected item could be opened up by hittingthe RETURN key. At the main menu, the ESC key will stop the current workcell sessionand return the user to the command prompt.The arrow keys are extensively used in most of the submenu levels for the selectionof various actions and displays. Navigation through these submenu items are mostlyself-explanatory from the layout of the menu items. The ESC key will return the userAppendix A. User Manual and Reference 175to the previous menu level from within a submenu. Also, a help bar at the bottom ofthe display will keep the user informed of what keys are effective at each level of thehierarchy.Demonstration Mode: By selecting ‘Load Data’ option from within the ‘Task Allocation’ menu, the user is automatically returned to the demonstration mode. In thismode, workcell will load data files (as selected by user) that have been saved from previous on-line operations. User can then go through the various system monitoring optionssuch as sensors, preprocessors, and workcell status which simulate an on-line session ofthe workcell. It also allows the user to preview the knowledge base and tuning actionsor inferences that has resulted from the given set of data.Demonstration mode of operation does not require the presence of servomotor controlprogram and hence this mode could be entered even if workcell.gll is not downloaded.On-Line Mode: The ‘On-Line’ option within the ‘Task Allocation’ menu lets the userselect this mode where the prototype fish processing machine is operated and monitoreddirectly by the workcell software. Once in this mode, workcell will wait for a signalgenerated by the primary vision system to trigger the servomotors into action. Uponreceiving the trigger, workcell will also start data acquisition and monitoring functions.At the end of this cycle, workcell will compute the status information and then use theknowledge base to infer tuning actions if any. At the same time workcell is ready toaccept another trigger signal and start the next cycle of operation.Upon entering the on-line mode, the user is asked to enter a file name in which processdata are to be saved. Then workcell will prompt the user to start the waiting mode. Byselecting ‘Yes’ at the prompt, user can make workcell wait for a trigger. Once a dataacquisition cycle has been completed, user can navigate through the hierarchical controlAppendix A. User Manual and Reference 176structure, monitoring the performance and tuning actions taken by the workcell.A.5 Compilation and LinkingCompiler: Microsoft C Optimizing Compiler, Version 6.OOALinker: Microsoft Segmented Executable Linker, Version 5.31Make utility: Microsoft Program Maintenance Utility, nmake, Version 1.20A makefile is provided in the d:\workcell directory to automate the steps of compilationand linking. When invoked with the command nmake, the makefile will build the targetworkcell.exe from the original object modules. If any object module is out of date withrespect to the corresponding C-source code, makefile will first compile the source beforebuilding the target. For a successful compilation and linking, all the source, include, andlibrary files listed in Section A.3 have to be present in the current directory.The compiler options used in the workcell can be viewed by consulting the make-file. For easy reference, following is a list of the most important options used in thecompilation,/AL — Use large memory model. This option is necessary since thetarget is larger than 64 kB./FPi87 — Use in-line floating point mathematics. This will give the fastestpossible code on a machine with a math-coprocessor./G2 — Use 286 instruction set. (The present compiler could not dobetter than that!)The object modules are linked with the default C-library llibc7.lib and two othercustomized library modules gpblarge.lib and timer.lib to produce the final target workcell.exe. The option /NOI in the link command line makes the linking case sensitive,Appendix A. User Manual and Reference 177as required by C-source code. Also note that on the present platform, the customizedlibrary timer.lib is merged into the default library llibc7.lib, and hence the lack of explicitreference to it in the link command line.A.6 Reference GuideThis section details the intended interpretation of the functions contained in each sourcecode module. Following is a single line description of the content of each source module.The subsequent sections describe most significant functions defined in each module ofthe workcell. Some simple functions whose purpose is obvious from their name and thecontent, have been omitted from the detailed listing. All functions follow the standardANSI-C argument passing syntax.fishrnain.c - Main program and functions required in common.fishdrv.c - Special hardware driver routines and I/O functions.fishsens.c - Functions required for reading sensory information.fishfilt.c - Functions for information preprocessing.fishstat.c - Functions to build workcell status (context).fishknow.c - Functions to build knowledge base.fishdecn.c - Inference engine and defuzzification functions.fishlay.c - Functions for drawing workcell layout.A.6.1 Main module — fishmain.cFunction : setup.screenSets the screen to 16 color high resolution video mode. Defines colors to beused in the user interface. Called only once in the program. Input - void.Output - void.Appendix A. User Manual and Reference 178Function setscreenClear the screen and prepares it for redrawing. Called before every submenufunction. Input - void. Output - void.Function ShowHelpDisplays help information at the bottom of the screen. Input - char *Help..Text, Output - void.Function mainmenuDraws the main menu screen layout. Input - void. Output - void.Function : maximumReturns the maximum value of the input arguments. Accepts a variablenumber of arguments. End of list marker must be a negative value. Input -float argi, float arg2..., Output - float maxvalue.Function : minimumSimilar to maximum but returns the minimum value. Input - float argl,float arg2..., Output - float minvalue.Function : wait..for.keyWaits in a ioop until user hits one of the keys from the list of input keyvalues. Returns the key hit. End of list marker is a null character. Input -mt keyl, mt key2..., Output - char KeyHit.Function : promptDisplays a pop-up message box with the supplied input text. If type is 1,returns the user input ‘yes’ or ‘no’ as an integer of value 1 or 0. Input - char*head, char *messagel, char *message2, mt type, Output- mt response;Appendix A. User Manual and Reference 179Function : get_fil&namesFinds the files whose name matches a given pattern and stores them inan array of file names. Returns the number of files found. Input - charpattern[], char filenames[][]. Output - mt nfiles;Function : findimagefileLooks for a matching image file for the data file supplied as the input argument. Returns success(1) or failure(O). Input - char datafilename. Output- mt flag;Function : do_servo_dataPerforms the complete data processing sequence for the servo motor positiondata. Input - void. Output - void.Function : do_image_dataPerforms complete image processing sequence on the input image in theGPB memory. Input - void. Output - void.Function : mit_load_dataInitializes the workcell by loading data into memory. Provides a menu interface for the user to select a data file. Returns Esc if user aborted dataloading, else returns null. Input - void. Output - char key.Function : initonlineInitializes on-line operation sequence. Returns Esc if user aborts the on-linesession, else returns null. Input - void. Output - char key.Function : initializeDraws the Task Allocation menu for initializing workcell. If input value isAppendix A. User Manual and Reference 180zero, provides the initializing menu, otherwise carries out the menu itemcorresponding to input value. Input - mt action. Output - void.Function : openupOpens a submenu from the main menu. The submenu to open is given bythe input argument. Input - mt box. Output - void.Function : mainWorkcell program entry point. Draws the main menu and provides the userwith the submenu selection interface. Input - void. Output - void.A.6.2 Hardware driver module — fishdrv.cFunction : dmc.get_characterReads a character from the the output port of DM0 controller. If data isnot ready, this routine returns immediately with a return value of zero (0),else returns one (1) with the character read pointed to by the input variableoutchar. Input - char *outchar. Output - mt ErrorFlag.Function : dmcJniLcommInitializes DMC controller ports for communication. Clears the outputport of any spurious characters. Returns zero (0) if successful, else returnsDMCINITERROR (5). Input - void. Output - mt flag.Function dmc_write_stringWrites the input character string to the input port of DM0 controller. Inputstring must be less than 256 bytes long. If successful returns zero (0), elsereturns DMC.WRITETIMEOUT (3). Input - char string[ 1. Output - mtErrorFlag.Appendix A. User Manual and Reference 181Function : dmc_read.stringReads a string of characters from the output port of DMC controller. Stringis stored in the out_string variable. Returns zero (0) if successful, else returnsDMCREADTIMEOUT (2) or DMCCOMNDERROR (4). Input - charout_string[]. Output - mt ErrorFiag.Function : dmctalkCombines the functions of the previous two routines, dmc_write_string anddmc_read_string, to make a single two-way communication interface withDMC controller. The input_string is written to the input port and theresponse from the controller is read to the response_string. Returns zero (0)if successful, else returns one of the error values defined previously. Input -char input_string[ ], char response_string[ 1. Output - mt ErrorFlag.Function : dmcinitservoExecutes the servomotor initializing part of the program from workcell.gll,which must have been downloaded to the DMC memory prior to callingthis routine. Returns zero (0) if communication was successful, else returnsthe error value. Note that for successful execution, the response from DMCcontroller must also be checked. Input - char *response. Output - mt ErrorFiag.Function : dmcJnitprogramStarts the execution of main servomotor control program workcell.gll. Returns an error value indicating success or failure of communication as before.Workcell.gll must have been downloaded to DMC prior to calling this routine. Input - char *response. Output - mt ErrorPlag.Appendix A. User Manual and Reference 182Function : dmc.stop.programStops the execution of main servomotor control program workcell.gll. Returns an error value indicating success or failure of. communication as before.Workcell.gll must have been downloaded to DM0 prior to calling this routine. Input - char *response. Output - mt ErrorFlag.Function : dmcwaiLonprogramWaits in a loop until a valid response from the DM0 controller is receivedor until user hits Esc key. The expected response is the one sent by theworkcell.gll program upon receiving the trigger signal from the primary image processing station, signaling a successful detection of gill position froman image of a fish on the conveyor. The out_string contains the X and Yposition commands for the two servomotors in pulse coordinates. If the useraborts the wait with the Esc key, then the return value is character Esc, elsereturns null. Input - char *out_string. Output - char key_hit.Function : wait_on_triggerFirst executes dmc_wait_on_program and upon return from it, computes theX and Y reference commands. Then polls the DM0 controller to get the current position of the servomotors. The total number of samples and sampletime are defined by the two constants NUMSERVODATA and SERVOSAMPLETIME. If user aborts the waiting for trigger, then the return value ischaracter Esc, else returns null. Input - mt *Xposition, mt *yposition.Output - char key_hit.Function : dmc.motorshutdownSends servomotor shutdown command to DM0 controller. Usually this isdone on exit from the workcell program. Input - void. Output - void.Appendix A. User Manual and Reference 183Function : set_conveyorspeedSends a speed command to the conveyor drive amplifier. The input value isin volts, with a maximum value of 5.0 representing the peak output of theamplifier. This routine writes a properly scaled value to the A/D converterport. Input - float volt. Output - void.Function : gpb..snap..imageSnaps an image from the CCD camera and stores it in GPB memory at thePlane and Bank specified by the input parameters. The video input channelis specified by the constant VIDEO.CHANNEL. The image snapped will alsobe displayed on the image monitor. Input - mt Plane, mt Bank. Output -void.Function : gpbdisplayimageDisplays, on image monitor, an image stored in GPB memory at the Planeand Bank specified by the input parameters. Input - mt Plane, mt Bank.Output - void.Function : save_imag&fileSaves an image stored in GPB memory at the Plane and Bank specified bythe input parameters. The file created will have the same basename as theinput filename, but with the extension 1MG. The path for the files createdis given by the constant IMGFILEPATH. Returns zero (0) for a successfulsave operation. Input - char *filename, mt Plane, mt Bank. Output - mtErrorFlag.Function : load_imag&fileLoads an image file that has been saved by the routine sav&image.iile, intoAppendix A. User Manual. and Reference 184the GPB memory at the Plane and Bank specified by the input parameters.The input filename must be full file name including the extension. Returnszero (0) if loading is successful. Input - char *filename, mt Plane, mt Bank.Output - mt ErrorFlag.Function : process_imageThe complete image data preprocessing sequence. The original image of aprocessed fish is assumed to be in the Plane and Bank specified by the inputparameters. The following sequence of operations are performed. (i) Defineregion of interest. (ii) Smooth twice with binomial filter. (iii) Thresholdthe image to isolate boundaries. (iv) Sobel filtering to get cut edges. (v)Labeling and extracting the cut contour. (vi) Call gpb_extractchain( ) andchain_to_xyarc. (vii) Returns the number of segmented labels. Input - mtPlane, mt Bank. Output - nLabels.Function : show_processed_imageDisplays the preprocessed image with the isolated cut contour highlighted.Input - void. Output - void.Function : gpb_extract_coordExtracts pixel coordinate data from the cut contour stored at the plane andBank specified by the input parameters. Also stores these X, Y data inthe third parameter coord. Input - mt Plane, mt Bank, ZAHYOU coord[ j.Output - void.Function : gpb_extract_chainExtracts chain code data from the cut contour stored at the plane and BankAppendix A. User Manual and Reference 185specified by the input parameters. Also stores these data in the array specified by the third parameter ‘chain’. Input- mt Plane, mt Bank, ZAHYOUcoord[ 1. Output - void.Function: gpb..maicJabelFor the source image specified by the Plane and Bank, this routine finds theconfiguration which has the largest area, and returns its label number. Thisalgorithms basically detects the cut contour from other labeled configurations. The source image must have been labeled properly prior to callingthis function. Input - mt Plane, mt Bank. Output - mt label.Function : gpbthresholdPerforms fixed level (128) thresholding on the source image at the In.Ylaneand In_Bank specified by the input parameters. Thresholded image is storedat the destination OutPlane and OuLBank. Input- mt InJlane, mtInBank, mt OutPlane, mt OutBank. Output - void.Function : abc_searchThis algorithm searches the contour-length profile specified by the inputarrays of X[ ] and Y{ ], to detect the points of interests ‘a’, ‘b’, and ‘c’ ofthe cut contour. Returns a, b, and c as pointers to corresponding indeces ofthe coordinate arrays for X, Y, and arc-length. Input - mt X[ 1’ mt Y[ 1’ mt*a, mt *b, mt *c. Output - void.Function : chain_to_xyarcConverts the chain code data of the cut contour to the corresponding arclength profile and to the X and Y coordinates. The output data are specifiedby the global variables xc[ I and yc[], and arclen[]. The input array has theAppendix A. User Manual and Reference 186chain code data. Input - unsigned char chain[ 1. Output - void.A.6.3 Sensor module — fishsens.cFunction : draw..cutioadDraws the cutter load data in graphical format. Input arguments point tocutter load data. Input also specifies the size of the graph to draw. Input- float *TopBladeData, float *BottomBladeData, short tlx, short tly, shortbrx, short bry. Output - void.Function : draw_conveyor.speedDraws the conveyor speed data in graphical format. Input arguments pointto conveyor speed data. Input - float *speed, Output - void.Function : draw_servomotorDraws the servo motor response data in graphical format. Input argumentspoint to servo motor data. Input also specifies the size of the graph to draw.Input - mt *ServoMotorResp, mt RefSignal, short tix, short tly, short brx,short bry. Output - void.Function : read_data_fileReads in top blade speed, bottom blade speed, conveyor speed, cutter response, and platform response from the input data file. Returns 1 if successful, otherwise returns a flag indicating the error. Input char *DataFileName.Output - mt flag.Function : write_data_fileWrites top blade speed, bottom blade speed, conveyor speed, cutter response, and platform response to a file in a format suitable for reading byAppendix A. User Manual and Reference 187the routine read_data_file. Returns 1 if successful, else returns zero. Input -char *DataFileName, Output - mt flag.Function : getblade_speedTakes a single set of readings from the blade speed sensor signals of bothtop and bottom blades through the A/D converter. Input - float *TopBlade.Speed, float *BottomBladeSpeed. Output - void.Function : get_conveyorspeedReads the conveyor speed sensor once through A/D converter. Returns thespeed reading. Input - void. Output - float speed.Function : store_readingsReads and stores the top and bottom blade speeds and conveyor speed atevery 10 millisecond interval. Total number of readings is set by the globalvariable NUMSPEEDDATA. Input - float *TopBlade, float *BotBlade, float*Conveyor. Output - void.Function : show_sensorDisplays sensor reading corresponding to the selected menu item. Inputargument selects the data set to be displayed. Input- mt box. Output -void.Function : sensor_screenDraws the screen for the sensor submenu and provides user with a selectionof different sensors to display. Input - void. Output - void.Appendix A. User Manual and Reference 188A.6.4 Preprocessor module — fishfilt.cFunction : auto_scaleloadRemoves any bias from the load data profile. This may have beeen causedby voltage drift in the measuring circuits. Input - float BladeLoad. Outputfloat drift.Function : smooth_loaddataSmoothes blade load data by filtering through a fourth (4) order binomialfilter. Input - float *BladeLoad, float *SmoothBladeLoad. Output - void.Function : peakDivides the blade load data into horizontal segments of size, ‘step’, anddetects the presence of any peaks bounded within the segment. The magnitude of the peaks detectable is directly proportional to the value selectedfor ‘step’. That is, for larger values of ‘step’, the algorithm is less sensitiveto smaller spikes in the input data. Returns the number of maximas found.The second and third input arguments stores the peak value and the corresponding x-coordinate (time). Input float BladeLoad[], float PeakValue[ 1float PeakTime{ 1. Output mt nPeaks.Function : slicePrepares blade load data for peak finding algorithm. A horizontal cut ismade through the load data at the value ‘Level’ and finds the x-coordinates(times) at which load passes up or down through this selected ‘Level’. Thestart and end coordinates of regions found are stored in the third argument.Input - float Level, float *LoadData, mt region[ ][ j. Output - void.Appendix A. User Manual and Reference 189Function : preJdprofPreprocesses load profile. This function forms an intermediate status information, in the form of fuzzy sets, regarding the slip at cutter. The presenceof secondary peak and the magnitude of which are the input values. Theoutput is the context given by the third and forth arguments. Input - floatsPeakTime, float sPeakMag, float inspeak[], float insload[ j. Output - void.Function : context_slipForms the status information of ‘slip’ for a single blade load profile fromthe information obtained from the pre_ldprof routine. A simple rulebase ofthree (3) rules is used with two antecedent variables, magnitude and timingof secondary peak, and one consequent variable ‘slip’. Input - float inspeak[ 1’float insload[,float slip[ 1. Output - void.Function : comptopbotFormulates the composite slip information for the workcell status database.The slip information from the top and bottom blades are used as antecedentvariables in a rulebase module which combines the two to form a single fuzzyvariable of ‘slip’. The result is stored in the global status variable ‘inslip[ ]‘.Input - float topslip[ 1’ botslip[ 1. Output - void.Function : processload.dataThis routine combines all of the above functions to perform the full set ofdata processing on the cutter load profile and formulates such information asmean load, asymmetry of top and bottom cutter profiles, and slip at cutter.Input - float MeanLoad, float asymmetry. Output- void.Appendix A. User Manual and Reference 190Function : smooth_pulse_dataSmoothes pulse position data by filtering through a second (2) order binomial filter. Input- mt PulseData[ 1. Output - void.Function : normpulsedataNormalizes the pulse response such that pulse data always starts with zeroand rises in the positive sense. Same normalization is applied to the referenceposition as well. Input - mt PulseData[ ], mt Reference. Output - mtStepSize.Function : rise_timeComputes the 95% rise time of the input pulse response. Rise time is interpolated in between sampling period and returned as a floating point value.If the response does not reach 95% level, it returns the total response timerepresented by the given set of data. Input - mt PulseData[ }, mt StepSize.output - float RiseTime.Function : turningpointsFinds the peak points of an underdamped response. The Values found arereturned in an array of structures of type TurnPoints which contains themagnitude of peak value (int) and the corresponding time (float). Theoutput is the number of peak points found. Input - mt PulseData[ ], mtStepSize, TurnPoints *tp. Output - mt nPoints.Function : dampednatfrequencyReturns the damped natural frequency of an underdamped pulse response.If the response is overdamped or critically damped, then it returns zero.Input - TurnPoints *tp, mt nPoints. Output - float dnfreq.Appendix A. User Manual and Reference 191Function : overshootReturns the maximum overshoot of an underdamped pulse response as aratio to the step input. Input - Turnpoints *tp, mt nPoints, mt StepSize.Output - float overshoot.Function : dampingatioReturns the damping ratio of an underdamped pulse response as calculatedfrom its overshoot. This routine assumes a second order mode to be thedominant one. Input - float - overshoot. Output - float dratio.Function : offsetReturns the absolute value of the offset of the input pulse response as aratio to the step input. Input - mt PulseData[], mt StepSize. Output - floatoffset.Function : evaluat&modelGiven the input parameters of natural frequency (nfreq), damping ratio(dratio) and offset of a model, this routine computes the risetime, dampednatural frequency, and overshoot of the model for a step input. These parameters are returned in a structure of type pAttrib. Input - float nfreq,float dratio, float offset, pAttrib *model. Output - void.Function : servo_performanceGiven the input pulse response, this routine computes, whenever possible,the risetime, damped natural frequency, overshoot, damping ratio, and offsetof the response and returns these values in a structure of type pAttrib. Input- mt PulseData[ J, mt StepSize, pAttrib *plant. Output - mt nPoints.Appendix A. User Manual and Reference 192Function : do_load_dataComplete data processing sequence for the cutter load profile data, includingsmoothing, preprocessing, context generation, and making inferences. Inferences are also converted to corresponding actions. Input- void, Output -void.Function : process_pulse_dataData processing sequence for pulse data including smoothing and computation of servomotor performance attributes. Input - mt PulseData[ ], mtStepSize, pAttrib *plant. Output - void.Function : get_qattribComputes context information for visual quality from the chain code dataobtained from the secondary image (i.e., image after processing). The inputis the number of labels in the segmented image. Input - mt nLabels. Output- void.Function : plot_arclengthDraws the arc-length profiles of the processed fish on the screen for preprocessor menu. The X-axis is the arc-length while Y-axis is y-pixel coordinatesin the original image. Input - float ArcLengthData[], mt Xcoord[], mt Ycoord[]. Output - void.Function : showfilterDraws the preprocessed information on the preprocessor menu screen depending on the user selected input box number. The selection includescutter load profile data (Box = 1), secondary image data (Box = 2), Platform servomotor response (Box = 3), and Cutter servomotor response (BoxAppendix A. User Manual and Reference 193= 4). Input - mt Box. Output - void.Function : filter_screenPreprocessor submenu screen layout. Allows the user to select a particularcategory of preprocessed data streams to be viewed. Input - void. Output -void.A.6.5 Status module — fishstat.cFunction : card2_contextFuzzification interface for input variables where the output fuzzy space hasa cardinality of two (2). The parameter ‘attrib’ is the crisp input variableand the parameter cmem[] is the output memberships in each of the twofuzzy sets defined by the two modal points ‘modi’ and ‘mod2’. Input - floatattrib, float mem[ }, float modi, float mod2. Output - void.Function : card3contextFuzzification interface for input variables where the output fuzzy space hasa cardinality of three (3). The parameter ‘attrib’ is the crisp input variableand the parameter ‘mem{]’ is the output memberships in each of the threefuzzy sets defined by the three modal points ‘modi’ , ‘mod2’, and ‘mod3’.Input - float attrib, float mem[], float modi, float mod2, float mod3. Output- void.Function : card5_contextFuzzification interface for input variables where the output fuzzy space hasa cardinality of five (5). The parameter ‘attrib’ is the crisp input variableand the parameter ‘mem[]’ is the output memberships in each of the fiveAppendix A. User Manual and Reference 194fuzzy sets defined by the five modal points ‘modi’ through ‘mod5’. Input -float attrib, float mem[], float modi, float mod2, float mod3, float mod4,float mod5. Output - void.Function : make_contextUses the previous three functions to fuzzify the crisp variables supplied in theinput arguments. The output memberships are stored in the correspondingglobal variables. Input - float load, float asymmetry, ... Output - void.Function : make_visual_contextSame as before, but the input variables are those derived from secondaryimage preprocessing such as depth of cut and smoothness of surface. Input- float depth, float contour, float surface. Output - void.Function : norm_servo_errorCompares the servomotor performance with that of the model and computes the normalized error parameters. The output is stored in the variable*err. pAttrib is a structure that holds the five performance attributes ofthe servomotors, namely, rise time, damped natural frequency, overshoot,damping ratio, and offset. Input - pAttrib *plant, pAttrib *model, pAttrib*err. Output - void.Function : err2idxCompares the performance error specified by the input parameter with thesupplied threshold levels and outputs an integer index representing the performance. Input - float error, float threshold[]. Output - mt index.Function : error_to_contextUses the ‘err2idx’ routine to convert the performance errors associated withAppendix A. User Manual and Reference 195the five attributes of the servomotor response into an index of error. Input- pAttrib *error, mt context[ 1. Output - void.Function : makeservo_contextCombines the previous three routines into a single function that convertsthe performance attributes of a servomotor into a context represented byperformance indices. The input parameter cplant contains the performanceattributes. Input - pAttrib *plant, pAttrib *model, mt context[]. Output -void.Function : draw.membershipsDraws a graphical representation of fuzzy variables on the screen with themembership in each of primary term set highlighted. The structure ‘FuzzyMemGraph’ defines the primary term set and its modal points. The inputmemberships are given by the array ‘memship[ J’. The other input parameters specify the size of the drawing on the screen. Input - FuzzyMemGraph*graph, float memship[ }, short ulx, short uly, short brx, short bry. Output- void.Function : show_contextDisplays the current status (context) of the workcell for each category ofsensor data stream. The user selected category is specified by the inputBox number. The selection includes, Cutter load context (Box 1), Visualquality context (Box = 2), Platform servomotor context (Box = 3), andCutter servomotor context (Box = 4). Input - mt Box. Output - void.Function : status_screenWorkcell status submenu screen layout. Allows the user to select a particularAppendix A. User Manual and Reference 196category of context data streams to be viewed. Input - void. Output- void.A.6.6 Knowledge base module — fishsknow.cFunction : makeruledcnsp, makeruleiildn, makeruleilnish,The ‘makerule’ family of routines construct the fuzzy rulebase for the work-cell. There is one makerule routine for each action (consequent) variable,such as change of conveyor speed (dcnsp), hold-down force (hldn), and finish product quality (finish). Each such rulebase module is defined by arelational table (array) of dimensions (N + 1) where N is the total number of antecedent variables in that rulebase module. The extra dimensionis for the single consequent variable. For example, the arrays ‘rule_dcnsp’,rulejildn’, and ‘ruleiinish’ define the relational tables for the correspondingconsequents respectively. All required membership functions are defined inthe file workcell.mem as global arrays of float variables such as ‘dcnspmem’,‘hldnmem’, and ‘finishmem’. The relational tables themselves are also arraysof float with global visibility. Inputs - void. Outputs - void.Function : buildrulesExecutes all the rulebase module routines defined above to create the finalknowledge base of the workcell. Input - void, output - void.Function : rulescreenWorkcell knowledge base submenu screen layout. Allows the user to selecta particular module of rulebase to be viewed. Input - void. Output - void.Appendix A. User Manual and Reference 197A.6.7 Decisions module — fishdecn.cFunction : infer_dcnsp, infer±ldn, infer_finish,The ‘infer’ family of routines implements the fuzzy compositional rule ofinference. There is one ‘infer’ routine for each action variable such as changeof conveyor speed (dcnsp), hold-down force (hldn), and finish product quality(finish). The inference is reached in a two step procedure, where the inputfuzzy variables (i.e., context variables) corresponding to the antecedents ofeach rulebase module are first joined into a single array. Then the mm-max rule of inference is applied between the joined input space and thecorresponding relational table. Resulting inference is stored in an arrayof float with global visibility in the form of a membership function. Forexample, the arrays ‘outdcnsp[ 1” outhldn[ ]‘, and ‘outfinish[ ]‘ hold themembership functions corresponding to the inferences of change of conveyorspeed (dcnsp), hold-down force (hldn), and finish product quality (finish)respectively. InputsFunction : makeinferencesCombines all the inference making routines into single function for easyexecution. Creates the final decisions of the workcell. Input - void. Output- void.Function : defuz3, defuz5These are the defuzzification routines for membership functions with cardinality three (3) and five (5) respectively. The centroid method of defuzzification is implemented with the output multiplied by the input parameter‘scale’. Input- float FuzzyMem[], float scale. Output - float defuz.Appendix A. User Manual and Reference 198Function : make...commandsDefuzzification interface for all the fuzzy decisions with suitable scaling.The outputs of this routine are scaler quantities that can be used directlyfor tuning hardware controllers. Input - void. Output- void.Function : tun&dAttribsServomotor design attribute inference routine. Computes the design attributes for the servomotor from the performance attributes specified by theinput variable ‘context[ 1’. Lookup table method is used for inferencing servomotor tuning actions. The array ‘ServoTuningTable’ contains the lookupdata. The outputs are stored in the structures of type ‘dAttrib’ pointed toby the variables ‘infer’ and ‘plant’. Input - mt context[ ], dAttrib *infer,dattrib *plant. Output - void.Function : design.dmcDetermines the DM0 controller parameters for a servomotor by carryingout a Bode-plot design on the basis of the design attributes specified by theinput variable ‘plant’. The output is stored in a structure of type dmcAttribpointed to by the variable ‘control’. The output is properly converted andscaled such that they could be sent directly to the DMC controllers. Input- dAtrrib *plant, dmcAttrib *control. Output - void.Function : updat&dmcUpdates (downloads) the DM0 controller parameters of the two servomotors X-axis (Cutter) and Y-axis (Platform). The input variables reflect thecontroller parameters inferred by the knowledge base. Input - dmcAttrib*)xis, dmcAttrib *Yaxis. Output - void.Appendix A. User Manual and Reference 199Function : controller_screenWorkcell controller submenu screen layout. Allows the user to view thecurrent parameter values of the various hardware controller settings. Input- void. Output - void.Function : show_decisionDraws the current inferences of a particular category on the screen dependingon the user selected input box number. The inferences are shown as fuzzyvariables. The selection includes Hold-down force (Box = 1), conveyor speed(Box = 2), Finish product quality (Box = 3), Cutter servomotor tuning (Box= 4), Platform servomotor tuning (Box = 5). Input - mt Box. Output -void.Function : decision_screenWorkcell decisions submenu screen layout. Allows the user to select a particular category of inferences to be viewed. The current inferences from theknowledge base are shown form of fuzzy variables. Input - void. Output -void.A.6.8 Layout module — fishlay.cFunction : actuator_screenWorkcell layout submenu screen. Allows the user to view, graphically, various hardware components and communication lines between them. Input -void. Output - void.Appendix A. User Manual and Reference 200Function : draw_workcellDraws a schematic representation of the workcell layout on the screen including hardware and communication between them. Input - void. Output- void.Appendix BDMC Controller Program ListingThe DMC controller program is stored in the file workcell.gll which has to be downloadedto the controller before any servomotor operation is attempted through the workcellprogram. Following is the program listing of this file which contains a series of DMCcommands. The syntax and meaning of these commands could be found in the DMCuser reference manual published by the manufacturer.op oAl 8JP #BENV1O=2*12 + IiV10=4*13 + ybV1O=8*14 + ybV1O=16*I5 + ybV1O=32*16 + ybV1O=64*17 + ybop 16Al -8op 0V11=2*12 + IiV11=4*13 + ViiV11=8*14 + ViiV11=16*15 + ViiV11=32*16 + ViiV11=64*17 + viiV12=128*V11 + ybProgram A starts hereWrites ready signalWait for input 8 (trigger)Jump to program BEnd program AProgram B starts hereRead X—axis position commandfirst byte. (7 bits)Handshake mechanismRead X—axis position commandsecond byte (7 bits)201Appendix B. DM0 Controller Program Listing 202OP 16Al 8OP 0V20=2*12 +V204*13 +V208*14 +V20=16*15V20=32*16V20=64*17OP 16Al -8OP 0V21=2*12 + IiV21=4*13 + V21V21=8*14 + V21V21=16*15 + V21V21=32*16 + V21V21=64*17 + V21V22=128*V21 + V20OP 16V12=;MG, ;V22PA V12,-V22BG XYAMJP #AENRead Y-axis position commandfirst byte (7 bits)Read Y-axis position commandsecond byte (7 bits)Write positions to the output bufferSpecify new servomotor positionsBegin movementWait until end of movementJump to program A - start againEnd program BACSPGNZRTLSH XYDP 950,0Program C starts hereSpecify accelerationsSpecify max. speedsSpecify initial controller gainsSpecify initial controller zerosSpecify torque limitBegin servomotor modeSet initial offset of cutterEnd program CHandshake mechanismIiV20V20+ V20+ V20+ V20Handshake mechanism3000000,4000000200000,30000080,40240,245127,64EN


Citation Scheme:


Citations by CSL (citeproc-js)

Usage Statistics



Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            async >
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:


Related Items