Introduction

Error budget serves to predict and/or control errors in a system. Every machine tool has its own error budget serving to predict its accuracy and repeatability (Slocum 1992). The error budget helps identify where to focus resources to improve the accuracy of an existing machine or one under development (Hale 1999). Every workpiece can be also given certain error budget which stands for an acceptable error in machining it. The amount of error budget is related to the production cost (Bohez 2002). Therefore on every stage of the production process we need to maximize the remaining error budget.

In the machining process many various sources of errors can be identified (Fig. 1) as well as the manners of their compensation (Yuan and Ni 1998; Liu 1999; Ramesh et al. 2000a, b; Mehrabi et al. 2002; Wang et al. 2006; Loose et al. 2007; Rahou et al. 2009; Mekid and Ogedengbe 2010). Identification and compensation for particular errors is difficult time-consuming and costly, moreover their total eradication is in most cases impossible. The amount of errors can be limited even while designing the machine tool (Hale 1999) or they can be measured and compensated for (Sartori and Zhang 1995). Compensation can relate to the chosen errors or the total error. Typical approach to the error compensation includes building the mathematical models taking into account the data from the sensors placed on the machine tool in on-machine-measurement (OMM) system (Ziegert and Kalle 1994; Ouafi et al. 2000; Cho et al. 2006; Marinescu et al. 2011), by the reconstruction of the control program (Mäkelä et al. 2011; Cui et al. 2012) and more.

In case of mass production of complex parts in the machining centers we often deal with a summary compensation of the system errors based on the measurement reports from coordinate measuring machines (CMM). A major problem with CMMs in a modern manufacturing environment is the difficulty associated with taking advantage of the measurement results (Davis et al. 2006). The CMM reports rarely present direct values of the correction necessary to modify setup data of CNC (Schwenke et al. 2008). In case of mass production we have to deal with multi-tool, multi-directional machining, in addition, during one machining process many features are machined in a few workpieces fixed in multi-part fixtures. In such case the measurement reports are thick documents, which analysis is difficult and time-consuming and they can be easily misinterpreted. Errors on this stage usually result in the defective production. Taking into account the variety of error sources and their dynamic change in every cycle machining, the process of compensating should be applied automatically and quite often.

Fig. 1
figure 1

Source of machining errors

The solution to this problem is creating the process chain enabling us to apply the measurement results automatically in the form of compensating corrections for CNC setup data (Fig. 2). Since the early 1990s, new product data standards such as STEP and STEP-NC have been developed to provide standardized and comprehensive data models for machining and inspections (Kumar et al. 2007; Zhao et al. 2009). In a plant or factory they usually check many produced parts with one or a few measuring machines. Thus the first element of the process chain should be a set of postprocessors which standardizes the form of the reports. In such form the reports can be processed by the right program which generates the corrections for the tools and workpiece coordinate systems (WKS) used in the machining process. The correction in the form of changing the tool trajectory should be considered only as a last resort, as it limits—in case of multi-part fixtures—the possibility to apply the subprogram technique. The corrections should rather be automatically conveyed to right registers directly or indirectly by use of the array of the Real-parameters.

Fig. 2
figure 2

The process chain of taking into account the measurement results

This article discusses automatic determination of the corrections on the axle Z of the machine tool by changing the setup data of the tools and the position of the local coordinate systems connected with the workpiece. In case of a complex geometric dimensioning and tolerancing (GD&T) model finding good solution requires optimization procedure.

Metaheuristic techniques in process planning and manufacturing

The problem of optimization in the discussed issue comes down to searching the optimal solution in multi-dimensional, discrete state space. It is a classical artificial intelligence problem. Computational intelligence (CI) is a successor of good old-fashioned artificial intelligence (GOFAI). GOFAI developed as the project of empirical research, implements a weak model of semantic networks. CI rather relies on metaheuristic algorithms such as fuzzy systems, artificial neural networks (ANNs), evolutionary computation, artificial immune systems, etc. CI combines elements of learning, adaptation, evolution and fuzzy logic (rough sets) to create programs that are, in a sense, intelligent. So far, many metaheuristic search algorithms have been invented. Timeline of main metaheuristic algorithms devised up to 2010 has been presented in (Gandomi et al. 2013). Recently, there’s been rapid increase in popularity of newly defined approaches, such as: cuckoo search algorithm (Mohamad et al. 2013), glowworm swarm optimization (Zainal et al. 2013), Levy flight algorithm (Kamaruzaman et al. 2013), firefly algorithm (Johari et al. 2013).

In year 2000, Kusiak published a trailblazing book (Kusiak 2000), which, for the first time, included state-of-the-art CI techniques to all phases of manufacturing system design and operations. The most important areas of manufacturing engineering are process planning and process control. The process plan constitutes an ordered sequence of tasks which can transform raw material into the final part economically and competitively. The major process planning activities are: features extraction, part classification for group technology, machining volume decomposition, tool path generation, machining condition optimization, operation sequencing, machine, setup and tool selection, and others. Because process planning is a NP-hard problem, some global search techniques must be applied. A brief review of CI applications in machining process planning and related methods and problems will be presented in work (Stryczek 2007). Fuzzy logic (FL) can by effectively used in modeling of machining processes such as predicting the surface roughness and controlling the cutting force. Adnan et al. (2013) present FL techniques used in machining process. FL was considered for prediction, selection, monitoring, control and optimization of machining process.

In the field of machining process planning, CI methods have been used most often for optimizing machining process parameters. The gradient-based non-linear optimization techniques have difficulty with solving those optimization problems; one must resort to alternative, conventional, non-systematic optimization techniques, i.e., evolutionary algorithms (Zhang et al. 2006). An overview and the comparison of the researches from 2007 to 2012 that used evolutionary optimization techniques to optimize machining process parameters were presented in Yusup et al. (2012a, b). Genetic algorithm (GA) stands out among CI methods as it is currently the full-grown method of single and multi-objective optimization, tested in many variants. Zain et al. (2008) discussed on how GA system operates in order to optimize the surface roughness performance measure in milling process. Yusoff et al. (2011) reviews the application of non dominated sorting genetic algorithm II (NSGA-II), classified as one of multi-objective GA techniques, for optimizing process parameters in various machining operations.

Coral reefs inspired particle swarm optimization

The popular metaheuristic, Particle Swarm Optimization (PSO), has been developed originally by Kennedy and Eberhart (1995). At the same time deep modifications have been introduced to PSO (Poli et al. 2007). They were inspired by the rebuilding processes in the coral reef, so the method has been called coral reefs inspired particle swarm optimization (CRIPSO).

The coral reef is a complicated ecosystem bound by the evolution rules, which undergoes constant reconstruction. It is a live organism consisting mostly of polyps which cluster into colonies. During the reproduction coral reef grows upwards and sideward. Polyps produce small larva better known as planula. After swimming for a few hours or even days planula settles down and transforms into a new polyp competing for food and space. Comparing polyp colonies with the particle swarm we can see the following differences. Polyp is a stationary particle undergoing reproduction and dying many times. In the classic PSO, particle is in constant movement and there is no generational change. Potential advantage of the modification is that the particles with the lower mark are eliminated from the population and the best ones can generate their descendants many times. CRIPSO is based on the principle of elitism

Figure 3 represents the course of the best solution search cycle. Each particle (polyp) stands for one solution in decision space. Algorithm was based on a contest between the two solutions chosen at random. The winning solution remains in set \(P\) thus the elitist character of the procedure while the worse solution is removed from the set \(P\). In its place the winner generates its own planula.

Fig. 3
figure 3

Basic CRIPSO flow chart

In real world planula moves in the ocean in the chaotic manner. Most of them die. However we can assume that those who manage to settle down and change into polyp obeyed the rules of particle swarm movement. Therefore the procedure of defining the position of a descendant has been based on PSO method. The position of the planula settlement in \(i\)th dimension is determined according to the formula 1. According to this, the particle shift vector’s components are determined as the sum of three components (Fig. 4) in the directions consistent with:

  1. I.

    The shift of the last planula generated by the given polyp. In case of a new polyp the direction of the inertia vector is agrees with the movement direction between the planula’s parent’s position and the point of planula’s settlement.

  2. II.

    The shift towards the descendant of the given polyp which has the best position so far. In case of a new polyp, position “polyp best” is inherited from the parent.

  3. III.

    The shift towards the best situated polyp in the whole colony.

$$\begin{aligned} x{\prime }_i&= x_i +w\left( {plast_i -x_i } \right) +c_1 r_1 \left( {pbest_i -x_i } \right) \nonumber \\&+\,c_2 r_2 \left( {gbest_i -x_i } \right) \end{aligned}$$
(1)
Fig. 4
figure 4

Determining new position of particle

The proposed compensation system

Let us focus on a simple example stemming from the analysis of the workspace of the 4-Axis (X\('\)YZB\('\)) horizontal-spindle machining center (Fig. 5). In the workspace we distinguish the following characteristic points: \(\dot{R}\)—reference point,\(\dot{M}\)—machine point, \(\dot{W}_{j}\)—the points of the origin of the coordinate system connected with the workpiece, \(\dot{K}_{t}\)—the code point of the tth tool and \(\dot{F}\)—the toolholder reference point.

Fig. 5
figure 5

Workspace of horizontal-spindle machining center

Those points are connected by the vectorial equation for machine tool space:

$$\begin{aligned} \mathop {MF}\limits ^{\longrightarrow }=\mathop {MW}\limits ^{\longrightarrow }+\mathop {WK}\limits ^{\longrightarrow }+\mathop {KF}\limits ^{\longrightarrow } \end{aligned}$$
(2)

This equation is the basis for analyzing the influence of the setup data presented here by the components \(\mathop {MW}\limits ^{\longrightarrow }\hbox { i }\mathop {KF}\limits ^{\longrightarrow }\), on the position of machined features, and consequently on the obtained dimensions. The relationships occurring here can be displayed as four-level weighted relationship graph (Fig. 6).

Fig. 6
figure 6

Four-level weighted relationships graph

On the basis of this model we can generate formulas which show the influence of the setup data change on \(f\)th features \(\mathop {F}\limits ^{\leftrightarrow }\) and \(q\)th dimension \(\mathop {D}\limits ^{\leftrightarrow }\) shift.

$$\begin{aligned} {\mathop {\mathop {F}\limits ^{\leftrightarrow }}_1}&= -{\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{1}}+{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{1}} ,\\ {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{2}}&= -{\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{1}} +{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{2}}-{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{1}} ,\\ {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{1}}&= {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{1}}= -{\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{1}}+{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+ {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{1}} ,\\ {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{2}}&= {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{1}}-{\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{2}} =-{\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{1}}+{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{1}} -(-{\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{1}}+{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{2}}-{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{1}})\\&= {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{2}}+2{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{1}}. \end{aligned}$$

On the whole the influence of setup data on resultant dimensions in Z axis can be presented in the form of orderly six-tuple \(\hbox {PM}=(M, W, T, F,\hbox {D},R)\). In the graphical interpretation the elements of \(M, W, T, F\) and D sets are the graph vertices whereas the elements of R set are weighted directed arcs. Weight for arc \(a\rightarrow z\) take the value:

$$\begin{aligned} w_{az} =\left\{ {{\begin{array}{ll} 1&{}\quad \hbox {if increase}\,a\,\hbox {causes increase}\,z, \\ -1&{}\quad \hbox {if}\,\hbox {increase a}\,\hbox {causes decrease}\,z, \\ 0&{}\quad \hbox {otherwise}. \\ \end{array} }} \right. \end{aligned}$$

In case of elements belonging to \(M, W, T\) and \(F\), sets the increase means shifting towards the positive values of the Z axis of MKS meanwhile in case of the elements of \(D\) set it means the increase of the dimension value. These relationships can be written down synthetically in the matrix form:

$$\begin{aligned} R_{MW}&= \left[ {{\begin{array}{ccc} {w_{11} }&{} \ldots &{} {w_{1\left| W \right| } } \\ \vdots &{} \ddots &{} \vdots \\ {w_{\left| M \right| 1} }&{} \ldots &{} {w_{\left| M \right| \left| W \right| } } \\ \end{array} }} \right] ,\\ R_{WF}&= \left[ {{\begin{array}{ccc} {w_{11} }&{} \ldots &{} {w_{1\left| F \right| } } \\ \vdots &{} \ddots &{} \vdots \\ {w_{\left| W \right| 1} }&{} \ldots &{} {w_{\left| W \right| \left| F \right| } } \\ \end{array} }} \right] ,\\ R_{TF}&= \left[ {{\begin{array}{ccc} {w_{11} }&{} \ldots &{} {w_{1\left| F \right| } } \\ \vdots &{} \ddots &{} \vdots \\ {w_{\left| T \right| 1} }&{} \ldots &{} {w_{\left| T \right| \left| F \right| } } \\ \end{array} }} \right] ,\\ R_{FD}&= \left[ {{\begin{array}{ccc} {w_{11} }&{} \ldots &{} {w_{1\left| D \right| } } \\ \vdots &{} \ddots &{} \vdots \\ {w_{\left| F \right| 1} }&{} \ldots &{} {w_{\left| F \right| \left| D \right| } } \\ \end{array} }} \right] . \end{aligned}$$

Predicted shifts of the features position and the changes of the dimensions can be, therefore, expresses as the vectors’ components in form of the following formula:

$$\begin{aligned} \left[ {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{1}} \ldots {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{|F|}}\right]&= ([{\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{1}} \ldots {\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{|M|}}]\cdot {R}_{MW}\nonumber \\&+\,[{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}} \ldots {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{|W|}}]) \cdot R_{WF}\nonumber \\&+\,[{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{1}} \ldots {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{|T|}}]\cdot R_{TF} \end{aligned}$$
(3)
$$\begin{aligned}{}[{\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{1}} \ldots {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{|D|}}]&= [{\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{1}} \ldots {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{|F|}}] \cdot R_{FD} \end{aligned}$$
(4)

In the practical applications the 0 level of the model, i.e. components \([{\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{1}} \ldots {\mathop {\mathop {M}\limits ^{\leftrightarrow }}\nolimits _{|M|}}\) in Eq. 4 can be omitted. This is so, because the errors connected with the zero point of the machine are usually comparatively insignificant and there may be some problems with their automatic compensation.

Formulating the optimization task

The aim for the engineer of the technological process is to provide the maximum unilateral error budget \(\delta \), which is understood as the distance between the zero deviation line and a closer of the two borderlines (top and lower) of the tolerance zone (Fig. 7b). Value \(\delta \) should be bigger than the performance error \(\varepsilon \). In the best possible case value \(\delta \) matches a half of the admissible error budget \(\varDelta \hbox {Z}_{max}\), that is a half of the minimal tolerance zone of all considered dimensions (Fig. 7a). The ideal case occurs very seldom or never. In practice the amount of the remaining error budget \(\varDelta \hbox {Z}\) is always smaller than the smallest tolerance zone (Fig. 7b). On of the manners to increase \(\delta \) is to correctly modify setup data so that to acquire additional error stock, so called bonus error budget \(b\). The bonus error budget reduces the number of rejected parts by increasing the tolerance zone. In order to determine \(b\), first we have to find the value of the tolerance zone center shift off the zero line \(\varepsilon _{q}\) (Fig. 7b) resulting from the correction of the setup data. The objective of the optimization \(f_{1}\) is to find the proper values of the setup data so as to maximize \(\delta \) for the least advantageous position of the tolerance zone (8). The bonus error budget is the difference between the presently registered value \(\delta \) and the predicted value obtained after the optimization.

$$\begin{aligned} dZ^{-}&= {\mathop {\max }\nolimits _q} \left( {\varepsilon _q -\frac{T_q }{2}} \right) \end{aligned}$$
(5)
$$\begin{aligned} dZ^{+}&= {\mathop {\hbox {m}in}\nolimits _q} \left( {\varepsilon _q +\frac{T_q }{2}} \right) \end{aligned}$$
(6)
$$\begin{aligned} \varDelta Z&= dZ^{+}-dZ^{-} \end{aligned}$$
(7)

The following objective functions have been taken into account:

$$\begin{aligned} f_1&= \delta _{max} ={\mathop {\max }\nolimits _p} \left( {\mathop {\min }\nolimits _q \left\{ {dZ_q^- ,dZ_q^+ } \right\} } \right) \end{aligned}$$
(8)
$$\begin{aligned} f_2&= \hbox {min}_{p\in P_1 } \sqrt{\sum \nolimits _i{\mathop {\mathop {x}\limits ^{\leftrightarrow }}\nolimits _i^{2}}} \end{aligned}$$
(9)
$$\begin{aligned} f&= 10f_1 -f_2 \end{aligned}$$
(10)
Fig. 7
figure 7

The distributions of tolerance zone: a in best case, b in real case

During the first step we seek the solutions for which \(f_{1}\) has maximum value. The decision space should be limited on both sides in each of dimensions, e.g. to the range [\(-\)0.1, 0.1]. Furthermore it is a discrete space which results from the precision of determining the setup data; mostly 0.001 mm or 0.0001 of an inch. However the number of solutions, even with the above limitations, is huge, e.g. \(1.024\times 10^{23}\) for 10-dimensional decision space. Therefore the set of \(P_{1}\) solutions matching \(f_{1}\) is also quite numerous. Among \(P_{1}\) elements we need to find the one for which the resultant vector of the change for all the setup data is the smallest \((f_{2})\). To make calculations simpler the substitute objective function \(f\) has been introduced. It converts the original problem with two objectives into a single-objective optimization problem.

Practical example

Let us take into consideration a machining process in a 4-part fixture (Fig. 8). Rear axle guide pins are being machined. The machining process is carried out in two angular positions of the rotary table, 0\(^{\circ }\) and 180\(^{\circ }\), so taking 8 WKS is advantageous. Figure 9 presents the model of the relationship between the structure elements of the machining process. Figure 10 presents the GD&T model for one machined part.

Fig. 8
figure 8

Machine and workpiece coordinate systems

Fig. 9
figure 9

Model of machining process of the given parts

Fig. 10
figure 10

Model GD&T of the given part

Relationships \(R_{TF}, R_{WF}, R_{TF}\), for one workpiece have been presented below in the matrix form.

figure a
figure b
figure c

The changes of the features position \(\mathop {F}\limits ^{\leftrightarrow }\) and the dimensions values \(\mathop {Q}\limits ^{\leftrightarrow }\), depending on the setup data corrections are determined for each part by means of the following formulas:

$$\begin{aligned} {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{1}}&= {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}} +{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}} \qquad {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{1}} ={\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+ {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}}\\ {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{2}}&= {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+ {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}} \qquad {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{2}}= {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}}\\ {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{3}}&= -{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}}- {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{23}} \qquad {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{3}}= -{\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}} -{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{23}}\\ {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{4}}&= {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+ {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{23}} \qquad {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{4}}= {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{1}}+ {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}}+2{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{23}}\\ {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{5}}&= - {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}}- {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}} \qquad {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{5}}=- {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}}- {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}}\\ {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{6}}&= - {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}}- {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}} \qquad {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{6}}=- {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}} -{\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}}\\ {\mathop {\mathop {F}\limits ^{\leftrightarrow }}\nolimits _{7}}&= - {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}}- {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}} \qquad {\mathop {\mathop {D}\limits ^{\leftrightarrow }}\nolimits _{7}}=- {\mathop {\mathop {W}\limits ^{\leftrightarrow }}\nolimits _{5}}- {\mathop {\mathop {T}\limits ^{\leftrightarrow }}\nolimits _{5}} \end{aligned}$$

In Fig. 11 the user interface of the setup data correction program has been presented. Input data are read automatically after indicating the file with the measurement results. Figure 12 shows how the values of benchmark \(f_{1}, f_{2}\), and \(f\) as function of iteration are determined. In this example the bonus error budget amounted to b = 0.071–0.22 = 0.049 mm. Increasing this value only by means of modifying the setup data is impossible. Further increase of error budget would require interfering with the control program. In case of multi-part machining process, in which the subprogram technique is applied, such interference is unadvisable as it complicates the structure and makes the control over the program more difficult.

Fig. 11
figure 11

User interface

Fig. 12
figure 12

Values of benchmark \(f_{1}, f_{2}\) and \(f\) as function of number of solutions in CRIPSO

Comparison between the proposed CRIPSO and other algorithms

CRIPSO has been compared with three other popular metaheuristics: classic PSO, GA, and cuckoo optimization algorithm (COA). For each of these methods the tests consisting of twelve trials have been carried out. Figure 12 presents a typical the process of searching for the best solution by means of CRIPSO. The current set of polyps (solutions) was constant and amounted to 100. Coefficients \(c_{1}\) and \(c_{2}\) were calculated each time according to the formula 11. Inertia weight \((w)\) was established on the constant level of 0.75. The total number of iterations was established as 5,000. The optimal solution was reached after less than 2,000 iterations. The solutions were repeatable (Figs. 16, 17). The time needed to generate 5,000 solutions was 0.58 s.

$$\begin{aligned} c_1 =c_2 =\cos \left( {\frac{\pi }{2}\cdot \frac{L_i }{L}} \right) \end{aligned}$$
(11)

where \(L_{i}\): successive number of a solution, \(L\): the total number of solutions.

Figure 13 shows a typical process of searching for the best solution by means of PSO. The basic pattern of PSO has been applied. Globally, the best position of a particle was updated each time after generating a new solution. The current set of particles (solutions) was constant and amounted to 100. Coefficients \(c_{1}\) and \(c_{2}\) were calculated identically as in CRIPSO. The time needed to generate 10,000 solutions was 0.96 s. Solutions were obtained after about 5,000 iterations on average. The spread of results was similar to CRIPSO (Figs. 16, 17).

Fig. 13
figure 13

Values of benchmark \(f_{1}\), \(f_{2}\) and \(f\) as function of number of solutions in PSO

Figure 14 shows a typical process of searching for the best solution by means of GA. The applied flowchart of GA was presented by Stryczek (2009). It is the variation of GA including the principle of elitism, as the winners of the competition qualify to the next population. The quantity of the population was 50 and the probability of the gene mutation 0.1. The time needed to generate 5,000 solutions was 0.72 s. The obtained results were only slightly worse than those of PSO and CRIPSO. GA finds the right solution quickly, after about 500 trials, but it has a problem with improving them afterwards.

Fig. 14
figure 14

Values of benchmark \(f_{1}\), \(f_{2}\) and \(f\) as function of number of solutions in GA

The fourth method of optimization is a metaheuristic known for several years which is called COA (Rajabioun 2011). The method is interesting, yet it takes into account many parameters which affect it’s effectiveness. The best solutions were obtained for the maximum number of habitats which amounted to 40 and for 5–10 laid eggs (Fig. 15). The trials of 100 iterations which corresponds with checking approximately 30,000 solutions in 2.11 s. The results diverged from other methods in terms of quality. The best of them are to be considered satisfactory, though (Figs. 16, 17).

Fig. 15
figure 15

Values of benchmark \(f_{1}\), \(f_{2}\) and \(f\) as function of number of solutions in COA

Fig. 16
figure 16

Comparison of test results for COA, CRIPSO, PSO and GA

Fig. 17
figure 17

Comparison of test results for COA, CRIPSO, PSO and GA

Validate the results of the proposed scheme

For the purpose of statistic validation of the proposed method a number of tests have been carried out for the model presented in “Practical example” section, for 100 measurement result sets. For each set, 10 tests have been conducted. On the whole, 1,000 trials have been carried out and their results are presented in Fig. 18. measurement results have been generated at random, but with maintaining the weight proportions considering the influence of setup data errors \((w_{1})\) and the remaining sources of performance errors \((w_{2})\). Firstly, setup data errors have been generated randomly (12) then their influence on analyzed dimensions. After the additional, random deviations (13) have been taken into account, the error budget for each case has been calculated. For the conducted trials it was within: \(-\)0.011 to 0.063. The negative value of the error budget means that the part has been made beyond the boundaries of tolerance field. Those boundaries can be controlled by establishing the proper weights \(w_{1}\) and \(w_{2}\). During the tests they were established on the set level accordingly 0.03 and 0.02. Choosing the proper weight has crucial influence on the possibility of increasing the error budget by correcting the setup data. The important conclusion drawn from the conducted tests should point out the possibility of using the proposed methodology to estimate the share of the setup data error in the total machining error. For instance, for 60 % share of setup data in the total machining error and the initial error budget value \((f_{1})\) of 0.022 the foreseen error budget amounted to 0.085 (Fig. 18, series 26). Meanwhile, for the same value of the initial error budget, for the example form Fig. 16, none of the tested optimization methods succeeded in reaching the value higher than 0.071. Therefore the conclusion that the share of setup data error was less that 60 % in this case. This subject is so extensive that it is not discussed here further. CRIPSO always generated good solutions regardless of the initial error budget value as shown in the results of the conducted tests. Only a few per cent of the results deviated for the average (Fig. 18).

$$\begin{aligned} E^{sd}_i&= w_1 (1-2r) \end{aligned}$$
(12)
$$\begin{aligned} E_q&= w_2 (1-2r) \end{aligned}$$
(13)
Fig. 18
figure 18

The sorted test results

Conclusion

The article presented the practical method of the automatic correction of setup data of the horizontal-spindle machining center in axle Z. Applying this method to the remaining axles is aimless as the errors in XY surface and in axle \(B\) have different character. This method is suitable for multi-directional and multi-tool machining using multi-part fixtures. The approach presented has been compared with the classic PSO, GA and COA methods. The effectiveness of PSO, GA and CRIPSO has been on a similar level and the results have been within the range of the random spread characteristic for these methods. The above method of the setup data correction can be applied automatically without the worker’s interference. It should be the essential element of the computer-integrated manufacturing (CIM). The time needed to apply this method in practice depends mainly on the link between GD&T and the setup data in the production process. Therefore the further research should focus on automation of this stage of planning.