Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 4, No. 1, 2023 33 Research on Voltage Sag Detection Algorithm based on Regional Transmission System Jinyu Wang, Haolin Shi School of Electrical & Information Engineering, Northeast Petroleum University, Daqing, China Abstract: Voltage sag is the most common power quality issue and often brings huge economic losses. To achieve voltage sag prevention and compensation, it is necessary to effectively detect voltage sag characteristics. An IEEE-39 node system model is built using Simulink, combined with common aer transformation methods and αβ. The transformation method accurately detects voltage sag accidents and incorporates a derivative algorithm, greatly reducing the detection delay and meeting the real-time and accuracy requirements of actual systems. Keywords: Voltage Sag; αβ Testing; Derivative Transformation. 1. Introduction Voltage sag is a phenomenon in the power system. According to the definition of the International Institute of Electrical and Electronic Engineers (IEEE), voltage sag refers to the phenomenon where the root means square value of voltage in certain areas of the power supply network decreases to 90% to 10% of the rated voltage under the action of power frequency voltage, lasting for a short period of half a cycle to 1 minute, and then returns to normal on its own [1- 3]. There are many reasons for voltage sag in the power system, including system phase to phase short circuit faults and ground short circuit faults, lightning strikes, capacitor bank switching, start-up of large capacity induction motors, and switch on/off operations. Among them, the vast majority of voltage sags are caused by inter phase short circuit faults and ground short circuit faults. After a short circuit fault occurs in the system, the current in the circuit sharply increases, causing a voltage drop. The closer the fault point is, the lower the voltage, which affects the normal operation of the equipment and causes a large number of economic losses. In the analysis and calculation of voltage sag, the three most recognized main characteristic quantities are the amplitude value, duration, and phase jump of voltage sag. These characteristic quantities can be used to describe the severity and impact range of voltage sags. According to the definition of voltage sag, it can be known that the amplitude of voltage sag is the depth at which the sag occurs, which is the root mean square value of the voltage. It is commonly expressed as a unit value in calculations. The duration of voltage sag is the time difference between the occurrence and end of the sag [4-6]. In actual engineering measurements, the duration of the sag process varies depending on the magnitude of the voltage sag. In addition, before and after the accident, the phase angle may undergo a jump phenomenon [7]. This type of jump usually occurs in systems with high impedance or three-phase asymmetric faults. The principle of the effective value calculation method is relatively simple and the calculation speed is fast, but in practical analysis, the phase jump of voltage sag cannot be detected, and there is still a period of delay. The wavelet transform method has many advantages, but it relies on the selection of wavelet bases and has not yet been widely applied [8,9]. This article focuses on the research of commonly used detection algorithms and adopts a transformation method based on derivative improvement, which greatly shortens the delay problem of conventional detection methods and accurately detects the amplitude and start stop time of voltage sag. 2. Voltage Sag Detection Algorithm 2.1. Effective Value Calculation Method The effective value calculation method determines the time domain in which voltage sag occurs by the ratio of the effective value of the voltage to the rated value within a certain time period, and then obtains it by sampling the root mean square value of a cycle within the time domain. The voltage data collected in practical applications is often integer or natural data, so the calculation formula is as follows: 2 rms 1 ( ) t kN t U U t kN    (1) In the formula, k is the number of sampling cycles, and N is the number of sampling times per cycle. IEC61000-4-30 recommends using full wave as a sampling period and updating the sampling data every half cycle [10,11]. In order to detect voltage sag accidents in real time, in practical applications, the unit is usually the collected voltage data of one cycle, and then the sliding average method is used to calculate. By using the sliding average method to calculate, a new voltage effective value can be obtained to replace the previous effective value, thus achieving continuous updates of the voltage effective value at each sampling point. The formula is as follows: 2 rms 1 1 ( ) ( ) t k t k N U k U t N       (2) The simulation diagram of the effective value calculation method is shown in the following figure: Fig 1. Voltage Sag Waveform 34 Fig 2. Calculation Results of the Effective Value of the Positive Period Method Fig 3. Calculation Results of Effective Value of Half Cycle Method Figure 1 shows the voltage sag waveform, with a set voltage sag amplitude of 0.5 p.u., a frequency of 50 Hz, and a sag duration of approximately three cycles, which is 60 ms. Figure 2 shows the calculation results of the effective value of voltage sag using one cycle. From the figure, it can be analyzed that there is a delay time of up to one cycle before the voltage sag reaches the set sag amplitude, and there is still a delay time of one cycle before the end of the voltage sag. This is because the sliding average value uses data of one cycle, so its real-time performance in practical applications is not good. Figure 3 shows the calculation results of the effective value of voltage sag using a half cycle method. From the analysis in the figure, it can be seen that although the delay time of the half cycle method is reduced by half compared to the positive cycle method, there is still a delay time of one cycle before the sag reaches the set amplitude. In practical applications, this sampling method must increase the number of sampling points to reduce detection errors, but the sampling data of the first half cycle needs to be used in the calculation, So the real-time performance is not enough, and this method cannot clearly provide the start and end time of voltage sag, and further improvement is needed. 2.2. Defect Voltage Method The defect voltage method is defined as a method that uses the difference between the actual voltage and the ideal rated voltage on the time axis to quickly determine the actual voltage sag amplitude and phase change. The ideal voltage Ur is: r 1 1( ) sin( )U t U t   (3) The voltage Usag after a transient occurs is: sag 2 2( ) sin(U t U t    (4) The difference between the above two voltages leads to the defect voltage Urs being: rs r sag 3 3( ) ( ) ( ) sin( )U t U t U t U t     (5) According to the calculation principle of trigonometric functions, the amplitude U3 and phase of the defect voltage can be obtainedφ3, the formula is as follows: 2 2 3 1 2 1 2 2 1 1 1 2 2 3 1 1 2 2 2 cos( ) sin sin arctan cos cos U U U U U U U U U                 (6) The simulation diagram of the defect voltage method is shown in the following figure: Fig 4. Voltage Sag Waveform Fig 5. Calculation Results of Defect Voltage Method 2.3. Wavelet Transform Method The wavelet transform method, as an improved method based on Fourier transform, is a mathematical tool that can analyze both frequency and time domains simultaneously. Compared to the traditional Fourier transform, the wavelet transform method introduces a scaling factor and a delay factor to construct a time-frequency adjustable window for signal analysis. This method can use wavelet basis functions with different features to represent the signal, thus obtaining the multi-resolution characteristics of the signal and solving the defect that Fourier transform cannot analyze the time- frequency domain simultaneously [12]. The basic principle is as follows: The formula for wavelet decomposition of signal f(t)is: j-1 j j( ) ( ) ( )P f t P f t D f t  (7) In the above equation, Pj f(t)is the projection of f(t)on Vj, and Dj f(t)is the projection of f(t)on the orthogonal complementary space Wj of Vj. The expressions Pj f(t)and Dj f(t)are: (j) j k jk (j) k j jk ( ) ( ) ( ), ( ) k P f t x t x P f t t          (8) (j) j k jk (j) k j jk jk ( ) ( ) ( ), ( ) ( ), ( ) k D f t d t d D f t t f t t            (9) In the above equation, ( ) k jx is the discrete approximation of f(t)at j resolution, ( ) k jd is the discrete approximation of f(t)at j resolution, ϕjk(t)is its scaling function, ψjk(t)is a wavelet function, The voltage sag signal decomposed by wavelet transform method is shown in Figure 6. Fig 6. Wavelet Transform Decomposition of Sag Signal 35 From the figure, it can be seen that the two points where the modulus maximum appears in the d1 layer correspond to the starting and ending times of the voltage sag, which also indicates a sudden change in the signal at that time. It can be clearly seen that the wavelet transform method can accurately determine when the voltage sag occurs and when it ends. At the same time, the wavelet transform can obtain the characteristic quantity of the voltage sag amplitude value changing over time without losing data. However, the wavelet transform method also has drawbacks. The essence of using the wavelet transform method to solve the calculation is to analyze the convolution of the temporary signal and the wavelet basis, and the temporary signal is projected on different scales of wavelet basis to extract the time-frequency characteristics of the temporary signal. However, the characteristics of the wavelet are different, and the wavelet basis needs to be selected. Therefore, the accuracy of signal detection depends on the selection of wavelet basis. 2.4. Dq0 Transformation Method The principle of instantaneous reactive power theory is to use Park transform to convert the three-phase voltage AC component of the system into the DC component in the dq0 rotating coordinate, and then conduct real-time analysis of these electrical quantities. Converting from abc coordinate system to dq coordinate system: a d b q c U U C U U U              (10) In the equation, C is the transformation matrix from the abc coordinate system to the dq coordinate system, and the expression for C is as follows: sin sin( 2 3) sin( 2 3)2 cos cos( 2 3) cos( 2 3)3 t t t C t t t                      (11) In the equation, sin(ωt), cos(ωt) is a sine and cosine signal with the same phase as the A-phase voltage. The ideal three- phase voltage signal is shown in equation (12): a b c 2 sin 2 sin( 2 3) 2 sin( 2 3) U U t U U t U U t              (12) From the equation, it can be seen that the three-phase voltage transformation results in the DC component Ud, and the transformation result is: d q 1 3 0 U U U            (13) From the above formula, it can be seen that the d-axis component reflects the effective value of the voltage, which is obtained by dq0 transformation to obtain the effective value of the three-phase voltage. Because there is no phase jump problem in a symmetrical three-phase voltage sag, considering that the phase has been recalculated, the result of equation (13) can be obtained. Therefore, based on this method, the amplitude of the sag voltage can be determined instantaneously. However, in practical power systems, most of the faults that occur on the transmission line are voltage sags caused by asymmetric short circuit faults. At this time, the voltage phase will change, so the above methods cannot solve this problem. Therefore, in practical engineering applications, the method of instantaneous reactive power is rarely considered. But based on this, many scholars have proposed new methods that can detect voltage sags in actual power systems. The instantaneous dq transformation method described in the next section is an improvement of this method. 3. Analysis of Voltage Sag Application 3.1. Application Analysis based on dq Transformation Method The dq transformation method of virtual three-phase voltage is a detection algorithm evolved based on the abc-dq transformation idea. Its construction process is based on three-phase symmetry, utilizing the phase difference characteristic of 120 ° between three-phase voltages in a symmetrical system, selecting one of the phase voltages as the input signal, and generating a virtual three-phase voltage signal for detection through dq0 transformation. Assuming phase a as an example, the root mean square value of the fundamental voltage is U and the initial phase is 0. Consider the disturbance as the sum of all high-frequency oscillation signals, where the phase voltage is: h a h h2 sin 2 sin( ) tu U t U h t e      (14) In the formula, Uh is the root mean square value of the h high-frequency signal θh is the initial phase angle and hte is the attenuation index. Using the A-phase voltage ua as the reference voltage, a virtual three-phase voltage can be constructed by leading and lagging them by 120 ° respectively. That is, by delaying ua 60°, -uc can be obtained. Then, by using ua+ub+uc=0, ub can be obtained. Then, ub and uc are represented as: h h b h h π ( - ) 3ω h h 2 sin 2 sin( ) 2 sin( ) 3 2 sin( ) 3 t t u U t U t U h t e h U h t e                     (15) h π ( - ) 3ω c h h2 sin( ) 2 sin( ) 3 3 th u U t U h t e          (16) Decompose the above ua, ub and uc into fundamental and high-frequency components, and substitute them into equation (10). After calculation, it can be obtained that: h h h h π ( - ) 3ω d h h-1 h h-1 π ( - ) 3ω h h+1 h h+1 3 sin( ) sin( ) 3 3 sin( ) sin( ) 3 3 tt tt h u U U e U e h U e U e                                  (17) h h h h π ( - ) 3ω q h h-1 h h-1 π ( - ) 3ω h h+1 h h+1 1 sin( ) cos( ) 3 33 1 sin( ) cos( ) 3 33 tt tt h u U e U e h U e U e                                   (18) From the above two equations, it can be seen that the fundamental effective value of the voltage in ud is reflected as the DC component, and the h-th high-frequency oscillation component can be obtained by adding h±1 high-frequency oscillation component. Due to the absence of a direct current component in the mathematical operation results of uq, and the similarity between the d-axis conversion and the high- frequency oscillation signal transformation, ud cannot reflect the effective value of the fundamental voltage. In order to obtain the root, mean square value of the response in an 36 instant, it is necessary to use filtering technology to decompose the DC component of the d-axis when the system is subjected to severe interference. When there is no phase angle change during a voltage sag accident, the DC component can be decomposed using the above method to obtain the root mean square value of the fundamental voltage. The existence of a voltage sag accident can be confirmed based on whether the root mean square value has changed. When there is a phase angle change during a voltage sag accident, assuming that the effective value of the voltage is Usag and the phase jump angle is α.The fundamental component of phase A voltage can be expressed as a sag2 (sin ω )u U t   .Assuming that there are still high-frequency oscillation components in the voltage when the phase angle changes, in order to obtain the b and c two- phase voltages, the above method can be used to delay the a phase voltage by 60 °,and the obtained three-phase voltage can be substituted into (10) to calculate the DC component Ud in the d and q voltage components, respectively Udα and Uqα,Obtain the following expression: dα sag3 cosU U  (19) qα sag3 sinU U   (20) The above two DC components Udα and Uqα For known quantities, the amplitude and phase jump of the sag voltage can be obtained separately based on the above two equations, and the expression is as follows: 2 2 sag dα qα 3 3 U U U  (21) qα qα 2 2 sag dα qα 3 arcsin arcsin 3 U U U U U                 (22) Can accurately and quickly decompose two DC components Udα and Uqα, The voltage sag amplitude and phase jump can be obtained. Currently, low-pass filters (LPF) are commonly used to decompose the DC components from the dq transform. Figure 7 is a flowchart for constructing a virtual three-phase voltage detection voltage sag. The application analysis of the sag amplitude detection waveform in the 39-node model using the dq transformation method has been conducted in the following chapter, and will not be repeated here [13-15]. Fig 7. Flow chart of dq transformation method 3.2. Be based on αβ Application Analysis of Transformation Method αβ The transformation method is a commonly used method in power system control, which originates from the dq transformation method. By converting the three-phase voltage in the abc coordinate system into a static one αβ Under the coordinate system, the amplitude of the required voltage signal can be obtained. The specific formula is as follows: a α b β c 1 1 1 2 2 2 3 3 3 0 2 2 u u u u u                      (23) Voltage U at α axis and the projection of the β axis represents the voltage at the instantaneous components in the αβ coordinate system are ud=Ucosφ and uq=Usinφ. uα and uβ the formula for transforming to the dq coordinate system is as follows: d α q β cos sin sin cos u ut t u ut t                  (24) The transformation between the αβ coordinate system and dq coordinate system is shown in Figure 8: βq d α U1cos(ωt+φ)  U1 U1cosφ U1sinφ φ  U1sin(ωt+φ)  ωt . Fig 8. αβ Conversion diagram with dq coordinate system According to relevant calculations, the amplitude and phase of the voltage can be obtained as: 2 2 sag d qU u u  (25) d q arctan u u    (26) In the power system, single-phase to ground short circuit fault is the most common type of fault. To detect such faults, it is possible to use αβ Transform method to obtain amplitude information of voltage sag. Specifically, in the αβ In the transformation method, it is necessary to construct the three- phase voltage of the system and convert it to a static state αβ In the coordinate system. Due to uα to be ahead of uβ 90°, therefore single-phase voltage can be set as a reference signal to achieve rotation of the coordinate system: a αsin( )u U t u    (27) Delay uα by 90 ° again to obtain: β sin( ) cos( ) 2 u U t U t        (28) The above formulas will αβ coordinate method is directly converted to the dq transformation method to calculate the amplitude of the voltage. The following is passed αβ transformation method is used to simulate the simulation detection circuit of voltage sag. Similar to the dq transformation method detection circuit, a second-order Butterworth filter is used, with a cutoff frequency of 60 Hz. By setting the filter, the impact of noise signals on the detection results can be effectively reduced, and the stability and reliability of the system can be improved. The system sampling frequency is set to 100 KHz, αβ transformation method detection circuit is shown in Figure 9: 37 Fig 9. αβ Detection circuit diagram of transformation method The waveform of the obtained voltage sag amplitude is shown in Figure 10: Fig 10. αβ Amplitude detection waveform of transformation method From the simulation results, it can be seen that using αβ effect of using transformation method to detect voltage sag is very obvious and can accurately detect voltage sag accidents. However, it should be noted that when constructing three- phase voltage, αβ transformation method requires a 90 ° delay. This means that this method has certain limitations in real- time performance and cannot meet the requirements of modern power systems for real-time monitoring and protection of sensitive equipment. 3.3. Based on Improvement αβ Application Analysis of Transformation Method The above two sections discuss the dq transformation method and αβ The application of transformation method in IEEE-39 node system has analyzed and clarified the delay problem caused by these two methods in constructing three- phase voltage of the system. In response to this issue, this section continues to discuss the methods used to construct the three-phase voltages ua, ub and uc of the system. To solve the delay problem generated during the construction process, which is to solve the conventional dq transformation method and αβ The problem of data asynchrony caused by delay in the transformation method will continue to be addressed αβ Transformation method for improvement. in the light of αβ. The delay problem in the transformation method is addressed in this section by using the method of function differentiation to construct the three-phase voltage of the system. Specifically, it is known that α Calculate the voltage phasor of the shaft and the derivative value of its voltage phasor, and then use α Derive the voltage phasor of the shaft β The voltage phasor of the axis is directly derived through differentiation, without directly transforming the delay problem of the coordinate axis, so it can solve the conventional problem of asynchronous data during detection using αβ transformation methods. Derive equation (27) to obtain: ' α cos( )u U t    (29) ' β α cos( )u u U t     (30) According to the convention αβ The process of transformation is calculated. Improved αβ The detection circuit of the transformation method is shown in Figure 10, and the improved method has set up ∆u/∆t modules to simulate the derivative transformation. The sampling frequency of the system remains unchanged, and a second- order Butterworth filter with a cutoff frequency of 60 Hz is continued for filtering. The waveform of the voltage transient amplitude value obtained is shown in Figure 11: Fig 11. Improved αβ Detection circuit diagram of transformation method Fig 12. Improved αβ Amplitude detection waveform of transformation method From the amplitude detection waveform of the voltage sag mentioned above, it can be seen that the improved αβ transformation method can effectively detect voltage sags, as previously constructed αβ. The shaft voltage has not undergone delay conversion, so this method has good real- time performance. In addition, improved αβ transformation method can reduce the impact of system oscillation in the process of waveform detection. By using Butterworth filter, the anti-interference ability to harmonics and distortion is enhanced. 4. Conclusion This article conducts research and analysis on commonly used voltage sag detection methods, clarifies the advantages and disadvantages of these methods in practical applications, and adopts derivative transformation to improve, further reducing the delay problem of detecting voltage sag in practical applications. References [1] Janusz Mindykowski, Tomasz Tarasiuk. Problems of power quality in the wake of ship technology development[J]. Ocean Engineering,2015,107. [2] Khadkikar Vinod,Xu Dianguo,Cecati Carlo. Emerging Power Quality Problems and State-of-the-Art Solutions[J]. IEEE Transactions on Industrial Electronics,2017,64(1). [3] Tang Liangyu,Han Yang,Yang Ping,Wang Congling,Zalhaf Amr S.. A review of voltage sag control measures and equipment in power systems[J]. Energy Reports,2022,8(S10). [4] Hu Wen-xi,Ruan Zi-hang,Xiao Xian-yong,Xiong Xiao- yi,Wang Jun-qi. A novel voltage sag state estimation method based on complex network analysis[J]. International Journal of Electrical Power and Energy Systems,2022,140. 38 [5] Wang Shuzheng,Zhang Shaowen,Li Xianyun. Study of Voltage Sag Detection and Dual-Loop Control of Dynamic Voltage Restorer[J]. Frontiers in Energy Research,2022. [6] Qader Mohammed Redha. Shunt compensation for mitigation of harmonics, voltage sags, and flickers using new STATCOM control scheme[J]. Energy Conversion and Economics, 2022, 3 (3). [7] Liu Yuxin,Zhang Jingjing,Jia Haowei,Yuan Lin,Zhou Min. Identification of Voltage Sag Sources in the Electrified Railway Power Supply System Based on CNNs[J]. Wireless Communications and Mobile Computing,2022. [8] Mehmet Karadeniz , M. Timur Aydemir , Saffet Ayasun. Online Parameter Identification of a Simplified Composite Load Model by Voltage Sag Events[J]. Turkish Journal of Electrical Power and Energy Systems,2022,2(1). [9] Guo Zhicheng. Three-phase unbalanced voltage sag detection method based on morphological filtering[J]. Journal of Physics: Conference Series,2022,2254(1). [10] Tan Min-gang,Zhang Chaohai,Zhang Rui,Chen Bin. Disturbance extracted methods for auxiliary power quality monitor-based voltage sag localization in distribution network [J]. International Journal of Electrical Power and Energy Systems,2023,145. [11] Wang Ziming,Guo Xiao,Li Zhenyu,Lin Hongyi,Chen Guozhu. A fast voltage sag detection method based on second order generalized integrator and delay transform method[J]. Energy Reports,2022,8(S13). [12] Da Hai Zhang,Cheng Yu Ge,Chen Chen,Xian He Han. Voltage Sag Detection Method Based on Wavelet Information[J]. Applied Mechanics and Materials,2015,3822(740-740). [13] S. Rashmi, Shankaraiah. A Novel Faulty Phase Identification Algorithm and Fast DQ Transform Technique for Voltage Sag Detection [J]. Journal of Circuits, Systems and Computers, 2017, 26(12). [14] An Improvement in Synchronously Rotating Reference Frame- Based Voltage Sag Detection under Distorted Grid Voltages[J]. Journal of Electrical Engineering & Technology,2013,8(6). [15] Kleber de Araújo Lima Francisco, Guerrero Josep Maria,Tofoli Fernando Lessa, Branco Carlos Gustavo Castelo,Dantas Joacillo Luz. Fast and accurate voltage sag detection algorithm [J]. International Journal of Electrical Power and Energy Systems, 2022,135.