As countless IoT applications track live systems, real-time analytics plays an essential role in identifying problems or finding opportunities and then responding fast enough to make a difference. How can digital twins create leverage for implementing real-time analytics in IoT?
Consider a software telematics application that tracks a nationwide fleet of trucks to ensure timely deliveries. Dispatchers receive telemetry from IoT connected trucks every few seconds detailing their location, speed, lateral acceleration, engine parameters, and cargo viability. In a classic needle-and-haystack scenario, dispatchers must continuously sift through telemetry from thousands of trucks to spot issues, such as lost or fatigued drivers, engines requiring maintenance, or unreliable cargo refrigeration. They must also intervene quickly to keep the supply chain running smoothly. Real-time analytics can help track these devices and tackle the seemingly impossible task of automatically sifting through telemetry as it arrives, analyzing it for anomalies needing attention, and alerting dispatchers when conditions warrant.
While the concept of a software-based, digital twin was originally developed for use in product lifecycle management and infrastructure, it also has the potential to dramatically simplify the construction of applications that implement real-time analytics for IoT. For example, a telematics application can use a digital twin for each truck to track that truck’s parameters (maintenance history, driver’s record, etc.) and its dynamic state (location, speed, engine and cargo condition, etc.). The digital twin can analyze telemetry from the truck to update this state information and generate alerts when needed. Real-time analytics code can incorporate machine learning techniques to quickly spot anomalies. Running simultaneously, thousands of digital twins can track all the trucks in a fleet and keep dispatchers informed while reducing their workload.
Applying the digital twin model to real-time analytics for managing large, time-critical, live systems dramatically expands its range of uses. Examples include preventive maintenance, health-device tracking, logistics, physical and cyber security, IoT for smart cities, ecommerce shopping, financial services, and many others.
Real-time analytics with Azure Digital Twins
Microsoft’s Azure Digital Twins cloud service provides a compelling platform for creating digital twin models, offering a rich set of features for describing their contents, including properties, components, inheritance, and more. The Azure Digital Twins Explorer GUI tool lets users view digital twin models and instances, as well as their relationships. Although Azure digital twins host dynamic properties that track the current state of physical data sources, they do not directly analyze incoming messages from their data sources. Instead, users can create serverless functions using Azure Functions to ingest messages generated by data sources and delivered to Azure IoT Hub (or other message hubs). These functions update the properties of Azure digital twins using APIs provided for this purpose.
For example, here’s a tutorial example that shows how Azure functions can process messages from a thermostat and update both its digital twin and a parent digital twin that models the room in which the thermostat is located. Note that the first Azure function’s update triggers the Azure Event Grid to run a second function that updates the room’s property:
The challenge in using serverless functions to process messages and perform real-time analytics is that they add overhead and complexity. By their nature, serverless functions are stateless and must obtain their state from external services; this increases latency. In addition, they are subject to scheduling and authentication overheads on each invocation, and this adds delays that limit scalability. The use of multiple serverless functions and associated mechanisms, such as Event Grid topics and routes, also adds complexity in developing analytics code.
How can real-time analytics be integrated with Azure Digital Twins to ensure high performance for thousands of data sources combined with straightforward application development?
Adding real-time analytics using in-memory computing
Integrating an in-memory computing platform with the Azure Digital Twins infrastructure addresses both of these challenges. This technology runs on a cluster of virtual servers and hosts application-defined software objects in memory for fast access along with a software-based compute engine that can run application-defined methods with extremely low latency. By storing each Azure digital twin’s properties in memory and routing incoming messages to an in-memory method for processing, both latency and complexity can be dramatically reduced, and real-time analytics can be scaled to handle thousands or even millions of data sources.
ScaleOut Software’s newly announced Azure Digital Twins Integration does just this. It integrates the ScaleOut Digital Twin Streaming Service, an in-memory computing platform running on Microsoft Azure (or on premises), with the Azure Digital Twins service to provide real-time streaming analytics. It uses in-memory computing to accelerate message processing for fast, scalable real-time analytics, while simultaneously streamlining the programming model.
The ScaleOut Azure Digital Twins Integration creates a component within an Azure Digital Twin model in which it hosts “real-time” properties used by each digital twin to implement real-time analytics. These properties track dynamic changes to the instance’s physical data source and provide context for message processing. Application developers can create message-processing code in several ways: with C# or Java code, using an intuitive rules-based language, or by configuring machine learning (ML) algorithms implemented by Microsoft’s ML.NET library. This code makes use of each digital twin’s real-time properties, and the in-memory compute engine automatically persists these properties in the Azure digital twin instance.
To process incoming messages, ScaleOut’s in-memory computing platform stores each Azure digital twin’s real-time properties in a memory-based object called a real-time digital twin, and it creates a real-time digital twin instance for each Azure digital twin. Here’s a diagram that illustrates how real-time digital twins integrate with Azure digital twins to provide real-time streaming analytics:
This diagram shows how each real-time digital twin instance maintains in-memory properties, which it retrieves when deployed, and automatically persists changes to these properties back to its corresponding Azure digital twin instance. The real-time digital twin connects to Azure IoT Hub or another message source to receive and then analyze incoming messages from its corresponding data source. Fast, in-memory processing provides sub-millisecond access to real-time properties and completes message processing with minimal latency. It also avoids repeated authentication delays every time a message is processed by authenticating only once when the ScaleOut service starts up.
All real-time analytics performed for each message runs within a single in-memory method that has immediate access to the digital twin instance’s properties. This code can also access and update properties in other Azure digital twin instances. These features simplify the design by avoiding the need to split functionality across multiple serverless functions and by providing a straightforward, object-oriented design framework with advanced, built-in capabilities, such as machine learning.
For example, here’s how the tutorial example for the thermostat would be implemented using ScaleOut’s Azure Digital Twins Integration:
The two serverless functions and use of Event Grid have been eliminated since the in-memory method handles both message processing and updates to the parent object (Room 21). The ScaleOut Digital Twin Streaming Service takes responsibility for ingesting messages from Azure IoT Hub and for invoking analytics code that processes each data source’s messages. The ScaleOut service uses multiple, pipelined connections with Azure IoT Hub to ensure high throughput.
To accelerate development, ScaleOut provides tools that automatically generate Azure digital twin model definitions for real-time properties. These model definitions can be used either to create new digital twin models or to add a real-time component to an existing model. Users just need to upload the model definitions to the Azure Digital Twins service.
Combining the ScaleOut Digital Twin Streaming Service with Azure Digital Twins gives users the power of in-memory computing for real-time analytics while leveraging the full spectrum of Azure services and tools, as illustrated below for the thermostat example:
Users can view real-time properties with the Azure Digital Twins Explorer tool and track changes due to message processing. They also can take advantage of Azure’s ecosystem of big data analytics tools like Spark to perform batch processing. ScaleOut’s service adds real-time data aggregation, continuous query, and visualization tools for real-time properties that enable second-by-second tracking of live systems and boost situational awareness for users.
Example of real-time analytics with Azure Digital Twins
Incorporating real-time analytics using ScaleOut’s Azure Digital Twins Integration unlocks a wide array of applications for Azure Digital Twins. For example, here’s how the telematics software application discussed above could be implemented:
Each truck has a corresponding Azure digital twin which tracks its properties, which include a subset of real-time properties held in a component of each digital twin. When telemetry messages flow into Azure IoT Hub from a truck on the road, they are processed and analyzed by ScaleOut’s in-memory computing platform using a real-time digital twin that holds the truck’s real-time properties in memory for fast access and uses a message-processing method to analyze telemetry changes, update properties, and signal alerts when needed. Real-time analytics algorithms examine telemetry, such as engine parameters, to detect anomalies and signal alerts. Continuous data aggregation and visualization powered by the in-memory platform enable dispatchers to quickly spot emerging issues and take corrective actions.
The power of real-time analytics with digital twins
For two decades, digital twins have offered a compelling means to model and visualize a population of physical devices. Adding real-time analytics to digital twins now extends their reach into live, production systems that perform time-sensitive functions of IoT devices. By enabling managers to continuously examine telemetry from thousands or even millions of data sources and immediately identify emerging issues, they can avoid costly problems and capture elusive opportunities.
Combining the ScaleOut’s in-memory computing technology with Azure Digital Twins unlocks the ability for Azure Digital Twins to analyze incoming telemetry with low latency, high scalability, and a straightforward development model. This powerhouse combination has the potential to address a wide range of important use cases and create new IoT solutions that deliver fast, actionable insights.
Editor’s note: This article is in association with ScaleOut Software
(Header image by Lindsay Henwood on Unsplash)