With Azure Digital Twins you can create a digital representation of your physical devices or products. This digital representation will help you to gain insights about your product.
With the use of Azure Digital Twins, you don’t have to have specialized knowledge to gain insights. The best example was when I showed the 3D demo of the space station (see the image below) to my manager. Without any knowledge of the space station, he knew at a glance which elements needed extra attention.
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/07/image-2.png?resize=676%2C544&ssl=1)
In this article, we will explain on how to use Azure Digital Twins within your IoT solution. This blog is slightly different than we are used to, we will not go through everything step by step because there are enough blogs that have already done this. That is why we will refer to these blogs.
Current situation
In this article, we will start with an existing (simple) IoT solution. This solution consists of an IoT hub, a Stream Analytics job to filter some telemetry attributes to PowerBI and an Azure Data Explorer for historical data storage. The architecture looks like:
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/07/Architecture-Copy-of-Page-1.drawio.png?resize=676%2C267&ssl=1)
There are two options to gather insights. First, with the use of Power BI, secondly, with the use of Data Explorer. Both have their own specific user group for gaining insights.
Desired solution
To gain extra insights, we will add Azure Digital Twins to the solution. To provide the telemetry data of the IoT hub to Azure Digital Twins, we have added a Logic App in between Azure Stream Analytics and the Azure Digital Twins.
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/07/Architecture-Between-1.png?resize=676%2C419&ssl=1)
Azure Digital Twins has an integrated feature to store the history of the twin updates. So, I suggest to enable this feature so you can create a track records of all the changes made in Azure Digital Twins. Check this MS learn page on how to do so.
Rule engine
It is not mandatory, but to really make an impact, we also added a rule engine based on Azure Logic Apps (take a look at this blog of Sander van de Velde for more information). With the use of this rule engine, it is possible to update attributes of (related) twins. For example, when a fire is detected in a room of an office building, the related floor (or even the whole building) will receive a fire alarm.
By adding a rule engine to our solution, we transfer knowledge of employees within our solution. In the current situation we are living in, finding new employees is very difficult. So, if your employees leave the company, at least the knowledge is secured.
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/07/Architecture-Between-2-1.png?resize=676%2C419&ssl=1)
Controlling devices
Next step, is to control the IoT devices within the Azure Digital Twins. Because there is no default functionality within Azure Digital Twin, we have added a Web App to our solution. The Web App retrieves information about a certain twin from the Azure Digital Twins and shows the data on a webpage. We even added a possibility to control the device by updating the desired properties of an IoT device.
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/07/Architecture-SOLL-3.png?resize=676%2C375&ssl=1)
We made the web page accessible in Azure Digital Twin by a link widget in the behavior of the element. By adding the $dtid
as a parameter in the url, the webpage knew which twin to retrieve.
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/09/image.png?resize=383%2C325&ssl=1)
At great expense
After running this solution for a while, we got a budget alert. The costs were skyrocketing. And it looked like Logic Apps were the main reason for this (as seen in the screenshot below). We were using a standard tier Logic App which was already cheaper than the consumption plan.
![Screenshot Azure Cost analysis](https://i0.wp.com/veldify.com/wp-content/uploads/2023/09/image-1.png?resize=297%2C244&ssl=1)
So, to reduce costs even more, we replaced the logic apps with function apps. This adjustment has succeeded in cutting costs in half. Although we cut the cost in half, this is not a maxim, the cost reduction depends on your solution.
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/09/Architecture-SOLL.png?resize=676%2C375&ssl=1)
A downside of changing the business rule engine to function apps, is that the business logic is now in code. The business logic was much easier to understand when it was in the Logic App, because of the designer. Almost everyone understands the workflow when it is made visual, like in the screenshot below.
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/09/example-enterprise-workflow.png?resize=676%2C423&ssl=1)
In my opinion, this trade-off is acceptable because of the great cost reduction.
But what’s in it for me?
Ok, you added Azure Digital Twins to the solution, but what’s in it for me?
With Azure Digital Twins you get an overview of your installation, and you can see the status of your installation without any prior knowledge. As I said before, my manager knew at a glance which elements of the space station needed extra attention (see the image below) without any knowledge of the space station.
![](https://i0.wp.com/veldify.com/wp-content/uploads/2023/07/image-2.png?resize=676%2C544&ssl=1)
Another benefit is that you can transfer the knowledge of your employees to a standardized solution.
Leave a Reply