Book Image

Hands-On Azure Digital Twins

By : Alexander Meijers
Book Image

Hands-On Azure Digital Twins

By: Alexander Meijers

Overview of this book

In today’s world, clients are using more and more IoT sensors to monitor their business processes and assets. Think about collecting information such as pressure in an engine, the temperature, or a light switch being turned on or off in a room. The data collected can be used to create smart solutions for predicting future trends, creating simulations, and drawing insights using visualizations. This makes it beneficial for organizations to make digital twins, which are digital replicas of the real environment, to support these smart solutions. This book will help you understand the concept of digital twins and how it can be implemented using an Azure service called Azure Digital Twins. Starting with the requirements and installation of the Azure Digital Twins service, the book will explain the definition language used for modeling digital twins. From there, you'll go through each step of building digital twins using Azure Digital Twins and learn about the different SDKs and APIs and how to use them with several Azure services. Finally, you'll learn how digital twins can be used in practice with the help of several real-world scenarios. By the end of this book, you'll be confident in building and designing digital twins and integrating them with various Azure services.
Table of Contents (25 chapters)
1
Section 1: Azure Digital Twin Essentials
4
Section 2: Getting Started with Azure Digital Twins
11
Section 3: Digital Twins Advanced Techniques
19
Section 4: Digital Twin Implementations in Real-world Scenarios

Understanding the components of Azure Digital Twins architecture

A Digital Twin Graph is created based on instances of those models and their relationships. The service provides several ways of managing the models and the Digital Twin Graph. But it depends on other Azure services to create an Azure Digital Twins instance.

Figure 1.5 – An overview of input and output services that are used with Azure Digital Twins

Figure 1.5 – An overview of input and output services that are used with Azure Digital Twins

In Figure 1.5, you see some of the Azure services available to interact with Azure Digital Twins. Some of these services can be used for different parts of your Azure Digital Twins instance.

Managing Azure Digital Twins

Managing is all about defining and creating models, creating instances of models, and laying out relationships between those instances to create a Digital Twins Graph. To access the Azure Digital Twins service, you have REST APIs available. The creation of models is done by defining the models using the DTLD. There are several ways of managing Azure Digital Twins:

  • Azure Digital Twin Explorer – A tool to manage, view, and upload models, create instances of models, and set relationships.
  • Client App – A custom application that makes use of available REST APIs and client SDKs to access the service.
  • Power App – The Power Platform, a platform that provides several applications and services to build low-code/no-code solutions and allows you to create a Canvas app that can connect to an Azure Digital Twins service.
  • Azure services – Different services such as Logic Apps, Azure Functions, and Azure Service Bus provide a way of connecting to Azure Digital Twins to manage the models. We will go into more depth about these services and how to use them in the next section.

Azure Functions

Azure Functions is a serverless compute service that runs event-triggered code. Azure Functions simplifies the development and provisioning of small applications without the concern of setting up an infrastructure. It is also called "compute on-demand." This means that it only runs when requested and automatically upscales when the number of requests increases.

Azure Functions makes it easy to handle different roles and tasks around an Azure Digital Twins instance. The following is a list of different tasks performed by Azure Functions.

Table 2

Azure IoT Hub

This is a managed service that acts as a central messaging hub between devices and IoT applications such as the Azure Digital Twins service. Any device can be connected to Azure IoT Hub. The hub provides a secure way of communicating with the attached devices. It can route device telemetry to multiple endpoints. It integrates with other services, such as Azure Event Grid, Azure Logic Apps, Azure Machine Learning, and Azure Stream Analytics.

In production solutions, you will mostly rely on Azure IoT Hub as the hub for connecting your application against real-world IoT sensors.

Azure IoT Hub Device Provisioning Service

This service, also called DPS, is a provisioning service for Azure IoT Hub. It enables the provisioning and connection of millions of devices in a secure and scalable way to Azure IoT Hub – scenarios such as zero-touch provisioning, load-balancing, and connecting devices to different IoT solutions within your IoT platform.

Azure Logic Apps

Azure Logic Apps is an Azure service that allows you to build automated, scalable workflows. It incorporates the basic elements of the Azure platform, such as user roles, security, and more. It supports hundreds of connectors to connect to any Microsoft service or external well-known service in the cloud or on-premises. And if there is no connector available, you can directly call the service or create your own custom connector. It provides a visual web interface allowing you to build these workflows quickly. These workflows can then be integrated into applications such as your Azure Digital Twins instance.

Azure Logic Apps can be used to define processes around your instance. These processes will be able to create and update Digital Twins. Processes can act upon certain values that are read from the Digital Twins.

Azure Storage

In principle, a Digital Twin can store information in its properties. But as soon as new values are set, the old values are overwritten. Data can be preserved by connecting the Azure Digital Twins service to Azure Storage. Depending on your requirements, you could choose simple storage such as storage accounts. But in most cases, your Azure Digital Twins instance depends on IoT data. Azure Data Lake provides storage for these large amounts of data.

Azure Analytics

Azure Digital Twins is part of the IoT platform. In almost any Azure Digital Twins instance, IoT data is involved such as sensor data. The IoT platform provides several ways to perform analytics.

One of them is called Azure Time Series Insights Gen2. This is an open and scalable end-to-end IoT Analytics service. The service can be used for collecting, processing, storing, and querying IoT data to analyze trends and anomalies. It does not require any lines of code to use this service.

It provides APIs to integrate it into your solution. But it can also be integrated into the workflows defined around your solution.

Together with the Azure Digital Twins service, it can be used to monitor the health, usage, and performance of devices. This allows you to optimize operational efficiency.

Azure Service Bus

Azure Service Bus is cloud messaging as a service (MaaS). It simplifies cloud messaging on an enterprise level by delivering a scalable cloud messaging solution. The service acts as a message broker by using message queues and topics. When you built large IoT solutions including Azure Digital Twins, this service can support the routing of messages from IoT devices to a Digital Twin. Backend systems can be loosely coupled by using Azure Logic Apps. Azure Functions is used to get messages from the message queue into an Azure Digital Twins instance.