1 Introduction

MODELS have being used for a long time in all engineering areas as a way to reproduce the real system in a safe environment. In electrical engineering, Electromagnetic Transient Programs (EMT) [1] provide an adequate environment to simulate power systems. Models can become very complex and several studies have been conducted to analyze the situation in which each component of a model should be used, as in [2].

Within the power system, building controls and relays are of great importance [3]. As a result, the study of models became a point of interest and several modeling techniques can be found in the literature [4,5,6]. The techniques vary according to the software in use, such as ATP [7] or Matlab [8], and according to the purpose in question, such as teaching [9].

With the advent of real-time simulators, the search for models increased [10]. Real-time digital simulators, as RTDS [11], brought new perspective to the study of power systems, to the development of several relay models [12], and to the search of ways to interact with them [13].

Real-time simulators make engineers to save time and, more importantly, increase the range of analyzed data. Despite all predicting capability of a test, there are still many aspects that have to be considered, especially in the case of protection equipment used in complex power systems. Changes and expansions in the system configuration are frequently necessary, and new transmission lines, power transformers, and generators are constantly installed. It is very important to define how to analyze the system expansion along with the existing equipment and notably how to analyze the impact of the modifications in the equipment already in operation.

The main proposal of real-time studies is to connect the equipment that is being tested to the hardware running the modeled power system. However, connecting dozens of equipment devices to the system under analysis is a very complex task. Besides the necessity of many amplifiers and digital and analog interfaces in the real-time hardware to all equipment connections, the time itself to connect all protection assets would substantially increase the test cost and the complexity of the system under test, leading also to a higher probability of failure.

The facts mentioned above and the intention of promoting more reliable protection tests brought the need to add actual/commercial protection relay models to real-time simulators into existence. As mentioned before, apart from the possibility of analyzing the new equipment, which will be completely tested from hardware to software, with the models, it is also possible to analyze the response of the existing surrounding relays in the power system near the new equipment.

In several countries, such as Brazil, a national electrical grid database is available containing data from main transmission lines and equipment and holding quite complete control models for HVDC and FACTS. However, the same type of information is not available for protection relays.

There are some basic relay models available in the RTDS and they can be used for learning purposes, but these models normally only present the relay’s basic characteristics. The existing built-in differential transformer relay model is very simple and presents only the basic differential element and a second harmonic blocking. Nevertheless, the new generation of commercial relays [14] contains several algorithms which can enhance the relay performance with more than one differential element, harmonic blocking, and harmonic restraint algorithms. With the intention of enhancing real-time tests, the development of real relay models in the power system simulation is proposed in [15].

Reference [16] proved that it is possible to build precise and accurate models. Therefore, based on [15], this work presents the step-by-step development of the differential protection element model. In the present paper, the other protection elements of multifunction SEL-787 relay were not included, although they could also be implemented using the presented methodology. In the following sections, some aspects of the modeling are described and the performance of the model is analyzed for different situations that interfere in the relay daily operation in the field. Important parts of the development presented could be used to develop other protection elements models.

It is also important to notice that although this work presents a model validated against a relay of a specific manufacturer, it can be expanded to other manufacturers, allowing future increase in the number of models available and accumulation of knowledge about real relays.

2 Subsystems of a typical relay

To build a digital relay model, it is necessary to accomplish the following steps. First, the relay needs to be connected to the power system. Digital data from the system, such as circuit breaker status or even analog data, such as CTs and PTs, can be connected in the traditional way through wires or even through Ethernet, such as IEC 61850.

Fig. 1
figure 1

Relay diagram

The steps to model the relay are:

  • reduce the signals level to a range adequate for the analog-to-digital (A/D) converter;

  • reduce the signal noise level and assure the non-aliasing of the signal (Nyquist theorem) by applying a low-pass filter;

  • convert from analog-to-digital data;

  • sample the signals at a specified rate;

  • convert the sampled signals to a binary code, making the signal understandable to the microprocessor;

  • decompose the signals into frequencies to calculate the phasors;

  • feed the protection algorithms with the appropriate data.

Although it depends on the manufacturer and on the application of the relay, a digital filter is commonly used to isolate an important signal at a desired frequency. Figure 1 shows these steps.

Studies, such as [10, 12, 16, 17], have already worked with real-time simulator, but none of them modeled all the steps to build an actual relay model or compared the model to the real relay regarding precision and, more importantly, response time.

3 Differential element

There are many types of algorithms, and consequently, many different ways to build them for one same purpose. Among transformer differential relays, there are high impedance relays and low impedance relays, the latter being the most used type. This type has many operation principles, such as fixed pick-up, one slope, two slopes, among others. The most commonly found is the two slope relay, and once again, there are different characteristics among relays of this type, as can be seen in Fig. 2. In addition to the main protection algorithm, the differential relays also need other parallel algorithms for transformer inrush, over-excitation, and angle compensation, as shown in [18].

Fig. 2
figure 2

Differential relay characteristics

As mentioned above, these algorithms can be implemented in many different ways. To analyze the different responses, the differential algorithm from SEL-787 relay and from the built-in RTDS model was compared.

The commercial relay and the proposed model characteristics are:

  • two-slope differential;

  • unrestricted instantaneous differential;

  • cross-blocking harmonic mode with the second and fourth harmonics;

  • harmonic restraint with the second and fourth harmonics added to the restraint current;

  • over-excitation blocking element based on the fifth harmonic;

  • angle compensation with 13 options [14].

The built-in model characteristics are:

  • two-slope differential;

  • unrestricted instantaneous differential;

  • Non-crossing harmonic blocking mode with only second harmonic;

  • Angle compensation with three options.

4 Implementation

This section describes the development of the proposed model inside the simulator.

The first step was to represent the low-pass filter, which can be built with a difference equation, as shown in (1), using constant values and buffers. However, the simulator’s library includes a component for this filter and that is what was used:

$$\begin{aligned} y\left( k \right)= & {} B_0 x\left( k \right) +B_1 x\left( {k-1} \right) +B_2 x\left( {k-2} \right) \nonumber \\&+\,A_1 y\left( {k-1} \right) +A_2 y\left( {k-2} \right) \end{aligned}$$
(1)
  • x \(=\) Input signal,

  • y \(=\) Output of the Butterworth filter,

  • k \(=\) Most recent sample.

For a second-order Butterworth filter with cut-off frequency of 640 Hz and processing time of \(50~{\upmu }\hbox {s}\), the constants are:

$$\begin{aligned}&A_{1}=1.717212,\quad A_{2}=-0.752516 \\&B_{0}=0.008826,\quad B_{1}=0.017652,\quad B_{2}=0.008826. \end{aligned}$$

Figure 3 shows the programmed processing signal steps inside RTDS.

After filtering, the analog values must be converted into digital values. The simulator has a component for data sampling, but there is no component that can appropriately represent the A/D converter. RTDS allows the user to build his own component and this function was used to model a component to represent the A/D converter. This block has two functions: it represents the sampled signal according to the microprocessor resolution (based on the number of bits) and it includes the maximum value that the microprocessor can work with. An A/D converter of 16 bits was used and as the nominal frequency of the system is 60 Hz, the model sampling frequency was of 1920 Hz. For a system in 50 Hz, the sampling frequency has to be adjusted to 1600 Hz or resampled.

Fig. 3
figure 3

Simulator programming

After the A/D converter, the next step is the extraction of each harmonic for future use in the protection algorithms. The differential relay under analysis has digital filters that extract the fundamental frequency and the second, fourth, and fifth harmonics. Filters usually have two elements in quadrature to extract the real and imaginary parts of the phasor. However, as the commercial relay used only had a cosine filter (phasor real part), rather than using a sine filter, the output of the cosine filter was delayed by 1/4 cycle, as presented in Fig. 3. As it was necessary to extract more than the fundamental frequency, this process was performed for each harmonic of each phase of each winding. The buffer must lag 1/4 cycle for each frequency, which means eight samples for fundamental frequency and four samples for 120 Hz.

In Fig. 3, the signal “pulse” informs the filter the exact moment to take the new sample and runs the buffer. The control of the signal “pulse” depends on the manufacturer and on the presence of a frequency-tracking element, as presented in [13]. For a differential relay, the frequency tracking can be disregarded, since any error \(\varepsilon \) due to frequency in one side will also appear in the other side and they will be cancelled in the operation current (2):

$$\begin{aligned} I_{{\mathrm{OP}}}= & {} |{\overrightarrow{{I^{\prime }}}_{1} + \overrightarrow{{I^{\prime }}}_{2}}| \nonumber \\= & {} I^{\prime }_{1} - I^{\prime }_{2}\nonumber \\ I^{\prime }_{1}= & {} I_{1} + \varepsilon \nonumber \\ I^{\prime }_{2}= & {} I_{2} + \varepsilon \nonumber \\ I_{\mathrm{OP}}= & {} I_1 +\varepsilon -I_2 -\varepsilon =I_1 -I_2. \end{aligned}$$
(2)

Finally, the output signal of the band-pass filter needs to be downgraded to rms value and corrected to pu value, as shown in Fig. 3.

The outputs of each filter of each frequency are the phasors, but the data are still not ready to be used in the protection algorithms. Because of the angle difference between the primary side and the secondary side of the power transformer, the phasors need to be compensated. To accomplish this step, it was necessary to develop a new component. A commercial relay has all possible compensations, as shown in [14, 18]. A new component was built to provide the same options as the relay and a setting to allow phasor compensation for ABC and ACB rotation was created to improve the component flexibility. In addition, both the input and output can be used as the rectangular or polar form of complex numbers, as shown in Fig. 4. However, it is important to emphasize that to run in real time and to solve the system equations in \(50~{\upmu }\hbox {s}\) or less, the rectangular form should always be used.

Fig. 4
figure 4

Matrix compensation component

The C code can be seen in the Appendix and all 13 matrix options can be seen in [14] or [18].

After the transformer compensation, the differential algorithm can be implemented and it is possible to calculate the operation and restraint currents with these compensated currents, as shown in Fig. 5.

Fig. 5
figure 5

Differential current calculation at the same pace as the relay

RTDS usually processes the whole system at \(50~{\upmu }\hbox {s}\), but this is not the relay processing time. To reproduce the same behavior of the relay processing interval, an S/H (sample and hold) component was used after calculating the operation and restraint currents. This element has the main function of giving the model the same pace as the real relays. In an offline model, this step is not important, but for a real-time model, this step is of paramount importance, although it has never been mentioned in the literature. Notice that, before this element, the model processing time and the samples are at the same speed. After the element, the proposed model is at the same pace as the hardware. Without this element, the model would take decisions at every sample time step and it would be much faster than the real relay. Again, this step is of major importance to achieve the same time responses as the real relays. Reference [17] states that the time step can change the model response and the main reason for that is the lack of the described control.

In possession of the restraint and operation currents and having established the correct pace, the next few steps are quite straightforward. It is just necessary to develop the slope and harmonic comparisons, and as mentioned before, this is not the main purpose of this article.

The last element in the model, the real relay physical output contact operation time, was adjusted as specified by the relay manufacturer, giving the model a much more realistic response time.

5 System and test description

All tests were performed in a system, as shown in Fig. 6. The system data are presented from Tables 345, 6, 7, 8, 9, and 10 in the Appendix. In this system, it was possible to run external and internal faults to the differential section and internal faults to the transformer, among others, as listed in Table 1. The CT burden resistance was increased to force saturation.

Fig. 6
figure 6

Single-line diagram

A total of 1190 tests were run, and each test was simultaneously applied to the real relay, to the proposed model, and to the built-in model.

6 Results and analysis

This section describes the two main performed analysis: proposed model versus real relay and built-in model versus proposed model. To avoid repetitiveness, some results are only exposed in the text and only some graphics are shown to exemplify the analysis.

All time results are presented in cycles of 60 Hz, and they represent the difference between the response times of the two signals under analysis. When a trip or a signal is called false, it means that the two signals under analysis did not agree in the pick-up response. When they are called true, it means that the signals agreed. It is very important to notice that the objective of the present analysis is to identify whether the models reproduce the performance of the physical relay or not, and it does not matter if the operation is correct from the protection point of view.

Table 1 Fault classification

All false operations were analyzed and false operation caused by measurement errors lower than 5% were considered acceptable. This error value is specified in the instruction manual [14].

6.1 Real relay \(\times \) proposed model

The difference between the real relay and the proposed model is analyzed in this section. The following signals were monitored regarding the pick-up and response times:

  • TRIP—trip signal, or combination of 87HR, 87HB, and 87U;

  • 87HR—harmonic restrained differential;

  • 87HB—harmonic blocking differential;

  • 87U—unrestricted differential;

  • 24HBL—second and fourth harmonic blocking;

  • 5HBL—fifth harmonic blocking.

Figure 7 shows the overall pick-up response of the model compared to the relay response. Less than 0.1% of the tests had a false trip, and there were only five false operations of the trip elements (87HR, 87HB, and 87U), representing less than 0.5% of all tests.

Analyzing these cases, it was observed that the pick-up happened almost when the circuit breaker opened. The simulated circuit breaker (CB) was allowed to open just 200 ms after fault inception to observe the full response of the relay and of the proposed model. Therefore, it can be concluded that this event would not happen in a regular test when the CB would act faster. Moreover, the difference between the level of the fourth harmonic, I3H4, and the operation current, IOP3, was less than 2%, which is within the relay error band. As a result, the cases were considered approved, Fig. 8.

Fig. 7
figure 7

True/false operations—relay \(\times \) proposed model

Fig. 8
figure 8

Level of fourth harmonic—inrush with fault

It is also possible to observe false operations of the second and fourth harmonic blocking element. They happened in some external faults and sympathetic inrush cases and they occurred in a little more than 2% of all cases.

During the analysis, it could be verified that sometimes, the relay picked-up, and at other times, there was a model pick-up, what demonstrates no biased response of the proposed model. This same behavior can be observed in relays of a same manufacturer and it happens because of time-processing differences related to the acquisition time and because of measurement errors. In all cases in which the model picked-up, the second harmonic level, I2H2, was above the operation current, IOP2, as it can be seen in Fig. 9, but the second harmonic element did not achieve the minimum pick-up level. In the proposed model, a minimum pick-up level was used and it probably was set differently from the level of the actual relay, which could not be obtained from the manufacturer. When working with models from manufacturers, some differences are expected because of data confidentiality [17]. In this case, they had no important impact on the final results.

Fig. 9
figure 9

Difference in the 24HBL behavior—external fault

There were also false operations of the fifth harmonic blocking element. Again, pick-ups from the relay were observed and sometimes also from the model, usually within one processing time interval. In spite of any interference of the fifth harmonic element in the protection results, these cases (more than 6%) show that there is room for future improvement of the proposed model.

Analyzing the model response time, in Fig. 10, it can be concluded that it was very close to the relay response, with more than 98% of all protection variable cases within a difference lower than one cycle.

It was also noticed that, when the differences appeared in the model, the pick-up was sometimes from the model and sometimes from the relay, confirming that the model is not biased and that it is running very similarly to the real relay, even for the fifth harmonic blocking element.

Fig. 10
figure 10

Response time—relay \(\times \) proposed model

6.2 Built-in model \(\times \) proposed model

Because of the simplicity of the built-in model, it was just possible to compare the signals of the blocking differential element, 87HB, and of the second harmonic blocking element, 24HBL.

Fig. 11
figure 11

True/false operations—proposed model \(\times \) built-in model

Figure 11 shows the overall result for pick-up operations. The differential element presented 2.5% false operations. It is an acceptable percentage in the overall result. Giving each case a closer look, it is possible to notice that the built-in model behaved as expected for external faults and energization tests, cases in which non-operation is expected. However, examining cases in which a trip is expected, the behavior differences between the built-in model and the proposed model were significant, as can be seen in Table 2.

Table 2 Cases of internal faults—proposed model \(\times \) built-in model

For the second harmonic blocking element, the overall false operation ratio reached almost 10%, which is a high value. For some specific cases, the results were much more severe: for sympathetic inrush, the false operations reached 53% and for saturation cases, more than 15%.

Fig. 12
figure 12

Response time—proposed model \(\times \) built-in model

Nevertheless, the major difference between the two models was presented in the response time. Figure 12 shows that less than 80% were within one cycle. It was noticed that the built-in model is in general faster than the proposed model and that can be explained by its calculation speed. The built-in model was not developed to emulate a real hardware, which means that it is running every RTDS step. In addition, there is no delay time representing the output contacts. In the false operation of the two signals under analysis, the presence of a biased behavior was noticed in all the cases in which the built-in model picked-up and the proposed model did not pick-up.

The behavior of the second harmonic blocking element can be explained by this element’s simple sensor in the built-in model, whereas the proposed model has a minimum fundamental sensor and a minimum operating sensor. In addition, the proposed model is based on the second and fourth harmonics.

7 Advantages of the model

In a real relay, users only have access to the tools made available by the manufacturer. In a model, every single step of its development can be accessed, allowing complete understanding of the modeled relay and of its modeling. In this section, a selection of different graphics is shown, and they are only available in the proposed model.

The real relay can provide users with regular data, such as input currents or the final differential calculation. The model can supply much more to the user. In Fig. 13, it is possible to see the input signal, IAW1s, the output of the analog filter, IAW1lp, and the sampled signal, IAW1sp. A real relay does not show the input signal, and it shows only the signal immediately after the sampling process, IAW1sp. From Fig. 13, it is also possible to see the analog filter delay, for example. In a real relay, this processing is analog and impossible to display.

Another interesting signal is the digital filter output. As seen before, after this filtering, there are two available pieces of information: the real and imaginary parts of the phasor. In a real relay, when available, the magnitude of the phasor can be obtained, whereas in the model, it is possible to plot each and every quantity, as shown in Fig. 14.

In a relay, there is not much information available about harmonics. In the model, there is information available not only for the fundamental signal but also for the harmonics. Figure 15 shows the output of the second harmonic filter for a transformer internal fault.

Fig. 13
figure 13

Input signal, low pass, and sampled outputs

Fig. 14
figure 14

Phasor quantities

Fig. 15
figure 15

Output of the second harmonic filter during a fault

The information mentioned in the previous paragraphs is important to users in general, but mainly to application engineers.

This type of model can be used for pre-settings or when the real hardware is not available for testing. It can be useful to manufacturer trainings, to the formation of new engineers, and also as a platform for the development of new algorithms.

Engineers can use the model not only to verify if the relay presented a correct or false operation, but also to analyze the operation’s margin.

If the model is built as described in the paper using RTDS components, the processor usage is very high. Two PB5 processors were used, what means that it is impossible to use many models such as this one in a real simulation. To overcome this drawback, the model has to be transcribed into C language and, with use of multi-thread coding, it can run in a few micro-seconds.

8 Conclusions

This paper described a commercial differential transformer relay element model developed inside the real-time digital simulator. The use of accurate models in the real-time simulator allows the study of not only one physical relay but also of the complete surrounding protection system. In addition, the performance of the proposed model was analyzed for different situations that interfere in the relay daily operation. The performance of the proposed model was compared to a real relay and to a built-in model. All necessary informations for the reproduction of the model are provided in the paper.

The model was based on SEL-787 relay and it presented a similar behavior to the real relay (hardware) behavior. There was less than 0.1% difference in the trip responses and they happened only because of the long opening time of the circuit breaker. Nevertheless, these errors were within acceptable measurement error. Almost 98% of all trips happened at the first cycle, what can be considered a very good performance as all filter algorithms need at least one cycle to reproduce the real rms/phasor value.

Based on the simulations, it was shown that built-in models can give engineers a view of the behavior of the differential element, but they do not provide full support for a precise decision. Less than 80% of all trips had a time difference lower than one cycle and some had a time difference larger than four cycles. These cases usually happened at critical faults, thus implying that it would be too risky to use generic models to represent real relays in simulations.

It can be concluded that the proposed relay model reproduces the physical relay with high fidelity not only representing the protection elements but also regarding response time, which is frequently neglected in the available models. The model could be used in a real-time simulation study to represent the surrounding relays, hence giving more reliability to the test.

As a final remark, it is also important to notice that a model such as the proposed one can provide users with more tools to analyze protection algorithms behavior during faults. They can also be used for educational purposes, for training and even for a relay pre-setting. Besides, the building steps of the proposed relay described in this paper could be used during algorithm development of other protection functions and for relay models of other manufacturers.