- About this Journal
- Abstracting and Indexing
- Aims and Scope
- Annual Issues
- Article Processing Charges
- Articles in Press
- Author Guidelines
- Bibliographic Information
- Citations to this Journal
- Contact Information
- Editorial Board
- Editorial Workflow
- Free eTOC Alerts
- Publication Ethics
- Reviewers Acknowledgment
- Submit a Manuscript
- Subscription Information
- Table of Contents
Advances in Mechanical Engineering
Volume 2013 (2013), Article ID 357308, 9 pages
Software Fault Location of CNC System Based on Similar Path Set and Artificial Neural Network
1Ningbo Institute of Technology, Zhejiang University, Ningbo, Zhejiang 315100, China
2College of Mechanical Science and Engineering, Jilin University, Changchun, Jilin 130022, China
Received 23 April 2013; Accepted 26 August 2013
Academic Editor: Mehdi Ahmadian
Copyright © 2013 Xiuhua Yuan et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
The assurance of software reliability of the CNC system is difficult to realize with the continuous increase in the computational complexity and software scale of the CNC system. Therefore, there is an increasing demand for efficient methods that are able to locate the defect codes quickly and accurately. This study proposes a practical fault location method which is based on the similar path set and artificial neural network (ANN). The detailed fault location process involves the following steps: (1) according to the execution information recorded by the monitor, the failed path is generated; (2) the similar path set is obtained from the control flow graph and the failed path; the ANN is trained by the learning sample which is composed of the failed path and the similar path set; (3) the defect code is judged by ANN. The results of the fault location experiment on the interpolation module showed that the proposed method located the software fault quickly and accurately without depending on the experience and intuition of maintainers.
The development trend in the high speed, high precision, integration, and intelligence of the CNC system has led to the continuous increase of software scale and computational complexity. It is always a challenge to improve its reliability [1, 2]. Therefore, there is a high demand for efficient methods that are able to locate the defect codes quickly and accurately. Although the FMEA and FTA methods have been successfully used for analyzing faults of the machine body [2–5], they cannot locate the defect codes effectively. When the software breaks down, the common methods for locating the fault are analyzing memory dump and inserting print statement , which largely depends on the experience and intuition of maintainers. As a result, they are not ideal methods for identifying the defect codes.
An important improvement in failure location is the conclusion that the fault will happen in the case of defect code being passed by execution trace . Agrawal et al. [8, 9] proposed that the fault location can be obtained by subtracting successful set of sentences from the fault-set. However, this method fails to locate the defect code effectively. Renieris and Reiss  tried to use the “nearest neighbor” to locate the faults by comparing a failed path with a successful path that was most similar to the failed path. However, they can only choose the most similar path without taking other paths into consideration, which results in a poor failure location. Hence, these two methods are not effective at locating the fault quickly and effectively.
To overcome the shortcomings of the above methods, this study proposes a new method to locate the CNC system failure based on similar path set and ANN. When the CNC system works properly, the monitor keeps recording the input and output values and the execution paths of the software module. If a failure occurs, the failed path is generated according to the execution information recorded by the monitor. Then, the similar path set is obtained from the control flow graph and the failed path. Finally, the defect code is judged by ANN.
2. Structure of Software Fault Location of CNC System
Due to programming errors, some bugs can be easily introduced at the stage of software design; however, not all bugs can be excluded in the stage of software testing, which causes maintainers a lot of trouble. In order to reduce the economic loss caused by bugs, an efficient method that is able to locate the defect code quickly and accurately is highly required. It is well acknowledged that the execution path differs from the normal path when the failure occurrs, and these differences cover the detailed defect information.
This study proposes an innovative method in which the defect code can be located by ANN comparing the differences between the failed path and the similar path set. In the light of the airplane black box, each branch of software modules is inserted with a pile, and the monitor is designed accordingly. The structure of software fault location of CNC system is shown in Figure 1. When the CNC system works properly, the monitor keeps recording the input and output values and the execution path of software module. When the software of CNC system breaks down, the detailed fault location would involve the following steps.(1)The failed path is generated according to the execution information recorded by the monitor.(2)The control flow graph is established by analyzing the source codes of the software module.(3)The similar path set is obtained from the control flow graph and the failed path.(4)The feasibility of similar paths was judged by using the historical execution tracks recorded by the monitor.(5)The ANN is trained by the learning sample which is composed of a failed path and a similar path set.(6)Finally, the defect code is judged by inputting the virtual path into ANN.
3. Monitor of the CNC System
The black box can record the flight data and cockpit voice when the airplane is working . If airplane crashed, the fault analysis can be carried out by replaying the information recorded by the black box. Similar to the airplane’s black box, this study will design the software monitor which can help to locate defect codes of the CNC system. In this case, the monitoring of the CNC system should offer the same attractive features as the airplane black box. For example, when the CNC system is working, as much information as possible can be recorded. Moreover, the system recourse occupied by the monitor should be small enough to ensure the least interference towards the CNC system.
As shown in Figure 2, the first step of designing the monitor of the CNC system is numbering the modules of each level. Each serial number corresponds to a layer of the module. Take the first 2 rows, for example; the main module in the first row is characterized as number “1”; in the second row, the module is marked as “1.1” for the compiler module, “1.2” for the interpolation module, “1.3” for the servo module, and so on. In the same way, the numbering continues until the module reaches the level of class or function. Also, the relationship between module name and its according number is stored in the database, which provides the base for the fault location.
The second step of designing the monitor is piling up modules of each level and recording their execution paths. As presented in Figure 3, the paths include , , , , , and , and the piles are inserted into each branch of the software module. The array for m_path  presents the execution path of the software module. If the execution trace covers any branch of the software module, the value of the corresponding element is “1”; otherwise, it is “0”. Take the execution path “”, for example. The obtained value of m_path  is “1100110”. Therefore, the structure can present the running information of the software module as in Algorithm 1.
At work, the monitor instantiates the structure, when the execution trace arrives at the entrance of the software module. Then, the monitor assigns the element of the structure, and stores this structure in the database at the exit of the software module.
4. Similar Path Set
The detailed procedures for solving the similar path set involve analyzing the control flow graph established by the source code, searching for unconstrained edges, replacing the unconstrained edges of failure path, and judging the feasibility of similar paths.
4.1. Control Flow Graph
The control flow graph is a graphical representation of the program’s control flow, by which the structure of the program can be conveniently analyzed. The control flow graph consists of a set of nodes and directed edges . The node represents the predicate of the program, and the directed edge represents the branch of the program. It is assumed that is the entry directed edge and that is the exit directed edge of the control flow graph. That is, any other directed edges in the control flow graph can be reached by and . The directed edge dominates the directed edge if every path from the entry directed edge to contains . The directed edge implies the directed edge if every path from the directed edge to the exit directed edge contains . The directed edge is an unconstrained edge only if does not dominate any other directed edge and is not implied by any other directed edge in the control flow graph. In other words, if the directed edge is unconstrained edge, there is at least one path from the entry directed edge to the exit directed edge , which does not contain .
4.2. Similar Path Set
The basic idea of the similar path set algorithm is shown in Figure 4. As shown in Figure 4, the path is a failed path, and the path is a similar path. This similar path is generated by replacing the unconstrained directed edge in the failed path with other directed edges in the control flow graph. In this study, the distance is used to reflect the difference between two paths, which is denoted as . The larger the distance between two paths, the lower the similarity of the paths. The calculation steps of distance are shown as follows: the initial value of is zero; only the unconstrained directed edge in the failed path is equal to that in the similar path; the has no change; else if each of the unconstrained directed edges in the failed path can align with, but not equal to, that in the similar path, the increases by 1; in another case, if each of the unconstrained directed edges in the failed path cannot align with that in the similar path, the also increases by 1; eventually, the value of is the distance between two paths.
As shown in Figure 5, the algorithm of the similar path set is based on “replacing the unconstrained directed edge filling in blank of the discontinuous path.” The algorithm is performed as follows: firstly, the control flow graph, and the failed path are established according to the program module; secondly, all unconstrained directed edges are worked out from the control flow graph and the unconstrained directed edges in the failed path are marked out; the subpaths ( and ) can be obtained after breaking off the failed path at the unconstrained directed edge; then, new similar paths can be achieved through combining subpaths ( and ) to a kind of subpaths which can replace the unconstrained directed edge; finally, the distance between the failed path and similar path is calculated, and a new similar path is added to the similar path set; this step continues until no other subpaths can be found in the control flow graph; this cycle continues until no other unconstrained edges in the failed path can be replaced. After the similar path set is built up, the feasibility of the similar path is verified. The test case of similar paths can be found in the execution information database because a large set of successful execution information was recorded by the monitor in the past.
5. ANN Recognition
An ANN is a programmed computational model that aims to replicate the neural structure and functioning of the human brain. Thus, it has the ability to generalize and learn [12–14]. In order to improve previous fault location methods, we use ANN to find the defect code in the failed path. In this study, the input is the directed edge coverage of an execution path which indicates whether the directed edge in the failed path is covered by the execution path. The output is the result (success or failure) of the corresponding execution path. Once ANN has been trained, the coverage of the virtual execution path with only one directed edge in the failed path is used as an input to compute the suspicions of the corresponding directed edge in terms of its likelihood of containing a defect code. The larger the value of the output is, the more suspicious the directed edge seems to be. The directed edges in the failed path can then be ranked in a descending order of their suspiciousness, and the directed edge with the largest suspicion contains defect code.
5.1. Learning Sample of ANN
We constructed a three-layer BP ANN (backpropagation artificial neural network) with input layer neurons (each of which corresponds to one of the directed edges in the failed path) and one output layer neuron (corresponding to the result (success or failure) of the execution path). In addition, there is a hidden layer with units between the input and output layers, shown in Figure 6. In this paper, the input is expressed as with the th unit corresponding to theth directed edge in the failed path . If the execution path covers the th directed edge in the failed path , theth unit has a value of 1; otherwise, it has a value of 0. The output is expressed as , which is the level of suspicion of the execution path.
Each neuron in the hidden layer uses the Log-Sigmoid function as its activation function. The output of theth unit in the hidden layer is shown as follows: where is the number of neurons in the hidden layer and is the weight associated with the link connecting theth neuron in the input layer and the th neuron in the hidden layer.
The neuron in the output layer uses the line function as the activation function. The output of ANN is shown as follows: where is the number of units in the hidden layer and is the weight associated with the link connecting theth neuron in the hidden layer and the neuron in the output layer.
When locating the software fault of CNC system, suppose that we have a failed path with directed edges, which can be expressed as . The directed edge is the th directed edge in the failed path and is also the th directed edge in the control flow graph. Suppose that the failed path has similar paths and that execution path contains one failed path and similar paths. Let , and , be the th execution path, the coverage vector, and the execution result (success or failure), respectively. The coverage vector provides the information on how the failed path is covered by the similar path . Here, the coverage is repressed in terms of which directed edges in the failed path are covered by the execution path . The failed path and similar paths should be converted into the learning sample of ANN, which is shown in Figure 7.
In this study, the th learning sample can be expressed as , where and are the input vector and the output value of ANN, respectively. The input in the th learning sample can be expressed as , where
The value of depends on whether the execution path succeeds or fails. It has a value of 1 if the execution path fails and a value of 0 if the execution path succeeds:
5.2. The Identify of BP ANN
Once ANN is trained, it has learned good mapping between the input (the execution path) and the output (the corresponding execution result), and it can identify whether a new execution path is a fault path. Moreover, it can judge whether an execution edge in the failed path contains a bug. To do so, this paper uses a set of virtual execution paths as the input to ANN, which covers only one directed edge in the failed path. The set of virtual paths can be expressed by , as shown in Figure 8.
After inputting the virtual path into the ANN, the output of ANN is the level of suspicion of the corresponding directed edge in a failed path. The larger the value of suspicion is, the more likely the directed edge will be faulty. Virtual paths are inputted into the ANN in order, and the suspicion of the directed edges is obtained, which is expressed by . All directed edges are ranked in order of suspiciousness, and the directed edge with the largest value of suspicion is the fault edge.
6. Analysis of Fault Location of CNC Software
In virtual axis machine tool , the experiment on fault location of CNC software was carried out. The principle of NURBS interpolation can be found in [16–18], and the control flow graph of NURBS interpolation was shown in Figure 9. Also, the bug was injected into the program of NURBS interpolation beforehand, and the defect code was the 25th line code. The piles were inserted in each branch of the program, and array for m_path  denoted the execution paths. In the working process of NURBS interpolation, the execution information recorded by the monitor was written in the database.
While interpolating the NURBS curve (Figure 10), the program for NURBS interpolation failed (Figure 11), expressing the chord error as larger than the defined maximal chord error. To provide a detailed description of NURBS interpolation, the interpolation parameters were defined as follows: the control points were ; the weight vector was ; the knot vector was ; the speed command was 4 m/s; the sampling time was 2 ms; the maximal allowable acceleration/deceleration was 5 m/s2; the maximal allowable chord error was 2 µm. When the interpolation point was at , the chord error in Figure 11 was 2.419 µm, which was larger than the maximum allowed chord error. Hence, when the interpolated point was at , the program encountered failure.
The location for the above fault involved the following steps. To begin with, the control flow graph (Figure 9) was generated according to the program of NURBS interpolation. Next, the failed path was identified as through analysis of the execution information reordered by the monitor. Then, all of the unconstrained edges in the control flow graph were determined, according to the relationship between the edges. The unconstrained edges were , and only were in the failed path . After that, by breaking off the failed path at the unconstrained edges and by combining other unconstrained edges with subpaths ( and ), the similar path set was established as follows: , , , , , , and , and all of the obtained distances between similar paths and failed paths were 1. According to the execution information recorded by monitor in the past, only the similar paths were feasible. Finally, the defect code was identified by ANN.
As mentioned above, there were five similar paths and one failed path. So, the learning sample of BP ANN in this experiment can be expressed as , , , , and . In BP ANN, the input layer had six neurons corresponding to six directed edges, and the output layer had only one neuron. In addition, the hidden layer had four neurons. Each neuron in the hidden layer used the Log-Sigmoid function as the activation function, and the neuron in the output layer used the line function as the activation function. In BP ANN, both the learning rate and prediction accuracy were set to 0.01, while the maximum iteration number was set to 200. At each iteration, BP ANN calculated the average output error and adjusted every weight. The BP ANN was carried out based on MATLAB, and the average output error at each iteration was shown in Figure 12. After 95 iterations, the average output error was 0.0098252.
After BP ANN was trained, the virtual execution paths such as , , , , , and were input, respectively, to the BP ANN. The output of BP ANN was suspicious of the directed edge, which was shown in Table 1.
As indicated in Table 1, the directed edge with the largest degree of suspicion was . The directed edge included the codes in the twenty-fifth and twenty-sixth lines. The program code in the twenty-fifth line was deleted by the program slicing technique because this code had nothing to do with calculating the results of NURBS interpolation. Therefore, the program code in the twenty-sixth line was defect code, and the result was consistent with the code in which the bug was previously inserted. ANN can simulate certain behaviors of biological nervous systems and has the ability to learn and make judgments. So, the proposed method was able to locate the software fault quickly and accurately without dependence on the experience and intuition of maintainers. Hence, this method was effective in software fault location of the CNC system.
In summary, the application of a similar path set and ANN is very effective in establishing the fault location in the CNC software. The monitor can record the execution information in real-time during the operation of the CNC software. When the CNC software fails, the fault location can be carried out by the algorithm of the similar path set and ANN, and the experiment regarding the fault location of the NURBS interpolation module is carried out. The results of the above experiments show that the proposed method is a quick and accurate method in locating the fault in the CNC software without depending on the experience and intuition of maintainers.
This paper proposes a good foundation for self-repair of CNC software, especially for reliability self-growth of CNC software. The subsequent work is ongoing. The whole research will integrate the fault self-location, fault self-repair, and reliability self-growth, which will greatly improve the software reliability of the CNC system.
This paper is supported by the State Key Science and Technology Special Projects for Advanced CNC Machine Tools and Basal Manufacturing Equipments (no. 2012ZX04011021) and by the Natural Science Foundation of Zhejiang Province (no. Y1110708).
- Y. Q. Wang, Y. Z. Jia, and J. Y. Yu, “Field failure database of CNC lathes,” International Journal of Quality & Reliability Management, vol. 16, no. 4, pp. 330–343, 1999.
- B. Vinod, G. Gurusamy, and C. Sasikumar, “Design and analysis of power failure detector module for control of axis runaway in CNC machines during unprecedented power failures,” International Journal of Machine Tools and Manufacture, vol. 46, no. 12-13, pp. 1610–1616, 2006.
- Y. Wang, Y. Jia, and W. Jiang, “Early failure analysis of machining centers: a case study,” Reliability Engineering and System Safety, vol. 72, no. 1, pp. 91–97, 2001.
- S. S. Lee, J. H. Lee, and I. K. Park, “Reliability assessment approach using failure mode analysis in machining center,” Key Engineering Materials, vol. 321–323, pp. 1535–1538, 2006.
- Y. Wang, X. Wang, and S. Hua, “Reliability analysis and improvement of ATCs of CNC lathes,” Applied Mechanics and Materials, vol. 37-38, pp. 939–943, 2010.
- W. E. Wong and V. Debroy, “Software fault localization,” IEEE Reliability Society Annual Technology Report, 2009.
- M. J. Harrold, G. Rothermel, and K. Sayre, “Empirical investigation of the relationship between spectra differences and regression faults,” Software Test Verif Reliab, vol. 10, pp. 171–194, 2000.
- H. Agrawal, R. A. Demillo, and E. H. Spafford, “Debugging with dynamic slicing and backtracking,” Software Practice and Experience, vol. 23, no. 6, pp. 589–616, 1993.
- H. Agrawal, J. R. Horgan, S. London, and W. E. Wong, “Fault localization using execution slices and dataflow tests,” in Proceedings of the 6th International Symposium on Software Reliability Engineering, pp. 143–151, Toulouse, France, October 1995.
- M. Renieris and S. P. Reiss, “Fault localization with nearest neighbor queries,” in Proceeding of the 18th IEEE International Conference on Automated Software Engineering (ASE ’03), pp. 30–39, Montreal, Canada, October 2003.
- A. Ashish and S. B. Chougule, “Wireless flight data recorder (FDR) for airplanes,” in Proceeding of International Conference on Materials Science and Information Technology, Singapore, September 2011.
- S. R. Chu, R. Shoureshi, and M. Tenorio, “Neural networks for system identification,” IEEE Control Systems Magazine, vol. 10, no. 3, pp. 31–35, 1990.
- M. Y. Rafiq, G. Bugmann, and D. J. Easterbrook, “Neural network design for engineering applications,” Computers and Structures, vol. 79, no. 17, pp. 1541–1552, 2001.
- S. Duer, “Diagnostic system with an artificial neural network in diagnostics of an analogue technical object,” Neural Computing and Applications, vol. 19, no. 1, pp. 55–60, 2010.
- M. Yu, J. Zhao, L. Zhang, and Y. Wang, “Study on the dynamic characteristics of a virtual-axis hybrid polishing machine tool by flexible multibody dynamics,” Journal of Engineering Manufacture B, vol. 218, no. 9, pp. 1067–1076, 2004.
- R. T. Farouki and Y.-F. Tsai, “Exact Taylor series coefficients for variable-feedrate CNC curve interpolators,” CAD Computer Aided Design, vol. 33, no. 2, pp. 155–165, 2001.
- T. Yong and R. Narayanaswami, “A parametric interpolator with confined chord errors, acceleration and deceleration for NC machining,” CAD Computer Aided Design, vol. 35, no. 13, pp. 1249–1259, 2003.
- X. Liu, F. Ahmad, K. Yamazaki, and M. Mori, “Adaptive interpolation scheme for NURBS curves with the integration of machining dynamics,” International Journal of Machine Tools and Manufacture, vol. 45, no. 4-5, pp. 433–444, 2005.