With recent advances in information and communication technology (ICT), the bleeding edge concept of digital twin (DT) has enticed the attention of many researchers to revolutionize the entire modern industries. DT concept refers to a digital representation of a physical entity that is able to reflect its physical behavior by applying platforms and bidirectional interaction of data in real-time. The remarkable deployment of the internet of things in the power grid has led to reliable access to information that improves its performance and equips it with a powerful tool for real-time data management and analysis. This paper aims to trace the continuous investigation and propose practical ideas in originating and developing DT technology, according to various application domains of power systems, and also describes the proposed solutions to deal with the challenges associated with DT. Indeed, with the development of modern cities, different energy layers such as transportation systems, smart grids, and microgrids have emerged facing various issues that challenge the multi-dimensional energy management system. For example, in transportation systems, traffic is a major problem that requires real-time management, planning, and analysis. In power grids, remote data transfer within the grid and also various analyzes needing real data are just some of the current challenges in the field. These problems can be cracked by providing and analyzing a real twin framework in each section. All in all, this paper aims to survey different applications of DT in the development of the various aspects of energy management within a city including transportation systems, power grids, and microgrids. Besides, the security of DT technology based on ML is discussed. It also provides a complete view for the readers to be able to develop and deploy a DT technology for various power system applications.