Introduction

All manufacturing processes are inherently imprecise, thus producing parts with variation (Srinivasan and Heights 1999). The ability of assessing the effect of those variations by virtual models provides a competitive advantage for manufacturing and product development organizations (e.g. Schleich et al. 2017). For the purposes of product development, Skin Model Shapes, models derived from discretized nominal models or point cloud data, provide a better accuracy in variation propagation related analysis compared to the classical methods, such as vector loops and small displacement torsor (Schleich et al. 2016; Schleich and Wartzack 2016). The variation propagation analysis is based on the mechanical assembly of virtual parts (Schleich and Wartzack 2015), mainly for the purposes of performing tolerance synthesis and analysis (Nabil Anwer et al. 2014; Schleich and Wartzack 2014).

In multistage machining, the part variations propagate at each stage in process, resulting a complex relationship between the sources of variation and the machined parts. Such relationship is often studied under the notion of stream of variation. This mainly includes analytical modeling of the relationship for use in activities such as quality control, optimal placement of inspection stations, process planning, and process-oriented tolerancing (Abellán-nebot et al. 2013).

However, the techniques of variation propagation analysis used in product development and manufacturing processes have been developing independently without adapting the advances from each other (Abellán-nebot et al. 2013). Towards addressing this need, Wang et al. (2019) proposed a model that combines stream of variation for inter-station variation and small displacement torsor for variation in the assembly of workpiece and machine tool components. Even though, the method applies for most of the practical shapes, there is also a need to include geometric variation and workpiece deformity in the model (Wang et al. 2019). Such geometric shapes can be modeled using the principles of Skin Model Shapes (Schleich et al. 2014). However, the prediction of geometric variation of novel shapes using Skin Model Shapes in relation to variation sources is ongoing research (Schleich and Wartzack 2017). In that direction, a machining simulation with induced variations can be applied in representing actual processes (Yacob et al. 2018). Nevertheless, machining simulation with induced error at each stage can become slow for making continuous analysis and process planning, especially using a point cloud in CAM environment. Moreover, a generic mathematical relation between variation sources and the machined feature is complicated (Shi 2006).

Thus, this paper proposes a multilayer shallow neural network (SNN) regression approach to predict the geometric deviations of a part given variation sources’ deviations at a specific machining stage. In multistage machining process, the predicted geometric deviations become inputs to a trained model of a subsequent stage, thereby predicting variation propagation stage wise. Furthermore, in variation source identification, the predicted surface by a SNN is made to optimally match the actual machined surface by iteratively tuning the input values.

For the first time, Skin Model Shape (here after SMS) has been applied in variation source identification of machined parts. This approach extends the analytical methods applied in variation propagation modelling by introducing how SNN can be used in prediction of geometric variation and variation source identification. After discussing the background works in “Background” section, this paper presents three major sections. In “Prediction of geometric characteristics” and “Variation source identification” sections, the approaches to geometric characteristics prediction and error source identification are presented. After presenting a demonstration case in “Demonstration case” section, a discussion and conclusion are presented in the subsequent sections.

Background

Skin Model Shapes

A SMS can be generated from a tessellated nominal model by scaling the vertices of a feature of interest to match the desired deviations (Schleich et al. 2014). The scaling is performed so that vertices lie within the range of specified tolerance or variation range of observed data (Nabil Anwer et al. 2014; Schleich and Wartzack 2016). Specifically, second order shapes and Gaussian random fields (Zhang 2012) and signal processing approaches such as discrete-cosine-transform (Huang and Ceglarek 2002) and natural modes decomposition (Samper and Cedex 2019), and machining simulation with induced errors (Yacob et al. 2018) can be applied. Alternatively, SMS can be generated from observed data using techniques such as screened poisson surface reconstruction (Yacob et al. 2018) or NURBS-based (Zhang et al. 2017).

The central message of the concept of Skin model is the use of a univocal language in variation related analysis in design, manufacturing and inspection (Anwer et al. 2013; Schleich and Wartzack 2014). Arguably, the same model must be used in geometric prediction during design, manufacturing process planning and variation source identification. However, the use of SMSs towards variation propagation analysis in a multistage machining has not been extensively studied.

Variation propagation modelling

Variation in multistage machining is often studied under the notion of stream of variation. Stream of variation is a strategy that aims to model and analyze variation and its propagation in a multistage machining by applying the state-space model (Mantripragada and Whitney 1999; Shi 2006). The state-space model defines the relationship between key product characteristics and the sources of variation, i.e. the fixture-, tooltip (machining)- and datum-induced deviations, in a matrix form (Abellán-nebot et al. 2013). A more detailed description is available in Abellán-nebot et al. (2012a, 2013) and Shi (2006). Similar approaches based on the concept of small displacement torsor (Bourdet and Clement 1988) has been proposed for manufacturing processes, whereby the part and fixture are treated as a mechanism (Villeneuve et al. 2001). The methods based on the concept of small displacement torsor is often applied for tolerance synthesis to limit defects per setup given design requirements, and tolerance analysis to verify if a machining process meets a functional tolerance (Abellán-nebot et al. 2013).

Moreover, the concept of stream of variation is also applied in variation source identification per station. The approaches mainly include pattern matching of variances obtained from principal component analysis (Shi 2006) and statistical estimation of variation sources by hypothesis testing (Zhou et al. 2004). The manufacturing data is collected by random sampling of machined parts. Such approaches cannot be applied for a point cloud data as number of data points per sampled part is very large.

Most studies related to SMS focus on application of SMS in design stage of a product lifecycle. Thus far, few mathematical models have been proposed for determining the geometric characteristics of planar and cylindrical features given manufacturing variation sources’ deviations e.g. (Liu et al. 2018; Wu et al. 2017, 2018). However, the mathematical approaches require expert knowledge to apply in more complex products (Schleich and Wartzack 2017). Even though, the work reported in Liu et al. (2018) and Wu et al. (2017, 2018) can be extended in error source identification in multistage machining process, there has not been systematic attempt for error source identification based on SMSs. The prediction of geometric properties of a part produced in multistage machining is a non-trivial task, given the need to consider all sources of error and their combinatorial effect. Mapping of variation sources and to geometric properties is one of the current research challenges in variation modelling using SMSs (Schleich and Wartzack 2017).

Neural network

Neural network is an architecture that attempts to mimic the human brain. In a typical feedforward neural network, a multilayer architecture, containing input, hidden, and output layers, is used. Each layer contains multiple neurons that are represented by real-valued activations. In a feedforward network that applies backpropagation algorithm, the weights and biases are first initialized. The sum of the connection’s weights and biases determine whether to activate a neurons, thereby one layer affects the pattern on the activated neurons on the next layer. Following this, the weights and biases are repeatedly evaluated and updated in such a way that the mean squared error between predicted and actual values is reduced, often with the help of gradient decent. The network connection is adjusted in such a way that both linear and non-linear relationships between input data (predictors) and target values are inferred. Generally, when the input data is pre-defined before training and the number of hidden layers is less than 3, the architecture is referred as a shallow neural network, otherwise a deep neural network. A neural network’s model quality is determined by its ability to generalize (Hunter et al. 2012). A more detailed description on the working principles of neural networks can be found in Lecun et al. (2015) and Liu et al. (2017).

Neural networks have been applied in many fields in solving non-trivial problems (Liu et al. 2017). In manufacturing, different neural network models have been applied in tool condition monitoring (Burke and Rangwala 1991; Penedo et al. 2012; Wang and Cui 2013), machinery fault diagnosis and predictive maintenance (Hu et al. 2017; Li et al. 2018; Tian 2012; Wang et al. 2018; Zhang et al. 2013). However, most of the research related to conventional machine tools is inclined towards tool condition monitoring and surface roughness prediction (Kim et al. 2018). Limited attention has been given towards application of neural networks in variation propagation using point clouds.

Prediction of geometric characteristics

An accurate prediction of geometric characteristics of a machined part, thereby estimating capability of the machining process, would enable the selection of the most robust set of operations to manufacture a part. The accuracy of the prediction can be improved using historical shop-floor data (Abellán-nebot et al. 2013). Given a relationship between sources of error and a part, a process planner can evaluate the manufacturing accuracy of a process plan and take appropriate measures to reduce variation (Abellan-Nebot et al. 2012b). In this paper, a machining simulation followed by a SNN-based prediction is used to characterize the geometric shapes. The approach was inspired by SMS generation (e.g. Schleich et al. 2014) and stream of variation (e.g. Abellán-nebot et al. 2013; Shi 2006) techniques.

Data generation through machining simulation

A machining simulation with induced errors can mimic the actual machining process, thereby the simulation result closely matches the actual part with variation (Ibaraki and Yoshida 2017; Yacob et al. 2018). It is a generally accepted notion that part surfaces are a superimposition of lay, waviness and roughness (Henzold 2006). The surface waviness and roughness under a large applied force has a negligible contribution at distances greater than 20 mm away from the source, in line with Saint–Venant’s Principle (Guo et al. 2016). Thus, the simulation setup can focus only on the lay without significantly affecting the setup accuracy. By the same token, 2D (flat) locators can be reduced to a single point locator without significantly reducing the setup accuracy.

In a typical 3–2–1 fixture layout, features are assembled to a fixture in the sequence of primary, secondary and tertiary locators. A gravitational force is exerted on the part when assembling to the primary locators (3 locators). External forces are then applied to move the part against of secondary locators (2 locators) and tertiary locator (1 locator). The sequence of assembly to the secondary and tertiary is of no particular importance as long as all points are in contact. To assemble features to the corresponding locators, a SMS’s features must first be partitioned (Schleich and Wartzack 2015), as shown in Fig. 1. The primary feature of the model shape is first registered to the primary locators, which the rest of the point cloud is transformed by equivalent amount. This step fixes 3 degrees of freedom. The set of point clouds is then made to rotate around axis normal to the primary plane and slide in the direction normal to the secondary plane, which fixes another 2 degrees of freedom. Finally, the shape model slides in the direction of the intersection of primary and secondary direction until it meets the tertiary locator, which fixes the final degree of freedom. Mathematically, given the rotation matrix Rprim and translation Tprim needed to register the primary feature, the rotation of the resulted point cloud around normal to the primary Rsec, translation to the secondary plane Tpt, and translation to tertiary plane Tps can be expressed as:

$$ \varvec{A}' = \left[ {\left( {\varvec{A} \times \varvec{R}_{\text {prim}} + \varvec{T}_{\text {prim}} } \right) \times \varvec{R}_{\text {sec}} + \varvec{T}_{\text {pt}} } \right] + \varvec{T}_{\text {ps}} $$
(1)

where \( \varvec{A} \in {\mathbb{R}}^{3} \) is model shape, npt is a normal vector to the secondary plane (intersection of primary and tertiary planes) and nps is a normal vector to the tertiary plane (intersection of primary and secondary planes), as shown in Fig. 1.

Fig. 1
figure 1

An illustration of a configuration before assembly of partitioned point clouds of a SMS against primary, secondary and tertiary planes of locators, indicated in red, blue, green, respectively (Color figure online)

Following a setup with induced errors, a machining simulation can be performed to obtain a machined surface. However, to the best knowledge of the authors, there are no effective CAx tools that enable machining simulation on point cloud with induced fixture and tooltip errors. Nonetheless, the point cloud of primitive shapes, such as planes and cylinders, can be machined by placing and subtracting a corresponding point cloud of a feature, without compromising the accuracy and intended purpose of the simulation. The use of primitive shapes enables simulating directly on point cloud data, whereby the cutting feature’s points become the points of the machined surface, after adjusting the position for tooltip deviation. The approach is in line with the principles of constructive solid geometry techniques, whereby a signed distance is used to determine whether the points are inside or outside specific feature.

It is worth mentioning that cutting conditions, such as roughing and finishing, that result change in waviness and roughness of the machined surfaces are not directly considered in part quality prediction. In such predictions, the effect of cutting tool wear, machine tool axes deviations, spindle-thermal variation and cutting force are collectively expressed as tooltip deviations, which is assumed constant per operation (Abellan-Nebot et al. 2012b). Further, the effect of non-attributable factors on the machined surface are indirectly captured by Gaussian random fields, and added to the orientation and positional errors caused by attributable factors.

For instance, Fig. 2 illustrates virtual facing and boring processes by point cloud of a plane and cylinder while assembled to a fixture of 3–2–1 layout. The simulation steps in setup 1, shown in Fig. 2a, can be described mathematically as follows:

Fig. 2
figure 2

A 2D illustration of machining of a rectangular block with point clouds of cutting planes and cylinders. d1 and d2 represent deviations from nominal locator and tool positions, respectively

The point cloud of a stock \( \varvec{P}_{\text {stock}} = \left\{ {\left( {\varvec{X},\varvec{Y},\varvec{Z}} \right) \in {\mathbb{R}}^{3} } \right\} \), a point cloud of reference landmarks Q, that are arbitrarily placed in space, can be added to Pstock

$$ \varvec{P}_{\text {stock},Q } = \varvec{P}_{\text {stock}} \cup \varvec{Q} $$
(2)

For a point cloud of a cutting plane in the shape of a would be machined surface \( \varvec{C}_{\text {cp}} = \left\{ {\left( {\varvec{X}_{\text {cp}} ,\varvec{Y}_{\text {cp}} ,\varvec{Z}_{\text {cp}} } \right) \in {\mathbb{R}}^{3} } \right\} \), the point cloud of machined part \( \varvec{P}_{\text {stock},Q } \) while assembled to a fixture can be represented by

$$ \varvec{P}_{\text {assembly }} = \left\{ {\{ \left( {\varvec{X},\varvec{Y},\varvec{Z}} \right) |\varvec{Z} < \varvec{Z}_{\text {cp}} } \right\} \cup \varvec{C}_{\text {cp}} \} $$
(3)

For machining cylindrical features by cutting cylinder \( \varvec{C}_{\text {cy}} = \left\{ {\left( {\varvec{X}_{\text{cy}} ,\varvec{Y}_{\text{cy}} ,\varvec{Z}_{\text{cy}} } \right) \in {\mathbb{R}}^{3} } \right\} \), with nominal axis \( \varvec{P}_{\text {axis}} = \left\{ {\left( {x_{0} ,y_{0} } \right) \in {\mathbb{R}}^{2} } \right\} \) and radius r, the signed radial error \( \varvec{r}_{\text {error}} \) can be estimated by

$$ \varvec{r}_{\text {error}} = {r } - \sqrt { \left( {\varvec{X} - X_{0} } \right)^{2} + \left( {\varvec{Y} - Y_{0} } \right)^{2} } $$
(4)

The point cloud of a machined part while assembled to a fixture becomes

$$ \varvec{P}_{\text {assembly }} = \left\{ {\begin{array}{*{20}l} {\left\{ {\left( {\varvec{X},\varvec{Y},\varvec{Z}} \right) |\varvec{r}_{\text {error}} < 0} \right\} \cup \varvec{C}_{\text{Cy}} , \text {Internal cy.}} \hfill \\ {\left\{ {\left( {\varvec{X},\varvec{Y},\varvec{Z}} \right) |\varvec{r}_{\text {error}} > 0} \right\} \cup \varvec{C}_{\text{Cy}} , \text {External cy.}} \hfill \\ \end{array} } \right. $$
(5)

The landmarks \( \varvec{Q}_{\text{assembly} } \) can be extracted from \( \varvec{P}_{\text {assembly }} \); when a Procrustes registration \( PD(\varvec{Q},\varvec{Q}_{\text {assembly}} \)) is performed, the resulting rotation matrix \( \varvec{R} \) and translation vector \( \varvec{T} \) are applied in transforming the fixture-assembled point cloud \( \varvec{P}_{\text {assembly }} \) back to a nominal position via reference landmarks. Thus, the resulting point cloud of a machined part \( \varvec{P} \) can be obtained by

$$ \varvec{P} = \varvec{P}_{\text {assembly }} \times \varvec{R} + \varvec{T} $$
(6)

Furthermore, the cutting plane \( \varvec{C}_{cp} \) is transformed by an equivalent magnitude to yield a machined surface \( {\boldsymbol{\mathcal{N}}} \)

$$ {\boldsymbol{\mathcal{N}}} = \varvec{C}_{\text {Cp}} \times \varvec{R} +\varvec {T} $$
(7)

The resulting point cloud of the machined surface provides an orientation and position information. Form error can later be added to the point cloud using methods such as Gaussian random fields. To obtain the rigid transformation of the a nominal model due to a fixture error alone, a Procrustes registration from nominal position to a displaced position, \( {{PD}}( {\varvec {Q}}_{\text{assembly}} ,{\varvec{Q}}) \), can be applied. Furthermore, the simulation results alone can be used in the subsequent steps of the method proposed in this paper, without the need to render the surface or convert to image. The resulting point clouds, along with source of errors used during machining simulation, become the training data for a shallow neural network.

Training a shallow neural network

A specific combination of error source deviations (fixture, tooltip and datum deviations) yields a specific geometrical pattern on the machine surface (Shi 2006). Given error source deviations, the geometrical characteristics of the machined surface can be predicted by SNN regression.

The SNN requires a labelled training data that includes all combination of source of errors and the machined surface. One of the economical methods of generating data of combinatorial nature is Design of Experiments; however, SNN models perform better with randomized input data. Therefore, fixture and tooltip deviations can be sampled from a uniform distribution ranging between minimum and maximum deviations. For datum error, the point deviations from the nominal in the direction of X, Y, and Z are used.

Moreover, empirical results show that the accuracy of estimation of variation sources’ deviations, given a machined surface, can be increased by adding a vector connecting the secondary locators’ positions. This vector is associated with the model shape’s rotation, and transformation matrix parameters that capture the effects of the primary locators. Specifically, the parameters of the transformation matrix, derived using \( {\text{PD}}({\mathbf{Q}}_{\text{assembly}} ,{\mathbf{Q}} \)), significantly increase the accuracy of estimated variation sources given a machined surface, by adding a relationship between the locator deviations and a nominal model. To shield the user from the need to input the parameters, however, a SNN generated parameters, for a given fixture deviations, can be used. Figure 3 illustrates the SNN architecture that can be used to predict the rotation parameters R1×9 and translation parameters T1×3 given 6 locators’ deviations.

Fig. 3
figure 3

An illustration of a SNN architecture to predict a transformation matrix elements given 6 locators’ deviations

The aforementioned inputs are mapped to the deviations of the machined feature, such that the relationship is learned by the SNN. The relationship is more accurate and practical when performed for a single stage at a time. For a multistage machining, a series of predictions can be made based on upstream datum information, and current stage’s fixture and tooltip deviations. Algorithm I shows steps to generate a labelled training data. Figure 4 illustrates the inputs and outputs of a SNN architecture, where the outputs are predicted separately to increase accuracy.

Fig. 4
figure 4

An illustration of a SNN architecture to predict a machined surface based on deviations of variation sources, rotation matrix elements and a vector connecting secondary locators. Three separate SNN models are used to predict deviations in X, Y and Z direction

The set of input and output values to the neural network can mathematically be expressed as follows. For \( K \) experiments, the set of locator deviations \( \varvec {d}_{1 \ldots K}^{1 \ldots L} = \left\{ {d_{k}^{l} \in {\mathbb{R}}:l = 1,2 \ldots L, k = 1,2 \ldots K} \right\} \), tooltip deviations \( {d}_{1 \ldots K}^{tt} = \left\{ {\varvec{d}_{k}^{tt} \in {\mathbb{R}}: k = 1,2 \ldots K} \right\} \), and datum points deviations \( \varvec {d}_{1 \ldots K}^{i,1 \ldots M} \)  =  \( \left\{ {({\varvec {d}}_{k}^{{X_{i} ,m}} ,{\varvec{d}}_{\text{k}}^{{Y_{i} ,m}} ,{\varvec {d}}_{k}^{{Z_{i} ,m}} ) \in {\mathbb{R}^3}:m = 1,2 \ldots M, k = 1,2 \ldots K} \right\} \), the input data set \( \varvec{I} \) become:

$$ \varvec{I} = \left( {\begin{array}{*{20}c} {\varvec{d}_{1 \ldots K}^{1 \ldots L} , \varvec{d}_{1 \ldots K}^{tt} , \varvec{d}_{1 \ldots K}^{{X_{i} ,1 \ldots M}} ,\varvec{d}_{1 \ldots K}^{{Y_{i} ,1 \ldots M}} ,\varvec{d}_{1 \ldots K}^{{Z_{i} ,1 \ldots M}} , \varvec{R}^{1 \ldots 9} ,} \\ { \varvec{T}^{1..3} ,(\varvec{d}_{1 \ldots K}^{4} - \varvec{d}_{1 \ldots K}^{5} )} \\ \end{array} } \right) $$
(8)

where \( L \) is the total number of locators, \( M \) is total number of points in datum plane.

Similarly, the output data set \( \varvec{O} \),

$$ \varvec{O} = \left( {\varvec{d}_{1 \ldots K}^{{X_{o} ,1 \ldots N}} ,\varvec{d}_{1 \ldots K}^{{Y_{o} ,1 \ldots N}} ,\varvec{d}_{1 \ldots K}^{{Z_{o} ,1 \ldots N}} } \right) $$
(9)

where \( N \) is the total number of points in the output shape.

For a trained SNN model \( {{\varTheta }} \) and given input \( \varvec{I}' \), a specific deviation \( \varvec{O^{\prime}} = (\varvec{d}^{{ 'X_{o} }} ,\varvec{d}^{{ 'Y_{o} }} ,\varvec{d}^{{ 'Z_{o} }} ) \) is obtained by

$$ \varvec{O^{\prime}} = {{\varTheta }}\left( {\varvec{I} '} \right) $$
(10)

The predicted deviations can then be used to update the position of the nominal feature, thereby generating a surface with variation \( {\boldsymbol{\mathcal{N}}}\varvec{'} \)

$$ {\boldsymbol{\mathcal{N}}}^{'} = \left\{ {\varvec{X} + \varvec{d^{\prime}}^{{X_{o} }} , \varvec{Y} + \varvec{d^{\prime}}^{{Y_{o} }} ,\varvec{Z} + \varvec{d^{\prime}}^{{Z_{o} }} } \right\} $$
(11)

The datum’s and the resulting machined surfaces’ points should be reduced to a reasonable number before performing the machining simulation. To reduce the number of points, random down sampling, Octree based mean point extraction (Yacob et al. 2018) or K-means clustering (Jain 2010) methods can be applied.

figure a

Moreover, in a multistage machining, a stage-wise prediction can be applied. The respective SNN models are trained for a set of given fixture, tooltip and datum deviations of a specific stage. When performing a prediction, the datum deviations obtained from the output of previous stage’s trained model is used as input in the subsequent stage, as shown in Fig. 5. For a smooth stitching at the edges of predicted surface and the point cloud of the part, the steps proposed in Yan and Ballu (2017) can be applied. Further, it is worth mentioning that once the SNN is trained for all possible combination of fixture, datum and tooltip deviations, no further intervention is needed by the user when making predictions for given inputs.

Fig. 5
figure 5

Prediction of a machined feature deviations in multistage machining process using trained models

Variation source identification

As stated in the above, a specific combination of the 3 variation sources yield specific surface variation, which can be predicted with the help of a SNN. Reversing the prediction process, for a given machined surface, the error sources can be fine-tuned so that the predicted surface closely matches the actual. The resulting deviations of the error sources that closely match the surfaces are considered as the actual sources of error. In relation to SMS, pattern matching can be performed on the surfaces of interest by reducing the distance between the surfaces, in line with the technique applied in iterative closet point (ICP). The individual points deviation can be obtained by computing Hausdorff distance (Girardeau-montaut et al. 2005) or Euclidian distance from simulated points to the best fitting shape of the actual points. Figure 6 illustrates the deviations of points that must be reduced to match the pattern of simulated (or SNN predicted) points to the actual data points.

Fig. 6
figure 6

An illustration of point errors between simulated (SNN-predicted) and actual data points

The quality of surface matching between the SNN-predicted and the actual one can be estimated by computing the root-mean-squared-error (RMSE). To experiment with variation sources values that would give a matching surface, different locator and tooltip deviations within minimum and maximum allowable deviations can iteratively be tested. Since the three primary locators make a plane, independent of the shape complexity of the part, the corresponding contact points on the primary feature datum become a plane. Thus, to generate different datum orientations based on pre-selected points \( \varvec{S} = \left\{ {\left( {\varvec{X}_{s} ,\varvec{Y}_{s} ,\varvec{Z}_{s} } \right) \in {\mathbb{R}}^{3} } \right\} \), equation of a plane with coefficients \( a,b,c \) and \( d \) can be considered. Thus, for a given \( \varvec{X}_{s} \) and \( \varvec{Y}_{s} \), a new \( \varvec{Z} '_{s} \) value is derived from

$$ \varvec{Z} '_{s} = \frac{ - 1}{C}(a \varvec{X}_{s} + b\varvec{Y}_{s} + d) $$
(12)

and the new datum points then become

$$ {{\boldsymbol{\mathcal{M}}}} '= \left( {\varvec{X}_{s} ,\varvec{Y}_{s} ,\varvec{Z} '_{s} } \right) $$
(13)

Further, the RMSE between the measured surface and the surface generated by the SNN \( {\boldsymbol{\mathcal{N}}} ' \) is estimated by

$$ RMSE\left( {{\boldsymbol{\mathcal{N}}},{\boldsymbol{\mathcal{N}}} '} \right) = \left( {\frac{1}{n}\left( {{\boldsymbol{\mathcal{N}}} - {\boldsymbol{\mathcal{N}}} '} \right)^{2} } \right)^{{\frac{1}{2}}} $$
(14)

Since locator-induced and tooltip-induced variations can give the same position of a machined surface, to increase the accuracy of the prediction, two or more machined features in the same setup can be used as inputs. Minimizing the sum of RMSEs of the features, while keeping the worst locator, tooltip and datum deviations as constraints, provides the magnitudes of the source of variation. Mathematically,

$$ \begin{aligned} & {min}\,{\text{RMSE}} = {\text{RMSE}}(\boldsymbol{\mathcal{N}},{\boldsymbol{\mathcal{N}}}^{\prime } )_{{feature1}} + {\text{RMSE}}(\boldsymbol{\mathcal{N}},{\boldsymbol{\mathcal{N}}}^{\prime } )_{{feature2}} \\ & s.t. \\ & \begin{array}{*{20}l} {a + b + c = 1} \hfill & {\left( {{\text{normal}}\,{\text{ vector}}\,{\text{ constraint}}} \right)} \hfill \\ { - s \le d^{{1 \ldots L}} \le s} \hfill & {\left( {{\text{locator}}\,{\text{ constraint}}} \right)} \hfill \\ { - t \le d^{{tt}} \le t} \hfill & {\left( {{\text{tooltip}}\,{\text{ constraint}}} \right)} \hfill \\ { - {\text{r}} \le {\text{a}},{\text{b}},{\text{c}},{\text{d }} \le {\text{r}}} \hfill & {\left( {{\text{coefficients }}\,{\text{constraint}}} \right)} \hfill \\ \end{array} \\ \end{aligned} $$
(15)

The optimal outputs \( \varvec {d}^{1 \ldots L} \), \( d^{tt} \), and \( {\varvec{\mathcal{M}}}' \) through \( a, b,c \) and \( d \), become the deviations of the variation sources. Figure 7 summarizes the steps to estimate the variation source deviations iteratively, by reducing the difference between SNN-based prediction and scanned feature.

Fig. 7
figure 7

Variation source identification by feedback loop of a trained model and an optimizer per station

Demonstration case

This paper extends a 2D case study presented in Abellán-nebot et al. (2013) by adding cylindrical and torus features while considering the 3D variation, as shown in Fig. 8. Feature A was machined in Station 1 and features B, C, D, E and F were machined in Station 2. The results reported below will emphasize on feature E, as it is relatively difficult to predict its complex geometry.

Fig. 8
figure 8

A section view of a setup of a two-stage process. a Station 1. b Station 2

Machining simulation

First, multiple machining simulations with induced errors were performed to generate the would-be machined part. The part model was assembled to the primary, secondary and tertiary locators in sequence. In Station 1, a set of coplanar points were used as cutting-points and as representation of the Feature A. The position of the coplanar points was used to delineate the parts’ points that were below and above. To perform machining simulation for Station 2, the cutting points for each feature were set to prespecified depth of cut and dimensions of the feature. Based on the position of the cutting features, the points that were above, below, inside or outside the features were delineated accordingly. Moreover, a set of three landmark points, arbitrarily placed in space, were used to track the transformation of the model on and off the locators. Figure 9 shows the simulation result, where the star points were used to cut and represent the machined surface. Moreover, the simulation accuracy was validated against stream of variation model using the inputs provided in a case study reported in Abellan-Nebot et al. (2012b), which the simulation prediction was within 0.025%. The approach independent of the toolpath generation algorithms and their effect on the part. The simulation focuses on the deviation of the tool from nominal toolpath, which is assumed to be constant per operation.

Fig. 9
figure 9

A section view of the result of a machining simulation at station 2. The machined features are designated by star points

To generate a labelled training data, multiple simulation experiments were completed by assembling the SMSs to the 6 locators and machining by corresponding features. The point cloud of a nominal model was used as stock in the first station, from which 40 samples were generated. The datum and machined surfaces were represented by 100 points each; the X, Y, and Z deviations were arranged in the form of \( \varvec{d}_{k} = (\varvec{d}_{k}^{X,1 \ldots 100} ,\varvec{d}_{k}^{Y,1 \ldots 100} ,\varvec{d}_{k}^{Z,1 \ldots 100} ) \), which along with the locator deviations became inputs to the SNN. The locator and tooltip deviations were sampled from uniform distribution \( {\mathbf{\mathcal{U}}}\left( { - 0.1, 0.1} \right) \). Similarly, for Station 2, using the 40 samples of Station 2 as inputs, each sample was simulated 40 times, generating 1600 samples in 10.9 min. The samples became the training data for predicting the machined features. The samples were generated by following Algorithm 1 and the training conducted using the Deep neural network toolbox of MATLAB 2018a. In this paper, a 3.50 GHz, 4 Cores, Intel® Xeon® CPU with Windows 10 operating system and NVIDIA GPU Quadro P2000 was used to generate the simulation data and train the SNN models.

Prediction of geometric characteristics

Based on the training data obtained from the machining simulation, a feedforward neural network was trained using conjugate gradient algorithm in a GPU enabled parallel computing machine. The networks were structured in the form of 317–15–100, where the 15 hidden layers were determined based on the ability of the model to generalize on previously unseen data, as shown in Fig. 10. Similarly, a dataset of 1600 samples was selected based on the lowest mean squared error, at a cost of extra 2 min from the optimal training time, as shown in Fig. 11 The inputs 317 predictors included the 6 locator deviations, a tooltip deviation, the X, Y, and Z values of 100 points, difference between secondary locators’ points (ignoring 2 constant values), and 9 transformation matrix elements (ignoring the diagonal elements). The transformation matrix elements were generated using the 6 locators in a SNN architecture of 6–5–9.

Fig. 10
figure 10

Number of hidden layers versus mean squared error, obtained using a trained model and previously unseen data of Feature B

Fig. 11
figure 11

Number of samples versus mean squared error, obtained from a trained model and previously unseen data of Feature B

Further, in all the cases, 70%, 15%, and 15% of the generated data were used for training, validation and testing data, respectively. In all the cases, the training termination criteria was set to a maximum validation performance of 50, maximum epochs of 10,000 and minimum gradient of 10−8. The training result of all the features, a total of 18 models, ranged 10−7–10−6 mean squared error, 6000-8000 epochs and 2–5 min to compete. Due to probabilistic nature of the neural networks, the values were slightly be different at every training session Moreover, the training result of the models yielded a correlation close to 1, between the machining simulation output (target) and actual output of the SNN model, with minimal prediction error, as shown in Fig. 12. This indicates that the output of the SNN is close to the training data.

Fig. 12
figure 12

Training results of a SNN, based on data of Feature E in Z direction

To further test the trained model in predicting the geometric deviations of feature E, an unseen inputs of (0.0958, 0.0055, 0.0940, − 0.0016, − 0.0808, 0.0899, 0.0340) mm for Station 1 and (0.0236, − 0.0517, 0.0540, 0.0359, 0.0970, − 0.0475, 0.0339) mm for Station 2 were used. The predicted deviations were then added to the nominal points to get the predicted feature’s points, which took around 2 ms to generate. From Figs. 12c and 13a it can be deduced that the prediction error was less than 1%.

Fig. 13
figure 13

Comparison of machining simulation and SNN based predictions for feature E. a Histograms of deviations (mm) of 100 points in X, Y, and Z directions. b Scattered points based on prediction of a SNN model (red points) and simulation (blue circles) (Color figure online)

Moreover, to test the algorithm on more complex shapes, a free form surface shown in Fig. 14. was trained and tested, The feature, referred as Feature G in this paper, has the dimensions of Feature B and flatness value of 7.4 mm. The training result were similar to the one achieved using the features B–E. Figure 15 show the comparison of the test data and the prediction made by the trained SNN.

Fig. 14
figure 14

A free form surface (Feature G)

Fig. 15
figure 15

Comparison of machining simulation and SNN based predictions for feature G. a Scattered points based on prediction of a SNN model (red points) and simulation (blue circles). b Histograms of deviations (mm) of 100 points in X, Y, and Z directions (Color figure online)

Variation source identification

To demonstrate the proposed variation source identification method, a point cloud of the model shown in Fig. 9 was considered. The point cloud was generated by machining simulation with arbitrary deviations values, with the main goal of estimating the deviation values given machined features B–F.

Thus, in organizing the optimization input parameters, datum plane coefficients \( (a, b, c, d) \), locator and tool deviations, whose constraints set between − 0.1 and 0.1 mm, and the coefficient \( d \) between 42 and 46, as formulated in Eq. 16. Then using the Matlab’s fmincon sqp solver, the RMSE between the simulated features and SNN generated features was minimized. On average it took 3.3 s per feature for the solver to converge. The results of the solver based on an arbitrary sample with machined features B to F, with and without datum information, are shown in Fig. 16. In Fig. 16a, the estimated plane coefficient \( d \) has relatively high variation that affects the position of the datum plane. However, it is worth noting that the coefficient has limited importance when it comes to subsequent analysis that focus on the orientation aspects only.

Fig. 16
figure 16

Variation sources’ deviations based on features B to F relative to pre-specified values of 6 locator deviations (d1–d6), a tooltip deviation (dtt) and datum plane coefficients (a–d). a with an estimated datum plane. b with given datum plane. Locator and tooltip deviations are in mm

$$ \begin{aligned} & {\text{min RMSE}} = {\text{RMSE}}({\boldsymbol{\mathcal{N}}}, {\boldsymbol{\mathcal{N}}} ')_{Feature E} + {\text{RMSE}}({\boldsymbol{\mathcal{N}}}, {\boldsymbol{\mathcal{N}}} ')_{Feature F} \\ & s.t. \\ & a + b + c = 1 \\ & - 0.1 \le d^{1 \ldots 6} , d^{tt} ,\quad a, b \le 0.1 \\ & 0 \le c \le 1 \\ & 42 \le d \le 46 \\ \end{aligned} $$
(16)

Discussion

Since every physical machining operation is first simulated, it is a plus to include variation analysis capability in the simulation tool for a more realistic result. In this paper, a SNN was used to generate a function that relates the source of variation to the machined surface; the function can be embedded to commercial simulation platforms, without the need to include the associated point cloud.

Moreover, the simulation is performed in such a way that all features of a sample are virtually machined per setup. Specifically, the computational cost of generating training data was 0.4 s per sample and the training time of 2–5 min, while the prediction made by the trained model was 0.01 s per sample. The computational advantages of using the trained model instead of simulation becomes noticeable by a user when performing experiment that require large number of runs, such statistical tolerance analysis and solving optimization problems. From users’ perspective, the time saving gained when the trained models are used continuously is likely to outweigh the cost of preparing training data and training time. Figure 17 summarizes the training time per feature to achieve a certain level of mean time squared error.

Fig. 17
figure 17

Mean squared error and training time of features B to G

However, multiple assumptions have been made in developing the machining simulation. The fixture was reduced to a set of single point locators. The simulation model started out from a nominal model, with the assumption that the combined effect of fixture and datum deviation of the station can be obtained by increasing or decreasing locator deviations. Nevertheless, the nominal model can be replaced by a scanned model when available. Further, the surface texture and material characteristics of the part are not included in the simulation. A method to include such aspects would make the simulation complete. Nevertheless, from variation analysis point of view, surface texture has no functional meaning, especially under large forces. Furthermore, only the translation aspect of the cutting tool deviation was considered, ignoring potential cutting tool’s orientation deviation. To validate the machining simulation approach as well as the SNN-based geometry prediction, a commercial CAM simulation tool was utilized. The setup shown in Fig. 18 was used for machining simulation in Station 2; the locator deviations along with tooltip deviations and a model that was machined in station 1 were used as inputs. (The actual output model from station 1 is not shown in Fig. 18 for a better visualization). Using arbitrary deviations shown in Table 1, the outputs of the machining simulation on point cloud and SNN- based prediction gave parallelism error within 6.5% of the simulation result of a commercial software, Autodesk Inventor HSM CAM.

Fig. 18
figure 18

CAM simulation configuration for station 2 with locator deviations as inputs and a nominal model

Table 1 Comparison of machining simulation on point cloud and SNN-based generation of point cloud against a commercial tool HSM CAM, using the parallelism of Feature B relative to Feature A per given input of 6 locators and tooltip deviations for Station 2 and the inputs (0, − 0.04, 0, 0, 0.05, 0, − 0.07) for Station 1

Furthermore, the proposed approach of variation source identification applies pattern matching technique that iteratively matches a SNN generated surface to the actual (or simulated) data points of a single stage. To test the accuracy of the estimated variation sources relative to testcases, 20 samples from each of the features B to F and the combination B, E, and F, 140 samples in total, were iteratively estimated using their respective pre-trained SNN models and optimization solver. Figure 19a shows the errors between the SNN-based prediction and the actual values of the sources of variation, when datum deviations are unknown. Most of the errors were contributed by the datum coefficients and tooltip deviations. Even though, the error of the datum plane coefficients is small compared to the constraints’ range, a small error significantly affects the estimated tooltip deviation value. However, the reliability can significantly be increased, as shown in Fig. 19b, when the datum feature is extracted from a point cloud data of a scanned part. The locator and tooltip deviations were estimated at an error of less than 1%. Empirically, the trained SNN models should have at least 15 µm geometry prediction accuracy to be reliable in variation source identification.

Fig. 19
figure 19

Error between the actual and estimated values of variation source based on features B to F. a with estimated datum plane. b with given datum plane. Locator and tooltip deviations are in mm

Moreover, it important to embed the information about the vector connecting the secondary locators and the transformation matrix after assembling nominal datum to the primary locators in the trained model. Figure 20 shows the accuracy improvement in the estimation of variation sources’ deviations when considering these information.

Fig. 20
figure 20

Error (mm) between the actual and estimated values of variation source based on Features B, with and without considering both the vector connecting the secondary locators and transformation matrix

Conclusion

Variation modelling has a significant importance in processes planning, variation source identification, and tolerance synthesis and analysis. This paper showed how to apply a multilayer shallow neural network to predict the geometric characteristics of machined parts and estimate the variation source’s deviation in a multistage machining setting. To predict geometric shapes, a method for machining simulation on a point cloud was introduced and applied to a two-stage machining line. The resulting point cloud data, along with the induced locator and tooltip deviations, were used to train multiple SNN regression models. The trained models could predict their respective geometries at an error of less 1% in around 2 ms, for input data that the models have never seen before. The SNN-based approach has the potential to be an alternative to the mathematically complicated formulation of variation propagation models and the very slow CAM simulation-based generation of geometric models with variation. Further, such approach overcomes the current difficulty of processing point cloud data in CAD environment.

Moreover, based on the SNN generated geometry and process parameters as constraints, a linear programming model was formulated, and the associated parameters optimized. The magnitude of deviation of locators and tooltip could be estimated at an error of 4.25% and 1% when datum deviation is unknown and known, respectively, in about 3.3 s.

Despite the stated advantages, the shallow learning-based approaches are not deterministic in nature, and thus each trained model can yield slightly different results. Each point is predicted individually, which may induce variation as high 5 µm to some points. In future work, ways to improve the prediction accuracy by embedding transformation matrices due to datum deviations will be investigated.