## 3 Results and Discussion
### Evaluation of PLS Calibration Models  
The models developed for each parameter were evaluated mostly based on the RMSECV and R\({}^{2}\)CV, while still considering the calibration parameters, i.e., the root mean square error of calibration (RMSEC) and the coefficient of determination of calibration (R\({}^{2}\)Cal). Table 1 presents the optimized pre-processing strategy, the spectral region and number of LVs used in the final PLS models selected for each studied parameter, along with the respective calibration and cross-validation statistical results. According to the pre-processing information presented in Table 1, the optimized pre-processed Raman spectra of the calibration samples used for the development of each PLS model are represented in Figures S2-S12 in Supplementary Materials. These calibration models are graphically represented in Figure 2, which depicts the regression line that correlates the analytically measured values of each calibration sample with the corresponding values predicted by the calibration model. Overall, it was possible to establish a good relation between the Raman spectral data and the concentration of all the studied parameters. This was denoted by the very high R\({}^{2}\)Cal (>99.3%) and prediction deviation of calibration (RPD\({}_{\text{Cal}}\) > 11.6), and by the relatively low RMSEC values registered for almost all parameters (Table 1), except for NH3, which presented slightly less favorable calibration results (R\({}^{2}\)Cal = 96.2%; RPD\({}_{\text{Cal}}\) = 5.2). These statistical results reflect the data represented in Figure 2, where the calibration points fit the regression line for each parameter very well, with more scattered data points around the regression line being exceptionally observed in the NH3 model. Regarding the prediction performance of these calibration models, the excellent statistical results (R\({}^{2}\)CV > 90.0%; RPD\({}_{\text{CV}}\) > 3.2) obtained for TOC, VFAs, CO2, NO3, Total P, PHAs, TSSs and VSSs (Table 1) indicate that these parameters can be quantified with good quality through the respective Raman-based PLS models. On the other hand, the models developed for the prediction of PO4, NH3 and carbohydrates did not perform as well, according to their lower cross-validation quality parameters, i.e., R\({}^{2}\) < 90% and RPD\({}_{\text{CV}}\) < 3.0. Overall, the RMSECV values are higher than the corresponding RMSEC, but the determined bias values were close to zero for all parameters, except for PO4 (Bias = 0.364; Table 1). The cross-validation outcome, which represents the performance of each PLS model to predict the concentrations of the respective parameter, is graphically illustrated in Figure 3, where the reference analytical values measured for each sample are plotted together with the corresponding values predicted by a full cross-validation (leave-one-out) procedure. In addition, Figure 3 allows to observe each parameter's profile and the trend of predicted values along the SBR cycles. Overall, the analytical data for each parameter (Figure 3) followed the expected profile along the photo-BNR reactor cycles [14], i.e., the decrease in VFA and carbohydrates concentration values, in parallel with the increase in PHAs and PO4 concentrations along the anaerobic phase; followed by the decrease in NH3, PO4 and PHAs concentrations, along with the increase in NO3 concentration (nitrification) and poly-P and glycogen contents in the subsequent aerobic phase. The parameter predictions based on the Raman spectra in Figures 2 and 3 correspond to single measurements and there is only one parameter prediction for each spectrum. Repetitions of spectra acquisition were not performed since the biological reactions continued to occur in each sample after collection from the bioreactor. Thus, variations were expected to occur between those repetitions over a short period of time. However, the continuous monitoring during a long period allows the generation of continuous data and reveals the reproducibility of the monitored system.