District heating and cooling systems have been undergoing continuous development and have now reached the fifth-generation. In this innovative technology, connected buildings share local excess energy that otherwise would be wasted, which consequently reduces primary energy demands and carbon emissions. To date, the issue of implementing fifth-generation district systems on existing buildings has received scant attention, and our research addresses this challenging gap by proposing a novel method for designing these systems. We first explain the possible thermal interactions between connected buildings, and then present an analytical solution for the network energy balance, pipe design, and the prediction of fluid temperature under a fixed temperature difference control strategy. The analytical solution was validated against numerical simulations performed on 11 existing buildings located in Lund, Sweden using Modelica models. A diversity index metric between heating and cooling demands was also included in these models to assess the efficiency of the district system in the building cluster. The results from the analytical and numerical solutions were in complete agreement since Modelica is an equation-based modelling language. The developed models pave the way towards future investigations of different temperature control strategies and new business models that arise from the shift to the fifth-generation.