Simple-mix: Thermodynamics modeling in a Gama-type Stirling engine with a working fluid mixture

The Stirling engine is an external combustion engine that can be utilized in electricity generation. Existing literature indicates that air is less expensive than helium as the working fluid but has the low power and efficiency. Hence, the present updated MATLAB code attempts to use a mixture of air and helium as working fluids or other mixtures of other gases. To this end, this software proposes an experimentally validated nonideal thermodynamic model for a Gama-type Stirling engine. After validation, a mixing gas of air and helium was used instead of an operating fluid in the thermodynamic model. Finally, three examples were run to demonstrate the software outputs for a hybrid engine.


INTRODUCTION
A rise in the price of fossil fuels, environmental emissions, and noise pollution from engines using these fuels have increased nowadays, and therefore, engineers have focused on the investigation of alternative power generation methods. 1 In recent years, Stirling engines have been called attention due to their ability to use various power sources (such as solar energy), low noise, and high efficiency. 2,3 The Stirling engine has fabricated by Robert Stirling in 1816. 3 There are three types of Stirling engines: Alpha, Beta, and Gama. 3 The Stirling engine is an external combustion reciprocating engine. In this engine, heat is transferred to the working fluid inside the engine and it is, then, converted to work by the expansion of the gas inside the cylinder. 4 The working fluid inside the engine can be air, helium, or hydrogen. 5 Stirling engines could be widely utilized in electricity applications, heat or cold sources, sinks, heat pumps, cryocoolers, refrigerating engines, prime movers, solar converters (like dish Stirling), micro combined heat and power (CHP) unitsand so forth. 6 Besides, the Stirling engine is capable to operate in a wide range of temperatures and with different fuels such as solar, bio-mass or bio-gas, waste heat or energy, natural gas, wood pellets, the exhaust gas produced by combustion processes in automotive, powerhouses, and industrial factories and so forth. 6 Due to these applications, mechanical, electrical, computer, material and metallurgical, civil, and energy engineers could attend to such a topic.
Due to the importance of using a Stirling engine; today, engineers have conducted various studies in the field of experimental testing, simulation, and optimization to increase the efficiency and power of the Stirling engine. Looking into a literature review on this topic demonstrated that most studies have attempted to optimize the power and efficiency of the Stirling engine by modifying its various parameters, such that it can produce the most power with the highest efficiency and lowest dissipation. 1,[7][8][9][10][11] Moreover, it has also been determined that helium results in better power and efficiency than air although at a higher cost. 3,[12][13][14][15] To achieve these goals, various thermodynamic models such as the isothermal model, ideal adiabatic model, and non-ideal adiabatic model were presented. The difference between these models is in the assumptions and heat losses which brings the simulation answers closer to the experimental data. 3 Toghyani et al. 1 studied the multi-objective optimization of the Stirling engine using the non-ideal adiabatic method. They worked on a Beta-type of Stirling engine and they used helium as a working fluid. Moreover, they used the second-version Nondominated Sorting Genetic Algorithm (NSGA-II) to find the optimum points. Ahmadi et al. 3 investigated the thermal models for the performance analysis of the Stirling engine. These investigations were done on the Beta-type of Stirling engine with helium, as the working fluid. Finally, they found that the non-ideal adiabatic model provided the best results, among all models. Wang et al. 8 studied the transient one-dimensional numerical model for kinetic Stirling engine. They utilized helium and hydrogen as the working fluid in the Beta-type Stirling engine. Then, they compared their results and found that hydrogen gave higher power than that with helium. Sripakagorn and Srikam 10 proposed the design and performance of Beta-type Stirling engine, with air as the working fluid. In addition, they examined different parameters to achieve a better design. Li et al. 16 studied a new polytropic model to predict the performance of Beta-and Gama-type Stirling engines, with helium and hydrogen. Eventually, they realized that the presented model was a suitable model for these engines. They also realized that in order to achieve a speed higher than 2500 rpm, the hydrogen working fluid should be used. Luo et al. 17 presented a multi-objective optimization for the GPU3 Stirling engine by combining multi-objective algorithms. GPU3 was a Beta-type Stirling engine. Moreover, they used helium, as the working fluid to optimize the power and efficiency.
The Stirling engine used in the literature was mostly Beta-type 1,3,8,10,16,17 ; however, this study used a Gama-type Stirling engine. Moreover, in the previous studies, it was found that the researchers used different working fluids for the Stirling engine, but the mixture of the working fluid was not widely investigated. Therefore, as a conclusion to the literature review, the motivation of the current code consequently involves a mixing ratio of the working fluid (air, helium, hydrogen, argon, nitrogen, carbon dioxide, etc.) that could be considered for improving the power and efficiency of the Gama-type Stirling engine, Consequently, having a hybrid working fluid could be the main motivation of this article for developing the mentioned software. In addition, the outputs of the updated MATLAB code are the engine power, the engine efficiency, the heat loss, and the pressure-volume diagrams, which could help designers to have a superior response under the desired working conditions.

Software architecture
In Figure 1, the overall algorithm for the updated MATLAB code is given. That is the solution approach of the non-ideal adiabatic model in the Stirling engine. More details of this procedure could be found in the next section.

General information
The Stirling engine has been divided into five compartments, namely, the expansion space, heater, regenerator, cooler, and compressor. The fluid pressure is considered constant in all these five compartments at every angle of the crankshaft. The desired outputs, such as power and efficiency, can be obtained by determining the thermodynamic model and using the geometric characteristics of the engine, charge pressure, hot source temperature, cold source temperature, and engine speed as the initial conditions. .
(2) In these equations, V e is the expansion volume, V c is the compression volume, V dc is the compression dead volume, V ce is the compression swept volume, V de is the expansion dead volume, and V se is the expansion swept volume. Moreover, is the crank angle, e and c are the ratio of the crankshaft radius to the connecting rod length for the expansion and compression chambers, respectively.

Nonideal adiabatic model
The nonideal adiabatic model is based on the ideal adiabatic model but also considers the pressure losses and heat transfer in the heat exchangers. 19 Therefore, the results obtained from the non-ideal adiabatic model resemble reality more The temperature graph of the ideal adiabatic model 19 accurately. In the ideal adiabatic model, the engine is divided into five components for simplification. Figure 2 displays these five components along with the temperature graph of the ideal adiabatic model. 19 As shown in Figure 2, the temperature is considered constant in the cooler and the heater and varies linearly in the regenerator. However, it is variable in the compression and expansion spaces. The following assumptions are made in the ideal adiabatic model: • The pressure is considered constant in all these five compartments at every angle of the crankshaft.
• The compression and expansion spaces are considered adiabatic.
• The temperature is fixed in the heater and cooler spaces.
• The engine has no gas leakage.
• The Prandtl number is considered constant.
Ahadi et al. 20 used equations related to the non-ideal adiabatic thermodynamic model. In addition to all mentioned references in the literature, 1,20 in this study, Equation (3) has been used to calculate the viscosity, 21 as follows In this equation, is the dynamic viscosity, 0 and T 0 are the dynamic viscosity and temperature at the reference value. Moreover, S is the Sutherland constant and also T is the temperature of the working fluid.

Gas mixture equations
An assumption that was made in the present research is the ideal nature of air and helium, used as working fluids. One can calculate the properties of the gas mixture using these assumptions plus the thermodynamic Equations (4)-(8), as follows 22 In these equations, c i is the mass fraction of each component, m i is the mass of each component, and finally, m mix is the total mass of the mixture. In this case, there are two components including air and helium. Moreover, c p,mix and c v,mix are the specific heat capacity at constant pressure and constant volume, respectively. In addition, c p, i and c v, i are the specific heat capacity for each component. Finally, R mix and mix are the gas constant and the specific heat ratio of the mixture, respectively.
It should be noted that in this code, the specific heat capacity is considered constant and is not a function of temperature and pressure. 23 Vaziri et al. 23 claimed that the variation of the performance, efficiency, and heat loss was less than 12%, 6%, and 5%, for air, helium, and hydrogen, respectively. In addition, the sensitivity analysis showed that the efficiency variation was independent on the temperature, when the Prandtl number was varied.
In this article, the working fluids of air, helium, hydrogen, argon, nitrogen, and carbon dioxide were considered that their characteristics are listed in Table 1 for the Stirling engine.
In the Gama-type Stirling engine, the working fluid is heated by an external heat source and this issue causes the moving process of the working fluid to pass through the regenerator and enter the cold chamber, where it is cooled by the cooling fluid. And then, it returns to the warm chamber through the same path. There are some heat losses in the regenerator, which will be calculated in the written code.

Illustrative examples
To present a numerical example besides a validation process of the code results, this part is proposed. The engine used in this research is a Stirling engine of the Gama-type found in Irankhodro Powertrain Company (IPCO). The details of this engine could be seen in Table 2.
Then, three tests under different conditions were performed on this engine in the past years. 24 Hence, the theoretical results will be compared to those of the literature 24 to ensure the validity of the former. The conditions of the three mentioned tests are presented in Table 3. Figure 3 provides a comparison of the pressure-volume graph of the theoretical nonideal adiabatic model with the experimental graph in the literature 24 under conditions A, B, and C. It must be noted that this research is the continuation of the literature, 24 where numerical results have already been validated using empirical results. As shown in the  Table 3 TA B L E 4 The comparison between simulated and experimental data of the power (W) 20,24 Test conditions in Table 3 Condition A

Condition B Condition C
Test results 465 364 238 Results of nonideal adiabatic model 551 418 308 Relative error percentage (%) 16 13 23 graphs, the results of the nonideal adiabatic method are in better agreement with the empirical results. The reason is the consideration of the engine losses, which makes the model resemble the actual engine condition more closely. Table 4 shows a comparison between the experimental and theoretical power values. A comparison of the experiment in the literature 24 and the proposed model (Table 4) indicates that the nonideal adiabatic model is in better agreement with the experimental results since it takes losses into account. Moreover, Figure 3 shows that the modeling accuracy decreases with a rise in pressure in the expansion space and that no leak occurs in the compression space. 20 One reason for the error in the expansion space is the proximity of this region to the heater and the ignoring factors such as radiation heat dissipation. The maximum standard deviation between the thermodynamic model and the experimental test under conditions of A, B, and C for pressure was 2.3%, 2.4%, and 2.7%, respectively. Moreover, Ahmadi et al., 3 Hosseinzade et al., 25 Babaelahi et al., 26 and Sayyaadi and Ghasemi 27 conducted theoretical and experimental studies of the Beta-type Stirling engine using the nonideal adiabatic model under a hot source temperature TA B L E 5 An example of the results from the proposed code for air-helium

F I G U R E 4
An example of the results from the proposed code: The P-V diagram for air-helium of 997 K, a cold source temperature of 288 K, a charge pressure of 4.13 MPa, and a frequency of 41.7 Hz and obtained power errors of 123.30%, 99.00%, 152.83%, and 176.86%, respectively. A review of the results reveals that the 16%-23% error in this research is acceptable for the nonideal adiabatic mode, indicating a good agreement between the codes provided in this work and the results. Moreover, factors such as the type and also the geometry of the engine and the operating conditions can influence the percentage of errors. Here, the first example could be seen in Table 5 and Figure 4, for the case study of air-helium working fluids with a mixture of 20%-80%, 60%-40%, 40%-60%, and 80%-20%. These results were obtained for the inputs including 1000 rpm of the speed, 10 bar of the pressure, 350, and 34 • C of the temperature for the hot source and the cool sink, respectively. As it can be seen from Figure 4 and Table 5, with the increase in the percentage of helium, the power and efficiency increased, while a nonlinear behavior could be found for the heat loss. The molecular weight of helium is much lower than air and so that at a constant pressure, at higher percentages of helium, the less weight of gas is injected into the Stirling engine. Thus, the engine could work better under lower forces, and as a result, the engine power increased. On the other hand, since the specific heat capacity of helium is higher; therefore, with the increase in the percentage of helium, higher heat must be given to the Stirling engine to reach the temperature of the heat source. By comparing the input heat and the output power, it is clear that the gradient of the input heat changes was less than the output power, and as a result, the efficiency increased.
The second example is in Table 6 and Figure 5, for the case study of air-hydrogen working fluids with a mixture of 20%-80%, 60%-40%, 40%-60%, and 80%-20%. These results were obtained for the inputs including 1000 rpm of the speed, 10 bar of the pressure, 350, and 34 • C of the temperature for the hot source and the cool sink, respectively. As it is clear from Table 6 and Figure 5, with the increase in the percentage of hydrogen, the power and efficiency increased. With increasing the hydrogen percentage from zero to 100%, the heat loss decreased since the specific heat capacity of hydrogen was higher than that of air.
The third example is in Table 7 and Figure 6, for the case study of hydrogen-helium working fluids with a mixture of 20%-80%, 60%-40%, 40%-60%, and 80%-20%. The results were obtained for inputs, similar to the previous two examples. As it is clear from Table 7 and Figure 6, By increasing the hydrogen percentage, the power increased and the efficiency and the heat loss decreased. TA B L E 6 An example of the results from the proposed code for air-hydrogen In the Stirling engine, at higher percentages of hydrogen, the less weight of gas is injected into the engine, resulting in a better engine performance. Hydrogen has a molecular weight almost a half value of helium. Thus, a greater value of the hydrogen percentage leads to a higher power of the engine. However, the efficiency reduced since the specific heat capacity of hydrogen is higher. Therefore, with the increase of hydrogen percentage, higher values of heat should be given to the Stirling engine to reach the temperature of the hot source. The gradient of input heat changes was much higher than the output power and as a result, the efficiency decreased.
By comparing these three examples, it is clear that the combination of hydrogen and helium had the best output results in terms of power and efficiency. However, this mixture of working fluid had a higher cost than air-helium or air-hydrogen. Therefore, by using this code and performing an optimization process, the engineers can get a better output from the Stirling engine with lower costs. As another note, in the experiments, the working fluid has a very important effect on the output speed of the engine. Therefore, hydrogen is used to achieve higher speeds (over 2500 rpm), and helium is used for the speeds between 1000 and 2500 rpm. Air is also used at the speeds, less than 1000 rpm. 16,27,28 Moreover, by comparing Tables 5 and 6, it is determined that the working fluid of air-hydrogen gave a higher power than that of air-helium.
Notably, a dataset in other various mixtures for the air-helium hybrid Stirling engine is also available, as other code results, at Vaziri, Bahram; Azadi, Mohammad (2022), "Raw numerical data on the performance of helium-air hybrid Stirling engine", Mendeley Data, V1, DOI: 10.17632/nxsxfjt868.1 (https://data.mendeley.com/datasets/nxsxfjt868). This file includes the helium percentage, the speed, the pressure, the temperature, and the helium weight for calculating the costs, as inputs. In addition, the outputs are also reported as power, efficiency, heat loss, and helium cost. As mentioned in F I G U R E 6 An example of the results from the proposed code: The P-V diagram for hydrogen-helium the text, the written code has been validated once by experimental data. However, in the case of combining two working fluids, the experimental results were not available.
Finally, the impact of this updated code could be mentioned as follows, • This software is pursued since using the mixture of the working fluid in the Stirling engine could improve the performance besides the costs of the utilized gas. However, such a code is not being existed for the research target or the industrial objective.
• The present software improves the pursuit of existing research questions about using the mixture of fluid gases in the Stirling engine.
• This code is helpful for designers on the Stirling engine with superior performance and lower costs.
• The proposed MATLAB code will widespread the use of the Stirling engine by engineers, within and outside the research or industrial groups.
• This software is available and free for any research and commercial purposes, to spread the knowledge.

CONCLUSIONS
In the present code, the performance of the Gama-type Stirling engine with different mixture ratios of working fluids was investigated. First, the results of the updated software were validated by some experimental data. Then, the power, efficiency, and heat loss of the Stirling engine were calculated with the nonideal adiabatic thermodynamic model. Finally, three numerical examples of the air-helium, air-hydrogen, and hydrogen-helium mixtures were also illustrated in this article to find the code outputs. The following results from these three examples obtained by the mentioned codes are briefly listed as follows, • With an increase in the percentage of helium in the hybrid air-helium working fluid, the power and efficiency increased and the heat losses decreased. By increasing the percentage of helium from 60% to 80%, the power and efficiency enhanced by 15.85% and 21.15%, respectively, which was the highest amount compared to other percentages.
• Increasing the percentage of hydrogen in the hybrid air-hydrogen mixture improved the power and efficiency, as well as heat losses. By increasing the percentage of hydrogen from 60% to 80%, the power and efficiency increased by 22.30% and 9.80%, respectively, and the heat loss reduced 2.70%, which was the highest amount compared to other percentages.
• As higher hydrogen percentage increased the power and heat losses, resulting in a lower efficiency of hybrid helium-hydrogen working fluids. With the enhancement of hydrogen percentage from 20% to 40%, the power and heat losses increased by 3.94% and 35.70%, respectively, and the efficiency decreased 19.31%, which was the highest value compared to other percentages.
• Although air is less expensive than helium and hydrogen, but with this working fluid, the power and efficiency reduced. Combining the working fluid can improve the power and efficiency and even, it could be optimized considering a lower cost.
The significance of this work could be in a solar farm, where the Stirling dish generates electricity for a city. There may be several hundreds or thousands of Stirling engines running. Due to the beneficial properties of helium, if 100% of helium or hydrogen is to be used in all cases, it may cause high costs for the company. In large industries, getting the best result with the lowest cost is one of the most important parameters. Therefore, using this proposed code, the company can combine several working fluids and extract the best combination. Moreover, with the help of the provided code, the engineers can define different problems and extract the desired results with the lowest cost.

ACKNOWLEDGMENTS
This is to acknowledge the work, entitled "Stirling Cycle Machine Analysis", which is dedicated to https://www.ohio.edu/ mechanical/stirling. Moreover, it should be declared that no additional financial supports were received by the authors on this research.

CONFLICT OF INTEREST STATEMENT
There is no conflict of interest on this work for all authors.