Building the Next Generation of Smart PLC's With the ctrlX CORE and InfluxDB

Navigate to:

This article was originally published on IIoT World and is reprinted here with permission.

Program Logic Controllers (PLCs) have played an integral role in industrial automation since their initial creation during the 1960s. Since then, we’ve seen incremental improvements to their form and function throughout the years. The problem? While PLCs are exceptional at managing and controlling industrial processes, the evolving demands of modern manufacturing require these devices to do more than control machinery. Manufacturers now seek to leverage the computational power of PLCs for more complex tasks, particularly in monitoring the health and status of machines. The need for greater efficiency, predictive maintenance, and real-time data analysis drives this shift. So, does this mean we need to revisit how organizations design and use PLCs?

In this blog, we’ll explore a next-generation PLC called the ctrlX core by Rexroth and how we can utilize this platform to integrate best-in-class open source projects such as InfluxDB and Grafana to create a modern, interconnected anomaly detection stack.

What exactly is a PLC?

Before we get ahead of ourselves, let’s break down a standard PLC’s architecture and role. The diagram above breaks down a PLC into its core components:

  • Input Module: receives signals from input devices like sensors, switches, and buttons and converts these signals into a format that a PLC CPU can process.
  • Output Module: sends control signals from the PLC to output devices like motors, valves, lights, and relays.
  • Power Supply: converts the main AC (alternating current) to low-voltage DC (direct current) to power the PLC components.
  • CPU (Central Processing Unit): processes program data and instructions, executing control operations based on programmed logic. It handles logic operations, arithmetic operations, sequencing, timing, counting, and data manipulation.
  • Memory: used to store the control program loaded by the user. This typically includes both volatile and non-volatile memory types. Volatile memory (like RAM) temporarily stores data during operation. Non-volatile memory (like ROM, EEPROM) stores the PLC program and retains it even when power is off.
  • Programming Device: used to input the desired program into the PLC’s memory.

I believe breaking down the architecture of a PLC helps to remove the ambiguity behind its design. In its simplest form, it’s a rugged computer that performs and executes a program repeatedly.

To cement this idea, let’s take a look at a scenario to illustrate a PLC function: In the scenario above, the PLC automates the movements of a conveyor:

  • Start/Stop Control:
    • Pressing the Start button sends a signal from the PLC to the motor control relay, activating the conveyor belt.
    • Pressing the Stop button or activating the Emergency Stop immediately sends a signal to deactivate the motor control relay, stopping the conveyor.
  • Object Detection and Handling:
    • Photoelectric sensors detect objects on the conveyor.
    • The PLC can count objects, control their spacing, and halt the belt for specific operations like inspection or packaging.
  • Speed Control and Monitoring:
    • The speed sensor provides feedback to the PLC.
    • The PLC adjusts the motor speed to maintain a consistent conveyor speed, which can be crucial for synchronized operations with other machinery.
    • The PLC can also respond to manual speed adjustments made by the user.

With this basic understanding of how PLCs work, how are next-generation PLCs like the ctrlX core iterating upon this design—and where does InfluxDB come into all of this?

Next generation of PLC

As we now know, most standard PLCs have an embedded processor that carries out the devised program. Usually, this means PLCs ship with their own proprietary OS (e.g., Siemens’ SIMATIC Step 7 for their S7 PLCs and Rockwell’s RSLogix for Allen-Bradley PLC) to run on the embedded processor. This is great for providing a fault-tolerant and performant execution engine but leaves very little room for extensibility.

The ctrlX core, on the other hand, provides a flexible hardware specification, which allows manufacturers to control power levels for their PLC according to the needs of certain tasks. The PLC also deploys a Linux operating system called Ubuntu IoT Core, providing the flexibility to extend the core functionality and services users can install on the PLC. Let’s revisit the original PLC architecture and modify it to reflect the design of the ctrlX core: We’ve introduced two new aspects to our PLC design:

  • Data plane: this replaces the standard operation data in memory. It still provides a way for our PLC program to access input and output data, as well as a gateway to allow third-party applications to subscribe and publish data.
  • Third-Party Apps: because our PLC now uses a Linux distribution, we can leverage built-in Linux services, such as containerization. This allows developers to build and deploy dockerized applications onto the ctrlX core to interface with the data plane.

Where do InfluxDB and Grafana play into all of this? How can we leverage these new services and the extra compute of the ctrlX core?

Open source data historian

InfluxDB, an open source time series database, is specifically engineered from the ground up to handle vast amounts of time series data. In recent years, it has become the foundation for many next-generation data historians that are replacing standard relational databases. We can attribute this shift to several of InfluxDB’s distinctive qualities:

  • High-Throughput Data Ingestion: InfluxDB efficiently manages data intake from multiple parallel sources, making it ideal for environments with extensive data generation.
  • Schema-on-Write Flexibility: it offers a “schema on write” approach, allowing for the flexible and rapid storage of thousands of machine tags without requiring pre-designed schema. This makes it adaptable to varying data structures.
  • Low System Requirements: with minimal installation and operational demands, InfluxDB is an effective solution for local data storage, conserving hardware resources for other critical PLC processes.
  • Advanced Time-Based Queries: performs efficient time-based aggregations (like average, sum, min, max) across various time granularities (seconds, minutes, hours, days, etc.).
  • High-Resolution Timestamps: highly granular timestamps (up to nanosecond precision) make it suitable for precise machinery monitoring at a detailed level.

Users can install InfluxDB directly onto the ctrlX core via its third-party app store. This automatically installs the latest open source instance. So, what benefits does this provide to my site engineers? Let’s revisit our conveyor example.

Machine Anomaly Detection

In this example, we deployed the ctrlX core to control our conveyor. Like before, the PLC program includes functions such as:

  • Stop/Start control
  • Object detection and handling
  • Speed control and monitoring

On top of this, we’ll also deploy InfluxDB to act as a local edge data historian. InfluxDB will connect to the ctrlX core data plane and ingest the following health metrics from the conveyor servos:

  • Vibration
  • Speed
  • Temperature

In the illustration below, we can see that during standard operation, the system stores these sensor metrics in InfluxDB. Grafana connects directly to InfluxDB to display these raw metric readings directly on the HMI to the user: This is standard practice within the industry. However, using the InfluxDB OSS (Open Source Software) built-in task engine, we can perform automated analysis on both historical and current telemetry data to look for trends. Within this InfluxDB task, we compare historic readings to current metrics to learn that there is an upward climb in both temperature and vibration. We use this data to send alerts through Grafana to indicate to the onsite engineer that our current telemetry readings indicate one of the motors is under increasing stress and may require servicing.

This scenario provides a basic way for InfluxDB and Grafana to introduce predictive maintenance and anomaly detection directly onto the PLC. The benefit of this approach is lower latency when identifying and alerting on potential faults because these processes occur closer to the data source. We also use the hardware capabilities of the PLC rather than introducing another edge device to carry out this analysis.

Edge Data Replication

Lastly, as an added extra, InfluxDB OSS has a built-in feature that can write data from one InfluxDB instance to another remote instance of InfluxDB. This can be either InfluxDB Serverless, Dedicated, Clustered (on-prem), or even another remote instance of InfluxDB OSS. This feature allows you to aggregate data from different production lines into a single aggregated repository for further analysis. Some assets include:

  • Anomaly detection between production lines of the same type—discover if one production line begins to deviate from the others.
  • Greater organizational visibility. For instance, if one of your data scientists needs real machine data to train an ML model, this feature provides a non-invasive way to offload the necessary data.
  • Inherent security. InfluxDB acts as the data writer and receiver between OT and IT-based networks—data movement only occurs one way.

Conclusion

The evolution of Industry 4.0 is forcing many manufacturers to think creatively about how they can extract, store, and analyze data from PLCs on the shop floor. For many older systems, this practice won’t change (in these cases, combining PTC Kepware and InfluxDB will do the trick with most PLCs). However, I hope this blog serves you well when you consider bringing new machinery into your production line. A next-gen PLC like the ctrlX core is built from the ground up to accommodate the flexibility and adaptability of performing both as a robust machine controller and a powerful edge computing device. Pair this with open source projects such as InfluxDB and Grafana, and you’ll be able to develop a cost-effective solution for automating the health analysis of your machines.

To see how easy it is to configure InfluxDB, I highly recommend checking out this interactive demo. I also suggest this walkthrough by Rexroth on how to install and configure InfluxDB onto the ctrlX core. If you have any questions about this blog or InfluxDB in general, I highly recommend joining the InfluxDB community.