Real-time simulation of a turbo-shaft engine ’ s electronic control unit

. Hardware-in-the-loop (HIL) simulation is a comprehensive and repeatable manner for system-level testing of any control system. One of the ﬁ rst steps in an HIL simulation is to execute a preliminary real-time test where all parts of the control system are modeled numerically on separate personal computers (PC). In this paper, a real-time simulation of such preliminary real-time test has been conducted for an electronic control unit (ECU) of a gas turbine engine. The plant of the control system is a gas turbine model for a two-shaft turbo-shaft engine, loaded on an industrial personal computer. The turbine ’ s controller is actually another computer on which ECU ’ s software model is generated via software as well. ECU acts as a controller for the gas turbine and it ensures the operational reliability by limiting the angular speed, angular acceleration of the engine ’ s shafts and other parameters within their allowable working range. Signal interactions between control system parts are created via data acquisition cards. Different gas turbine load functions are fed as inputs to the engine model and results are compared to those of a same control system, modeled completely on an individual PC in real time. The latter is otherwise known as software-in-the-loop (SIL) simulation. The results show the acceptable functionality of the test setup.


Introduction
In design and construction process of a system, designer would better run a simulation of his model before construction, to guaranty the accuracy of the system's performance, because testing a real system is not only costly and time consuming, but might not be applicable in some conditions to which the system is imposed. One of the most common procedures in performing such a simulation is hardware-in-the-loop (HIL) simulation which provides a test bed for interaction between software and hardware in real time. In HIL setup, some parts of the system are modeled numerically while the remaining parts exist as real components. Therefore, there is no need for the system to be built completely. Moreover, data acquisition equipements provide the possibility of data transfer between hardware and software in an HIL simulation.
The advantages of such simulation are numerous. Utilizing the real hardware in the simulation resolves the need for software simulation of certain parts and reduces the software development time dramatically. On the other hand, it obviates the need for performing costly and often hazardous certification testing of the real system, specifically a gas turbine engine.
HIL simulation could be a suitable framework for calibration and initial credibility test for control systems [1,2] and as a result, has been extensively used not only in various gas turbines, but also in testing electronic systems, civil applications, aerospace and automotive industries in recent years.
Hanselman [3] used HIL simulation in the control development of ECUs used in engines, vehicles and other components. In [4] another HIL simulation is presented to control an unmanned vehicle. In this procedure, a real camera captures pictures of a virtual 3-D environment which would later be used in a control system.
Electric power steering (EPS) system of an automobile plays an important role in ensuring stability and proper handling. This system could assist the driver in vehicle's role rotation by means of an electric motor while anti-lock breaking system prevents slippage by controlling the wheels. In [5], an HIL simulation of these systems is presented. Cao et al. [6] verified the validity of their control scheme based on adaptive network-based fuzzy inference engine using HIL test.
Many theoretical procedures for inspecting structures' behavior under seismic loading have been presented as in [7,8].
In [9], motor and fuel cell of a small aircraft are evaluated using a real-time HIL simulation. In this test, mechanical and electrical loads are simulated and given to the motor as inputs, in a verity of flight conditions. Hence, the fuel cell's consumption rate could be monitored in a long flying period.
Numerous HIL applications have also been reported for industrial and aerospace gas turbines. For example in [10], a multi-platform HIL realization for a micro-turbine synchronized with a generator is demonstrated. HIL simulations have been presented for jet engines [11,12] and jet engine fuel control unit [13]. Bao et al. [14] and Duan et al. [15] have executed HIL simulations for testing the control system of turbofan engines. An HIL simulation for three-shaft gas turbine engine is established in [16].
Despite this broad application range for HIL simulation, errors are inherent in each HIL test and should be accounted for. Therefore, identifying the factors that contribute to errors is an important step toward making an HIL simulation as close to reality as possible.
In this paper, a preliminary real-time test for an electronic control unit of a two-shaft gas turbine engine has been presented for the mentioned purpose, and test bed preparation of such simulation is discussed. In this test, the plant and the controller are modeled numerically on separate personal computers using Simulink Real-Time Workshop (RTW) of Matlab software for both models (RTW creates a real time application in the Simulink model). Signal connections between plant and controller would also be established between two computers via input/output (I/O) cards. At the end, real-time simulation of the control system is performed. Since both models are present in the form of software model, if test results differ from those of the software-in-the-loop (SIL) simulation (where all parts of the control system are loaded on one computer), the accuracy of the hardware used in the test (such as connections, data acquisition cards, I/O ports, etc.), could be estimated. This preliminary test for any control system that is supposed to be simulated in an HIL simulation will be of great importance. This real-time simulation is a novel contribution for a turbo-shaft engine since such report has not been presented for any type of two-shaft gas turbine engine (to the authors' knowledge).
The concept of HIL of such an engine and its difference from testing a real engine are schematically shown in Figure 1.

Model description
A control system mainly consists of a controller, actuators, sensors and a plant. In the control process of the gas turbine engine presented in this paper, ECU is the controller which regulates the fuel flow to the engine based on rotational velocities of the gas turbine shafts and the engine's reference rotational velocity (RRV). The schematic of this control system is demonstrated in Figure 2.
ECU is actually the gas turbine's intelligence. It controls the input fuel flow to the motor (in kg/s) as precisely as required along with providing a safe working environment. Hence, ECU immaculate behavior is one of the most important factors in designing a gas turbine engine.
As illustrated in Figure 2, one of the engine inputs is the fuel flow rate, calculated by the ECU. In other words, ECU's output is the fuel flow. Load is another input to the engine which is set by HIL test operator. With these two values entered to the engine model, the shafts' angular velocities (power turbine shaft and gas generator turbine shaft angular velocities denoted by NPT and NGG) are estimated and then fed back to the ECU as two of its three inputs. The third input parameter is the desired angular velocity of the power turbine shaft which is set as a required reference value (RRV). The required fuel flow rate, which is  a function of these input signals, is then calculated by the ECU and forwarded to the engine as its input and this control loop continues. Input and output signals are transferred via I/O cards between the ECU and the engine.

Engine model
One of the methods of nonlinear system modeling is to use the block-oriented model which is used widely in engine modeling due to its acceptable accuracy and time-response.
In this method, the linear time-invariant dynamic subsystems (modeled by a single block) are linked to the nonlinear static elements (also represented by another block).
Blocks may be connected in different ways such as series, parallel or feedback. This causes the block model the flexibility to present a more realistic definition of the system. However, the simplest approach is composed of two blocks is series. If the model output is the nonlinear part, the model is Wiener model.
Nonlinearities of the Wiener model are not dependent on the input amplitude but on changes of static and dynamic characteristics of the system; therefore, Wiener model is suitable for simulating the behavior of gas turbine engines.
In this simulation, Linear Time Invariant (LTI) dynamic subsystem is represented by a time invariant transfer function 1/(1 + ts). This block indicates the engine performance parameters delay due to the input fuel to the model. These parameters are the engine static characteristic behavior mentioned above. This transfer function should be defined between the input and each output separately.
In addition, the nonlinear static subsystem including the relation between the various engine parameters at steady state and the amount of fuel entering the engine is in the form of a look-up table between the input and the output.
In order to control the motor under study, the designer needs two parameters: the rotational speed of the generator turbine (v GG ) and the rotational speed of the power turbine (v PT ), resulting in two series of linear and nonlinear blocks for simulation of the engine behavior.
To simulate the nonlinear static part of the Wiener model the parameter curves of rotational speeds of the turbine generator and power turbine with respect to fuel flow rate are generated via thermodynamic model of the engine. Results are then entered into a look-up table block.
For the linear dynamic subsystems, each time delay corresponding to each of the two mentioned engine parameters is first tuned in such a way to minimize the  Engine's Wiener model described is demonstrated in block diagram in Figure 3. For more information regarding this Wiener model please see [17] and [18].

ECU model
Gas turbine engine fuel controller must observe the steady state and transient modes as well as complying with all of the physical limitations of the engine control algorithm so that engine's performance does not drop. The idea is the basic feature to create Min-Max control algorithms.
A Min-Max controller composed of several control loops, each of which takes the task of observing a different engine controlling mode. These loops are in parallel and at any moment, according to a predefined fuel control strategy, one of them fires and undertakes the observation. Min-Max control loops and the selection strategy are explained in the following.
Detailed understanding of engine's control requirements is the basis of the controller design. Gas turbine engine control modes for the control algorithm are categorized as steady-state controlling mode and transient controlling modes including: limiting rotational velocity of the power turbine controlling mode, limiting rotational velocity of generator the turbine controlling mode, required power turbine rotational velocity controlling mode, limiting the maximum acceleration controlling mode and limiting the minimum deceleration controlling mode.
The only parameter available in order to control the engine is fuel flow entering the combustion chamber. Thus, the purpose of controller design is to control the engine's fuel mass flow rate.
Selection of an appropriate control loop at any moment is the controller's ultimate goal through Min-Max control algorithm which plays an incontrovertible role in modeling process.
Fuel required for transient state is calculated as: in which W dec ; W acc ; W NGGÀmax ; W NPTÀmax ; W NPTÀdesird ; are the fuel calculated by the deceleration controlling mode, acceleration controlling mode, limiting rotational velocity of generator the turbine controlling mode, limiting rotational velocity of the power turbine controlling mode and power turbine required rotational velocity controlling mode, respectively. W trans is the transient fuel flow required at any moment. According to equation (1) the fuel control strategy designed for the transient mode is as follows: First, the desired fuel flow rates in the four limiting control loops are calculated and minimum value is selected. This prevents gas turbines' shafts from over-speeding and over-accelerating (also prevents surge occurrence). Then the maximum value is selected between the previous winner and the calculated fuel in the decelerating control mode. This impedes flame-out. The final fuel flow for transient condition is then added to the required fuel for steady-state condition to form the definitive fuel flow at  Figure 4.
The simulated ECU based on Min-Max control algorithm in Matlab software is also presented in Figure 5.
In order to assess the ECU performance, an arbitrary input load as is illustrated in Figure 6 has been applied to the engine.
As could be seen in Figures 7-9, NGG, NPT and the acceleration of the gas generator turbine shaft do not exceed from their allowable limits and also, NPT tracks its desired value properly.

Real-time test setup
SIL simulation is the first step toward ECU design, in which both the engine and ECU are numerically modeled. ECU's algorithm should then be implemented on hardware as the next step. Finally, conducting a performance test, which in this case is a real time simulation, is required to verify the results compared with those derived from the SIL simulation.
In this test (which will be referred to as HIL simulation hereafter), engine thermodynamic model is loaded on an industrial PC and the ECU on a target PC. The computer on which ECU model is running is the hardware part of the simulation, attached to the system's software-based model. Connection between these two computers is provided via data acquisition cards.
In other words, to implement such a control loop on an HIL test bed, engine and ECU models are created on separate personal computers while their signal interactions as depicted in Figure 2 are rendered applicable via data acquisition cards. This mentioned implementation is better shown in Figure 10. The block diagram of such an HIL setup is shown in Figure 11.
Description of each of these components is included in the following.

Component description
In order to conduct the real time HIL test of the gas turbine's ECU, two PCs are utilized simultaneously. First is an industrial personal computer (IPC) which is an IPC-611 on which the engine model is created. Some of its specifications are listed in Table 1. ISA cards for Advantech PCL-812 and PCI-1711 are mounted on this computer.
Engine's I/O signals are transferred by a PCL812-PG card by Advantech Company, mounted on one of the main ISA slots. Its specifications are listed in Table 2. Two analogue channels are used for exporting engines' angular velocities while only one analogue input port is used for reading the fuel flow rate calculated by ECU.
ECU model is running on an ordinary PC while its signal transfer is rendered via a PCI-1711 multifunction card, also an Advantech product. Some of its specifications are shown in Table 3.    Practical HIL test architecture prepared is illustrated in Figure 12 with all of its components as: (1)

HIL results
As for the first test, the input load of the engine is considered to be stepwise as depicted in Figure 13. This simulation was accomplished both on the HIL and SIL test beds with the same load input. As the figure implies, load is constant at first, then starts to decrease with a constant rate until reaches a minimum value at which it remains for about 20 s. After that, it gains its initial value through the same rate after which it continues to the end of simulation without change. Figure 14 shows power turbine shaft angular velocities (NPT) for both of these tests. NPT is required to remain at its desired value (RRV or NPT des ). However, when the load starts rising or falling, NPT deviates slightly from its desired value. This is due to the fact that when the load is decreasing, less fuel for the engine is required from the ECU and similarly, when the load is increasing, more fuel will be demanded. Consequently, this change in fuel demand would lead to NPT digression from its required value. When that happens, the ECU takes necessary action so that NPT returns to its set value.
Gas generator turbine shaft angular velocities (NGG) in real time for SIL and HIL simulations are plotted in Figure 15. NGG variation is in accordance with the change in load. When the load starts increasing, more fuel is provided to the engine. Since the gas generator turbine and the combustion chamber are directly connected, NGG rises. Alternatively, when the load is falling, less fuel is forwarded to the engine and NGG decreases as well.
Fuel flow rates (ECU output) of HIL and SIL tests are presented in Figure 16. Fuel is slightly oscillatory when load is changing. During transient condition, the calculated fuel in the ECU is changed since the dominant control loop in the Min-Max controller replaces its predecessor at short time intervals.
The same tests are repeated with another input as shown in Figure 17. The difference between this load input and the previous one is that the minimum value at which the second load is reached is higher than the first one. The rest are similar such as the maximum value, rate of change and load step durations. Results are obtained as illustrated in Figures 18-20. These plots have been zoomed-in so that the differences between the HIL and SIL simulations could be discernable; however, the differences are less than 1% and therefore the errors are negligible.
These results show successful implementation of the HIL simulation, by comparing the results from the preliminary HIL test and those of SIL simulation. The success criterion for the tests is the similar trends of different parameters in both the HIL and SIL simulations. Therefore, it can be assured that the overall system could be simulated in real time environment and if either the control unit or the plant is implemented on hardware and tested for further investigations in more comprehensive and closer-to-reality HIL simulations, similar results are predicted and errors could be foreseen. In other words, the implemented ECU presented in this paper could be replaced by a real controller with the same control algorithm. However in [18], such mentioned case has    been studied and performed for the same engine by the authors in which the control unit has been implemented on a microcontroller and the expected results have been obtained. Thus, for more elaborations on details with this regard, please refer to the mentioned paper. However, slight differences at some points are discerned for these tests. This difference could be contributed merely to hardware equipments of the preliminary test such as I/O ports and wire connections. If the same equipments were used later for an HIL simulation with the ECU implemented on a hardware (such as a microcontroller), the probable errors could be classified more accurately.

Conclusion
Gas turbine control system consists of two parts, ECU and the engine itself. ECU controls fuel flow supply to the engine according to the load exerted to the engine and prevents the engine from dangerous situations. As on-      engine tests for control system are often time-consuming, expensive and unsafe, HIL simulation approach is a preferable approach. Such simulation enables the testing of hardware components of the control system along with the rest of its virtual software-based simulation in realtime.
In this paper, a preliminary simulation of a two-shaft turbo-shaft engine electronic control unit is presented. This test bench incorporates two personal computers connected together within the real-time. In this simulation, an industrial personal computer is employed for the engine model and another computer is used on which ECU is implemented. Finally, the test is conducted for two different inputs within a limited time domain and compared with those of SIL simulation. The results show successful implementation of the simulation platform.
As for the future works, the fuel control unit (FCU) could also be simulated and implemented either on a separate PC or on a mechanical system to further investigate the effects of fuel control strategy on both ECU and FCU in real time. Also, different control strategies could be used for the ECU (other than the Min-Max method discussed in this paper) for determining the best approach as well as considering the stability criteria.