Interview with Dr. Fabian Bause, Beckhoff
"AI is an evolutionary process"
Beckhoff has integrated machine learning into its TwinCAT 3 controllers and gained experience. In this interview, Dr. Fabian Bause, Product Manager Twin-CAT, explains how machine learning can be used profitably.
Before companies implement machine learning, what should be the first step?
Dr. Fabian Bause: The first step should always be to analyze exactly where machine learning (ML) can be used successfully, i.e. profitably. People tend to take extreme positions when it comes to new technologies: Either there are concerns because there is a lack of experience with it, or the enthusiasm is so great that, if possible, all previously inadequately addressed challenges should be solved with this technology. Both paths should not be taken, but rather analyzed objectively to determine where ML can really help with success.
Once a potentially suitable application for ML has been found, it should be quickly implemented as a prototype in an agile environment. The agility of the project team is a decisive factor. ML projects are fundamentally evolutionary in nature and therefore cannot be forced into a tightly prescribed corset.
Dr. Fabian Bause, TwinCAT Product Manager at Beckhoff Automation: "Today, it is no problem to execute neural networks even in the microsecond range."
© Dr. Fabian Bause, TwinCAT Product Manager at Beckhoff AutomationAt the Hannover Messe 2019, Beckhoff announced that it would be integrating machine learning into the TwinCAT 3 controller. Which application areas have stood out since then and why?
Dr. Fabian Bause : Last year, we had a successful beta phase and also a very successful market launch for our first product - an inference engine for machine learning models that is seamlessly integrated into TwinCAT 3. The special feature of this solution is the execution of models such as neural networks directly in the TwinCAT real-time environment. This means that there are no limits to the fields of application in a machine.
On the user side, a cluster has primarily formed in ML-based solutions for quality control and process monitoring/process optimization. Fully automated and control-integrated quality control, which is also based on existing machine data, e.g. motor currents, speeds and tracking errors, enables 100% inspection of the goods produced - 24 hours a day, 7 days a week, without tiring and in a cycle time that is far superior to that of humans. The areas of process monitoring and process optimization are consecutive, i.e. directly successive steps: if a process can be monitored with a trained model, the machine can send a message to the machine operator, who in turn adapts the process promptly in order to achieve the desired product quality. The next step is to learn from the experienced machine operator and train the model in such a way that it independently makes the necessary parameter adjustments based on the operator's example or, in an intermediate step, makes parameterization suggestions as a 'smart assistant'.
At Beckhoff, in addition to the infrastructural components for ML in the control system, we are also increasingly working on applications in the fields of image processing and motion control. The aim is to provide users with optimized hardware and software components that can be used without prior ML knowledge.
Machine learning in real time
Machine learning in real time is a challenge, especially in production, where very fast processes take place, and requires a certain amount of computing power. How can machine learning still be used in real-time controlled applications such as motion applications?
Dr. Fabian Bause: First of all, it is important to realize that the training of ML models takes considerably more time than the execution (inference) of learned models. The inference in TwinCAT runs on the hardware side on our IPCs. A key aspect for efficient execution on the CPU is the consistent use of SIMD instruction set extensions in combination with highly optimized memory management in the cache. In addition, the current trend towards more and more processor cores per CPU supports the accelerated execution of neural networks, as these can be parallelized very efficiently.
Furthermore, it is always necessary to take a close look at the trained model. It is the same as with 'hand-written' source code. A lot of and possibly inefficient source code has longer execution times than lean and optimized source code. The trained ML models should always be adapted and optimized to the task. Today, it is no problem to execute neural networks in the microsecond range. A good example is the corresponding trade fair exhibit, in which a multi-layer perceptron neural network with 250 neurons is used. The execution time on an Intel Core i3 CPU is only a few microseconds using our highly optimized inference engine. We therefore do not expect any major obstacles in terms of computing power when using ML in image processing and in the motion area.
When should machine learning ideally be integrated into the application - during application development or only during operation?
Dr. Fabian Bause: As mentioned at the beginning, an ML project is an evolutionary process and should start as early as possible in the machine manufacturer's value chain. An optimum solution will not exist for every application when a machine is commissioned by the end customer. New relevant data can be collected and evaluated during the machine's service life. In this way, an ML model can be continuously improved. To provide technical support for this process, Beckhoff has designed its inference machine in such a way that it can load newly created models without a TwinCAT stop and without compiling source code - i.e. at machine runtime.
In many applications, there is already a machine with a controller that does not include ML functionality. Machine operators want to optimize their production and are now increasingly considering the use of ML for this reason. In these cases, an open control concept plays a decisive role: thanks to its numerous interfaces, the subsequent integration of a TwinCAT controller into the existing control concept is not an obstacle. This was the case, for example, with our first customer for TwinCAT Machine Learning: a third-party controller was, and still is, in use here. An embedded PC from Beckhoff with TwinCAT 3 was added, which has read access to the essential data from the third-party controller and houses the inference for implementing a quality control role in the TwinCAT environment.
The be-all and end-all of reliable ML applications is the database. How is the training data selected in TwinCAT Machine Learning? Is a data scientist required?
Dr. Fabian Bause: An ML project is teamwork, whereby the project team is made up of different experts. The central person is the domain expert, e.g. the mechanical engineer or the expert for linear drives or the forming process. They are faced with a challenge that they want to solve using machine learning, so they have a goal in mind and know the interrelationships in their machine. Together with a data scientist, who is mainly responsible for data analysis, key machine variables that may be important for the defined goal are determined. The data scientist always works closely with the domain expert to shed light on the significance of certain data patterns and behavior. A data scientist alone, without feedback from the domain expert, can only act inadequately.
At Beckhoff, we work flexibly with our customers at this point and tailor our approach to their individual situation. Some machine manufacturers already have data science departments, possibly as a one-man show, and take on this task. Others need clear assistance, which we can provide. Of course, customers also contact us and ask for a service - in other words, an 'all-round carefree package' for the tasks of the data scientist. In such cases, we are happy to draw on our established network of specialized partner companies and establish the appropriate connection.
Train and protect ML models
How do you train a model for anomaly detection if no anomalies are known?
Dr. Fabian Bause: There are many ways to achieve this. A simple, easy-to-describe variant is to train a classification model with only one known class - the 'no anomaly' class. During training, the model is only presented with data that contains no anomalies and this data set is defined as 'class A'. If the algorithm is used in the process, it recognizes 'class A'. However, it also recognizes when the data has a different unknown structure and then reports an unspecified anomaly.
Once again, AI is an evolutionary process. If data is continuously collected from the machine and the classification result is also saved, the data scientist and the domain expert can subsequently analyze precisely those process sequences in which an anomaly was detected in more detail. If necessary, a model update can then be used that not only detects an anomaly, but also narrows down the detected case in more detail.
To what extent are data and know-how protection limiting factors in the development or training of ML models?
Dr. Fabian Bause: At first glance, the issue of data protection seems far away when it comes to machine data. However, a closer look reveals its relevance. Although we are working with neutral machine data, it is people who collect this data and label it, for example. The data is therefore no longer purely neutral in nature. When working on ML projects, you should therefore always have the necessary sense of proportion with regard to data protection.
How secure are ML models? Can they be manipulated by cyber criminals, for example?
Dr. Fabian Bause: Any data or program code that exists on PCs in our digitalized world can be manipulated to some extent by cyber criminals. An ML model is certainly no exception. IT security measures are correspondingly important. Beckhoff takes this area very seriously and continuously develops appropriate measures for the management of security risks when using its products.
Keyword safety: What needs to be considered for ML in safety applications?
Dr. Fabian Bause: Functional safety is a strictly regulated area. ML applications are still very young here and are still at the research stage. In my view, some fundamental development work still needs to be done here.














