Sunteți pe pagina 1din 9

Journal of Materials Processing Technology 164165 (2005) 13791387

Evolutionary programming of CNC machines


M. Kovacic a , M. Brezocnik a, , I. Pahole a , J. Balic a , B. Kecelj b
a

Laboratory for Intelligent Manufacturing Systems, University of Maribor, Smetanova ulica 17, Maribor, Slovenia b TECOS, Slovenian Tool and Die Development Centre, Kidriceva ulica, Celje, Slovenia

Abstract The paper proposes a new concept for programming of CNC machines. The concept based on genetic algorithms assures evolutionary generation and optimization of NC programs on the basis of CAD models of manufacturing environment. The structure, undergoing simulated evolution, is the population of NC programs. The NC programs control the machine which performs simple elementary motions. During the evolution the machine movement becomes more and more complex and intelligent solutions emerge gradually as a result of the interaction between machine movements and manufacturing environment. The examples of evolutionary programming of CNC lathe and CNC milling machine tool for different complexities of the blanks and products are presented. The proposed concept showed a high degree of universality, efciency, and reliability and it can be also simply adopted to other CNC machines. 2005 Elsevier B.V. All rights reserved.
Keywords: Manufacturing systems; NC programming; CNC machines; Genetic algorithm

1. Introduction Since the CNC machines are already present in almost all manufacturing systems, the automatic programming of CNC machines became widespread in the last two decades [1,4,6,7]. Thus, nowadays numerous commercial programming solutions, including automatic generation of NC programs, are available. The solutions differ in reliability, efciency, exibility and universality. So far, it has not been possible to trace a universal solution for the programming of NC machines. In this paper we used the genetic algorithms (GA) [2] based approach for programming of CNC lathe and milling machine tool. The proposed concept can be adopted also to other CNC machines for example coordinate measuring machines [5], welding machines, laser and plasma cutting machines [4], robots and manipulators. The concept imitates the natural evolution of living organisms, where in the struggle for natural resources the successful individuals gradually become more and more dominant, and adaptable to the environment in which they live, whereas the less successful ones are present in the next generations rarely. In the proposed concept

the NC programs, represented as weighted graphs, undergo adaptation. During the simulated evolution more and more successful organisms (the NC programs) emerge on the basis of given data on manufacturing environment. Researches have shown that the proposed concept is universal, exible, reliable, and efcient. For the paper to be self-contained the basic terms on turning and milling processes are stated in the beginning of the Section 2. Afterwards the idea of the proposed concept is presented. The coding (i.e., genotype) of the individual NC program (organism), the evaluation of organisms, and the genetic operations used are described. Sections 3 and 4 show functioning of the proposed system. The examples of programming of CNC lathe and CNC milling machine tool for different combinations of exactingness of the blank and product are given. Section 5 summarizes the main contributions of the performed research and also gives guidelines for further researches.

2. Programming of CNC lathe and milling machine tool with GA The objective of turning and milling process is to assure relative motion of the tool with respect to the workpiece. The

Corresponding author. Tel.: +386 2 220 7592; fax: +386 2 220 7990. E-mail address: mbrezocnik@uni-mb.si (M. Brezocnik).

0924-0136/$ see front matter 2005 Elsevier B.V. All rights reserved. doi:10.1016/j.jmatprotec.2005.02.047

1380

M. Kovacic et al. / Journal of Materials Processing Technology 164165 (2005) 13791387

consequence of the relative motion is moving of the tool reference point and, consequently, forming of the desired shape of the product. The tool movement consists of the working and feeding motions. Machining of material takes place in several cuts whose optimum sequence is known in general only for very simple products. Each working motion takes off a certain quantity of material and thus it produces the cuttings. 2.1. Main algorithm The basic idea of the proposed concept will be demonstrated on simple examples. Figs. 1 and 2 show the blank, product and the relevant chips in turning and milling process, respectively. The area of the possible tool (blade) motion is discretized into squares in case of turning and boxes in case of milling. The tool of one square thickness in turning can move discretely up, down, to left and to right, whereas it cuts only to right or downwards. In case of milling the tool can move and cut in the positive and negative directions of axes x, y and z. Due to the discretization of the machining eld the tool reference point is in the middle bottom of the cutting tool (Figs. 1 and 2). The material to be taken off is divided into several cuts consisting of chips. For example, the cut-1 in the bottom diagram of Fig. 1 consists of nine chips, the cut-2 and the cut-3 consist of four chips each, the cut-4 of two chips, etc.

Fig. 2. Blank, product, waste and modes of machining in milling.

Diagrams at the right of Fig. 1 show the types of machining. Due to the discrete nature of the system it is possible to select horizontal, vertical or combined cuts. Fig. 3 shows the main algorithm for programming of the CNC machine tool in the pseudo code. First it is necessary to enter the data on the blank and product. In the proposed concept entering is effected automatically, directly from the CAD modules of the blank and product. The input of the desired type of machining follows. Then the system divides the machining area into the desired number of squares (turning) or boxes (milling). At the end of the data input it is necessary to dene the starting and nal point of the tool motion and the tool reference point. From now on the system is capable of autonomous genetically based generating and optimizing the NC programs through several generations t. The Boolean variable known NC program decides whether the solution from machining previously performed should be used for the initial population or the initial pop-

Fig. 1. Blank, product, waste and modes of machining in turning.

Fig. 3. NC programming algorithm in pseudo code.

M. Kovacic et al. / Journal of Materials Processing Technology 164165 (2005) 13791387

1381

the number of the required tool steps and in the number of collisions between the tool and the workpiece. Before introducing let us dene two important terms: consistency of cuts and consistency of chips. A cut is consistent if at least one chip in the cut sticks to the workpiece. A chip is consistent if it still sticks to the workpiece (i.e. to the consistent cut). Verifying of cuts and chips is very important, since due to fastly changing environment (i.e. workpiece) it is necessary to check continuously which workpiece areas have already been machined or not.
Fig. 4. NC program as a weighted graph.

2.3. Evaluation of population ulation should be initialized completely at random. Each chromosome (organism) in the population P(t) represents a collision-free or a non-collision-free NC program. Of course, in the initial generation most of the programs are noncollision-free. Each NC program consists of feeding motion between the initial point and the initial cut, feeding and working motions between cuts and feeding motion between the nal cut and nal point of the tool. The evolutionary development of solution starts, when the chromosomes have been evaluated. Greater probability of participating in the genetic operations of selection and changing is assigned to the solutions better solving the problem. Selection assures survival of more successful members of population and their progress in unchanged form into the next generation. Changing inuences one or several organisms and creates from them their offspring. After selection and changing a new generation is obtained which has to be evaluated, too. The process is repeated until the termination condition of the process has been fullled. That can be the greatest specied number of generations or sufcient quality of solutions. 2.2. Initial structure: coding of NC program The randomly generated collision-free and non-collisionfree (i.e. feasible and infeasible) NC programs can be represented by a weighted graph (Fig. 4). The vertices of the graphs are working motions (cuts), and the edges between the points are the feeding motions. Each vertex of the graph is connected to all other vertices of the graph. The points and corrections in the graph are weighted. The sequence of genes (i.e. cuts) represents the blade motion from cut to cut. In the graph the two permanent genes (vertices) are the initial and nal point of the blade motion, marked with S and E, respectively. The intermediate vertices (e.g. cut-1, cut-4) represent the cuts subjected to machining. At rst, the tool moves with the feeding motion from the initial point S up to the rst cut, then it proceeds with the feeding motion up to the next cut, it machines it and so on, until it has machined all cuts. Finally, with the feeding cut it reaches the nal point E. The randomly generated NC programs differ in The aim of the combinatory task is to nd such a path through the weighted graph with the initial point S and nal point E that will contain all points in the graph and so that the sum of weights (at the edges and vertices) and of weighted number of collisions will be minimum. In other words this means that it is necessary to nd the optimum collision-free NC program. If, for example, the path through the graph in Fig. 4 is equal to the list: S, cut-1, cut-2, cut-3, cut-4, cut-5, cut-6, cut-7 and E, the sum of the weights at connections and points is as follows: EvalNCx = wNCx = wS-1 + wcut-1 + w12 + wcut-2 + w23 + wcut-3 + w34 + wcut-4 + w45 + wcut-5 + w56 + wcut-6 + w67 + wcut-7 + w7-E + fH, (1)

where NCx is the xth NC program, wS-1 the length of feeding motion from initial point S up to the rst cutting of cut-1, wcut-1 the length of working motion of consistent cut-1, wij the length of feeding motion between the consistent cut-1, wi-E the length of working motion from the last cutting of the last consistent cut i up to point E, f the impact factor, and H the number of collisions. The most demanding operation of the evaluation of the NC program is the determination of the tool path length, consistency of cuts and cuttings and number of collisions. Due to changing of the workpiece shape during machining consequently also the tool path length changes. During the feeding and working motion of the tool the system carefully follows up the blade movement, it continuously veries the consistency of cuts and the possible collisions. Fig. 5 shows the non-consistency of cuts and collision during turning and milling. Fig. 6 describes the procedure evaluation, which contributes most to complexity of programming of the CNC lathe and milling machine tool by genetic algorithms. The procedure includes four most important functions check consistence, check collision, move and cut taking care of verifying the undesirable collision of the tool with the workpiece. The function check consistence supervises sepa-

1382

M. Kovacic et al. / Journal of Materials Processing Technology 164165 (2005) 13791387

Fig. 7. Two possibilities of tool motion from cut i to cut j.

Fig. 5. Consistency of cuts and collision.

last consistent cutting of last consistent cut to the rst cut from the sequence of cuts. The individual cut is machined as long as the cuttings are consistent; complete machining of workpiece is extended until the total number of cuts in the list of cuts has been machined. The number of cuts in the list of cuts depends on the product shape and differs for different workpieces. The procedure evaluation returns the collision number (H), the NC program (i.e. tool path) and the number of tool steps (NC program length). 2.4. Genetic operations After initialization of the initial population of NC programs and its evaluation the population of the organisms must be changed by genetic operations. We used the operations of reproduction (selection), crossover and permutation in case of turning and added the operation of mutation in case of milling [3]. For selection of chromosomes we used the tournament selection. In the operation of reproduction rst one chromosome from the population P(t) is randomly selected and transferred unchanged into the next generation. In the operation of crossover two chromosomes from the population P(t) are randomly selected. Also the point of crossover is selected randomly. Parts of selected chromosomes are interchanged. During the crossover it is necessary to assure that the two offspring contain all cuts from the list of cuts. In the operation of permutation rst the chromosome is selected, then two randomly selected genes (cuts) are interchanged. In the operation of mutation the gene (cut) in the chromosome is randomly selected and the tool motion direction changed. If the randomly selected gene is the cut j (Fig. 7), it is possible for the feeding motion from cut i to cut j to select between two possibilities; the tool can move on the left or on the right (Fig. 7). During mutation of randomly selected gene cut j the direction of feeding motion from cut i to cut j is interchanged.

ration of cuttings from workpiece and thus veries the consistence of cuts. The functions move and cut are intended for simulation of the tool working and feeding motions. The evaluation of the chromosome starts by calling the functions check consistence and check collision which continuously follows up every step of the blade and supervises separation of cuttings from the workpiece and verify the unallowable blade positions. Next, the motion from the initial (specied) tool start point S, to the rst cutting of rst cut in the list of cuts follows. Machining continues until the cuttings of the rst cut from the list of cuts are consistent. The procedure goes on with the selection of the next consistent cut. The feeding motion is executed again this time from the

3. Results of programming of lathe by GA Functioning and efciency of the system are shown on test examples. First, an example of the manufacture of a simple product from a simple blank is shown (see Section 3.1). For detailed presentation of capability of the system and its detailed analysis the example of the manufacture of a simple product from a workpiece of demanding shape (see Section

Fig. 6. Procedure evaluation in pseudo code.

M. Kovacic et al. / Journal of Materials Processing Technology 164165 (2005) 13791387

1383

3.2) and the manufacture of a demanding product from a simple workpiece (see Section 3.3) are presented. In all three cases we want in particular to emphasize the universality, intelligence and autonomy of the proposed concept, the capacity of the system to adopt to dynamic environment (i.e. to changing of the workpiece shape) and the selforganizational improvement to more successful solutions. In all runs of the system the same evolution parameters were used: population size of 50, probability of reproduction 0.2, probability of crossover 0.6 and probability of permutation 0.2. The tournament selection of organisms with tournament size 7 was used. 3.1. Example 1 In this example the goal was to make a relatively simple product from a relatively simple blank. Fig. 8 shows the results of three independent runs. Only the best organisms are shown. In Fig. 8a the system intelligently shortened the machining by a vertical cut at the right side of the workpiece. In this way, shorter tool path and reduced tool wear were assured. From the practical point of view such cutting depth is maybe contestable, since the blade penetrates into the material for as much as four steps. However, it is necessary to emphasize that at this stage of research we tried to assure particularly the exibility and universality of the system, where only simple rules of behavior are permissible such as: (1) the tool can move step by step to left, to right, up and down; (2) the tool cuts only down and to right; (3) damages to blade and machine are not permissible; and (4) the product should be made fastest possible by adhering to the rst three rules. The number of blade steps required for the manufacture of the complete product amounts in this case to 52 and the number of steps, when the tool is in contact with

the workpiece, is 22. Fig. 8b shows conventional solution of the same problem. For the manufacture of the product now 64 blade steps were necessary out of which the tool was in contact with the workpiece for 26 steps. The NC program length and the tool loading in this case are grater for 23.09% and 18.18%, respectively, than previously. Fig. 8c shows the genetic manufacture of the same product from the same blank except that the initial and nal point of the tool movement are different from the previous two cases. The number of steps for the manufacture of the product is 62 and the tool is in contact with the workpiece for 21 steps. 3.2. Example 2 In this example we want to show the intelligence and universality of the system in cases when the blank has demanding shape whereas the product is relatively simple. We start from the workpiece represented by the bold contours (including black squares) and we need the product represented by black squares. The initial and nal points of the tool movement are in the same square. Fig. 9 shows some important solutions during the evolution of NC programs. Of course, the result of random programming of CNC machines in the initial generation is bad. The best organism in generation 0 has the length 94 and the number of collisions is equal to H = 3. Collisions of the tool holder with the workpiece are indicated with grey squares. For comparison let us present the worst NC program in the generation 0. That program has the length of 106 steps and causes as much as H = 11 damages to the tool or workpiece.

Fig. 8. Simple product and three different solutions.

Fig. 9. Simple product and complex blank.

1384

M. Kovacic et al. / Journal of Materials Processing Technology 164165 (2005) 13791387

The worst collision-free NC program emerged in the generation 3 and has the length 80. In the generation 15 the evolution develops the best collision-free NC program of the length of 48 tool steps, which is the best solution in this run. 3.3. Example 3 Generally, the products cannot be made with only one xing of the blade or workpiece. If machining with one xing is not possible, the intelligent system automatically offers the possibilities of re-xing of the blade or workpiece. The system recognizes the workpiece areas which cannot be machined with current xing, it re-xes the blade and repeats the algorithm in Fig. 3. The system automatically denes the sequences of the blade and workpiece xings, it plans and optimizes the machining for the individual xing and warns against the errors in the design concept of the product and selection of the workpiece. Fig. 10a shows initial xing of the workpiece and tool. The blade position is rectangular to the workpiece rotation axis. The system prepares the NC program of the length of 24 steps for that xing within a relatively short time. Since the product is not yet nished, the system re-xes the blade so that the holder is now parallel with the rotation axis of the lathe spindle (Fig. 14b). The system prepares the NC program of the length of 12 steps. The product is not yet completely nished, therefore the system turns the workpiece area for 180 and machines the accessible workpiece areas with the NC program of the length of 14 steps (Fig. 14d). Therefore it marks the unmachined areas. Subsequently, the product can be made by other machining processes or the product or the workpiece can be modied.

4. Results of programming of milling by GA Milling will be represented by machining a simple product from a relatively complex workpiece and by machining relatively complex product from a simple workpiece. In all runs of the system the same evolution parameters were used: population size of 500, maximal number of generations 50, probability of reproduction 0.1, probability of crossover 0.6, probability of permutation 0.2 and probability of mutation 0.1. The tournament selection of organisms with tournament size 7 was used. 4.1. Example 1 In this example of manufacture of a simple product from relatively complex blank is shown. The size of the product is 3 cubes and the size of the workpiece is 20 cubes (Fig. 2). Horizontal machining type in the direction of x-axis was selected (Fig. 2); it means that the cutting were grouped into horizontal cuts parallel with x-axis. Difference between conventional and genetic machining for a given case is shown in Figs. 11 and 12. In the conventional process the proposed machining strategy imposes the product machining in such a way that the tool tries to move during the majority of time of machining in the plane parallel with the horizontal plane (xy plane). By conventional machining type (Fig. 11) the tool made the product in 41 steps. The tool was in contact with the workpiece as much as 13 cuttings. In the new concept let us have a look at the development of one of 20 independently developed civilizations. In the initial generation 0 the result of blind search was relatively bad. The best strategy of the length 41 steps caused the tool breakage only once, if compared with the worst strategy of the initial generation of length 49 steps which broke the tool (or collided with the workpiece) as much as 5 times. The

Fig. 10. Complex product and simple blank.

Fig. 11. Simple product and complex blank (conventional machining).

M. Kovacic et al. / Journal of Materials Processing Technology 164165 (2005) 13791387

1385

Fig. 14. Machining with the rst xing.

Fig. 12. Machining based on genetic algorithm NC programming.

rst collision-free strategy of length 45 appeared already in generation 1. The best strategy of length 33 appeared already in generation 7 (out of 50) and is shown in Fig. 12. The tool was in contact only with 7 cuttings. Conventional machining differs from the genetic machining for 24.24% with respect to the path length and for 85.71% with respect to the tool wear. 4.2. Example 2 In Section 3.3 we mentioned that the products cannot be made with only one xing of the tool or workpiece. If machining with one xing is not possible, the intelligent system automatically offers the possibilities of re-xing of the tool or workpiece. The system recognizes the workpiece areas which cannot be machined with current xing, it re-xes the tool and repeats the algorithm in Fig. 3. Fig. 13 shows the simple blank and complex product. Fig. 14 shows initial xing of the workpiece and tool. The system prepares the NC program of the length of 33 steps for

that xing within a relatively short time. Since the product is not yet nished, the system re-xes the tool (Fig. 15). Fig. 15 shows the process of conventional, gradual cutting of material, executed for the comparison with the proposed concept. Material is cut gradually, layer after layer. Machining is shown depending on the length (percentage of length of path of machining) of the path covered by the tool. The number of steps needed by the tool to make a product during the motion between the initial and nal point is 263 in the rst case. From the point of view of consistence of cuts the system had no difculties since the workpiece was of simple

Fig. 13. Complex product and simple blank.

Fig. 15. Conventional machining with second xing.

1386

M. Kovacic et al. / Journal of Materials Processing Technology 164165 (2005) 13791387

Fig. 16. Second xing: best NC program in generation 0.

Fig. 18. Second xing: best NC program of civilization.

shape. Figs. 1618 will show the development of the civilizations of NC programs after the workpiece re-xing. NC programs are made and improved gradually, from generation to generation. In the initial generationgeneration 0, the NC programs are randomly created. Fig. 16 shows the machining (percent-

Fig. 17. Second xing: best NC program in generation 10.

age of length of the machining path) according to the best NC program created in generation 0. The path length of the best NC program in generation 0 amounts to 257 steps, which is less than the tool path length in case of conventional machining type. The tool holder did not hit the workpiece. Apparently chaotic tool motion on the basis of the randomly created NC program does not give the impression requiring reduction of the machining length. The paths created in advance, obtained from the geometrical data on the product, workpiece and tool do not represent accurately determined tool paths in case of the proposed concept, but they are only the guidelines between which the tool selects and, consequently, optimally moves intelligently by taking two simple instructions into account: make the product soonest possible and do not injure yourself and the environment. With the same tool wear as in case of the conventional machining method the productivity increased for 2.28%. Fig. 17 shows the tool travel with respect to the best NC program in generation 10. The path length of the best NC program in generation 10 amounts to 183 steps which means that the productivity has been increased for 30.41% if compared with the conventional machining. The tool holder did not hit the workpiece. Fig. 18 shows the tool travel with respect to the best program of the generation 45, where the best NC program of the civilization appeared. The path length of the best NC program in the civilization amounts to 137 steps, which means that productivity was increased for as much as 47.90% if compared with the conventional machining.

M. Kovacic et al. / Journal of Materials Processing Technology 164165 (2005) 13791387

1387

5. Conclusion In the paper we presented the concept of automatic programming of CNC lathes and milling machine tools by the method of genetic algorithms. Researches have shown that the proposed system of evolutionary searching for optimum NC program is efcient and universal, therefore it can be used also for programming of other NC machines (for example coordinate measuring machines, welding machines, laser and plasma cutting machines, robots, manipulators, etc.). First, the proposed intelligent system hierarchically divides the task of product machining into sub-tasks: xing, cuts and cuttings. Then, it determines the sequences of xing and intelligently prepares the NC programs for the individual blade and workpiece xing. The system prepares the strategy of machining by means of simple rules for the tool movement. More and more optimal NC programs appear gradually, from generation to generation, as a consequence of interactions between the tool and the workpiece dynamic environment. Special emphasis is put on the evaluation of machining strategies. Due to complexity of the problems and size of the solution searching space we used the genetic algorithm method imitating the biological evolution of living beings. The system is capable of autonomously planning the machining technology, detecting the machined and unmachined workpiece areas, planning and optimizing the tool working and feeding motions, detecting the collisions and verifying whether the product cannot be completely machined on a certain machine.

A disadvantage of the system is the discretization of the machining eld, which considerably contributes to the time exactingness of searching for optimal solutions. Therefore, in future the researches will be oriented particularly towards conceiving an improved system with the possibility of use of different types of machining (rough machining, ne machining) and different tool shapes. The system will also be improved so that in the future it will be possible to use different cutting parameters of the tool (geometry, cutting depth, feeding).

References
[1] G. Vosniakos, An intelligent software system for the automatic generation of NC programs from wireframe models of 2-1/2D mechanical parts, Comput. Integr. Manufact. Syst. 11 (1/2) (1998) 5365. [2] J. Holland, Adaptation in Natural and Articial Systems, The MIT Press, Massachusetts, 1992. [3] M. Gen, R. Cheng, Genetic Algorithms and Engineering Design, Wiley, Canada, 1997. [4] M. Kovacic, J. Balic, Evolutionary programming of a CNC cutting machine, Int. J. Adv. Manufact. Technol. 22 (1/2) (2002) 118124. [5] M. Kovacic, M. Brezocnik, Genetic algorithm method for computer aided quality control, in: Proceedings of the Third Research/Expert Conference with International Participation, Quality 2003, 2003, pp. 125130. [6] S. Chao-Ton, C. Mu-Chen, Computer-aided optimization of multi-pass turning operations for continuous forms on CNC lathes, IIE Trans. 31 (7) (1999) 583596. [7] Y. Lin, An adaptive tool path generation algorithm for precision surface machining, Comput. Aided Des. 31 (4) (1999) 237247.

S-ar putea să vă placă și