Click here to Skip to main content
15,349,320 members
Articles / Hosted Services / Azure
Posted 31 Dec 2018

Tagged as


2 bookmarked

Azure Digital Twins

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
31 Dec 2018CPOL6 min read
An overview of Azure Digital Twins (yes, the marketing folk really named it this... sigh!)


A digital twin is a virtual or digital representation of a process, product or service. Digital twins, also known as mirrored systems, were originally developed by NASA in order to deal with the problem of developing systems which would then travel beyond NASA’s ability to see or monitor them.

Here's how they work:

First, smart components are integrated with a physical item. These smart components use sensors to gather data about the physical item; for example, about real-time status, position or working condition. The smart components are connected to the cloud which processes the data that the sensors monitor. The digital twin represents not only the structure, but also the behaviour of the physical asset in real life by capturing real time data from the asset. The digital twin can then be used to monitor the physical item.

Image 1

What Are Digital Twins Used For?

Digital twins make it possible to simulate, analyse and test scenarios digitally, before implementing changes in the real world. Digital twins have traditionally been used in manufacturing, transportation, construction and energy. Large, complex items such as wind turbines or train engines could be designed and tested digitally before being produced. However, with the development of the Internet of Things (IoT), digital twins can be used in smaller and less complex items and systems. By using data analytics, digital twins can help optimize an IoT deployment for maximum efficiency.

Real World Applications and Uses

Image 2

Wind Turbines

When wind turbines were first developed, there was more focus on how they produced energy rather than the lifecycle of the turbines themselves. However, due to the number, size and location of wind turbines, it’s difficult to access and manage them physically. Digital twins, by creating a virtual model of the physical turbine, allows remote management of the turbine as data is relayed to the controller. It also allows the streamlining of maintenance schedules, load balancing and power distribution and identify and predict disruptions and failures.


Kaeser is a US based manufacturer of compressed air products. Originally Kaeser sold product, that is it installed compressed air equipment at a customer’s site and the operation of the equipment was left to the customer. However, the use of digital twins has allowed Kaeser to monitor its equipment remotely as well as measure air consumption which allows them to charge accurate fees based on consumption rather than a fixed rate. Commodity costs have been cut by approximately one-third.


Digital twins can be used to monitor occupancy rates, temperatures, ventilation, energy consumption. This information can be used to reduce waste and increase efficiency. Once sufficient amounts of data have been collected the digital twin can provide predictions; for example, if the weather forecast for tomorrow is cold, then measures to counteract this can be taken automatically.

Image 3

Overview of Digital Twins Technology

Azure Digital Twins is part of Azure IoT. It creates detailed models of a physical environment and can also create spatial intelligence graphs which model the relationships and interactions between people, devices and spaces. When devices, physical spaces and people are combined, it makes a better insight into how the space actually work, which is turn can drive business insights.


Azure Digital Twins can be used in many different environments, such as banks, hospitals, offices and warehouses and with many different scenarios including temperature and humidity tracking, analysing occupancy levels and monitoring vehicles. With Azure Digital Twins, you’re querying data from a physical space (e.g., a building) rather than from many different sensors (e.g., temperature control, humidity control, entrances, exits, lights). Also, Azure Digital Twins offers multi-tenant support. This means that different organisations can access their portions of the data safely and securely.

Image 4

How Digital Twins Work

Digital Twins object models describe domain-specific concepts, properties and categories. Object models include the following types: spaces, devices, sensors, users, resources and roles, among others. Object models can be predefined by users. Combined, object models make up an ontology. For example, a smart building’s ontology includes floors, venues, offices and conference rooms. When you have object models and an ontology in place, you can populate a spatial graph. A spatial graph is a virtual representation of the relationships between people, spaces and devices. Below is a spatial graph of a smart building.

Image 5

User-defined functions can be used to define and run custom functions against incoming data from devices in order to send signals to predefined endpoints. This capability means that you can improve customization and automation of device tasks. For example, a smart flooding app could include a user-defined function to assess current water levels and combine them with the rainfall forecast. The app then sends information about flood warnings.

Role-based access control and Azure Active Directory means that you can securely control access for individuals and devices. For example, a facilities management app can be configured to allow the facilities managers to change the temperature for any room in the building while occupants can only change the temperature for their rooms.

Azure Digital Twins can be connected to Azure Stream Analytics, Azure AI, and Azure Storage, Azure Maps, Microsoft Mixed Reality, Dynamics 365, or Office 365.

Data Processing in Digital Twins

Data processing in Digital Twins consists of defining three objects: matchers, user-defined functions, and role assignments. Matchers define a set of conditions which evaluate what will happen based on incoming data from sensors. The conditions are written as comparisons against a JSON path. A user-defined function is a custom written function that runs in an isolated Digital Twins environment. UDFs have access to the spatial graph and raw sensor telemetry. Once a UDF is registered, a matcher must be created. The matcher will specify when the UDF should run. You can write UDFs in JavaScript. However, the actions of a UDF are subject to role-based access control. This is to ensure that data remains secure within the service. The level of access a UDF has is checked when it attempts an action.

Image 6

Data Processing Flow

Once data is sent by devices to Azure Digital Twins, the data can be processed in four phases which are validation, matching, computing and dispatching.

Image 7

In the validation phase, the incoming data is transformed to a data transfer object (DTO). In the match phase, the user-defined functions (UDFs) are found while the compute phase runs these UDFs. Finally, the dispatch phase routes any notifications from the compute phase to pre-defined endpoints

Route Types

There are two ways that you can integrate IoT events into other Azure services. First, events from Azure Digital Twins can be sent to Azure Event Hubs, Azure Service Bus topics or Azure Event Grid for further processing. Also, Azure Digital Twins can route raw telemetry messages directly without processing them to Event Hubs where they undergo further processing.

Image 8

You can specify different endpoints for different events and messages. When you route to Event Hubs, the messages arrive in the same order as they were sent. This is not necessarily the case with Event Grid and Service Bus, but they do include timestamps which you can use to identify the chronological order.

Find out more about Azure Digital Twins here:


  • 31/Dec/2018: Version 1


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Chief Technology Officer The DataWorks
United Kingdom United Kingdom
Allen is a consulting architect with a background in enterprise systems. His current obsessions are IoT, Big Data and Machine Learning. When not chained to his desk he can be found fixing broken things, playing music very badly or trying to shape things out of wood. He runs his own company specializing in systems architecture and scaling for big data and is involved in a number of technology startups.

Allen is a chartered engineer, a Fellow of the British Computing Society, and a Microsoft MVP. He writes for CodeProject, C-Sharp Corner and DZone. He currently completing a PhD in AI and is also a ball throwing slave for his dogs.

Comments and Discussions

QuestionPerhaps I'm missing the point Pin
Sacha Barber1-Jan-19 0:51
MemberSacha Barber1-Jan-19 0:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.