**1. Introduction**

Generally, univariate and multivariate control charts are applied to identify anomalies in the industry and control the quality of products and services. However, the specific characteristics of data obtained by continuous monitoring (which has become the main trend due to advancements in sensoring and communications in the framework of Industry 4.0), require the use of increasingly sophisticated tools that take into account the presence of autocorrelation in critical to quality (CTQ) variables for the process under study.

Recently, diverse solutions have been provided that propose the modification and application of exponentially weighted moving average chart (EWMA) control charts [**?** ]; control charts based on the fitting of autoregressive integrated moving average (ARIMA) models [**?** ]; and the use of control charts for profiles, which is understood as the control of the parameters that define the relationship between two different CTQ variables [**????** ]. Additionally, there are solutions that propose the use of techniques based on the control chart concept for anomaly detection such as machine learning techniques (neural networks and support vector machines, among others) and time series [**??????? ?** ]. The increasingly common use of these tools is attributed to the fact that they adapt very well to the new paradigm of data (in the framework of Industry 4.0) defined by the continuous monitoring of numerous variables. Traditional control charts cannot be applied to many of the new cases due to their non-compliance with their starting hypotheses. In the domain of statistical quality control, the use of the concept of latent variables along with multivariate control charts is one of the most popular and useful alternatives to solve the problem of process control in the Industry 4.0. domain [**???** ].

Many of these new data, usually curves, can be studied as functional data. This is the case of data in the fields of energy consumption, indoor and machine temperatures, relative humidity, amount of CO2, among other variables, measured in all types of buildings. These new data, which currently characterize industrial processes, require innovative solutions, developed by researchers in the field of statistical quality control, based on the application of functional data analysis (FDA) techniques. Until now, few works have been published (in relation to the importance of the topic and the frequent monitoring of this type of data) on controlling the quality of processes when the data to be monitored are functional CTQ variables. Among the most outstanding research in this context, Reference [**?** ] compared the performances of different control charts used for monitoring functional data; these charts are often identified as profiles in the statistical quality control literature. According to References [**? ?** ], in the case of the monitoring of profiles, a set of statistical techniques (usually multivariate) is applied for controlling processes when they are defined by the functional relationship between two variables. However, a control chart for monitoring functional data, which is based on bootstrap resampling, is also proposed in Reference [**?** ], whereas, in References [**? ?** ], two complete monographs are proposed in which the concepts of control charts for profiles are adapted to the context of the functional data. Moreover, recently, new alternatives for outlier detection based on interlaboratory studies and those with application in industrial anomaly detection have been performed in the FDA framework [**???** ].

This study intends to provide an alternative solution to the detection of out-of-control anomalies or states in the area of energy efficiency in buildings, specifically in commercial areas such as different stores of textile companies. Therefore, an important aim of this work is to solve the problem of such companies, specifically the ones providing lighting facilities; office automation; and heating, ventilation and air conditioning (HVAC). One such company is Fridama SL. The group comprises Fridama's facilities, Σqus (web platforms for big data management) and Nerxus (statistical consultancy for data analysis in the energy sector); the solution to the problem raised by this company is defined by continuously monitored data over time that can be treated as profiles or functional data. Based on this need, the present study proposes methodologies to build control charts that allow us to control the aforementioned processes. in order to test the applied statistical methodologies for anomaly detection properly, these companies have provided a database on a real HVAC installation, whose anomalies and assignable causes are identified by its maintenance personnel.

These energy efficiency data are non-Gaussian and autocorrelated, as the main component of continuously monitored data in the Industry 4.0 framework. Thus, the present proposal provides alternative control charts for Phases I and II of the statistical process control that can deal with non-Gaussian and autocorrelated data. As is well-known, using control charts, the process can be controlled in the following two phases: Phase I involves the stabilization or the calibration of the process and Phase II focuses on process monitoring. For Phase I, a control chart is proposed based on the depth measurement of a functional datum and the idea of atypical detection; in Phase II, a nonparametric range control chart is proposed, based on the calculation of the functional data depth, to monitor the process of interest. The procedure of building control charts corresponding to Phases I and II are explained in the next section; it also shows the results of their performance through a simulation study including diverse scenarios. The proposed methodology has been developed and programmed in R through different functions integrated in the "Quality Control Review" package, qcr, which can be freely and easily accessed by the practitioners.

Additionally, it provides a way to visualize the control charts for functional data, including the original data and the curves corresponding to the estimated control limits. This visual tool allows users and maintenance managers to relate each anomaly to an intuitively assignable cause. The results of the simulation study and its application to the real data show the usefulness of this control chart methodology in detecting anomalies when the process is defined by functional data, specifically the daily curves of energy consumption in commercial areas.

### *1.1. Alternatives of the Statistical Quality Control When the Basic Assumptions of the Control Charts Are Not Met*

This control chart approximation for functional data is based on nonparametric multivariate control charts, which are useful when the assumptions of Gaussianity are not met. Therefore, a brief introduction of nonparametric control charts and statistical tools for dealing with autocorrelated data are presented in the following section.

Recently, analyses of the robustness of different control charts against the non-compliance of Gaussianity hypothesis have been developed. Particularly, several nonparametric control charts have been proposed. In this domain, we should highlight the works of Regina Liu [**???** ], who has developed the *r*, *Q* and *S* control charts based on the data depth and rank concepts and the rank or ranges. In this regard, it is important to highlight the strong influence of Liu's works; it must be noted that several nonparametric alternatives for control charts are based on the concepts of data depth and rank. Moreover, it should be emphasized that one of the most important lines of research of the SQC, the profiles' control charts, are based, in many cases, on the application of nonparametric or semiparametric regression models [**? ?** ]. Additionally, it is also important to highlight the use of resampling techniques for calculating natural control limits for different types of control charts [**? ?** ]. The work in Reference [**?** ] constitutes a complete monograph on the current trends for the development of control charts.

Despite their important advantages (no assumptions on the probability distribution of CTQ variables), nonparametric control charts are not predominantly used in the industrial and business framework. As noted in Reference [**?** ], this can be attributed to several factors such as the lack of specific software, both commercial and free; the lack of general training in nonparametric statistics that generates insecurity and distrust in users and the lack of contrasted reference texts for the application of nonparametric methods in SQC. However, the research activity in this field is growing, as illustrated by the work in Reference [**?** ].

Another starting hypothesis of control charts is the independence of the observations. The data continuously monitored over time by different sensors usually show a variable level of autocorrelation (the greater the correlation the closer the observations are in time). The application of standard techniques in the case of the violation of the independence hypothesis often results in the detection of an unacceptable number of false alarms [**?** ]. Therefore, the development and analysis of techniques that remove the sample autocorrelation is fully justified. Within these techniques, the most widespread is the application of time series models (e.g., autoregressive moving average (ARMA) and ARIMA) to remove the correlation between observations and the subsequent monitoring of the error variable (difference between actual values and those estimated by the model) using control charts [**???** ]. Moreover, References [**? ?** ] propose the combination of control charts with adjustment algorithms. Finally, the monographs of [**? ?** ] describe the most relevant lines of research for controlling and monitoring autocorrelated data.

It is important to note that this type of data is related to the control charts for functional data. The use of FDA techniques allows us to consider the autocorrelation of the data as well as, by means of resampling techniques, to circumvent parametric assumptions about the trend and dependence.

### *1.2. Control Charts for Phases I and II*

The studied process is stabilized in the framework of the Phase I control charts, that is, the process is left under control [**?** ]. This implies that there are no other assignable causes in the process, except for those present due to randomness itself (non assignable causes). This is equivalent to stating that the process remains stable—the parameters of the probability distribution of the CTQ characteristic remain unchanged. This allows us to estimate the natural control limits for the variable that describes the quality of the process. The natural control limits are estimated using a preliminary or calibration sample. Thus, in this stage, the main assignable causes of variation are identified and rectified through corrective actions. After the variations are removed, we estimate the natural control limits of the CTQ variable corresponding to the process under control. While most of the literature in the field has referred to Phase II control charts, within the new data paradigm for Industry 4.0, it would be essential to develop methodologies for Phase I [**?** ]. In this regard, Reference [**?** ] presents an overview of the recent contributions to the development of Phase I control charts. Among the latest proposals for control charts, the work of Grasso et al. [**?** ] is especially interesting taking into account that is a Phase I control chart proposal for profiles based on the use of functional data depth concept (as well as the case of the present proposal). In fact, they proposed a Phase I control chart methodology for profiles belonging to the "multi-modelling framework", that includes the following stages: (1) a classification stage of new profiles into different operating modes or profile patterns using functional classification techniques from functional data depth measures (maximum depth approach based on Mode depth); (2) even the identification of a novel operation mode is included; (3) Once the operation mode corresponding to a new profile is identified, this is assigned to the corresponding control chart and consequently a suitable control charting method is applied to determine if the process remained in control over the period of time where those data were collected.

In this study, the atypical detection procedure presented in Reference [**?** ] is adapted to develop a control chart for Phase I; this approach allows us to obtain a calibration sample from an under-control process that can be monitored through new measurements using a Phase II rank control chart. In fact, in Phase II, it is assumed that the process is under control [**?** ]; additionally, in each new sample (monitored sample), the statistical rank is obtained and it is represented in the control chart with the estimated lower control limit.
