Abstract
In this paper, neural network and genetic algorithm is used to obtain the optimal output power of thermal lag Stirling engine. A neural network is trained and developed using the theoretical data of previous literatures in order to predict the performance of Stirling engine. Input parameters to neural network include angular velocity, thermal resistance, stroke length radius, piston diameter, the volume of heat buffer chamber and the volume of gas chamber, and output parameter includes output power. The accuracy of neural network is evaluated by average square error and regression analysis. Also, genetic algorithm is used for the optimization of the output power of the Stirling engine. The results of present study show that the neural network can be used as an appreciate tool to predict the output power of the thermal lag Stirling engine with a high precision and speed. The main deficiency of thermal lag type of Stirling engines is low output power. However, the optimization of design parameters of thermal lag Stirling engine causes an increase of 86.9% in output power.
Introduction
Today, energy plays a vital role in the development of human society. Completion of fossil fuels, corresponding pollution and environmental problems has attracted researchers to use renewable energy sources such as solar energy. Solar energy is the world’s largest energy source. The amount of energy shines from the sun to Earth in every hour is more than the total energy that the Earth inhabitants consume within a year. 1 To use this free resource, we should be looking for a way to convert this clean energy into electrical energy with low cost and high efficiency. Stirling engine is one of the most useful techniques that can be applied for using solar energy. Stirling engine is an external combustion engine can be used to produce mechanical energy from external heat sources. Low pollution, noise and vibration, low fuel consumption, and the use of different fuels (fossil fuel, nuclear fuel, and solar energy) are some of the advantages of Stirling engine. 1 Solar energy is considered as one of the suitable heat sources to supply the energy needed in the Stirling engine. Solar energy is absorbed by parabolic concentrator dishes in the heat source of Stirling engines and is transferred to the working fluid in the closed cycle and through increasing the volume of fluid is converted to work. Parabolic concentrator dishes raise the temperature of the working fluid and also increase the thermal efficiency. Solar Stirling engine has very little side effects on nature. Because the Stirling engine is an external combustion engine, it can use renewable energies such as solar energy instead of fossil fuels. Also, because the thermodynamic cycle of a Stirling engine is a closed cycle, it does not result in the release of contamination due to the discharge of combustion products into the environment. Therefore, it does not cause environmental pollution. 1 Stirling engines include various types such as alpha, beta, gamma, and others. The thermal lag Stirling engine, unlike other models, only has one movable piston, it does not need cylinder and displacer piston; therefore, requires less maintenance and is easier to repair. Also much quieter than other models and its construction cost is much lower. For this reason, in this study, the performance optimization of this engine using genetic algorithm has been studied.
Tiller in 1995 presented the first single-piston Stirling engine. He stated that the most important factor limiting output power of the Stirling engines is a long time that the gas needs for heat exchanging. 2 The limiting factor is called thermal lag. Tiller used the limiting factor as a driver for the single-piston Stirling engine. 3 Kaushik and Kumar in 2000 analyzed Stirling engine based on finite time thermodynamics. They reported that the output power and thermal efficiency of their engines up to 74.32 kW and 43.93% respectively. 4 Petrescu et al., in 2002, presented a method for calculating power and efficiency of Stirling engine based on the First Law of Thermodynamics for processes with limited speed. Their method includes a new PV/PX chart for the Stirling cycle that considers the effects of pressure drop due to friction, limited speed and throttling processes in the Stirling engine booster.5,6 Timoumi et al., in 2008, developed a thermal model to estimate the thermal performance of Stirling engine GPU-3 model and then continued the Stirling engine optimization. Their results show that if the optimal design parameters be used in the model, it increases the engine efficiency and engine power of about 22% and 20%, respectively. While the increase of engine average pressure is not considerable. 7 Cheng and Yu in 2010 developed a numerical model to predict the beta-type Stirling engine performance with diamond driving mechanism. Their results show that the output power and thermal efficiency depends to geometrical and physical parameters including regenerative length, the distance between two gears, from the eccentricity of the crankshaft and hot source temperature. 8 Rochelle and Grosu in 2011 carried out the optimization of an exo-irreversible, endo-reversible Schmidt-Stirling engine cycle. 9 They derived analytical expressions for the phase angles at gas flow inversion within the regenerator and for the positive or negative perfect regeneration heat. Their optimization led to an optimum phase angle and volume ratio to obtain a good compromise between maximum power and maximum work (or torque) at minimum speed. Chen et al., in 2012, analyzed the thermal performance and optimization of a gamma type solar Stirling engine using genetic algorithm. The results showed that the maximum engine output power and thermal efficiency was 596 W and 36.3%, respectively. 10 Cheng and Yang, in 2013, presented a numerical model to predict the thermodynamic cycle of thermal lag Stirling engine and studied the dependence of engine performance to geometrical and operating parameters. They also investigated the flywheel moment of inertia effects on unstable fluctuations in instantaneous angular velocity and average angular velocity. 11 Önder Özgören et al., in 2013, developed an artificial neural network (ANN) model to predict the torque and power of a beta-type Stirling engine using helium as the working fluid. 12 Their results showed that the ANN is an acceptable model for prediction of the torque and power of the Stirling engines. Solmaz and Karabulut in 2014 presented a new configuration of the beta-type Stirling engine with only one lever driver. The results of the new engine performance compared to the engine with diamond-shaped driver showed that the output power of the engine with lever driver is more than the engine with diamond driver. Under the same working pressure, thermal efficiency of lever driver engine was less than diamond driver engine. In addition, for the same working fluid mass, thermal efficiency of the lever driver engine was more than diamond driver engine. While the external mass and volume of lever driver engine is less than the diamond driver engine. 13 Chen et al., in 2014, addressed to design and multi-objective thermodynamic optimization of a gamma engine using optimization algorithm of multi-objective particle swarm optimization (MOPSO). Their results showed that the multi-objective optimization method provided significantly better results than traditional methods of single-objective optimization in predicting the optimal performance of the engine. 14 Hooshang et al., in 2015, optimized the design parameters of the gamma type Stirling engine using neural networks. They found the optimal design variables of neural network using multilayer perceptron (MLP). The neural network used to predict the performance of the engine was fast and accurate enough that could predict the output power and engine efficiency at a fraction of a second with an accuracy of less than 2% error (compared with dynamic and thermodynamic simulation results). 15 Arora et al., in 2016 performed the multi-objective optimization of a gamma type Stirling engine with heat loss recovery using non-dominated sorting genetic algorithm II (NSGA-II) . They considered the output power, thermal efficiency, and economic cost as three objective functions to obtain the Pareto optimal front. Then they chose the best value Pareto-optimal front using four criteria, including Bellman–Zadeh fuzzy logic, TOPSIS, Shannon, and LINMAP. Their results showed that TOPSIS decision method for two-objective optimization, and the Bellman–Zadeh fuzzy method for triple-objective optimization has the minimum deviation. 16 Tavakolpour-Saleh and Jokar in 2016 applied an ANN controller to an active solar-powered Stirling pump to make it intelligent. 17 The ANN controller for solar-powered Stirling pump led to more powers at lower water heads. Xiao et al. in 2017 performed multi-objective optimization of a beta-type Stirling engine. The objective functions of their research include thermal efficiency, output power, and power drop of flow resistance. They used computational fluid dynamics (CFD) to determine the velocity, pressure, and temperature distribution in the expansion chamber of engine. Their optimization leads to an increase of 2% in thermal efficiency and 80 W in output power. 18 Barreto and Canhoto in 2017 performed the dynamic and thermodynamic modeling of a beta-type solar Stirling engine. Their study included a beta-type Stirling engine, a parabolic dish, thermal receiver, and electric generator. They obtained the optimal value of concentration factor equal to 250 and the corresponding maximum overall efficiency to 10.41%. 19 Yang and Cheng in 2017 presented theoretical solutions for power output of thermal-lag Stirling engine by a dimensionless nonlinear dynamic model. 20 They solved their model by perturbation method. They point out that the power output of thermal-lag Stirling engine will maximize if the dimensionless amplitude and loading damping coefficient are properly selected.
The necessity of present research
Due to the elimination of the displacer piston and cylinder in thermal lag Stirling engine, it has less maintenance, easier repair, lower construction cost, and less noise than other types of Stirling engine. However, the main deficiency of thermal lag type of Stirling engines is low output power. Timoumi et al. 7 have shown that if the design parameters of a Stirling engine are optimized, its output power will be increased. In previous studies,7–16 the single-objective or multi-objective optimization of various types of Stirling engines including alpha, beta, and gamma has been done. However, thermal lag Stirling engine optimization has not been carried out. Therefore, the main goal of present study is to obtain the optimum performance of thermal lag Stirling engine using genetic algorithm. Cheng et al. 2 simulated a thermal lag Stirling engine by the solution of the nonlinear complex equations of dynamic and thermodynamic model of the engine. The solution of nonlinear equations of dynamic and thermodynamic model is very time-consuming. On the other hand, Hooshang et al. 15 have shown that the neural network method can predict the output power of Stirling engine at a fraction of a second with a high accuracy. Thus, in present research, the neural network is used to simulate the performance of thermal lag Stirling engine.
The governing equations
Figure 1 shows a schematic of a thermal lag Stirling engine.

Schematic view of thermal lag Stirling engine. 2
As shown in Figure 1, the thermal lag Stirling engine is a combination of a cylinder and a piston engine where the second displacer piston as well as its link has been removed and replaced with a porous medium in gas chamber. Porous medium acts as a heat recovery in Stirling engine. In this engine, the temperature difference between warm and cold source is the main reason of permanent engine motion. In Figure 1, the P is the center point of the piston,
Neural network
ANN is one of the important branches of artificial intelligence that is composed of nonlinear linked components called neurons. Unlike conventional simulation methods involving the analytical or numerical solving of series of equations, neural network acts as a black box and based on artificial intelligence concepts with the help of neurons establishes the relation between input and output data. First, the neural network should be trained using number of experimental or analytical data. Then, the trained neural network will be able that for a given number of input data, to predict system output parameters with sufficient accuracy.21,22 Usually a neural network involves an input layer, several hidden layers and an output layer. The information stored in the connection weights. Training of neural network means changing the connection weights associated with the use of new data. Figure 2 shows a simple neuron performance in a neural network. 23

The performance of a simple neuron in a neural network.
Neural network performance is very similar to the human brain so that its basis is on learning and teaching. As a common human after a while working with a device or tool without the knowledge of physics or the natural laws that govern it would be able to predict the behavior and performance of the device, a neural network after training network will be able to predict similar problems. 23 In Figure 3, the performance and the components of a multilayer neural network are shown.

The operation and components of a multi-layer neural network. 23
Evaluating the performance of the trained neural network is performed by regression analysis between the primary and output data network. The criteria used to determine network performance are as follows 23
Matching coefficient
Mean square error
Mean absolute error
Coefficient of variation
In the above equations,
As much as the coefficient of variation and mean squared error are smaller and matching coefficient is closer to 1, the better the network performance.
In the present study, neural network model with sigmoid functions neurons is used for hidden layers and linear neurons for the output layer. The network structure is shown in Figure 4. The network has four hidden layers and an input layer and output layer.

The structure of the designed neural network.
In present study, the neural network was trained using 1038 data of Cheng et al. 2 Seventy percent of data was used for train and 15% of data was used for test and 15 percent of data was used for validation. In order to find the number of neurons in hidden layers, the several number of neurons was evaluated by R2, root mean square error (RMSE) and mean absolute error (MAE) criterion. The results of this process are given in Table 1.
Number of neurons in hidden layers.
It can be seen from Table 1 that after the neurons number of 60 there is negligible change in R2 and RMSE. Therefore, the neurons number of 60 is chosen in three hidden layers. The network structure of the present study is expressed as (1–1–20–20–20–7). It means that the network with 7 neurons in the input layer, and 20 neurons in each of the hidden layers of first, second, and third, and one neuron in the fourth hidden layer and one neuron in the output layer. To train the neural network, the analytical data of Cheng et al.
2
were applied. Cheng et al.
2
simulated the performance of a thermal lag Stirling engine by numerical solution of dynamic and thermodynamic equations governing it. They investigated the influence of various design and operating parameters including angular velocity, the wall temperature of gas chamber, thermal resistance, the radius of stroke, the diameter of the piston, the volume of heat buffer chamber, and the volume of the gas chamber on the engine output power. Based on the parametric study, the desired values of the radius of stroke (r), the diameter of the piston

The convergence diagram of neural network for the present research.
Matching coefficient and mean square error values for the network were 0.99 and 0.053, respectively. The stop criterion for the trained neural network is given in Table 2.
The stop criterion for the trained neural network.
It should be mentioned that neural network does not include the dynamic and thermodynamic governing equations. It does not give an explicit mathematical function. It acts as a black box. A schematic of this black box (neural network) has been given in Figure 6.

A schematic of neural network (black box).
Validation
In order to train and develop a neural network for performance prediction of the Stirling engine, the wide range of experimental or theoretical data is needed. The wide range of theoretical data of Cheng et al.
2
for a thermal lag Stirling engine is suitable for our purpose due to its high accuracy with experimental data. Therefore, the simulation results of the neural network of this study were validated by the theoretical data of Cheng et al.
2
for the output power versus angular velocity in various values of the wall temperature of gas chamber and volume. To calculate the error between theoretical data and neural network simulation data, the average relative error by the following formula was used.
Where

The power output of the Stirling engine versus average angular velocity for different values of the wall temperature of gas chamber (present study and Cheng et al. 2 ).
According to Figure 7, the maximum relative error is observed in the wall temperature of gas chamber

The power output of the Stirling engine versus average angular velocity for different values of the gas chamber volume (present study and Cheng et al. 2 ).
In Figure 8, the maximum relative error is relevant to the gas chamber volume
Formulation of the optimization problem
The formulation of the optimization problem is defined as follows
In the present study, the objective function is the output power of thermal lag Stirling engine and decision variables include angular velocity
The selected options of genetic algorithm.
Results
The optimization results of thermal lag Stirling engine are shown in Table 4.
The optimization results of thermal lag Stirling engine.
From the results of Table 4 can be seen that if the design and operating parameters of the engine are chosen equal to optimum levels of decisions variables, then the output power of the thermal lag Stirling engine will reach to a maximum of 43.36 W. In the following figures, to ensure the accuracy of optimization results, the objective function according to decision-making variables was depicted in three dimensions. Figure 9 shows the changes in output power of Stirling engine versus changes in the volume of gas chamber and thermal resistance.

Changes in output power of Stirling engine versus changes in the volume of gas chamber and thermal resistance. (
As can be seen in Figure 9, the procedure of drawing output power of the engine according to the volume of gas chamber and heat resistance has a maximum point. The coordinates of this maximum point correspond to the optimum values of the volume of gas chamber and thermal resistance.
In Figure 10, the output power of the engine versus changes in thermal resistance and the radius of the stroke are shown.

The output power of the engine versus changes in thermal resistance and the radius of the stroke. (
According to Figure 10, the maximum point of output power of the engine occurred in the optimum amount of thermal resistance and radius of the stroke. By changing the thermal resistance value and the radius of the stroke from their optimal value, the value of the engine output power is reduced.
In Figure 11, engine output power variations versus changes in the average angular velocity and radius of the stroke are shown.

Engine output power variations versus changes in the average angular velocity and radius of the stroke. (
According to Figure 11, the maximum engine output power is obtained at the optimum values of the average angular velocity and radius of stroke.
Figure 12 shows the variations of engine output power versus changes in the volume of buffer chamber and the diameter of the piston.

The variations of engine output power versus changes in the volume of buffer chamber and the diameter of the piston. (
According to the Figure 12 on each piston diameter values due to changes in buffer chamber volume an extreme point is observed for the output power of the engine. But the maximum of these extreme values is achieved for the optimized diameter of the piston and the optimized buffer chamber volume.
In the next figures, the parametric studies have been carried out and the effect of various design and operating parameters on output power of the engine is investigated.
In Figure 13 the variation of engine output power versus piston diameter is shown.

The variation of engine output power versus piston diameter.
The output power of engine increases with piston diameter to the optimum value of 0.048 m and then decreases. The maximum output power of the engine is 43.36 W. By increasing the diameter of the piston to 0.048 m, a greater mass of gas fits in the cylinder and consequently more gas mass leads to higher engine output power. But with increasing piston diameter from the 0.048 m, the mass and weight of piston goes up and decreases the average angular velocity of the engine and the engine output power.
Figure 14 shows the output power variation versus average angular velocity changes.

The output power variation versus average angular velocity changes.
According to Figure 14, the maximum output power of the engine is equal to 43.36 W for the optimal angular velocity of 667.26 r.min. By increasing the average angular velocity higher than 667.26 rpm, the engine goes to the instability condition.
In Figure 15 the variation of engine output power versus stroke radius changes is shown.

The variation of engine output power versus stroke radius changes.
According to Figure 15, the maximum output power occurred within the optimal stroke radius of 0.022 m. By increasing stroke radius to its optimum level the engine compression ratio goes up leading to the increase of engine power output. However, increasing the radius of the stroke higher than the optimum value leads to the increases of engine friction and reduces the engine output power.
Figure 16 shows the engine output power versus thermal resistance changes.

The engine output power versus thermal resistance changes.
According to Figure 16, the optimal thermal resistance for maximum engine output power is equal to 1 K/W. For thermal resistance values of more than 1 K/W, due to insufficient heat transfer in hot and cold parts of the engine, the operational mode of the engine changes from rotary to undesirable fluctuation and decay, and consequently the engine output power reduces.
In Figure 17 engine output power variation versus the volume of heat buffer chamber is shown.

The variation of engine output power versus the volume of heat buffer chamber.
According to Figure 17, the volume reduction of heat buffer chamber leads to an increase in the output power of the engine as the heat buffer chamber is considered as a dead space in the thermal lag Stirling engine which should be minimized. However, for the heat buffer chamber volume, there is an optimum value that maximizes the engine output power.
Figure 18 compares the performance of optimized Stirling engine of the present study with the Stirling engine of Cheng et al. 2

Comparison of performance of optimized Stirling engine of the present study with the Stirling engine of Cheng et al. 2
In Figure 18, the output power of our optimized Stirling engine and the conventional Stirling engine of Cheng et al. 2 in terms of average angular velocity for temperature of the gas chamber of 1200 K are compared. It is observed from Figure 18 that if optimized value of operating and design parameters is used for Stirling engine, its output power will increase by 86.9%.
Conclusion
In this study, a neural network was trained to simulate the performance of the thermal lag Stirling engine. Then using the genetic algorithm, the optimum value of the design and operating parameters including average angular velocity, the wall temperature of gas chambers, thermal resistance, the radius of stroke, piston diameter, the volume of heat buffer chamber, and the volume of gas chambers to maximize the engine output power was obtained. The results of present study show that for the thermal lag Stirling engine by having a limited number of experimental data in different operating conditions, a neural network can be trained and without the need for solving complex, dynamic and thermodynamic equations, the performance of thermal lag Stirling engine with a desirable accuracy can be predicted. Moreover, the optimization of thermal lag Stirling engine leads to 86.9% increase in output power. In general, the use of neural network and genetic algorithm to predict and optimize the performance of the thermal lag Stirling engine can be a suitable alternative to time-consuming and costly laboratory procedures as well as complex and time-consuming numerical methods for studying the performance of thermal lag Stirling engine.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
