Hydraulic Circuit Design and Dynamic Learning using Case-Based Reasoning C.M. Vong and P.K. Wong Faculty of Science and Technology, University of Macau, P.O. Box 3001, Macau Keywords: Hydraulic circuit design, Case-based reasoning (CBR) Abstract This paper describes the design and implementation of a hydraulic circuit design system using case-based reasoning (CBR) paradigm from AI community. The application domain of hydraulic circuit design and case-based reasoning are briefly reviewed. Then a proposed methodology in computer-aided circuit design and dynamic learning with the use of CBR is described. Finally an application example has been selected to illustrate the usefulness of applying CBR in hydraulic circuit design with learning. Although production rules are effective, the acquisition and maintenance of production rules are the problems facing by not only the software engineers but also the designers using the software. Moreover, static learning 1 is another issue of traditional rule-based systems. To resolve the problems inherited from conventional rule-based expert systems, the AI community proposed another reasoning paradigm called case-based reasoning (CBR). CBR supports dynamic learning in the way that new knowledge can be appended to the knowledge base without recompilation of the system. This is one of main advantages of CBR that maintenance of knowledge takes much less time. This paper studies the application of CBR in hydraulic system design and a hydraulic circuit design system has been developed to verify this proposed methodology. 1. Introduction The use of computers in engineering design has become a major trend in industry. Today, many commercial computer-aided design (CAD) software are available to improve the design process in many engineering applications. However, CAD software in hydraulic system design is not as prominent as in many other areas of engineering design. This is mainly due to the complexity of hydraulic analysis and lack of agreement of the most appropriate approach to the design process. In recent years, more and more CAD software in hydraulic system design have been developed using object-oriented technology [Wong & Chan 1997] to reduce the complexity in defining components used in a hydraulic system, with the help of artificial intelligence (AI). Most of the systems [Burton et. al 1989] incorporate with an expert system containing production rules to guide the design and check the consistency of the hydraulic system. 1 Whenever the rules are updated, the whole system have to be recompiled. 1 is employed to find the nearest neighbor for the current problem from the reference cases, where wi is the importance of dimension i, sim is the similarity function for primitives, and , fiI and fiR are the values for feature fi in the input and retrieved cases, respectively. The sim function could be freely designed by user but mostly this function could employ the Euclidean distance function and turns (1) to 2. Revision 2.1 Review of CBR CBR is a methodology that allows to find analogies between a current working situation and past experiences (reference cases). CBR makes direct use of past experiences to solve a new problem by recognizing its similarity with a specific known problem and by applying its solution to find a solution for the current situation as shown in Figure 1. CBR has been used to develop many systems applied in a variety of domains, including manufacturing, design, law, medicine, and planning. E( f , f ,W ) I n E( f , f i 1 n i 1 wi n i 1 wi (2) C Yes Weight WA 1 WB 2 WC 1 With these parameters, the similarity function is calculated as E 1 12 2 0.2 2 1 12 0.72 4 The retrieved case with the smallest value E is considered as most similar to the new case because the value E is now indicating the distance (difference) of the input case and the retrieved case. The most similar retrieved case and the new wi sim ( fi I , fi R ) wi ( f i I f i R ) 2 Retrieved Case: A B 9 3.7 When user inputs a problem, the problem is interpreted and converted as a new case into the specific format of the reasoning system. Then the converted new case enters the stage of RETRIEVAL where the new case is matched against the previous cases in the case library of the reasoning system. In the retrieval stage of CBR usually a simple similarity function ,W ) n i 1 0 if f i I f i R fi I fi R I R 1 if f i f i To illustrate the use of this function, consider the following example. Input case: A B C 10 3.5 No 1. retrieve –– retrieve similar past case matched against current problem 2. reuse –– reuse to solve current problem based on solution of past case 3. revise –– revise the past solution if any contradiction occurs when applied to current problem 4. retain –– retain the final solution along with the problem as a case if the case is useful in the future R For symbolic features, CBR is constituted with four RE’s [Watson 1994]: I R (1) 2 2.2 Review of Hydraulic Circuit Design case are both passed to next stage REUSE where the solution part of the retrieved case is applied to the new case, with the guidance of adaptation knowledge. The application of old solution involves substitution of solution features, structural modification of the solution and/or derivational replay of solution. These methods were discussed in [Kolodner 1993]. After this stage, now the new case is along with the adapted solution based on the old one. This adapted solution is considered as a suggested solution which is still incomplete because it is adapted according to the requirement of new case and this solution may have inconsistency among its solution parts. To ensure the adapted solution is consistent, it will be passed to next stage REVISE, where the adapted solution will be further adapted based on the user feedback and additional meta-adaptation knowledge, which provides information of how to reuse adaptation rules to perform adaptation. This final adapted solution is then returned as a confirmed solution to the new case but this does not come to an end. It was discussed that CBR learns by accumulating new cases. However, should any newly derived case be accumulated in the case library? The answer is no. CBR should only store the cases that can contribute to future reasoning of solutions, that could not be done only by the cases in current case library. In other words, if the cases in a case library is capable enough to cover the newly adapted solution, this new solution should not be stored in order to avoid redundancy and inconsistency. Otherwise, it should be stored for future use. This leads to the final stage of CBR – RETAIN. The case considered as being able to contribute in the future is called “learned case” and stored in the case library. Mechanical energy is converted to hydraulic energy in hydraulic circuits. This energy is then transferred as hydraulic energy, processed either in an open loop or closed loop circuit, and then converted back to mechanical energy. Hence the main task of hydraulic power system design is circuit design and hydraulic power circuit design is one kind of configuration design problems. At present, the design of hydraulic circuit is conducted by an interactive trial and modification procedure. This involves sketching the schematic of the circuit, and calculation of various component and circuit parameters, and then evaluate performance of the designed circuit. The above process is repeated to refine the circuit design according to the evaluation result until the result is satisfactory. 2.3 General Procedure in design of hydraulic power circuit 1. The circuit is designed according to the information provided by the user such as maximum thrust required, speed of actuator, duty cycle, function, etc. 2. The piston and the rod diameters required for the actuator are determined according to the maximum operating pressure, maximum thrust required and stroke length. 3. Select the piston and rod diameter required and convert these into standard size. 4. The system parameters such as system pressure, hydraulic oil flow rate, etc, are calculated. 3 5. The suitable pump or pump circuit based on the system pressure and flow rate is selected. 6. Other hydraulic components used in the circuit are then selected. the similarity of cases to the current one, the cases are already ranked with different similarity level. After that, the engineer could adapt/modify the retrieved case manually by the above procedure or by applying the adaptation rules supplied by CBR. Those adaptation rules are specific production rules captured from experts or from the engineer’s own experience. Finally the engineer can decide if the case is good enough to store into the case library for future reuse. 3. Use of CBR in hydraulic circuit design Based on the above procedure, engineers perform a hydraulic circuit design. However, as it was noticed that hydraulic engineers are usually accustomed to modify an existing circuit design into a new one for different situation and use. It is because hydraulic circuit design is usually similar even for different situation, so hydraulic engineers have to manually look through their, or their company’s, old circuit designs stored in a database and then retrieve a similar and suitable one and perform modification. This process is repetitive and tedious in the stage of retrieving because engineers have to review the circuit designs one by one. However, the situation that retrieving an old design circuit and adapt the retrieved circuit design into a suitable one for current situation is exactly the paradigm supported by CBR. Since each circuit in the database (case library) was stored along with its functional and applicationspecific requirements of the outputs, these parameters were used as the case (circuit design) indexes. Whenever the hydraulic engineer wants to retrieve an old case from the case library, he just needs to input the functional and application-specific requirements and CBR uses (1) to calculate the most similar past case. If the engineer does not satisfy and think that the retrieved case is not suitable, then the next most similar past case would be shown. This could be done because when calculating 3.1 Dynamic learning in hydraulic circuit design Hydraulic circuit designs differ by not only the circuit diagram but also the functional attributes along with them. For circuit adaptation, if some components are replaced, then the number of attributes will also be changed by adding or deleting some of them. CBR enables dynamic structural modification of cases so that attributes can be added or deleted accordingly. For example, an engineer retrieves an old case and perform modification on the circuit design, then the number of attributes would be changed according to which components are revised by adding predefined attributes for the components or deleting unnecessary attributes in the circuit. 4. System implementation and application example The hydraulic circuit design system has been built with Microsoft Visual Basic and running under Microsoft Windows95 platform. The system, as implemented, is able to recommend most 4 similar circuit design based on the circuit requirement specification. The working environment and front-end user interface of the circuit design system are shown in Figure 2. In addition, Figure 2 also shows a sample circuit design and the modifiable attributes along with it. The input specification for an example of a 100-ton horizontal hydraulic wooden press is shown in table 1. Figure 5 shows the circuit configuration and the main component sizes recommended by the system. Whenever an old similar case is retrieved, the case is adapted in order to reuse it for current situation. However, not every case is adaptable by the system as the adaptation rule set of any system is always incomplete. At this moment, human user intervention is necessary to compensate the inability of adaptation of the system. Usually, human user needs to adapt the case by himself using his domain expertise and this is a good time to capture the user’s domain knowledge by recording what operations he perform to adapt a case, along with indexing of the problem case that the system could not adapt automatically. In recording the operations, the system can dynamically learn from the user the adaptation knowledge. The learnt knowledge is encapsulated as a case called adaptation case because it is used to guide adaptation. Later, when similar problem case arises, the system will become capable to handle the adaptation by referring to the adaptation case. 4.1 Dynamic Learning in details The dynamic learning ability of the system is illustrated in this part. As the retrieval process is already discussed in section 2.1, the detail will not be discussed here. Before going on the example, the attributes of the case representation for a hydraulic circuit is briefly introduced. The attributes constituting a hydraulic circuit is listed below as a sample case: 4.1.1 System Implementation Drawing name Max. Flow Max. Pressure Useable range of speeds Useable range of pressures Viscosity range Max. noise level Service life Price Pressure function Orientation Load Type Environment Symbol Synthesis Connection point 1 Connection point 2 Var_1 33 L/min 630 Bar 2 1 1 3 2 3 Constant Horizontal Press Noisy Pump 1 (230, 100) (350, 100) Initially, the existing standard block drawings of hydraulic sub-circuits were constructed along with their respective attributes such as the ones listed above. In the training stage of the system, a list of preview of existing drawings will be shown. The user can select one of them to perform training of the system in order to teach the system to recognize other variations of the sub-circuit. For instance, consider again the above list as an existing standard sub-circuit. If the user changes the attribute “Max. Flow” from 33 L/min to 350 L/min, the pump component of the initial sub-circuit has to be replaced with a new one which is able to support flow rate of 350L/min. where 1 = very good/very large 2 = good/large 3 = satisfactory 4 = poor 5 This is learnt by means of the production rule if “Max. Flow” <= 33L/min then use old_block else use new_block The system will keep all of these production rules to adapt the future cases. Whenever a sub-circuit has maximum flow rate greater than 33L/min, it has to select a certain pump component. Because of the change of the pump component, the attributes “Synthesis Symbol”, “Connection Point 1” and “Connection Point 2” are necessary to change so that in the drawing, a more powerful pump component is inserted. The change of drawing could be done by integrating the system with a CAD system for hydraulic circuit developed by the author [Wong et. al 1998]. By integrating the CAD system, only the block drawing filename and the connection points are necessary to modify the existing drawing. Another example illustrates the structural changes of a case. The user changes the “Pressure function” from “Constant” to “High Speed, Low Pressure”. With this change of value, one more attribute “Speed function” should be added to the case to represent the speed variation. In addition, the actuator in the drawing is replaced with another one with tail. The replacement is shown in Figure 3 and Figure 4. Again this could be done by the CAD system. After the learning, a new drawing should be saved together with the modified attributes. Later, user can retrieve this newly generated subcircuit to constitute the solution for a new problem. maximum flow rate and inserting a new attribute, etc., are saved in the form of operations to represent adaptation knowledge. The forms of operations are specified below. For substitution operation: Operator Feature Ratio/ Value name Value “Operator” means one of the following: substitute add minus multiply divide “Feature name” means the name of the feature in the case “Ratio/Value” are the operands used for the operators “Value” means the value to replace the original if the operator is substitute. For transformation operation: Operator Feature Value Attribute name Type “Operator” means Add or Delete “Feature name” means the name of the feature in the case “Value” means the value to insert for the feature. So it is optional for “Remove” “Attribute Type” means the data type for the attribute. These operators are saved in another database and ready for adaptation. Important meta-adaptation knowledge are also saved in another database that consists of the information of past successful trace of adaptation operators, source (retrieved most similar) case and the target (current problem) case. These meta-adaptation knowledge is called “adaptation case”. The general structure of an adaptation case is listed below. 4.1.2 Representation of adaptation operators During the user intervention, the actions of substituting a new block for Source case 6 Target case Operators Index work is much simpler than designing a brand new circuit from scratch. To match an adaptation case, the source case and target case are both the input parameters and the output for the matching is the sequence adaptation operators. One thing to notice is that this is not an exact matching. Once again this is only a similar matching using more or less the same similarity metrics. Once the operators are retrieved, they are applied to source case and the real solution can be found for the target case. 5. Conclusions This work is an attempt of applying CBR methodology in hydraulic circuit design to dramatically reduce the unnecessary time consumed for repeatedly designing similar hydraulic circuit by reusing past cases. CBR is a methodology in AI which can more robustly capture the thinking of human beings. The most important part of CBR is to reuse past experience in current problem so that identical parts of the current problem can be directly reused while only similar and missing parts of the problem can be solved by analogy using expert adaptation rules. An intelligent hydraulic circuit design system has been built using the recommended methodology and it has been verified to work successfully. The recommended methodology will be further verified by applying to other hydraulic engineering domains, such as moulding machines and marine applications. 4.2 Discussion of results Owing to no standard solution in the circuit design, so design evaluation will be concentrated on the validity of the design. The results generated from the prototype circuit design system has been verified to perform in accordance with the stipulated specifications by the experts from two hydraulic engineering companies. The major contribution of this circuit design system is the reduction of design lead time for the stage of similar circuit retrieval and postanalysis of attributes for circuit components. Non-experts normally spend one to two weeks to finish a circuit design. By reusing past circuit design with slight modification, only several minutes are necessary. The major difficulties in manual design is to find appropriate components and connection among components. It is because of the lack of universal design theory, hence finding and understanding the properties of components in a circuit is a very timeconsuming task, even for experts. With CBR, most part of past circuit design can be reused and the time for re-considering the selection of components satisfied by the circuit requirement specification can be saved. The only effort left for a circuit design is how to adapt an existing circuit into a new suitable one and this References 1 2 7 Burton R T , Sargent CM. The use of expert systems in the design of single and multi-load circuits. Proceedings of the 2nd International Conference on Fluid Power Transmission and Control, 1989: 605~610 Chan K K. Implementation of an object-oriented ICAD system for hydraulic circuits. MSc. Thesis, Department of Engineering, University of Warwick, U.K.,1997. 3 Galvão P , Vong C M. A step closer to modelling human reasoning CaseBased Reasoning. Macau Engineering Bulletin, No.3 December 1996, The Macau Institute of Engineers:54~56. 4 Gebhardt F, Vo A, Grthäer W and Schmit-Belz B. Reasoning with Complex Cases, Kluwer Academic Publishers, 1997. 5 Kolodner J. Case-based Reasoning. Morgan Kaufman Publication, San Mateo, CA, U.S.A., 1993 6 Veloso M. Planning and learning by analogical reasoning. 7 Veloso M, Aamodt A. eds. International Conference on CaseBased Reasoning - ICCBR95, Springer Verlag, 1995. 8 Leake D, Plaza E. eds. International Conference on Case-Based Reasoning - ICCBR97, Springer Verlag, 1997. 9 Watson I and Marir F. Case-based Reasoning: A Review. The Knowledge Engineering Review Vol.9, No.4, 1994. 10 Wong P K, Tam L M and Tam SC. Object-oriented CAD for hydraulic circuits of pressing machines. Computer Aided Drafting, Design and Manufacturing, Vol.8, No.1, 1998 June, China Engineering Graphics Society. Table 1 The input specifications of a 100-ton horizontal hydraulic wooden press Actuator group no. Maximum loading (Ton) Cylinder constraint (bore diameter/ mm) Cylinder constraint (rod diameter/mm) Stroke length(mm) Max. stroke speed (mm/sec) Max. speed for pressing (mm/sec) Mounting method No. of variation stage of the load pressure during pressing (i.e. at high load condition) Type of control in press Action Stage of the actuator speed Acceptable noise level Expected service life time Machine operating hours/day Prime mover rated speed System operating pressure 1 (Ram cylinder for pressing) 100 Nil Nil 300 30 10 Front and rear flange 1 Position sensing Two 60 db 5 years 12 hours/day 1450 rpm 210 bar Reference cases Problem Similarity New Problem Figure 2. Working environment and front-end user interface Adaptation Solution New Solution Figure 1.Case-based Reasoning Scheme 8 Changes of substitution of block drawing Changes of structure –– Speed variation Figure 3 Standard subcircuit Figure 4 Subcircuit after learning Figure 5 Solution for the wooden press recommended by the system 9