Sensor maintenance is time-consuming and is a bottleneck for monitoring on-site wastewater treatment syst ems. Hence, we compare maintained and unmaintained sensors to monitor the biological performance of a small-scale sequencing batch reactor (SBR). The sensor types are ion-selectiv e pH, optical dissolved oxygen (DO), and oxidation-reduction potential (ORP) with pl atinum electrode. We created soft sensors using engineered features: ammonium valley for pH, oxidation ramp for DO, and nitrite ramp for the ORP. Four soft sensors ba sed on unmaintained pH sensors correctly identified the completion of the ammonium ox idation (89 to 91 out of 107 cycles), about as many times as soft sensors based on a ma intained pH sensor (91 out of 107 cycles). In contrast, the DO soft sensor using data from a maintained sensor showed slightly better (89 out of 96 cycles) detection performance than that using data from two unmaintained sensors (77, respectively 82 out of 96 correct). Furthermore, the DO soft sensor using maintained data is much less sensitive to the optimisation of cut-off frequency and slope tolerance than the soft sensor using unmaintained data. The nitrite ramp provided no useful information on the stat e of nitrite oxidation, so no comparison of maintained and unmaintained ORP sensors was possible in this case. We identified two hurdles when designing soft sensors for unmai ntained sensors: i) Sensors’ type- and design-specific deterioration affects performa nce. ii) Feature engineering for soft sensors is sensor type specific, and the outcome is strongly influenced by operational parameters such as the aeration rate. In summary, the results with the provided soft sensors show that frequent sensor maintenance is not necessarily needed to monitor the performance of SBRs. Without sensor maintenance monitoring smalls-scale SBRs becomes practicable, which could improve the reliab ility of unstaffed on-site treatment systems substantially. Abbreviations COD chemical oxygen demand DO dissolved oxygen DOC dissolved organic carbon ORP oxidation-reduction potential OST on-site wastewater treatment (s mall, unstaffed wastewater treatment plants) PE population equivalents SBR sequencing batch reactor TOC total organic carbon WWTP wastewater treatment plant This article has meanwhile been published in Water Research. Please visite and cite: https://doi.org/10.1016/j.watres.2019.06.007 2 1 Introduction Small scale on-site wastewater treatment (OST) plants are capable of achieving the relative performance of large-scale wast ewater treatment plants (WWTP) (e.g. Abegglen and Siegrist, 2006). Consequently, a system of OST plants with adequate monitoring and associated demand-driven maintenance schem e might be able to deliver performance on par with a single centralised plant (Eggim ann et al., 2017). OST systems with capacities of approximately 4–50 population equivalent (PE) are an attractive option for several reasons: i) Modular systems have a high ma rket potential in rural areas of OECD countries because of their low investment costs and the short planning horizon (Eggimann et al., 2018); ii) OST systems can ad apt more flexibly to strong demographic changes as their lifespan is considerably s horter than corresponding networked systems (Neumann et al., 2015); and iii) from a gl obal perspective, OS T systems have the potential to rapidly improve sanitation and water pollution in urban areas without having to complete extensive public sewerage netw orks (Langergraber and Muellegger, 2005; Larsen et al., 2016). However, small OST pl ants are typically unstaffed. In some countries, like Germany, OST are inspected two to three times per year (DIBt, 2012) and many undetected failures of the plants occu r (Moelants et al., 2008). Hug and Maurer (2012) showed that monitoring would im prove the treatment performance of OSTs. Therefore, a change towards decentralised treatment requires solutions for monitoring the performance of OST systems. Rendering the evaluation of the performance of such OST systems feasible requires that the sensor maintenance burden be reduced. The scattered location of the unstaffed units means that using the sensor maintenance scheme for staffed units would incur high maintenance costs and risk a lack of diligent sensor management practice. Unmaintained sensors, which do not receive the recommended regular maintenance, may provide inaccurate measurements. However, if info rmation about the plant performance is still retrievable from these inaccurate signals, unmaintained sensors might be an attractive monitoring solution for unstaffed OST plants. In recent years, several experiments have been conducted in which staffed WWTPs were monitored and controlled over a long period with low-maintenance online sensors (Battistoni et al., 2008; Martín de la Vega et al., 2012; Peng et al., 2006; Rieger et al., 2005). Un fortunately, no information is available about the frequency of sensor maintenance, so we assume regular, e.g. weekly, maintenance. Various types of online se nsor exist for monitoring and controlling centralised WWTPs (Bourgeois et al., 2001; Olsson et al., 2014). Vanrolleghem and Lee (2003) review the most mature and some newer online sensor technologies for reliability, fouling, and calibration, and they classify t he sensors according to the maintenance each requires. Numerous studies to monitor (Lee et al., 2008) and quantify the performance (Weirich et al., 2015) of small but staffed WWTPs (5000-10000 PE) have also been conducted. In striking contrast to those centralised WW TPs, and despite early calls for monitoring and control (Boller, 1997; Massoud et al., 2009; Prieto et al., 2013), few attempts have been made to monitor OST plants remotely. Mor eover, the deterioration of signal due to lack of sensor maintenance is still poorly understood. Recent research on aging sensors suggest that signal deterioration due to sensor aging can be characterised: Ohmura et al. (2018) studied pH sensor drifts in urine nitrification processes and observed that the sensitivity (change in potential (mV) per pH unit) of 12 sensors hovered around the ideal value, which indicates that the effects of sens or deterioration might not affect the shape of a pH signal. Samuelsson et al. (2018) studied biofilm fouling on dissolved oxygen sensors and characterised their bias progression to des ign effective sensor maintenance routines. Two other studies have recently been conducted, one to correct the drifting signal of ion- selective electrodes (Papias et al., 2018) and the other to understand the fouling of ion- selective electrodes (Cecconi et al., 2019). To our knowledge, no systematic, long-term comparisons between maintained and unmaintained online soft sensors exist yet for wa stewater treatment. In this article, we use the term soft sensor to mean a sensor together with software designed to identify 3 particular features in the sensor data to obta in a specific type of information. The only other study we found monitored coastal wate rs over 100 days with various sensor designs and was used to tune the frequency of service intervals (Gra y and Heitsenrether, 2013). In this study, we tested three types of online sensors for their feasibility to monitor a pilot-scale sequencing batch reactor (SBR) without sensor maintenance: oxidation- reduction potential (ORP), dissolved oxygen (DO), and pH. The key question is: Can any kind of useful information for monitoring the biological treatment process of OST be extracted with soft sensors using measur ements from unmaintained sensors? We formulated three hypotheses: H1) the nitrite ramp feature during the aeration phase can be detected using an unmaintained ORP sensor signal; This feature is a proxy for the end of the nitrification process, when all nitrite is ox idised to nitrate; it is also called the nitrogen breakpoint (Martín de la Vega and Jaramillo-Morán, 2018; Ra et al., 1999); H2) the aeration ramp feature (a rapid chang e of the signal during the aeration phase) can be detected using an unmaintained DO signal. The presence of this feature indicates the end of the nitrificati on process as defined in i); and H3) the ammonium valley (Al-Ghusain et al., 1994) feature can be detected using an unmaintained pH signal. This feature indi cates that the ammonium oxidation is completed. 2 Materials and Methods 2.1 Experimental setup The experiment took place from 20 May 2017 to 22 May 2018 in an SBR that was launched in May 2016 with sludge from a large-scale WWTP. The pilot-scale SBR setup is depicted schematically in Figure 1. The wast ewater is pumped from the main trunk of a combined sewer with approximately 100,000 PE in its catchment to the primary clarifier. From there, approximately 800 L of pretreated wastewater is transferred to a buffer tank once a day. Urine was added to about half of the sampled cycles. Every four hours the SBR is filled with 80-120 L of wastewater from this buffer tank. Table 1 characterises these influent concentrations. Table 1: Mean, standard deviation, minimum, and maximum of the inflow concentrations to the SBR during the measurement campaign and the number of measurements. These concentrations include the added urine. Additionally, the ratio between ammonium nitrogen (NH 4-N) and total nitrogen (N tot) is given. mean standard deviation minimum maximum number of measurements NH 4 (mg N/L) 47 22 9 119 93 DOC (mg COD/L) 55 21 27 152 94 TOC (mg TOC/L) 134 69 45 399 93 COD fil (mg COD/L) 117 34 67 196 15 COD tot (mg COD/L) 423 220 164 1044 15 Ntot (mg N/L) 88 23 64 115 5 NH 4-N : N tot 0.68 0.04 0.61 0.71 5 4 Figure 1: Schematic representati on of the pilot-scale SBR setup. Sensor location is the level where the sensors are installed in t he SBR. The system boundaries indicate which part of the setup the authors studied. Automatic samplers were used to sample the influent and the effluent. The sensors are installe d at the lower part of the tank to ensure that they are below the level of the wa stewater even during the decantation phase. Buffer tank: The buffer tank is refilled every morning between 10 and 11 am. It is usual to record peak concentrations for ammonium and chemical oxygen demand (COD) in the trunk sewer at that time of the day. The urine was added to the buffer tank to ensure a balanced dataset in which half the analysed samples show complete nitrification while the other half do not. Table 2: Recipe of the SBR cycles with pha ses in chronological order. Total cycle time: 234-242 minutes. The features in this article focus on phase 4; the aeration phase.  means device off,  device on. Phase Time [min] Mixing Aeration Description 1: Idle 0.2   - 2: Filling 2-6   Filling with 80-120 litres of wastewater 3: Denitrification 23   Inflow stops before phase 3; no inflow until next cycle. 4: Nitrification (aeration phase) 114   Set point aeration between 2 and 2.2 mgO 2/L based on the signal of the maintained DO sensor. 5: Denitrification 33   Excess sludge removal once a day. 6: Settling 60   - 7: Decantation 2-6   Removal of 80-120 L supernatant. Reactor: The SBR has a volume of 430 L and is operated in six cycles per day. One cycle takes approximately 240 minutes as show n in Table 2. The reactor phase duration is time controlled. The relevant aeration phase is 114 minutes long. In addition to the wastewater from the combined sewer, we intr oduced three sources of variation: air flow (1800 – 5600 norm-litres per hour), aerobic sludge age (2-10 days1), and inflow ammonium concentration (0-8 litres of urine added). Some 56 of 107 cycles used in this study had measured effluent ammonium concentrations above 1 mg N/L and 51 cycles below or equal to 1 mg N/L. 2.2 Sensors tested for value of maintenance Three types of sensors (ORP, DO, and pH) were installed, each at least in triplicate. Figure 2 lists the individual sensors and the maintenance and sensor validation practice used for every sensor. Identical sensor designs were chosen for all three ORP and DO sensors, whereas two different designs were selected for the five pH sensors. One sensor of each type was maintained per m anufacturer’s recommendation. These sensors are henceforth called the maintained sensor s. The other sensors were neither cleaned 1 The 2 days’ sludge age, which is very short for OST, was chosen to stress the system, as the purpose was to observe cycles with incomplete ammonium and nitrite oxidation. 5 nor maintained throughout the entire measurement campaign and are called unmaintained sensors. Figure 2: Installation, maintenance, and detec tion of failure of the tested sensors. pH: Three pH sensors of CPS11D (Endress & Hauser) design and two of CPS91D (Endress & Hauser) were installed in the SBR. The difference between the two sensor designs is in the diaphragm of the reference half-cell. The CPS11D has a ring-shaped diaphragm. The CPS91D has an open aperture and is recommended for use in liquids with a high TSS concentration (Freudenberger, 2018). The maintained sensor was a CPS11D and was maintained every week according to the following procedure: i) reference measurement, as described for the unmaintained sensor below, at pH 4, ii) reference measurement in pH 7, iii) calibration whenever the drift from pH 7 or pH 4 was larger than 0.1 pH, and iv) control measurement in pH 4 and pH 7 if calibrated. The other four unmaintained pH sensors were compared weekly against the recommended buffer solutions of pH 4 and pH 7 (time in buffer 10-15 minutes). In the following, this procedure is called sensor validation. Dissolved oxygen (DO): Three sensors of the COS61D (Endress & Hauser) design were installed. The maintained sensor was cleaned twice a week and validated once a week with the water-saturated air method (Endress & Hauser, 2016). Whenever the deviation from saturation concentration was larger than 0.4 mgO 2/L, the maintained sensor was calibrated with the same water-saturated air method. The two unmaintained DO sensors were automatically cleaned with pressured air every 10 minutes during the aeration phase. Additionally, sensor validation measurements were taken once a week without drying or cleaning with the water saturated air method. The reference value was recorded after waiting at least 30 minutes. T he first 11 cycles of the DO signals were excluded from analysis, as the automatic cleaning was not yet installed. Oxidation/reduction potential (ORP): Three sensors of the CPS12D design (Endress & Hauser) were installed. The maintained sensor was cleaned and validated once a week 6 as the manufacturer recommended (Endress & Hauser, 2017) with 220 mV and 468 mV reference solution and was calibrated (for the la st eight months of the experiment) with a 220 mV solution as soon as the validation surpassed the lower limit of 190 mV. On 27 November 2017, the maintained sensor recorded a temperature of 134°C and was replaced by a new sensor of the same design on 7 December 2017. The two unmaintained sensors were neither cleaned no r maintained; however, regular sensor validation with the 220 mV buffer solution was performed during the last two months of the measurement campaign. 2.3 Process monitoring sensors Joss et al. (2009) originally set up the reactor with automatic controls and a Siemens MICROMASTER 420 converter system. We adapt ed the setup for this study. In addition to the sensors discussed in section 2.2, one pr essure sensor was installed to control the filling and emptying of the SBR. Furthermore, an ISEmax CAS40D ion-selective electrode (Endress & Hauser) was installed in the SBR to measure ammonium and nitrate. This measurement was used to decide which samples to analyse in the laboratory. 2.4 Reference measurements Over the course of the experi mental period, samples were taken with two cooled (4°C) automatic samplers (TP5 C, MAXX, 2016). One sampled the inflow during the filling phase with a bypass to the inflow tube, the ot her from the SBR close to the outflow during the decantation phase. Figure 1 shows the samp ling locations. The samples were filtered with glass-fibre filters (GF-5, 47 mm diam eter, 0.4 µm average retention capacity, MACHEREY-NAGEL) and analysed for dissolved organic carbon with a nondispersive infrared sensor (TOC-L, Shimadzu), nitrat e and nitrite with ion chromatography (IC 761 compact with anion column Metrosep A Supp4 and Supp4/5 Guard, Metrohm), and ammonium with flow injection analysis (QC 8500 FIA Series 2 with precision dilutor PDS200, Lachat) and ion chromatography (930 Compact IC Flex with cation column Metrosep C6 250/4 and C4 Guard, Metrohm). The detection limit for the ammonium measurements of the flow injection analysis is 0.2 mg N/L and of the IC 0.5 mg N/L. Next to the 107 cycles used for the analysis in this article, 21 additional cycles were sampled. These 21 data sets were separated and used fo r another study. Moreover, only 96 cycles could be used for the DO evaluation, as the aut omatic cleaning was not functional at the beginning of the experiment (see section 2.2). 2.5 Computational Methods The focus of this study is on comparing soft sensors using data from maintained and unmaintained sensors, and the aim is to shar e our findings with a large community under a suitable open-source licence2. The feature detection algorithms were selected to be as simple as possible for straightforward impl ementation, software maintenance for practical applications, and ease of sharing. Note that elaborate methods such as shape-constraint splines (Villez et al., 2013) are also available. However, these were ruled out at the time of writing due to the complexity of their implementation. All the methods are implemented using Pyt hon 3, and a module is available for download (Carbajal and Schneider, 2018). The module builds on the functionality provided by the Scipy 1.0.0 Python module (Jones et al., 2001). 2.5.1 General structure of feature computation All computed features are phase (see Table 2) and sensor type specific. Point, or local, features take a signal and return an n-dimensional point and functional, or nonlocal, features take a signal and return another signal (a d-dimensional vector where d is not 2 a license allowing copying, modification, and redistribution; e.g. GPLv3 compatible 7 specified). In this article, we only use point features. The structure of the algorithms for all features is the following: i. Select phase and/or time interval ii. Filter signal iii. Compute feature In the subsequent sections, we provide details a bout the filters we used in step ii) (section 2.5.2), and the computation of features in st ep iii) (section 2.5.3). The selected phase was always the aeration phase, since the hypotheses we are testing (H1, H2, H3 at the end of section 1) involve only this phase. 2.5.2 Digital filters There are three reasons for a filtering stage: i) signals have noise; ii) during the aeration phase, oscillations are induced in the signal by the on-off controlle r operation of the air valve; and iii) most features require a degree of regularity in the representation of the signal, such as continuous time derivatives. In the current study, we used frequency-bas ed low-pass Butterworth filters (See Scipy’s manual entry for function butter in the signal module; see e.g. Smith, (1997) for method explanation), which are useful for removing the oscillations induced by the aeration method (pH and DO signal). The frequency contents of these oscillations is clearly separated from the slowly varying co mponents that provide the features. In our case, this corresponds to removing all t he frequencies above a cut-off frequency (low- pass). However, users might consider using othe r kinds of filter, such as matching filters or time-based filters, for better performance 3. 2.5.3 Signal features The features defined in our module accept a hierarchy. Basic features are the general properties of signals (extrema, inflection poi nts: see under “Basic point features” below). Sensor-type-specific features combine or select basic features to make them specific for the signal analysed (e.g. valley in the pH signal during aeration phase, see under “Sensor-type-specific features” below). For most of the computations, we assume that the filtered signals have at least their first derivative with respect to time continuous in the interval of the analysed phase (aeration), i.e. they are ܥଵሺሾ0,1ሿሻ functions. However, some features assume more regularity; for example, features that exploit cubic spli ne representations of the smoothed signals, assume that the smoothed signals (in form of spline representations) have at least continuous derivatives with respect to time up to order 2. Henceforth, we use the term derivative to mean derivative with respect to time . 2.5.3.1 Basic point features All sensor-type-specific features used in the current study rely on two basic features: i. Signal extrema are defined as points at which the first derivative is zero and the second derivative is not zero. Extrema are computed on a spline model of the signal. The computation is performed in closed form if the degree of the spline allows it; otherwise it uses a root-finding algorithm. ii. Inflection points are defined as points at which the second derivative is zero and the lowest-order (above the second) nonzero derivative is odd (third, fifth, 3 In the accompanying Python module, the user needs only to provide a function with the signature filtered_signal = smoother(time_vector, signal) where signal, time_vector, and filtered_signal are the original sensor signal, its time vector, and the corresponding filter ed signal, respectively; the smoother here is simply a placeholder for the user-defined smooth function. 8 etc.). If additionally, the first derivative is zero, then the point is called a saddle. In our module, we compute inflection points based on spline models of the filtered data. 2.5.3.2 Sensor-type-specific features All sensor-type-specific features used in this study are demonstrated in Figure 3. pH: The ammonium valley is a minimum (signal extrema) of the pH signal during the aeration phase (Al-Ghusain et al., 1994). The function in the accompanying module computing this feature is called the aeration_valley . This point feature indicates the time at which the minimum was found and the value of the pH signal at this time. Dissolved oxygen: The aeration ramp is a maximum of the first derivative of the DO signal during the aeration phase. The function in the accompanying module computing this feature is called the aeration_ramp . The output of the function is a three- dimensional point feature composed of the time of occurrence of the ramp, the value of the DO signal, and its derivative at that time. The latter is used for the slope tolerance. Oxidation / reduction potential : The nitrite ramp feature is also a maximum of the first derivative; it is an inflection point where the second derivative is zero and the third derivative is negative. The function in the accompanying module computing this feature is called the nitrite_ramp . Visual classification of all ORP cycle signals in a randomised order by one of the authors (MYS) revealed no sy stematic feature that could be exploited as a nitrite ramp. Therefore, no automat ic classification was tested based on the proposed feature. Instead, we performed an exploratory analysis of the ORP signals (see section 3.5). Figure 3: Synthetic signal that shows possibl e variations introduced by aeration. This signal is smoothed with our algorithm. The aeration ramp and the nitrite ramp (ramp) and the ammonium valley (valley) are then taken from the smoothed curve. 9 2.6 Data labels for classification of sensor signals The performance of the soft sensors is eval uated by their classification power. The cycle labels used for classification are derived from the concentrations of ammonium measured in the effluent. If ammonium nitrogen was equal to or below the 1 mg N/L threshold, the cycle label is positive ; 51 cycles have the positive label. If the ammonium nitrogen in the effluent is above 1 mg N/L, the cycle label is negative ; 56 cycles have the negative label. This threshold was set before we started the analysis with the effluent concentration as a classifier. We decided to use double the detection limit. This is one option of several (five effluent concentrations lie between 0.75 mg N/L and 1.25 mg N/L). The choice of a threshold allows us to ignore the issue of assigning a concentration to the measurements below the detection limit: it only matters that these measurements are below the threshold but not by how much. We assume that the measured concentrations do not suffer from systematic errors and that t he stochastic error is negligible for the classification. 2.7 Parameter optimisation We use the following definitions to descri be the type of classification of the feature detection:  True positive (TP): A feature is detected, and t he cycle label is positive.  True negative (TN): No feature is detected, and the cycle label is negative.  False positive (FP) : A feature is detected despite a negative cycle label.  False negative (FN) : No feature is detected despite a positive cycle label. The results for the different parameters are visualised using a receiver operating characteristic (ROC) curve (Swets, 1961). The true positive rate (TPR) and the false positive rate (FPR) are computed using Equations 1 and 2, respectively. ܴܲܶ ൌܲܶ ܲܶ ൅ܰܨሺ1ሻ ܴܲܨ ൌܲܨ ܲܨ൅ܰܶሺ2ሻ 3 Comparison between maintained and unmaintained sensors 3.1 Tuning of the cut-off frequency for the ammonium valley feature To tune the cut-off frequency for the ammonium valley detection, we used a grid search. Figure 4 shows the ROC curve for the different cut-off frequencies to smooth the signal. The ROC curve shows no difference between the maintained and unmaintained sensors. This suggests that maintained and unmaintai ned sensors provide the same information content and information quality. Different cut-off frequencies for maintained (2.25 per aeration phase duration) and unmaintained (t hree times 1.82 and once 2.57 per aeration phase duration) soft sensors provide the same feature detection ability. This implies that parameter tuning is required to choose a su itable trade-off between the TPR and FPR. 10 Figure 4: ROC curve for the evaluation of all five pH soft sensors, which plots the true positive rate (TPR) against the false positive rate (FPR) with the FPR < 0.03 as the boundary where the cut-off frequency is optimal for the FPR. Circle size is used to visualise overlapping points, it carries no meaning. 3.2 Tuning of cut-off frequency and slope tolerance for the aeration ramp feature For the oxygen soft sensor, two parameters were tuned: the cut-off frequency and the slope tolerance. The parameter landscape plot in Figure 5 shows the total of true feature detections with the set of parameters indica ted on the x and y axis. The left panel shows the true detection for the maintained sensor and a large dark area (when compared with the other panels) can be observed. This larger optimal (darker) area indicates that using a maintained sensor will generate better detections than using unmaintained sensors, for the same set of cut-off frequency and slope tole rance. The size of the darker area also tells that the quality of the detections usi ng a maintained sensor are less sensitive to variation of the filter and feature paramete r (cut-off frequency and slope tolerance) than those using an unmaintained sensor. However, for some parameter combinations, the sum of the true detection of the unmaintai ned soft sensors is nearly as high as for the maintained soft sensor, and the sum of the false prediction is nearly as low for the unmaintained soft sensors as for the maintained soft sensor (see Figure 7). A minimal slope tolerance of 21.5° and a cut-off frequency of 2.54 per aeration phase duration for the maintained soft sensors was chosen and minimal slope tolerance of 40° and a cut-off frequency of 2.5 per aeration phase duration for the unmaintained ones. 11 Figure 5: The sum of all true detection for t he DO soft sensor’s parameters, where TP is true positive and TN is true negative. The parameters are minimal slope and cut-off frequency. The maintained sensor is co mpared to the unmaintained sensors. 3.3 Ammonium valley detecti on based on the pH signal The automatic identification of the ammonium valley in 107 SBR cycles, with the identified cut-off frequencies, shows that 85% of t he maintained pH cycles and 83-85% of the unmaintained pH cycles were classified corr ectly (compare Table 3, true positive and true negative, divided by total) when compared to the ammonium effluent concentration. Only one cycle (Figure 6) of the maintained and unmaintained soft sensors had a false positive classification, and the measurement of this effluent sample had been marked as untrustworthy before we observed any feature re sults. Therefore, this false positive is very likely an outlier of the reference measurem ents. Hence, if the algorithm identifies an ammonium valley, we are confident that the ammonium concentration is below the threshold of 1 mg N/L. Conversely, false negative identific ations indicate that nondetection of the feature does not necessarily mean that the ammonium concentrations are above the threshold. Similarly, in Figure 4, we cannot see any si gnificant difference in the feature detection performance of the maintained and unmaintained soft sensors. This means that we were able to reliably identify the end of the ammonium oxidation process with unmaintained pH sensors. 12 Figure 6: Ammonium valley (pH soft sensor) – Measured effluent ammonium concentration against the ammonium valley feat ure detection time (% of duration of cycle passed during the aeration phase). The upper plot shows the concentrations for cycles in which the ammonium valley was not detect ed. The detection of the feature should correspond to a concentration below threshold, here shown with a vertical line (1 mg N/L). The analysis from the maintained sensor is shown by a large circle, the unmaintained sensors by smaller circles with decreasing diam eters. The colours of the markers indicate whether the classification was true (pur ple/darker) or false (orange/lighter). Table 3: Results of the binary feature dete ction with the selected parameters for the maintained and the unmaintained pH soft sensors. pH sensors number of FP number of FN number of TN number of TP maintained 1 1 15 50 41 unmaintained 1 1 16 50 40 unmaintained 2 1 15 50 41 unmaintained 3 1 17 50 39 unmaintained 4 1 17 50 39 3.4 Aeration ramp detection based on the DO signal The automatic identification of the aeration ramp for the 96 fully characterised SBR cycles showed that 92% of the maintained DO cycl es and 80% for the first unmaintained DO and 85% for the second unmaintained DO sensor, respectively, were classified correctly (compare Table 4, true positive and true negativ e, divided by total). Only 2 cycles of the maintained signal are classified wrongl y, and none of the unmaintained signals are. Therefore, if the algorithm does identify an aeration ramp, we are confident that the ammonium concentration is below 1 mg N/L at the end of the cycle. Additionally, 5 false negative identifications of the aeration ramp were made with the maintained soft sensor and 19 and 14 with the unmaintained soft s ensors. When the par ameters are tuned to minimise the number of false positive classifi cations, we observe that the number of false positives is insensitive to sensor maintenance , but the number of false negatives is larger without maintenance of the sensor (see Figure 7) 13 Figure 7: Aeration ramp (DO soft sensor) – Measured effluent ammonium nitrogen concentration against the feature detection ti me during the aeration phase. The feature is a steep slope in the DO signal. The upper pl ot shows the concentrations for cycles in which no feature was detected. The presence of the feature should correspond to a concentration below the threshold, here shown with a vertical line (1 mg N/L). The analysis from the maintained sensor is shown by a large circle, the unmaintained sensors by smaller circles with decreasing diameters. T he colours of the markers indicate whether the classification was true (purple/ darker) or false (orange/lighter). Table 4: Results of the binary feature dete ction with the selected parameters for the maintained and the unmaintained DO soft sensor. DO sensors Number of FP Number of FN Number of TN Number of TP maintained 1 2 5 49 40 unmaintained 1 0 19 51 26 unmaintained 2 0 14 51 31 3.5 Exploratory analysis of the ORP signal A basic exploratory analysis showed that i) the mean and variance of the signals are highly correlated over time (see Figure 8 A), and ii) it is hard to distinguish the signals of maintained sensors from those of unmaint ained sensors by their summary statistics. Observation i) is expected due to the experim ental procedures in which activated sludge remains across several cycles, and biological processes develop slowly over time. This observation is relevant to future efforts aimed at building models for forecasting effluent concentrations. Observation ii) indicates that ORP might be still a good candidate variable for unmaintained monitoring provided that t he operational conditions leading to detectable ORP features are identified. Figure 8 B) and C) show the lack of classification potential using the mean and variance of a locally detrended signal and the projection in the first two principal vectors. The outliers in Figure 8 B) correspond to cycles for which the 14 sensors were validated. Figure 8: Results of the expl oratory analysis of the ORP signals. A) shows the mean and standard deviation of the signals. The time of the cycle within the experimental period is indicated by the area of the circles (small = cycle at the beginning, large = at the end). B) shows the mean and standard deviation of the residuals on a log scale (after removing a moving linear trend with a Savitzky–Golay f ilter (Savitzky and Golay, 1964)), and C) shows the first and second principal components. 3.6 Time required for maintenance An additional result from our study, useful to estimate the costs of OST monitoring, is the time we spent on sensor maintenance. It t ook us about 15 minutes per week to validate the maintained pH sensor, 30 minutes to validate the DO sensor, and 5 minutes to validate the ORP sensor. Most of this ti me was spent waiting until the measurements were stable. When a calibration was perfor med, the time required for the reference measurements multiplied by the number of point s that were used for the calibration (two for pH and one for DO and ORP) results in a total of 45 minutes for all pH sensors, 60 minutes for all DO sensors, and 10 minutes for all ORP sensors. This calculation excludes the time travelling to the test site. 4 Discussion Our extensive monitoring campaign has enabled us to successfully demonstrate that, given an appropriate engineered feature, unmaintained sensors can provide the same information and information quality as maintained sensors. In this section, we discuss the circumstances under which this is expected to be true. We first discuss the features of each sensor type and what the results suggest for further feature development. Second, we compare the detection ability of maintained and unmaintained soft sensors, including which of the soft sensors we would recommend using. Finally, we make suggestions for future research. 15 4.1 Feature Engineering Proton concentrations, measured by th e pH sensor, and dissolved oxygen concentrations, measured by the DO sensor and indirectly by the ORP sensor, are not only strongly affected by nitrification but also depend on a series of other factors, such as aeration rate and heterotrophic bacteria growth. These factors act as potential confounding factors during feat ure detection. Indeed, our method s assume that a feature, such as a minimum in the pH signal, can only be produced by the target phenomenon of interest (i.e. ammonium oxidation completion). For example, with the experience gained in this study and an additional OST in operation, we observed that the aeration rate is the pred ominant factor for all the features that we tested. Similarly, another study has found that the ORP is strongly affected by residual oxygen (Holman and Wareham, 2003). As the in fluence of each confounding factor can be reduced by appropriate control of aerati on, we are convinced that the low-level controls of SBRs should be designed and tuned to ensure that the high-level monitoring functionalities provided by soft sensors are guaranteed. In the following, we discuss the detection of three features: nitrite ramp, aeration ramp, and ammonium valley.  ORP: Ra et al. (1999) identified the nitrogen breakpoint, here called nitrite ramp, in swine manure treatment. We did not observe the nitrite ramp feature in the ORP signal of our data despite complete oxidation of ammonium and nitrite to nitrate in 30 cycles. One possible explan ation is that the ammonium oxidation rate is too low, especially relative to the aeration rate (controlled between 2 and 2.2 mgO 2/L), as discussed above. However, te sts with a lower aeration rate did not support this. Similarly, Peddie et al. (1990) observed a plateau instead of a nitrite ramp.  DO: A feature that relies on the DO signal has a direct causal relation via the oxygen uptake rate to the ammonium effluent concentration, which makes it a compelling signal for feature engineering. The feature we use is based on visual observation. The driving factor behind th is feature is the oxygen uptake rate, which was reported previously as a relia ble measure for SBR processes (Villez et al., 2010). In a constantly or fixed-time-i nterval aerated system, we would expect this ramp to appear even more clearly than with on-off feedback control of the DO.  pH: The ammonium valley proved to be a very robust feature in our case. However, similarly to the nitrite ramp, the ammonium valley feature could be absent from the pH signal (as a test in the same reactor showed where we controlled the DO between 4 and 4.4 mgO 2/L). Indeed, if the aeration is strong enough to strip CO 2 faster than the nitrifying bacteria produce protons, no ammonium valley occurs despite a full amm onium oxidation. As stronger aeration is a waste of energy, within the te sted range is no trade-off between the performance of the treatment process and the feature occurrence: both benefit from a lower aeration rate. 4.2 The value of s ensor maintenance To our knowledge, this is the first time that the same type and design of maintained and unmaintained sensors were installed in a wa stewater treatment pl ant and a systematic comparison was made over one year. As sensor maintenance is time-consuming, hence preventing the application of sensors in OSTs , the findings described below are potential game-changers. In the following, we discuss how the unmaintained ORP, DO, and pH soft sensors fare compared to the maintained soft sensors:  ORP: Several elements of the experiments lead to new insights: i) under our operating conditions, the nitrite ramp is absent, which means that we do not gain information about the system’s perform ance from this feature, and ii) the 16 unmaintained and maintained sensor signals are statistically not distinguishable, based on this exploratory analysis (Figur e 8 in section 3.5) of the signals.  DO: Both unmaintained DO sensors show very similar behaviour but distinct from the maintained sensor. This suggests that the sensor deterioration processes for both unmaintained sensors are similar. St udying these disturbances may lead to robust features to compensate for deteri oration effects. Possible causes might be the formation of a layer of fat that t he treatment with pressured air does not remove, gradual abrasion of the sensor membrane by pressured air, or the growth of a nitrifying biofilm. This last would explain the sudden change observed in the offset at the end of nitrification, where no ammonium is present to cause additional oxygen consumption on the sensor membrane (see Appendix A.2). Despite these disturbances, which migh t mislead human experts when classifying visually, the soft sensor does not classify a false-positive ramp. This means that detection from the unmaintained soft sensor is insensitive to these disturbances.  pH: No difference could be observed between the maintained and unmaintained pH soft sensor when detecting ammonium valleys. The comparably high information content of the unmaintained pH sensor signal can be explained by the design of the soft sensors. We used features that are robust to additive disturbances of the signal, such as an offset or a drift that is slow compared to the length of an SBR cycle. While observi ng a drift, we did not find any variation in sensitivity, which is in line with a re cent study with 12 pH sensors lasting for two years that observed stable sensitivity (Ohmura et al., 2018). With the algorithms that we used, the DO soft sensor performs better with data from a maintained sensor than do the pH and ORP soft sensors. However, the DO sensor with automatic cleaning is about as informative with unmaintained-sensor data as the pH soft sensors with either kind of data. The perfor mance of the soft sensors with maintained- sensor data is treated as the benchmark, because they are equivalent to the best performance achievable with unmaintained sensor s. However, it should be noted that this is not a universal benchmark, because using a different algorithm or sensor designs could lead to better performances of soft sensors with maintained-sensor data. In addition, we did not optimise the plac ement of the sensors. In our study, the ammonium valley detection for the pH signal is at its full potential. In contrast, the aeration ramp could be im proved by first characterising and then compensating the disturbances in soft sensors. 4.3 Implications for OSTs and outlook An extensive literature study and conversations with practitioners across Asia and Europe confirmed that no continuous, remote monito ring of the biological processes of OST plants is currently executed in practice. This has a detrimental effect on overall treatment performance and cost, as performance failures are only detected during maintenance, and maintenance is executed to a fixed schedul e instead of when it is actually needed. Our study demonstrates that unmaintained sensors can be used to monitor biological processes in OSTs, which allows one of the main hurdles to widespread monitoring, sensor maintenance costs, to be overcome. Therefore, we suggest using soft sensors with unmaintained sensors as a cost-effective solution that enables continuous monitoring of OST plants. This result offers potential improvements fo r OSTs: Demand-driven maintenance of OSTs could lead to an overall increase of system performance and thus improve the reputation of OST systems. Furthermore, the dat a gathered can be used to refine and further improve the soft sensors presented in this wo rk for example by exploring the following:  the possibility of employing human expe rts instead of ti me- and resource- consuming ammonium measurements to detect ammonium valleys and/or 17 aeration ramps, which are then used as a benchmark against which the features under development can be tested;  the use of unmaintained ORP, DO, and pH sensors to determine the inflow and the effluent concentrations of other compounds than ammonium, such as for example COD; and  extracting information from as-yet-unexp loited auxiliary data, su ch as the aeration pattern. This could enable more transferable feature design. Furthermore, other designs of pH, ORP and DO sensors or completely different types of sensors, such as ion-selective electrod es for ammonium measurement and off-gas sensors, could be tested for use without maintenance. 5 Conclusion The goal of this study was to identify sensor s to monitor on-site wastewater treatment (OST) plants without sensor maintenance for at least one year. We performed experiments using a small scale SBR monitored by ORP with platinum electrode, optical DO, and ion-selective pH sensors. For each se nsor type, multiple sensors of the same design were used: one was maintained while the others were left unmaintained. This experimental design allowed us to study and understand the value of maintenance for three different types of sensors. The main findings are that  The automatic detection of the end of t he ammonium oxidation using a feature based on a pH signal, called the ammonium valley, is reliable with and without maintenance. No difference in the quality of the ammonium valley detection between maintained and unmaintained pH soft sensors could be observed, despite a significant signal drift in the unmaintained pH sensors. This finding clearly shows that pH sensors can be used to monitor wastewater treatment processes in SBRs with minimal maintenance.  The signals of the two unmaintained opt ical DO sensors both showed similar, nonlinear disturbances. These unexplained disturbances make automatic feature detection difficult. Additionally, the per turbations might mislead experts who are used to oxygen signals from maintained sensors, as these differ considerably. For these reasons, we would not recommend relying on unmaintained DO sensors in OSTs as long as the effects of the disturbances and the fault-inducing processes are poorly understood.  The nitrite ramp, also known as the nitrogen breakpoint, could not be observed in either the maintained or the unmaintained ORP sensor signals. This suggests that the nitrate ramp, which indicates the end of nitrite oxidation during the aeration phase, is not a sufficiently robust feature for OST plants. A better feature than the nitrite ramp would be needed to test the hypothesis that either the maintained or the unmaintained ORP sensors can be used to monitor OST plants. Therefore, further comparison of the maintained and unmaintained ORP sensor signals with different features would be interesting.  Successful application of the features presented in this study depends on the low-level process control of the SBR, particularly on the aeration. This shows that adapting the control, especially aeration, to the feature design is vital. In this article, we refute the widespread be lief that frequent sensor maintenance is always necessary. We show that robust soft sensor s can be designed to deliver key process indicators while enabling a drastic reduction in maintenance frequency. We expect these findings to have a broad impact, because they open the path towards autonomous and remote monitoring of OST plants. 18 Source Code and Data The sbrfeature module is implemented in Python 3.7 and is available for downloaded from https://gitlab.com/sbrml/sbrfeatures. The sc ripts to create the plots in this article are available on https://gitlab.com/sbrml/beyondsi gnalquality. We also provide the input data (Schneider et al., 2019). Acknowledgements Karin Rottermann and Sylvia Richter for careful sample analysis; Adriano Joss, Marco Kipf, Simon Dicht, Daniel Iten, and Stefan Vogel for technical support; Philipp Beutler, Lena Mutzner, and Christoph Ort for valuable input; and Simon Milligan for language editing. JPC acknowledges support from t he EmuMore discretionary funding scheme of the Swiss Federal Institute of Aquatic Science and Technology. Authors’ contributions MYS designed the experiment and led the projec t and the writing of the article. MYS & JPC wrote software and executed data analysis. VF supported the reference measurements. BS did most of the referenc e measurements, KV & JPC provided ideas and expertise. KV & MM supervised the work. All aut hors contributed to the writing of this document. 19 Appendix A. Perturbations of the lo w maintenance sensors: A.1. Reference measurem ents of the pH sensors pH, DO and ORP sensors each show a different pattern of aging. The pH sensor values drift, the DO drifts and is dampened and for the unmaintained ORP sensor we do not have enough data to clearly identify a drift, how ever even the sensor validation of the maintained sensor shows a high standard deviation. Figure A.2: Sensor drift based on referenc e measurement of the maintained and the unmaintained pH sensors with buffer solution at pH 4 between July 2017 and July 2018. Figure A.1: Sensor drift based on referenc e measurement of the maintained and the unmaintained pH sensors with buffer solution at pH 7 between July 2017 and July 2018. 20 A.2. Signal behaviour of the DO sensors over time Figure A.3: Behaviour of the unmaintained DO signals represented by four cycles during the experimental period, which showed non- linear deterioration effects. The cycle of 20.05.2017 is without automatic sensor cleaning installation. 21 Figure A.5: Reference measurements of unmaint ained DO sensors – in water saturated air without cleaning between July 2017 and July 201 8. The asterisk represents the target concentration for the present temperature and altitude. A.3. Reference measurements of the DO sensors Figure A.4: Reference measurements of main tained DO sensor – cleaned with soap, then measured in water saturated air, calibrated if necessary between July 2017 and July 2018. The cross represents the target conc entration for the present temperature and altitude. 22 A.4. Reference measurements of the ORP sensors Figure A.6: Reference measurements of the maintained ORP sensor – cleaned, calibrated, and validated regularly between July 2017 and July 2018. Sensor was exchanged due to a fault with unknown on-set at the dotted line. Figure A.7: Reference measurements of unmaintained ORP sensors – frequent measurements from July 2017 to July 2018. 23