## 3 Integrating DT in CPS
### Smart Grid  
As a key energy infrastructure, the smart grid leverages information communication technology (i.e., cyber system) to provide two-way communication (of both energy and information) so that the monitoring and control of the grid can be improved and consumers can be engaged. The physical infrastructure of the power grid is composed of power generation facilities, transmission facilities, and power distribution facilities. Power generation facilities are responsible for generating electricity, while transmission facilities are used to deliver power to distribution facilities. Finally, power distribution facilities provide electricity to consumers. With the integration of the cyber system, the next-generation power grid, denoted as the smart grid, has been envisioned to provide more efficient energy service for users, including reliable and intelligent distribution management, renewable energy integration, energy storage, grid monitoring and control, and the integration of electric vehicles into the grid [5]. Generally speaking, the smart grid is a highly distributed grid system, which integrates information communication techniques, including sensing, networking communications, data analytics, and machine learning [66; 67]. These technologies can improve the reliability, efficiency, and security resilience of the grid system. The smart grid system is a large-scale distributed system. To improve the monitor and control of the grid, it is critical to know the states of physical objects (voltage, current, etc.) in the system. To do so, a massive quantity of sensors can be deployed in the grid to measure the state of critical objects and derive the accurate and insightful knowledge  
Figure 7: DT-based CPS. of physical objects based on measurements. In the past, both static and dynamic state estimation have been applied to the monitoring and control of the grid, and bad data detection algorithms have also been designed to deal with corrupted, invalid measurement, and/or malicious injection data, which can be generated via measurement error, sensor failure, or even cyber threats [24; 25]. Note that in addition to potential failures in the grid, cyber threats can directly or indirectly affect the grid's operations by injecting malicious measurement data and/or manipulating the critical control information to the actuator. To handle cyber threats, it is critical to not only monitor the state of physical objects but also monitor the state of cyber components. In this regard, the DT can be a viable approach to link the objects in the physical world to the cyber world. DT uses a data-driven modeling strategy to map the physical grid to the digital grid so that monitoring and management operations for the entire grid can be enabled. Based on the DT architecture that we have discussed, the smart grid system can be divided into several layers: object layer, communication layer, application layer, and end-user layer. In the object layer, grid components include power generation facilities, transmission facilities, and power distribution facilities. The communication layer is responsible for the communication to connect objects, supporting data exchange between the objects and the application layer, and the data communication within the object layer. For example, the gateway of the communication layer contains the device information of object layer. When the application layer needs data, the gateway can retrieve the data from a specific device as required. The application layer can also construct a digital model based on the device distribution information from the gateway. The application layer includes a digital representation of the gateways from the physical system, which contains device information from the object layer; it communicates between the application layer and the object layer through the communication layer. In the application layer, the AI model is trained based on the data collected from the object layer, and the trained model is stored in the data storage for future use.