Sede centrale Svizzera
Beckhoff Automation AG

Rheinweg 7
8200 Schaffhausen, Svizzera

+41 52 633 40 40
info@beckhoff.ch
www.beckhoff.com/it-ch/

Supporto tecnico Schaffhausen (German)

+41 52 633 40 40
support@beckhoff.ch
Modulo di contatto

Supporto tecnico Arbon (German)

+41 71 447 10 80
support@beckhoff.ch

Supporto tecnico Lyssach (German)

+41 34 447 44 88
support@beckhoff.ch

Supporto tecnico Yverdon-les-Bains (French)

+41 24 447 27 00
support@beckhoff.ch

Supporto tecnico Losone (Italian)

+41 91 792 24 40
support@beckhoff.ch

TwinCAT Machine Learning:

Scalable, open and in real time

Artificial intelligence seamlessly integrated at control level

Today, artificial intelligence (AI) is considered a key technology in automation. It imitates human learning and decision-making processes and opens up new avenues for process optimization, quality improvement, and energy efficiency. The most successful approach is machine learning (ML), which detects patterns and correlations in sample data.

Beckhoff consistently integrates this technology into the PC-based control world: With TwinCAT 3 Machine Learning, AI is becoming an integral part of machine control.
This results in an open, integrated hardware and software ecosystem that enables AI models to run directly on the PLC – without external systems or specialized knowledge.

Learn how Beckhoff bridges the gap between data collection, training, and real-time inference – and how you can integrate AI directly into your control system with TwinCAT 3 Machine Learning.

AI applications in industrial automation – recognizing new potential

Artificial intelligence opens up new avenues in machine and system engineering for increasing quality, productivity, and efficiency. It complements classic control and automation concepts wherever conventional algorithms reach their limits, such as in cases of high variance, complex data patterns, or processes that are difficult to model.

AI systems learn from examples, recognize correlations independently, and make data-based decisions. This makes machines more adaptive, precise, and predictive.

Computer vision: Machines see and understand

Automated visual quality control is one of the most important and challenging areas of AI application in industry. While classic image processing algorithms solve well-defined tasks, such as length measurements or edge checks, AI-based methods reveal their strengths when dealing with natural variance and irregular patterns, where conventional rules fail.

  • highly robust when faced with changes in illumination and environment
  • can be adapted to new product variants through retraining
  • 100% test rates without manual parameter optimization
  • seamless integration into control systems with TwinCAT

  • Quality and surface inspection
    Detection of cracks, scratches, soiling, or shape deviations on metallic, wooden, or polymer surfaces
    (Example: end-of-line testing of metal components, wooden panels, or injection-molded parts)
  • Classification and sorting
    Sorting natural products according to quality grades, color, ripeness, or damage
    (Example: classification of eggs, fruit, or other agricultural products)
  • Anomaly detection in processes
    Visual monitoring of packaging, welding, or assembly processes to detect faulty procedures
    (Example: detection of defective seal seams in food packaging)
  • Object recognition and localization
    AI-supported detection of components, holes, or markings for robot-assisted pick-and-place or assembly processes
    (Example: aligning a bottle using the PET logo for precise labeling)

Signals and time series: Machines hear and feel

In addition to visual data, time-based signals form the basis of many industrial AI applications. Current, pressure, vibration, or temperature curves provide information about the state of processes, components, and tools. AI models detect patterns and deviations at an early stage, enabling predictive maintenance, process optimization, and anomaly detection in real time.

  • recognition of subtle patterns beyond classic threshold values
  • combination of multiple sensor signals into holistic state models
  • seamless integration into control systems with TwinCAT

  • Process monitoring and quality assurance
    AI-based assessment of welding, pressing, or packaging processes based on electrical or mechanical signals
    (Example: detection of faulty seals using servo current profiles)
  • Process optimization
    Dynamic adjustment of parameters such as pressing force, feed rate, or temperature for maximum energy efficiency and product quality
    (Example: adaptive feed control for milling processes based on current curves)
  • Forecasting and control
    Short-term forecasts of process variables such as wind direction, pressure, or temperature for predictive control
    (Example: prediction of wind speed and wind direction for the optimum alignment of wind turbines)
  • Condition monitoring and predictive maintenance
    Early detection of bearing damage, imbalances, or pump wear through analysis of vibration and current signals
    (Example: detection of compressor defects via temperature and current curves)

From data to application

Simplified representation of the workflow from data collection and training to the integration of a trained AI model into a production environment
Simplified representation of the workflow from data collection and training to the integration of a trained AI model into a production environment

Beckhoff offers a continuous workflow from data acquisition to real-time execution – fully integrated, open, and without lock-in effects. With its open system, Beckhoff allows specific requirements to be met using toolboxes and functions from the TwinCAT modular system. This also applies to existing system infrastructures that are not based on Beckhoff products.

See below to find out more about the options that Beckhoff can offer for the workflow outlined on the right.

Each application and also each IT infrastructure places different demands on the method of collecting machine data: SQL or noSQL, file-based, local or remote, limited port releases, cloud-based data lake, and many more. For all of these scenarios there are a large number of established TwinCAT products available, such as the TwinCAT 3 Database Server TF6420, the TwinCAT 3 Scope Server TF3300, TwinCAT 3 Analytics Logger TF3500, or the TwinCAT 3 IoT Data Agent TF6720. For image data, TwinCAT Vision provides an entire product family for image acquisition, image (pre)processing, and image storage.

Machine learning needs clean, representative data sets as a foundation. Depending on the task, these are pre-processed, labeled, and then trained – either automatically or manually.

For automation and process experts

With the TE3850 TwinCAT 3 Machine Learning Creator, users without prior AI knowledge can create AI models independently – quickly, intuitively, and without AI expertise.

  • automated, intuitive training via a web-based no-code interface
  • optimized for accuracy and latency for Beckhoff hardware
  • export in open ONNX format for maximum interoperability
  • provision of a PLCopen XML file for direct integration in TwinCAT

This creates a standardized, reproducible training process that requires no data science expertise.

For AI experts

Depending on their objectives and working methods, AI experts have two possible roles in the Beckhoff ecosystem:

  • The AI expert with the Machine Learning Creator
    The TwinCAT 3 Machine Learning Creator can serve as an efficiency tool to standardize, accelerate, and document the training process. Data scientists use the tool to quickly generate an initial model (“version 0”), create benchmark data, or compare different configurations. The models generated can then be imported into specialized AI frameworks via ONNX and further refined there.
  • The AI expert as an independent framework user
    Alternatively, data scientists can work entirely in their familiar environment. Models trained using frameworks such as PyTorch or TensorFlow can be exported directly as ONNX files and integrated into the Beckhoff AI system. This preserves complete freedom in model design, while execution takes place seamlessly in TwinCAT.

Both approaches are fully compatible and interoperable. This allows companies to optimally combine their existing AI expertise with the real-time and automation advantages of the Beckhoff environment without lock-in effects, but with maximum integration depth.

If the trained model is available as an ONNX file, it can be loaded and executed directly on the control computer. This makes AI an integral part of the PLC application – with all the advantages that entails:

  • no additional hardware or interfaces required
  • standardized system for maintenance, security, and updates
  • direct access to all machine data in real time
  • cost-efficient, scalable, and transparent

Hardware

Depending on the model size and latency requirements, various hardware options are available, ranging from CPU-based to GPU-accelerated solutions.

CPU-based execution: For many applications, executing AI models on standard CPUs without additional specialized hardware is sufficient. The familiar Beckhoff portfolio, ranging from Intel Atom® to Intel® Xeon®, covers all performance levels and enables real-time, cost-efficient integration of AI models into the TwinCAT runtime process.

GPU-accelerated execution: For larger neural networks or high latency requirements, the use of GPU-based systems is recommended. The C6043 ultra-compact Industrial PC with Intel® CoreTM i and NVIDIA® GPU (e.g., RTXTM A500 or RTXTM 2000) provides the computing power needed to run complex deep learning or vision models in near real time, directly called from the PLC code.

Software

Two architectures are available for the productive use of AI models, which differ in terms of execution type, latency behavior, and hardware use. Both variants integrate fully into the TwinCAT environment and support the open ONNX standard.

Inference in the TwinCAT runtime: The AI model is executed directly in the real-time context of the control system (XAR). Calculations are performed synchronously and deterministically on the CPU – ideal for applications with fixed cycle times or hard real-time requirements. This variant requires no additional hardware and uses the familiar Beckhoff IPC portfolio. It is particularly suitable for relatively compact deep learning or classic ML models where low latency and precise timing are crucial.

Inference server (GPU-accelerated): Alternatively, AI execution can take place in a separate server process. This architecture enables near real-time processing with significantly higher AI computing power thanks to GPU support – especially in combination with the C6043 ultra-compact Industrial PC with integrated NVIDIA® RTXTM GPU. It is ideal for larger deep learning models that combine high model complexity with short response times. In addition, the server approach allows multi-client connections and thus central provision of AI models for multiple controllers.

The following table shows the respective properties:

Execution type Properties Typical products
Inference in the TwinCAT runtime Hard real time execution
CPU-based
Highly optimized models
ONNX-compatible
TF3800 | TwinCAT 3 Machine Learning Inference Engine
TF3810 | TwinCAT 3 Neural Network Inference Engine
TF7810 | TwinCAT 3 Vision Neural Network
Inference server (separate process) Near real time
GPU support
Multi-client operation
ONNX-compatible
TF3820 | TwinCAT 3 Machine Learning Server
TF3830 | TwinCAT 3 Machine Learning Server Client

AI models are capable of improving through training with larger sets of data. Likewise, general conditions can change gradually or spontaneously when the machine is being operated. This means you can update the trained AI models during the machine’s normal runtime – i.e., without stopping the machine, without recompilation, and also completely remotely through the standard IT infrastructure. Regardless of which TwinCAT product you choose to execute the AI models, a new AI model can be transferred to the control computer and reloaded via PLC functions.

What’s more, you can also operate your training environment remotely or locally on the industrial PC within the operating system context, allowing you to retrain, exchange, and load models with TwinCAT in close proximity to the process.

Application examples for artificial intelligence in control systems

Virtual machines provide flexible execution environments for containerized edge applications.
Virtual machines provide flexible execution environments for containerized edge applications.

In the discrete production of metallic workpieces, the geometric shape is often a key quality feature. In addition to metric measurement methods to assess a workpiece quantitatively, qualitative statements (such as the classic categorization into OK and non-OK) are often sufficient.

A representative data set of approx. 200 images was recorded and saved using the TwinCAT Vision library. The data was annotated as OK and non-OK, whereby various different error patterns were summarized together as non-OK. With the TE3850 TwinCAT 3 Machine Learning Creator, an image classification model could be trained based on this data set, which can predict whether a workpiece is OK or not OK in more than 95% of the cases considered – without any AI expert knowledge.

Retrofitting existing machines
Retrofitting existing machines

Automation in the food industry contributes to the efficient and resource-saving supply of a wide variety of foods. One challenge is the automated sorting of foodstuffs, as these have a high natural variance compared to artificially produced products. In the context of eggs, for example, these should automatically be sorted into the categories OK, dirty, and broken. For this purpose, 200 images were taken with these three classes and annotated. With the TE3850 TwinCAT 3 Machine Learning Creator, it was possible to create an AI model that can correctly classify an egg in more than 90% of the cases considered. Using the explainability methods for AI models included in the product, it was easy to find out that misclassifications occurred especially in marginal areas from OK to dirty. This made it immediately clear what measures needed to be taken to improve the model: Either provide more sample data in the boundary area between OK and dirty, or define the boundary more cleanly by revising the existing annotations.

All data from the machine park is consolidated and pre-processed.
All data from the machine park is consolidated and pre-processed.

Wind turbines are a key component in the transition to renewable energies. They supply clean, electrical energy, which they obtain from the kinetic energy of the wind. Knowing both the wind direction and the wind speed is crucial for the efficiency of the system. The rotor attached to the nacelle is aligned with the wind direction according to the wind direction. As for the pitch of the rotor blades, this is adjusted according to the wind speed so that the turbine is operated as constantly as possible at its rated output.

Wind direction tracking and pitch adjustment are relatively slow, which means that the future wind direction and speed have to be estimated in order to move the turbine predictively to the optimum orientation.

Based on wind data collected from real wind turbines, an AI model was created that is able to estimate wind direction and wind speed values 10 to 20 seconds in the future with an acceptable margin of error. This is based entirely on past wind values. The created model can be easily integrated into TwinCAT with the TF3810 TwinCAT 3 Neural Network Inference Engine.

Representation of the core width as one of the quality criteria for the core wrapping
Representation of the core width as one of the quality criteria for the core wrapping

A mechanical bolt anchor essentially comprises the bolt, a washer, a hexagon nut, and a metal sleeve. The frictional forces between the sleeve and the wall of the drill hole ensure sufficient adhesion during use. To apply the normal forces required for the holding force to the drill hole, the sleeve is expanded with the drill hole via the conical head of the metal bolt.

The project, led by R&D engineer Robin Vetsch as part of the OST’s Bachelor of Science in Systems Engineering, focused on the enclosure process, whereby the preformed, punched sleeve encloses the conical neck of the bolt anchor. Only the existing machine data was to be used for quality control – i.e., no installation of additional sensors.

Until this point, the quality of the sleeve around the bolt was mostly checked manually using a test gauge. Now, however, it has been demonstrated that each enclosure can be classified into three different categories (under-enclosed, acceptable, over-enclosed) within the quality specifications. The geometric key data of the enclosed sleeve (sleeve width, height, and opening) should also be predicted with a regression. The 100% inspection of the enclosure process is designed to detect trends or deviations at an early stage.

Lu Peng (left), project manager from Tianjin FengYu, and Wan Pinlei (center), system application engineer from Beckhoff China – with the CX51x0 Embedded PC as the hardware core of the TwinCAT Machine Learning solution – and Xie Shaowei, technical support engineer from Beckhoff China (right)
Lu Peng (left), project manager from Tianjin FengYu, and Wan Pinlei (center), system application engineer from Beckhoff China – with the CX51x0 Embedded PC as the hardware core of the TwinCAT Machine Learning solution – and Xie Shaowei, technical support engineer from Beckhoff China (right)

Instant noodles can be found in just about every food store in China. In a bid to reduce the number of products with packaging errors and the associated customer complaints, a large Chinese producer of instant noodles decided to turn to Beckhoff control technology including TwinCAT Machine Learning. This made it possible to perform intelligent and reliable real-time inspection of the packaging quality.

In the first step, the sensor data was acquired via EL1xxx and EL3xxx EtherCAT digital and analog input terminals along with TE1300 TwinCAT 3 Scope View Professional. The AI model was then trained via the Open Source Framework Scikit Learn, and the model description file was generated from it. The requisite pre-processing of the sensor data was implemented in the controller using TF3600 TwinCAT 3 Condition Monitoring. In the next step, the corresponding model description file was deployed to a CX51x0 Embedded PC, which runs the AI model in real-time with the help of the TF3800 TwinCAT 3 Machine Learning Inference Engine and outputs the inference results for the detection of faulty products via an EL2xxx EtherCAT digital output terminal. The system openness in particular – a great advantage of the Beckhoff control technology – bore fruit here, as this could be integrated into the existing third-party main controller of the production line with no great effort.

Products

TE3850 | TwinCAT 3 Machine Learning Creator

TE3850 | TwinCAT 3 Machine Learning Creator

The TwinCAT 3 Machine Learning Creator automatically creates AI models based on data sets. These AI models can be optimized in terms of their accuracy and latency to ensure they run efficiently on Beckhoff Industrial PCs with TwinCAT products. The generated models can also be used as standardized ONNX models beyond the Beckhoff product range. For AI model execution with TwinCAT products, a PLCopen XML file with IEC 61131-3 code is created in addition to the model, which describes the complete AI pipeline and can be imported seamlessly into TwinCAT.

TF3800 | TwinCAT 3 Machine Learning Inference Engine

TF3800 | TwinCAT 3 Machine Learning Inference Engine

The TF3800 TwinCAT 3 Function is a high-performance execution module (inference engine) for trained, conventional machine learning algorithms.

TF3810 | TwinCAT 3 Neural Network Inference Engine

TF3810 | TwinCAT 3 Neural Network Inference Engine

The TF3810 TwinCAT 3 Function is a high-performance execution module (inference engine) for trained neural networks.

TF3820 | TwinCAT 3 Machine Learning Server

TF3820 | TwinCAT 3 Machine Learning Server

The TF3820 TwinCAT 3 Machine Learning Server is a high-performance service for executing trained AI models with the option of using hardware accelerators.

TF3830 | TwinCAT 3 Machine Learning Server Client

TF3830 | TwinCAT 3 Machine Learning Server Client

The TwinCAT 3 Machine Learning Server includes a connection to a local client as standard (local TwinCAT runtime). If (possibly further) TwinCAT runtimes need remote access to a TwinCAT 3 Machine Learning Server, these runtimes must each be equipped with a license for the TF3830 TwinCAT 3 Machine Learning Client.

TF7800 | TwinCAT 3 Vision Machine Learning

TF7800 | TwinCAT 3 Vision Machine Learning

TwinCAT 3 Vision Machine Learning provides an integrated machine learning (ML) solution for vision-specific use cases. Both the training and the implementation of the machine learning models take place in real time, and they even help machines to learn sophisticated data analyses automatically. This can be used to replace complex, manually created program constructs.

TF7810 | TwinCAT 3 Vision Neural Network

TF7810 | TwinCAT 3 Vision Neural Network

TwinCAT 3 Vision Neural Network provides an integrated machine learning (ML) solution for vision-specific use cases. The implementation of the machine learning models takes place in real time. With the help of these models, complex data analyses can be learned automatically. This means that complex, manually created program constructs can be replaced.

C6043 | Ultra-compact Industrial PC with NVIDIA® GPU

C6043 | Ultra-compact Industrial PC with NVIDIA® GPU

The C6043 Industrial PC with NVIDIA® GPU handles applications with high demands on 3D graphics or deeply integrated Vision and AI program blocks with minimal cycle times. It extends the series of ultra-compact industrial PCs to include a high-performance device with a built-in slot for powerful graphics cards. With the latest Intel® Core™ processors and highly parallelizing NVIDIA® graphics processors, the PC becomes the perfect central control unit for ultra-sophisticated applications. The Beckhoff TwinCAT 3 control software is capable of mapping this as a fully integrated solution – without any additional software or interfaces. With the additional freely assignable PCIe® compact module slot, the C6043 can be flexibly expanded with supplementary functions.

C6675 | Control cabinet Industrial PC

C6675 | Control cabinet Industrial PC

The C6675 industrial PC is equipped with top-performance components with Intel® Celeron®, Pentium® or Core™ i3/i5/i7/i9 of the latest generation on an ATX motherboard.. The housing and cooling concept adopted from the C6670 also enables the use of a GPU accelerator card, among other things. A total of 300 W is available for full-length plug-in cards. Applications in the field of machine learning or vision can thus be realized in an industrial environment.