## 1 Introduction  
Covering the current needs of humanity without jeopardizing the coverage of the needs of future generations is the definition established for sustainable development [1]. Thus, the concept of energy sustainability is used to address the coverage of the energy demand of society. However, this process has not been sustainable because the development and economic growth of humanity has been based on the use of energy resources of fossil origin. The transformation of these resources to final energy has had an impact on the emission of greenhouse gases (GHG), the precursors of climate change. This final energy, mainly in the form of electricity, has been mainly destined to meet the energy demand of the urban population. As seen in Figure 1 (which includes data after the 1973 oil crisis), electricity consumption has a greater correlation with the growth of the urban population than with the growth of the total population. As a further handicap, by 2040 the global demand for energy will have risen by more than a quarter due to the increase of people residing in urban areas in developing economies to 1.7 billion [2]; by 2050, 75% of the population will live in the cities [3]. Because energy consumption is transversal to economic activity, mitigation and adaptation measures towards climate change are marked by a process of the transformation of the current economic model to one decarbonized. This process is called energy transition and is based on increasing energy efficiency, electrification, and the use of renewable energy resources [5]. At the scale of the cities there is talk of urban energy transition (UET) to the use of urban renewable energy resources and the reduction of the energy consumption of buildings [6]. Compared to industry, transport, and other energy end-use consumption sectors (according to the New Policies Scenario of the World Energy Outlook 2018, in 2017 the final energy consumption was 9696 Mtoe and was distributed as follows: 3265 Mtoe in the industry (29.45%), 2794 Mtoe in transport (28.82%), 3047 Mtoe in buildings (31.43%), and 999 Mtoe (10.3%) in other energy end-use consumption sectors), world energy consumption is concentrated in buildings [2]. Thus, the greatest potential for energy saving is in these constructions [6]. In this regard, the strategies of the UET seeks to make the operation of the electrical system more flexible through the empowerment of the consumer in the management of demand and the generation of urban energy through the energy self-consumption in buildings. Making the electrical system more flexible involves an optimal combination of demand and renewable energy generation. However, the main sources of this type of energy, such as solar and wind, are intermittent: Periods of higher renewable generation generally usually occur during periods of lower residential energy demand. Therefore, to take full advantage of these energy sources, it is necessary to implement mechanisms that optimize the operation of the distribution system in cities. A strategy aimed at addressing competitiveness and confronting the efficiency and limitation of the economic and natural resources of the urban areas is smart city model [7;8]. Although this strategy surfaced during the last decade to address the limitation of energy resources in cities and the inherent production of GHG, today it covers other fields that include the provision of urban services, and governance, knowledge, and behavior of citizens [9]. Technically, smart cities are cities with a high degree of penetration of Information and Communication Technologies (ICT) to create synergies [10] between technological components and economic agents. Due to the global trend of population concentration in these urban areas, cities tend to be representative of the population, energy consumption, and energy sustainability of their countries. Figure 1: Correlation between urban population and electric energy consumption. Source: Created by authors using data from [4].