The growing pressure towards decarbonized and sustainable energy systems is radically changing how electrical power networks must be designed and operated. The demand of electricity worldwide is increasing rapidly, following the electrification of emerging economies, the diffusion of small electrical devices (e.g., consumer electronics), the adoption of electrical systems replacing less efficient energy technologies (e.g., heat pumps replacing gas-fired heating), and, finally, the transition towards the electrical mobility. In addition, the generation of electricity from renewable energy sources, the adoption of the distributed paradigm, and the deregulation of energy markets are radically revolutionizing the way electrical networks must be designed and operated, leading to the conceptualization of next generation power grids, i.e., the so- called smart grids. This course tracks all the fundamental aspects of modern electrical power systems, from the bulk power generation to the distribution and consumption of electricity by final users, by remarking all the main novelties and criticisms introduced by the decarbonization and electrification of current energy systems, and introduces the concept of smart grid as a set of assets and methodologies aiming to solve the identified issues. Particular attention is devoted to the characterization of the distributed generation from renewable sources, electrical energy storage, and electric vehicle charging systems, and to their integration and harmonization into smart grids. The course is intended to students of scientific faculties dealing with energy and electrical engineering, who want to learn the basics of smart grid design and management, as well to student of information engineering, who want to learn how information and communication technologies can be applied in modern and future power networks.