1 Hardware-in-the-Loop-Based CPES Testing

1.1 State-of-the-Art and System Modelling

HIL simulation integrates physical power components with a Real-Time Simulator (RTS) into a closed-loop system configuration, effectively replicating the original System of Interest (SOI). Figure 1 illustrates the SOI alongside its corresponding power HIL (PHIL) simulation setup. The SOI is represented by a voltage divider topology consisting of two interconnected Thevenin equivalents \(\textrm{S}_1\) and \(\textrm{S}_2\). The Model of Interest (MOI) \(\textrm{S}_1\) corresponds to the real-time network within the digital RTS platform, while \(\textrm{S}_2\) represents the Hardware of Interest (HOI). \(\textrm{S}_1\) consists of a voltage source \(V_\textrm{S}\) in series with an equivalent impedance \(Z_\textrm{S}\), representing the model implemented on an RTS. \(\textrm{S}_2\) comprises the hardware equivalent impedance \(Z_\textrm{H}\). As shown in Fig. 1b, these two subsystems are coupled through a PHIL interface, enabling real-time interaction between the MOI and the HOI.

Fig. 1
Diagram illustrating two circuit configurations. (a) System of Interest (SoI): A circuit with a voltage source V_S , impedance Z_S , and current I_S . The voltage across the impedance is V_S' = V_H , and the current through the hardware is I_H , with impedance Z_H . (b) PHIL System: A circuit divided into software and hardware sections. The software section includes a voltage source V_S , impedance Z_S , and current I_S , with voltage V_{Z_S} . The power interface connects to the hardware section, which includes voltage V_H and impedance Z_H . Systems are labeled as S_1 and S_2 .

Topology of a SOI and b the corresponding PHIL simulation system

A PHIL interface – in literature often called Power Interface (PI) as well – consists of a Power Amplifier (PA), signal conversion cards, and sensors. The configuration of these components and the method by which power is transferred between MOI and HOI are determined by specific Interface Algorithms (IAs), as depicted in [15]. Among these IAs, the Ideal Transformer Model (ITM) interface is widely adopted due to its straightforward implementation and strong performance in terms of stability and accuracy. As shown in Fig. 2a, the ITM interface consists of a controllable voltage source on the HOI side and a controllable current source on the MOI side. The voltage source is implemented as a PA that regulates its output voltage based on the command signal measured at MOI coupling point and transmitted via a Digital-to-Analog Conversion (DAC) card. The current on the HOI side is measured by a current sensor and processed through a Low-Pass Filter (LPF). The filter output is subsequently injected into the emulated network via a controlled current source, thus closing the test loop.

Fig. 2
Diagram showing two circuit configurations labeled (a) and (b). (a) Features a circuit with components including a current source, power amplifier, ADC, DAC, and a summer. It includes labeled paths for signals and feedback loops, with connections to a load and measurement points. (b) Displays a circuit with a DAC, amplifier, ADC, and LPF source. It includes labeled signal paths and feedback loops, with connections to a load and measurement points. Both diagrams are enclosed in colored sections indicating different functional areas, with labels such as "DRFS" and "HMI."

a Equivalent model of PHIL setup and b its equivalent block diagram

From a system modelling standpoint, the PHIL system can be represented as a single-input-single-output system, whose equivalent block diagram, illustrating all key components and interface signals, is shown in Fig. 2b. The open-loop transfer function of this PHIL system is represented as

$$\begin{aligned} \begin{aligned} T_\textrm{O}(s)=\underbrace{G_1(s)G_2(s)G_3(s)G_4(s)}_{G_\textrm{PI}(s)}\frac{Z_\textrm{S}(s)}{Z_\textrm{H}(s)}, \end{aligned} \end{aligned}$$
(1)

where \(G_\textrm{PI}(s)\) represents the power interface, which includes the transfer functions of DAC card \(G_{1}(s)\), PA \(G_{2}(s)\), current sensor \(G_{3}(s)\), and Analog-to-Digital Conversion (ADC) card in series with an LPF \(G_{4}(s)\). These components are modelled as

$$\begin{aligned} \begin{aligned} \left\{ \begin{array}{lrlc} G_1(s)=& k_1e^{-sT_\textrm{d1}}, & G_2(s)=& k_2\displaystyle \frac{1}{\frac{s}{2\pi f_{c2}}+1}e^{-sT_\textrm{d2}}, \\ G_3(s)=& e^{-sT_\textrm{d3}}, & G_4(s)=& \displaystyle \frac{1}{\frac{s}{2\pi f_{c4}}+1}e^{-sT_\textrm{d4}}, \end{array}\right. \end{aligned} \end{aligned}$$
(2)

where \(k_1\) and \(k_2\) are the DAC and PA scaling factors, respectively. \(T_\textrm{d1}\) and \(T_\textrm{d4}\) represent the time-step delay of RTS, \(T_\textrm{d2}\) and \(T_\textrm{d3}\) are the time delay of PA and sensor, respectively. Frequencies \(f_{c2}\) and \(f_{c4}\) are the corner frequency of PA and LPF, respectively [6]. The open-loop transfer function in Eq. 1 is further expressed as

$$\begin{aligned} \begin{aligned} T_\textrm{O}(s)=k_1k_2\displaystyle \frac{1}{\frac{s}{2\pi f_{c2}}+1}\displaystyle \frac{1}{\frac{s}{2\pi f_{c4}}+1}\frac{Z_\textrm{S}(s)}{Z_\textrm{H}(s)}e^{-sT_\textrm{d}}=G^{*}_\textrm{PI}(s)\frac{Z_\textrm{S}(s)}{Z_\textrm{H}(s)}e^{-sT_\textrm{d}}, \end{aligned} \end{aligned}$$
(3)

where \(G^{*}_\textrm{PI}(s)\) represents the delay-free part of \(G_\textrm{PI}(s)\) and \(T_\textrm{d}\) is the aggregated time delay of the interfacing components depicted in Eq. 2.

Fig. 3
Four-panel bode plot showing frequency response analysis. Panel (a) displays two plots: - Top plot: Magnitude (dB) vs. Frequency (Hz) with a curve indicating "Gain Crossover" in purple. - Bottom plot: Phase (degrees) vs. Frequency (Hz) with annotations for "Positive PM—Stable" and "Negative PM—Unstable" in green and red, respectively. Time constants from 0 to 800 microseconds are marked. Panel (b) displays two plots: - Top plot: Multiple curves showing different stability conditions labeled as "Negative GM—Unstable" in red and "Positive GM—Stable" in green. Curves are marked with different resistance values (e.g., 0.8R₀ to 1.5R₀). - Bottom plot: Phase (degrees) vs. Frequency (Hz) with a curve indicating "Phase Crossover" in purple. The charts emphasize stability analysis through gain and phase margins.

a Bode plots of \(T_\textrm{O}(s)\) of PHIL system with unity \(G^{*}_\textrm{PI}(s)\) and (a) fixed \(\textrm{IR}\) and variable time delay, b fixed time delay (\(T_\textrm{d}=600us\)) and variable \(\textrm{IR}\) [6]

1.2 Research and Application Challenges

From both research and application perspectives, the key challenges hindering the robust and widespread adoption of the PHIL system can be summarized as follows.

System stability: The stability of the PHIL closed-loop system can be evaluated using the Nyquist criteria applied to the system characteristic equation (i.e., \(1\,+\,T_\mathrm{{O}}(s)\) = 0). Consequently, as highlighted in [6], Gain Margin (GM) and Phase Margin (PM) serve as key indicators of the PHIL stability. Apart from the intrinsic delay-free power interface \(G^{*}_\textrm{PI}(s)\), the time delay \(T_\textrm{d}\) and the Impedance Ratio (IR) between the simulation and HOI side in the open-loop transfer function in Eq. 3 are the key determinants of stability, with GM and PM satisfying the Nyquist stability criteria. As illustrated in Fig. 3a, for a PHIL system with fixed impedance, the presence of time delay destabilises the system once it exceeds the threshold \(T_\textrm{dc}\). Due to the inherent time delay and its associated stability challenges, the permissible IR range of the PHIL system is significantly constrained, limiting its broader application. Furthermore, as in Fig. 3b, for a PHIL system with fixed time delay, the increment in IR eventually breaches system stability. This stringent IR constraint to ensure a stable PHIL system poses a major challenge to the practical implementation of PHIL setups, as real-time PHIL setups may experience significant variations in impedance on both the MOI and HOI sides during an experimental scenario run.

System accuracy: An ideal PHIL interface is delay-free and features transparent power amplification with unity gain and infinite bandwidth, allowing it to replicate the SoI depicted in Fig. 1a identically. However, in practice, the non-unity gain of the interfacing components and the phase lag introduced by the time delay lead to inconsistent magnitude and phase relationship between \({V_\textrm{S}}\) and \({V_\textrm{H}}\) in the PHIL system. This discrepancy disrupts accurate power signal synchronization between MOI and HOI and degrades the current response at both ends. Moreover, as demonstrated in [5], the phase shift (\(\varphi \)) arising from the time delay and PHIL interface alters the phase relationship between the voltage and current at both the MOI and HOI ends, leading to deteriorated power transfer between MOI and HOI sides. The relationship between the MOI power (\(P_\textrm{S}+jQ_\textrm{S}\)) and HOI power (\(P_\textrm{H}+jQ_\textrm{H}\)) is derived in [5] and is expressed as,

$$\begin{aligned} \begin{aligned} \left\{ \begin{array}{rc} {P}_\textrm{H}=& {\left| G_\textrm{PI}(s) \right| } ( P_{\textrm{S}}cos\varphi - Q_{\textrm{S}}sin\varphi ), \vspace{2ex} \\ {Q}_\textrm{H}=& {\left| G_\textrm{PI}(s) \right| } ( Q_{\textrm{S}}cos\varphi + P_{\textrm{S}}sin\varphi ). \end{array}\right. \end{aligned} \end{aligned}$$
(4)

System sensitivity: Due to the incorporation of interfacing subsystems into the PHIL setup, their associated non-ideal characteristics not only significantly deteriorate PHIL stability and accuracy but also render the system more vulnerable to these imperfections, particularly to external disturbances that are inevitably introduced into the PHIL setup. These external disturbances originate from (i) offset in power signal measurement units, (ii) quantisation errors and noise in ADC and DAC signal conversion cards, (iii) switching harmonics arising from PA high-frequency pulsating modulation, and (iv) measurement noise in voltage and current sensors (typically high-frequency). From an application perspective, conducting a comprehensive sensitivity analysis, evaluating the impact of these disturbances on the PHIL setup, and identifying sensitivity issues caused by external disturbances are essential for achieving high-fidelity and robust PHIL simulations before final-stage deployment. In contrast to the well-established stability and accuracy assessment schemes presented in the literature, sensitivity analysis and assessment remain unexplored within the PHIL community, with no dedicated scheme developed before the research efforts [11] in ERIGrid 2.0 aimed at bridging this gap.

2 Hardware-in-the-Loop Simulation Improvements

2.1 Approaches for PHIL Stability Enhancement

To alleviate the destabilising impact of the key determinants identified above, numerous research efforts have focused on enhancing the PHIL system’s stability. These approaches include refining the impedance ratio between the MOI and HOI ends [10] or increasing the system stability margins by augmenting the power interface with compensation schemes [12]. Building upon these advancements, the following novel PHIL stability enhancement schemes have been developed in ERIGrid 2.0.

Adaptive Smith Predictor-aided PHIL stability enhancement: To counteract the detrimental impact of the time delay on PHIL closed-loop stability, a Smith Predictor (SP) -based compensator is proposed in [4, 6]. As shown in Fig. 4, the SP compensator is integrated at the point of common coupling within the feed-forward path to manipulate the output signal from MOI before it is amplified by PA. The SP compensator functions by equivalently shifting the time delay out of the PHIL closed-loop, thereby enabling a delay-free PHIL interface with an enhanced stability margin. This improvement in stability margin extends IR, allowing for a higher IR threshold before breaching the system stability. Consequently, this approach introduces greater flexibility in impedance variations, enabling stable PHIL experiments across a broader range of operating conditions.

Fig. 4
Flow chart illustrating a control system with two main sections: "Compensator" and "Power Interface." The "Compensator" section includes elements labeled C_{eq}(s), hat{T}_o(s), and e^{-sT_d}. The "Power Interface" section contains blocks labeled G_1(s) to G_4(s) and 1/Z_t(s). Arrows indicate the flow of signals between components, with inputs V_s, V_f, and V_z, and output V_y. The diagram shows feedback loops and signal paths connecting the components.

PHIL diagram with detailed structure of SP compensator

Furthermore, robustness analysis of SP compensator against the modelling error \(\delta T^{*}_\textrm{O}(s)\) arising from system impedance variations is presented in [6]. As shown in Fig. 5a, the stability constraint imposed by the modeling error is quantified, serving as a key metric for assessing the robustness of the SP compensator. Accordingly, the critical impedance ratio \(\mathrm IR_c\), which defines the buffer for IR variability while maintaining stability in the SP-compensated PHIL system, is further quantified in Fig. 5b. This analysis reveals that while a passive SP compensator enhances stability by providing a buffer for impedance variations, it fails to maintain stability when the PHIL system witnesses a broader range of IR fluctuations.

Fig. 5
The image consists of two subfigures. The left subfigure is a Nyquist plot showing contours with and without modeling error, labeled in decibels, with arrows indicating direction. The right subfigure is a 3D plot depicting a surface with axes labeled as IR, w (rad/s), and a vertical axis. The plot includes a legend indicating different functions, with a highlighted point labeled "IR=0.38%".

a SP compensator robustness analysis against modelling error, and b critical IR quantification of passive SP based PHIL setup

To address the limitations of a passive SP compensator, as illustrated in Fig. 6, an adaptive SP compensator is further proposed in [6]. This approach leverages the Sliding Discrete Fourier Transform (SDFT) aided online impedance parameter identification technique, ensuring good agreement between the estimated and reference impedance transfer functions. This allows real-time adaptation of the SP compensator parameters, enabling stable and seamless operation across a broader range of impedance variations during experimental runs. This is essential for a robust PHIL experimental assessment of candidate HOI with naturally fluctuating impedance. Furthermore, this approach can be extended and applied to PHIL setups integrating parallel power electronics systems or physical power networks with dynamic impedance characteristics.

Fig. 6
Diagram illustrating a flow chart of a PHIL experimental setup. On the left, a real-time simulator is connected to a power interface. The center features a Smith-Predictor Compensator and a TP-90kVA power amplifier, with measurement units for voltage and current. The right side shows a 40kW, 256-steps static load setup. Key components are labeled, including digital real-time simulation, online parameter identification, and hardware under test. Arrows indicate the flow of information and power between components.

PHIL experimental setup with adaptive SP compensator

Virtual Shifting Impedance (VSI)-based PHIL stability enhancement: The Feedback Filtering (FBF) method was proposed in [12] to stabilise the PHIL setup at the expense of reduced system bandwidth and accuracy. Furthermore, the physical shifting impedance method was developed in [10] to shift a portion of MOI impedance to the HOI end. However, its applicability is limited by the dependence on the availability of hardware impedances of different values to conduct multiple test cases. To address these challenges, a novel Virtual Shifting Impedance (VSI) interface was developed as part of ERIGrid 2.0 [13]. Building upon existing IAs, this method enhances PHIL stability and accuracy by virtually shifting a portion of the MOI impedance to the HOI side. The detailed derivation and implementation of VSI are depicted in [13]. Compared to conventional approaches, as shown in Fig. 7, instead of relying on physical hardware impedance, this method manipulates the PA controller command to virtually shift impedance, thereby enhancing PHIL stability and extending its operational range without deteriorating the accuracy.

Fig. 7
The image is a circuit diagram composed of three main sections, each outlined in different colors. The first section, labeled "Equivalent of real-time emulated power network (DRTS)," includes a circuit with a voltage source and inductor. The second section, labeled "Power amplifier," features a grid-following converter with various inputs and outputs, including a control system and algorithm. The third section, labeled "Hardware under Test (HuT)," shows a complex circuit with operational amplifiers and labeled inputs and outputs such as V_{in} , V_{out} , and I_{out} . The diagram includes components like PLL (Phase-Locked Loop) and VSI (Voltage Source Inverter).

PHIL equivalent block diagram implemented with VSI algorithm

Fig. 8
Diagram illustrating a power network setup. On the left, a DRTS (Digital Real-Time Simulator) represents an emulated power network, connected to a schematic with components labeled V_s , V_D , Z , and Z_D . In the center, a workstation with a keyboard and monitor displays "Virtual Shifting Impedance" and "Proprietary Controller," linked to a measurement unit for voltage and current. To the right, a power interface with a Triphase 90kVA power amplifier connects to a HiL (Hardware-in-the-Loop) system, featuring a 40kW, 256-step static load bank. The setup is divided into three sections: 1) DRTS, 2) Power Interface, and 3) HiL.

PHIL setup for experimental validation of VSI algorithm

In addition, as presented in [13], the stability performance of the VSI and FBF methods is evaluated by analyzing the frequency responses of the open-loop transfer function of the PHIL setup for a range of example impedances. This analysis offers valuable insight into their comparative effectiveness and highlights the superior stability performance of the proposed VSI method over the FBF method. Furthermore, the applicability and effectiveness of the proposed VSI algorithm are validated using the PHIL setup shown in Fig. 8, where the VSI is implemented within a Triphase 90 kVA PA. Various IRs between MOI and HOI are employed to evaluate the stability performance of both VSI-based and FBF-based PHIL setup. The experimental results presented in [13] highlight the limitations of the FBF method in stabilizing the PHIL setup due to the constraints imposed by a low cut-off frequency. In contrast, for the same PHIL setup, the VSI-based interface maintains stability without compromising accuracy. This demonstrates that the proposed VSI algorithm offers a significant advantage over the commonly adopted FBF method. Furthermore, this demonstrates the capability of the proposed VSI approach to extend the range of PHIL setups with guaranteed stability and accuracy, facilitating the validation of novel smart energy technologies and controls across a broader range of scenarios.

2.2 Approaches for PHIL Accuracy Enhancement

To mitigate the impact of the time delay as identified in Sect. 1.2 on PHIL closed-loop power signal synchronisation accuracy, the following PHIL accuracy enhancement schemes have been developed in ERIGrid 2.0.

Sliding Discrete Fourier Transform (SDFT)-based delay compensation in the abc-frame: A SDFT-based time delay compensation scheme was developed in [5], leveraging its linear phase and sample-by-sample processing mechanism. As shown in Fig. 9, SDFT comprises a comb filter in series with multiple complex resonators that present liner phase and steep cut-off amplitude characteristics, allowing selective update of signal phase and amplitude over frequencies of interest without magnitude distortion and phase shift. SDFT-based delay compensation was achieved by manipulating the PA reference signal in the abc frame and adding an additional phase shift to the output of resonators with the specific resonant frequency. This enables time delay compensation on a harmonic-by-harmonics basis without signal magnitude distortion.

Fig. 9
Flow chart illustrating a signal processing system. The input signal x() enters a comb filter, depicted with a feedback loop and delay element z^{-}. The output branches into multiple paths, each with a resonator filter H_{resk}(z) defined as frac{e^{j2pi k/}}{1 - rz^{-1}e^{j2pi k/}}. Each path includes a multiplier with a phase term frac{e^{jphi_k}}{}. The outputs are summed to produce the final output y(). Key components include comb filter, resonator filters, phase multipliers, and summation.

SDFT-based PHIL delay compensation in abc-frame

Phase Locked Loop (PLL)-based delay compensation in the dq-frame: Building on PA controller modifications, a PLL-based time delay compensation method was developed in [1]. As shown in Fig. 10, compensation is achieved by manipulating the PA command signal and introducing an additional phase (\(\delta _\textrm{comp}\)) to the HOI voltage angle (\(\delta _\textrm{GFC}\)), extracted via PLL. The compensated HOI voltage angle (\(\delta ^{'}~_\textrm{GFC}\)) is further used to convert the current controller output (in dq frame) into a PA modulating signal. This aligns the PA output current with its reference from MOI, effectively compensating for time delay and enabling accurate signal synchronization.

Fig. 10
Diagram of a circuit featuring a current-mode power amplifier (PA) with control components. The circuit includes transistors, diodes, and labeled blocks such as PWM, PLL, and PFD. Connections are shown with lines and arrows, indicating signal flow. The diagram is divided into sections with dotted lines, highlighting different functional areas.

PLL-based PHIL delay compensation in dq-frame

2.3 A Novel Framework for PHIL Sensitivity Analysis

To address the sensitivity issues from above and facilitate quantitative analysis and assessment of the impact of external disturbances on PHIL setups, a framework for sensitivity analysis of PHIL setups has been developed in [11]. A key contribution of this work is the analytical modeling of PHIL systems, focusing on disturbances (\(\delta \)) causing sensitivity issues in two commonly used voltage-type and current-type ITM interfaces shown in Fig. 11. Accordingly, sensitivity transfer functions are derived for voltage-type (\(S^\textrm{v}_n\)) and current-type (\(S^\textrm{i}_n\)) ITM interfaces:

$$\begin{aligned} \begin{aligned} \left\{ \begin{array}{clrc} \displaystyle \ S^\textrm{v}_1(s)& =& \displaystyle \ \frac{ I_\textrm{H}(s)}{\delta I_\textrm{H}(s)}=& \displaystyle \ \frac{1}{1+T^\mathrm{{v}}_\mathrm{{O}}(s)}, \\ \displaystyle \ S^\textrm{v}_2(s)& =& \displaystyle \ \frac{ I_\textrm{H}(s)}{\delta V_\textrm{H}(s)}=& \displaystyle \ \frac{{1/Z_\mathrm{{H}}(s)}}{1+T^\mathrm{{v}}_\mathrm{{O}}(s)}, \\ \displaystyle \ S^\textrm{v}_3(s)& =& \displaystyle \ \frac{ I_\textrm{H}(s)}{\delta V_{\textrm{S}^{'}}(s)}=& \displaystyle \ \frac{C_\textrm{v}(s)/Z_\mathrm{{H}}(s)}{1+T^\mathrm{{v}}_\mathrm{{O}}(s)}, \\ \displaystyle \ S^\textrm{v}_4(s)& =& \displaystyle \ \frac{ I_\textrm{H}(s)}{\delta I_\textrm{S}(s)}=& \displaystyle \ \frac{-C_\textrm{v}(s)Z_\mathrm{{S}}(s)}{[1+T^\mathrm{{v}}_\mathrm{{O}}(s)]Z_\mathrm{{H}}(s)}\vspace{0.1ex} \end{array}\right. \end{aligned} \left\{ \begin{array}{clrc} \displaystyle \ S^\textrm{i}_1(s)& =& \displaystyle \ \frac{ V_\textrm{H}(s)}{\delta V_\textrm{H}(s)}=& \displaystyle \ \frac{1}{1+T^\mathrm{{i}}_\mathrm{{O}}(s)},\vspace{1.5ex} \\ \displaystyle \ S^\textrm{i}_2(s)& =& \displaystyle \ \frac{ V_{\textrm{S}^{'}}(s)}{\delta V_\textrm{H}(s)}=& \displaystyle \ \frac{{P_\textrm{i}(s)}}{1+T^\mathrm{{i}}_\mathrm{{O}}(s)},\vspace{1.5ex} \\ \displaystyle \ S^\textrm{i}_3(s)& =& \displaystyle \ \frac{ I_\textrm{H}(s)}{\delta V_\textrm{H}(s)}=& \displaystyle \ \frac{-P_\textrm{i}(s)/Z_\textrm{S}(s)}{1+T^\mathrm{{i}}_\mathrm{{O}}(s)},\vspace{1.5ex} \\ \displaystyle \ S^\textrm{i}_4(s)& =& \displaystyle \ \frac{ I_\textrm{H}(s)}{\delta V_\textrm{H}(s)}=& \displaystyle \ \frac{-C_\textrm{i}(s)P_\textrm{i}(s)}{[1+T^\mathrm{{i}}_\mathrm{{O}}(s)]Z_\textrm{S}(s)}\vspace{0.1ex} \end{array}\right. \end{aligned}$$
Fig. 11
Diagram illustrating two flow charts labeled (a) and (b), each depicting control systems with various components and signals. In (a), the flow starts with V_s leading to a summing junction, then to a block labeled G_1(s)G_2(s) , followed by another summing junction and a block labeled frac{1}{Z_H(s)} . Feedback loops include components Z_s(s) and G_3(s)G_4(s) . In (b), the flow begins with V_s + V_{zs} leading to a block labeled frac{1}{Z_s(s)} , then to a block labeled G_i_1(s)G_i_2(s) , followed by a summing junction and a block labeled Z_H(s) . Feedback loops include components G_i_3(s)G_i_4(s) . Both diagrams include variables such as delta V_s' , delta V_H , delta I_H , and delta I_s , indicating changes in signals.

PHIL diagrams with a voltage-type and b current-type ITM interfaces

These sensitivity functions are crucial to assess the robustness and enhanced stability properties of PHIL setups and to facilitate the sensitivity analysis of PHIL systems to external disturbances. Furthermore, as depicted in [11], the proposed framework reveals the inherent relationship between stability, accuracy, and sensitivity functions, enabling accurate estimation of PHIL system properties before its final-stage deployment. In addition to the sensitivity analysis criteria, Signal-to-Noise (SNR) and the Total Harmonic Distortion plus Noise (THD+N) metrics are employed to quantify the system sensitivity, facilitating the applicability of the proposed framework.

The applicability of the proposed sensitivity framework was validated through PHIL experiments in [11], demonstrating its effectiveness for testing both elementary and complex power system components. This framework serves as a guideline offering insights into PHIL design principles and sensitivity analysis.

3 Applications of HIL Techniques for CPES Testing

Aided by the advanced methods dedicated to improving the PHIL stability and accuracy, along with the sensitivity framework presented in Sect. 2, PHIL-based RTS techniques have been extensively leveraged to support the experimental validation of emerging smart energy techniques in the following test cases.

Case 1: Applying PHIL to support the development, calibration, and validation of digital twins of active distribution network: Digital Twins (DTs), serving as digital representations of physical assets within a network under various operational conditions, play a crucial role in facilitating the dynamic analysis of Distribution Networks (DNs). Although numerous DT approaches have been proposed in the literature, most have not been fully tested within network simulation models that accurately replicate real-world conditions. This limitation hinders a thorough assessment of their effectiveness in replicating the dynamic behavior of DNs. The joint research presented in [2] bridges this gap by conducting RTS within a PHIL experimental setup to support the development, calibration, and validation of measurement-based, data-driven, and reduced-order DTs for DNs. Figure 12 illustrates the PHIL experimental setup, which consists of a hybrid high-voltage and medium-voltage grid hosted on an RTS platform, while the actual laboratory represents the Low Voltage (LV) DN. Various DN configurations with a variety of load compositions, Distributed Generation (DG) penetration levels, and types of DG controls were implemented. Subsequently, dynamic responses to voltage variations, in terms of real and reactive power at the point of common coupling between the RTS system and LV DN, were collected to aid the development and calibration of the proposed DTs. Furthermore, the developed DTs were integrated into the RTS system to assess their effectiveness in digitally replicating physical LV DN under diverse scenarios. The results demonstrate that DTs accurately reproduce the dynamic real and reactive power responses of the LV DN to voltage disturbances, highlighting the effectiveness of the PHIL-aided DT development and validation approach.

Fig. 12
Diagram illustrating a digital real-time simulation system. The image includes a circuit diagram with labeled components such as power amplifiers and converters. It shows connections between various elements, including a power converter and a load bank. The diagram is divided into sections with color-coded borders, each representing different stages of the system. Text labels include "Digital Real-time Simulation," "Power Amplifier," "Converter under Test," and "Load Bank." Photographic images of equipment are included, showing a power converter and control panels.

Case 1—PHIL testing setup [2]

Case 2: PHIL testing of grid forming control for power system black-start: As power grids transit toward high renewable penetration, Grid-forming Converter (GFC) is transforming black start strategies by facilitating renewable-rich power system restoration with fast response and enhanced resilience. A refined GFC Virtual Synchronous Machine (VSM) control was proposed in [1], tailored for black-start application. The VSM Q-V loop is adapted with voltage ramp-up to enable soft energization, effectively mitigating transformer inrush currents. In addition, the P-w and Q-V loops are modified to enhance voltage support for the restored AC network and enable smooth synchronization between restarted islands and the main grid. As shown in Fig. 13, a PHIL setup incorporating a hardware GFC is employed to validate the capability of the modified VSM controller to restart a simulated network hosted in the RTS platform. The current-type ITM interface method proposed in [3] is used to bridge hardware GFC with the RTS system. The stability and accuracy enhancement schemes, in particular the time delay compensation, presented in Sect. 2 were employed to facilitate a robust PHIL testing environment with enhanced accuracy. The proposed VSM control was evaluated under black-start sequences, encompassing soft transformer energization to mitigate inrush currents, critical load pickup, and grid synchronisation. The test results presented in [1, 3] not only demonstrate the effectiveness of the proposed GFC VSM control strategies but also enhance grid operators’ confidence in adopting these control schemes for subsequent field tests within the Scottish power network. Furthermore, this PHIL configuration establishes a foundation for testing GFC control schemes tailored for black-start and grid ancillary services provision in a controlled environment across a wide range of network conditions.

Fig. 13
Diagram of a testing setup divided into three sections: the left section shows an ambient-assisted power network with a grid, voltage sensor, and data management unit. The middle section illustrates a current-mode power amplifier with control circuits. The right section depicts a grid-forming converter under test with various connections and control elements. Labels and arrows indicate the flow of electricity and data between components.

Case 2—PHIL testing setup [1]

Case 3: PHIL-based assessment of cyber resilience of inverter-dominated microgrids: In inverter-dominated Microgrids (MGs), new vulnerabilities arise due to the extensive use of control and communication technologies. Adversaries can intrude on the CPES, aiming to exploit their dynamics to cause stability and power quality issues. Research conducted in [9] explores the vulnerabilities and impact of stealthy cyber-attacks targeting the synchronization loops of Grid-forming (GFM) and Grid-following (GFL) inverters and their dynamic interactions. This theoretical analysis reveals that well-designed stealthy attacks can potentially lead to the disconnection of the inverter-interfaced resources or even an MG blackout. The PHIL experimental setup, presented in Fig. 14, comprises a real-time simulated MG and a hardware GFL inverter. This setup was leveraged to validate the analysis of the cyber resilience of inverter-dominated MG against stealthy cyber attacks on the synchronization loops of the inverters. It effectively demonstrated that appropriate design of the operational parameters of MG can mitigate the arising anomalies, enabling enhanced cyber resilience against such cyber attacks.

Fig. 14
Diagram illustrating a testing setup. On the left, a digital real-time simulator connects to a microgrid icon. Arrows indicate connections to an amplifier labeled "Voltage AMC130." The center features a schematic with labels: V_{rec, rms}, I_{sp}, V_{cc, rms}, and I_{pm}. On the right, a photo of grid-following inverters is labeled "Power Converters." The diagram highlights software, hardware, and power conversion components.

Case 3—PHIL testing setup

Case 4: PHIL for prototyping and testing digital twins of distributed energy resources: As depicted in case 1, DT acts as a digital replica of physical assets in energy systems, playing a vital role in enhancing system visibility for monitoring and control purposes. The development and validation of DTs necessitate a controlled, yet realistic, testing and validation environment to facilitate their adoption in the energy industry. To address this need, as illustrated in Fig. 15, an RTS-based PHIL testing platform dedicated to prototyping and testing the DTs of DERs was developed in [7, 8]. In this platform, a Visual Studio-based communication emulator was developed and integrated with RTS platform via Ethernet protocol to evaluate the performance of DTs for DERs under communication latency and timing jitter conditions. Moreover, a PHIL setup, aided by the compensation schemes presented above, was employed to integrate a physical GFL converter, replicating the DER within the RTS platform. Case studies were conducted in [7, 8] to validate the effectiveness of the proposed DT prototyping paradigm and testing platform in supporting DER-rich MG frequency control using DTs.With the increasing penetration of DERs in power systems, enhancing their coordination is essential, particularly by strengthening DER visibility despite limited communication constraints. From an application perspective, the improved visibility of the DER enabled by this DT prototyping and testing platform facilitates system-level monitoring and control applications, e.g. voltage and frequency regulation in DER-rich power grids. The proposed platform fosters the advancement of DTs for DERs and accelerates their adoption into modern energy systems.

Fig. 15
Diagram illustrating a testing setup of a PHIL interface and project system under test. The left section shows a PHIL interface with components like a power amplifier and a system under test. The middle section depicts a real-time simulation setup with various interconnected devices and communication lines. The right section features a high-performance PC executing cloud server tasks, including DT-enabled applications and services. Key elements include communication lines, network servers, and a laptop.

Case 4—PHIL testing setup [7]

Case 5: Advanced HIL testing chain for investigating interactions between CPES components during transients: In this case, the interactions between CPES components, particularly during transient power system events, are explored through an advanced HIL Testing Chain, as shown in Fig. 16. This Testing Chain is tailored for both academic and industrial users, such as relay and power electronics manufacturers, as well as distribution and transmission system operators. A range of HIL simulation setups are considered, from basic offline simulations to intricate PHIL simulations, thus creating a robust testing framework. As explained in [14], the different setups, e.g., RTS/Software-in-the-Loop (SIL), CHIL, PHIL and combined CHIL/PHIL, are suitable for investigating different dynamics of interest in modern power system studies. To demonstrate the applicability of this HIL Testing Chain, a case study is presented in [14], focusing on testing an advanced MG smooth mode transition algorithm. Particularly, the interactions between a sophisticated GFM inverter and existing GFL inverters under both normal and abnormal grid conditions are studied. By adhering to the steps of the proposed Testing Chain, valuable insights are gained into component validation during transient events.

Fig. 16
Flow chart illustrating different simulation setups: 1. **RTS/SIL**: Two simulated networks connected via D/A and A/D protocol-based interfaces. 2. **CHIL Simulation**: A simulated network linked to a control device through D/A and A/D protocol-based interfaces. 3. **PHIL Simulation**: A simulated network connected to a power hardware device using D/A interfaces, amplifiers, and sensors. 4. **Combined CHIL/PHIL**: Integrates elements from both CHIL and PHIL, connecting a control device and power hardware device through D/A interfaces, amplifiers, and sensors. Each setup is visually separated and labeled, showing the flow of data and control between components.

Case 5—HIL simulation testing chain steps [14]

4 Closing Remarks

This chapter presents the improved RTS and HIL techniques developed in ERIGrid 2.0. Generic PHIL system modelling, along with the key research and application challenges regarding the stability, accuracy, and sensitivity analysis, are presented. Advanced methods developed to address these challenges are presented, including novel VSI and adaptive SP-aided stability enactment methods, SDFT and PLL-based time delay compensation for accuracy enhancement, and a novel PHIL sensitivity analysis framework.

These advancements have been employed to facilitate a variety of PHIL tests, including the development and validation of a digital twin for LV distribution networks, validation of an improved VSM control strategy for GFC-based black start testing, assessment of the inherent cyber resilience of inverter-dominated MGs against PLL attacks, prototyping and validation of digital twins for DER monitoring and control, and the implementation of an advanced HIL test chain designed to investigate interactions among CPES components. These advancements serve as key enablers for a more robust RTS and HIL testing with enhanced fidelity, facilitating the broader adoption of these techniques for smart power system validation.