## 1 Introduction  
Energy consumption worldwide grew by 2.3% in 2018, due in large part to higher heating and cooling needs. As a result, global energy-related CO2 emissions increased by 1.7%, up to 33.1 Gt/yr. Energy efficiency and renewable energy sources (RES) are considered the main weapons to reduce carbon dioxide emissions in the energy sector and improve primary energy intensity [1]. In this context, Smart Energy Systems (SES) are acknowledged as a viable and effective solution to shift to a more sustainable energy paradigm [2]. Smart energy systems aim to optimally integrate different energy sectors (i.e., electricity, heating, cooling, industry, transportation), in order to improve the overall flexibility and efficiency. In this way, both the economic viability and environmental sustainability of energy systems can be enhanced. Within this framework, Distributed Energy Systems (DES), which bring the production of energy close to end-users, are a clear opportunity to realize the smart integration of different energy technologiesand sources [3]. Likewise, District Heating and Cooling (DHC) networks are key elements in achieving higher security of supply, lower costs, and lower carbon dioxide emissions [4]. Indeed, smart thermal grids can exploit hybrid substations (e.g., distributed heat pumps) and usually implement optimal control strategies, thus fostering the coupling between the electrical and thermal grids [5]. In recent years, the concept of 4 th generation district heating (4 GDH) has emerged, which outlines the main features that modern thermal grids must have to meet the challenges of a sustainable energy system [6]. The first and foremost feature is the low temperature of the water distribution, so that grid losses are lowered, heat from low-temperature and renewable sources can be exploited, and high-efficiency technology, such as heat pumps, can be integrated within the network. In this respect, several works can be found in recent literature. [PERSON] and [PERSON] [7] proposed a mathematical programming model to optimize design and planning of a 4 GDH, from an economic perspective. [PERSON] et al. [8] demonstrated that lower supply temperatures can improve the energy efficiency of thermal networks, by analyzing the operation of electric heat boosters in low-energy districts. Likewise, a case study was investigated by [PERSON] and [PERSON] [9], which proved that lower temperatures provide higher exergy efficiency in district heating systems. At the same time, the issue of possible layouts of DES and plants feeding DHC networks has been thoroughly investigated in recent years. Indeed, the optimization problem of SES must deal with the synthesis of the plant, i.e., the existence and size of each component/technology considered in the superstructure of the energy system [10]. The possibility of integrating RES in district cooling systems has been exhaustively reviewed in [11]. [PERSON] et al. [12] analyzed biomass-based district heating systems, combining forestry biomass and agriculture residues as fuel. [PERSON] et al. [13] proposed the adoption of distributed heat pumps to assist the thermal production at building level in a hybrid microgrid. The integration of a trigeneration system with an Organic Rankine Cycle and a ground source heat pump was studied by [PERSON] et al. [14]. Possible configurations and operational modes of heat pumps in district heating systems have been proposed and analyzed by [PERSON] et al. [15] and by [PERSON] et al. [16]. Similarly, [PERSON] et al. [17] investigated the effect of the introduction of heat pumps in small-scale district heating systems. Basic trigeneration systems feeding DHC networks are traditionally composed of a prime mover (e.g., an internal combustion engine), a heat recovery system, and a thermally driven cooling technology (usually an absorption chiller). Moreover, back-up units are included in the system, to ensure that the demand can always be met and to improve the flexibility of the system.