# Towards Machine Learning for Error Compensation in Additive Manufacturing
## 4 Error Compensation in Additive Manufacturing  
Unlike other manufacturing processes, AM defects' analysis and modelling has yet to be fully established and explored. 3D printing which can be considered as non-linear system possess a rather difficult error control generally [104]. The research field of error compensation in 3D printing is still in its inception stage, however, it benefits from the maturing techniques of various data mining analytics and machine learning. Their successful applications in a list of engineering fields proved that similar approaches could be applied in additive manufacturing processes specifically for error compensation which in turn, provide congruous end products. AM geometric deviation modelling has been investigated for various AM processes from various aspects, including characterization of geometric approximation errors during conversion from CAD model to standard input files, parametric modelling of machine errors and identification of influential process factors on shape shrinkage ratio. The focus of these methods is concentrated on a global improvement of geometrical accuracy. To derive more specific models of shape deviation, [PERSON] et al. decompose an AM shape deviation into in-plane and out-of-plane deviation, and developed deviation models incorporating only the shape parameters based on statistical methods [105]. In an AM process, the error generation mechanism can be explained by three main error sources:  
* Material related error such as thermal shrinkage and material distortion arising from the rapid heating and cooling process [106,107]. * Production process induced error resulting from machine errors and process characteristics [108,109]. * Error due to conversion from scanned/CAD model to the standard file input as mathematical geometry approximation [110,111]. Due to the nature of AM which lays out one layer at a time, the effect of error sources could arise in both inside each layer and between layers, resulting in in-plane and out-of-plane deviations of the product shape from its nominal design [105]. An in-plane situation is considered in this research [112], where small layer thickness allows the authors to reduce the problem into a two-dimensional (2D) problem by approximating the boundary of a layer with a 2D shape. Calculation of the variation effects on the designed 2D shape is essential to the effective modelling of AM shape deviation, thus motivating us to investigate the transformations of the designed shape resulting from the complex error sources. Mechanical wise, AM methods like LSTM benefits from error compensation by predicting the tensile strength of the printed parts by utilizing in-process layer wise features acquired by infrared sensing data [113], with a prediction RMSE of \(1.8~{}\times~{}10^{-2}~{}kN\). The transformation perspective can be reasonably justified since, the process-induced error, such as unexpected displacement of machine axes or variation in electrical components, may cause slight translation and rotation of shape with respect to the original machine coordinate system, and a material-related error, such as thermal shrinkage, may cause local variations of shape from its original software form. The accumulation of these deviations can a result in the deviation in dimensionality from the original CAD dimensions. The stack-up of layers will accumulate these deviations and affect the overall product form. Therefore, three kinds of transformations can be defined on a 2D shape in the \(x-y\) building plane: translations in \(x\)- and \(y\)- direction \(\Delta x\), \(\Delta y\), rotation with respect to the origin and scaling in \(x\)- and \(y\)-direction \(\Phi x\), \(\Phi y\). Figure 10 illustrates the transformation effects on the designed shape during AM process. A mathematical relationship between the designed shape \(\Omega\circ\) and the final shape \(\Omega^{\star}\) can be established based on the transformation parameter set \(C=\{\phi x,\ \phi y,\ \alpha,\ \Delta x,\ \Delta y\}\).