In-building heat recovery mitigates adverse temperature effects on biological wastewater treatment: A network-scale analysis of thermal-hydraulics in sewers

Heat recovery from wastewater is a robust and straightforward strategy to reduce 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 facility and competition among heat recovery strategies may arise. A model-based assessment of heat recovery from wastewater therefore implies extending the modeling spatial scope, with the aim of enabling thermal-hydraulic simulations from the household tap along its entire flow path down to the wastewater resource recovery facility. With this aim in mind, we propose a new modeling framework interfacing thermal-hydraulic simulations of (i) households, (ii) private lateral connections, and (iii) the main public sewer network. Applying this framework to analyze the fate of wastewater heat budgets in a Swiss catchment, we find 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 recovery facility 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. Inbuilding technologies are thus less likely to adversely affect biological wastewater treatment processes. The proposed open-source modeling 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.


Introduction
Wastewater streams in sewer networks have long been considered for their energy-carrying potential: 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, has the potential to increase the energy efficiency of the overall urban water cycle (Frijns et al., 2013).
Centralized 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., 2005).
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 centralized 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 systems 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 technologies can hardly be regulatedbeing located in private buildingsthey 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 alterationsfor instance an energy efficiency measure or a heat recovery installationrequires an additional extension of their spatial scope.Some authors have led network-wide analyzes in the context of sewer-level heat recovery (Abdel-Aal et al., 2018;2019).However, existing thermal-hydraulic studies did not simulate the entirety of the sewer network, from the household appliance to the treatment plant, either because the thermal-hydraulic modeling toolfor instance TEMPEST (Dürrenmatt and Wanner, 2014) did not allow to do so (Sitzenfrei et al., 2017) or because the focus of the study did not require in-building thermal-hydraulic processes to be simulatede.g., (Abdel-Aal et al., 2018).Important thermal-hydraulic components in upstream sections of the network are thus being overlookedor at least simplified.One such component is private lateral connection pipes, which connect households to public sewer lines, and are hypothesized as potential hotspots for heat loss from households 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 sourceshouseholdsto sinks, at which point it is finally treated (WRRF).The novel framework combines two modeling tools: (i) WaterHub (Hadengue et al., 2020) for the stochastic simulation of in-building thermal-hydraulic processes, and (ii) SWMM-HEAT (Figueroa et al., 2021), a network-scale thermal-hydraulic model based on the well-known EPA SWMM for the simulation of thermal-hydraulics in lateral connection pipes 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 modeling 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 analyzes.

Materials and methods
In the sections below, we detail each step of the workflow developed for this study.The data used for individual components of the modeling framework described hereinafter are described in Table S1 of the supplementary material.Methodological details are separated as follows: (i) The development of a novel framework to simulate thermalhydraulic processes in sewers with a full network perspective, from the wastewater source (households) to the sink (WRRF) -Section 2.1.(ii) The calibration and validation of a model using observed data from the urban catchment of Fehraltorf, Switzerland -Section 2.2.(iii) Investigations of the influence of private lateral connectionspipes connecting building drains to the public sewer networkon thermal processes in sewer networks -Section 2.3.
(iv) The assessment of the influence of in-building shower drain heat recovery devices on wastewater temperatures at the WRRF -Section 2.4.
The workflow allowed us to run scenario analyzes on upstream levels of the catchment (households and private lateral connections) and compare the results against a reference model validated with observed data.

Modeling framework
We propose a modeling framework combining building-level and network-level tools to simulate the fate of wastewater temperature and flow from households to WRRFs.The schematic structure of the framework is shown in Fig. 1.In sub-model (A), the flow and temperature of wastewater produced by households is modeled using the WaterHub Modeling Framework (Hadengue et al., 2019;2020).In sub-model (B), the outputs of sub-model (A) -i.e.wastewater thermal-hydrographs produced by householdsare used as inputs to lateral connections modeled with SWMM-HEAT (Figueroa et al., 2021).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 nodei.e. the inlet of secondary sewer linesof 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 water consumption events that are known to be important for the simulation of in-building heat flows (Hadengue et al., 2020;Marini et al., 2021).In sub-model (C), a time resolution of 5 s is used to improve computational efficiency.
The modeling framework can be applied for the simulation of any catchment.Here, we use it to simulate the sewer network of the municipality of Fehraltorf in the canton of Zurich, Switzerland.In the following sections, we provide methodological details specific to each sub-model (A), (B) and (C) with a focus on the Fehraltorf catchment.

Modeling of householdssub-model (A)
We used the WaterHub modeling framework for the thermal-hydraulic simulation of households.The framework provides (i) a stochastic water consumption simulation tool generating single water consumption events at one-second time resolutions based on real or assumed consumption data, and (ii) a thermal-hydraulic simulation tool of domestic hot water systems in the Modelica language (Mattsson and Elmqvist, 1997).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 this study, households in Fehraltorf were modeled upon a reference domestic hot water system typically found in Swiss households (Fig. 2).We simulated a basic plumbing layout: four water pipeslosing heat to their surroundingsconnected the tank boiler to appliances requiring hot water (length 5 m and diameter ½ in, no insulation).For the stochastic simulation of water demand, the 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;2017b;Butler et al., 1995;Friedler and Butler, 1996;Kenway et al., 2012;Pakula and Stamminger, 2014).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 distributionranging from one to fiveprovided by the Federal Office of Statistics, with a mean of 2.3 inhabitants per household (Bundesamt für Statistik, 2018).
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 supplementary material -Fig.S4 for comparison).

Modeling of lateral connectionssub-model (B)
The foul sewage of households is transported to the public sewer network through private lateral connection pipeshereafter referred to simply as lateral connections.Little information is available on the hydraulic and/or thermal influence of lateral connections on sewage temperatures and flow rates in public sewer lines (Islam et al., 2012;Post et al., 2016).We modeled lateral connections using single-stretch SWMM-HEAT models with uniform sampling for length, diameter, and slope characteristics to account for real-world variability.Each lateral connection had its characteristics sampled only once and reused throughout the study.The robustness of this statistical approach increases with the number of lateral connections in the system, but its practicality and ability to take into account real-world variability made it the preferred approach.We defined sampling ranges based on the few available studies and taking the limitations of the SWMM-HEAT with regard to computational instabilities into consideration, which we describe in the paragraphs below.Two studies have driven our range choices: 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 modeled 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.
In our modeling of the Fehraltorf catchment, lateral connection pipes were considered PVC pipes with Manning's roughness coefficient equal to 0.011 (cf.ASCE, 1982).We calculated pipe thicknesses to meet the requirements for drain PVC pipes (PN7.5)from the norm DIN EN 1452(1999).For lateral connections, we considered a sewer headspace temperature and soil temperature of 13 • C (see supplementary material -Section 3.2).

Table 1
Characteristics of lateral connections as used in the literature and in this study."U" stands for "uniform distribution".In SWMM-HEAT, computational instabilities in temperature computations arise at very low water volumes in hydraulic links, i.e. pipessee details in Figueroa et al. (2021).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 intrinsically transient nature.To overcome the challenge, we introduced constraints on both input flows and model characteristics of lateral connections to maximise the water volume in hydraulic links of each lateral connection.
First, input flows from several households 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, 11 households were connected to every one of the 356 lateral connections in the catchment, with a standard deviation of 2.5 households per lateral connection.To further limit the impact of low-flow periods, we introduced a constant base flow of 0.0005 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 considered negligible in the overall water balance.
Second, we 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 15 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 householdsrepresenting about 5% of the WRRF inflowcould not be associated with a simulated temperature value and were thus set to soil temperature.Additional figures and details are provided in the supplementary material (Fig. S1 and Table S2).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 difficulty 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, 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 around lateral connections.

Modeling the public sewer networksub-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 412 conduits, into SWMM-HEAT.The gravity-driven system receives two wastewater transfer flows from neighbouring municipalities (Rumlikon, Russikonsee the schematic representation in Fig. 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.Groundwater infiltration contributes up to 15%, and industrial wastewater to about 21%.The rest, 28%, is residential wastewater from households located within the municipality of Fehraltorf.
SWMM-HEAT is based on the widespread EPA SWMM hydraulic model.The thermal-hydraulic model computes the temperature at each time step based on a heat balance equation taking into account (i) conduction heat transfer at the wastewaterpipe/soil interface, (ii) latent heat transfer between wastewater and sewer headspace, and (iii) the convective heat transfer between wastewater and sewer headspace (Figueroa et al., 2021).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 supplementary material (Table S3).
Based on observations in the Fehraltorf catchment for the month of Aprilcorresponding to the calibration and validation periods (see Section 2.2) -and additional modeling analyzes, we set the soil temperature 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 supplementary material-Section 3.2.
Other model inputs were defined as follows: • Wastewater transfer flows: we used measured thermal-hydraulic time series to represent the contribution of the two neigbouring municipalities Rumlikon and Russikon.• Groundwater infiltration: Sewer infiltration 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 analyzes of own measurements at the catchment boundary (transfer flows F02, F03) and at the inflow of the WRRF (F00).Details are given in the supplementary material -Section 3.6.The temperature of sewer infiltration was set to a constant value according to the soil temperature.
• Industrial dischargers: Inflows 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 discharging hot wastewater 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 calibrated 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 flows were summed, while corresponding average temperature values were computed using a weighted mean method.

Model calibration and validation
The model was calibrated by comparing the simulated flow and temperature curves with the observed flow and temperature at three locations along the main collector in the Fehraltorf system: upstream (mostly residential wastewater flows), midstream (mixed industrialresidential wastewater), and at the inlet of the WRRF located downstream (cf.Fig. 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 runoffefficient rainfall in the preceeding 72 h until the next rain.The main reasons for choosing the period of April 2019 were: (i) non-extreme but still somewhat critical wastewater temperatures for biological wastewater treatment (European spring time 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 measurements 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 morning flow and corresponding temperature rise and the evening fall best fit the observations.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 influence of this schedule is predominent for locations downstream of the discharge point of the textile industry, i.e. midstream and WRRF.• We calibrated the temperature of industrial wastewater flows such that the simulated temperature would best fit the observed temperature 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 h-average of flow and temperature during the night-minimum flow period (between 2:00 and 4:00).Additionally, we calculated one goodness-of-fit metric: the root mean square errorobservations standard deviation ratio (RSR), following guidelines from Moriasi et al. (2007): Here, RMSE refers to the root mean square error and STD obs to the standard deviation of the observations.We note that April 19th -a public holidaywas excluded from the goodness-of-fit assessment since the model only reflects flow and temperature patterns from typical weekdays.For the following scenario analyzes, we refer to the validated model describing the status quo uniquely as the reference model.

Influence of lateral connections
Using the reference model as a basis, we evaluated the influence of changing properties of lateral connections on wastewater temperatures.In this regard, we simulated didactical scenarios with lateral connections of incrementally increasing lengths for the validation period (15-19th April 2019).Starting at 0 mno lateral connection, i.e. direct discharge from household to the public sewer networkwe systematically increased the length of the 356 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 38.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 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 lengths.

In-building heat recovery
To investigate the influence of in-building heat recovery technologies on wastewater temperatures 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, 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 discussion of its performance, we refer to the publication by Hadengue et al. (2020).
We investigated various spatially-randomized market penetration levels (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 inflow at the WRRF.Under the assumption that wastewater flows from Rumlikon and Russikon consist only of residential (85%) and groundwater infiltration (15%) sources, implementing these heat recovery technologies in Fehraltorf thus influences 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.

Model calibration and validation
We assessed the performance of the entire modeling framework by comparing the output of sub-model (C) with flow rates and temperatures measured at several locations along with the main collector in the pilot catchment: upstream, midstream and at the WRRF (see Fig. 3).With this, we provide spatially differentiated evidence of the model's ability to reflect the thermal-hydraulic dynamics of wastewater within a realworld sewer network.

Resultsqualitative evaluation
The results indicate that simulated sewage flows and temperatures follow closely the dynamics observed during dry weather conditions (Fig. 4).Diurnal flow dynamics, i.e. morning peak, 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 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.

B. Hadengue et al.
We note that for the upstream locationdominated by residential wastewater flowsmorning-peak temperatures are overestimated by 4, 5 K.Further downstream at the inflow of the WRRF, this overestimation is still visible, although less pronounced.Interestingly, a clear mismatch between observed and simulated time series appears 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 Fig. 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 weekdayshowever, we report an overall match between simulated and observed time series.

Resultsquantitative 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 flowsprimarily driven by groundwater infiltrationfall 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 nightminimum temperature fall within 0.5 K (at most 2.9% relative deviation) of the observed values at all three locations.RSR values confirm the satisfactory fit for flow dynamics (range: 0.51-0.76).The goodnessof-fit regarding temperature dynamics is less good (range: 0.68-1.32),but these values are heavily biased by the morning-peak overestimation.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 supplementary material (Table S4).

Discussiondiurnal dynamics
We consider the validated model to be a viable reference case for the analyzes presented in Sections 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 ranges when compared with observed data.Nevertheless, the discrepancy with regard to morningpeak temperatures requires a thorough discussion.
Causes for the morning-peak temperature overestimation are assumed to be manifold.First, the peak is a consequence of the 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 representto our knowledgesome of the best available data, it is likely that they do not adequately reflect the current showering habits in Fehraltorf.Second, the model simulates showers 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 studies (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 supplementary material (Fig. S3).Third, the latent heat transfer (evaporation) modelpart of SWMM-HEATis likely to yield inaccurate results in the extreme case of low-flow, small pipes 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., 2021).It is not possible to quantify the error induced by the evaporation model, but it may explain part of the overestimation of morning shower peak temperatures.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.

Influence of lateral connections
We assessed the influence of lateral connections on wastewater temperatures in sewer networks by comparing the reference case to five scenarios of varying lateral connection lengths.Starting at zero (no lateral connections, residential wastewater flows directly into the sewer network), we increased the length of connections in 15 m steps, up to 60 m.

Resultsinfluence of lateral connections
Fig. 5 shows the resulting temperature distributions at the WRRF for April 15-18, 2019.Contrary to pure hydraulic considerations, where peripheral elements are generally considered less relevant, lateral connections appear to have a significant influence on the temperature: the average temperature at the WRRF increases by 0.8 K in the scenario without lateral connections.When all households in Fehraltorf are equipped with relatively short lateral sewers (15 m), the difference in average temperature with the reference case drops to 0.2 K.The average temperature at the WRRF asymptotically decreases further with increasing length.
Results from Fig. 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 when the difference between bulk liquid and soil temperature is largewhich is often the case with incoming household wastewater.Second, wastewater inflow rates are usually small, with high surface-to-volume ratiosthin films of waterand thus further increasing heat transfer to surrounding media.It is thus no surprise that taking lateral connections into account is critical to obtain accurate simulations of wastewater temperatures in sewer networks.

Discussionrealistic 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 impossible.We therefore cannot draw 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 realisticphysically-basedsimulations 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 groundwater temperatures.We speculate, however, that the influence of lateral connections 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 closely linked to the thermal damping effect in lateral connections, discussed in Section 3.3.3.(ii) temporal context: wet-weather periods may lead to increased groundwater infiltration rates (in addition to additional runoff water), thus modifying the relative importance of lateral connections in the total heat budget.Lastly, during weekends, we may expect different water consumption behaviors and a reduced influence from industrial flows, further modifying contributions to the total heat budget at the WRRF.(iii) spatial context: Descriptions of lateral connection characteristicsslope, depth, diameter, length, surrounding media, etc. -are scarce in the literature.However, they were shown to vary widely from location to location (Islam et al., 2012;Post et al., 2016).Topographical specificities of the catchment under investigation may thus strongly influence analyzes 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 simulating lateral connections realistically when investigating thermal processes in sewer networks.
We emphasize this further by acknowledging that results from Fig. 5 are, overall, likely to underestimate heat losses in lateral connections.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 WRRF.We can thus infer that in catchments with smaller industrial wastewater or groundwater infiltration flow rates, lateral connections have an increased influence on the network's thermal-hydraulic processes.Second, as described in Section 3.1.3,the numberand total lengthof 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 Fig. 5 may thus underestimate the real influence of lateral connections on wastewater temperatures in the sewer network.

Resultsinfluence of in-building heat recovery
As shown in Fig. 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-temperaturebut less frequentpeaks are 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 thescarceliterature on the topic.Sitzenfrei et al., (2017) for instance, report a maximum temperature decrease of 1.2-1.3K at the WRRF after the installation of in-building heat recovery devices in the catchment upstream with 100% market penetration.In this regard, we discuss important perspectives to challenge and explain our results in Sections 3.3.2and 3.3.3below.

Discussioncatchment context
In the Fehraltorf catchment and during the dry weather period in April 2019 under consideration, we estimate that 21% of wastewater inflows 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 the 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 contexts of other catchments.It may thus appear reasonable to infer that this context explains the limited impact of inbuilding heat recovery on WRRF temperatures.This is, however, not the case: the average temperature difference between the reference case and the 100% market penetration scenario 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.2,we argueas other authors dothat a thorough assessment of the spatio-temporal context 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).

Discussionthermal damping
We have seen that specificities of the Fehraltorf catchment do not explain results from Fig. 6.Indeed, regardless of the catchment context, lateral connectionsand secondary sewer lines of the networkare major heat sinks, and thus act as thermal dampers.Because of the nonlinearity of heat transfer rates to the surrounding soilemphasized by the magnitude of heat losses in small uninsulated pipes -, a thermal alteration to the heat budget of householdse.g.heat recoveryis 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 case and the 100% market penetration scenario (Fig. 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 of households, in line with estimates from the literature (e.g., Kenway et al. (2019) estimate a 22% energy reduction for hot water production).At the outlet of lateral connections, the difference is 11.3 MWh, decreasing 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 technologies on wastewater temperatures at the WRRF.We thus anticipate in-building heat recovery to have significantly fewer adverse effects than centralized heat recovery strategies upstream of treatment plantsfor the same amount of recovered heaton water treatment processes in WRRFs.
In the case of Fehraltorf, if we neglect thermal damping effects entirely and simply reduce the heat budget at the inflow of the WRRF by 16.8 MWh, i.e. the effective amount of heat recovered in households upstream, the average temperature at the WRRF would decrease by approximately 0.9 Kcompared to 0.3 K as reported in Fig. 6.This temperature drop 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 penetration scenario.Whereas 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 mitigates this risk.The accurate assessment of thermal alterations at building-level thus relies on the detection and quantification of thermal damping effects stemming from lateral connections and secondary sewer lines.

Conclusion
• 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.
The framework allows systemic investigations of thermal-hydraulic modifications made to the systemfor instance heat recovery from wastewater or changes in water consumption behaviorsby taking into account the full catchment context.We used it to explore the influence of in-building heat recovery devices.• 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 Fig. 7. Thermal damping effect: the heat budget differenceover the course of four daysinduced 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, for the sake of comparison, we reduce the heat budget at the WRRF by 16.8 MWh, i.e. the amount of heat recovered in households, the average temperature at the WRRF would decrease roughly by 0.9 K, instead of 0.3 K as reported in Fig. 6.
strategy at the WRRF inflow is estimated to decrease the wastewater average temperature by up to 0.9 K for the same amount of recovered heat.• We identified lateral connectionsconnecting households to the public sewer networkas hotspots for heat loss 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 targeting hightemperature wastewater flows in the household does not significantly impact temperatures downstream.Such impacts are considerably 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 technically easier and where the impact on wastewater temperatures (and thus on wastewater treatment) is minimized.

Fig. 1 .
Fig. 1.Schematic of the modeling framework, including three sub-models (A-C) to simulate thermal-hydraulic dynamics of wastewater from the source (household) to the sink (WRRF).

Fig. 3 .
Fig.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.

Fig. 4 .
Fig. 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 April is a public holiday.

Fig. 5 .Fig. 6 .
Fig. 5. Temperature distributions at the WRRF Fehraltorf for increasing lateral connection lengths (sub-model B).The reference casethe validated model from Section 3.1 -includes randomized lateral connection lengths (very left distribution).The red line represents the trend of the mean values.(For interpretation of the references to color in this figure legend, the reader is referred to the web version of this article.)

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.