FrigørFastgørLuk

Jul 22, 2021

TwinCAT Machine Learning optimizes an intelligent anchor bolt production line

Machine learning enables reliable real-time quality inspections in manufacturing

In this application, an internationally operating company that specializes in fastening technology produces, among other things, anchor bolts of the most diverse types. In order to determine the enclosing quality of the associated metallic sleeve from existing machine data in real-time, a corresponding development project was conducted as part of a bachelor thesis on the Buchs campus of the Ostschweizer Fachhochschule (OST, Eastern Switzerland University of Applied Sciences). Machine learning (ML) with TwinCAT Machine Learning software from Beckhoff has proven to be a suitable solution.

Visualization of the test statistics.
Visualization of the test statistics.

A mechanical anchor bolt essentially consists of the bolt, a washer, a hexagonal nut and a metallic sleeve. The friction forces between the sleeve and the wall of the drill hole ensure sufficient adhesion in use. To apply the normal forces required for the adhesive force to the drill hole, the sleeve is spread apart with the drill hole by the conical head of the metal bolt.

Goal of the project

The project, which was run by the R&D engineer Robin Vetsch as part of the OST degree course Bachelor of Science System Technology, focused on the enclosing process in which the pre-formed punched sleeve encloses the conical neck of the anchor bolt. The pre-formed metal sleeves are closed around the neck of the bolt via two servo cylinders using a newly developed manufacturing concept. The two servo cylinders are controlled precisely by a Beckhoff AX5206 Servo Drive.

The aim of the bachelor thesis was to develop an automated quality inspection procedure with the help of machine learning methods. The quality inspection would only use the existing machine data sources, i.e. no additional sensors were to be installed. Until this project, the enclosure quality of the sleeve around the bolt had mostly been checked manually with a gauge. Now it was shown that all enclosures can be classified into three different classes (enclosed too loosely, OK, enclosed too tightly) within the quality specifications. Furthermore, the geometric key data for the enclosing sleeve (sleeve width, height and opening) were to be predicted with a regression. The 100% inspection of the enclosing procedure would detect trends or deviations at an early stage.

The project team (from left): Christian Egger, scientific associate at the Institute of Computational Engineering (ICE) of OST, Prof. Dr. Christoph Würsch, lecturer at ICE, and R&D engineer Robin Vetsch.
The project team (from left): Christian Egger, scientific associate at the Institute of Computational Engineering (ICE) of OST, Prof. Dr. Christoph Würsch, lecturer at ICE, and R&D engineer Robin Vetsch.

A cylindrical test sleeve was used as a quality benchmark. The bolt enclosed by the sleeve must fit exactly into this gauge, i.e. the sleeve must not enclose the bolt too tightly or too loosely. On the basis of various FEM simulations of the enclosing process, the parameters that have a relevant effect on the enclosure result were defined. Tuned to this information, numerous enclosing tests followed, during which all important real-time data from the two servo cylinders were recorded with the TwinCAT Scope software oscilloscope. These included, for example, the power consumption, the torque and the lag error of the servomotors.

ML integration in the machine controller

Within a classic ML framework – in this case Scikit Learn – a very robust machine learning regression model was developed and trained on the basis of the recorded test data. Such work with the ML framework includes the preparation and selection of the data, the modeling and training of a suitable ML algorithm and its evaluation. The result of this engineering step is a trained ML model, which represents the relationship between input and target data. The interface for the deployment of the Trained ML model in TwinCAT 3 is just as open as the interface to the data. Here, the Open Neural Network Exchange (ONNX) file format is supported as an established standard.

The next step of the project involved the real-time capable integration of the trained ML model into the machine controller. To do this, the TwinCAT 3 Neural Network Inference Engine (TF3810) was used so that, according to Robin Vetsch, the model converted to the ONNX format could be implemented in the TwinCAT real-time environment in a very simple way requiring just a few lines of code. For such a deployment of the ML model in TwinCAT 3, the exported ML model is converted into a binary format (.bml) and then saved on the target system (Embedded PC or control cabinet PC). After loading the .bml file, the runtime model precisely configures itself in such a way that the exact computing operations needed for the inference of the ML model are run efficiently on the CPU of the Industrial PC. This ensures that the resulting module is a real-time capable inference engine that integrates seamlessly into TwinCAT 3 and supports all established ways of programming in TwinCAT 3: calling of the module from the PLC, from C/C++ or directly via a cyclic task.

Representation of the sleeve width as one of the quality criteria for the sleeve enclosure.
Representation of the sleeve width as one of the quality criteria for the sleeve enclosure.

Results of the project

Due to the execution of the ML model trained for the anchor bolt inspection, the height and width of the enclosing sleeve could be estimated with an accuracy of +/-0.15 mm, which is equivalent to a relative error of just under 2%. The sleeve opening could be estimated with a relative error of 10%. As a simplified approximation, it could be determined that the test sleeve used sufficiently specified the height and width of the enclosing sleeve. A neural network of the type MLP (Multi Layer Perceptron) was used for this purpose. The output variables of the model are the estimated values for the width, height and opening of the sleeve. Through simple limit values defined in the PLC, a simple classification can be implemented in addition to the regression.

According to Robin Vetsch, the company benefits from numerous advantages with the help of the data-based quality inspection. This way, a 100% inline quality inspection can be implemented without additional sensors or test stations. Furthermore, the quality data existing for each enclosing procedure can be used for more detailed evaluation. The real-time capability of the ML solution offers the optimum basis for the implementation of the earliest possible ejection of the detected bad parts. Finally, a detailed trend representation via TwinCAT HMI enables prompt responses on the part of the operator if necessary.