# Building Cyber-Resilient Smart Grids with Digital Twins and Data Spaces
## 2 Digital Twins and Data Spaces
### Data Spaces
```
1:procedureCheckPrincipleCompliance(Service, Principle)
2:\(\textit{isComplant}\leftarrow\textsc{AssessCompliance}(\textit{Service}, \textit{Principle})\)
3:ifnot isComplantthen
4:returnfalse\(\triangleright\)Service does not comply with the principle
5:else
6:returntrue\(\triangleright\)Service is compliant with the principle
7:endif
8:endprocedure
```  
**Algorithm 1** Data space service compliance```
1:functionAssessCompliance(_Service_, _Principle_)
2:ifPrinciple == Data Sharing Principle then
3:returnService.meetsDataSharingRequirements()
4:else
5:ifPrinciple == Data Transparency Principle then
6:returnService.ensuresDataTransparency()
7:else
8:ifPrinciple == Data Portability Principle then
9:returnService.supportsDataPortability()
10:else
11:returnfalse \(\triangleright\) Principle not recognized
12:endif
13:endif
14:endif
15:endif
16:endfunction
```

**Algorithm 1**_Cont._

## 3 Proposed Framework

This section describes the architecture of the proposed framework, together with a comprehensive overview of the Common Information Model and data spaces in smart grids. ### Common Information Model--IEC 61970

The Common Information Model (CIM) [8] is an essential standard that serves as the backbone for the integration and management of information systems in the power system sector. It offers a uniform structure for data representation and exchange, enhancing compatibility and enabling smooth communication across the various segments of power systems. The drive for a standardized information model emerged from the increasing intricacy and heterogeneity of electrical networks. As the energy sector evolved, a plethora of standalone software solutions and devices emerged, leading to isolated data repositories and suboptimal data flow. This fragmentation became a significant hurdle when it came to incorporating new technologies such as renewables, smart grids, and demand response initiatives. Originating from the efforts of the Electric Power Research Institute (EPRI) in the 1990s, the CIM was designed to forge a common language for electrical system representation. It later gained international stature, being refined by the International Electrotechnical Commission (IEC) and the International Organization for Standardization (ISO). The CIM delineates an extensive, flexible schema of data models that articulate the elements and interconnections characteristic of the power system landscape. These models span a broad spectrum, from power production and delivery to market transactions and customer engagement. By unifying the depiction of these elements, the CIM paves the way for different systems and applications to work in concert. A principal benefit of the CIM is its provision of an integrated perspective of the energy network, allowing for a more cohesive and efficient management of a power system. The CIM harnesses the Unified Modeling Language (UML) [13] to graphically articulate the structure and behaviour of its system components [14]. UML's universally recognized graphical tools offer a suite of diagrams and symbols that deliver a coherent visual representation of the CIM's constructs. This includes a variety of diagrams such as class, object, and sequence diagrams, each capturing distinct facets of the CIM. Through UML, the CIM's entities, with their respective attributes and interrelations, are depicted, providing an intelligible and succinct map of the model's architecture. Adapting to the dynamic requirements of the power system domain, the CIM has expanded to incorporate modern technological practices, including web services and XML-based data exchange protocols, to maintain relevance and ensure seamless integration with current IT frameworks. A significant stride in this evolution is the FIWARE community's integration of CIM entities into its data models.