Heat recovery from wastewater is a robust and straightforward strategy to reduc e water -related energy consumption . Its implementation, though, requires a careful assessment of its impacts across the entire wastewater system as adverse effects on the water and resource recovery f acility and competition among heat recovery strategies m ay arise. A model -based assessment of heat recovery from wastewater therefore implies extending the current simulation spatial scope, enabling thermal -hydraulic simulations from the household tap along it s entire flow path down to the wastewater resource recovery facility . With this aim in mind , we propose a new modelling framework interfacing thermal -hydraulic simulations of (i) households, (ii) private lateral connections , and (iii) the main public sewer network. Applying this framework to analyse the fate of wastewater heat budgets in a Swiss catchment, we f ind that heat losses in lateral connections are large and cannot be overlooked in any thermal -hydraulic analysis, due to the high -temperature, low -flow wastewater characteristics maximizing heat losses to the environment. Further , we find that implementing shower drain heat recovery devices in 50% of the catchment’s households lower the wastewater temperature at the WRRF significantly less – only 0.3 K – than centralized in -sewer heat recovery , due to a significant thermal damping effect induced by lateral connections and secondary sewer lines . In-building technologies are thus less l ikely to adversely affect biological wastewater treatment processes. The proposed open -source modelling framework can be applied to any other catchment. We thereby hope to enable more efficient heat recovery strategies, maximizing energy harvesting while minimising impacts on biological wastewater treatment . *Corresponding author: bruno.hadengue @eawag.ch 1 1 Introduction Wastewater streams in sewer networks have long been considered for their energy -carrying potenti al: The recovery of organic carbon allows for the production of biogas and the recovery of water -contained heat, originating from hot water for domestic uses like showering and laundering , and has the potential to increase the energ y efficiency of the overall urban water cycle (Frijns et al. 2013) . Central ized heat recovery systems, such as heat pumps implemented in sewer networks or water resource recovery facilities (WRRF ), have been investigated since the 1980s (Lindström 1985, Wade et al. 1979) . Their impact on wastewater temperatures at the inflow of WRRFs and, consequently , on biological treatment processes is now widely recognized (Kollmann et al. 2017, Kretschmer et al. 2016, Neugebauer et al. 2015, Wanner et al. 20 05). More recently, in-building heat recovery systems , especially shower drain heat recovery technologies , have been gaining traction notably due to their simplicity and efficient use of high-temperature wastewater flows (Bertrand et al. 2017a, Cooperman et al. 2011, Mcnabola and Shields 2013, Meggers and Leibundgut 2011, Spriet and McNabola 2019, Wong et al. 2010) . However, the systemic implications of these technologies , both on WRRF processes and the performance of central ized heat recovery systems located downstream in the sewer network , are still unclear. Sitzenfrei et al. (2017) , for instance, have warned that in -building heat recovery system s may lead to significant competition with sewer -level heat recovery , reducing the potential of the latter technology . Because the implementation of in -building heat recovery techn ologies can hardly be regulated – being located in private buildings – they emphasize that robust strategies are required for the efficient management of heat recovery along the urban water cycle. Other authors have highlighted the need to expand the temporal scope in order to understand the seasonal impact of these technologies on wastewater temperatures (Cipolla and Maglionico 2014, Wärff et al. 2020) . In addition to expanding the temporal scope of thermal -hydraulic investigations , studying the impacts of in -building alterations – for ins tance an energy efficiency measure or a heat recovery installation – requires an additional extension of the ir spatial scope. Some authors have led network -wide analyses in the context of sewer -level heat recovery (Abdel -Aal et al. 2018, Abdel -Aal et al. 2019) . However, e xisting thermal -hydraulic models such as TEMPEST (Dürrenmatt and Wanner 2014) generally do not allow thorough system -level investigations due to their inability to simulate full sewer networks , from the household to the treatment plant . Important thermal -hydraulic components in upstream sections of the network are thus being overlooked – or at least simplified. One such component is private lateral connection pipes , which connect h ouseholds to public sewer lines , and are hypothesized as potential hotspots 2 for heat loss from household s streams . Indeed, the cumulated length of small and uninsulated lateral connection pipes commonly amounts up to two times the length of the public sewer network (Berger et al. 2016) . We propose a framework that allows for model -based investigations across entire systems, i. e. from wastewater sources – household s – to sinks , at which point it is finally treated (WRRF ). The novel framework combines two modelling tools: (i) WaterHub (Hadengue et al. (2020) ) for the stochastic simulation of in -building thermal -hydraulic processes, and (ii) SWMM -HEAT (Figueroa et al. in prep.) , a network -scale thermal -hydraulic model based on the well -known EPA SWMM for the simulation of thermal -hydraulics in lateral connection pip es and the public sewer network . We apply this framework on a median -scale Swiss city located 12 km Northeast of Zurich. The case selection was motivated by the extensive sensor network deployed in the catchment (Blumensaat et al. 2021) , providing real-world temperature and flow observations for the validation of the modelli ng framework . Using this framework , we evaluate (i) the importance of accurate simulations of private lateral connection pipes and (ii) the influence of in-building heat recovery on WRRF temperatures through various scenario analyses. 2 Materials and Method s In the section s below , we detail each step of the workflow developed for this study. The data used for individual components of the modelling framework described hereinafter are described in Table S1 of the s upplemental information ( SI). Methodological d etails are separated as follows : (i) The d evelopment of a novel framework to simulate thermal -hydraulic processes in sewers with a full network perspective , from the wastewater source (households) to the sink (W RRF) – Section 2.1. (ii) The c alibration and validation of a model using observed data from the urban catchment of Fehraltorf, Switzerland – Section 2.2. (iii) Investigations o f the influence of private lateral connections – pipes connecting building drains to the public sewer network – on thermal processes in sewer networks – Section 0. (iv) The assessment of the influence of in-building shower drain heat recovery device s on wastewater temperatures at the WRRF – Section 2.4. 3 The workflow allo wed us to run scenario analyses on upstream levels of the catchments (households and private lateral connections) and compare the results against a reference model validated with observed data. 2.1 Modelling framework We propose a modelling framework combining building -level and network -level tools to simulate the fate of wastewater temperature and flow from household s to WRRFs. The schematic structure of the framework is shown in Figure 1. In sub -model (A), wastewater produced by households is modelled using the WaterHub Modelling Framework (Hadengue et al. 2019, 2020) . In sub -model (B), the outputs of sub -model (A) – i.e. w astewater thermal - hydrographs pro duced by households – are used as input to lateral connections modelled with SWMM -HEAT (Figueroa et al. in prep.) . Ultimately, in sub -model (C), we aggregate thermal - hydrographs from the lateral connections of sub -model (B) and set the results as input to every residential node – i.e. the inlet of secondary sewer lines – of a main network model ( developed in SWMM -HEAT ). We simulate sub-models (A) and (B) with a time resolution of one second, thus accounting for small, frequent domestic wate r consumption events. In sub-model (C), a time resolution of 5 seconds is used to improve computational efficiency . The modelling framework can be applied for the simulation of any catchment. Here, w e use it to simulate the sewer network of the municipali ty of Fehraltorf in the canton of Zürich, Switzerland. In the following sections, w e provide methodological details specific to each sub- model (A), (B) and (C) with a specific focus on the Fehraltorf catchment . Figure 1. Schemati c of the modelling framework, including three sub -models (A), (B) and (C) to simulate thermal -hydraulic dynamics of wastewater from the source (household) to the sink (WRRF). 4 2.1.1 Modelling of households – sub-model (A) We use d the WaterHub modelling framework for the thermal -hydraulic simulation of households . The framework provides (i) a stochastic water consumption simulation tool generating single wat er consumption events at one -second time resolution s based on real or assumed consumption data, and (ii) a thermal -hydraulic simulation tool of domestic hot water systems in the Modelica language . The combination of these tools allows for the simulation of thermal -hydrographs, i.e. wastewater temperature and flow -resolved time series of single households. In thi s study, households in Fehraltorf were modelled upon a reference household representing a typical household in Switzerland (Figure 2). We simulated a basic plumbing layout: four water pipes – losing heat to their surroundings – connected the tank boiler to appliances requiring hot water (length 5 m and diameter ½ in, no insulation) . For the stochastic simulation of water demand, t he HydroGen tool from the WaterHub framework was used to perform Poisson processes on appliance -resolved consumption curves and event profiles found in the literature (Ableitner et al. 2016, Bertrand et al. 2017a, Bertrand et al. 2017b, Butler et al. 1995, Friedler and Butler 1996, Kenway et al. 2012, Pakula and Stamm inger 2015) . For each appliance, the consumption curves were scaled to Swiss averages (SVGW 2015) to reflect a water consumption (without outdoor uses) of 136 L cap-1 d-1. For full details on the procedure, we refer to descriptions of the WaterHub framework (Hadengue et al. 2019, 2020) . Lastly , we sampled the number of inhabitants from a distribution – ranging fr om one to five – provided by the Federal Office of Statistics , with a mean of 2.3 inhabitants per household (Bundesamt für Statistik 2018) . Figure 2. Reference household syste m modelled with the WaterHub modelling f ramework (Hadengue et al, 2020) . 5 The number of households in Fehraltorf was back -calculated from dry -weather flows provided for each residential node (see Section 2.1.3 ), assuming 2.3 inhabitants per household and a per capita consumption of 136 L d-1 (Bundesamt für Statistik 2018, SVGW 2015) . The calculation resulted in 9306 inhabitants distributed in 4046 simulated households. We note that these numbers are not identical to the Fehraltorf census data (6500 inhabitants in 2700 households consuming an estimated 187 L cap-1 d-1), but we found that this discrepancy had only marginal consequences on the simulated flow and temperature time series in the main sewer network (results are provided in the SI – Figure S4 – for comparison ). 2.1.2 Modelling of lateral connections – sub-model (B) Little information is available on the hydraulic and/or thermal influence of private lateral connection s – hereafter referred to as lateral connection s – on sewage temperatures and flow rates in public sewe r lines (Islam et al. 2012, Post et al. 2016) . We modelled lateral connections using single -stretch SWMM -HEAT models with uniform sampling for length, diameter , and slope characteristics to account for real -world variability . We defined sampling ranges based on the few available studies and taking the limitations of the SWMM -HEAT with regard to computational inst abilities into consideration , which we describe in the paragraphs below . Two studies have driven our range choice s: Islam et al. (2012) have collected data from surveys sent to municipalities and consulting companies in the United States, Canada and in the city of Berlin, Germany. As the only European city, and thus topographically closer to our modelled catchment, we only considered values from Berlin. Post et al. (2016) have investigated lateral connections from The Hague and Rotterdam in the Netherlands. Table 1 summarizes sampling ranges used in this study . Table 1. Characteristics of lateral connections as used in the literature and in this study. Islam et al. (2012) Post et al. (2016) This study Location Berlin, Germany The Hague / Rotterdam, Netherlands Fehraltorf, Switzerland Length [m] 1.8 - 53 1.3 - 45 U [15, 45 ] Diameter [mm] 75 - 400 117 - 200 U [150, 300] Slope [ -] - U [0.00 5, 0.02] U [0.01, 0.04] In our modelling of the Fehraltorf catchment, l ateral connection pipes wer e considered PVC pipes with Manning’s roughness coefficient equal to 0. 011 (cf. (ASCE 1982) ). We calculat ed pipe thickness es to meet the requirements for drain PVC pipes (PN7.5) from the norm DIN 6 EN 1452 (1999) . For lateral connections, we considered a sewe r headspace temperature and soil temperature of 13 °C (see SI – Section 3.2). In SWMM -HEAT , computational instabilities in temperature computations arise at very low water volumes in hydraulic links , i.e. pipes - see details in Figueroa et al. (in prep.) . SWMM - HEAT thus sets a fixed lower volume threshold at one litre. Below this value, the water temperature is not calculated . Accurate simulations of single -household wastewater flows are thus difficult due to their intrinsic ally transient nature. To overcome the challenge, we introduced constraints on both input flows and model characteristics of lateral connection s to maximise the water volume in hydraulic links of each lateral connection . First, input flows from several hou seholds were aggregated to decrease the number of zero- flow periods. To achieve this , we generated batches of households connected to a single lateral connection based on their cumulated flow. Within a given batch, we set, when possible, the cumulated flow to an amount greater than 2750 L d-1, a value found to be a good compromise to prevent low water volumes and yet provide a realistic number of households connected to each lateral connection (thereby representing a multi -household building). On average, 1 1 households were connected to every one of the 356 lateral connection s in the catchment, with a standard deviation of 2.5 households per lateral connection . To further limit the impact of low -flow periods , we introduce d a constant base flow of 0.000 5 L s-1 as a lower limit for flow inputs with a temperature equal to soil temperature, in this study 13 °C. This arbitrary base flow increased the total wastewater volume by roughly 1 %, which we consider negligible in the overall water balance . Second, w e constrained the spatial discretisation of lateral connection models. Lateral connection pipes were simulated with a maximum granularity of 15 m, i.e. every lateral connection is split into several sections of 15 m each, the shortest possible pipe being 1 5 m long. These constraints did not prevent periods of non -simulated temperature entirely , but significantly increased the stability of the simulations . On average, 16% of the cumulative flow from households – representing about 5% of the WRRF inflow – could not be associated with a simulated temperature value and were thus set to soil temperature . Additional figures and details are provided in the SI (Figure S2 and Table S 2). The soil temperature assumption stems from the reasoning that when in -pipe water volumes are very small, water forms a thin film at the bottom of the pipe, thus maximizing heat losses due to high surface -to-volume ratios. Despite the difficult y of quantifying the uncertainty this assumption induces in our model, we see it as having a negligible impact on temperatures at the treatment plant. Indeed, 7 the contribution of these low -flow periods to the total heat budget at the WRRF is close to negligible, in the order of 3% when the temperature is set to 13 °C , i.e. soil temperature . 2.1.3 Modell ing the public sewer network – sub-model (C) Our study focuses on the combined sewer network of Fehraltorf , which is equipped with sensors gathering thermal -hydraulic data at high spatiotemporal resolutions (Blumensaat et al. 2021) . For our analysis, we implemented sewer infrastructure data, i.e. a link -node network of 415 manholes interconnected by 4 12 conduit s, into the stormwater management model EPA-SWMM (v5.1.015 ) to establish a hydraulic model . The gravity -driven system receives two wastewater transfer flows from neighbouring municipalities (Rumlikon , Russikon – see the schematic representation in Figure 3) and carries those together with sewage from Fehraltorf to the WRRF . Our study targets dry weather conditions, i.e. it exclusively considers municipal wastewater, industrial wastewater (including commercial wastewater) , and groundwater infiltration flows. Transfer flows from the two adjacent municipalities account for 36% of the total wastewater inflow at the treatment plant. We estimate groundwater infiltration to contribute up to 15%; indus trial wastewater to about 21%. The rest, 28%, is residential wastewater from households located within the municipality of Fehraltorf. Model parameters such as pipe material, thickness, diameter, slope, and surrounding soil thermal characteristics were set according to cadaster data or following assumptions from the literature. We provide a summary of the main model parameters in the SI (Table S 2). Based on observations in the Fehraltorf catchment and additional modeling analyses , we set the soil temperat ure to 11 °C. Groundwater infiltrations, for lack of any data source, were set equal to the soil temperature. Moreover, motivated by observations in Fehraltorf, we set the sewer headspace temperature to 12 °C . Extended details are given in the SI – Section 3.2. Other model inputs were defined as follows:  Wastewater t ransfer flows: we used measured thermal -hydraulic time series to represent the contribution of the two neigbo uring municipalities Rumlikon and Russikon .  Groundwater infiltration: Sewer infiltrat ion of groundwater is accounted for as spatially distributed inflow rates ranging from 0.0005 L s-1 (non-zero for numerical stability) to 0.925 L s-1. These groundwater infiltration rates are based on night -minimum flow analyses of own measurements at the catchment boundary (transfer flows F02, F03 ) and at the inflow of the WRRF (F00) . Details are given in the SI – Section 3 -5. The temperature of sewer infiltration was set to a constant value according to the soil temperature. 8  Industrial dischargers : Inflow s to the industrial nodes were simulated as daily rectangular pulses with flow values ranging from 0.02 to 6 L s-1. The pulse schedule and temperature was calibrated manually (see Section 2.2). A textile producing company discha rging hot w astewater into the public sewer constitutes an exception . Flow and temperature were here simulated with a rectangular pulse set to 6 L s-1 and 30 °C respectively, following related field measurements. The daily schedule was identical to that cal ibrated for the other industrial contributors.  Household wastewater flows: we aggregated thermal -hydraulic time series from the outputs of sub -model (B) – see Section 2.1.2 – for every residential node in the network. Water flo ws were summed, while corresponding average temperature values were computed using a weighted mean method. Figure 3. Schematic description of the Fehraltorf catchment with the three monitoring locations upstream, midstream and at the WRRF used for the calibration and validation process (see Section 2.2) . We show transfer flows from the neighbouring sub -catchments Rumlikon and Russikon, as well as the main textile industry. The relative wastewater flow shares at the WRRF are shown on the right. F00, F02 and F03 designate the flow monitoring stations necessary to determine the groundwater infiltration rates. 2.2 Model calibration and validation We manually calibrated two parameters to match the measured flow and temperature reference at three locations along the main collector in the Fehraltorf system : upstream (mostly residential wastewater flows), midstream (mixed industrial -residential wastewater) , and at the inlet of the WRRF located downstream (cf. Figure 3). We compared simulated with observed time series in April 2019 , i.e. for two periods of persistent dry weather conditions : 8-10th April for calibration ; 15-19th April for validation . A period of persistent dry weather is hereby defined as a period with no runoff -efficient rainfall in the preceeding 48 hours until the next rain . The main reasons for cho osing the period of April 2019 were : i) non-extreme but still somewhat critical wastewater temperatures for biological wastewater treatment (European spring t ime 9 after the cold-weather period ); ii) the occurence of two sufficiently long periods of dry weather in the same season ; iii) the availability of consistent input and observed data. With all other model parameters and inputs either derived from measureme nts or from cadaster data , as described in Section 2.1.3 , we manually calibrated two remaining model parameters:  The daily schedule of industrial contributors (including the main textile industry) was calibrated such that the m orning flow and corresponding temperature rise and the evening fall best fit the observ ations . The daily schedule for the industrial rectangular pulses was thereafter set to 7:00 – 20:00. While settings are applied to all industrial contributors, the effec t of this is predominent for locations downstream of the discharge point of the textile industry, i.e. midstream and WRRF.  We calibrated t he temperature of industrial wastewater flows such that the simulated temperature would best fit the observed temperat ure curves between 10:00 and 17:00). We set it to 18 °C during daytime . We quantified the model performance through the evaluation of absolute and relative differences between simulated and observed data for a range of flow and temperature characteristics : total cumulative flow volume, period -average flow and temperature, and 2- hour-average of flow and temperature during the night -minimum flow period (between 2:00 and 4:00) . Additionally, we calculated one goodne ss-of-fit metric : the root mean square error – observations standard deviation ratio (RSR ), following guidelines from Moriasi et al. (2007) . Note that April 19th – a public holiday – was excluded f rom the goodness -of-fit assessment since the model only reflects flow and temperature patterns from typical weekdays . For the following scenario analyse s, we refer to the validated model describing the status quo uniquely as the reference model . 2.3 Influence of l ateral connections Using the reference model as a basis , we evaluated the influence of changing properties of lateral connection s on wastewater tempe rature s. In this regard, we simulated didactical scenarios with lateral connections of incrementally increasing length s for the validation period (15-19th April 2019). Starting at 0 m – no lateral connection , i.e. direct discharge from household to public sewer network – we systematically increased the length of the 3 50 lateral connections in Fehraltorf in steps of 15 m [0, 15, 30, 45 , 60 m]. This corresponds to an incremental increase in the total sewer network length from 17.06 km (0 m) in 5.25 km steps (15 m) up to 3 8.06 km (60 m) . As a comparison, the reference model total length is 27.56 km (17.06 km main network + 10.5 km lateral connections). At each step , we compared flow and 10 temperature characteristics described in Section 2.2 with results from the reference model . From these characteristics , we derived the temperature changes induced by the varying lateral connection length s. 2.4 In-building heat recovery To investigate the influence of in-building heat recovery technologies on wastewater temperature s at the WRRF , we modified the household model described in Section 2.1.1 through the addition of a shower drain heat recovery device , a commercially available technology used for the preheating of cold water streams using shower drain water. The heat recovery model implemented is a spatially discretized counter -flow heat exchanger with 10 ideally mixed nodes . Its effective heat recovery potential for the preheating of cold water from shower drain water is 8 – 10 kW, comparable to commercially available devices (Joulia AG 2017) . The heat exchanger cools down shower drain water by roughly 12 – 14 K and transfers heat to the cold water stream, typically heating up by more than 20 K. For more details on the heat exchanger model and d iscussion of its performance , we refer to the publication by Hadengue et al. (2020) . We investigated var ious spatially -randomized market penetration rates (25%, 50%, 75%, and 100% of the 4046 households located in Fehraltorf ). As described in Section 2.1.3 , these households are responsible for 28% of the total wastewater in flow at the WR RF. Under the assumption that wastewater flows from Rumlikon and Russi kon consist only of residential (85%) and groundwater infiltration (15%) sources, implementing these heat recovery technologies in Fehraltorf thus influence s at most only 50% of the total number of households in the whole catchment in the 100% market penetration scenario . Similar to the lateral connection scenarios, the flow and temperature characteristics described in 2.2 were compared to results from the reference model. 3 Results and Discussion 3.1 Model calibration and validation We assess ed the performance of the entire modelling framework by comparing the output of sub-model (C) with flow rate s and temperature s measured at several locations along with the main collector in th e pilot catchment : upstream, midstream and at the WRRF (see Figure 4). With this, we provide spatially differentiated evidence of the model’s ability to reflect the thermal -hydraulic dynamics of wastewater within a real -world sewer network. 11 Figure 4: Calibration and validation of flows and temperatures at three locations (upstream, midstream, and at the WRRF ) in the sewer network . a) Calibration period ( Monday, April 8 to Wednesday, April 10, 2019). b) Validation period ( Monday, April 15 to Friday, April 19, 2019). Note that the 19th of Apr il is a public holiday . 3.1.1 Qualitative evaluation The results indicate that simulated sewage flows and temperatures follow closely the dynamics observed during dry weather conditions ( Figure 4). Diurnal flow dynamics, i.e. morning pea k, mid -day valley and lower evening peak, are precisely reproduced at all three different locations along the main collector. Observed and simulated temperature time series show a slightly different and less consistent pattern: while the upstream location represents a 12 typical residential -dominated peak -valley -peak pattern, the midstream and WRRF locations show the impact of industrial wastewater flows estimated through a rectangular pulse temperature pattern. We note that for the upstream location – domina ted by residential wastewater flows – morning - peak temperatures are overestimated by 4 - 5 K. Further downstream a t the inflow of the WRRF, this overestimation is still visible, although less pronounced. Interestingly, a clear mismatch between observed and simulated time series appear s on Friday, April 19th, 2019 as it was a public holiday . Industries were thus not operating and it is likely that water consumption habits were not identical to typical working days (see Figure 4b). This operational shutdown is (deliberately ) left unconsidered in the model . For the first four days of the validation period – April 15 to 18th, representing typical weekdays – however , we report an overall match between simulated and observed time series. 3.1.2 Quantitative evaluation As reported in Table 2, the selected flow and temperature characteristics confirm the visual match. In the validation period, simulations yield an average flow within 1% of the observed data at the WRRF with a deviation of only 0.27 L s-1. At the two upstream locations, though, simulations overestimate the average flow by over 12%, mostly due to the overestimation of the morning peak. Simulated night minimum flows – primarily driven by groundwater infiltratio n – fall within 15% of the observed values at the WRRF (19.90 versus 23.14 L s-1). In terms of temperature, both simulated average temperature and simulated night -minimum temperature fall within 0.5 K (at most 2.9% relative deviation ) of the observed value s at all three locations. RSR values confirm the satisfactory fit for flow dynamics (range : 0.51 – 0.76). The goodness - of-fit regarding temperature dynamics is less good (range : 0.68 – 1.32), but these values are heavily biased by the morning -peak overesti mation. Indeed, ignoring the 06:00 -10:00 morning period, we find a satisfactory performance of the model, with a RSR range of 0.63 – 1.03. The full results are available in the SI (Table S3 ). 13 Table 2: Flow and temperature relative deviations (∆) for calibration and validation periods . Note that the evaluation of the signature metrics in the validation phase is limited to Apr 15th - 18th, as the 19th of April is a public holiday and does not represent a typical weekday . ∆ Avg. flo w ∆ Avg. temp. ∆ Min. flow ∆ Cum. flow ∆ Min. temp. RSR flow RSR temp. Calibration Upstream 9.8% 0.3% 43.8% 9.6% 2.9% 0.51 1.32 Midstream 3.9% 3.2% 16.7% 4.2% 0.5% 0.66 0.81 WRRF 0.3% 3.7% 5.0% 0.3% 1.5% 0.71 1.31 Vallidation Upstream 12.1% 3.3% 15.5% 11.5% 1.5% 0.59 1.09 Midstream 13.6% 3.6% 3.3% 13.4% 0.3% 0.76 0.68 WRRF 0.6% 1.5% 14.0% 6.2% 1.3% 0.75 0.83 3.1.3 Diurnal dynamics We consider the validated model to be a viable reference case for the analyses presented in Section 3.2 and 3.3 below . We adequately simulate flow and temperature dynamics at three different locations in the catchment , with reasonable RSR values and flow and temperature characteristics falling within acceptable range s when compared with observed data. Nevertheless, the discrepancy with regard to morning -peak temperatures requires a thorough discussion . Causes for the morning -peak temperature overestimation are assumed to be manifold . First, the peak is a consequence of t he hot morning showers simulated in the WaterHub sub-model (A). Showering patterns from the literature (see Section 2.1.1 ) represent showering habits of a different spatio -temporal context (1987 ) (Butler et al. 1995, Friedler and Butler 1996) . Although these curves represent – to our knowledge – some of the best available data, i t is likely that they do not adequately reflect the current showering habits in Fehraltorf . Second , the model simulates shower s as ideal processes (i.e. no evaporation or heat losses). However, a side study using the empirical heat loss model developed by Wong et al. (2010) – and used in other studi es (Sitzenfrei et al. 2017) – showed no significant reduction in the morning peak temperature, indicating that in -shower processes are not major drivers of morning -peak discrepancy. Further details are available in the SI (Figure S3) . Third, the latent heat transfer (evaporation) model – part of SWMM -HEAT – is likely to yield inaccurate results in the extrem e case of low -flow, small pipe s with large temperature gradients like shower drain water entering a lateral connection pipe. More details are available in the description of SWMM -HEAT (Figueroa et al. in prep.) . It is not possible to quantify the error induced by the evaporation model , but it may explain part of the overestimation of m orning shower peak temperatures. 14 Finally , we are likely to underestimate the number of lateral connections present in Fehraltorf . Constraints imposed on the simulation of lateral connections (see Section 2.1.2 ) led to, on average , 11 households connected to one connection pipe. A large number of connected households means a reduction in the influence of heat transfer processes in lateral connections on the network thermal -hydraulics. 3.2 Influence of lateral connections We assessed t he influence of lateral connections on wastewater temperatures in sewer networks by comparing the reference model to five scenarios of varying lateral connection lengths. Starting at zero (no lateral connections, residential wastewater flow s directly into the sewer network), we increased the length of connections in 15 m steps, up to 60 m. Figure 5 shows the resulting temperature distributions at the WRRF for April 15 -18, 2019. Contrary to pure hydraulic considerations, where peri pheral elements are generally considered less relevant, lateral connections appear to have a significant influence on the temperature: the average temperature at the W RRF increases by 0.8 K in the scenario without lateral connections. When all households i n Fehraltorf are equipped with relatively short lateral sewers (15 m), the difference in average temperature with the reference scenario drops to 0.2 K. The average temperature at the WRRF asymptotically decreases further with increasing length. Results fr om Figure 5 are in line with our understanding of basic physical processes driving heat dispersion dynamics in pipes: First, lateral sewers are smaller and thinner than main sewers, thus increasing heat transfer to the surrounding soil, especially when the difference between bulk liquid and soil temperature is large. Second, wastewater inflow rates are usually small, with high surface -to-volume ratios – thin films of water – and thus further increasing heat transfer to surrounding m edia. It is thus no surprise that taking lateral connections into account is critical to obtain accurate simulations of wastewater temperatures in sewer networks. 15 Figure 5. Temperature distributions at the WRRF Fehraltorf for inc reasing lateral connection lengths (sub -model B). The reference case – the validated model from Section 3.1 – includes randomized lateral connection lengths (very left distribution). The red line represents the trend of the mean distribution values. 3.2.1 Realistic lateral connection models The lack of catchment -specific data for water consumption, building types, and lateral connection characteristics makes a thorough validation of the household and lateral connection models impossib le. We therefore cannot draw accurate and quantitative conclusions about the real influence of lateral connection on a sewer network’s thermal - hydraulic processes. Rather, the objective of this study is to alert to the importance of providing realistic – physically -based – simulations of lateral connections when performing network - scale thermal -hydraulic investigations . We note that the influence of lateral connections on thermal -hydraulic processes depends largely on the (i) seasonal, (ii) temporal and (ii) spatial context of the catchment : (i) seasonal context: a clear limitation of our study is to focus on a single week in April 2019 , although seasonal effects are expected to modify heat transfer processes due to varying in -sewer headspace air , soil and grou ndwater temperatures. We speculate, however, that the influence of lateral connec tions on WRRF temperatures would increase in winter due to the larger temperature gradients between wastewater and soil, and thus coincide with critically -low wastewater temperatures at the WRRF. In contrast, in summer, when wastewater temperatures are not critical, their influence would decrease due to generally lower temperature gradients. This discussion is 16 closely linked to the thermal damping effect in lateral connections, discussed in Section 3.3.2 . (ii) temporal context : wet-weather periods may lead to increased groundwater infiltration rates (in addition to additio nal runoff water), thus modifying the relative importance of lateral connections in the total heat budget. Lastly, during weekends, we may expect different water consumption behaviours and a reduced influence from industrial flows, further modifying contri butions to the total heat budget at the WRRF. (iii) spatial context: Descriptions of lateral connection characteristics – slope, depth, diameter, length, surrounding media, etc. – are scarce in the literature . However, they were shown to vary widely from locatio n to location (Islam et al. 2012, Post et al. 2016) . Topographical specificities of the catchment under inves tigation may thus strongly influence analyses like the one presented here. Extending our investigations to consider alternate spatiotemporal contexts goes beyond the scope of this study . Nevertheless, the discussion above highlights the importance of simul ating lateral connection s realistically when investigating thermal processes in sewer networks . We emphasize this further by acknowledging that r esults from Figure 5 are, overall, likely to underestimate heat losses in lateral conn ections . First, the scenarios presented with varying lateral connection lengths affect only residential wastewater in the Fehraltorf catchment , i.e. only 28% of the total inflow to the W RRF. We can thus infer that in catchments with smaller indust rial wastewater or groundwater infiltration flow rates, lateral connections have a n increased influence on the network’s thermal -hydraulic processes. Second, as described above in Section 3.1.3 , the number – and total length – of lateral connections in the model is likely lower than in reality given that typical lengths are within the same range as the total length of the public sewer network . Results from Figure 5 may thus underestimate the real influence of late ral connections on wastewater temperatures in the sewer network . 17 3.3 Influence of in-building heat recovery Figure 6. Temperature distributions at the WRRF Fehraltorf for various in-building heat recover y scenarios. The reference cas e – the validated model from Section 3.1 – is compared to increasing market penetration levels (25% to 100% penetration) of a shower drain heat recovery device . The red line represents the trend of the mean distribution values. As shown in Figure 6, shower -level heat recovery influences mean wastewater temperatures at the WRRF inflow only marginally . When 25% of the Fehraltorf households are equipped with the technology, the mean temperature drops by less than 0.1 K. The drop increases to 0.3 K in the 100% market penetration scenario. Although average temperatures are not significantly influenced by shower -level heat recovery, we observe an impact on temperature distribution shapes. The high -temperature – but less frequent – peaks a re shaved off, reducing the temperature range . Maximum temperatures in the reference case reach roughly 20 °C, whereas maximum temperatures in the 100% market penetration scenario remain well below 18 °C. These results tend to disagree with the – scarce – literature on the topic. Sitzenfrei et al. (2017) for instance, report a maximum temperature decrease of 1.2 – 1.3 K in the sewer network downstream . In this r egard, we discuss important perspectives to challenge and explain our conclusion in the sections below. 18 3.3.1 Catchment context In the Fehraltorf catchment and during the dry weather period in April 2019 under consideration , we estimate that 21% of wastewater in flows at the WRRF stem from industrial or commercial sources , and 15% from groundwater infiltrations . These flows both contribute significantly to the overall heat budget : when neglecting industrial inflows in our simulations , the average temperature at th e WRRF drops by 1. 3 K, from 14.8 to 13.5 °C for the reference case . The prominent role of industrial wastewater flows in the Fehraltorf catchment may not reflect typical spatial context s of other catchments. It may thus appear reasonable to infer that this context explains the limited impact of in -building heat recovery on WRRF temperatures. This is, however, not the case: the average temperature difference between the reference case and the 100% market penetration scenar io simulated without industrial sources is 0. 3 K, identical to the difference of 0.3 K reported when considering industrial wastewater. Echoing the discussion from Section 3.2.1 , we argue – as other authors do – that a thorough assessment of the spati o-temporal c ontext of a given catchment is critical for accurate assessments of thermal -hydraulic alterations to the system (Kollmann et al. 2017, Kretschmer et al. 2016, Neugebauer et al. 2015) ). The installation of in-buildi ng heat recovery devices as well as behavioural changes or in -sewer heat recovery strategies represent such alterations, and the presented framework allows these to be investigated in a catchment context. 3.3.2 Thermal damping We have seen that specificities of the Fehraltorf catchment do not explain results from Figure 6. Indeed, r egardless of the catchment context , lateral connections – and secondary sewer lines of the network – act as major thermal dampers . A thermal a lteration to the heat budget of households – e.g. heat recovery – is thus not propagated linearly into the heat budget of the WRRF located downstream . This is clearly visible in the total heat budget difference between the reference scenario and the 100% market penetration scenario (Figure 7). At household -level, the difference is 16.8 MWh over the course of four typical weekdays (April 15 – 18, 2019) . This value reflects the amount of heat recovered with shower -level heat exchangers and represents a 16% reduction in the heat demand in households . At the outlet of lateral connections, the difference is 11.3 MWh, decreas ing by 33% due to the non -linearity of heat transfer processes in lateral connection pipes. Lastly, at the inflow of the WRRF, the heat budget difference is 8.0 MWh, less than half the difference at household -level. In other words, the thermal damping induced by lateral connections (mostly) and the sewer network (significantly) reduces the influence of in -building heat recovery technolo gies on wastewater temperatures at the WRRF . In-building heat recovery thus has significantly fewer 19 adverse effects than centralized heat recovery strategies upstream of treatment plants – for the same amount of recovered heat – on water treatment processe s in WRRFs . In the case of Fehraltorf , if we neglect thermal da mping effects entirely , i.e. we simply reduce the heat budget at the WRRF by 16.8 MWh , the average temperature at the WRRF would decrease by approximately 0.9 K – compared to 0.3 K as reported in Figure 6 –, which is much closer to the 0.8 K decrease reported by Sitzenfrei et al. (2017) in a similar market penetration scenario , i.e. the 60% market penet ration scenario . Where as these authors have concluded that in-building heat recovery may lead to large performance drops in centralized heat recovery systems and water treatment processes, we argue that thermal damping from lateral connections largely miti gates this risk . The accurate assessment of thermal alterations at building -level thus relies on the detect ion and quantification of thermal damping effect s stemming from lateral connections and secon dary sewer lines. As we have shown here, a network -scale thermal -hydraulic model – from the wastewater source (households) to the sink (WRRF) – is necessary . Figure 7. Thermal damping effect: the heat budget difference induced by heat recovery in the 100% market penetration scenario is reduced during propagation to the WRRF. Lateral connections, especially, act as significant thermal dampers. If heat recovery devices influenced the heat budget at the WRRF similarly to how they influence households, the temperature decrease at the WRRF would be roughly 0.9 K, instead of 0.3 K as in Figure 6. 4 Conclusions  The thermal -hydraulic modeling framework proposed adequately reproduces the evolution of wastewater temperatures from the source (households) to the sink (WRRF) in a real -world catchment. We used it to explore the influence of in -building heat recovery devices. 20  Implementing shower heat recovery in 50% of the households in the Swiss municipality of Fehraltorf reduced the heat demand of the targeted households by 16 %. During the spring period studied , the consequent wastewater temperature decrease at the WRRF inflow was 0.3 K. In comparison, a large -scale in -sewer heat recovery strategy would decrease the temperature of the WRRF inflow by up to 0.9 K .  We identified l ateral connections – connecting households with the public sewer network – as hotspots for heat los s to the environment, and thus major drivers of wastewater temperatures in the sewer network downstream.  Lateral connections act as major thermal dampers : thermal alterations in households are not propagated linearly in the system downstream. In this context, heat recovery target ing high-temperature wastewater flows in the household do es not significantly impact temperatures downstream . Such impacts are consi derably smaller than in - sewer heat recovery applications. Due to the large variability in lateral connection characteristics and the lack of publicly available information on this infrastructure , further research is required to support this finding.  We argue for an adaptive, flexible and location -dependent integration of heat recovery technologies. In areas where households are not the only contributors to wastewater entering the WRRF , we encourage the recovery of heat at the source, where recovery is easiest and where the impact on wastewater temperature s (and thus on wastewater treatment) is minimized. 5 Acknowledgements This research project is financially supported by the Swiss Innovation Agency InnoSuisse , and is part of the Swiss Competence Center for Energ y Research for Efficiency in Industrial Processes ( SCCER EIP ). Further financial support is given by the Eawag Discretionary Funds (grant number 5221.00492.013.08, project: DF2019/ StormHeatX). 6 Supplementa l Information Supplementa l information can be found online at https://doi.xxxxx.xxxxx . Moreover, a data package containing raw results and modeling scripts is available at https://doi.xxxxx.xxxxx . 21 7