Hands-On Azure Digital Twins - Alexander Meijers - E-Book

Hands-On Azure Digital Twins E-Book

Alexander Meijers

0,0
47,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

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.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 338

Veröffentlichungsjahr: 2022

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Hands-On

Azure Digital Twins

A practical guide to building distributed IoT solutions

Alexander Meijers

BIRMINGHAM—MUMBAI

Hands-On Azure Digital Twins

Copyright © 2022 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Group Product Manager: Rahul Nair

Publishing Product Manager: Meeta Rajani

Senior Editor: Athikho Sapuni Rishana

Content Development Editor: Sayali Pingale

Technical Editor: Rajat Sharma

Copy Editor: Safis Editing

Associate Project Manager: Neil Dmello

Proofreader: Safis Editing

Indexer: Pratik Shirodkar

Production Designer: Vijay Kamble

Marketing Coordinator: Nimisha Dua

First published: January 2022

Production reference: 1200122

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK.

978-1-80107-138-3

www.packt.com

To my lovely girlfriend and four children, and my global team at Avanade, for their understanding and support during my time writing this book. Their continuous support has helped me to grow and become what I am today, allowing me to share content with others in my own way!

– Alexander Meijers

Contributors

About the author

Alexander Meijers is a professional who inspires, motivates, and supports others and helps them to innovate. His goal is to help organizations achieve more by creating, improving, and working smarter, with the aim of shortening business processes and improving the environment for employees.

As global XR technology lead and Microsoft Windows MVP for mixed reality, working for Avanade, he understands business issues and translates them into logical solutions using technology. Additionally, he supports companies in applying emerging experiences during their digital transition journey.

He works with technologies such as virtual, augmented, and mixed reality, in combination with cloud services including mixed reality services, Azure Digital Twins, and IoT, from the Microsoft Azure platform, Office 365, Power Platform, and Dynamics 365.

His primary focus is manufacturing, utilities, and the engineering and construction sector. However, he certainly does not stay away from other sectors.

He engages in speaking, writing books, blogging, and is an organizer of local and global events such as the Mixed Reality User Group in the Netherlands, and Global XR Talks and the Global XR Conference, both part of the GlobalXR.Community.

In the last few months, he has designed and implemented a solution. Data is collected from IoT and Microsoft Dynamics 365 Field Service. An Azure Digital Twins service is built up dynamically by using Azure Functions, Azure Service Bus, and Logic Apps. A 3D visual is generated by using Microsoft HoloLens 2 as an augmentation device.

Since January 2018, he has been a Windows Development MVP for the Mixed Reality category.

About the reviewer

Sjoukje Zaal is a Microsoft chief technical officer at Capgemini, a Microsoft regional director, and a Microsoft Azure MVP with over 20 years of experience providing architecture, development, consultancy, and design expertise. She mainly focuses on cloud, security, productivity, and IoT. She loves to share her knowledge and is active in the Microsoft community as a cofounder of the user groups Tech Daily Chronicle, Global XR Community, and the Mixed Reality User Group. She is also a board member of Azure Thursdays and Global Azure. Sjoukje is an international speaker, is involved in organizing many events, and has written several books and blogs. She is also part of the MVP Diversity and Inclusion Advisory Board.

Table of Contents

Preface

Section 1: Azure Digital Twin Essentials

Chapter 1: About Digital Twins

Understanding the concept of a Digital Twin

Digital replica

Entities

Relationships

Realities

Exploring the Digital Twin environment

Looking at real-world applications

Smart building

Education

Simulation

Historical data

Insight and control

Azure Digital Twins

The Azure Digital Twins service

Important terminology

Open modeling language

Tools

Costs

Understanding the components of Azure Digital Twins architecture

Managing Azure Digital Twins

Azure Functions

Azure IoT Hub

Azure IoT Hub Device Provisioning Service

Azure Logic Apps

Azure Storage

Azure Analytics

Azure Service Bus

Exploring the Azure Digital Twins REST API

Summary

Chapter 2: Requirements and Installation

Technical requirements

Azure Digital Twins service

Azure account

Resource group

Azure Digital Twins service

Configuring access control

Microsoft Visual Studio

The Windows Azure CLI with Windows PowerShell

Node.js

Azure Digital Twins Explorer

Download

Installation

Compile and run

Creating your first Digital Twin

Uploading models

Summary

Section 2: Getting Started with Azure Digital Twins

Chapter 3: Digital Twin Definition Model

Technical requirements

Digital Twins Definition Language

JSON-LD

Versioning

Digital Twin interface

Interface content

Properties

Telemetry

Relationships

Component

Schemas

Primitive schemas

Complex schemas

Field

Object

Map

Array

Enum

Geospatial schemas

Semantic types

Validating a model

Summary

Questions

Further reading

Chapter 4: Understanding Models

Technical requirements

Designing models

Modeling a smart building

Designing models

Modeling recommendations

Creating an application

Managing models

Creating a model

Creating multiple models

Inheriting from a model

Deleting a model

Getting a model

Getting models

Managing Digital Twins

Creating a Digital Twin

Updating a Digital Twin

Deleting a Digital Twin

Getting a Digital Twin

Summary

Questions

Further reading

Chapter 5: Model Elements

Technical requirements

Primitive properties

Complex properties

Telemetry

Components

Summary

Questions

Chapter 6: Creating Relationships between Azure Digital Twin Models

Technical requirements

Understanding relationships

Creating relationships

Getting relationships

Getting a single relationship

Getting a list of relationships

Deleting relationships

Relationship properties

Updating relationship properties

Summary

Questions

Further reading

Chapter 7: Querying Digital Twins

Technical requirements

Setting up a demo graph

Basic querying

Querying by model

Querying relationships

Filtering results

Querying using code

Querying asynchronous calls using code

Summary

Questions

Further reading

Chapter 8: Building Models Using Ontologies

Technical requirements

Understanding ontologies

Modeling strategy

Using industry-standard ontologies

Uploading ontology models

Summary

Questions

Further reading

Section 3: Digital Twins Advanced Techniques

Chapter 9: APIs and SDKs

Technical requirements

Understanding the developer landscape

Understanding the REST API

Control plane

Data plane

SDKs

Monitoring API metrics

Using the Azure CLI to manage Azure Digital Twins

Understanding service limits

Summary

Questions

Further reading

Chapter 10: Building a Digital Twin Pipeline

Technical requirements

Understanding application architecture

Setting up a demo sensor using Azure IoT Central

Getting sensor messages on Azure Service Bus

Summary

Questions

Further reading

Chapter 11: Updating the Model

Technical requirements

Updating the digital twin

Updating the sensor model

Creating a storage account

Creating an Azure function

Setting the connection string

Creating an Azure function placeholder

Granting the Azure function permissions

Publishing the Azure function

Setting the connection string

Creating a digital twin for the sensor

Viewing the result

Summary

Questions

Further reading

Chapter 12: Event Routing

Technical requirements

Data ingress and egress

Event notifications

Understanding event routes

Creating an event grid topic

Creating an endpoint

Creating an event route

Subscribing to event messages

Monitoring event route messages

Summary

Questions

Further reading

Chapter 13: Setting up Azure Maps

Technical requirements

Understanding Azure Maps

Creating an Azure Maps account

Creating a Creator resource

Building a map

Uploading a map

Converting a map

Creating and validating a dataset

Creating and validating a tileset

Creating and validating a feature stateset

Summary

Questions

Further reading

Chapter 14: Integrating Azure Maps

Technical requirements

Updating a feature stateset

Setting up an update Azure Function

Publishing the Azure Function

Configuring application settings

Subscribing to Event Grid

Monitoring updates

Visualizing the model

Summary

Questions

Further reading

Chapter 15: Monitoring and Troubleshooting

Technical requirements

Setting up a log analytics workspace

Setting up diagnostic settings

Viewing logs

Viewing metrics

Using alerts

Summary

Questions

Further reading

Section 4: Digital Twin Implementations in Real-world Scenarios

Chapter 16: Facility of the Future

Understanding the scenario

Designing the digital twin solution

The solution architecture

Summary

Questions

Chapter 17: Creating Digital Twins for Smart Building

Understanding the smart building ecosystem

Sensors

Analytics

User interfaces

Automation

A smart building solution design

The smart building architecture

Summary

Questions

Chapter 18: Simulations Using a Digital Twin

Understanding simulation

Solution design and architecture

Work preparation

Training

Testing

Summary

Questions

Assessments

Chapter 3 – Digital Twin Definition Model

Chapter 4 – Understanding Models

Chapter 5 – Model Elements

Chapter 6 – Creating Relationships between Azure Digital Twin Models

Chapter 7 – Querying Digital Twins

Chapter 8 – Building Models Using Ontologies

Chapter 9 – APIs and SDKs

Chapter 10 – Building a Digital Twin Pipeline

Chapter 11 – Updating the model

Chapter 12 – Event Routing

Chapter 13 – Setting up Azure Maps

Chapter 14 – Integrating Azure Maps

Chapter 15 – Monitoring and Troubleshooting

Chapter 16 – Facility of the Future

Chapter 17 – Creating Digital Twins for Smart Building

Chapter 18 – Simulations Using a Digital Twin

Other Books You May Enjoy

Preface

Being able to create a real-time digital counterpart from reality gives organizations the ability to build simulations, training environments, and other business solutions. Digital twins are a virtual representation of these solutions. Organizations such as Microsoft provide cloud services to support building the foundation of a digital twin. This book will help you understand what digital twins are and how to build these IoT solutions using the Azure Digital Twins service and other related Azure services

Who this book is for

This book is targeted at Azure developers, Azure architects, or anyone else who wants to learn more about how to implement IoT solutions using Azure Digital Twins and additional Azure services.

What this book covers

Chapter 1, About Digital Twins, explores the concept of a digital twin.

Chapter 2, Requirements and Installation, goes over all the requirements, services, and tools to get up and running with the Azure Digital Twins service.

Chapter 3, Digital Twin Definition Model, discusses and describes each of the metamodels as part of the digital twin definition model.

Chapter 4, Understanding Models, covers models and how to manage them by creating, updating, and removing models.

Chapter 5, Model Elements, discusses several model elements, such as properties, telemetry, and components.

Chapter 6, Creating Relationships between Azure Digital Twin Models, explores the concept of relationships between digital twins and how we can create and delete them.

Chapter 7, Querying Digital Twins, explains the query language and executing different types of queries to retrieve data from an Azure Digital Twins instance.

Chapter 8, Building Models Using Ontologies, explains how to use ontologies – predefined sets of models – to provision a digital twin solution more quickly.

Chapter 9, APIs and SDKs, looks at the differences between APIs and SDKs and how to manage and control Azure Digital Twins instances using the REST API.

Chapter 10, Building a Digital Twin Pipeline, offers a guide to get data into a model by building a pipeline using several Azure services.

Chapter 11, Updating the Model, continues extending the pipeline by getting sensor data from demo sensors in Azure Service Bus.

Chapter 12, Event Routing, goes into more detail about how to send data to other services. We will learn about how notifications are triggered and messages are routed to endpoints.

Chapter 13, Setting Up Azure Maps, goes through setting up the Azure Maps service, which allows us to visualize data on top of a map.

Chapter 14, Integrating Azure Maps, looks at integrating the setup of Azure Maps with the Azure Digital Twins instance using several Azure services.

Chapter 15, Monitoring and Troubleshooting, discusses how to leverage an Azure Log Analytics workspace and diagnostic settings to monitor and troubleshoot our Azure Digital Twin instance.

Chapter 16, Facility of the Future, shows with an example how insights can contribute to different processes and roles within an organization by using an Azure digital twin.

Chapter 17, Creating Digital Twins for Smart Building, shows how an Azure digital twin is used with the smart building concept to automate and control a building's ecosystem.

Chapter 18, Simulations Using a Digital Twin, provides a better understanding of what simulation is and how simulation can benefit from an Azure digital twin.

To get the most out of this book

Building digital twin solutions requires you to have basic knowledge of using Microsoft Azure and standard development tools such as Microsoft Visual Studio, and have intermediate experience in building applications with .NET.

All examples can be executed using a trial subscription with Microsoft Azure. All code in the book is expected to work with future version releases of the abovementioned software. While the book focuses on using a Windows computer, several of these tools are available on other platforms, too, such as macOS.

When you have finished the book, start building your own concept around a digital twin to apply what you have learned. Start with something small and easy and extend your solution along the way.

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781801071383_ColorImages.pdf

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Hands-on-Azure-Digital-Twins. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Create a new folder called chapter6 under the Models folder of SmartbuildingConsoleApp."

A block of code is set as follows:

public string RelationshipId(string twinSourceId, string twinDestinationId)

{

    return string.Format("{0}-{1}", twinSourceId, twinDestinationId);

}

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Click on the +relationship icon in the Graph View area to start creating a relationship."

Tips or Important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you've read Hands-on Azure Digital Twins, we'd love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we're delivering excellent quality content.

Section 1: Azure Digital Twin Essentials

Our first section is all about understanding and learning the concept and architecture of a digital twin. We will be focusing on the Microsoft Azure Digital Twins service and how to set this up. All tools and services required to start building with the Microsoft Azure Digital Twins service will be explained and installed.

This part of the book comprises the following chapters:

Chapter 1, About Digital TwinsChapter 2, Requirements and Installation

Chapter 1: About Digital Twins

This chapter will explore the concept of a Digital Twin. A Digital Twin is a virtual representation of the real world combined with real-world data. Digital Twins can be used for a variety of scenarios. Digital Twins can be used to visualize insights or to simulate real-life situations by using a virtual representation and real-life sensory data. Learning about Digital Twins allows you to build solutions around these scenarios.

In this chapter, we'll go through several scenarios to understand Digital Twin implementations. We'll look at Microsoft's Azure Digital Twins service and how it allows us to model a Digital Twin. We'll walk through the layout of the service and how it is incorporated into the model of a Digital Twin. Part of that is a global overview of the architecture, which includes the relationship to other Azure services. This is required to create an actual Digital Twin solution. We will finish with an overview of the available SDKs and APIs for using Azure Digital Twins to create your own Digital Twin solutions. The chapter contains a lot of introductions to different services and tools that will appear again in the following chapters.

In this chapter, we'll go through the following topics:

Understanding the concept of the Digital TwinExploring the Digital Twin environmentLooking at real-world applications Azure Digital TwinsUnderstanding the components of Azure Digital Twins architectureExploring Azure Digital Twins APIs

Understanding the concept of a Digital Twin

You have probably heard someone talking about Digital Twins in the last few years. You could even say that it has been a buzzword for some time. But since 2019-2020, it's become more than just a buzzword. Organizations and people have started to understand the benefits of having a Digital Twin. There has even been a large increase in organizations that want to start and implement a Digital Twin.

But what is a Digital Twin? I get that question a lot. And every time it is difficult to come up with an answer that others will understand. And even referring to the definition on Wikipedia will not make it easy to understand. There are a lot of different definitions you can find online in articles and blog posts. To explain what a Digital Twin is requires a definition to start with followed by a more in-depth explanation of the definition itself. I use the following definition:

A Digital Twin is a digital replica of entities and their relationships in a reality

You may have noticed that this definition contains several terms: digital replica, entities, and reality. It becomes clearer when explaining each of them in more depth.

Digital replica

A digital replica is a way of storing several entities and their relationships in a specific model. Such a model is stored in a location according to your requirements and needs. An example could be a database or service. Each product on the market that is available to create a Digital Twin has its own way of storing the information that describes the model. That means that the digital replica can describe a real-life situation using definitions and parameters. Think of a machine and whether it is turned on or off. The digital replica would describe the machine and its state. But a digital replica could also be about a collection of machines and their relationships. Think of a machine that is creating a product and the machine that is packing the product. The packing machine requires products to pack anything. That relationship is also described in a digital replica.

Entities

Entities can be different things. An entity can be anything from a physical living being such as people to a physical non-living thing such as processes, machines, buildings, equipment, rooms, and devices. When we talk about physical, it means being physically part of the reality from which you create a digital replica. Each of these entities has a specific purpose within the model. An entity is described by its characteristics that are relevant to the model and what you try to achieve in your solution. An entity could be a temperature sensor installed in a room. The characteristics are then the location of that sensor, the temperature the sensor is measuring, and the notifications it is raising when the temperature gets too low or too high. The location in this case is the room where the sensor is located. That characteristic is a relationship to another entity called the room. All these characteristics when developing Digital Twins are described by properties and metadata.

Relationships

An important part of a Digital Twin is the way entities are related to each other. These relationships are important as they define the context in which the entities are depending on each other and are a part of the reality on which the model is based. A relationship itself defines a set of data based on how the relationship is defined between the entities. An example is the relationship between the temperature sensor and the room where it is installed. This relationship defines what the temperature is within the room. Business rules can be used to take certain actions based on entities and their underlying relationships. An example would be switching off the lights within the room when there is no movement for a pre-defined time. In that situation, the lights, motion sensor, and room are each an entity with underlying relationships.

Realities

Each entity is part of a reality. Normally the reality would be a part of the physical world around us, like the example of the temperature sensor in a room. In that case, we have an actual device, room, and building. But imagine a world that represents a theoretical reality. This could be a virtual, generated reality that acts as the source for the digital replica. An example would be a digital world created in virtual reality or even another Digital Twin.

You have just learned about the concept of Digital Twins and its elements. This is important since it will help you to understand how Digital Twins can be applied to different scenarios. In the next section, we will explore the different parts of the environment around a Digital Twin to implement Digital Twin solutions.

Exploring the Digital Twin environment

It is important to understand that we need to do more than just store a model of entities to use a Digital Twin. Using a Digital Twin requires us to bind information to our entities in the model and use some method of visualization to view the model and its outputs.

Figure 1.1 – High-level overview of a Digital Twin environment

The model in Figure 1.1 shows a high-level overview of everything that is in some way used within a Digital Twin environment:

Entities – This part represents the entities from your reality. This is, for example, real-world assets, people, processes, and locations. Data that defines these entities is stored in some way in the Digital Twin.Digital Twin – This is the digital replica model of the entities in the reality. Input module – This part of the model provides data from entities into the Digital Twin model. In some situations, this is also used to dynamically generate the model-based structure of the entities. It depends heavily on actual data that flows from the entities being used in the reality.Output module – The output of the model is in most cases used to visualize the data in some way. But that is not always the case. The output could also be a setting turned on based on business logic and rules that are triggered by the input.Business logic and Rules modules – This is all about building logic and rules around the data in your Digital Twin. The result of this logic can resolve into setting the data of entities in the Digital Twin. You could extend this by connecting to or triggering the actual entity. Visualize – It is often thought that a Digital Twin is visualized. But that is not always the case. In many situations, the data flows back to the entity itself. But in some situations, a visualization of data could enhance the experience and benefit the business process. Visualization can be reached in many ways. Think of a display at the door of a meeting room displaying availability, an Excel that is filled with output data, or using augmented glasses to create a 3D presentation based on the data from the entities.Security – Each module needs to have some sort of role-based security. This can influence what data flows in and out of the Digital Twin. It could be used to only view the data that you are allowed to see based on your role in the organization. But it could also be used to view a subset of output data coming from the Digital Twin.

Now let's look at how a Digital Twin is connected to real-world entities.

A Digital Twin needs to be integrated with the physical and non-physical entities that it represents. As shown in the following figure, you will see that a Digital Twin is about being connected:

Figure 1.2 – Real-world entities are connected to a Digital Twin

Any device that can generate some form of output information based on sensors, processes, or a manual action can be an input for your Digital Twin. And these same devices, if they have some form of interface, can be controlled using rules based on the received input.

Taking the example of the motion sensor, the entity representing the motion sensor needs to get the values from the actual motion sensor in the room. Then, business logic can define that the lights need to be turned off or on based on the value within that entity. The lights themselves are also an entity in the model and bound to the actual lights within the room. The business logic can then set the value on the entity of the lights.

There are Digital Twins that require no visualization. Those Digital Twins handle and set values that will cause certain physical entities to respond. Like the example with turning on and off the lights. There are situations where a Digital Twin needs to be visualized. Such situations require some sort of presentation of the information from the Digital Twin model. Presentations can be flat out a spreadsheet or a list. But they can also be a visual representation of reality on a desktop screen. And nowadays, with extended reality using augmented glasses, it is even possible to have 3D modeled presentations of your Digital Twin.

You have learned about the different modules and parts that are required when you are going to build a Digital Twins solution. In the next part, we will be looking at several real-world examples.

Looking at real-world applications

In this chapter, we have several scenarios that will help you better understand the idea behind a Digital Twin and what it can contribute to an organization. Since implementing a Digital Twin can be a costly journey to implement, it is important to address the business value for organizations:

Gaining insights – Digital Twins can be used to get better insights into your business operations and allow you to optimize these processes. More insights can be reached by visualizing situations that would normally not be visible or more difficult to understand. Hence, better insights and allowing you to respond differently, more quickly, or in a more streamlined process. Collaboration – Using Digital Twins to view data in a collaborative way. By mimicking a real situation digitally, you can have multiple users experience and view the same data while not even being at the same location. Education – Digital Twins give you the ability to create learning environments. These learning environments can be used at schools or at the start of a job to get new employees more quickly up to speed.Simulation – Simulation by using Digital Twins allows you to create digital replicas of environments that are normally difficult to reach, too dangerous, or just not accessible. It also allows you to experiment with settings to see what the outcome is before changing these settings in the actual environment to prevent downtime or process disturbances. Create experiences – Experience a process, environment, or other situation by digitizing using a Digital Twin. There is a very clear distinction for people between looking at a flat dashboard and having the situation visualized in three dimensions. People are used to understanding more quickly by looking at something in a three-dimensional way. It can also contribute to investors and management having a clearer overview of what they are managing.Optimize operations and costs – Use Digital Twins to optimize processes in an organization to optimize operations and reduce costs. Digital Twins can deliver a return on investment in different ways. Better insights reduce time to action, getting new employees up to speed more quickly, or simulate possible optimizations before making them available in the real world.

Smart building

A smart building involves including intelligence in the processes of maintaining a building and its services. In this example, we have the Contoso office building, which has several meeting rooms. These rooms are maintained by facilities. Since this office building is a smart building, several sensors are installed in each room. We have sensors for temperature, humidity, motion, and light. Each of these sensors can be read out through a smart network. Additionally, things such as light can also be controlled by that same smart network.

Figure 1.3 – Example of a 2D map interface used for a smart building

The facilities team is responsible for the state of these rooms. One of their responsibilities is, for example, keeping the rooms at a standard temperature. There are several conditions that can influence the temperature in the rooms:

Room usage – The room being used or not for a specific amount of timeGroup size – The number of people that are in the room when it is in useDevices – Devices such as laptops, wall screens, projectors, and the use of light

Another responsibility is to provide a booking system for the meeting rooms. This booking system shows the availability on a small screen at the door and allows employees to book a meeting room through an app or service, such as Outlook.

A Digital Twin can be used to monitor and act based on business logic and rules. It can automatically switch off the lights when there is no movement in the room for a specific period. It can change the temperature based on the conditions mentioned earlier. But it is also used to update the small screen at the door with the latest information and bookings, maintaining availability by freeing up rooms that were booked but do not have someone inside, since we monitor light and movement.

There are many other features that are provided by using a Digital Twin for a smart building.

Education

In this example, we are at the Contoso Water company. Water is coming in from natural sources and goes through a filter system into large reservoirs where it is transported to households. The system needs to be in harmony for optimal performance.

This water company uses large pumps that transport incoming water into the filter system. The configuration of these pumps and their throughput needs to be adjusted over time. It is a delicate task to make changes. With the wrong configurations, the filter system could be overloaded and bring the whole water plant to a stop. The engineers who are allowed to perform these tasks must have many years of experience to perform these tasks without worry.

What happens with a junior engineer who just came from school? The junior engineer needs to learn these tasks too. But you don't want the junior engineer to practice on the actual water pump.

A Digital Twin can help with this. By replicating the important, key parts of the water plant, simulating and visualizing the assets using augmentation or virtual reality, the junior engineer can learn how to execute these tasks. The student engineer can view the digital pump and learn how to control this pump. And by tweaking the values in the model, it is possible to see the influence on the other assets in the plant. For example, by changing the throughput of the water, the student engineer can learn what the effect is on the filter system. This can be achieved by enriching the Digital Twin model using historical data and specifications of the real-world assets such as the water pump and the filter system.

Simulation

Simulation is one of the most powerful features you can create with Digital Twins. Just like the teaching example, you can simulate almost anything in a digital world. Simulation can be used for areas that are normally very dangerous to be in, such as an oil rig or areas that are not easily accessible, such as an operating room in a hospital. But it can also be used to optimize processes, which will in time create more margin.

In this example, we have the Contoso oil plant. Most of the areas in an oil plant are dangerous due to the threat of explosions and fire hazards. Oil plants contain large quantities of assets, each with its own configuration and real-time sensor devices.

For an oil plant, it is important to have the plant running as close to optimal as possible. The more oil produced, the better.

Now assume we use a Digital Twin to create a digital replica of the oil plant. We add the configuration information and real-time IoT data from sensors to the Digital Twin. This digital replica allows us now to change configuration settings for the plant and see what effect this has on oil production. Since we don't know the results upfront, the simulation will help us decide which asset configurations are required to have a positive effect on oil production.

Historical data

An interesting use case is the ability to view historical data using a Digital Twin. The amount of data stored by organizations is phenomenal. But that data is almost never used in a way that the organization could benefit from.

For this example, we will use Contoso Events. Contoso Events is a large organizer that organizes events in big cities. One of their main concerns is handling security and safety. This involves the government, police, health, and fire department. They will need to prove that they have taken enough precautions to manage it. Contoso Events needs to determine what is required to achieve a certain level of security and safety. Part of this is closing roads and defining health points in the city. The organization uses smart cameras during the event to monitor issues and crowd density. They have been collecting this data and data from various access, check, information, and health points.

In this case, the Digital Twin is a digital replica of the city map enriched with the collected data. All data is visualized on a city map. The Digital Twin contains a slider to move through time to view everything that is happening during the event. Based on these insights, their own experiences, and using machine learning, they are able to determine what the best locations are for placing roadblocks, information points, access points, and health points. The information is shared with all the government agencies.

Insight and control

Having better insights into and control over processes can help an organization. It is all about empowering workers at any level, improving and optimizing processes, and getting insights and end-to-end telemetry.

We have a company called Contoso Construction. This company performs construction work on existing facilities worldwide. Their work involves adding and updating new assets. They use large equipment such as trucks and cranes to perform their work. Several workers are onsite performing different tasks to get the job done. Contoso Construction wants to have more insights and control over the work process and the safety of their employees. While they try to prevent incidents, when those incidents happen, they require a command center to monitor and assist from a global level. Each assignment they have gives them asset data. This asset data contains the location of the asset and real-time data from sensors that are connected to the asset. An asset can be anything from a simple machine to a storage location.

By combining all this data into a Digital Twin and connecting it to backend systems containing the assets, Contoso Construction can create a visual representation of the site using augmented glasses, as shown:

Figure 1.4 – Command and control center of a construction site

When an issue occurs, the facility manager can view the issue in real time on a 3D map of the site. The visualization shows which alerts are generated based on sensor data and which cases and tasks are created. It is even possible to assign a task to an engineer. That data flows back into the Digital Twin and updates the connected backend systems.

You have learned about the different scenarios of using a Digital Twin. These examples have shown you how to solve scenarios around gaining insights, education, simulation, and creating experiences with Digital Twins. In the next part, we will explain how Digital Twins reside within Microsoft Azure.

Azure Digital Twins

Microsoft has built a comprehensive cloud platform in the last 10 years called Microsoft Azure. Every year, new services are released on the platform. One of them is Azure Digital Twins. Azure Digital Twins is part of the Internet of Things (IoT) platform and is called the next-generation IoT solution that models the real world.

The Azure Digital Twins service

The Azure Digital Twins service is a platform as a service (PaaS) that enables you to create digital replicas of an environment. PaaS is a cloud model where a provider delivers hardware and software tools enabling you to build your solutions without worrying about purchasing, installing, and maintaining hardware infrastructure.

It has a robust setup that provides a scalable and secure environment. It is part of IoT-connected solutions within Azure that allow it to connect to assets such as IoT devices as other Azure services and backend systems. The Azure Digital Twins service uses an event system to allow you to build your own business logic and data processing as routing. And it integrates with Azure services such as Azure Storage, Analytics, and Azure Machine Learning to extend the platform with predictiveness. The service can be created through the Azure portal.

Important terminology

Before we move forward, it is important to understand the different terminology used within Azure Digital Twins. Without it, it could become very confusing when explaining how Azure Digital Twins works:

Azure Digital Twins instance – This represents the complete digital replica of reality.Model – A model is seen as the noun in a description within reality. It is like a class within programming and defines a part of that reality. Examples of a model are Room, Engineer, Asset, MotionSensor, and Device. Each model is described by properties, relationships, telemetry, components, and commands. Digital Twin – An instance of a model to represent a certain entity. An example is CoffeeRoom based on the Roommodel.Twin graph – A representation of Digital Twins and their underlying relationships.

Open modeling language

Models used in Azure Digital Twins are based on the Digital Twins Definition Language (DTDL). DTDL is used as a definition language for Azure Digital Twins and IoT Plug and Play. It is part of the IoT space and helps to describe the model's ability to support provisioning and configuration across the different IoT resources. DTDL uses a variant of JavaScript Object Notation (JSON) and is named JavaScript Object Notation for Linked Data (JSON-LD).

Important note

Azure Digital Twins uses DTDL version 2. While it uses DTDL as its modeling language, it does not currently implement DTDL commands.

Tools

There are several tools that are needed when you start working on Azure Digital Twins. First, you will require an Azure environment. The Azure environment allows us to create the Azure Digital Twins service and to monitor all the other services that we will be using throughout the book.

We will be using Azure Digital Twins Explorer to view an Azure Digital Twin that is created. The tool connects to an instance of the Azure Digital Twins service and allows you to query models.

In most cases, Azure resources such as Azure Functions, Azure Service Hub, and others are used to connect to the Azure Digital Twins service. Throughout the book, we will be using Microsoft Visual Studio to create code and deploy services to build Digital Twin examples.

In most scenarios, an Azure Digital Twins instance contains digital replicas of devices. These devices generate IoT data. While normally devices are connected and routed using Azure IoT Hub, you could also make use of IoT Central.