**6. Conclusions**

A new alternative of control charts has been proposed when CTQ variables of the process are functional. The proposal includes alternatives to develop the the Phase I and II control charts for stabilizing and monitoring the processes, respectively. In order to develop Phase I control charts based on functional data, outlier detection methods are used based on a method of smooth bootstrap resampling and the depth calculation of functional data is proposed. However, in order to implement Phase II, the use of rank-type nonparametric control charts based on the concept of functional data depth is proposed. This Phase II control chart is directly estimated assuming that the asymptotic distribution of the rank statistic is a uniform distribution. The application of the control charts to the two-process control phases and the development of a new graphic tool for visualizing functional data (including an envelope with 95% of the deepest curves that facilitate the identification of the assignable cause of each anomaly) give rise to the proposed methodology. It has been successfully applied in real case studies belonging to the framework of anomaly detection in building energy efficiency. Additionally, a simulation study is conducted to measure the performance (as the percentage of rejection when the null hypothesis is not met) of the control charts, depending on the functional data depth used, the sample size, the presence of dependence between curves and the use of different FDA procedures for outlier detection.

In the simulation study, the use of different types of functional depths has been compared to develop Phase II of the proposed control chart. In case of the univariate functional data (single type of curves), for the three scenarios, a better performance is obtained with the mode depth measurement combined with the weighted outlier detection method and moderately large samples. Additionally, one of the final observations of the simulation study is that the control chart methodology is robust against the presence of dependence between curves. Thus, this alternative tool can be applied to the framework of continuously monitored data streams.

Generally, the authors recommend using the weighed method and the Mode functional data depth for the case of Phase I taking into account the values of *p*ˆ*f* and *p*<sup>ˆ</sup>*c*. Thus, when the Phase I control chart is evaluated, both weighted method and Mode data depth are generally the best options in those scenarios defined by under control assumption and even in those where out of control curves are simulated. In the latter, when the change in magnitude or shape is very small, the corresponding *p* ˆ *c* tends to be not higher to those obtained by the use of other combinations of data depth measure and outlier detection method. Nevertheless, when the change in magnitude (*δ*) or shape (*η*) increases, the power of the combination of weighted method and Mode depth tends to be higher than those corresponding to the other combinations. Moreover, regarding the Phase II control chart and taking into account the higher values of power estimates included in Tables **??** and **??**, we also recommend the use of Mode data depth for Phase II control charts.

The present proposal has been verified by its application in a real case study dealing with the detection of energy efficiency anomalies in buildings. Specifically, all the previously identified real anomalies (by the maintenance personnel) have also been successfully identified by the application of this functional approximation of control charts for Phases I and II of process control. Additionally, the proposed graphical tool helps to intuitively identify the assignable causes corresponding to each anomaly.

This procedure can be used in different industrial and scientific domains in which the control procedures are defined by functional CTQ variables.

**Author Contributions:** Conceptualization, S.N., M.F. and J.T.-S.; methodology, M.F., R.F.-C. and S.N.; software, M.F. and R.F.-C.; validation, M.F., R.F.-C. and J.T.-S.; formal analysis, M.F., R.F.-C., S.N. and J.T.-S.; investigation, M.F., R.F.-C., S.N., J.T.-S., S.Z. and P.R.; resources, S.N., S.Z. and P.R.; data curation, S.Z. and P.R.; writing—original draft preparation, M.F., J.T.-S., S.N. and R.F.-C.; writing—review and editing, J.T.-S., R.F.-C., M.F., S.N. and S.Z.; visualization, Miguel Flores, R.F.-C. and S.N.; supervision, S.N., J.T.-S. and R.F.-C.; project administration, S.N.; funding acquisition, S.Z. and S.N. All authors have read and agreed to the published version of the manuscript.

**Funding:** This study has been funded by the eCOAR project (PC18/03) of CITIC. The work of Salvador Naya, Javier Tarrío-Saavedra, Miguel Flores and Rubén Fernández-Casal has been supported by MINECO grants MTM2014-52876-R, MTM2017-82724-R, the Xunta de Galicia (Grupos de Referencia Competitiva ED431C-2016-015, and Centro Singular de Investigación de Galicia ED431G/01 2016-19), through the ERDF. The research of Miguel Flores has been partially supported by Grant PII-DM-002-2016 of Escuela Politécnica Nacional of Ecuador.

**Acknowledgments:** The authors strongly thank, on the one hand, Fridama, Σqus, and Nerxus companies, and on the other hand CITIC, Campus Industrial and MODES group their valuable help and support.

**Conflicts of Interest:** The authors declare no conflict of interest. The founding sponsors had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.
