Big Data

Dr. Fabian Bause, Dr. Rainer Mümmler | Meinrad Happacher,

Online machine data under control

Turning huge amounts of data into valuable information - how can this smart industry approach be implemented? Linking PC-based controllers with Matlab and a cloud-based IoT analytics service can be a viable approach.

© AdobeStock/yingyaipumi

Smart industry will change familiar paradigms, such as the shape of the conventional automation pyramid. One current trend is the direct connection of the MES and even the ERP layer to the programmable logic controllers in the field. Unlike in previous interpretations of the pyramid, these upper layers now not only collect data from the layers directly below, on which they have been reduced and analyzed, but they can also send recipe data directly to controllers and receive status reports in return. This paves the way for the flexibility and response times that a smart industry requires.

Automation at B2M level

Future production and maintenance environments will have to include more and more plants that are distributed across different locations or even worldwide. In the future, machine manufacturers will want to compare and evaluate globally operated plants and offer maintenance contracts based on remote functionality. The establishment of automated processes on layers 2 and 3 of the automation pyramid and the networking of remote plants are therefore the future of automation: they enable effort reduction, more comprehensive data analysis, as well as streamlining and accelerating the implementation of orders and business decisions in global companies.

Both production companies and machine builders must not only be able to do this efficiently, but also - something that is often neglected in the discussion about a smart industry - securely, i.e. without jeopardizing secure operation, network integrity and valuable confidential data.

Advertisement

SCADA as an entry point

Figure 1: The five layers of the automation pyramid with the information flows as they have been commonly used to date.

© Mathworks

A good entry point for engineers, production planners and machine builders is the SCADA level (layer 2), where all relevant production data arrives in reduced form and is analyzed. An easy way to connect to external networks and utilize more computing power is to use an edge device. By adding this device at the Scada level, companies can concentrate their MES and ERP work in fewer locations or even a single location. This makes it relatively easy to give machine builders access to data from the shop floor and PLC level, but not to business and corporate data.

One approach to establishing secure connections between distributed factories is the use of VPNs. However, setting them up and maintaining them presents several challenges. Even establishing a connection with a single machine and exchanging data with it can be frustrating and disrupt operations.

An alternative is to use cloud-based solutions that offer the advantages of secure data transfer - via a VPN - and minimize the disadvantages of maintaining the network connection. One common security mechanism is TLS (Transport Layer Security). This protocol is frequently used in cloud-based data communication. Traditionally, such solutions work on a client/server basis. When an engineer wants to communicate with a PLC at a remote location, the PLC providing the data acts as a server and the user's machine takes on the role of a client and establishes a direct connection with the PLC. This connection can easily be secured via TLS, although a port would need to be opened in the firewall for such communication. However, most IT administrators refuse to do this and the project is abandoned, leaving opportunities for data exchange and analysis unused.

A secure publisher/subscriber platform

Figure 2: Connecting a cloud-based IoT analytics service to the automation pyramid. The service can be easily and securely integrated into existing IT infrastructures.

© Mathworks

To overcome these limitations, cloud-based services such as ThingSpeak, which use publisher/subscriber models, can be used. ThingSpeak is an IoT analytics service from Mathworks that can be used to aggregate, visualize and analyze live data streams in the cloud (Figure 2). The service server itself can be placed in a secure network and may be assigned a static IP address. It then acts as a message broker so that all data made accessible to it is only sent via an outgoing connection. Each subscriber also sends its requests via an outgoing connection and receives data as a TCP response. This is very similar to how web browsers work and is therefore familiar to IT administrators.

This approach has a number of advantages:

  • All parties involved in this communication only need to know the IP address of the message broker. Participants' IP information only needs to be disclosed for the individual connection to the ThingSpeak server.
  • New publishers and subscribers can be added easily. This makes the application flexible and scalable.
  • Since every connection to the ThingSpeak server is essentially an outgoing connection, this solution does not result in any additional firewall requirements. It can therefore be easily and securely integrated into existing IT infrastructures.

Channel configuration, data streaming and integrated Matlab

Communication with the analytics service is based on channels, which are easy to configure and only take a few minutes to set up, even for new users. Channels have read and write API keys and can be set as public or private, with the default being private. Each channel contains eight fields to store eight data streams, such as sensor readings, electrical signals or temperatures. Each channel can be updated up to once per second. Each field of each channel has a standard visualization that is automatically updated when new data arrives and contains iFrame code that allows easy embedding into other applications.

To capture data for these channels, ThingSpeak provides REST or MQTT APIs, a communication library for Arduino and Particle devices, write blocks in hardware support packages for Arduino and Raspberry PIs, and other common protocols. While the REST API is platform-specific, the MQTT API is general (Figure 3). The only requirement for MQTT is that the user specifies the correct user data format.

Figure 3: Data acquisition with the MQTT protocol. The only requirement is that the user must specify the correct user data format.

© Mathworks

Once channel data is in the analytics service, it can be stored in the cloud or processed and visualized immediately. If the user is logged in with a MathWorks or ThingSpeak account, the service offers the ability to run Matlab code without an additional license. More than a dozen toolboxes offer functions for statistics, analysis, signal processing and machine learning. Matlab scripts can be scheduled to run at specific intervals, enabling updated calculations and visualizations at fixed times.

These scripts can be integrated into the service by simply copying and pasting Matlab code. For ease of use and testing, this code can be written on any desktop or laptop PC with a Matlab license. This makes the analytics service a natural cloud extension of the Matlab desktop. Users can also configure messages to be sent to them via email or Twitter for machine failures, parameter threshold violations or other specific events, allowing them to react immediately not only at the plant but also from a remote location.

The analytics service alone does not guarantee a successful IoT environment, but it can very easily be part of such an environment. To understand this, it is important to take another look at data collection and processing in the pyramid.

In manufacturing, live data is processed locally on the controller in real time. This type of stream processing requires an enormous bandwidth and therefore fieldbuses with data rates of up to several Gbit/s. Beckhoff offers this with the help of port multipliers with standard 100 Mbit/s Ethercat or via Ethercat G with 1 Gbit/s data rate. The required algorithms can be developed in Matlab and Simulink and then integrated into the PLC via corresponding coders together with the target for Matlab/Simulink for seamless integration into the Twincat 3 automation software from Beckhoff. This approach ensures fast processing with deterministic response times and latencies in the sub-millisecond range required for real-time controlled processes. Applications for this type of data processing include condition and energy monitoring, computer vision applications and information compression.

Figure 4: Data processing can take place both on the PLC - the Twincat 3 Runtime - or on the edge device - the Twincat 3 Runtime/Matlab Compiler Runtime.

© Mathworks

Disadvantages of limiting data processing to the PLC layer: Only one specific process can be monitored and controlled - without knowledge of adjacent processes, machines or systems. In addition, only live data can be used (no historical data).

For this reason, data originating from more than one controller is often processed further on the Scada layer. In Figure 4, this is implemented on the edge device - for example an industrial PC - which forms the connection with the analytics service. This structure enables data stream processing and comparison with stored data. It differs significantly from the PLC layer, on which only data streams flow and practically no storage takes place.

The advantages of data processing on an edge device are the high computing power and the extensive working memory in combination with the high bandwidth of the Gbit LAN. Nevertheless, the edge device cannot achieve deterministic response times and therefore cannot be used to control processes in real time. Here too, the required code can be written in Matlab or generated from Simulink models. Deployment on the edge device, for example via a compiler, ensures fast execution of runtime applications. With the Twincat 3 interface for Matlab/Simulink, fast communication between the PLC layer and the Matlab runtime on an edge device can be achieved, including client and server functionality. The latter includes the possibility of displaying functions written in Matlab as callable functions from the PLC (asynchronous remote procedure call). Typical applications are cross-process statistics, model-based optimization, anomaly detection and, again, information compression.

All of the data processing described so far takes place locally in a single, closed network. While this approach can provide a comprehensive overview of a plant or site, it does not enable monitoring or control of processes that are distributed across different sites. ThingSpeak offers this possibility.

Outside the conventional pyramid

Since ThingSpeak is connected to the edge device via an external network, data reduction is often required for bandwidth reasons. This reduction can be done, for example, by algorithms that can be easily integrated into the runtime application created by a Matlab compiler. The analytics service can store the incoming data stream or process it immediately. Information reduction can also be performed within the PLC using built-in Matlab functions and a direct connection from the PLC to ThingSpeak can also be established. However, due to latency and bandwidth limitations, ThingSpeak cannot guarantee deterministic response times and therefore real-time control.

Figure 5: The IoT analytics service can be used to compare systems and machines at different locations.

© Mathworks

However, the advantages are enormous:

  • Firstly, the integration of different processes is simple. All the user has to do is specify the relevant channels and start collecting data. In this way, any number of facilities can be connected to the analytics service.
  • Secondly, the storage capacity is much larger, so historical data can be stored to support maintenance and business decisions over long periods of time. This is not only of interest to manufacturing industries, but also to equipment manufacturers who can now monitor the machines they sell to customers around the world from a single location, offer maintenance contracts and compare performance by environment (Figure 5).

The analytics service also offers a serverless architecture. The corresponding cloud naturally contains servers; however, these operate without users having to maintain or update them.

As already mentioned, the analytics service offers integrated Matlab functionality and several toolboxes. This allows users to take advantage of numerous computational, analytical, statistical, control and visualization functions to create comprehensive, global analyses of their business, machine maintenance or scientific projects.

In turn, the use of Matlab allows them to extend their activities in ThingSpeak to the desktop to develop algorithms and code or deploy real-time and runtime applications. This makes ThingSpeak an effective link between a comprehensive modeling and design platform on the one hand and real-world industrial and scientific applications on the other. In addition, companies can use ThingSpeak functionality for business applications.

Authors:
Dr. Fabian Bause is Product Manager Twincat at Beckhoff Automation;
Dr. Rainer Mümmler is Senior Application Engineer at Mathworks.

  • Xing Icon
  • LinkedIn Icon
Advertisement
Advertisement

You might also be interested in

Advertisement

Miba

The first steps towards digitization

Real-time transparency in the material flow: this was the goal set by Miba when it set out to digitalize its internal logistics processes. But how successful was the close link between ERP and MES in the end? - A field report.

read more...
Advertisement
Advertisement
Advertisement

Control / Rules

From modeling directly into the PLC

Despite digitalization and I4.0, the technical functions in a process plant do not become simpler if you break them down to the smallest detail. Nevertheless, the high level of difficulty can be overcome by combining the right tools in the right way.

read more...
Advertisement
Advertisement
Advertisement

Industry 4.0

Why predictive maintenance?

Investments in predictive maintenance systems are worthwhile in order to proactively detect damage. Not only does this increase the service life of a machine, it also opens up new business models for machine manufacturers.

read more...

Industry 4.0

First customer projects via BaSys 4.0

The BMBF project 'Basissystem Industrie 4.0' expired at the end of June 2019. Together with NetApp and Objective Partner, Fraunhofer IESE now offers Industry 4.0 solutions with support and adaptation to customer systems on the basis of this project....

read more...

Cloud technology

The multi-cloud under control

German companies have been hesitant about the cloud for a long time, but now things are really taking off. More and more manufacturers are using multiple cloud providers - whether strategically or due to shadow IT. But how can the complexity of the...

read more...
Subscribe to our newsletter
Advertisement
Back to home