Memgraph logo
Back to blog
How To Build Automation Systems with Digital Twins and Graph Databases

How To Build Automation Systems with Digital Twins and Graph Databases

By Sara Tilly
7 min readJune 28, 2024

In our latest Memgraph community call, we had the pleasure of hosting Michael Marganelli, the CTO and co-founder of Michael's enthusiasm for graph technology was immediately evident, and we knew he would bring valuable insights to our community.

During this webinar, Michael presented the concept of Digital Twins for Smart Buildings using Memgraph as a graph database. This blog post recaps the main topics of the webinar, highlighting what you can do with graph technology and graph data modeling.

Watch the full recording here if you’ve missed the live event.

Talking Point 1: Introduction

Here's a quick backstory for our readers unfamiliar with Smart, building automation systems, and related use cases.

What is, founded in 2021 by Michael Marganelli and Gord Ericsson, specializes in building automation systems (BAS) security and integration. The company offers services to a diverse clientele, including real estate management firms, federal governments, and heavy industries. Their focus areas include:

  • BAS security management: Auditing and providing secure remote access solutions for building control systems.

  • Integration and software development: Developing custom software to integrate various building systems that may use different protocols.

  • Air and water intelligence: Deploying and monitoring environmental sensors to detect risks such as flooding and poor air quality.

What is a Digital Twin?

A digital twin is a virtual representation of a physical asset, such as a building or a system, that mirrors its real-world counterpart in real time. In the context of Smart Buildings, a digital twin involves creating a dynamic model of a building's automation systems.

This model includes real-time data on various building parameters such as temperature, humidity, and equipment status, allowing for efficient monitoring, maintenance, and operation. Essentially, the digital twin serves as a comprehensive and up-to-date digital replica of the physical building and its systems.

Talking Point 2: The Problem Faced by Smart Buildings' Client

The client, a major property management firm, manages thousands of buildings across North America, each with disparate BAS systems generating numerous alarms. Different vendors and alarm notification methods led to inefficiencies and confusion in alarm management.

Smart Buildings partnered with the client to develop an alarm management system that consolidates alerts from various systems into a single platform, providing a unified view for operators.

Talking Point 3: Memgraph as the Facility Index

To build a digital twin, Smart Buildings needed a robust facility index that could handle complex relationships between facilities and devices.

Traditional relational databases with linked tables could have been more efficient and faster for this purpose. Smart Buildings chose Memgraph for its ability to store and process complex relationships efficiently. It reduced processing time and API calls by storing facility and device information locally.

This graph-based facility index provided the foundation for the digital twin, allowing Smart Buildings to map out all facilities and their components.

Talking Point 4: Enriching the Digital Twin with Sensor Information

Smart Buildings developed software to scan BAS networks for equipment and their parameters, creating a detailed graph database of facilities and their components. Each piece of equipment, such as chillers, thermostats, and boilers, was mapped with its accessible parameters (e.g., temperature, status, command). This enriched digital twin model provided a more comprehensive view of the building's automation systems, allowing for better monitoring and management.

Talking Point 5: Enriching the Digital Twin with Telemetry Data

Live telemetry data from BAS points, such as temperatures and statuses, were integrated into the digital twin. The telemetry data, stored in InfluxDB (a time-series database), was linked to Memgraph to provide real-time insights into building operations.

This real-time data feed allowed Smart Buildings to monitor the current status of equipment and environmental conditions, creating a dynamic and accurate digital twin. For example, the boiler's operating temperature and pressure were continuously updated in the digital twin, providing a live snapshot of its status.

Talking Point 6: Future with Smart Buildings

Smart Buildings plans to further enrich the digital twin with maintenance and safety plans, ensuring comprehensive coverage of all facilities and equipment. Future developments include connecting service representatives to the digital twin model for easier maintenance and enhancing the model with more detailed asset information.

The ultimate goal is to create a fully integrated and dynamic digital twin that provides complete visibility and control over building automation systems.


We’ve compiled the questions and answers from the community call Q&A session. Note that for brevity, we’ve paraphrased them slightly. For complete details, please refer to the full Constructing a Digital Twin for Smart Buildings with Memgraph community call recording.

1. How are you ingesting data into Memgraph?

  • Michael: Our Memgraph deployment is centralized, but our edge clients are out on the edge. We've written custom software that scans the building automation systems for their equipment and points, and it outputs this data in JSON format. This JSON output is then ingested by another system which reads the JSON file and creates the required nodes and relationships in Memgraph. Currently, this is a two-step process, but we hope to streamline it as the project progresses.

2. Is the asset information enriched with semantic capabilities and knowledge?

  • Michael: Not at the moment. This project is still a proof of concept for us. Currently, the asset information is limited to what we have. We are looking to integrate data from our clients' asset databases, which contain their asset tagging and information, and we hope to bring that information into our digital twin in the future.

3. What gave you the idea to look at graph databases in the first instance?

  • Michael: The idea came naturally when we considered the structure of a digital twin. A digital twin is inherently a series of nodes and relationships, mirroring real-world connections. For example, in an airplane, various components are interconnected based on their functionalities and performance metrics. Similarly, in building automation systems, the relationships between different equipment and their parameters are crucial. A graph database, with its ability to visually and logically represent these connections, was a natural choice. Additionally, the schema-less nature of graph databases made it easier to integrate diverse types of equipment and data without worrying about rigid structures.

5. Can you give us some number on how API calls were reduced?

  • Michael: Initially, every alarm would result in three API calls: one to us and two back to the vendor for facility and device names. By building a facility index with Memgraph, we eliminated the need for those extra calls. Now, we make a quick check in Memgraph to see if we have the facility information already stored. This change reduced our API calls by two-thirds, significantly decreasing network traffic and processing time.


For Smart Buildings, Memgraph proved to be the perfect solution for building their digital twin. The platform had an extremely low barrier to entry and was easy to get started with, whether using Memgraph Cloud or on-premises deployment. As an in-memory graph database, Memgraph offered very fast response times, significantly outperforming SQL calls in terms of speed. It also eliminated the need for complex lookup tables, reducing maintenance headaches.

Memgraph's ability to store both asset information and relationships within a single database allowed Smart Buildings to easily visualize connections between equipment, alarms, and other elements. This capability was crucial for their digital twin, enabling them to see the impact of taking equipment offline and other dynamic relationships.

The current graph database for Smart Buildings includes about 2800 facilities, 3700 pieces of equipment, and approximately 4000 BACnet objects (parameters). The project is ongoing and continuously expanding and improving, making it an exciting and valuable tool for Smart Buildings' operations.

Next Steps

Be sure to watch the entire community call—Constructing a Digital Twin for Smart Buildings with Memgraph. Whether you're new to graph technology or facing advanced technical challenges, our DX team is here to help. Book a 30-minute technical session during our office hours to get the support you need.

Join us on Discord!
Find other developers performing graph analytics in real time with Memgraph.
© 2024 Memgraph Ltd. All rights reserved.