Design and Analysis on an Optimized Interface Algorithm for Real-Time Integrated Simulation System of Renewable Energy and the Power Grid

: The interface algorithm is critical for accuracy of the real-time integration simulation system of renewable energy and the power grid. To improve the overall performance of the existing interface algorithms, this paper proposes an optimized interface algorithm based on the auxiliary damping impedance method interface current feedback. We explain in detail the implementation principle of the new interface algorithm and the calculation method of impedance matching and also provide a parallel timing control logic. Using the new interface algorithm, we derive equations for voltage and current of the digital simulation system side and the device under test side and also compare it with the naturally coupled system without interface delay. Finally, we verify the accuracy of the new interface algorithm via establishing a complete model of the real-time integration simulation system with a wind turbine and the power grid. The results show that the accuracy can be improved 95% in the digital simulation system side and 17% in the device under test side by using the proposed interface algorithm in this paper.


Introduction
With the large-scale development of renewable energy, such as wind power and photovoltaic power generation, the reliability and stability of the integration with renewable energy and the power grid is becoming more and more important [1,2]. Considering fluctuation of the renewable energy, the real-time reliability of renewable energy power-generation units must be fully tested and verified on the ground before being connected to the real power grid. The most important and effective method of doing this is conducting a full and complete integration test under various simulated grid conditions using a grid simulator on the ground.
The traditional grid simulator is mainly based on the power electronic converter, which can only simulate some specific grid faults such as high-and low-voltage faults, harmonics and frequency changes, and so on [3]. However, it cannot simulate real-timely actual grid characteristics and the interactive characteristics of the renewable energy and the power grid. Recently, real-time integrated simulation system (RTISS) with renewable energy and the power grid based on power hardware-in-the-loop (PHIL) technology is becoming a hot topic of research in renewable energy areas [4][5][6]. Using PHIL technology, the digital simulation system (DSS) and the device under test (DUT) are connected by an interface unit composed of interface hardware and an interface algorithm to form a close loop RTISS, as shown in Figure 1. The interface algorithm is used for mutual mapping between DSS side and DUT side. The interface To solve above IA problems, Institute of Electrical and Electronic Engineers (IEEE) has set up a working group [10]. The ideal transformer model (ITM) IA and the damping impedance method (DIM) IA are two widely used algorithms in this field [10,11].
Based on the ITM IA, the PHIL system with the wind power and photovoltaic power is implemented in [12,13], but the problem of accuracy and stability of the system due to interface delay and error are not considered.
Yuzhou, Hu, et al. [14] analyzed the ITM and DIM interfaces and pointed out that the accuracy of the DSS side with DIM interface is higher than that of the ITM interface in the case of impedance matching, but the distortion of the DUT side is greater than that of the ITM interface.
There is a small distortion with ITM IA in the DUT side, which means it has a strong load capacity and is suitable for high-power applications.
Based on the characteristics of the strong load capacity of the ITM IA, the MW-level PHIL test system is established, and the filter link is added to improve the stability in [15,16]. However, it also introduces delay issues, and the accuracy of the system has not been improved.
The methods of interface time delay compensation and filtering are analyzed for ITM IA and DIM IA in [17][18][19], but the parameters need to be reset for different DUTs and are not fully suitable for a DUT under different conditions.
The interface design methods to enhance the stability of PHIL systems are discussed in [20,21], but these methods are based on passive load networks, which are not suitable for testing active loads such as wind power, photovoltaics, energy storage system, and so on.
The DIM IA for the modular, multilevel, converter-based high-voltage direct current (MMC-HVDC) PHIL system is improved in [22,23]. However, the improved DIM IA based on specific DUT is not applicable to different DUTs.
A composite IA is proposed and the implementation method is described in [24], but the stability and accuracy of the system under long-term operation and high-power application scenarios cannot be guaranteed and the timing control of the composite interface is not given.
Comprehensive literature analysis shows that many scholars have conducted a lot of improvement studies on the currently commonly used DIM and ITM IAs; however, there are still some critical problems, including the versatility of parameter tuning caused by the introduction of compensation and filtering, and the problem of PHIL system loading capacity, accuracy problems, suitability problems for active loads, and so on. The currently used IAs are not well applicable to a RTISS of renewable energy and the power grid, especially in high-power applications. To solve above IA problems, Institute of Electrical and Electronic Engineers (IEEE) has set up a working group [10]. The ideal transformer model (ITM) IA and the damping impedance method (DIM) IA are two widely used algorithms in this field [10,11].
Based on the ITM IA, the PHIL system with the wind power and photovoltaic power is implemented in [12,13], but the problem of accuracy and stability of the system due to interface delay and error are not considered.
Yuzhou, Hu, et al. [14] analyzed the ITM and DIM interfaces and pointed out that the accuracy of the DSS side with DIM interface is higher than that of the ITM interface in the case of impedance matching, but the distortion of the DUT side is greater than that of the ITM interface.
There is a small distortion with ITM IA in the DUT side, which means it has a strong load capacity and is suitable for high-power applications.
Based on the characteristics of the strong load capacity of the ITM IA, the MW-level PHIL test system is established, and the filter link is added to improve the stability in [15,16]. However, it also introduces delay issues, and the accuracy of the system has not been improved.
The methods of interface time delay compensation and filtering are analyzed for ITM IA and DIM IA in [17][18][19], but the parameters need to be reset for different DUTs and are not fully suitable for a DUT under different conditions. The interface design methods to enhance the stability of PHIL systems are discussed in [20,21], but these methods are based on passive load networks, which are not suitable for testing active loads such as wind power, photovoltaics, energy storage system, and so on.
The DIM IA for the modular, multilevel, converter-based high-voltage direct current (MMC-HVDC) PHIL system is improved in [22,23]. However, the improved DIM IA based on specific DUT is not applicable to different DUTs.
A composite IA is proposed and the implementation method is described in [24], but the stability and accuracy of the system under long-term operation and high-power application scenarios cannot be guaranteed and the timing control of the composite interface is not given.
Comprehensive literature analysis shows that many scholars have conducted a lot of improvement studies on the currently commonly used DIM and ITM IAs; however, there are still some critical problems, including the versatility of parameter tuning caused by the introduction of compensation and filtering, and the problem of PHIL system loading capacity, accuracy problems, suitability problems Energies 2020, 13, 4380 3 of 17 for active loads, and so on. The currently used IAs are not well applicable to a RTISS of renewable energy and the power grid, especially in high-power applications.
Considering the disadvantages of the existing IAs, in this paper, we propose a new optimized IA based on the auxiliary DIM interface current feedback, which combines the advantages of ITM and DIM IAs, avoiding their respective shortcomings. Using the proposed new IA, the accuracy of the digital simulation results is significantly improved due to calculation results of the DSS side is not affected by time delay and error accumulation. Apart from that, the accurate command signal obtained by the calculation on the digital side also improves the accuracy of the physical side and the loading capacity under high-power conditions is guaranteed. Thereby the accuracy and stability of the RTISS system as a whole is improved. The remainder of the paper is organized as follows. Section 2 proposes a new interface model and elaborates the implementation method and timing control method of the new IA. Section 3 analyzes the characteristics of the new IA for RTISS. Section 4 verifies the simulation accuracy of the new IA and approaches an example simulation verification study for the RTISS with the high-power wind turbine as the DUT. Section 5 concludes the paper.

Implementation Architecture of the New IA
Considering the practical application characteristics of the high-power, real-time integrated system studied in this paper, the input reference voltage of the power amplifier needs to be accurate, that is, the target voltage waveform of the integrated simulation system must be accurate, so as to reproduce the actual grid characteristics. The current signal error fed back to the grid model should be as small as possible. It can reflect the real-time influence of DUT on the power grid. At the same time, it must also ensure the loading capacity of the interface at a power level on the order of tens of megawatts.
To solve the problems of the current commonly used IAs, in this study, we proposed a new IA based on the auxiliary DIM current feedback. Figure 2 shows the block diagram of the implementation of the new IA.
In Figure 2, i*, u*, and Z* are, respectively, the current, voltage, and damping impedance of the branch port in the auxiliary grid model; i 1 and u 1 are, respectively, the current and voltage of the branch port of the main grid model (u 1 is also called the forward excitation voltage); i 2 and u 2 are, respectively, the output current and voltage of the power amplifier; u s and Z s are, respectively, the equivalent power supply and equivalent impedance on the DSS side of the RTISS; and u p and Z h are, respectively, the equivalent power supply and equivalent impedance on the DUT side.
The operation of the new IA requires establishing two sets of the same grid model in DSS, but the grid simulation output branch is equivalent to the ITM and DIM interfaces, which are called the main grid model (MGM) and the auxiliary grid model (AGM), respectively. Let i 1 = i*, that is, the calculation result of the AGM is fed back to the MGM. The grid simulation branch voltage u 1 of the MGM is calculated in real-time to obtain the forward excitation voltage. The output voltage u 2 is obtained by the power amplifier to perform power amplification, with u 1 as the target voltage. This process is called the forward voltage excitation process, and the delay time is T d1 . u 2 and i 2 are sampled in real-time by the sampling and processing unit (SPU) and are simultaneously input into the impedance matching unit (IMU) and the AGM, respectively. The equivalent impedance can be calculated in real-time by the IMU. According to u 2 and i 2 , i* can be calculated in the AGM accordingly with delay time T d2 . This process is called the backward signals feedback process. The forward voltage excitation process and the backward signals feedback process are carried out simultaneously to form a closed-loop simulation system, thereby accomplishing the simulation of the grid characteristics. be as small as possible. It can reflect the real-time influence of DUT on the power grid. At the same time, it must also ensure the loading capacity of the interface at a power level on the order of tens of megawatts. To solve the problems of the current commonly used IAs, in this study, we proposed a new IA based on the auxiliary DIM current feedback. Figure 2 shows the block diagram of the implementation of the new IA.
Sampling and processing unit (SPU) In the forward excitation process, the target voltage is the output and is connected to the DUT side with the ITM interface equivalent form, which ensures a small distortion and a strong loading capacity of the DUT side. In the backward feedback process, the DUT side feedback signal is input into the AGM with the DIM interface equivalent form. The model calculation results are not affected by sampling errors and delay links in the case of impedance matching, which ensures the accuracy of the target voltage u 1 of the DSS side. That is, using the new IA proposed in this paper to construct a RTISS can effectively improve the accuracy and stability of the system, and the DUT side loading capacity is consistent with the use of the ITM interface.

Real-Time Impedance Matching Calculation Method of the New IA
As the DUT connected to RTISS is generally an active load, and the equivalent impedance changes with the load, the commonly used method of calculating the average impedance cannot achieve real-time impedance tracking and matching. In this paper, referring to the idea of the phasor measurement unit (PMU) technology used in power system monitoring technology [25], real-time matching of the damping impedance is achieved by use of the Thevenin equivalent model to calculate the DUT side equivalent impedance.
When using PMU technology to acquire phasors, the calculation period is usually 10-20 ms, and the real-time requirement is low. The real-time simulation system (RTDS, RT-lab, etc.) used in this paper is used for calculation, and the simulation step is generally set to 50 µs or even smaller. The impedance calculation must be completed within the ultra-short time interval of two simulation steps, and the calculation accuracy must be ensured at the same time. Therefore, if the PMU calculation method is directly applied, there will be numerical stability problems, which will affect the impedance calculation accuracy. To improve the accuracy of impedance measurement, a small signal disturbance needs to be actively added in the DSS side of the RTISS system to solve the numerical stability of Thevenin parameters when the system disturbance is small. In real-time simulation, two sets of different voltage and current data are measured. U 1 ∠ θ U1 , I 1 ∠ θ I1 are the voltage and current phasor at the moment before the system runs and U 2 ∠ θ U2 , I 2 ∠ θ I2 are the voltage and current phasor at the current moment. It is easy to derive the expressions for the amplitude Z and argument of the equivalent impedance θ Z using the relevant knowledge of periodic AC circuit theory. The expressions are Equations (1) and (2), respectively: ) + arctan To achieve impedance matching on each frequency component, the resistance R and the inductance L can be further calculated by Equations (1) and (2). When the real-time simulation system is implemented by RTDS, the controllable R-L branch model provided by RTDS can be directly used for modeling operation. In addition, the real-time performance and calculation accuracy of impedance matching can be further improved by improving the hardware performance of the real-time simulation system and shortening the simulation step. Figure 3 shows the diagram of a new IA timing control logic. The model operation and data sampling and transition are simultaneously started on the DSS side and the DUT side at time t n , and the following steps are performed in parallel to complete the system simulation operation control.

Sequential Control Logic of the New IA
To achieve impedance matching on each frequency component, the resistance R and the inductance L can be further calculated by Equations (1) and (2). When the real-time simulation system is implemented by RTDS, the controllable R-L branch model provided by RTDS can be directly used for modeling operation. In addition, the real-time performance and calculation accuracy of impedance matching can be further improved by improving the hardware performance of the realtime simulation system and shortening the simulation step. Figure 3 shows the diagram of a new IA timing control logic. The model operation and data sampling and transition are simultaneously started on the DSS side and the DUT side at time tn, and the following steps are performed in parallel to complete the system simulation operation control. Step 1. Backward signals feedback process. The current and voltage signals after data transition on the DUT side at time t (n-1) are input into the AGM. The reference value of the output current of the AGM before calculation is i* (n-2), which becomes i* (n-1) after calculation and the time consumption is d1. u1 (n) can be obtained in the MGM by using i* (n-1) as the feedback input value and the elapsed time is d2. The signal transmission time between the MGM and the AGM can be ignored.

Sequential Control Logic of the New IA
Step 2. Forward voltage excitation process. Calculation result u1 (n-1) of the DSS in the last simulation step is input to the DUT side after data transition and power amplification. At time tn, the DUT side output is u2 (n-1). When u1 (n-1) is updated to u1 (n) in the MGM, the DUT side output is updated after a delay of d3, that is, u2 (n-1) is updated to u2 (n) at time tn + d3.
Repeat Steps 1 and 2 at time t (n + m) and run cyclically, where m is the adjustable closed-loop simulation control period of the RTISS. Maintaining the value of m greater than the total delay time is mandatory, which is determined according to the actual system operation delay.
Compared with the commonly used IAs, the introduction of the new IA increases the calculation time of the models, whereas the introduction of the auxiliary DIM interface feedback signal increases the calculation result accuracy of the MGM. The model calculation error will not be accumulated, and the increased time consumption for the AGM can be solved by improving hardware performance. Step 1. Backward signals feedback process. The current and voltage signals after data transition on the DUT side at time t (n-1) are input into the AGM. The reference value of the output current of the AGM before calculation is i* (n-2), which becomes i* (n-1) after calculation and the time consumption is d 1 . u 1 (n) can be obtained in the MGM by using i* (n-1) as the feedback input value and the elapsed time is d 2 . The signal transmission time between the MGM and the AGM can be ignored.
Step 2. Forward voltage excitation process. Calculation result u 1 (n-1) of the DSS in the last simulation step is input to the DUT side after data transition and power amplification. At time t n , the DUT side output is u 2 (n-1). When u 1 (n-1) is updated to u 1 (n) in the MGM, the DUT side output is updated after a delay of d 3 , that is, u 2 (n-1) is updated to u 2 (n) at time t n + d 3 .
Energies 2020, 13, 4380 6 of 17 Repeat Steps 1 and 2 at time t (n + m) and run cyclically, where m is the adjustable closed-loop simulation control period of the RTISS. Maintaining the value of m greater than the total delay time is mandatory, which is determined according to the actual system operation delay.
Compared with the commonly used IAs, the introduction of the new IA increases the calculation time of the models, whereas the introduction of the auxiliary DIM interface feedback signal increases the calculation result accuracy of the MGM. The model calculation error will not be accumulated, and the increased time consumption for the AGM can be solved by improving hardware performance.

Accuracy Analysis of the Proposed New IA
We establish a naturally coupled system (NCS), as shown in Figure 4. The meanings of u s , Z s , Z h , and u p in Figure 4 are the same as in Figure 2, and u o and i o are the output voltage and current, respectively.

Accuracy Analysis of the Proposed New IA
We establish a naturally coupled system (NCS), as shown in Figure 4. The meanings of us, Zs, Zh, and up in Figure 4 are the same as in Figure 2, and uo and io are the output voltage and current, respectively. From Figure 4, by applying circuit theory, the reference output voltage and current can be derived, as shown in Equations (3) and (4): The system shown in Figure 4 does not include an interface and hence is not affected by delay and sampling errors. The calculation results of Equations (3) and (4) are theoretical values of the actual system and can be used as standard reference values.
For the RTISS, the accuracy of the output reference signal of the DSS, that is, the port voltage u1, is first investigated, followed by the accuracy of the DUT side output current. Considering that td1 is only sampling processing and transmission delay, which is much smaller than td3, and is significantly reduced by improving hardware performance, it can be ignored in actual calculations. We derive from Figure 2 when impedance matching is implemented in the AGM, that is, * h Z Z = , Equation (5) can be simplified to Equation (8). From Figure 4, by applying circuit theory, the reference output voltage and current can be derived, as shown in Equations (3) and (4): The system shown in Figure 4 does not include an interface and hence is not affected by delay and sampling errors. The calculation results of Equations (3) and (4) are theoretical values of the actual system and can be used as standard reference values.
For the RTISS, the accuracy of the output reference signal of the DSS, that is, the port voltage u 1 , is first investigated, followed by the accuracy of the DUT side output current. Considering that t d1 is only sampling processing and transmission delay, which is much smaller than t d3 , and is significantly reduced by improving hardware performance, it can be ignored in actual calculations. We derive from Figure 2 that Energies 2020, 13, 4380 7 of 17 when impedance matching is implemented in the AGM, that is, Z * = Z h , Equation (5) can be simplified to Equation (8).
Because of the current feedback from the AGM to the MGM applying the new IA, that is, i 1 = i*, it can be derived from Equations (7)-(9) that Based on this method, the reference voltage signal U 1-ITM of the DSS side applying the ITM IA is derived as [14] We deduce from Equation (11) that the reference voltage signal calculated by the DSS is distorted due to the existence of the delay link. Such a reference voltage signal will be further aggravated by the power amplifier. If no measures are taken, cumulative errors will be formed during the operation of the simulation model in the DSS, which will further distort the output waveform of the power amplifier, and will eventually threaten the stability of the system.
Comparison of Equations (10) and (11) shows that the reference voltage signal u 1 of the DSS side of the RTISS is not affected by the interface delay, and the error will not be accumulated, which is only related to the equivalent power supply and impedance, applying the new IA proposed in this paper. The system stability can also be improved effectively, thanks to the characteristics of the noncumulative error in the DSS side. Meanwhile, its characteristics are still consistent with the ITM interface in the DUT side, which also means strong loading capacity.

Simulation Verification of the New IA
To verify the accuracy of the new IA proposed in this paper and the performance of the RTISS using the new IA, the models were established based on the MATLAB/Simulink for simulation verification research both on a simplified model and an example system by introducing a high-power direct-drive wind turbine with a rated power of 1.5 MW. A full-power back-to-back dual PWM converter was used to realize electric energy conversion and grid connection. The generator-side converter adopted a vector control algorithm based on permanent magnet flux orientation to achieve stable operation control of the generator, and the grid-side converter adopted a dual closed-loop control strategy based on grid voltage orientation to realize the stability of the DC bus voltage and grid connection. During the test operation, the active current of the wind turbine was set to 300 A, and the reactive current was set to zero.

Accuracy Verification of the New IA on a Simplified Model
The simulation model was established based on the IA shown in Figure 2. Considering the characteristics of the DSS side grid model and the DUT side power-generation equipment (the impedance on the DDS side is generally smaller than the impedance on the DUT side), it is easy to meet the system stability requirements, that is, Z h > Z s . Owing to its limitation of length, in this study, we verified and analyzed only the accuracy of the IA and compared it with the ITM and DIM interfaces. Table 1 shows the simulation parameters. Among them, 10% of the fifth and seventh harmonics are superimposed in u s , so as to simulate the actual situation more realistically. According to the implementation principle and theoretical analysis of the new IA proposed in this paper, using the new IA, the DSS side and DUT side characteristics of the PHIL simulation system should be consistent with the DIM and ITM interface algorithms. We carried out a comparative analysis of the response results of the PHIL simulation system and equivalent original system using three interfaces. Figures 5 and 6 show the voltage and current waveforms of the DSS side, respectively, whereas Figures 7 and 8 show the voltage and current waveforms of the DUT side, respectively.  According to the implementation principle and theoretical analysis of the new IA proposed in this paper, using the new IA, the DSS side and DUT side characteristics of the PHIL simulation system should be consistent with the DIM and ITM interface algorithms. We carried out a comparative analysis of the response results of the PHIL simulation system and equivalent original system using three interfaces. Figures 5 and 6 show the voltage and current waveforms of the DSS side, respectively, whereas Figures 7 and 8 show the voltage and current waveforms of the DUT side, respectively.     According to the implementation principle and theoretical analysis of the new IA proposed in this paper, using the new IA, the DSS side and DUT side characteristics of the PHIL simulation system should be consistent with the DIM and ITM interface algorithms. We carried out a comparative analysis of the response results of the PHIL simulation system and equivalent original system using three interfaces. Figures 5 and 6 show the voltage and current waveforms of the DSS side, respectively, whereas Figures 7 and 8 show the voltage and current waveforms of the DUT side, respectively.      6 show that, using the DIM interface and the new IA, the voltage and current accuracy of the DSS side of the PHIL simulation system is better, and the response results in the ideal situation of the simulation remain the same as the equivalent original system. However, with the ITM interface, there are errors in the voltage and current responses, and the accuracy is also poor, which will further affect the system stability with long-term accumulation of errors. Figures 7 and 8 show that, using the new interface algorithm and the ITM interface algorithm, the voltage and current responses of the DUT side of the PHIL simulation system are identical. Compared with the equivalent original system, there is a certain error distortion, but the accuracy is better than that of the DIM interface, which also means strong loading capacity. There are large errors and distortions in the response results with the DIM interface. The error of the DUT side is increased in long-term operation situation, which will affect the accuracy of grid simulation.
Data statistics show that, with the simplified model, the overall accuracy on the DSS side is improved by more than 97% compare to other IAs, and approximately 26% on the DUT side even under the influence of time delay and harmonics distortion. The results also show the IA proposed in this paper is not affected by factors such as error and delay in the DSS side, and the characteristics of the DUT side are consistent with the ITM interface and the accuracy and delay are better than that of ITM IA. Using the new IA, the RTISS can obtain better grid simulation accuracy.    6 show that, using the DIM interface and the new IA, the voltage and current accuracy of the DSS side of the PHIL simulation system is better, and the response results in the ideal situation of the simulation remain the same as the equivalent original system. However, with the ITM interface, there are errors in the voltage and current responses, and the accuracy is also poor, which will further affect the system stability with long-term accumulation of errors. Figures 7 and 8 show that, using the new interface algorithm and the ITM interface algorithm, the voltage and current responses of the DUT side of the PHIL simulation system are identical. Compared with the equivalent original system, there is a certain error distortion, but the accuracy is better than that of the DIM interface, which also means strong loading capacity. There are large errors and distortions in the response results with the DIM interface. The error of the DUT side is increased in long-term operation situation, which will affect the accuracy of grid simulation.
Data statistics show that, with the simplified model, the overall accuracy on the DSS side is improved by more than 97% compare to other IAs, and approximately 26% on the DUT side even under the influence of time delay and harmonics distortion. The results also show the IA proposed in this paper is not affected by factors such as error and delay in the DSS side, and the characteristics of the DUT side are consistent with the ITM interface and the accuracy and delay are better than that of ITM IA. Using the new IA, the RTISS can obtain better grid simulation accuracy.  Figures 5 and 6 show that, using the DIM interface and the new IA, the voltage and current accuracy of the DSS side of the PHIL simulation system is better, and the response results in the ideal situation of the simulation remain the same as the equivalent original system. However, with the ITM interface, there are errors in the voltage and current responses, and the accuracy is also poor, which will further affect the system stability with long-term accumulation of errors. Figures 7 and 8 show that, using the new interface algorithm and the ITM interface algorithm, the voltage and current responses of the DUT side of the PHIL simulation system are identical. Compared with the equivalent original system, there is a certain error distortion, but the accuracy is better than that of the DIM interface, which also means strong loading capacity. There are large errors and distortions in the response results with the DIM interface. The error of the DUT side is increased in long-term operation situation, which will affect the accuracy of grid simulation.
Data statistics show that, with the simplified model, the overall accuracy on the DSS side is improved by more than 97% compare to other IAs, and approximately 26% on the DUT side even under the influence of time delay and harmonics distortion. The results also show the IA proposed in this paper is not affected by factors such as error and delay in the DSS side, and the characteristics of the DUT side are consistent with the ITM interface and the accuracy and delay are better than that of ITM IA. Using the new IA, the RTISS can obtain better grid simulation accuracy.

Example Simulation Verification Based on the New IA by Introducing a Wind Turbine
A wind turbine (WT) was used as a DUT for simulation verification. A complete model of the RTISS was established using MATLAB, as shown in Figure 9. A simplified equivalent model was used to establish a grid model containing 110 kV, 35 kV, 10 kV, 690 V, and other common voltage levels of wind farms. Table 2 shows the parameters of the grid model. By changing the location and type of the fault in the grid model, their corresponding fault waveforms were obtained at the grid-connection point of the WT to simulate the actual grid characteristics. Table 3 shows the simulation parameters of the wind turbine.

Example Simulation Verification Based on the New IA by Introducing a Wind Turbine
A wind turbine (WT) was used as a DUT for simulation verification. A complete model of the RTISS was established using MATLAB, as shown in Figure 9. A simplified equivalent model was used to establish a grid model containing 110 kV, 35 kV, 10 kV, 690 V, and other common voltage levels of wind farms. Table 2 shows the parameters of the grid model. By changing the location and type of the fault in the grid model, their corresponding fault waveforms were obtained at the gridconnection point of the WT to simulate the actual grid characteristics. Table 3 shows the simulation parameters of the wind turbine.   On the basis of the principle of the new IA proposed in this study, two sets of grid models were established in DSS, and the DSS and DUT sides were equivalently connected through the interface unit to simulate the grid characteristics and its interaction with the WT. The capacity of the grid simulator as a power amplifier was 15 MW, which was designed based on the modular multilevel converter topology. The output voltage control strategy of the parallel multi-resonance controller was adopted to achieve non-differential tracking to the input target voltage signal, whereas low-order harmonics in the output voltage could be eliminated by the parallel multi-resonance controller.
A three-phase symmetrical short-circuit fault occurs at the 35-kV bus of the far end of the WT, where the short-circuit resistance is 10 Ω. Figure 10 shows the voltage drop waveform of the 35-kV bus.   Table 3. Simulation parameters of the wind turbine.

System Parameters Value
Rate power of DUT On the basis of the principle of the new IA proposed in this study, two sets of grid models were established in DSS, and the DSS and DUT sides were equivalently connected through the interface unit to simulate the grid characteristics and its interaction with the WT. The capacity of the grid simulator as a power amplifier was 15 MW, which was designed based on the modular multilevel converter topology. The output voltage control strategy of the parallel multi-resonance controller was adopted to achieve non-differential tracking to the input target voltage signal, whereas low-order harmonics in the output voltage could be eliminated by the parallel multi-resonance controller.
A three-phase symmetrical short-circuit fault occurs at the 35-kV bus of the far end of the WT, where the short-circuit resistance is 10 Ω. Figure 10 shows the voltage drop waveform of the 35-kV bus. Different IAs were used for simulation verification. Figures 11 and 12 show, respectively, the phase A voltage and current waveforms of power grid simulation branch in the DSS side.  Different IAs were used for simulation verification. Figures 11 and 12 show, respectively, the phase A voltage and current waveforms of power grid simulation branch in the DSS side. Different IAs were used for simulation verification. Figures 11 and 12 show, respectively, the phase A voltage and current waveforms of power grid simulation branch in the DSS side.   To compare and analyze the system simulation accuracy of various interface algorithms, the steady-state amplitude error and delay time were used as evaluation indicators. The steady-state amplitude error σ U and σ I are defined as the Equations (12) and (13), where U 0 or I 0 are the steady-state amplitudes of the NCS system, and U or I are the simulated amplitudes with each algorithm. Figures 11 and 12 show that, with the new IA and DIM algorithms, the digital side waveform almost coincides with the NCS system waveform. Compared with the ITM IA, the waveform distortion is small, the accuracy is high, and the delay is small, not exceeding 8 µs. Considering the coexistence of various loads and the real-time change of impedance in the actual system, there is a little tracking error in impedance matching, making it impossible for the waveform of the DSS side to completely coincide with the NCS system. However, with the ITM algorithm, the waveform of the DSS side is significantly distorted compared with the new IA and DIM IA, and the accuracy is lower, due to the effects of interface delay and errors. The voltage and current waveform delays are about 68 and 71 µs, respectively.  To compare and analyze the system simulation accuracy of various interface algorithms, the steady-state amplitude error and delay time were used as evaluation indicators. The steady-state amplitude error σU and σI are defined as the Equations (12) and (13), where U0 or I0 are the steadystate amplitudes of the NCS system, and U or I are the simulated amplitudes with each algorithm.  Figures 11 and 12 show that, with the new IA and DIM algorithms, the digital side waveform almost coincides with the NCS system waveform. Compared with the ITM IA, the waveform distortion is small, the accuracy is high, and the delay is small, not exceeding 8 μs. Considering the coexistence of various loads and the real-time change of impedance in the actual system, there is a little tracking error in impedance matching, making it impossible for the waveform of the DSS side to completely coincide with the NCS system. However, with the ITM algorithm, the waveform of the DSS side is significantly distorted compared with the new IA and DIM IA, and the accuracy is lower, due to the effects of interface delay and errors. The voltage and current waveform delays are about 68 and 71 μs, respectively.
The simulation results of the 0.264-0.272 s on the DSS side are shown in Figures 11 and 12, and Table 4. Data statistics in Table 4 show that the σU and σI of the DSS side are reduced by approximately 95% and 96.2%, respectively, compared to ITM IA. This means that the accurate target voltage signal can be calculated in the DSS side, which is beneficial to the accuracy of the DUT side.  Table 4. Data statistics in Table 4 show that the σ U and σ I of the DSS side are reduced by approximately 95% and 96.2%, respectively, compared to ITM IA. This means that the accurate target voltage signal can be calculated in the DSS side, which is beneficial to the accuracy of the DUT side.  Figures 13 and 14 show, respectively, the phase A voltage and current waveforms of the point of common coupling (PCC) of the WT. Figures 13 and 14 show that, under the condition of grid voltage fault, using new IA, the response characteristics of the DUT side of RTISS are basically consistent with ITM, and the delay is less than those of ITM IA and DIM IA. It can be seen from the voltage waveform in Figure 13 that the delay is about 376 µs with the new IA, while the delay is 618 µs with the DIM IA. In Figure 14, the delay is about 365 µs with the new IA, while the DIM delay is 590 µs with the DIM IA. Using the three IAs, the waveforms on the DUT side of RTISS are different of distortion, but distortion waveforms with new IA and ITM IA are significantly smaller than that of DIM IA. Since the calculation Energies 2020, 13, 4380 13 of 17 results of the DSS side are not affected by the interface delay and error accumulation with the new IA, the calculation results accuracy of the DSS side is improved, which makes the accuracy of the DUT side better than that of ITM IA and DIM IA.
of common coupling (PCC) of the WT. Figures 13 and 14 show that, under the condition of grid voltage fault, using new IA, the response characteristics of the DUT side of RTISS are basically consistent with ITM, and the delay is less than those of ITM IA and DIM IA. It can be seen from the voltage waveform in Figure 13 that the delay is about 376 μs with the new IA, while the delay is 618 μs with the DIM IA. In Figure 14, the delay is about 365 μs with the new IA, while the DIM delay is 590 μs with the DIM IA. Using the three IAs, the waveforms on the DUT side of RTISS are different of distortion, but distortion waveforms with new IA and ITM IA are significantly smaller than that of DIM IA. Since the calculation results of the DSS side are not affected by the interface delay and error accumulation with the new IA, the calculation results accuracy of the DSS side is improved, which makes the accuracy of the DUT side better than that of ITM IA and DIM IA.  The data analysis results of the 0.280-0.295 s on the DUT side are shown in Figures 13 and 14, and Table 5. Data statistics in Table 5 show that the σU and σI of the DUT side are reduced by voltage fault, using new IA, the response characteristics of the DUT side of RTISS are basically consistent with ITM, and the delay is less than those of ITM IA and DIM IA. It can be seen from the voltage waveform in Figure 13 that the delay is about 376 μs with the new IA, while the delay is 618 μs with the DIM IA. In Figure 14, the delay is about 365 μs with the new IA, while the DIM delay is 590 μs with the DIM IA. Using the three IAs, the waveforms on the DUT side of RTISS are different of distortion, but distortion waveforms with new IA and ITM IA are significantly smaller than that of DIM IA. Since the calculation results of the DSS side are not affected by the interface delay and error accumulation with the new IA, the calculation results accuracy of the DSS side is improved, which makes the accuracy of the DUT side better than that of ITM IA and DIM IA.  The data analysis results of the 0.280-0.295 s on the DUT side are shown in Figures 13 and 14, and Table 5. Data statistics in Table 5 show that the σU and σI of the DUT side are reduced by The data analysis results of the 0.280-0.295 s on the DUT side are shown in Figures 13 and 14, and Table 5. Data statistics in Table 5 show that the σ U and σ I of the DUT side are reduced by approximately 17% and 23%, respectively, compared to DIM IA. This feature ensures the load capacity in high-power application scenarios, making it more suitable for high-power new energy grid-connected testing.

Discussion
At present, most of the PHIL system interface algorithms mentioned in the literature are only aimed at the improvement of a single interface algorithm, and each has some problems. The new interface algorithm studied in this paper combines the advantages of DIM and ITM interface algorithms and avoids the respective defects of the two interface algorithms. The calculation result on the digital side is not affected by errors and delays. Accurate command voltage signals can be obtained, and then the power amplifier can achieve accurate amplification and output on the physical side, so that the signal distortion on the physical side is very small. With the proposed new algorithm, not only the loading capacity can be ensured in high-power applications but the accuracy and stability of the system are effectively improved.
A high-power direct-drive wind turbine was selected as the DUT example simulation to illustrate that the new IA proposed in this paper has better applicability in multiple scenarios. Direct-drive wind turbine is connected to the grid through a full-power converter, which is AC-DC-AC power electronic converter with bidirectional power flow. Firstly, the common converters used in photovoltaic power generation, energy storage systems, electric vehicle charging equipment, and so on are all DC-AC power electronic converters, which are only half of the wind power full-power converter in structure, and the control is simpler. Secondly, for passive DUT, because of its simple impedance measurement and no load-side harmonic distortion, even if the commonly used ITM or DIM IA is used, better results can be achieved. Finally, the verified operating condition is a voltage sag condition, which is a relatively serious grid fault. Therefore, it is very representative to verify the effectiveness of this algorithm with wind turbines as the DUT, which also illustrates the universality of the new IA proposed in this paper in multi-scenario applications.
However, the reduction of the inherent delay part of the power interface is not further discussed. In addition, when the system is subjected to large disturbances, the analysis of the accuracy of the entire system is not involved. This is also the focus of next research direction.

Conclusions
The proportion of renewable energy in power systems and forms of energy supply systems is gradually increasing, and the reliability testing of renewable energy grid connection becomes particularly critical. We studied a key technology of the real-time integration simulation to realize reliable grid-connected testing of high-power renewable energy.
Aiming at the problems of the current common PHIL real-time simulation system IAs, we proposed an optimized new IA based on the auxiliary DIM interface current feedback, which has the advantages of both DIM and ITM interface algorithms. Using the impedance matching calculation method mentioned in this paper, in the case of impedance matching, the accuracy and stability of the new IA are better than those of the ITM and DIM interfaces. Based on the verification of the effectiveness for the new IA, it can also be seen that the new interface algorithm has good generality and is suitable for PHIL systems with source or passive loads, especially high-power active load application scenarios, such as grid connection test of wind power, photovoltaic, and so on. The simulation verification for the new IA was carried out with the wind turbine as the DUT. The simulation results show that the real-time actual grid characteristics and the interactive characteristics of the renewable energy and the power grid can be accurately simulated based on the new IA proposed in this paper, and the results Energies 2020, 13,4380 15 of 17 also show that the accuracy can be improved 95% in the DSS side and 17% in the DUT side by using the IA proposed in this paper.
The research results of this paper provide a basis for sufficient testing of renewable energy grid-connected equipment on the ground and has important reference significance. Thanks to the advantages of the new IA algorithm, the simulation accuracy and stability of the power hardware-in-the-loop system have been improved. Thus, the RTISS with renewable energy and the power grid system can easily and effectively evaluate the performance of grid-connected renewable energy equipment and the impact of the operation of grid-connected renewable energy equipment on the grid.
Next, we will focus on delay compensation algorithms to further improve the accuracy of real-time integration simulation system with renewable energy and the power grid and further research the impact of large disturbances caused by faults and harmonics distortion on the stability and accuracy of the whole system.

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

Nomenclature i*
The current of the branch port in the auxiliary grid model u* The voltage of the branch port in the auxiliary grid model Z* The damping impedance of the branch port in the auxiliary grid model i 1 The current of the branch port of the main grid model u 1 The voltage of the branch port of the main grid model and u 1 is also called the forward excitation voltage i 2 The output current of the power amplifier u 2 The output voltage of the power amplifier u s The equivalent power supply on the DSS side of PHIL system Z s The equivalent impedance on the DSS side of PHIL system u p The equivalent power supply on the DUT side of PHIL system Z h The equivalent impedance on the DUT side of PHIL system T d1 The delay time of the forward voltage excitation process T d2 The delay time of the backward signals feedback process u o The output voltage of the naturally coupled system i o The output current of the naturally coupled system σ U The steady-state error of the voltage amplitude σ I The steady-state error of the current amplitude RTISS Real-time integrated simulation system PHIL Power hardware-in-the-loop DSS The digital simulation system DUT The device under test IA The interface algorithm ITM The ideal transformer model DIM The damping impedance method MMC-HVDC The modular, multilevel, converter-based high-voltage direct current MGM The main grid model AGM The auxiliary grid model IMU The impedance matching unit SPU The sampling and processing unit PMU The phasor measurement unit WT The wind turbine