# Building Cyber-Resilient Smart Grids with Digital Twins and Data Spaces
## 2 Digital Twins and Data Spaces
### Data Spaces
This harmonization between the CIMand FIWARE data models is instrumental in enabling efficient data interchange between systems compliant with CIM standards and those developed on the FIWARE architecture, fostering an ecosystem where data circulate freely and efficiently. ### Data Space for Smart Grids

In the face of escalating energy demands driven by economic growth, industrial expansion, and population increases, the quest for sustainable energy solutions has become increasingly critical. Industries such as manufacturing, mining, and transportation, in addition to the development of urban infrastructures, are experiencing a steep climb in energy consumption [15]. The reliance on fossil fuels to satisfy these needs, however, is a cause for environmental concern, as their combustion emits greenhouse gases, exacerbating global warming and climate change [16]. Addressing these challenges, the modernization of power grids emerges as a pivotal strategy, transitioning from traditional systems hampered by an ageing infrastructure and a limited renewable integration capacity to smart grids that promise enhanced efficiency, resilience, and renewable compatibility [17]. The European Commission's initiative to create common data spaces in the energy sector is a testament to this transition, with smart grids at the forefront, enabling a two-way flow of energy and data that enriches stakeholder insights. Among the supported initiatives, FIWARE is notable for its role in shaping these data spaces through standardized data models and generic enablers, which are instrumental in developing collaborative and smart solutions. Central to FIWARE's ecosystem is the Context Broker, a key component that facilitates the creation of digital twins, essential for smart grid monitoring. It allows for the collection and analysis of data, improving grid management through its subscription methods. FIWARE's architecture also addresses interoperability issues by incorporating IoT agents that act as conduits for data exchange, converting various messaging protocols into a unified FIWARE-compliant format. This harmonization ensures that different devices and systems within the smart grid can communicate effectively. The FIWARE architecture, depicted in Figure 1, encapsulates the elements and interactions within this ecosystem, as discussed in this section. ### Framework Architecture

The architectural design we propose for our framework is tailored to enhance the surveillance of essential services, particularly focusing on advanced smart grid systems. This design incorporates various elements as illustrated in Figure 2. Our process starts with the transformation of smart grid data, organized using the CIM, into the NGSI-LD format, a standard designed for interoperability and compliance with the data space view. These data are then relayed to the Context Broker, a digital mirror of the physical grid that oversees the grid's entities, their relationships, and their data attributes. The Context Broker is equipped with subscription features that notify the system of any changes in the

Figure 1: FIWARE core components. grid's condition. These notifications are sent to the Kafka message broker, which archives historical data and facilitates interaction with external applications. Figure 2 also depicts the main technologies that have been used in each module, which will be described in detail in the following paragraph. From the CIM to the data space. The initial step in the concrete implementation of the proposed architecture involves the critical process of data conversion. Data originating from the field, already modelled following the CIM standard, are transformed for the FIWARE Context Broker. This step is pivotal, not only for aligning with the stringent regulations governing data spaces but also for guaranteeing the uniformity of data across the system. It paves the way for a standardized data model that facilitates seamless integration and interoperability among the diverse array of applications and services deployed within this ecosystem.