On the issue of ensuring the stability and reliability of operation of continuous self-monitoring measuring systems for accounting pollutant emissions

. The main purpose of the article is to develop an algorithmic software solution for an automated measuring system for accounting for emissions, capable of determining the conditions for the stability of measurements of input data for estimating the contents of the components of the chemical composition of pollutants, and allowing to replace incorrect data from a faulty measuring instrument with data from logical (indirect) measurements based on indications of serviceable measuring instruments. The results of using a multidimensional process disorder detector and a stable value reconstructor on historical data of a petrochemical process plant are demonstrated.


Introduction
Operational statistical input control of data is an important stage of the technological process, which makes it possible to determine the stability conditions and limiting conditions for measuring input data.Processing of signals by intelligent statistical methods coming from measuring instruments, such as sensors, control and accounting devices, analyzers, etc., makes it possible to identify the stages of instability (metrological failure) in the operation of automated measuring systems (AMS), emergencies and malfunctions or its further unsuitability for operation, and the reconstruction (restoration) of signal values to transfer the system to its stable (robust) state.
At present, the task of verifying input data is relevant for automated measuring systems for recording emissions (AMS RE) of pollutants based on the functions of converting input parameters into its output signal.Automated measurement systems for accounting for emissions play an important role in industrial environmental control, measuring the quantitative content of the components of the gas mixture of emissions into the atmospheric air [1].Obviously, in order to meet the requirements for automatic control systems, the input process data must be as accurate as possible in order to obtain stable estimates of pollutant emissions.In addition, a number of data validation checks must be performed in near real time.
The purpose of this article is to present the concept of a software solution for building a reliable automated emission measurement system (R-AMS RE) with an anomaly detection and stable values reconstruction unit, consisting of a set of measurement instrument failure detection algorithms, a faulty measurement instrument values isolation unit and a neural network algorithm for restoring values, which will make the systems of automated measuring systems for accounting for emissions resistant to errors and malfunctions of measuring instruments.

Materials and methods
To the metrological support of an automated measuring system for accounting for emissions, as well as to any other automatic measuring instrument, there are requirements for measuring parameters by sensors and metering devices included in the calculation function, metrological and technical requirements for these measuring instruments [1][2].For different objects of negative impact, the quantitative assessment of the contents of the components of the chemical composition of pollutants can be characterized by a large number of control and monitoring parameters of the technological process, the quality of measurements of which, in some cases, may not meet the requirements of the technological regulation due to the occurrence of various kinds of malfunctions and failure of measuring instruments.In this regard, in order to ensure stable measurements, it is necessary to provide operational input control of the primary measurement information coming from the automated process control system with online identification of the so-called.anomalous values that have gone beyond the limiting conditions of measurements.
Raw, raw data is not suitable for the machine learning and deep learning algorithms used in the signal conversion functions of automated emission measurement systems, so pre-processing is a critical step in monitoring emission concentration values based on production data.If indirect function calculations are made on the basis of incorrect input data, then false information about the control object will be generated, which will lead to unreliable measurement values for emission indicators.
Typically, errors or malfunctions that occur in measuring instruments fall into two categories:  Momentary errors that occur occasionally or at irregular intervals. Permanent errors, which are caused by malfunctions of the measuring instrument and, most likely, will remain during further measurements.Instantaneous errors are not included in the discussion of this article, since they do not greatly affect the performance of an automated emission measurement system, since mass estimates for their transfer to the state register of objects are usually averaged over a 20minute period [3][4].In addition, instantaneous mass and gross outliers can be detected using classical statistical outlier detection methods, such as z-score or interquartile range (IQR) scoring.
An algorithmic software solution for determining the stability conditions and limiting conditions for measuring input data, and allowing you to replace incorrect data from a faulty measuring instrument with logical (indirect) measurement data based on the readings of serviceable measuring instruments, is based on three main ideas:  Detection, which consists in searching in the vector of the stationary time series for values that are out of range of the training dataset of the transformation function, that is, the points of the "good" value should be similar to the points in the training set, and have a smaller Euclidean distance to the center of the cluster, then as points of "bad" measurement -these are points that do not belong to any of the clusters.If these are "good" points, then they are directly transferred to the empirical signal conversion function for the automated emission measurement system.
 Identification and isolation, which consist in the fact that if the points are "bad", it is determined which input parameter / measuring instrument led to the anomaly, the failure status of the detected parameter / measuring instrument is assigned and its primary measuring information is isolated for the automated measuring accounting system emissions.
 Reconstruction (recovery), which consists in the fact that if the "bad" values from the faulty parameter/measuring instrument are isolated, the incorrect primary measurement information is replaced with logical (indirect) measurement data based on data from other other serviceable measuring instruments .These "reconstructed" value points are then passed to a signal conditioning function for an automated emissions measurement system.Further, the process continues.
In this work, the assumption was made that permanent failures of measuring instruments are so rare that the probability that a simultaneous metrological failure of two or more sensors or metering devices will occur is negligible.Therefore, the approach is based on the fact that the software solution will be able to detect, identify, isolate and reconstruct points of "bad" measurements by input parameters before another measuring instrument fails.The operator will then receive a recovery report indicating that the gauge has failed and will be prompted to replace the failed gauge as soon as possible at the next scheduled service.
The raw data coming from the measuring instrument may contain errors (large deviations from the average values, missing values, non-numerical or zero values, if these are unacceptable), be very noisy or not exist at all.In this regard, it makes sense to consider successive event detection algorithms that at each step (time count) make a decision about the presence of an event using the data obtained in the previous steps [5].
A multidimensional type of detector was used in the work.Multidimensional detectors process the signals of one group of sensors based on the assumption that the signals within the group are similar.It is supposed to define the following states of values:  Detection of the fall of the measured physical quantity to zero. Detection of a time-invariant (constant, constant) value or the fact of a value "freezing". Outlier detection (using thresholding based on previous readings or statistical methods to identify the current data point as an outlier relative to the data window under consideration).
 Detection of gaps in data.
 Detection of changes in data noise level. Detection of changes in statistical characteristics.When choosing a detector, consider the type of data being measured, the magnitude of the measurements, the group of sensors under consideration, and the size of the data window under consideration.
The optimal group of event detection algorithms are algorithms based on the calculation of cumulative sums.
In [6], it was shown that the influence of the measure of joint variability of two or more random variables or the covariance (autocorrelation) of the members of the time series cannot be neglected, since this leads to a significant underestimation of statistical estimates, and as a result, to an underestimation (decrease) of sensitivity to observability of the system in case of discord of random processes.
In the course of testing to detect process disorder events on multidimensional data, the method of constructing control charts based on the multidimensional cumulative sums (MCUSUM) algorithm showed the greatest efficiency.We considered, as a comparison, the method of multivariate control charts Hotelling T 2 (HT-s) and multivariate exponentially weighted moving average (MEWMA).In [7], a comparison of the advantages and disadvantages for various methods of control charts was made, where the highest estimates of the efficiency and performance of the MCUSUM algorithm were also obtained.
Event detection using the MCUSUM cumulative sum algorithm allows you to find even the smallest events.If necessary, the sensitivity of the algorithm can be increased by lowering the threshold for an acceptable change in the decision function.
The main idea of the reconstructor is to restore values based on several (redundant) measuring instruments and the relationships between them.The principle of operation of the data reconstructor is based on checking the consistency between the observed behavior of the dynamic process and the expected one, based on the mathematical representation of the process.A mathematical representation that contains the analytical redundancy of the system can be obtained from first-order differential equations, for example, the description of the law of conservation of mass and energy, physical and chemical transformations of substances, etc.However, in many situations, obtaining equations based on physics can be difficult due to the complexity of the dynamic process and its high dimensionality [8].
As an alternative to physical model methods for linear dynamic processes, statistical data dimensionality reduction methods based on the principal component (PCA) [9] are considered, and for nonlinear processes, autoencoders (AE) [10].
An autoencoder (autoencoder) is a special architecture of artificial neural networks that allows you to apply unsupervised learning when using the backpropagation method.A number of hidden sequential layers in the autoencoder are built on the basis of a recurrent network with a long short-term memory (LSTM), which is widely used for time series analysis [11].The efficiency of LSTM networks to extract hidden patterns in large datasets is much superior to classical statistical linear methods, which allows you to get better predictive models for time series.
The autoencoder architecture can consist of a different number of hidden layers and different types of neural network architectures and depends on the task, the internal data structure and the predictive accuracy of the model.The standard architecture usually includes 2 hidden layers for the encoder (encoder) and the same number of layers for the decoder (decoder).The output of the autoencoder is organized by a wrapper layer with the same number of outputs as the input to return the sequence at each time.

Results
Next, we present the empirical results of the operation of the algorithms of the multidimensional detector and the values reconstructor for the classical structure of the automated measuring system for accounting for emissions.For modeling, a set of time series was used for the main parameters of the elemental sulfur production unit (Claus process) for the last 15 months of continuous operation with a polling frequency of 1 min.The data set includes 128 process parameters, of which 117 are analog control and monitoring parameters of the process, 11 are discrete parameters that determine the key operating modes of the process unit.From these parameters (also known as tags, labels in the language of industrial automation), 11 key parameters were selected for testing the algorithms, including those used in the transformation function to estimate the mass concentrations of sulfur dioxide (SO 2 ) in the gaseous flue mixture.The sample size was 65821 time-ordered observation points for one parameter.
The process plant is designed to produce elemental (gas) sulfur from acid process gas (mainly in the form of hydrogen sulfide H 2 S) released during the desulfurization of natural gas from a gas condensate field.Modern sulfur production processes include a thermal stage, in which part of the hydrogen sulfide is oxidized by atmospheric oxygen to sulfur dioxide, and a catalytic stage, in which the reaction between hydrogen sulfide and sulfur dioxide is carried out in the presence of an alumina catalyst to obtain elemental sulfur [12].
In modeling, the main emphasis was placed on the detection of persistent errors, which are characterized by the continuity of occurrence, in accordance with the observed pattern, which is studied by the algorithms over time.
Synthetic areas of anomaly were generated in the data set, simulating the freezing, "freezing" of values in each of the 11 parameters/measurements.From the initial set of the test sample, 11 independent test sets were created, for which the value of one of the parameters/measurements was fixed and did not change over time in the period from 17:00 on February 16 to 17:00 on February 17, that is, for a period of 24 hours (there were tests were carried out for various time intervals with "frozen" values, but for brevity of the material they are not given in this paper).
On Figure 1a shows the trend of the true signal and the initial (measured) values for one of the key input technological parameters -the flow of fuel gas into the furnace of the process unit.The simulated "freeze" values were set at 3329 m 3 /h (shown as red lines on the graph).According to the technological regulations, the range of variation of the parameter values during trouble-free operation of the plant can be 2000-5600 m 3 /h.
To carry out the detection of generated anomalies based on the MCUSUM method, a sliding time window, taking into account the dynamics of the process (the time constant of the technological parameter) and the frequency of oscillations during the nonstationarity of the process, was chosen fixed with a width of 1200 points or 20 min.
The resulting MCUSUM statistics evaluation results and the upper control limit level (UCL) with a value of 112.74 units.shown in Figure 1b.The method showed good efficiency in detecting faults for all measuring instruments included in the signal conversion function.In fact, the MCUSUM statistics starts to increase at the point of failure or at the beginning of the synthetic region of the anomaly (i.e. when the parameter values "freeze" at the level of 3329 m 3 /h) and immediately exceed the upper threshold of UCL.In the class of searching for stable data anomalies in time series, it was experimentally established that among all possible anomalies, "freezing" of a measuring instrument (sensor and meter) is the most difficult to detect using a general-purpose fault detector [9].Obviously, such an error can be detected using a special derivative or variance test for a one-dimensional array.However, such a solution will not detect other types of persistent errors such as offset and drift in multidimensional data.The performance results of MCUSUM in estimating drift and bias in data are not considered in this paper due to space limitations and will be investigated in future papers.
Next, the results of restoring anomalous values and their replacement with stable values will be analyzed and qualitatively evaluated in the event of a malfunction of the measuring instrument, that is, when the values of the parameter for the fuel gas flow into the furnace freeze for a period of 24 hours.
The AE autoencoder test dataset was divided into a training set, a network hyperparameter validation set, and a test set.In view of the fact that it was necessary to preserve the sequence (internal structure) of time series objects, and splitting objects randomly and randomly would not be acceptable, therefore, the continuous crosspartitioning method was used.As a result, the data set was divided into 4 independent pairs of training and test samples (blocks) in a ratio of 70:30.The validation set was taken from the training set in a ratio of 85:15.
The architecture of the autoencoder for encoding a sequence coming from 11 inputs consists of two layers of LSTM cells that translate the series into a vector containing information about the entire sequence.Hidden LSTM layer 1 consists of 16 neurons with relu activation function, LSTM layer 2 consists of 4 neurons.The Repeat Vector layer is used to transform the vector of input 2D data from the encoder into the dimension of the tensor (batch size, sequence length, input size), and transfer this sequence to the input LSTM layer 1 of the decoder.The set of hidden layers and the number of neurons in the decoder is the same as in the encoder.The output of the autoencoder is organized by a Time Distributed wrapper layer with 11 outputs to return a sequence at each point in time.For this AE architecture, the total number of tunable hyperparameters (weights and biases) was chosen to be small, on the order of 3800, mainly to increase the network learning rate and reduce the processing power of the processor.
The AE model was trained on 25 epochs, with a sample consisting of separate 10 batches.Adam was chosen as the optimizer.Convergence is built on the quality metric -MAE.The value of the training error was 0.048 ab.u., and the validation error was 0.051 ab.u.
The results of restoring the values by the AE model on the test data for the current area of the synthetic anomaly are shown in Figure 2a.The average estimates of accuracy with and without restoration of values relative to true (measured) values, during a 24-hour malfunction of the measuring instrument, are presented in Table .1.According to the obtained results, it can be concluded that, despite the different variance of the reconstructed signal, the average errors (RSME and MAE) compared to the signal without restoration of values are 3-4 times less relative to the true (measured) signal.In this case, the magnitude of these errors is about 1.5-2% of the average value of the technological parameter for the synthetic region of the anomaly.The test statistics to the ratio of the sample variances of the true signal and the signal during restoration is less than the critical one for a significance level of 5%, and confirms that the null hypothesis is accepted and the variances of random variables are recognized as the same.Up to this point, the authors have evaluated the effectiveness of the MCUSUM and AE algorithms, which have shown their high performance and accuracy.Let us now show an assessment of the system performance of a reliable automated emission measurement system as a whole, that is, we will determine how much the predictive ability of a classical automated emission measurement system will deteriorate compared to a reliable automated emission measurement system.The assessment was made in the event of a malfunction (failure) of one of the input parameter/measuring tool included in the signal conversion function when estimating the mass concentrations of sulfur dioxide (SO 2 ).For clarity of results, we will use the same anomaly region with synthetically generated "frozen" values of the parameter for fuel gas consumption in the afterburner.
The original classical performance of the automated emission measurement system without failures, as well as the performance of the classical automated emission measurement system and the reliable automated emission measurement system with parameter/measurement "freezing" values, at the time of the N-series number equal to 1-1300, are shown in Figure 2b, on which the average relative error of the system was calculated.
From Figure 2b, it can be seen that before the failure occurs, the classic AMS RE and R-AMS RE work in the same way.After some time, faulty values from the measuring instrument are identified, isolated and eliminated in accordance with algorithmic decision procedures.At this moment, the "frozen" values from the measuring instrument enter the classic automated emission measurement system, and the reconstructed values enter the reliable automated emission measurement system.After a measuring instrument failure that occurs in an N-series number of 1350 and later, the classic AMS RE immediately degrades its performance compared to the fail-safe case, exceeding the 35% margin of error by more than 40%.At the same time, as can be seen from the graphs, a reliable automated measuring system for accounting for emissions at the beginning also has a slight deterioration in accuracy compared to the case of the "no failure" system operation, but it does not go beyond the permissible level of error.
After a transitional period, a reliable automated emission metering system improves its accuracy characteristics to an error level of 10-15%, while a classic automated emission metering system still operates with an error level exceeding 35%.A significant error of the classical automated measuring system for accounting for emissions (more than 100%) is observed for N-series numbers from 2600 to 3000, corresponding to the period from 12:00 to 17:00 on February 17 or 5 hours before the restoration of the faulty measuring instrument.
It has been shown that the classical automated emission metering system is very sensitive to malfunctions and failures of measuring instruments, in the sense that a small error in the sensor or meter is reflected in a large error (error) in estimating emission targets.Such an error can systematically exceed the allowable limit of 35% established in the requirements for automatic emission control systems [1,3].

Conclusion
The article proposed a concept for the development of an algorithmic solution for building a reliable automated measuring system for accounting for emissions, which will allow the system to be transferred to the category of stable measuring systems in the event of a metrological failure of measuring instruments.A method was proposed for determining the limiting conditions of measurements and recovering input data values, based on the use of a multivariate process disorder detector MCUSUM and a stable value reconstructor on the AE autoencoder.Preliminary simulation tests on historical plant data have shown how and to what extent a reliable automated emissions measurement system, unlike a classical system, can increase its stability and continue to meet regulatory requirements in the event of a single measurement instrument failure.The developed algorithmic solution can also be used for other automated measuring systems, the principle of which is based on indirect measurement methods, as a tool for making management decisions based on data.

Fig. 1 .
Fig. 1.True (measured) and synthetically generated values for fuel gas consumption (a); detection and detection by the multivariate MCUSUM model of process disorder in a fixed data window (b).

Fig. 2 .
Fig. 2. Restoration of the simulated values of the signal of the technological parameter during the period of the process change (a); average errors of the automated measuring system for accounting for emissions for the case "without failure", when restoring values and with "frozen" values of the input parameter (b).

Table 1 .
Results of average statistical characteristics for parameter values relative to true (measured) values.