New Technology and Method for Monitoring the Status of Power Systems to Improve Power Quality—A Case Study

The identification and analysis of harmonics, frequency, and transient events are essential today. It is necessary to have available data relating to harmonics, frequency, and transient events to understand power systems and their proper control and analysis. Power quality monitoring is the first step in identifying power quality disturbances and reducing them and, as a result, improving the performance of the power system. In this paper, while presenting different methods for measuring these quantities, we have made some corrections to them. These reforms have been obtained through the analysis of power network signals. Finally, we introduce a new monitoring system capable of measuring harmonics, frequency, and transient events in the network. In addition, these values are provided for online and offline calculations of harmonics, frequency, and transient events. In this paper, two new and practical methods of the “algebraic method” are used to calculate network harmonics and wavelet transform to calculate transient modes in the network. Furthermore, the proposed monitoring system is able to reduce the amount of data-storage memory. The results of the simulations performed in this article show the superiority of using the new method presented for online and offline monitoring of power quality in electric power systems.


Introduction
The complexity of power grids has increased rapidly in recent decades. To know the different conditions governing the power grid, we must have the ability to measure its electrical quantities [1]. For this purpose, many measurement methods have been provided. The important point, in this case, is to provide the possibility of fast and online analysis of network quantities and harmonics in the power grid [2]. Accurately determining the frequency of the power grid today has become more difficult because of the presence of harmonics and other noises. Because it is difficult to maintain the dynamic balance of power systems in the current conditions that are expanding day by day, the frequency fluctuates around the nominal frequency. In addition, these frequency fluctuations are closely related to the dynamic states of the power grid. Therefore, real-time monitoring and measurement of the power grid frequency is also very important. This importance increases especially with the addition of harmonics to the power grid [3,4]. One of the main issues for industrial factories is how to deal with power grid disturbances. Power quality problems determine the degree of sensitivity of measurement equipment and provide valuable results.. This importance is due to the fact that some disturbances (such as a voltage drop of more than 30% in a short period of time) cause an interruption in the operation of controllers and relays, which makes the importance of qualitative analysis of power systems clearer [5]. In order to improve power quality, sources of error and disturbance should be identified and controlled. This action can be completed by sequentially performing error detection, recording the location and time of error occurrence, and classifying the errors. For this purpose, it is necessary to place suitable sensors on the network lines and identify the data received from them using suitable tools in real time [6]. In order to achieve this purpose, a powerful mathematical analysis tool is needed to simultaneously provide different analyses of the quality issues of the power system both in the time domain and in the frequency domain.
Among the factors that increase the importance of studying harmonics in the power network are the following: increasing the application of power electronics devices that have voltage and currents with non-linear characteristics and cause harmonics in the power network; increasing the shunt capacitor banks to correct the power factor and regulate the voltage range also increases the level of harmonics; and reducing the equipment design margin, which means that the equipment becomes more sensitive to voltage and current harmonics, harmonics have adverse effects on power network equipment and loads.
Harmonic disturbances usually appear in frequencies other than the main frequency of the network (but not always), and they often result from the non-linear operation of the mentioned factors in a permanent state and cause the collapse of the network. Here, the collapse of the network means the creation of unacceptable conditions for its network voltages and currents [7]. This definition is able to include all the errors and wrong operations and unwanted torques created in the shaft of electric machines. Except in very exceptional cases, common measuring devices and methods are not able to detect the number of harmonics or their different effects on the power system [8].
In this research, after reviewing the previous articles in this field, we present the statement of the proposed strategy. This paper, considering the problems of power quality monitoring, especially in the online field, presents a new plan to solve these problems using the new algebraic method and wavelet transform.
Two methods are provided to identify transient states: One is performed using the derivative of the signal, and the other is conducted with the help of a new signalprocessing technique called wavelet transform (which has been "used recently"). Finally, a monitoring system is proposed that is capable of identifying harmonics, frequency, and transient modes for real-time and offline analysis.
In order to be able to analyze the signal information offline, it is necessary to provide the possibility of storing this information in the memory. In this case, it is necessary to compress this information before saving. Some methods for compressing transients and steady states are mentioned. By applying these methods, information is compressed more than 40 times. In this system, with the new compression technique, the amount of memory needed to store the monitored data (for offline analysis) has been greatly reduced.

Background
In [9], the authors presented the frequency by calculating the phase voltage in quasi-steady and rotating frames with the DFT technique and regression relations. Because of the use of the DFT technique, this algorithm is inherently insensitive to network harmonics but is vulnerable to noise. Moreover, in this method, a wide measurement window is needed when measuring small frequency changes.
In [10], they used the Kalman filter to measure the frequency, and the method they used was able to remove the noise well, but it could not adequately consider the performance of harmonics.
In [11], the authors calculated the power grid frequency using the least-squares technique. However, their method was sensitive to both noise and network harmonics.
In [12], the frequency was measured using DSP and quadratic sampling data. In this paper, the authors removed the harmonics and the DC component of the grid voltage using a median filter.
In [13], the author defined the instantaneous frequency as the angular velocity of the spatial phasor of the voltage. He obtained good results, but the technique he used was very complicated.
In [14], the description of power quality monitoring (PQM) and the examination of the four main methods of PQM placement, which include monitor access area, coverage and packaging, graph theory, and multivariate regression, were discussed. In addition, the concepts, advantages, and disadvantages of each method were discussed.
Various methods have been presented in this field, including discrete Fourier transform (DFT) and fast Fourier transform (FFT). One of the main reasons for paying special a ention to the FFT technique is its lesser need for computing devices. This feature is obtained by removing the additional coefficients of the differential equation of the signal under analysis. However, there are limitations in this method. One of is causing disruptions in the proper selection of data windows. One of these limitations is leakage. Leakage occurs when the data window used for the technique FFT does not contain a precise interval of integers of frequency cycles. Because this method depends on the information windows of the signal under monitoring, due to the inevitable changes in the signal frequency, the problem of leakage will therefore always exist in this method [15].
In addition, the FFT technique has inherent limitations in terms of resolution. Today, improvements have been made to the FFT technique that have improved the mentioned issues to a great extent. Among them, it is possible to mention the selection of information windows based on the detection of crossing the zero level of the signal. Although the use of zero-level detection methods is simple and completely reliable (even for low-level noise pollution conditions), if the range of high-order harmonics of the signal is significant, the accuracy of this method is significantly reduced. Another way to evaluate the monitored signal is to use Taylor series techniques. This method also suffers from the same limitations that existed in detecting the crossing of the zero level [16,17].
There are also some methods that use the FFT technique as a starting point to estimate the phase of the main harmonic, and then the frequency of the main harmonic is calculated based on the change in phase angle shifting. This method is successful only when the changes in the main frequency are insignificant. Otherwise, as mentioned earlier, the leakage problem causes a gross error in the initial values of the central harmonic phase obtained from the technique FFT. These methods have also been improved by the least squares algorithm or using the Kalman filter. In most common methods, the main harmonic is the primary basis. Therefore, if there are many other harmonics in the signal under analysis, these harmonics can affect the results of these methods [18].
The latest method of monitoring electrical quantities uses non-linear methods to follow the signal under monitoring. Using the Newton iteration method and combining it with the least square method is one of these non-linear methods. Nevertheless, this method is computationally intensive, and therefore, several processors must be used in parallel to perform real-time analysis. Artificial neural networks can be used to increase the speed of calculations. It should be remembered that the use of neural networks in monitoring harmonics is not a new concept. This method can provide accurate results of the conditions of network quantities, even if complete information about these quantities is not available [19].
But the new method presented in this article is the algebraic method which will be explained below. While this method is straightforward, it also solves many of the disadvantages of the standard DFT method. Also, in this article, the DFT method and the algebraic method mentioned, have been turned into reversible methods. Hence, their calculation speed is equal to the speed of the minimum gradient method solved with the help of Hopfield neural network.
To analyze transient states, Riberio was one of the first to use WT. He realized that the WT is easily able to separate the transient states and the primary states of the power network signals from each other, with the most minor parameters and the most accuracy, and he identifies them [20]. Later, people like Galli, Heydt, etc., used different types of WT for different cases of power network analysis. Even today, there are many articles about the different use cases of WT in the power network.

The Weaknesses of Previous Research and the Importance and Necessity of Research
In this section, the weaknesses of the proposed methods in previous many articles are explained. Classical artificial intelligence in previous articles in this field does not give importance to the aspects of system development (how knowledge structures are created and their changes over time). Through monitoring power quality disturbances, it is possible to examine the details of the disturbances and determine solutions to overcome the system's power quality problems. The main part of power quality monitoring, which is very important and effective, is the identification and classification of power disturbance signals and requires signal processing techniques and machine learning tools (intelligent tools) [21,22]. Today, many studies have been published to classify power quality disorders. Each article has achieved different accuracies by using a particular diagnosis structure. The reality is that each diagnosis structure may have the desired answer for specific conditions and data. Therefore, comprehensive and efficient monitoring needs an automatic and intelligent framework to make the best decision among the candidate structures when necessary, according to the set goal [23]. The main problem in this field is the lack of comprehensiveness of the diagnosis system and not making a proper and timely decision in determining the structure of the optimal diagnosis. In the systems presented in the reference articles, the need for adaptability and flexibility to changing environmental conditions and changing the characteristics of the data in the database has not been considered. In many previous studies, there is no feature selection section (data mining) to improve the operation of the detection system. The performance of classification tools depends on several internal parameters, which have been set by trial and error in many previous articles. In many practical applications in this field, the accuracy and efficiency of existing methods are not suitable against different noise conditions and should be improved. In some articles, a empts have been made to improve the performance of these systems by using noise removal methods and adding new steps in the structure of the noise detection system, but these methods have not been well received due to their complexity and large number of calculations. And this research has led to new and advanced signal processing algorithms that are inherently robust to noise. In general, it can be said that in many previous studies, only the performance of an offline monitoring system has been investigated [24,25].

Frequency Monitoring Methods
In this section, several methods for measuring frequency are presented.

The Modified Technique of Crossing the Zero Level
The sampled voltage waveform can be formulated as follows [26,27]: The data window   V k for M consecutive sample is defined as follows: The time to open the informational window is optional. The polynomial of degree Lth of   p t l is assumed as follows [28]: If each of the mentioned sentences is equal to the voltage at the moment t, and it can be wri en as: or as: In this way, the voltage waveform can be calculated as a polynomial of degree l, in terms of the time variable and in the distance k to k + M. This means that: Usually, "l" is considered to be at most 3. In this case, for each M + 1 sample, V(t) is approximated by a new third-order function. The moment of crossing the zero level is between two sequences in which the sign changes. If these sequences are denoted by m and m + 1, then the relation (6) can be wri en as follows: Now, if V(t) = 0 is solved for Equation (7), the time the curve crosses the zero level is calculated. In the same way, we calculate all the points crossing the zero level of the signal and call them in L , , t t j j 2 1 in order, as in Figure 1: Therefore, the period of the sampled signal in the Jth cycle is: Also, the frequency of this signal in the Jth cycle is calculated from the following equation: As seen in the above figure, it can be proved that the calculated frequency for almost "periodic" signals depends on the value of the DC level. Furthermore, if the waveform of the signal has a significant difference from one period to another, before calculating the crossing point of the zero level, the value of the DC level calculated in the previous period should be subtracted from the relation of the primary wave, and then the crossing point of the level zero measured the resulting signal, which is free of DC component.

DFT Method with Polynomial Approximation
The sampled voltage waveform can be formulated as follows [29]: The data window   V k for M consecutive sample is defined as follows: The real and imaginary parts of the voltage phasor from the discrete Fourier transform relation are as follows: The mentioned method can be considered as a harmonic filter. If the phasor voltages of all three phases are available, the positive sequence phasor can be calculated from them follows: To calculate,    k , we consider it as the argument of   V k 1 and consider a sliding data window as follows: Now, inside this window, the positive sequence phasor argument function of the voltage is approximated by a polynomial of the Lth degree.
In this way, the instantaneous frequency of the voltage, which is the instantaneous derivative of its argument, can be calculated: The discrete form of the relation (16) can also be wri en as follows: The frequency at the end of each data window should be calculated consecutively.
It can be seen that the realization of the mentioned method in real time is straightforward. In this method, the DFT technique protects against harmonics, and the least square technique protects the system against noise. Therefore, noise and harmonics cannot have a great effect on the calculated frequency value. Nevertheless, it has a complex calculation method.

Power System Monitoring
In this section, a new method for online and offline monitoring is presented using the mentioned methods for identifying transient states and harmonics. The basis of work in the aforementioned monitoring above system is as follows: First, the signal is passed through a low-pass filter with a cut-off frequency of 10 kHz to solve the aliasing problem. Then, it is sampled with a sampling frequency of 24 kHz (ensuring compliance with Nyquist's theorem). Later, a wavelet stage is taken from the resulting discrete signal. The harmonics of the power network (in steady state) are always limited to less than the 20th order, and therefore, only samples of the signal are used to calculate the harmonics, and the distance between them is equal to 0.02/41 s [30]. In this system, the harmonics and the primary harmonic frequency are calculated in real time via the reversible algebraic method. Also, to identify transient states, two methods are presented here. Depending on the accuracy and sensitivity of the system, any of them can be used. For offline analysis, the monitoring system can compress and store the harmonics and transient states of the signal with a new technique (which will be explained below). The presented method in signal compression, in addition to being highly accurate, can significantly compress any original signal. The block diagram of the mentioned monitoring system is shown in Figure 2 and consists of the following components:

Signal Analysis by Wavelet
The sampled signal is analyzed via the wavelet transform into the wavelet factor of the first level ( 1 d ) and the scale factor of the first level ( 1 c ).

Harmonic Calculation
The scaling factor of the first level is the parts of the low-frequency spectrum of the monitored signal. In other words, this coefficient includes the steady state of the waveform. Assuming that the harmonics of the signals are limited to the 20th order, it is possible to obtain the DC value and the amplitude and phase of the monitored signals with 41 samples of it in one period using the algebraic method. Figure 3 shows sampled voltage signal, scaling factor ( 1 c ), and wavelet factor ( 1 d ), respectively. Let us suppose the signal   t v is calculated as shown below:

Algebraic Method for Calculation of Harmonic
The scaling factor   1 c shows a low-frequency spectrum of the monitoring signal. In other words, this coefficient shows the steady state of the monitoring signal. In this case, we can calculate the DC magnitude and phase harmonics of the monitoring signal with 41 samplings in one period. First, the momentary frequency is calculated by detected the zero crossing of 1 c , and then the DC value, magnitude, and phase of harmonics are calculated via the algebraic method. The algebraic method, which has been presented for the time first in this paper, is confirmed based on solving of the algebraic equations obtained through the sampling of 1 c (when that rating frequency is constant) [30]. Thus, for this reason, we have called it the algebraic method, and we describe it in the following section. The waveform of the power network voltage in the presence of network harmonics can be wri en as follows: (20) In this equation,    (26) then from Equations (25) and (26), we have: It is observed that for calculating n n b a , , and DC v , it is required that we have completed one period of signal monitoring, and then it is necessary to perform a high volume of calculating for n n b a , , and DC v . The reason for this is because for each variable, it is necessary to perform 1 2  N sum operations and 1 2  N multiple operations, and also, the number of variables is operations of multiplication and addition should be performed. A method is presented here that divides these calculations among samplings. The method of performing the work is as follows: if the period we calculate the harmonics is the kth period, we can write [34]: In the above relationships, k is the period number, i is the sample number in the kth period, n is the harmonics number, and N is the total number of harmonics. The number of samples in each period starts from one, and the initial values of the variables are one at the beginning of each period; this means that It can be seen that after the 2N + 1 sample or after going through a period, the harmonics and the DC value of the signal are calculated [35]. Then, the sampling number i is equal to zero, and one is added to the value of k (period number) so that the amount of harmonics in the next period is calculated in the same way. In this method, because the value of the variables in each sampling stage (in any period) depends on the value of the variable in the previous sampling stage (of the same period), it is called the recursive method.

Simulation of Algebraic Method
To show the ability of the algebraic method, we consider the voltage of the power system in the form below [36]:   Figure 5 show the frequency of the first harmonic, the blue waveform is the actual frequency of the first harmonic, and the waveform of the frequency calculated by the algebraic method.  Figure 6 shows the voltage waveform simulated by algebraic method and its actual value. Figure 7a and 7b show the amplitude and phase of the first harmonics, respectively. Figure 8a and 8b also show the range of the third and fifteenth harmonics, respectively. The algorithm of the DFT method for calculating harmonics is shown in Figure 9.

Simulation for DFT Method
In order to demonstrate the capability of the DFT method, the voltage of the power network is considered as follows [37]:

 
The variability of the first harmonic phase (fundamental) causes the variability of the first frequency of the signal. In this case, the first harmonic frequency is: Figure 10 shows the frequency of the first harmonic, the blue waveform is the actual frequency of the first harmonic, and the waveform of the frequency calculated by the DFT method. Figure 11 shows the voltage waveform simulated by DFT method and its actual value. Figure 12a,b show the amplitude and phase of the first harmonics, respectively. Figure 13a,b also show the amplitude of third and fifteenth harmonics, respectively.

Start
Read   One of the drawbacks of the DFT method is the leakage in the spectrum. This effect occurs due to the windowing of the signal under analysis in the time domain and corresponds to the Fourier transform of that window. Figure 14 shows the windowing of the signal in the time domain. As we know, convolutional in the frequency domain means integration over all components of the frequency spectrum. Furthermore, this means the influence of adjacent spectra in the harmonics to be calculated. In other words, spectral energy leaks from one frequency to another due to windowing. The following can be mentioned as ways to reduce this effect: (1) increasing the window's width by increasing the number of DFT points inside this window; (2) using appropriate window functions; (3) removing large intermi ent components before windowing [38].

Comparison of the Algebraic Method with the Dynamic Gradient Method
In the algebraic method, for 2N + 1 samples during a period, N harmonics and the DC value of the waveform can be obtained entirely (analytically). However, this possibility does not exist in the least squares method; in other words, to increase the accuracy in this method, the number of samples should be increased [39]. In terms of speed, it can be seen that if we convert these methods into reversibility, their speeds will ultimately be the same. It should be noted that it is possible to calculate the instantaneous frequency for the least squares method. However, this possibility is not directly possible for the algebraic method [40].

Compression Monitored Variables
For making offline analysis available, we must be able to store the frequency, DC v magnitude, harmonics (steady values), and transient modes, and for the maximum decreasing of memory values, we must compress them. For this proposal, we present a method for compressing transient values and a new method for compressing steady values [41].  Thus when the amount of 1 d is smaller than specific values, 1 d will be zero, and

Compression of Transient Modes
In this manner, in additionally performed compression, the disturbance of 1 d , which has a high-frequency spectrum, is also omi ed [42].

Compression of DC Value and Amplitude and Phase of Signal Harmonics
DC value, amplitude, and phase of signal harmonics are steady-state parts of the signal, and usually, its changes are smooth and predictable. The consecutive values for these variables are the values obtained for them in their corresponding consecutive periods. Because the changes in these signals are slow, we therefore approximate the signal with a third-degree function. In order for this approximation to be more accurate, the coefficients of this function (third-order function) are recalculated based on the restrictions mentioned later. The least square technique is used to approximate the signal. That technique is also solved via the reversible algebraic method [43]. Figure 16) is the magnitude of any harmonics that we intend to compact. For this purpose, first, we divide it into different areas. Then, we approximate each of these areas using the third-degree function. To specify these time ranges, we apply the following restrictions [43]. These constraints are considered so that, while minimizing the third-order function with the waveform, the amount of compression is also maximized. It should be noted that the more extensive the selected spatial range, the more significant the amount of compression, which will be discussed in detail in the next section. The constraints based on which the coefficients of the third-degree function change are as follows: (a) One of the other places where the coefficients of the third-order function should change is the place where, firstly, the derivative of the signal changes its sign, and secondly, the absolute value of the difference in the signal value at that place is greater than a particular value, i.e., [44]:   (42) The values of j A , which is   Thus, at the end of each range, we have: (44) This means that all the matrix elements of coefficients  

4
A and vector

4
Y are calculated until the end of each range. Moreover, in the end, it becomes possible to calculate the variables a a a a in much less time. In order to be er understand the harmonics compression method, the process of compressing the harmonics permanent part is presented as an algorithm. The algorithm of the compression of steady-state harmonics is shown in Figure 17. In this algorithm,    Figure 17. Algorithm of recursive algebraic method for steady-state approximation.

Amount of Compression
In this part, we want to examine the amount of compression via the mentioned system. The number of samples of the main signal is 24 thousand samples per second. This signal is divided into two parts, one of which represents the transient state (wavelet factor), and the other represents the steady state (scaling factor). Because we have assumed that the frequency spectrum (harmonics order) of the steady state of the power network signal is limited to the 20th harmonic, it is therefore necessary to take 41 × 50 = 2050 samples from the harmonic part of the signal to calculate the harmonics and the DC value. Alternatively, in other words, we use only samples 41 × 50 = 2050 s apart (in this case, the signal frequency is 50 Hz). But after calculating the harmonics, for each period of the signal, 41 values (20 harmonics size values, 20 harmonics phase values, and one for the DC value) are calculated. Therefore, there is no change in the amount of data before and after the harmonics measurement. So far, assuming that the length of transient states that have occurred is 1% on average for each second, then furthermore, the remaining 99% can be considered deleted after passing through the limiter; the number of data have been halved.
However, from the harmonics, the wavelet is taken first. Furthermore, its steady part is passed through the compression system explained in the previous section. If we consider the number of periods in each range to be 50 periods on average, we will have the following: the number of compression values in each range is 5. While the number of data in each limit is considered to be 50, it can be seen that the amount of compression is [48]: are the amount of original signal data in a range and the amount of compressed signal data, respectively.

Harmonic Recovery
In this part, the values of harmonics are retrieved for different values. After receiving the time when the values of the harmonics are required for that moment, the order of the period in which this time is located is calculated.
In the above relation, k is the order of the period, and   t f  is the absolute value of the signal frequency and the time for which the harmonics are to be calculated. Then, the range of compression in which k is located is determined, namely [49]: In this relation, m k m, are the number of the compression interval and the number of the last period that exist this interval, respectively. Harmonics in any interval are specified through calculation of m k m, . The harmonics recovery algorithm is shows in Figure 18.

Real-Time and Offline Analysis of Power System
By obtaining the transient states and harmonics of the voltage and current of the power network phases, the quality of the power network can be analyzed, and necessary electrical quantities can be obtained. These quantities are as follows: the practical values of the voltage and currents of the power network, and the real and imaginary components of the apparent power of the network and also positive, negative, and neutral sequences in real time.

Finding the Location of the Fault by Derivation
Occurred faults are of high importance when they have significant effects on the main component of the power grid voltage. In this case, the fault occurrence time can be obtained by deriving the waveform of the main component of the signal. This is because if we represent this time with fault t , then the difference between two samples before and after the error will be more significant than the difference between consecutive samples in typical moments. Therefore, the derivative will be significant at this moment. This means that: In this relation, are, respectively, the sampling times before and after the occurrence of the fault. However, the derivative of the sinusoidal signal (the main component of the voltage waveform) cannot always be determined when the fault occurs.
In Figure 19, the derivative of the signal at the fault location does not differ much from the derivative of the signal at ordinary moments. Therefore, the derivative of the signal cannot determine the occurrence of the fault.  It can be seen from the above figure that it is possible to determine the half period of the signal in which the fault occurred. In other words, this time is enclosed between two times in which the signal has the maximum value before the fault and the minimum value after the fault or vice versa (minimum before the fault and maximum after the fault).
It can be seen that in Figure 21, the fault occurred when the value of the sine function is close to zero. Therefore, the derivative of the function will be insignificant at this point. However, in Figure 22, a fault has occurred in a place where the value of the sinusoidal function is close to one, regardless of its sign. Therefore, the value of the derivative of the signal at this moment is substantial.

Accurate Determination of the Fault Occurrence Time Using Wavelet Transform
As was said before, the first wavelet level of any signal can show the location of the fault in time and frequency.
After taking the wavelet transform (as shown in Figure 23), the wavelet coefficient represents the transient modes. Next, for Figures 24 and 25, the wavelet coefficient and scale coefficient are shown.  For this case, it was observed that we could not obtain the location of the change in the monitored signal through derivation. Nevertheless, in part (c) of the above figure, it can be seen that the location of the change in the signal under study can be easily found. This part actually shows the waveform of wavelet's factor.

Offline Analysis of the Power Network
Considering that the provided monitoring system is able to store harmonics and transient states, they can therefore be used for offline analysis such as statistical harmonics analysis.

Simulation of Compression Steady Values
Normally, the waveform of the harmonics and DC value is sinuous or exponential. Thus, we use the presented algorithm for steady compression over these waveforms.

Comparison Results with Other Papers
In order to check the quality of the proposed method, a comparison has been made between the results of this study and the results of the articles in Table 1 in terms of the percentage of classification accuracy and the dimensions of the feature vector. This comparison shows that the classification algorithms presented in this research have high immunity despite the high noise. Also, the overall accuracy in this research is higher than all the mentioned articles. Therefore, the proposed detection structures perform best in noisy conditions without using denoising algorithms, and power quality disturbances can be detected without the complexity of performing noise steps and calculations with an appropriate accuracy.
It should be noted that for the better understanding of the readers and to help the related research in the future, parts of the written computer program are given in Appendix A.

Conclusions
In recent times, the non-linear loads in power networks have increased, so the identification of harmonics is critical. Because of this, in order to analyze the network with such loads, the number of harmonics must be known. One of the important parameters in controlling and studying the stability of power systems is the power grid frequency. Therefore, it is necessary to determine its momentary changes; in other words, it should be possible to measure it momentarily.
In this paper, we present a monitoring system that is able to calculate frequency, harmonics, and DC value and transient events. In this research, different methods of frequency and harmonics have been presented and compared to each other. DFT method, algebraic method, and least square method are the three main methods of calculating harmonics and calculating frequency. Techniques to improve these methods have been provided. Based on the comparison, the reversible algebraic method is superior to the others, while being simpler to implement, with high accuracy and speed. Therefore, this method has been used in the monitoring system.
In order to diagnose faults and study their effects on a power network, transient states must be identified. For this purpose, the mathematical technique of signal processing called wavelet transform is used today. We have also used this method to identify the faults that occurred in a power network. In addition to displaying signals in time and frequency domains, a wavelet can display them with the least coefficients. This is because their coefficients rapidly tend to zero with an increase in their levels if the mother wavelet function is selected. The provided monitoring system provides harmonics and transients for real-time and offline analysis. To perform offline analysis, the measured values must be stored. Obviously, if these measured data are stored directly, they will occupy a significant amount of memory. To reduce the memory usage, it is necessary to compress the measured values before being stored. The provided monitoring system can multiply the data obtained from the measurement by a new and unique method up to 40 times (while maintaining maximum accuracy).
The simulation results obtained in this article show that this structure and approach are superior to other approaches used in recent years in the discussion of monitoring power quality disturbances.
Due to the introduction of a new processing technique (wavelet transform), which is used to analyze transient states from different points of view that were briefly mentioned, the suggestion that can be made here is to study and complete each of these methods. In particular, these items include the following: -Studying and improving the exact location of the fault between two parts of the power network, in which it is possible to accurately measure the quantities of the power network (voltage and current). -Finding the most suitable mother wavelet function, which has maximum compatibility with power network signals. Funding: This research received no external funding.
Institutional Review Board Statement: This paper does not contain any studies with human participants or animals performed by any of the authors.

Data Availability Statement:
The data that support the findings of this study are available from the corresponding author upon reasonable request.

Conflicts of Interest:
The authors declare no conflict of interest.