The Methodologies of Automatically Analyzing the Similarity of Processes Based on Features Abstracted From NC Codes

It is difficult to draw the similarity correlation degree of the process features from NC codes since the NC codes do not represent the process features directly. This research works at the methodologies of automatically analyzing the similarity of process based on features abstracted from NC codes to improve the group efficiency. Employing the NC codes’ advantages of the clear and stable structure, good readability, taking the similarity principles as the theoretical foundation, this research regards the NC codes as similar systems to study on the problem of automation for similarity correlation comparison of process features. A detailed and concrete case study demonstrates the specific steps of the process features modeling and similarity comparison of the NC codes. The calculation and comparison shows the effectiveness of the method, which provides the foundation for group automation.


INTRODUCTION
It is an effective approach of upgrading the processing efficiency though applying the group technology to the scheduling of the processing resources (Jeffrey, 2007;Brent, 2007;Wu and Lee, 2008).The basic method is that the process features of the parts are classified according to the similarity and then the same process features are distributed to the relevant processing unit, so that the debugging time is saved and the processing efficiency is upgraded (Surjit et al., 2008;Nomden et al., 2008).However, in real practice, group technology still hasn't played remarkable roles in the aspect of scheduling optimization of the NC resources due to the following reasons: different from the common processing tasks, the NC tasks present themselves in the form of NC codes and it is hard to obtain the process features of the NC tasks intuitively, consequently at present it's still cumbersome and manual work to abstract the process features of the NC tasks and differentiate the similarity.It is nearly an impossible task to accomplish the abstracting and differentiating manually when there are a great amount of NC tasks for scheduling.Therefore abstracting the process features and similarity differentiating of the NC codes automatically are the main bottleneck problem that restricts the application of the group technology to scheduling optimization of the NC resources.Aiming at this problem, employing the NC codes' advantages of the clear and stable structure, good readability and taking the similarity principles as the theoretical foundation, this study studies on the automatization problems of abstracting process features and similarity comparison based on the NC codes and presents methods and tools for promoting group technology to apply to scheduling optimization of the NC resources.

NC CODES' PROCESS FEATURES MODELING
The modeling strategies for the NC codes' process features: The NC codes have the advantages of the clear and stable structure, good readability (LAN et al., 2008;Hao et al., 2008), which make the automatization of NC tasks' feature analysis possible (Tobias and Dirk, 2007;Karunakaran and Shringi, 2007;Yau and Wang, 2007).However, as the formal structure of the NC codes is designed only for NC programming and NC processing, it is needed to construct the models of mapping features that are fit for reflecting the correlative features of process similarity in order to implement the similarity correlation analysis of the process from the NC codes.The process features that the NC codes can reflect include basic features and module features.The process of modeling the process features is just the course of abstracting basic and module features from the NC tasks.
Basic features are inherent in the NC tasks, which include the processing time, the state of machine tools and so on.As the NC codes reflect the basic features of the process directly, therefore, the basic features of the process need not to be transformed from the NC codes and can be constructed directly from the NC codes.The module features are proprietary features of the NC tasks facing the analysis of the similarity correlation relation with the main aim of realizing the modularization of the NC tasks' process features.
One of the two bases on which the module features of the NC tasks are built is the application of the mode codes and non-mode codes in the NC program.For example, it is always available of the linear interpolation G00 before being replaced by the G codes of the same group.Meanwhile, it could be thought that the machine tools are in the state of reamer's orientating all along, so this section of the NC codes that the G00 acts can continually be divided into an orientating module and describe or analyze its features unitarily in the viewpoint of system.According to the analytical method similar to the mode codes, the process features of non-mode codes can be analyzed regarding a line of the NC program as a whole, since which only act on the programming row coming forth and in the course of modeling.
Another base on which the module features of the NC tasks are built is the influencing degree of which the NC codes act upon the features of the parts.Parts' features are the reflection of the process features and the process features are decided by the NC codes, therefore, the models of the process features can be built according to the influencing degree of the parts' features and the section of the NC codes that forms the similarity features can be divided into the relevant modules of the NC tasks.
In a word, the module features of the process of the NC tasks can be built by modularizing the NC tasks according to the above two bases of modeling, after analyzing the NC codes line by line.
The hierarchy models' structures of the NC tasks' process features: In order to expatiate conveniently, the following concepts are defined first: Process travel: in a specific coordinate mode, the total tracks formed by the reamer driven by a section of the NC codes, including the tacks formed at the time of locating and feeding.
Relative Process Travel: in a specific coordinate mode, the displacements of the reamer in the direction of each coordinate axis driven by a section of the NC codes.
Feed travel: the route of the reamer from cutting-in work pieces to cutting-out work pieces, driven by a section of the NC codes.
Location Travel: the route of the reamer from cuttingout work pieces to before cutting-in work pieces again, driven by a section of the NC codes.
Met code: the section of the NC codes that can drive the reamers to finish a combination of location and feed traveling, including two courses of quick-locating and feed processing, which is the basic unit of the NC tasks facing the analysis of correlation relationship.
Feature code: the combination of the mate codes and correlative procedure lines that can drive the reamer to accomplish some feature part of work pieces.
The process feature models of the NC tasks facing the similarity correlation analysis are made up of two parts of models of basic features and models of module features.The model of basic features, which is mainly numerical model and is made up of the basic features of the NC tasks, can be obtained by calculating and matching of the function codes.The model of module features is a model of hierarchy structure and according to the strategies of modeling, combining the ordinary syntax structures of the NC tasks; it can be expressed by BNF (Backus-Naur Form) as follows: Stipulate that denotes A probably being any number of 0～n, which is abbreviated to {A}.
<NC From the BNF mentioned above, the feature models of the NC tasks are divided into five hierarchies, which are address symbol hierarchy (including line number, address and number), program line hierarchy, feed travel hierarchy and location travel hierarchy, metacodes hierarchy and feature codes hierarchy.The information to which each hierarchy pays attention is different from each other.

The Method Of Recognizing The Process Features:
The process feature modeling of the NC tasks includes three levels of modeling strategies, structure modeling and feature recognizing.Modeling strategies are the theoretical basis of the structure modeling and the destination of feature recognizing is to abstract process features of the NC tasks from the structure models, which is convenient for the final correlative analysis of the process similarity.The recognizing of the two kinds of process features will be expatiated, respectively as follows: • The calculation and recognizing of the basic features: The time of locating reamer and the time of feed can be calculated accurately according to each coordinate axis' fast moving speed, feed speed and feed tracks of the machine tool.Feed tracks can be obtained in different interpolation modes, according to the initial and final X, Y, Z values of each axis in the NC codes.The concrete calculation of tasks' processing time is showed in formula (1): where, is the total track of the reamer for the ith time of feed travel: The state of machine tool includes the setting of reference frame of work pieces, the choose of size types, the state of the rotate speed of the machine tool's principle axis, the state of the cutting liquid, changing reamers and the complete of reamers and so on.These features are all determined, in the NC codes, by the function codes, key words and other words.Therefore, the NC tasks can be divided into the line-by-line NC programs by setting up the interpreted machine of the NC codes and the strategies of reading-in the NC codes line-by-line and recognizing character-by-character, then make the character matching of the key words table of the NC codes in the system character-by-character and function recognizing, so the relative process features can be abstracted.The hierarchy of metacodes: it is obtained from the definition that, both location travel and feed travel are intact program section and the nesting between travels is not allowed.As at the time of processing, reamer must be located first so as to feed process, so location travel and feed travel usually come forth by turns, nay, without intervals.The program section of no-interval location and feed travel makes up metacodes, a section of which has exactly one location and one feed travel.
The hierarchy of feature codes: If multi-metacodes and multi-line complex processing program drive reamer to operate and process again and again in the region of a certain part, forming an item of part feature, therefore these metacodes and program lines compose a module of feature codes.The hierarchy of feature codes is made up of multi-modules of feature codes.
It is not isolated between lines in recognizing of the NC codes' process features and the rules in incompact and coupling NC program can be found and recognizing rules be set ups, feature recognizing be completed.The recognizing rules are described as follows: Rule 1: If the program section begins with G00 or other location codes and ends up with non-location codes, well then this section of codes composes "location travel" Rule 2: If the program section begins with G01, G02, G03, G06, G33, G34, G 35 which belong to G group a1 or begins with other feed codes, also ends up with non-feed codes, well then this section of codes composes "feed travel" Rule 3: If the program section begins with "location travel" and ends up with "feed travel" and does not contain "program line", well then this section of codes composes "metacodes" Rule 4: If the difference value's modular value of the "relative processing travel" of the contiguous "metacodes" in program section is smaller than K, well then the contiguous "metacodes" are the elements of the same "feature codes"(K is the user-defined constant of the part features, used to reflect the partial feature ambit of the part.)Rule 5: If the program line of the program section falls short of the above four rules, well then this line composes "program line" According to the above three sectors of modeling strategies, structure modeling and feature recognizing, the feature modeling facing the process features of the NC codes could be realized, that is, the structure modeling of the process features and the recognizing of the process features could be realized.

THE ANALYTICAL METHOD OF PROCESS SIMILARITY CORRELATION
The analytical method of process similarity correlation based on similarity principle: The similarity principle refers that there exist some different quantities of similarity elements and features among systems and the extent of similarity among systems can be determined according to the numbers and values of the similarity elements among systems (Hung and Yang, 2008;Xu and Chen, 2008;Hu and Su, 2008).Supposing that system A is composed of k elements and system B is composed of l elements, the similar elements between the two system are n, the similar extent of each similar element can be reflected by similarity unit, the similar extent among systems is denoted by Q, called similarity, then the mathematical model of the similar system could be achieved.
The basic conception of this study is to investigate the similarity among systems regarding the NC codes as one system.Supposing NC program A and B, {address symbols, numbers, program lines, metacodes, feature codes}, in the child nodes of program lines A and B, the similar elements of the address symbols are m features in common, which can be denoted in turn (the superscript is the number of the features in common and if, it could be omitted.),the situation of the child nodes' similar unit of the program lines A and B is now discussed.Marking and respectively are the feature values of the elements and relative to the same feature , then the coefficient of proportionality of this similar elements' feature value can be used to measure their similarity. Define: where, has the value field [0, 1].When, it shows that the effect of the elements and relative to the same feature is same, while, it shows the effect is completely opposite.According to the weighted adding method of each feature value, the numerical value expression of the similar units is: where, is the weight of the similar elements and the similarity extent of the similar elements can be measured by .If the NC program similar systems A and B exist similar units of the program line child nodes, then the similarity of the program line's last node can be shown as: where, is the weight of similar units, reflecting the magnitude of the extent that each unit affects the system similarity.
The system being usually multilevel, similarity principle should first be used in different system hierarchies respectively.The relationship of different hierarchies is subject and that of same hierarchies is constitutional.The aggregate total of the composing elements in the system is an element for high hierarchies and is a system for low hierarchies.The numerical values of the similar units reflect the similarity of the elements in a system or system similarity.Via multilevel integrated judgment, the values of similar units of different types and different hierarchies can be determined; which indicate the magnitude of the similarity extent.
The process feature model facing similarity correlation analysis is a typical multilevel system.According to the grammar structure, beginning with the root nodes from bottom to top, the similar elements can be abstracted hierarchy by hierarchy, respectively from address hierarchy, program line hierarchy, feed travel and location travel hierarchy, metacodes hierarchy and feature codes hierarchy, constructing similar units and then the calculation is carried out hierarchy by hierarchy form bottom to top adopting the method of numerical value judgment of the similar elements, finally, the scientific decision of the whole NC program system's similarity is made.
The distribution of the weight and the choosing of features is critically important in the course of judging, which directly affects the correctness and reliabilities of the judging results.As the function of each hierarchy's structure in the NC program is different, so are the similar elements abstracted and the factors constructing the similar units, therefore the mutual relationship between each hierarchy, each element of the hierarchy should be considered synthetically when choosing the weight of the similar units.The study will apply analytic hierarchy process to solve the problem on weight decision of similar systems.
The method of deciding weight of the similar system based on analytic hierarchy process: Analytic Hierarchy Process is an analytical method combining the qualitative and the quantitative and being systematic and hierarchical (Noorul and Kannan, 2006;Fuat and Fatma, 2006;Venkata, 2008).High precision usually needn't in the AHP and the maximum Eigen value and the eigenvector can be obtained by the approximate method.At present the commonly used and proved quite valid approximate calculation methods are squire-root method, sum method, the logarithmic least square method and the least square method and so on.The conventional squire-root method will be used in this study to solve AHP.
The squire-root method geometrically average each column vector of the judge matrix A, then normalize, obtaining the column vector, that is, the scheduling weight vector of A. Its formula is: where, expresses the weight of the ith factor; expresses the ratio of the effect the ith factor and the jth factor of this hierarchy against a factor of the last hierarchy; n, k express the number of the factors this hierarchy.
According to the process feature model of the NC codes, the factors that affect the processing results of the NC tasks are mainly made up of the feature codes, metacodes, location travel, feed travel and program lines.
In order to determine the extent of relative importance of the index layer's elements, it is needed to obtain relative weight of each element of the rule hierarchy relative to the target hierarchy, that is, quantify each element of the rule hierarchy relative to total goal-the similarity of process features, meanwhile, it is needed to work out the relative weight each index element relative to each element of the rule hierarchy.As the function of each hierarchy is different in the NC program and so are the elements that affect the proposing of similar elements and the construction of similar units.For each hierarchy, different similar elements and features are chosen.

THE CASE STUDY
We expatiate above on the theory and method of process feature modeling and similarity comparing of the NC codes in terms of feature structure modeling, feature abstracting and process similarity comparison of the NC codes.In this section an example is taken to demonstrate the concrete practicing steps of the above theory and methods.
The technical steps of the similarity correlation analysis of the NC tasks are shown as follows: Step 1: Read-in the NC codes from text files then check the syntax Step 2: Calculate and recognize the basic features and set the target system according to the processing time Step 3: Make the recognition of the structure of module feature according to the key words of the codes of the NC tasks Step 4: Modularize the NC tasks on the basis of module features, meanwhile, abstract similar elements according to module feature and construct similar units Step 5: Make weight calculation and distribution of each module of the target system and compute of the similarity of the system waiting for estimating Taking two sections of simple NC codes in FANUC system for example, the modeling and the calculation process of the method mentioned above are described in detail.O0001 N01 T01 M06 N02 G54 G90 S400 M03 T02 N03 G00 X 1.0 Y 1.0 N04 G43 H01 Z 0.1 M08 N05 G01 Z -1.5 F4 N06 G00 Z 0.1 M09 N07 G91 G28 Z 0 M19 N08 M30 O0002 N01 T02 M06 N02 G54 G90 S400 M03 T01 N03 G00 X 2.0 Y 1.0 N04 G43 H02 Z 0.1 M08 N05 G01 Z -1.2 F5.5 N06 G00 Z 0.1 M09 N07 G91G28 Z 0 M19 N08 M30 Setting the program section O0001 being system A, the program section O0002 being system B, the both systems contain 8 program lines and 25 numerical orders of address symbols.According to the treestructure the analysis and calculation are carried on from top to bottom.The following shows the concrete calculation course of the program line N01.
The degree of similarity between the two NC tasks can be worked out as 0.8679 according to the steps and equations above.It is known there out that the NC program A and B have the great similarity and in practical processing and scheduling, the grouped disposal of processing could be carried out.

CONCLUSION
Aiming at the problem on the automatization of process feature comparison of the NC codes, employing the NC codes' advantages of the clear and stable structure and good readability, this study puts forward the methodologies of automatically analyzing the similarity of process, abstracting from NC codes.The detailed technologies, such as the NC tasks' process feature, recognizing rules of the process features, the tactic of determining the weight of similar system, are illustrated.A detailed and concrete example demonstrates the efficiency of the novel methods, which will provide the well foundation for group automation.
beginning and ending coordinates of reamer, for the ith time of location travel, moving along the axis for the jth time y LEij , y LBij = The beginning and ending coordinates of reamer, for the ith time of location travel, moving along the axis for the jth time z LEij , z LBij = The beginning and ending coordinates of reamer, for the ith time of location travel, moving along the axis for the jth time v mx , v my , v mz = The fast location speed of the machine tool v F = The feed speed of the machine tool t Ct = The time of changing the reamer for the tth time t O = Other time; m, n are the numbers of feed travel and location travel of the NC task

•
The recognition of module features: The recognition of module features is carried out hierarchy-by-hierarchy from bottom to top of the beginning at the hierarchy of address symbol, according to the modularization structures of the NC codes and with the principle symbol of function codes' key words of the NC codes.The following describes the foundation of recognizing the features and the elements in each hierarchy.The hierarchy of address symbol: Both the function codes and the numbers of address symbol in the NC program were divided into the elements of the hierarchy of address symbol.The function codes include the G order with preparation function, the M order with assistant function, the F order with feed function, the S order with the principal axis speed function, the T orders with reamer function codes and so on.The numbers of the address symbol are made up of the address symbols of X, Y, Z expressing coordinate parameters and their relative values.The hierarchy of the program line:It is built up according to the original line structure of the NC program line and dividing all the program lines of the NC program into the elements of program lines.The hierarchy of feed travel and the hierarchy of location travel: The elements of this hierarchy are made of organically fitting together program lines according to its definition and the module codes of the NC program.