Power Hardware-In-the-Loop Approach for Autonomous Power Generation System Analysis

The article presents the Power Hardware-In-the-Loop (PHIL) dynamic model of a synchronous generator of 125 kVA for autonomous power generation system analysis. This type of system is typically composed of electrical energy sources in the form of several diesel generator units with synchronous machines, the main distribution switchboard and different loads. In modern power distribution systems, the proposed power management strategies are typically aimed at the minimization of fuel consumption by maintaining the operation of diesel generator units at peak efficiency. In order to design and test such a system in conditions as close as possible to the real operating conditions, without constructing an actual power distribution system, a PHIL model in the form of a power inverter that emulates the behaviour of a real synchronous generator is proposed. The PHIL model was prepared in the MATLAB/Simulink environment, compiled to the C language and fed into a 150 kVA bidirectional DC/AC commercial-grade converter driven by a HIL real-time simulation control unit. Experimental research was performed in the LINTE2 laboratory of the Gdańsk University of Technology (Poland), where the PHIL emulator was developed. The proposed model was validated by comparing the output voltages and currents as well as an excitation current with the measurements performed on the 125 kVA synchronous generator. The obtained results proved satisfactory compliance of the PHIL model with its real counterpart.


Power Hardware-In-the-Loop Background
In order to design and test a system in conditions as close as possible to the real operating conditions without constructing an actual expensive and space-consuming system, a Power Hardware-In-the-Loop (PHIL) technique has been proposed. Such a modelling approach is used in a variety of industrial branches, e.g., the aviation industry [1], the drives industry [2] and power converter developments [3]. The PHIL models allow the development of a power management system in laboratory conditions. There are several approaches to PHIL modelling.
The first is to use the digital signal processors (DSPs), field-programmable gate arrays (FPGA) or commercial real-time machines (HIL) with the power amplifier, which amplifies the instantaneous values of voltages and currents in the form of waveform signals [4][5][6]. The second approach is to use the power inverter control algorithm for the required output signal generation. This second approach uses internal resources of the inverter control board DSP to control the output values [7][8][9]. The approach proposed in this research uses functional level modelling in a dedicated real-time simulation unit, which reduces the computation time and the overall complexity of the model. DC or RMS values calculated in this unit are then sent via DAC I/O interface to the inverter. This feature enables the PHIL model to be implemented using a commercially available and relatively inexpensive scalable power amplifier. However, the limitation of this approach is its lack of possibility to inject or to control harmonics, which could be potentially used in the fault diagnosis studies. For example, in the context of the marine industry, where the everyday operation, maintenance and servicing of the ship power distribution system is difficult due to the distance from the land and the specialized, well-equipped repair services, the adequate PHIL model helps to study and to test certain emergencies or control strategies when the target object (a ship) is far in the sea. The following article presents the PHIL model in the form of a power inverter, which emulates the behaviour of the real machine.
Modern distributed smart grid power systems are relatively complex structures in terms of their control and their ties to the main power grid. The development of such systems or the evolution of existing system components requires tools that allow for flexible and robust analysis of different steady and transient states of system components. PHIL and its more overall system approach, the Power-System-Hardware-In-the-Loop approach [10], allows for the rapid development of modern smart grid control strategies. Distributed power system operation in off-grid conditions, such as the marine or aeroplane power systems, due to more stringent environmental requirements that are also experiencing rapid development.
The overall objective of this development is the improvement of the system efficiency as well as the reduction of greenhouse gases from those systems. As a result of those trends in the marine industry for example, new components are added to the system, such as Battery Energy Storage Systems (BESS) and solar and wind renewable energy sources. The increase in complexity of those systems introduces risks connected with the safe operation of the power distribution system [11]. For this reason, modern marine Power Management Systems (PMSs) rely on the real-time diagnosis of system components. The PHIL approach allows for such control system development in safe laboratory conditions [12].
This research focuses on the development of an adequate PHIL model and control strategy to accurately emulate the behaviour of synchronous generator units in autonomous power distribution systems.

Autonomous Power Distribution System Overview
The autonomous power distribution system is usually composed of an electrical energy source in the form of several diesel generator units with synchronous machines, the main distribution switchboard and different loads. The main objective of this system is the supply and distribution of electrical energy among the loads. In modern power distribution systems, the usually proposed power management strategy is aimed at the minimization of fuel consumption by maintaining the operation of the diesel generator units at peak efficiency.
Due to the increase in complexity of modern diesel-electric and hybrid power distribution systems, there is an increase in the operating modes of the typical diesel generation system. Sudden load changes due to large loads and BESS operation may occur due to the failure of some system components. Such a transient state leads to temporary changes in power system voltage amplitude and frequency. The PMS control algorithm is designed to maintain constant power system voltage amplitude and frequency; however, due to the transient state changes in those values other power system controllers and modern protection equipment operation might be affected [13].
Another aspect of the autonomous power system development using the PHIL approach is the development of online diagnostic tools for the PMS. The basis for the real-time diagnosis of the power system components can be the ESA (Electrical Signature Analysis) or the MCSA (Motor Current Signature Analysis) techniques. Those methods are based on comparing the armature voltage and current waveforms with the waveforms of a healthy component. In MCSA used for generator analysis, only stator (armature) current measure-ments are collected and processed to identify small changes in current signatures. The ESA method additionally uses the measurement of the stator (armature) voltage.
It has been shown that, after appropriate treatment, ESA indicators are sensitive to mechanical and electrical disturbances occurring in the machines and their driven devices [14][15][16]. The PHIL approach will allow for diagnostic system development as it is relatively easy to incorporate selected generation system internal and external failures to the system's model.

Objectives and Scope
The main objective of the research is the development and performance analysis of the PHIL model of a synchronous generator operation in an isolated power system. The power system on load transient and steady-state performance is used for model verification and proposed solution validation. The main contributions of the presented research are: • The development of a discrete model of synchronous generator, including electrical and electromechanical equations in a MATLAB/Simulink environment. • The implementation of the developed model in a power amplifier control algorithm. • PHIL simulation and measurement performance analysis as well as model verification.
The main hypothesis of the research is that it is possible to accurately emulate both the steady-state and transient performance of the SG using a real-time simulation, analogue I/O interface and commercial-grade power inverter as the PHIL system power amplifier. This contribution is significant in the development of adequate tools for power system performance analysis. Normally, such a system requires either an expensive power amplifier or a model to be implemented in the DSP processor of a converter. The presented approach aims to show that it is possible for certain applications to use a commercial-grade power converter, one that can be controlled by setting the RMS and frequency values from an external real-time system and I/O interface.

Synchronous Generator Model
The synchronous generator model used for the PHIL application is the classical d, q model described in [17] and shown in Figure 1. Such models are relatively simple, and thus they are widely used and described in the literature [18][19][20][21]. The differential Equation (1) describing the above equivalent circuits was rewritten in the MATLAB/Simulink environment in the discrete form. The parameters of the model were identified in the frequency domain using the Standstill Frequency Response (SSFR) test [22,23] and the least-squares problem procedures. The identified equivalent circuit parameters in [p.u.] are presented in Appendix B.
The flux linkages are given by the equation system (2).
The mechanical behaviour of the driving machine and the generator unit is described by Equations (3) and (4), where T l is the driving torque set by the proportional-integral (PI) regulator. T e is the electromagnetic torque and B m is the friction coefficient. J is the inertia coefficient and p is the number of pole pairs.
One of the common issues that arise during real-time model building is the presence of algebraic loops. Indeed, in the synchronous generator mathematical model, the flux linkages λ depend on the machine currents i, while to calculate the currents, one has to know the linkages values. Such a situation can be usually solved by breaking the loops using delay blocks (z − 1). Unfortunately, in some cases, even if this solution works for MATLAB/Simulink simulations, it provokes instability while compiling the model to C language. Therefore, the authors propose a different approach consisting of rewriting the Equation (1) in MATLAB/Simulink using integration blocks instead of differential ones. Thus, the damper bars flux leakages are calculated using Formula (5) while the damper bars currents are calculated using Formulas (6) and (7).
In that case, adding the delay blocks does not result in numerical model instability.

Machine Emulation
Generator model prepared in the MATLAB/Simulink environment ( Figure 2) was integrated into the real-time control algorithm of the DC/AC converter (FW functional unit). The general algorithm parameters, including the generator rated data, are configured by editing the m-file containing the set of initial variable values necessary for the operation of the functional unit controller (FUC). Then, these parameters are loaded into Workspace memory in MATLAB. After compiling the model in the Simulink environment with the parameters loaded previously, the resulting C program is automatically loaded to the functional unit controller.
The real-time model calculation step was set to 1 ms. In each time interval, the AC phase voltages, line currents, converter frequency and DC voltage were measured by the RTDAC4 I/O card within the FUC. Raw sampled values were converted, scaled and used to calculate RMS line current, voltage and the active and reactive power (Figure 3a). Those quantities were then fed into the generator model as inputs for the calculation of the RMS line voltage and frequency based on the mechanical speed ω r . At the same time, the field voltage and current from the MATLAB/Simulink generator model were also calculated.
The reference values at the output of the generator model in the range of 0 to 1 were scaled to the appropriate voltage level and then converted to UINT16 variable type. Following the above mentioned operations, the values were sent to the RTDAC analogue output channels ( Figure 3b) and fed to the FW DC/AC inverter. In the proposed approach, the inverter input parameters are typical set values for a commercial-grade inverter, such as the AC output voltage amplitude and frequency. For the frequency or the rotational mechanical speed ω r , a simple prime mover PI regulator was used. The output frequency of the model is dependent on the regulator parameters, the electromagnetic torque calculated based on (4) and the combined machine moment of inertia J.

Dynamometer Test Bench
The performance of a discreet electromechanical model of synchronous generator working in autonomous power system was compared with the experimental results of the Elmor GCh114a/4 3-phase, 4-pole, 125 kVA (0.8 pf), 400 V (wye-connected) salient pole synchronous machine (rated data in Appendix A). On load transients and steadystates were measured using a dynamometer test bench with speed and torque control ( Figure 4). The diagram of the measurement setup is presented in Figure 5. Measurements of voltages and currents during resistive and inductive loads (100 kW and 20 kVar at 400 VAC) connections were acquired using LEM ® current transducers and the ZES ZIMMER LMG670 power analyser.

PHIL System Description
After the experimental validation, a synchronous machine model was implemented into the Power-Hardware-In-the-Loop system. The PHIL hardware consisted of three main groups of components, which are presented in Figure 6.
The behaviour of actual synchronous generator working in isolated, island-like power system was replicated by the 150 kVA bidirectional DC/AC converter (Functional Unit (FU)), which was connected to the rest of the power system by three-phase 400 V AC bus on one side and to a 650 V DC bus on the other. The DC/AC converter marked as 1 in Figure 6 acted as the sole energy source (a generator) for the other functional units (active and reactive loads) described in this research.
Transient states occurring after switching on and off the load connected to the converter could imitate the autonomous power generation system performance, where voltage and frequency variations are common phenomena. The functional unit was governed by a Functional Unit Controller (FUC), marked as 2 in Figure 6. The FUC includes a 64-bit Intel PC with off-the-shelf components mounted in a 19" rack chassis (Target PC in Figure 6). This runs the Simulink Real-Time kernel and executes the real-time control algorithm for the functional unit. In order to be able to interface with the DC/AC converter, the FUC is equipped with a measurement and control card (RT DAC4 I/O PCI CARD in Figure 6). This enables necessary analogue input channels for measuring phase currents, voltages, converter frequency and DC voltage. Binary states informing about the present status of the unit are also monitored. Finally, there are provided analogue and digital outputs that send reference values of AC voltage, frequency and work-mode into the converter. Host PC, marked as 3 in Figure 6, is used for algorithm development and control through Simulink Real-Time Explorer. The SCADA environment ensures control over the whole power system described in the following paragraph.
The power electronics and real-time simulators used in this research are part of the LINTE 2 laboratory of the Gdańsk University of Technology (Poland). This is an R&D structure designed to emulate a modern power distribution system-albeit on a reduced scale. LINTE 2 installation includes so-called functional units responsible for: autonomous power generation, the emulation of power sources, the emulation of HV and MV transmission lines, energy storage, a transformation of energy, EVs charging and emulation of consumer loads.
Those units can be set up thanks to purpose-built switchgear, including AC and DC buses, contactors and circuit breakers accessed via IEC 61850 protocol. Each of the functional units is governed by a functional unit controller (Target PC in terms of the real-time simulation). The real-time algorithms can be used and edited individually for each of the controllers, by a Simulink-Real-Time Explorer or through the SCADA control system. The experimental validation of the PHIL model was conducted using three functional units. The synchronous generator model was employed on a bidirectional DC/AC converter (FW) operating as a voltage source. The unit was the sole energy source with regulated voltage amplitude and frequency in the modelled autonomous power system. The FW was supplied through a DC bus with 650 V using an additional AC/DC converter, which is a part of the battery storage functional unit (BA). The BA converter was powered from the main AC bus with 400 V. To test the behaviour of the model under different scenarios the FW was connected with the LOAD4 unit, which presented a passive resistive and/or inductive load to the modelled generator. The SCADA connection diagram is presented in Figure 7.

PHIL Emulator Validation
The MATLAB/Simulink model was verified by comparing its electric behaviour with the measurements performed on the 125 kVA synchronous generator. This model was used to set up in real-time the output voltage and frequency of the converter FW. Finally, the PHIL emulator of the generator unit was validated.
A series of tests with the different load characteristics (active, reactive and activereactive) and values were conducted to investigate the dynamic behaviour of the proposed PHIL model. Three sets of data points were compared: the measurements on the SG, simulation model power converter setpoint calculated based on the measured load current and active and reactive power, and measurements of the FW converter output voltage and frequency. Figure 8 shows an overall simplified diagram of the three sets of data points compared in this section.  Moreover, the tests included both switching the load on and off. The load applied to the machine and the emulation system had 100 kW of active power at 400 V and 20 kVar of reactive power at 400 V. Figure 9 shows the armature voltage during (a) the load being connected and (b) the load being disconnected. The armature voltage drop is caused by the lack of an Automatic Voltage Regulator (AVR). In general, values calculated using the model implemented in the PHIL system are used as the set points for the converter. Generally, the difference between the simulation setpoint and the converter output is insignificant and results from the internal converter regulators and interference issues.
The difference between the PHIL model and the SG measurements can be explained by the model overall simplifications: lack of saturation effect implemented in the model, simplified single d and q axis reactances modelling the damper rotor winding and simplified model of the excitation power source developed using only the voltage source and internal resistance. Those simplifications influence the behaviour of the PHIL system in transient states.
Moreover, dynamic changes of the setpoint values calculated using the model, with the internal limitations of the FW converter influence the converter output. It can be observed especially in the voltage during the load connection transient, when sudden change in system load impedance causes a drop in the converter output voltage. This is a limiting factor for the use of a commercial-grade converter as a power amplifier in such a PHIL system. Figure 10 shows the armature current of the SG and its emulation system values. The power load disconnection in both the emulation and measurements occurs very similarly and is due to the fact that, in both cases, the current is controlled by a switch. The error observed for the time from 0.5 to 1 s is determined by the FW converter capabilities and observed for the time from 1 to 3 s is determined by the model simplifications.
The excitation voltage and current during load connection and load disconnection are shown in Figures 11 and 12, respectively. In this case, one can only compare two data sets, the measurements of the SG and the simulation results. The model being the part of the PHIL system calculates all of the internal machine variables, such as the excitation, armature and damper winding currents, voltages and magnetic fluxes. However, only the armature voltage and frequency are the input values of the FW converter. The other variables are the model calculation results made using actual measured armature current, active and reactive powers.     Figure 13 shows the SG armature voltage frequency. In this figure, one can see that, during the load connection, both the measurements and emulation values are very similar. However, during the load disconnection, there are some differences between the setpoint and the actual output frequency of the FW converter. The observed differences are due to the model simplification. In this case, the SG measurements were carried out using a dynamometer test stand with its own closed loop control system. The simulations were carried out using simple PI speed regulator model. However, the dynamometer may be equipped with more sophisticated control system with different or changing regulator parameters.  Despite some inaccuracies in the transient states, the presented waveforms show high compliance of the emulation with the measurements. The noise observed in the calculated curves is due to the fact that the values are calculated using measurements (active power, reactive power and line current) acquired by the online acquisition system of the PHIL model. The calculated values are then used for setting up the emulating converter. Nevertheless, the designed PHIL model of the synchronous generator reflects, to a large extent, the electrical and mechanical behaviour of the real machine.

Conclusions and Perspectives
The proposed PHIL approach for the emulation of the autonomous power generation system was validated in the presented research. Implemented synchronous generator model simplifications allowed for accurate real-time simulations. Variations of the output voltage amplitude and frequency observed in the generator PHIL model represent the real behaviour and performance of the machine in transient and steady states. Parameters of the model determine, to a large extent, the electrical and electromechanical performance of the synchronous generator emulator.
The model was developed and implemented in the MATLAB/Simulink environment using discrete-type function blocs. This allowed for the model to be compiled into the C language and implemented in the Real-Time Unit of the dedicated PC.
The presented results prove the usefulness of the PHIL modelling technique for the design and analysis of the autonomous power generation system. The implemented model is versatile and scalable, which allows for the application of different load levels and load characteristics. In summary, the main advantage is the possibility of using a standard power converter as the power amplifier eliminating the need for expensive and complex dedicated emulation systems. The main drawback of the presented model is the lack of magnetic saturation representation in the model parameters.
Due to the nature of the autonomous operation of the generation system, the machine magnetizing flux and terminal voltage can change in transient states, thus, influencing the nonlinear parameters of the model. In the research, the generator was not equipped with an Automatic Voltage Regulator (AVR); therefore, after applying the active and/or reactive load, the steady-state armature voltage level remained decreased.
The presented model will be further developed to incorporate additional physical phenomena, such as eddy currents in massive parts of the rotor or damper bars and magnetic saturation [24]. Moreover, further research will also include the analysis and measurements of a diesel generator unit equipped with the AVR. Finally, the PHIL approach will be used in the synchronous generator diagnostic system, supporting the fault-condition detection in generator performance.

Conflicts of Interest:
The authors declare no conflict of interest. The founders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.