Real-Time Simulation-Based Testing of Modern Energy Systems: A Review and Discussion

One can define an energy system as a system that converts one or more energy fluxes into other energy fluxes of a different kind. This definition may describe a relatively small system, for instance, a power plant, a chemical plant, or the heating and cooling apparatus of a single-family house, as well as one covering larger energy needs, for example, those of a city, a country, or even a continent. As energy systems are developed through the centuries, the way we structure these systems goes through changes affected by contextual conditions. Recently, concerns about the availability of traditional fossil energy sources and their environmental effects are revolutionizing the way energy systems are planned, designed, and operated.

O ne can define an energy system as a system that converts one or more energy fluxes into other energy fluxes of a different kind. This definition may describe a relatively small system, for instance, a power plant, a chemical plant, or the heating and cooling apparatus of a single-family house, as well as one covering larger energy needs, for example, those of a city, a country, or even a continent. As energy systems are developed through the centuries, the way we structure these systems goes through changes affected by contextual conditions. Recently, concerns about the availability of traditional fossil energy sources and their environmental effects are revolutionizing the way energy systems are planned, designed, and operated.
Modern energy systems are expected to be multimodal and incorporate electrical, gas, and heat networks to achieve the maximum usage of every form of energy available and include storage capacity [1]. The distributed nature of new resources (generation and storage) and the participation of loads in energy management require fast, reactive control and protection. In this context, the monitoring and control of modern energy systems is expected to be characterized by a distribution of functions. At the same time, to ensure optimal coordination, a significant use of communication media is envisioned [2].
Interactions between continuous dynamics and discrete events are becoming more relevant due to the increasing number of controllable devices (e.g., powerelectronic converters in the electrical grids) and the use of networked control schemes. Energy systems, furthermore, are increasingly driven by market competition. Because of these characteristics, and as well as human involvement, modern energy systems can be classified as complex, and concerns about emerging behaviors might be raised [3].
The complexity of such systems poses significant challenges to how these systems are planned, designed, and operated. In this context, it is crucial that each piece of the system is tested in a more comprehensive way. During the past decade, using incremental prototyping tools [mainly based on hardware in the loop (HIL)] has become a standard practice in industry. In this article, we review and summarize recent developments in specifying validation needs as well as corresponding methods and tools, such as real-time simulation and HIL-based experiments.

Validation Concepts
As outlined, the planning, design, and operation of modern energy systems become more complex mainly due to the networks' cyberphysical and multidomain/modal nature. Typically, in the past, individual domains of power and communication systems have often been designed and validated separately. Also, existing methods generally focus on component-level issues; system integration topics are usually not addressed in a holistic manner [4]. Instead of this wellknown practice, an all-inclusive approach and corresponding methods and tools for analyzing and testing modern energy systems on the system level is required.
During the past years, there has been some progress to introduce formalized concepts for designing and developing modern energy system applications, such as the IntelliGrid method for documenting use cases as well as the smart grid architecture model for developing suitable designs [5]. Also, model-driven development of cyber physical energy systems is becoming more popular [5]. However, when it comes to structured and formalized validation and testing of system-level questions, there exists a lack of concepts. First, promising approaches, such as ERIGrid holistic testing [6] as well as the Joint Research Center interoperability testing approach [7], have been recently introduced, which makes it easier to define testing needs and corresponding plans. Furthermore, available validation methods and tools, spanning from formal analysis/physical equations and simulations/real-time simulations to laboratory experiments and field tests, need to be aligned with these new design and validation approaches. Table 1 provides an overview of the suitability of those approaches through the development process. In the following sections, we review recent progress in the development of real-time simulation and HIL-based methods and tools to support the prototyping and rollout phases.

Real-Time Simulation
During the past years, real-time simulation has become increasingly popular to test and validate equipment and algorithms in a controlled and realistic environment. The synchronization between simulation time steps and the elapsed real time enables the exchange of physical inputs and outputs between the real-time simulator and connected devices since a simulated second corresponds to a second of elapsed time. There are several examples of the use of real-time simulation in power systems: the development and testing of protection and control systems; distributed generation units [9], [10], especially those with renewable energy resource integration and microgrid control [8]; and energy storage solutions [11], [12].
The development of real-time simulation and HIL testing solutions for modern energy systems can be broken down into several subtasks, such as the development of solvers for different time steps, interconnection of laboratories through a communication network, configuration of HIL experiments, and integration of systemwide testing. An overview of different approaches, technologies, and products as well as their performance is provided in [13]. We mainly discuss the latest developments related to the small time-step solvers, laboratory remote connections, and slow dynamics solvers of real-time simulation

Small Time-Step Solvers
Historically one of the main interests for real-time simulation in the electrical engineering field was the testing of relays for terrestrial power systems as, for example, in [14]. In [15], a real-time resistive companion type of solver is presented; in [16], by applying the multiarea Thevenin equivalent [17] concept, a 78-node power system ©ISTOCKPHOTO.COM/EVGENY GROMOV is executed in real time on a PC cluster. Starting at the same time but with a significant growth of interest in recent years, real-time simulation and HIL methods for power-electronic systems have attract the interest of both academia and industry.
With the rise of increasingly larger and more complex energy conversion systems that have ever-faster dynamics, e.g., power-electronics converters based on wide-bandgap power devices, the need for real-time simulators capable of modeling such systems and their fast transients has grown. In this article, we refer to simulators/methods that are able to accurately represent those systems as small timestep solvers (a time step smaller than 500 ns). The strong nonlinear behavior of the system and the small time-step size required by the high switching frequencies are the main challenges of real-time simulation of power-electronics converters.
During the past few years, to face these challenges, there has also been a change in the type of processors used: mixed solutions based on digital signal processors/CPUs and fieldprogrammable gate arrays (FPGAs) are more and more common. FPGAs are used both as an interface and for computation. While CPUs have, in general, higher computation capabilities than FPGAs, the latencies associated with access to memory and communication buses limit the algorithms' parallelizability and make the use of highspeed input-out interfaces difficult, if not impossible. In general, it is hard to imagine the use of CPUs for real-time simulation with a time step smaller than 1 µs. In recent years, the use of FPGA devices has been the center of new work in academia and industry to perform real-time simulation of energy systems with fast dynamics.
A large number of works have been published during recent years, focusing on defining simulation methods fitted for the real-time simulation of power-electronics systems using FP-GAs: in [18]- [20], an ac machine, power converter, and nonlinear power transformer are directly simulated on an FPGA. In [21], a modular multilevel converter is simulated using an FPGA in combination with a CPU. For solutions fully based on FPGA execution, time steps as small as 40 ns [22] have been achieved. A common trend in recently published approaches on realtime simulation is the focus on nonlinear behaviors.
The authors of [22]- [25] focus on defining approaches that enable creating models that, while representing with good accuracy the nonlinear characteristic of power-electronics converters, can be executed in real time with very small time steps. Several papers [26]- [30] have been published that focus on the modeling of device-level behaviors. Even if look-up tables and precomputed behavior are used, this level of detail was, for sure, hardly imaginable for real-time simulation until a few years ago. In [31] and [32], the authors focus on the molding of the nonlinear behavior of electrical machines.
A common problem with the use of FPGAs for real-time simulation is the steep learning curve necessary for the programming of those devices. Recently developed high-level synthesis (HLS) tools are simplifying this process. Several of the papers recently published and previously mentioned use those types of tools; the authors of [33] provide an overview of the use of HLS tools for real-time simulation programming. Another interesting approach for real-time simulation on FPGA devices has been proposed in [34] and [35], where the FPGA has been employed as a solver engine. While FPGA-based solvers can achieve very fast execution with a stable time step as the size of the simulated system grows, their main limitation is resource usage [22], [25]. Numerical methods and interface solutions for multi-FPGA execution are proposed in [36] and [37].

Laboratory Remote Connections
Modern energy systems are often characterized by a wide adoption of power-electronics-interfaced generation and loads, especially at low and medium voltage distribution levels. This leads to an increase of the modeling complexity, often reaching the scalability limit of digital real-time simulators (DRTSs) [38], [39], resulting in a situation where the local available DRTSs might not be adequate for a desired scenario. Furthermore, devices to be tested and simulators are often geographically distributed. Those scenarios can be seen as drivers for distributed simulation and laboratory interconnection.
An often-overlooked aspect for distributed real-time simulation lies in the inherent data confidentiality. Each laboratory/participant can simulate its own part locally while solely exchanging interface variables with the interconnected systems, as depicted in Figure 1. This resembles the logic of the power grid, where regional and national networks are interconnected through tie lines. The communication delay caused by the coupling of different simulators through the Internet may be orders of magnitude larger than the simulation step of commercial DRTSs, which would make the data exchange at every time step impossible. For such cases, a compensation for the delay would be required, which follows the same logic of the interface algorithm used in power HIL (PHIL) experiments [40].

Slow Dynamics Solvers
A common approach to partition power systems for parallelization is the use of the traveling-wave transmission line model [41], which travels roughly 15 km in 50 µs and is a typical time step in real-time power system simulation. The expected delay in Internet-enabled simulation is tens of milliseconds; therefore, the communication delay will cause instability. This can be explained by the sampling theorem, in which the required sampling frequency is at least twice the maximum frequency expected in the systems. A possible solution is the use of static phasors, which implicitly include the system frequency. However, the system frequency is fixed, and, therefore, static phasors do not support variable frequencies. Dynamic phasors are an extension of static phasors. Dynamic phasors were initially developed for power-electronics analysis [42] to increase the accuracy of the state space averaging method. Later, the concept was extended to cover power systems analysis [43], representing a compromise between steady-state solutions and classical electromagnetic transient analysis.
Dynamic phasors are a very efficient method to study signals that have a frequency spectrum in a limited band. This is the typical case for power systems, where all the quantities typically have a frequency content that is in a reasonably small neighborhood of 50 Hz (60 Hz in the United States and Japan). By means of a shift in the frequency domain, the signal can be seen as characterized by  a frequency spectrum limited, roughly, to 0 Hz. As result, longer time steps are possible, enabling a faster and more efficient simulation operation.
In the postprocessing stage, the simulation results are shifted back into the right frequency range. All in all, the process can be interpreted as performing the simulation to calculate the envelope of an oscillatory signal instead of calculating the signal itself. As result, very large systems can be calculated in an extremely efficient way, performing real-time dynamic simulation of complex power systems by also using off-the-shelf hardware. The application of dynamic phasors for multisource and multifrequency systems, including time-varying frequencies, was shown in [44].

Controller HIL
Controller HIL (CHIL) is a methodology that combines numerical simulations with hardware testing. Instead of connecting the controller hardware to the power unit, the controller hardware is interfaced with a DRTS. For example, the input signal, voltage and current measurements, and output signals for power system control are exchanged in real time, as depicted in Figure 2. CHIL testing has become a widely adopted methodology since it bridges the gap between simulation and power experiments. It offers the engineer low costs and risks, combined with high flexibility and fast realization, which can shorten the development cycle [45].

Laboratory-Based Testing of Energy Infrastructure
The focus on CHIL and PHIL is often part of a prototyping chain that bridges the gap between simulation and real implementation. Frequently, the focus here lies on a single component and its interactions with an e mu late d environment. This focus en hances the testing quality of the implemented algorithms and enables the verification of the de si re d s y s t e m behav ior in normal and abnormal operating conditions, while relying on measured values.
Laboratory-based testing of energy infrastructure extends the focus from CHIL and PHIL toward system integration, as shown in Figure 3. When looking at the figure, it becomes obvious that modern energy systems are interconnected networks, which are more complex to design, develop, and validate. They are now a multidomain system of systems. In this context, functionality, integration, and performance assessments have to be verified while also ensuring interoperability and the interchangeability of the designed solutions. This system integration testing needs to bridge the gap between simulations and field trials and is done in a laboratory. In this context, the concept of digital twins, which is already used in the factory automation domain [46], must be applied. The reason for this is that due to the number of possibilities, a field test to assess the performance of every solution and device would not be possible, or at least very time consuming and expensive. Furthermore, in the area of power systems, the network operator is less eager to perform certain tests, which may result in disconnected customers.

CHIL Applications and Examples
CHIL has been applied in different fields, such as vehicles, aerospace, power-electronics converter design, re newable energy sources [47], and microgrids [48]- [51]. Real-time testing for microgrid controllers has become mandatory for validation and compliance testing, therefore recommending CHIL testing for evaluating controller performance [52]. It can be concluded that HIL simulations became an advanced means for investigative experimentation, model validation, and testing before the implementation of electrical subsystems in actual processes [53]. This is reflected in the ongoing standardization efforts [46].

PHIL
The validation of hardware performance is a fundamental step before commercialization. During this phase, the hardware must demonstrate that it achieves the results planned during the analysis stage. The validation is initially left to simulations. However, the accuracy of the results depends strongly on the modeling adopted, and complex modeling, despite its accuracy, may require an unacceptable simulation time for industrial practice [54].
The current practice for hardware validation, e.g., power-electronics converters for distributed generation applications, is to recreate in the laboratory equivalent grids using voltage sources and real impedances, with the goal of reproducing the grid behavior at the point of connection. However, this approach has two main drawbacks: it requires physical changes if new grid conditions are to be tested (e.g., grids with different impedances)  and only the hardware performance at a specific point on the grid can be proved; the performance of the overall network cannot be verified.
To overcome this limitation, the PHIL concept has been introduced [55]- [57]. It combines the advantages of testing real hardware in realistic grid conditions without being limited by the need to build large grids in the laboratory context. PHIL operations involve three main actors: the hardware under test (HUT), which is the equipment whose performance we want to test; a DRTS, where the test grid is simulated in real time; a power amplifier, with the goal to replicate the simulated grid conditions at the hardware level; and a measurement system, which enables us to read physical variables and send them to the DRTS, as shown in Figure 4.

Power Amplifiers and Interface Algorithms
In PHIL applications, finding a method to interface the HUT with the simulated grid has always attracted interest in the engineering community. In the literature, two typologies of PHIL evaluation currently exist: voltage and current. The first [ Figure 4(a)], largely discussed in the literature, is the most adopted PHIL interface that is used to validate customer-level appliances, such as drives [58], onboard systems [59], and renewables and battery plants [56], [60]. In the hardware, the power amplifier replicates the voltage waveform at the point where the HUT will be tested, while the HUT output current is measured in the hardware and reproduced in the software by means of a current source.
During the past years, gridforming converters have attracted significant interest in the scientific and industrial community. These converters'  principal feature is to synthesize the voltage waveform in the fed grid despite the lack of a synchronous connection with the mains. Due to this feature, using a voltage-type PHIL evaluation can be tricky in terms of stability. Two voltage source converters, both controlled in voltage (and presumably with a comparable control bandwidth), that are connected in series can create possible loopunstable conditions. For this reason, current-type PHIL evaluation is carried out for testing grid-forming converters, such as high-voltage dc terminals and smart transformers [61]. An ideal current-type PHIL evaluation is presented in Figure 4. The power amplifier is a current source converter that, connected to the gridforming converter under test, reproduces in the hardware the current demand of the simulated grid. The voltage waveform, synthesized by the converter, is then measured and replicated in the software by means of a controlled voltage source at the point of common coupling with the fed grid.
However, an ideal current-type PHIL is difficult to realize due to the lack of a current source converter-based power amplifier. For this reason, a modified current-type PHIL interface is proposed in [61] and [62]. As can be seen in Figure 4(c), the power amplifier is still a voltage source converter, but it is controlled in current by means of a high-bandwidth current implemented in either the DRTS or a customized microcontroller. The main advantage of this approach concerns the currenttype PHIL evaluation of voltage source converters, which are widely available in the market. As a drawback, the ability of the power amplifier to accurately reproduce in the hardware what occurs on the simulated grid is strongly dependent on the interface current controller bandwidth.
The need to accurately reproduce the software currents in the hardware calls for increasing the current controller bandwidth. On the other hand, an aggressive current controller can destabilize the loop. As concluded in [62], a tradeoff between accuracy and system stability must be found to precisely represent higher-frequency current content in the hardware without making the system unstable.
When designing a PHIL experiment, is important to take into consideration some practical aspects that may significantly impact the accuracy of the performed test. PHIL interfaces add nonidealities in the loop, thus affecting the accuracy of the evaluation. To properly address the accuracy of the PHIL evaluation, three main factors have to be considered: ■ Communication between the DRTS and power interface: All PHIL com-ponents work with a specific time step, depending on the computational capabilities of their respective controllers. As can be seen in Figure 4, digital-to-analog conversion (DAC) and analog-to-digital conversion (ADC) stages are interposed between the real and simulated systems. This implies that analog measurements have to be discretized within the sampling frequency of the DRTS (typically 20 kHz) and HUT (typically in the range of 5-20 kHz). As consequence, further delay is introduced in the loop, which can affect the accuracy and stability of the system. ■ Software interface: The stability and accuracy of the PHIL evaluation are affected by the strategy to interface the software and hardware sides. Several algorithms have been developed and their characteristics investigated in the literature [56], [57]: the ideal transformer method (ITM), transient first-order approximation (TFA), transmission line approximation (TLA), partial circuit duplication (PCD), and the damped impedance method (DIM). Each of these techniques has advantages and disadvantages related to the simplicity of their implementation, accuracy, stability, and need for external interface impedance (see Table 2). Since this topic is widely  described in the literature, it is not deeply treated here, but the reader can refer to well-known literature in this regard for a detailed explanation [55]- [57]. ■ Power interface dynamic and rating: Accurately representing the simulated variables in hardware is fundamental for a correct representation of the simulated phenomena. However, this representation depends on the capability of the power interface to dynamically follow the reference signal coming from the DRTS. Currently, two power interface technologies are available on the market: the switching element-based power interface and linear power amplifiers. In the first category, all the semiconductorbased technologies are included.
The advantages of the switching element-based power interface lie in high power ratings [55]- [57] and power bidirectionality, which enables the current to be sent back to the grid without the need to burn it in external resistors. The drawback to this technology is the limited bandwidth of the converters (up to a few kilohertz) and the input/ output delay (on the order of a few hundred microseconds). Linear power amplifiers, instead, are based on linear operational amplifiers that facilitate a high bandwidth (up to 180 kHz). However, linear power amplifiers are still largely limited in their power ratings (up to a few hundred kilowatts), and they do not enable bidirectional operations. If a four-quadrant mode (positive/negative current/voltage) is requested, this technology requires integrating external resistors to burn the reverse power. Another limitation of these devices is the linear dependence of the power injection on the voltage level. Because they are linear operational amplifiers, the rated power is possible only under nominal voltage conditions. A lower voltage linearly limits the power that can be injected by the amplifier. A third possibility exists in the market despite the fact that it is not used for distribution grid-level tests: synchronous generators are exploited for balanced grid testing, with clear constraints in the bandwidth and accuracy in representing current and voltage (Table 3). • Based on the long-line decoupling method that is a well-known approach for decoupling large systems • Numerically stable due to the trapezoidal implementation • Need for a physical resistor that leads to high losses in large-power applications • The resistor value needs to be updated any time the simulated system changes, leading to low flexibility. • Online topology changes to the simulated system are not possible due to the fixed resistor value in each experiment.

PCD
• Based on the software relaxation technique, enabling splitting the loop in two subsystems • Higher stability than the ITM algorithm, due to the possibility of changing the linking impedance and keeping the hardware/software ratio below unity • Need for a physical impedance • To reduce the error in each iteration, the linking inductance will be larger than that of the HUT and simulated grid, leading to high power losses. • Low accuracy resulting from the difficulty of realizing a large linking inductance DIM • A method mixing PCD and ITM, inserting a damping impedance • If the HUT equivalent impedance is accurately estimated, the loop error tends to be zero. • Lower power losses than the PCD method • Estimation of the HUT equivalent impedance is not easy to acquire; thus, the loop error depends on the HUT modeling error. • The HUT equivalent impedance is influenced by the HUT controller; thus, different controllers may strongly affect the loop accuracy. • No power reverse is possible; thus, the system needs resistors to burn the power sent back to the power amplifier. This feature is usually limited to one-third of the power amplifier's rated power. • The power capability is directly dependent on the voltage. PHIL Applications, Examples, and Existing Facilities PHIL has been chosen as a validation tool in a large number of academic and industrial applications. As an example, voltage-type PHIL is commonly adopted for the validation of renewable energy sources. Several examples are present in the literature. Microgrid facilities, composed of batteries, diesel generators, electronic loads, and renewables, are interfaced with PHIL setups to validate grid integration tests with fast (e.g., a drop in the irradiation in photovoltaic plants) [63] and slow dynamics (e.g., a power dispatch of renewables) [21].
High-power facilities, in the range of megavolt amperes, are beginning to be developed in university and industrial facilities. Energy Lab 2.0, established at the Karlsruhe Institute of Technology, Germany [64], has a 1-MVA PHIL facility that can be interfaced with a 1-MW photovoltaic power plant, 50-kW flywheels, and large battery storage systems. Wind turbine generators can be tested in the range of 10 MVA at the Fraunhofer Institute for Wind Energy Systems, Bremerhaven, Germany [65]. This setup is mainly used for wind turbine validation and certification purposes, with the possibility to reproduce a large variety of grid conditions less expensively than using only a hardware-based test bench. Electric drives are tested at Florida State University, where a PHIL setup on the order of 5 MW and 4.16 kV has been realized [58].
Although the main PHIL application relates to the scientific and industrial aspect, education must be considered, too. As described in [63], basic power system operations, such as the effect of increasing the integration of distribution generation and power sharing between generators, can be effectively taught in classrooms by means of PHIL ( Figure 5).
Students are able to directly witness real practical problems, such as the impact of the line impedance ratio on the voltage control, and adopt remedial control actions in person.
At Kiel University, a 45-kW modified current-type PHIL facility has been built for validating grid-forming converters, such as smart transformers and grid-forming converters [61]. This setup enables the exploration of new control features for asynchronously connected grids, such as voltage control and fault current limitation. Another interesting PHIL setup using a voltage-type approach is provided by the AIT Austrian Institute of Technology, which enables the testing of inverter-based distributed energy resources and storage devices of up to 1 MW as well as active distribution grids with corresponding control strategies. Therefore, the AIT lab provides a configurable low-voltage distribution grid with test places for distributed energy resources and storage devices that can be connected via switchedmode (up to a roughly 800-kW power range) and linear amplifiers (up to an approximately 30-kW power range). It also offers a commercial DRTS to characterize and test the aforementioned components and evaluate their impact on the grid (e.g., power quality studies, unintentional-islanding testing, fault ride-through testing, the charging behavior of electric vehicles and energy storage systems, and control and automation system validation), as described in [67].
In addition to the previously listed examples, the authors of [8] provide a comprehensive overview of real-time simulation and PHIL-related applications covering functional applications (designing, rapid prototyping, testing, teaching, and training), field-specific applications (power systems, distributed energy resources/power electronics, and control systems), and simulation fidelity-based applications (EMT and phasor and hybrid simulation) of smart energy systems.

Future Research
Modern energy systems tend to be more complex than traditional approaches due to their cyberphysical and multidomain/modal nature. In particular, their planning, design, and implementation phases (including validation and testing), as well as their operation, need suitable concepts, methods, and corresponding tools. This article summarized real-time simulation/HIL-based validation and testing approaches, which tend to be more suitable for complying with future needs. Those approaches have been further developed during the past couple of years, and they are used now on a broad scale.
However, the cyberphysical nature of modern energy systems requires further development and harmonization/ standardization (such as IEEE Standard P2004 for real-time system/HIL recommended practices) of the tools. The implementation of DRTS-based application is still time consuming and highly linked with the provided tools from the corresponding manufacturers. Model exchanges and coupling different DRTSs from various vendors need to be improved to enable a multidomain/modal analysis of modern energy systems. There is still enough room and an adequate need for future research and technology development.
Thomas Strasser (thomas.strasser@ ait.ac.at) is with the AIT Austrian Institute of Technology, Vienna.