Adaptive algorithm in distance relay with out of step blocking element compatible with smart grid requirements during sub-synchronous resonance in transmission line

Smart grid comprises utility system and dispersed renewable generations. It establishes bidirectional power transmission and communication among utility system, distributed generations and consumers. Sub-synchronous resonance (SSR) is a major concern in transmission line. Furthermore, impedance swing during SSR leads in operation of out of step blocking characteristic of distance relay. SSR brings about a signiﬁcant rise in the magnitudes of voltage and current. It also raises probability of occurrence of ferroresonance. Here, the impact of SSR in utility system is analysed on operation of doubly-fed induction generator and distance relay with out of step blocking element is given here. Smart grid urge to establish a self-healing protection, hence, an adaptive algorithm based on sub harmonic and ferroresonance detection is proposed for distance relay. The algorithm discriminates ferroresonance from other nonlinearities by wavelet transform and neural network and utilises time domain analysis to distinguish between different types of ferroresonance. The algorithm is able to observe smart grid protection strategy. It is capable of receiving the commands according to protection strategy to take a correct decision in such conditions to enhance reliability of power electricity in smart grid. Finally, the proposed algorithm is examined in SSR condition to certify the correct operation.


INTRODUCTION
The term "smart grid" describes a self-healing electrical network and comprises dynamic optimization techniques that use real time measurements to minimize grid losses, conserves voltage level, improves reliability and enhances asset management [1]. Sub-synchronous resonance (SSR) may cause serious difficulties in operation of wind farm. SSR investigations in doubly-fed induction generator (DFIG) and adaptive controls to suppress SSR in wind farm are presented in [2]. Ref. [3] analyses impact of doubly-fed induction generator based wind farm integration on sub-synchronous torsional interaction (SSTI) between thermal generators (TGs) and HVDC.
SSR phenomenon causes sub harmonic components of electrical quantities interact with natural frequencies of rotary systems encountered with series capacitors. It leads in catastrophic torsional oscillation in turbo-generator. Such oscillation in the rotor causes pole slipping and out of step condition in the generator. As a matter of fact, SSR raises the amplitude of voltage and current in the network. As a result of overvoltage, can be saturation of transformer core and consequently occurrence of ferroresonance in a network with series capacitors [4]. Ferroresonance in effect of installation of capacitor bank, which is used for compensation of reactive power, is discussed in [5].
In order to distinguish variety forms of faults in wind farm and protection of DFIG several methods and algorithms are discussed as follows. Ref. [6] applies positive and negative quantities to recognise internal and external faults in Wind Park. An overcurrent relay enhanced by genetic algorithm for protection of DFIG in wind farm is presented in [7]. Ref. [8] represents an adaptive overcurrent coordination scheme to improve relay sensitivity and resolve the problems due to distributed generation in smart grids. Adaptive protection of a line with distance relay in case of fluctuation of wind farm output power is investigated in [9]. General concept and application of self-healing technology is presented in [10]. Ref. [11] presents a contribution in the area of self-healing distribution networks in the event of a permanent short-circuit. The beneficial aspect of self-healing protection in smart grid is described in [12]. Self-healing protection employs equipment that recovers the power electricity automatically in case of a trouble, or a fault in the system. This declines the number of vulnerable consumers in effect of power outages.
Protection of series compensated transmission lines is stated in literature. Ref. [13] presents a synchronized phasor measurement-based wide-area backup protection scheme which compares the magnitude of sequence voltages of buses at a system protection centre to identify the bus closest to the fault. In addition, ref. [14] describes a method that is implemented for computing responses of series compensation capacitors with MOV protection in a real-time simulator for relay testing. Moreover, the effect of the residual compensation factor on the measuring accuracy of distance protection measurements when an earth fault occurs on a series compensated line is investigated in [15].
Several methods have been presented in literature to mitigate SSR condition. A Fractional-order PI based UPFC (unified power flow controller) is used in [16] to suppress SSR in series compensated system. In addition, static synchronous series compensator (SSSC) is series injection voltage, which leads or lags line current by 90 • , thus emulating a controllable inductive or capacitive reactance. Effect of SSSC-based SSR controller on the performance of distance relay and adaptation of digital relays using phasor and synchronized measurement is presented in [17,18].
In order to detect SSR condition by electrical relays a method based on shaft angle and voltage angle measurement has been presented in [19]. Digital torsional stress protective relay proposed in [20] monitors the turbine-generator shaft for torsional oscillation to detect shaft fatigue. Sub harmonic protection relay detects SSR condition by means of sub harmonic components evaluation [21,22]. In addition to that, several integrated schemes are presented for distance and overcurrent relays to identify faults in series compensated lines [23,24]. However, such developments cannot be considered as adaptive devices to determine behaviour of the relay in SSR condition. Adaptation of protective relays against ferroresonance and SSR has been presented in literature. Refs. [25 and 26] proposes intelligent algorithms in SSR condition to prevent mal operation of overcurrent relay and out of step protection of generator respectively.
Adaptation of distance relay with out of step blocking (OSB) element against ferroresonance was first outlined in [27]. The algorithm distinguishes ferroresonance in traditional network and modifies relay setting quantities based on user defined setting coefficients. However, the algorithm is not flexible enough to determine behaviour of the relay based on analytical results of electrical studies to maintain stability and availability of the network.
Conference version of this paper [28] came up with the idea of enhancing investigations respecting more adaptation of distance relay against ferroresonance and SSR, in addition, extends application of the algorithm to smart grid. The smart grid has a variable configuration due to instantaneous switching of renewable energy resources. Therefore, real-time monitoring of the conditions and controlling protective relays is essential for the system to establish stability of the grid in different network configurations. Hence, this study enhances investigation of SSR and designation of a new adaptive algorithm for protective relays in smart grid. In order to make a self-healing protection against SSR compatible with smart grid requirements, an adaptive algorithm based on sub harmonic measurement and ferroresonance analysis in time domain is proposed for distance relay. Protection strategy in smart grid is responsible for operation of protective relays in any condition based on consideration of stability and availability of the network. The proposed algorithm receives modification commands from protection strategy to make a suitable decision in SSR condition.
This paper is improved with respect to its conference version. Theoretical aspects of SSR in transmission line, popular SSR analysis tools, ferroresonance detection based on wavelet and neural network, in addition, time domain analysis of ferroresonance to distinguish ferroresonance of different types, the structure of protection strategy to prevent mal operation or activate the relay in severe ferroresonance and SSR conditions are added to this version. Furthermore, the issue of protection strategy logic and occurrence of SSR in utility system are specifically explained with more pictures and detail information in this version.
Thereafter, prototype of an intelligent algorithm is explained for distance relay with OSB element. The method is enhanced to distinguish ferroresonance from other nonlinearities in smart grid like, effects of electronic devices of renewable energy resources. Then, structure of the algorithm and protection strategy is designed. Impact of occurrence of SSR in utility system is analysed on operation of DFIG by PSCAD/EMTDC software. Behaviour of distance relay and OSB element is assessed during SSR. The algorithm is implemented in the software and is examined in SSR conditions to certify correct operation in smart grid electrical protection.

THEORETICAL APPROACH
In this section, theoretical approach respecting occurrence of SSR in series compensated transmission line, principle of ferroresonance detection based on wavelet and neural network, and detection of ferroresonance of different types based on time domain analysis are briefly explained.

SSR in transmission line
Theoretical aspect of SSR in AC transmission system, furthermore, widely enjoyed SSR analysis tools are briefly explained in this subsection.

Series compensation and SSR phenomenon
Loadability of AC transmission line is specified as below [29].
Series compensation raises capability of power transmission by contributing series capacitances, which cause a decrease in total line impedance as below.
S is considered as compensation degree, which can vary between 0% and 100% defined as below.
The theoretical value of compensation degree is equal to 100%. It may cause generation of huge currents in case of occurrence of small disturbances or short circuit. It is noted that, a high level of series compensation brings about operational problems in protective relays and in voltage profile in abnormal conditions. In a radial series compensated power system, the electrical resonance frequency is achieved as follows [30].
where f s is rated frequency of power system. X L is total inductance of the system. The current flowing to the system due to series compensation initiated by a short circuit is circulated to stator winding of the generator and is able to interact with rotor of turbogenerator as sub harmonic and super harmonic frequencies.
As shown by Formula (6), the current comprises fundamental component (power system frequency) and also other sinusoidal components, which are determined by existing elements in the system [31].
where ζ is damping ratio defined as follows.
ω 2 is damping frequency as below.
ω n is un-damped natural frequency defined as below.
Sub synchronous currents enter into generator winding and cause production of electrical torque on the generator rotor. Sub synchronous torque is able to coincide with natural frequencies of the turbo-generator rotor. It leads in oscillation of the rotor at its natural frequencies. Sub synchronous resonance consequently brings about catastrophic damage to the turbogenerator rotor. SSR is substantially divided into transient and steady state explained as below.
Transient SSR generally arises in effect of a short circuit fault in the network with series capacitors. Transient magnitudes comprise sub synchronous frequencies, which are firmly dependent on existing elements in the network. Slip frequency f r in turbo-generator is given as follows [32].
As soon as this frequency coincides with one of natural frequencies of the turbo-generator rotor (f n) , torque amplitude increases much more larger than the system without series compensation.
Steady state (self-excitation) SSR is categorized into the induction generator effect (IGE) and torsional interaction (TI). IGE regards turbo-generator as a rigid mass rotating at a fixed speed connected to the grid. TI respects the turbo-generator with multi-mass rotor, which interacts with the system disturbances at its natural frequencies.

SSR analysis tool
In order to study SSR phenomenon several methods have been developed. Frequency scanning and eigenvalue analysis are well-established tools, which have been fairly practical in this regard. Frequency scanning considers impedance from behind of generator armature as a function of frequency. Eigenvalue analysis is mostly practical in dynamic stability studies. A linearized model of ac system is derived by this analysis as follows [33].Ẏ The elements of matrix Y are strongly dependent on the network quantities and operating conditions which are essential to define the system. Firstly, eigenvalue of matrix A is calculated and then torsional frequencies of the system are attained as below.
where λ i is eigenvalue of matrix A.

Principle of ferroresonance detection based on wavelet and neural network
In order to distinguish ferroresonance from other transients, wavelet and neural network are utilized in power system. The method based on wavelet and neural network explained in [34] distinguishes ferroresonance from transients like; transformer energizing and load or capacitance switching. discrete wavelet transform (DWT) analyses the signal at variety of frequency bands with different resolutions by decomposition of the signal into a course of approximation and detail information. The decomposition of the signal is obtained by successive high pass and low pass filtering of the signal in time domain. The original signal x[n] is passed through a half band high pass filter g[n] and a low pass filter h[n]. After filtering, half of the samples can be eliminated according to the Nyquist's rule, since the signal now has a highest frequency of a half value of original signal. The signal can therefore be subsampled by 2, simply by discarding every other sample. This constitutes one level of decomposition and can mathematically be expressed as follows.
The above procedure, which is also known as the sub band coding, can be repeated up to desired level of decomposition. Different families of mother wavelets like; Harr, Daubechies, Symlets and Coeiflets are named using a Surname ('har', 'db', 'sym' and 'coif') and a number following the surname represents the order. More details regarding wavelet transform can be found in [35].
Neural network comprises interconnected adaptive simple elements (neurons) that perform parallel computation for data processing. The self-organization of networks is one of the most interesting subjects of the neural networks. These networks can recognize the organization and connectivity present at the input and respond to the other inputs according to that organization. Neural network is able to fit the data, recognize the pattern and clustering the data. Neural network architecture includes input layer, layer of neurons (hidden layer) and output layer. Input data are designated for training, validation and testing process. In training course, the weights (w) are changed to match input data based on target data to obtain desired output by selecting a suitable training algorithm [36].
As was mentioned in advance, the method is enhanced to distinguish ferroresonance from other nonlinearities in smart grid. One particularly prominent example of this issue can be impact of electronic devices of renewable energy resources on power quality in the network. This purpose can be established by means of wavelet and a well-trained neural network. A large number of samples designated to certain nonlinear abnormalities must be provided to train the network. Application of the detection tool is illustrated in the next section.

Ferroresonance of different types detection algorithm based on time domain analysis
After distinguishing ferroresonance from other transient abnormalities, it is beneficial to determine ferroresonance of different types in time domain. Time and frequency domain of ferroresonance are explained in [37][38][39][40].
However, the method in [27,41] proposes a different solution based on time domain analysis briefly explained as follows. Ferroresonance of different types can be detected by calculation of frequency deviation from nominal value (Δf) and total harmonic distortion (THD) of specified waveform. Table 1 shows typical values of criteria to determine ferroresonance based on Δf and THD. In this paper, the quantity of dTHD/dt is added to consider better recognition of ferroresonance in presence of electronic devices such as inverter and converter in renewable energy resources. Such devices are considerably prone to increase the value of THD in the network. Similarly, occurrence of ferroresonance causes significant increasing of THD in the network. Application of such quantities to design adaptive algorithm for distance relay will be explained in the next section. Figure 1 shows a simplified system diagram where a series compensated transmission line interconnects two generating sources [28]. SSR generally leads in power oscillation and increasing the magnitudes of voltage and current. Growing the voltage is the main cause of saturation of transformer and reactor in the system. It subsequently leads in occurrence of ferroresonance in no-load conditions. Moreover, the ferroresonance brings about an undamped exchange of energy at sub synchronous frequencies between the series capacitor and saturable transformer core [4].

Distance relay in SSR condition
Ferroresonance causes deviation of waveforms of voltage and current from sinusoidal form. It spontaneously causes frequency deviation in different places in the network [42]. It consequently causes power oscillation, which is superimposed on torsional oscillation in SSR. Subsequent to oscillation of power, impedance varies in the grid and is calculated by the following formulas [43]. As a result, impedance in distance relay is calculated as below [44].
where δ = δ A − δ B is load angle difference between two power sources, and Z T is total impedance of the system. Figure 2 illustrates protective zones of distance relay including two offset mho characteristics surrounded by OSB element in impedance diagram [28]. The protective zones are enclosed by OSB circles, which prevent mis-operation of the relay during power oscillation in the system. SSR leads in oscillation of power with specific swing frequency. Impedance locus traverses throughout OSB elements; hence, OSB signal is generated and causes a blockage in operation of the relay in effect of short circuit along with occurrence of SSR in the system. The value of current increases during SSR; hence, it brings about a mal operation in the relay, whereas any actual fault does not occur in the network. On the other hand, in case of a severe ferroresonance along with SSR essential trip operation of the relay may be restricted due to degradation of fundamental harmonic of the current waveform; whereas, true rms value of current rises remarkably. Protection strategy of smart grid is responsible of behaviour of the relay in ferroresonant condition based on respecting stability and availability of the network, which is achieved by consequences of electrical studies in the system. To accord with smart grid protection requirements, an intelligent algorithm is designated for distance relay to operate in such conditions based on consideration of protection strategy. Structures of the algorithm and protection strategy are described in detail by the following paragraphs.

3.2
Structure of the algorithm in distance relay Figure 3 illustrates flowchart of an adaptive algorithm to compatible operation of distance relay with OSB element in case of occurrence of SSR along with ferroresonance with protection strategy of smart grid [28]. The algorithm is designed to receive the values of relay setting quantities and network electrical values like; voltage, current and frequency. The algorithm is able to detect sub synchronous components of the current waveform in range of 5-50 Hz by means of low pass filter. Thereafter, fast Fourier transform (FFT) is developed to decompose the signal into order of sub harmonics. Sub harmonic frequencies correspond to electrical resonance frequency (F er ), which is dependent on the values and types of elements in the system as stated in Formula (5). Sub harmonic currents are calculated by the proposed algorithm as criteria to recognize SSR in the system as shown by the following formula [21,28].
These values are adjusted in the algorithm according to required sensitivity to detect SSR. In fact, protection strategy determines setting values of these criteria based on degree of sensitivity, which is obtained from results of electrical studies in the network. As soon as one of the above-mentioned quantities becomes greater than the adjusted value and remains unchanged for more than 100 ms or more that 10 operation per second (OPS), SSR is considered to be detected in the grid. The OPS registers successive pickup operations, which are dropped off in the time below 100 ms.
As was mentioned in advance, wavelet and neural network are utilized to discriminate ferroresonance from other nonlinearities and transient conditions in the network like; transformer energizing, load and capacitance switching. Furthermore, it recognizes impact of electronic devices like inverters provided for renewable energy power generations. Such devices are able to affect power quality in the power system. In order to distinguish ferroresonance, daubechies (db) mother wavelet decomposes the current signal into a course of approximation and detail information up to six levels. Relevant experiences show that this type of mother wavelet is more practical in such applications [34]. Input signals are clustered into five classes based on patterns provided for each class. Neural network is trained by entering the patterns (target) to the algorithm in commissioning term. It is obvious that including more patterns to the algorithm causes the neural network to be well trained in this course.
The algorithm is also designed to distinguish ferroresonance of different types based on frequency deviation (Δf) and THD of voltage and current waveforms [45,46]. In this study, the quantity of dTHD/dt is considered for adequate discrimination of ferroresonance from disturbances in power quality issue due to existing electronic devices in renewable energy resources. Protection strategy of distance relay utilizes recognition of ferroresonance of different types by the algorithm to decide the ferroresonance type in which relay setting modification must be implemented during SSR.
The algorithm measures fundamental component, and true rms values of voltage and current. Thereafter, the applicable quantities for the algorithm like Z, dz/dt and Z true rms are precisely calculated. In addition to measured and calculated quantities, it is noted that, previous relay setting quantities are considered by the algorithm prior to real-time measuring and calculating above-mentioned quantities. In order to modify characteristic of the protective zone the algorithm changes the centre of the circle to relocate the characteristic in designated situation based on protection strategy requirements. Previous relay setting quantities are retrievable when SSR and specified type of ferroresonance are not detected or Z ≤ Z critical specified in the flowchart, is fulfilled.

Structure of the protection strategy
As was stated beforehand, protection strategy of distance relay determines behaviour of the relay based on consideration of stability and availability of power sources in the network during SSR condition. In this section, structure of the protection strategy based on behaviour of the relay during SSR and ferroresonance is explained in two conditions by the following paragraphs.

Prevent mal operation of the relay during SSR
As was discussed in advance, SSR and ferroresonance cause increasing the current and consequently decreasing the value of impedance. It also results in power oscillation, which can passes through OSB element of distance relay and block operation of protective zones in case of a short circuit in the system. In some cases, protection strategy requires restriction of trip operation of protective zones during SSR and ferroresonance conditions. Figure 4 shows structure of protection strategy algorithm, which prevents mal operation of the relay in SSR.
Protection strategy logic (PSL) determines some features and setting parameters of the structure based on results of electrical studies, experiences and practical compromises, which specify stability, and necessity of availability of power sources in the network in each condition. By means of the studies, it is also possible to predict consequences of operation or restriction of the relay in different phenomena (for instance in SSR and ferroresonance) to make a correct decision in such conditions. It is notified that explanation of PSL in detail is out of scope of this paper.
In case of pickup operation of the relay along with detection of SSR and ferroresonance, PSL determines the ferroresonance mode, in which setting modification of the relay must be applied. It is clear that the relay picks up when measured impedance become lower than setting value of protective zones. Hence, in order to prevent mal operation of the relay impedance setting values must be modified.
In case of entering impedance locus into each protective zone of the relay the setting modification is activated. It is achieved when measured impedance is greater than Z min specified by PSL. Setting modification can be established by whether changing diameters of the zones or displacing the circles, moreover, blocking operation of the zones can also be the case. However, the preference over modification of setting values of protective zones causes the relay to be responsible to operate in other conditions and impedance locations in effect of evolved faults in the network.
The impedance locus during SSR can be located in zone 1 or 2. The target zone is defined as the zone on which the impedance locus lies. Firstly, new setting value of the target zone is obtained by multiplying the measured value of impedance to pickup decreasing factor (PDF) and safety factor (SF) determined by PSL. In addition, the algorithm is able to change the centre of the circle to locate impedance locus out of the circle. The method of setting modification is chosen based on situation of impedance locus with respect to circular characteristic of the target zone. Then new setting value of another zone and OSB element is achieved so that discrimination margin is adequately considered among both zones and OSB characteristics the same as the condition before occurrence of SSR.
In some cases, in spite of modification of characteristic of the zones, impedance locus lies on the characteristic according to dynamic of the system. In such conditions, PSL decides to increase trip time by multiplying previous time setting to time increasing factor (TIF). Furthermore, PSL may blocks trip operation to prevent mal operation of the relay during SSR.

Prevent restriction of operation of the relay during SSR
Distance relay measures fundamental values of voltage and current to calculate impedance to be considered for operation of protective zones. The value of fundamental harmonic may decreases in severe SSR and ferroresonant states so that pickup condition of the relay may not fulfilled. Whereas, because of significant increasing the true rms value of current the relay has to operate according to PSL. Figure 5 shows structure of protection strategy of the algorithm to prevent restriction of the relay in SSR and ferroresonance. True rms value of measured impedance may decreases from a critical value (determined by PSL) in presence of ferroresonance due to SSR and causes lack of relay operation. In such condition, the algorithm increases pickup setting by multiplying the measured fundamental value of impedance to pickup increasing factor (PIF) and SF to operate the relay. As shown in Figure 5, PIF is calculated based on the ratio of measured value of fundamental impedance to true rms value of impedance. The algorithm is also able to change the centre of the circle to locate impedance locus into the circle. The method of setting modification is chosen based on situation of impedance locus with respect to circular characteristic of the target zone. New setting value of another zone and OSB element must be determined so that discrimination margin is obtained between both zones and OSB characteristics the same as the condition before occurrence of SSR.
In case of pickup operation of the target zone due to setting modification, PSL decides to decrease trip time by multiplying previous time setting to time decreasing factor (TDF). In some cases, in spite of modification of characteristic of the zone, impedance locus lies out of the characteristic according to FIGURE 5 Structure of protection strategy to prevent restriction of operation of distance relay dynamic of the system. In such conditions PSL may decide to force trip operation. Figure 6 shows an example of shifting method of setting modification of protective zones and OSB element. As was shown in Figure 2, impedance swing in n < 1 passes through OSB element and zone 2 of the relay during SSR and ferroresonance. In order to prevent blockage of the relay due to activation of OSB element, protective characteristics and OSB element are shifted upward so that impedance trajectory is located out of the OSB element. Therefore, the relay remains available to operate in case of any kind of fault in the network.

Introduction
Smart grid utilizes renewable energy resources like, wind farm and solar energy to supply local consumers. Figure 7 shows A 400 MVA wind farm, which is modelled by a DFIG in PSCAD/EMTP software [28]. It comprises a two-mass Wind turbine and a generator, which is connected to the HV system by a 230/13.8 kV 500 MVA power transformer. The DFIG employs AC/DC converters, which are connected to rotor and stator windings to output power at stable voltage and frequency in variable wind speed condition. In this section, impact of SSR in the system is investigated on electrical and mechanical quantities of DFIG. Then, operation of distance relay with OSB element is assessed in SSR condition.

Impact of SSR on operation of DFIG
Utility system comprises a 230 kV double circuit transmission line with a length of about 500 km. the line including three individual sections, which are interconnected through substations. All three sections are compensated by individual capacitor banks. Table 2 lists the values of reactance and capacitance in each section [28]. As stated in [14], series capacitors are generally protected by Metal Oxide Variable resistors (MOV) against overvoltage. Series capacitors in this study are equipped by MOV with V-I characteristic presented in Table 3.  Where: V base is 230 kV Occurrence of a fault in series compensated 230 kV system causes initiation of SSR phenomenon in the network. In order to analyse operation of DFIG and distance relay during SSR a three-phase short circuit fault is simulated in the time of 1 s from energizing and cleared after 0.2 s. Compensation level is adjusted to 75% in all capacitor banks.
The value of F er is dependent on existing elements in the network. As stated in formula (10), it causes emerging slip frequency (f r ), which may coincide with one of natural frequencies (f n ) of wind turbine. Rotor of DFIG includes a 2-stage turbine, generator and exciter. Table 4 shows Inertia constant, shaft stiffness and natural frequencies of the rotor [28].
Eigenvalue analysis is now utilized to calculate natural frequencies of the DFIG shaft. These frequencies are categorized in 3 torsional modes as illustrated in Figure 8 [28]. Current Torsional modes of DFIG in wind farm

FIGURE 9
Frequency spectrum of current waveform in DFIG during SSR waveform is deviated from sinusoidal form due to occurrence of ferroresonance along with SSR in the network. It comprises sub harmonic components, which flow in DFIG stator winding.
As shown in Figure 9 [28], the current waveform includes a sub harmonic component with the frequency of about 24 Hz and magnitude of about 50%. In fact, this frequency is f er , which is emerged in the system at fault inception time. Thereafter, slip frequency f r = 60 − 24 = 36 Hz, which is obtained from formula (10) is induced in the DFIG rotor and coincides with natural frequency (mode 2) of rotor shaft as evidently shown in Table 3. Figure 10 shows oscillation of electrical quantities of DFIG after clearing the fault and occurrence of SSR in the network. Swing frequency of voltage significantly increases in the time after 6 s from energizing. It is evident from the graph that after this time, slip frequency increases remarkably, so that both active and reactive powers follow oscillation of voltage in wind farm.
As shown in Figure 11, waveforms of voltage and current are misshaped markedly in both utility system and wind farm. The magnitude of line to ground voltage in utility system and wind farm grows up to 298 kV pick and 19.7 kV pick respectively.
Occurrence of SSR in wind farm brings about a significant rise and oscillation in mechanical parameters of DFIG. Torsional displacement of masses is results of increasing mechanical torque on the shaft. Figure 12 shows torque on shaft, which experiences a remarkable increase up to 1.34 pu. Deviation of mechanical position of turbine with respect to generator follows the same manner as mechanical torque and increases up to 0.3 • . As shown in the graph, mechanical speed of the turbine experiences considerable fluctuations during SSR. It decreases to 164 rpm with respect to rated speed in duration of about 6 s from the beginning of oscillation due to SSR. Then, this parameter increases gradually up to 15 rpm above rated speed. Consequently, it is clearly evident from the information provided that excessive increment of mechanical parameters of DFIG causes catastrophic and irreplaceable mechanical damage to the shaft.

Impact of SSR on Operation of Distance Relay with OSB Element
As was discussed in advance, and illustrated in Figure 10, SSR leads in oscillation of power with a swing frequency of about 1.5 Hz and then with an increasing value of about 9 Hz in the time of 6 s from the beginning of SSR. As shown in Figure 13 [28], Impedance loci traverse across protective zones and OSB element of distance relay. As a result, protective zones are blocked in effect of activation of OSB element. On the other hand, if slip frequency due to SSR is out of operating range of OSB element protective zones are not blocked and consequently cause false operation of the relay whereas any fault does not occur in reach of the relay. It is noted that, the ratio of n = E DFIG E Grid determines diameter and location of the impedance circles.

IMPLEMENTATION AND EXAMINATION OF ADAPTIVE ALGORITHM OF DISTANCE RELAY IN SSR
Theoretical aspects of adaptive algorithm for distance relay against SSR were expressed in Section 3. In this section, the algorithm is implemented in the relay and then is examined in presence of SSR by PSCAD/EMTDC simulation software.

Implementation of structure of the algorithm
As was shown in Section 3, the adaptive algorithm includes variety of components like; electrical resonance frequency calculation, SSR, out of step and ferroresonance detections, in addition, protective zones and OSB element setting modification. Functionality of the components is explained as below.
As a practicable solution, detection of electrical resonance frequency (f er ) of the system can be possible through filtering the current signal by means of a low pass filter in range of 5-50Hz below power frequency as was shown in Figure 3. In case of detection of any sub harmonic components the quantities of ISHNR, ISHFR and ITSHD are calculated to recognize SSR. If these quantities exceed from threshold values of 6%, 13% and 100% respectively and persist up to 100 ms or 10 OPS, SSR is considered to be detected.
The algorithm is equipped with ferroresonance detection component to discriminate ferroresonance waveforms from other waveforms due to existing electronic devices and nonlinear abnormalities in the grid. To do so, wavelet and neural network are utilized to achieve the purpose. Firstly, neural network has to be trained to cluster variety kinds of waveforms into designated class. Training course is implemented during commissioning term. In this term, the patterns respecting different classes specified in Section 3 are entered into the algorithm. Daubechies (db) mother wavelet decomposes the signals into six levels of approximation and detail information. Thereafter, neural network is trained and classifies patterns in designated class. At the end of training course, the algorithm is put into operation mode. In case of occurrence of ferroresonance or other abnormalities neural network recognizes ferroresonance based on patterns and designates the input signals to related classes.
The algorithm detects ferroresonance of different types by measuring the values of THD and Δf. To accomplish this, some analogue and digital elements like; comparator and derivative elements and logic gates are evoked from the software. In case of detection of any type of ferroresonance during SSR, relevant command signal is sent to protection strategy. It is responsible to determine the type of ferroresonance in which relay setting quantities must be modified. Protection strategy receives measured impedance value and previous relay setting quantities to consider pre-fault condition and make a decision on behaviour of the relay in SSR condition.

5.2
Implementation of structure of the protection strategy As was mentioned in advance, protection strategy determines behaviour of the relay in case of SSR and ferroresonance based on threshold values, which are obtained by protection strategy logic. Protection strategy is implemented in the software by means of logical and computational elements to modify distance relay setting quantities as described in Section 3. SR flip flap, comparator and logic gates are utilized to perform structure of the protection strategy. Threshold values, increasing coefficient values of PIF, TIF and decreasing coefficient values of PDF, TDF are determined by protection strategy logic. Nevertheless, they are considered as constant values in this study to perform an example of setting modification.

Examination of the algorithm in the relay
In this section, functionality of the adaptive algorithm implemented in distance relay is examined in SSR condition explained in Section 4.2. Firstly, pattern signals respecting ferroresonance and other possible abnormalities are entered into the algorithm to train neural network. As shown in Figure 14, the signals are decomposed into six levels of details by wavelet. Then Neural fitting tool with Levenberg-Marquardt training algorithm and hidden Layer Size 10 is utilized in training validation and testing terms to evaluate performance of the network. As shown in Figure 15, the best validation is 0.188 52 obtained at epoch 130 [28]. Thereafter, the algorithm is put into operation and performs real time monitoring of the signals to distinguish ferroresonance condition.
As was shown in Figure 9, sub harmonic with the frequency of 24 Hz and magnitude of about 50% is achieved at compensation level of 75% detected at the instance of short circuit fault in the network. The magnitudes of ISHNR, ISHFR and ITSHD rise up to threshold values for a period more than 100 ms. Protection strategy logic is responsible to determine pickup values of these quantities according to results of the electrical studies performed on the network. These values are considerably high in this example to detect SSR condition in the specified time.  Occurrence of ferroresonance during SSR causes deviation of current waveform, which is recognized by neural network. Figure 16 shows detection of ferroresonance of different types. As shown in the graph, frequency deviation and THD increase considerably at the time after 6 s, hence, fundamental and harmonic ferroresonance modes are detected. Thereafter, due to ever-rising magnitude of Δf, THD and consequently dTHD/dt, harmonic ferroresonance is mostly prominent. This is the evidence of remarkable deviation of current waveform due to ferroresonance.
As was illustrated in Figure 13, impedance loci traverse across protective characteristics and OSB element of distance relay during SSR condition. Hence, protective zones are blocked in effect of activation of OSB element. In this condition, protection strategy decides to displace situation of OSB elements and subsequently protective characteristics to prove the relay capable of responsible to variation of impedance due to probable short circuit in other areas of the impedance diagram. As illustrated in Figure 17, protective zones and OSB elements  are placed upward in impedance diagram and consequently impedance loci does not pass through the characteristics in SSR condition. Furthermore, diameter of zone 2 decreases to provide a margin at the load impedance.
The algorithm is examined at different compensation levels to attain other modes of natural frequencies to certify the correct operation. To do so, the inductance value of the lines (XL) is remained constant, then by changing compensation level and consequently XC the value of f er is changed and causes variety of natural frequency modes as illustrated in Table 5.
As shown in flowchart of Figure 3, the algorithm is able to recognize f er in a range of 5-50 Hz by mean of low pass filter, so that it covers detection of all three natural frequency modes. As was discussed in advance, the threshold values of criteria to detect SSR and ferroresonance and then modification of relay setting quantities are determined by PSL, which is dependent on the results of electrical studies in the network. Hence structure of the algorithm is able to support variety range of oscillation modes and ferroresonance of different kinds.
The algorithm is also examined through simulation of both internal and external faults especially during ferroresonance and SSR conditions (capacitor banks are in service) to certify sensitivity and security of the relay respectively. A three phase fault is located far from protective zones of the relay as an external  Figure 18(a), the relay remains stable against external fault; nevertheless, as shown in Section 4, occurrence of a fault can initiate SSR condition. In case of clearing the fault by other protective relays in the system there is risk of oscillation of power due to SSR condition. In such conditions the algorithm detects SSR and probable ferroresonance conditions and then acts to modify setting quantities as explained beforehand. Figure 18(b) shows occurrence of a three phase fault, which is located in zone1 of the relay and is considered as internal fault. The relay is activated to clear the fault, whereas this fault can initiate the SSR condition and power oscillation. Similarly, in case of detection of any SSR or ferroresonance conditions, the algorithm recognize the status and then acts to modify setting quantities as explained beforehand.
Regarding implementation of the relay with adaptive algorithm in a real power system some special considerations must be taken as follows. As was discussed in advance, PSL requires results of electrical studies, to determine behaviour of the relay in SSR and ferroresonance condition. Ref. [47] introduces universal protection software, which performs real-time electrical studies in the network to design protective system based on protection design criteria applicable to both traditional network and smart grid. This software is also able to consider impact of fault ride-through on wind turbine examined in various fault and abnormal scenarios in the system. Hence, a practical power system requires incorporation of such analysis software with variety of adaptive algorithms designated to protective relays.
Another concern respecting implementation of the relay in a real power system is capability of the algorithm in speed of the analysis and data reporting rate. Generally, speed of the data communication between above-mentioned analysis software and the relay and also modification of setting quantities must be high enough to address critical clearing time (CCT), which is calculated by the analysis software. In other word, the protective relay must be in new setting quantities before CCT becomes elapsed to maintain stability of the system in abnormal conditions.

CONCLUSIONS
Mal operation of distance relay due to occurrence of SSR and ferroresonance in the system decreases reliability of protective system. Hence, an adaptive algorithm is designated for distance relay to modify setting quantities of the protective characteristics and OSB element during SSR and ferroresonance. Protection strategy of the algorithm is responsible to determine setting quantities of distance relay in smart grid based on results of electrical analysis on the network accomplished by protection strategy logic. Therefore, adequate setting quantities are issued by protection strategy logic in this condition. Protection strategy changes setting of the relay so that behaviour of the relay is determined in SSR condition. Functionality of the algorithm has been examined in different network configurations and ferroresonant states. It is certified that the algorithm is responsible adequately respecting increasing and decreasing relay setting quantities to comply with protection strategy of smart grid. Finally, a demerit respecting the current version of the algorithm is response time based on CCT as discussed in the last paragraph of Section 5.3. It requires closer investigations regarding incorporation of protection and analysis software and the proposed algorithm in variety of power system configurations to certify the correct operation and address required stability of the grid. This is considered as future work respecting adaptation of distance relay with OSB element.