## 3 Smart5 Grid Platform
### M&O Framework
#### 3.2.3 Smart Energy Grid Layer  
The smart energy grid layer is the environment where the data is both generated (e.g., by sensors, advanced measurement, and instrumentation units such as phasor measurement units, amongst others) and received (e.g., by intelligent controllers of distributed energy resources, automated remote terminal units, applications supporting the reliable and safe operation of the grid, and so on). Power systems are highly critical infrastructures [35]. Therefore, before deploying any new equipment or sub-system solutions that may affect the actual operation of the grid, it is mandatory that these solutions are thoroughly tested and validated in a controlled power-grid related operation environment, such as a digital twin, real-time hardware-in-the-loop (RT-HIL) testbed infrastructure. As such, in the general Smart5 Grid architecture, the smart energy layer is virtually represented by a flexible, pre-piloting smart grid layer. A general architecture of the pre-piloting testing facility, or the virtual smart grid layer, is depicted in Figure 6. It is comprised of three main architectural blocks, and only part or all of them may be required depending on the specific operation scenarios to be tested and validated. The role of each of these components, and how the Smart5 Grid platform will be integrated into this setup is briefly described below. _Digital twin of a power system:_ The implementation of a digital twin of a power system is crucial for creating realistic conditions to test and validate the energy-specific NetApps, which in turn aim to provide additional services for the grid and enable the power systems' evolution. To accomplish this, a dedicated real-time simulator (RTS) (e.g., OPAL-RT OP5700 [36]) can be used. Field measurements (collected from actual power plants either online or through measurement campaigns) are employed in these simulations to replicate the operation of selected power systems as digital twins. As a result, a digital twin of an actual power system allows the execution of studies and investigations for evolving the operation of a smart grid without risking the integrity of the infrastructure. _Control-hardware-in-the-loop (control-HIL)_: This is a framework where the Smart5 Grid platform, along with the developed power grid controllers, are included in the loop with the digital twin of the power system implemented in the RTS. To consider the complexity of the power system in real time, either a small-scale prototype plant or the digital twin of the actual power plant can be used. Thus, the controller can receive measurements  
Figure 6: General architecture of the smart grid layer in an RT-HIL environment. and send control set-points to the power grid under test (digital twin), emulating realistic conditions for the demonstration. In actual power grids and control-HIL frameworks, the real-time responsiveness of the controller is crucial for the stability of the grid along with any communication or processing delays. _Power-hardware-in-the-loop (power-HIL)_: This investigates the interaction between the power grid under test (digital twin) and a physical power equipment in the loop. This allows the testing of how a prototype or a commercial equipment will operate when it is connected to a specific location within an actual power system. Therefore, the dynamics of the power systems are replicated in a realistic way to investigate the operation of physical equipment under a relevant environment. Examples of physical power equipment are PV plants, battery storage systems (BSSs), the electrical installation of a building, wind turbines (WTs), devices used by the power industry (i.e., smart meters, phasor measurement units (PMUs), protection relays, etc. ), and micro or nano-grids, amongst others. On the other hand, power-HIL is crucial for validating and demonstrating how new power equipment will properly operate when it is connected to an actual power plant.