*Corr. Author’s Address: Hijjawi Faculty for Engineering Technology Yarmouk University, Irbid, Jordan, Amjad.Alsakarneh@yu.edu.jo 401 Strojniški vestnik - Journal of Mechanical Engineering 69(2023)9-10, 401-408 Received for review: 2023-04-07 © 2023 The Authors. CC BY 4.0 Int. Licensee: SV-JME Received revised form: 2023-05-22 DOI:10.5545/sv-jme.2023.597 Original Scientific Paper Accepted for publication: 2023-05-29 Fuzzy and Matlab/Simulink Modelling of the Air Compression Refrigeration Cycle Alsakarneh, A. – Lina Momani, L. – Tabaza, T. Amjad Alsakarneh 1,* – Lina Momani 2 – Taha Tabaza 3 1 Yarmouk University, Hijjawi Faculty for Engineering Technology, Department of Mechanical Engineering, Jordan 2 Higher Colleges of Technology, Fujairah Men’s College, Engineering Division, UAE 3 AL-Zaytoonah University of Jordan, Department of Mechanical Engineering, Jordan The coefficient of performance (COP) for a gas refrigeration cycle was estimated using Matlab/Simulink and fuzzy logic. A Matlab/Simulink model of the gas refrigeration cycle was developed, and the output was compared to theoretical data. Additionally, fuzzy logic was used to estimate the COP for arbitrary low- and high-pressure levels. Simulation results were used to develop a multi-input-multi-output (MIMO) fuzzy Takagi-Sugeno-Kang (TSK)-based model. Both the Matlab/Simulink and the MIMO fuzzy model were found to be very well correlated with theoretical results, with an error of less than 2 %. These results demonstrate the effectiveness of using fuzzy logic to analyse gas refrigeration cycles and suggest that this approach can be extended to analyse other thermodynamic cycles. Keywords: coefficient of performance, Matlab/Simulink, Takagi-Sugeno-Kang, refrigeration cycles Highlights • The coefficient of performance (COP) for a gas refrigeration cycle was assessed using a modern intelligent tool, specifically fuzzy logic. • To verify the results obtained by fuzzy logic, a simulation study was conducted over a wide range of low and high pressures in the cycle. • The fuzzy logic approach was found to produce results very similar to the simulated COP, with a root mean square error of less than 2 %. • Fuzzy logic was found to be a fast approach for estimating the COP with limited knowledge of gas refrigeration cycles. 0 INTRODUCTION Thermodynamics has a wide range of applications, including refrigeration, which involves the transfer of heat from a lower temperature region to a higher temperature one [1] and [2]. The air compression refrigeration cycle is a well-known example of this process, utilizing air as a working fluid instead of chlorofluorocarbon (CFC). This type of refrigeration is commonly used in airplane air conditioning systems, where pressurized air from the engine compressors is utilized. In recent years, researchers have shown more interest in this type of refrigeration due to its environmental advantages, as it has a positive impact on the ozoneosphere. Additionally, the working fluid for this refrigeration cycle is readily available at no cost, making it economically attractive. However, due to the low efficiencies of the compressor and expander [3] and [4], the coefficient of performance (COP) of this refrigeration cycle is relatively low. The closed-air refrigeration cycle is typically comprised of four components: the air cooler, refrigerator, compressor, expander, and motor. Fig. 1 displays the four components of the refrigeration cycle, where the refrigerator holds air at a low pressure and the air cooler holds air at a high pressure. Many studies, such as [5] and [6], have investigated the simulation and thermodynamic analysis of this cycle. Gigiel et al. [7] compared the air cycle and the CFC conventional freezing cycle. Further research regarding the optimization of the air refrigeration cycle using finite time thermodynamics and entropy generation minimization has been discussed in [8] and [9]. Fig. 1. Air refrigeration cycle (dashed and solid lines stand for high and low pressures, respectively) Refrigeration system designers aim to maximize efficiency while minimizing energy consumption and production costs. Several variables have an Strojniški vestnik - Journal of Mechanical Engineering 69(2023)9-10, 401-408 402 Alsakarneh, A. – Lina Momani, L. – Tabaza, T. effective role in determining which combination of properties can be used to increase the coefficient of performance (COP) of the system. Kizilkan [10] conducted a performance analysis of a variable- speed refrigeration system using artificial neural networks. The objective of the study and the learning procedure was to identify the optimal set of weights that would produce the correct output for any input. The output of the network was compared to a desired response to generate an error, and the performance of the network was evaluated in terms of the desired signal and the convergence criterion. Fuzzy logic and artificial neural networks (ANNs) have been widely used in the literature to model complex mechanical systems [11] and [12]. Sahin [13], for example, used ANNs and adaptive neuro-fuzzy (ANFIS) to analyse the performance of a single-stage vapour compression refrigeration system with an internal heat exchanger using refrigerants R134a, R404a, and R407c. A comprehensive review of the applications of artificial neural networks for refrigeration cycles was presented in [14]. This research work proposes an alternative method for estimating the coefficient of performance (COP) using fuzzy logic as a tool, eliminating the need for analytical modelling of the refrigeration cycle. The researchers developed two models to estimate the COP of gas refrigeration cycles: the first model utilized a Matlab/Simulink model and direct mathematical relations and models, while the second model employed fuzzy logic. Both models utilized the low and high pressures of the cycle as inputs and the COP as an output. These results can be applied to modelling and simulating other refrigeration cycles, specifically, and thermodynamic cycles, generally. 1 METHODS In this section, the gas refrigeration cycle model development using Matlab/Simulink is described. Matlab/Simulink has been extensively used by researchers for modelling and simulating mechanical systems. Milecki and Rybarczyk [15], for instance, employed Matlab/Simulink to simulate the behaviour of an electrohydraulic proportional valve. The development process starts with the calibration of the thermodynamic properties of air, as described below: h = f (P r ), (1) h = f (T), (2) where h is the enthalpy (kJ/kg), P r is the relative pressure, and T is the temperature in Kelvin. To obtain the enthalpy fitted model, a power function in the form of (h = a x b + c) is suggested. By utilizing the curve-fitting toolbox (CFT) in Matlab, the following results are obtained: h(P r ) = 333.70 × P r 0.2539 – 65.14, (3) h(T) = 0.391 × T 1.136 + 43.91. (4) To evaluate the accuracy of this model, the root mean square error (RMSE) is utilized, which is less than 1 % for the enthalpy for both Eqs. (3) and (4). Figs. 2a and b depict the original data, obtained from the thermodynamics tables, and the fitted data generated through this model. In addition to the enthalpy data, the relative pressure as a function of temperature and temperature as a function of relative pressure are also required. These relationships are generated using the curve fitting toolbox, and the resulting equations are as follows: PT T r    1025 10 5 586 11 4 333 . ., (5) TP P rr    395 125 4 0 221 . .. (6) To assess the performance of the developed model, the root mean square error (RMSE) is used as an evaluation metric. The RMSE is determined to be less than 1.5 % for both Eqs. (5) and (6), indicating good agreement between the fitted data and the original data obtained from the thermodynamics tables. This is further supported by Figs. 2c and d, which show the fitted data closely overlapping with the original data. Using the fitted functions described earlier, the researchers developed a complete Simulink model of the gas refrigeration cycle. This model takes the low and high pressures of the cycle as input and produces the COP as output. A block diagram of the Simulink model is depicted in Fig. 3. In the compressor subsystem, it is assumed that the air enters the compressor with a temperature of 285 K and a pressure of one atmospheric pressure. Using Eqs. (4) and (5), the enthalpy and relative pressure can be calculated. The thermodynamic properties of the air at the exit can be determined by applying the conservation of mass and energy principles. P P P P rr 2 2 1 1 = . The exit enthalpy and temperature can be determined using the computed value of the P r from Eqs. (3) and (6). Strojniški vestnik - Journal of Mechanical Engineering 69(2023)9-10, 401-408 403 Fuzzy and Matlab/Simulink Modelling of the Air Compression Refrigeration Cycle In the Turbine subsystem, the air enters the turbine with the third state, which is the exit of the condenser and exits the turbine with the fourth state. The enthalpy and relative pressure of the third state obtained from the condenser subsystem are used to calculate the enthalpy and relative pressure of the fourth state, using Eqs. (4) and (5), respectively. a) b) c) d) Fig. 2. Displays a comparison between the simulated data obtained from the developed models and the data obtained from thermodynamics tables; a) the enthalpy as a function of relative pressure, b) the enthalpy as a function of temperature, c) the relative pressure as a function of temperature, and d) the temperature as a function of relative pressure Fig. 3. The gas refrigeration cycles model Strojniški vestnik - Journal of Mechanical Engineering 69(2023)9-10, 401-408 404 Alsakarneh, A. – Lina Momani, L. – Tabaza, T. P P P P rr 4 4 3 3 = . Using the relative pressure, the enthalpy and temperature can be determined using Eqs. (3) and (6). In the evaporator model, the absorbed energy in the condenser (q L ) can be calculated as the difference between the enthalpies of the first and fourth states, which is given by the following equation: qh h L  14 . (7) 2 EXPERIMENTAL The components of a fuzzy expert system include fuzzification, a knowledge base, a fuzzy inference engine, and defuzzification. A summary of how these components operate is provided below: 1. Fuzzification: To perform fuzzification in a fuzzy expert system, input values are transformed into fuzzy values according to a specific membership function. In this case, the proposed method uses a Gaussian function for input membership. 2. Knowledge Base: In the knowledge base component of a fuzzy expert system, rules are created based on the expertise and experience of the system's designer. Typically, each rule is given equal weight, though some rules may be given more weight based on expert judgement. This component establishes the connections and regulations between input and output values. The proposed method for this system uses nine rules that encompass all possible combinations of the input membership functions. 3. Fuzzy inference engine: The fuzzy inference engine component of a fuzzy expert system utilizes expert knowledge-based rules to make inferences from the available information. One popular method of inference is Takagi-Sugeno- Kang (TSK) inference. In TSK inference, the existing rules are combined using the Max-Min operation. 4. Defuzzification: Defuzzification is the process of converting fuzzy information into a specific value. One common technique for defuzzification is the weighted average method, which is simple and widely used. The method of defuzzification that uses weighted averages is also known as the Sugeno defuzzification method. It is suitable for fuzzy sets with symmetrical output membership functions and produces results that are similar to the centroid of area (COA) method. The proposed method involves the development of a fuzzy logic model that is based on the input-output data of the COP obtained from the mathematical models and relations of the gas refrigeration cycle. The data set that is generated is then used to structure the fuzzy model, including the input and output membership functions, as well as the if-then rules. We attempted to optimize the membership functions used for the input variables by trying two and four functions. However, the accuracy of the two-function approach was only about 95 %, while the four- function approach was very close to the three-function approach, with an error of about 1 %. Therefore, we decided to adopt the three-function approach, as it provided a better correlation compared to the two-function approach and faster computation time compared to the four-function approach. The refrigeration cycle includes four sub-systems: the evaporator, compressor, turbine, and condenser. However, the proposed fuzzy model only considers the input variables, which are the low and high pressures, and the output variable, which is the COP. For the low and high pressures, three membership functions are assumed, using Gaussian functions as follows: LPIMF ei i xA B i i     2 2 123 ,, ,, where (8) a) b) Fig. 4. The input membership functions before tuning of a) low pressure, and b) high pressure Strojniški vestnik - Journal of Mechanical Engineering 69(2023)9-10, 401-408 405 Fuzzy and Matlab/Simulink Modelling of the Air Compression Refrigeration Cycle HPIMF ei i xC D i i     2 2 123 ,, ,, where (9) where L i and H i are the i th membership function of low and high pressures, respectively, A i , B i , C i and D i are the design parameters of i th input membership functions. Fig. 4 shows the input and output membership functions. For the if-then rules, Table 1 lists the if-then rules together with the output membership functions. Where COP were calculated as follows: COPa LbHc i iiii i       1 9 . (10) The authors previously presented a method to estimate the coefficients a, b, and c of the TSK model using the available experimental or simulation data. This was achieved by generating an optimized TSK model through the application of a nonlinear least square method, as described in reference [16]. 3 NUMERICAL EXAMPLES RESULTS After performing simulations using the Matlab/ Simulink model with various input pressures, a dataset was generated with the COP as the output. The range of low pressures considered was from 100 kPa to 200 kPa, while the range of high pressures was from 1.0 MPa to 3.0 MPa. The MATLAB code used the COP data generated from the Simulink model and applied the least square method to estimate the optimal values of the membership function coefficients. The accuracy of the results is demonstrated by the RMSE value of 0.01953, which means that the expected COP error based on the model is less than 2 % on each occasion. Table 2 provides all the If- Then rules and output membership functions (OMF). Increasing the order of the OMF could be a potential area for future work, but it may require high-speed computers. Fig. 5a depicts the relationship between the input variables of low and high pressures and the output variable of COP, as predicted by the developed model. The accuracy of the model is evident from the plot, with the error being negligible. Furthermore, Fig. 5b displays the residuals of the developed surface with a maximum error of less than 0.02, indicating the accuracy of the model's predictions. a) b) Fig. 5. The input membership functions after tuning of a) low pressure; and b) high pressure Table 1. The if-then rules and output membership functions No. If low pressure is and If high pressure is then The COP is 1. LPIMF 1 HPIMF 1 a 1 ×L + b 1 ×H + c 1 2. LPIMF 2 HPIMF 1 a 2 ×L + b 2 ×H + c 2 3. LPIMF 3 HPIMF 1 a 3 ×L + b 3 ×H + c 3 4. LPIMF 1 HPIMF 2 a 4 ×L + b 4 ×H + c 4 5. LPIMF 2 HPIMF 2 a 5 ×L + b 5 ×H + c 5 6. LPIMF 3 HPIMF 2 a 6 ×L + b 6 ×H + c 6 7. LPIMF 1 HPIMF 3 a 7 ×L + b 7 ×H + c 7 8. LPIMF 2 HPIMF 3 a 8 ×L + b 8 ×H + c 8 9. LPIMF 3 HPIMF 3 a 9 ×L + b 9 ×H + c 9 Strojniški vestnik - Journal of Mechanical Engineering 69(2023)9-10, 401-408 406 Alsakarneh, A. – Lina Momani, L. – Tabaza, T. Table 2. The if-then rules and output membership functions No. If low pressure is and If high pressure is then The COP is 1. LPIMF 1 HPIMF 1 0.09796×L + 0.08642×H – 0.02512 2. LPIMF 2 HPIMF 1 –0.7031×L + 0.3672×H + 0.2381 3. LPIMF 3 HPIMF 1 0.1053×L + 0.3493×H – 0.2462 4. LPIMF 1 HPIMF 2 0.06101×L – 0.6759×H + 0.2887 5. LPIMF 2 HPIMF 2 –0.4113×L + 0.2595×H – 0.3855 6. LPIMF 3 HPIMF 2 –0.09852×L + 0.63×H – 0.1404 7. LPIMF 1 HPIMF 3 –0.1456×L – 0.03702×H – 0.3712 8. LPIMF 2 HPIMF 3 0.1469×L + 0.1681×H – 0.3202 9. LPIMF 3 HPIMF 3 0.6347×L + 0.4321×H + 0.4061 a) b) Fig. 6. a) the normalized COP as a function of the normalized input pressures, and b) the residual between the calculated COP and the predicted COP using fuzzy logic Strojniški vestnik - Journal of Mechanical Engineering 69(2023)9-10, 401-408 407 Fuzzy and Matlab/Simulink Modelling of the Air Compression Refrigeration Cycle 4 COMPARISONS BETWEEN SIMULINK AND FUZZY MODELING RESULTS Although the proposed approach does not inherently require a dynamic model, the Matlab/Simulink is employed to facilitate the utilization of the developed model for future research endeavours, e.g., implementing control strategies for refrigeration cycles and to make the developed model easily accessible to other researchers, enabling them to further investigate and contribute to the field of refrigeration systems. Table 3 presents a comparison between the methods used by Matlab/Simulink and Fuzzy logic modelling to estimate the COP of refrigeration cycles. Table 3. A simple comparison of the Matlab/Simulink and Fuzzy logic modelling Matlab/Simulink Fuzzy logic Mathematical modelling is employed to express the equations governing the gas refrigeration cycle through block diagrams. The model is built using the raw data available from the gas refrigeration cycle. To estimate the COP , complete mathematical models and equations for all sub-domains of a refrigeration system are necessary. The detailed interaction between sub-systems of a refrigeration system is not necessary for fuzzy modelling. Instead of requiring expertise, a data set can be used to develop the Fuzzy model of the COP . Classical mathematical programming models rely on well-defined coefficients for all refrigeration cycle components. However, in some cases, model parameters can only be roughly estimated. Additionally, to obtain the COP , all tables must be used. After developing the fuzzy model of the gas refrigeration cycle, a tuning process is typically carried out to optimize it. Once optimized, the fuzzy model can estimate the COP independently without the need for tables or physical components. With its graphical user interface (GUI) environment, Matlab/Simulink provides an easier way to simulate gas refrigeration cycles, as well as other engineering systems. To use fuzzy logic in refrigeration systems, an expert in the field is needed to provide an initial guess of the input/output membership functions and to construct the If-Then rules. 5 CONCLUSIONS In this research, the COP of gas refrigeration cycles was estimated using both Matlab/Simulink and fuzzy logic approaches. Matlab/Simulink used mathematical equations and relations to estimate the COP, while fuzzy logic used available data sets for the same purpose. The performance of the fuzzy logic approach was evaluated across a wide range of low and high pressures in the cycle. The results showed that fuzzy logic provided a quick way to estimate the COP with less knowledge of gas refrigeration cycles. The fuzzy logic found to be comparable in accuracy to Matlab/ Simulink and mathematical modelling with a RMSE of less than 2 %, highlighting the effectiveness of fuzzy logic as a tool to model refrigeration cycles, in particular, and thermodynamics cycles in general. 6 ACKNOWLEDGEMENTS This paper's research was supported by Yarmouk University, Jordan and Al-Zaytoonah University of Jordan, Jordan. 7 REFERENCE [1] Cengel, Y., Boles, M. (2014). Loose Leaf for Thermodynamics: An Engineering Approach. McGraw-Hill Education, New York. [2] Mohamed, H., Camdali, U., Biyikoglu, A., Aktas, M. (2022). Enhancing the performance of a vapour compression refrigerator system using R134a with a CuO/CeO 2 nano- refrigerant. Strojniški vestnik - Journal of Mechanical Engineering, vol. 68, no. 6, p. 395-410, DOI:10.5545/sv- jme.2021.7454. [3] Hou, S., Li, H., Zhang, H. (2007). Open air-vapor compression refrigeration system for air conditioning and hot water cooled by cool water. Energy Conversion and Management, vol. 48, no. 8, p. 2255-2260, DOI:10.1016/j.enconman.2007.05.005. [4] Alamayreh, M.I., Alahmer, A., Bazlamit, S.M., Younes, M.B. (2021). Energy analysis and refrigerant replacement in pre- cooling concrete system in massive concrete structures. EPPM Conference Proceedings, p. 14. [5] AlAsfar, J., AlShwawra, A., Shaban, N.A., Alrbai, M., Qawasmeh, B.R., Sakhrieh, A., Odeh, O. (2020). Thermodynamic analysis of a biomass-fired lab-scale power plant. Energy, vol. 194, p. 116843, DOI:10.1016/j.energy.2019.116843. [6] Giannetti, N., Milazzo, A. (2014). Thermodynamic analysis of regenerated air-cycle refrigeration in high and low pressure configuration. International Journal of Refrigeration, vol. 40, p. 97-110, DOI:10.1016/j.ijrefrig.2013.11.017. [7] Gigiel, A.J., Russell, S.L. (2001). A comparison between air cycle and conventional freezing. International Institute of Refrigeration Conference Proceedings, p. 139-144. [8] Chen, L., Wu, C., Sun, F. (1999). Finite time thermodynamic optimization or entropy generation minimization of energy systems. Journal of Non-Equilibrium Thermodynamics, vol. 24, no. 4, p. 327-359, DOI:10.1515/JNETDY.1999.020. [9] Berry, S.R. (1999). Thermodynamic Optimization of Finite Time Processes. John Wiley & Sons, Hoboken. Strojniški vestnik - Journal of Mechanical Engineering 69(2023)9-10, 401-408 408 Alsakarneh, A. – Lina Momani, L. – Tabaza, T. network and neuro-fuzzy. Renewable Energy, vol. 36, no. 10, p. 2747-2752, DOI:10.1016/j.renene.2011.03.009. [14] Kalogirou, S.A. (2001). Artificial neural networks in renewable energy systems applications: a review. Renewable and Sustainable Energy Reviews, vol. 5, no. 4, p. 373-401, DOI:10.1016/S1364-0321(01)00006-5. [15] Milecki, A., Rybarczyk, D. (2015). Modelling of an electrohydraulic proportional valve with a synchronous motor. Strojniški vestnik - Journal of Mechanical Engineering, vol. 61, no. 9, p. 517-522, DOI:10.5545/sv-jme.2015.2553. [16] AlSakarneh, A. (2011). Optimum fuzzy model for single input single output data system. Control and Intelligent Systems, vol. 39, p. 41. [10] Kizilkan, Ö. (2011). Thermodynamic analysis of variable speed refrigeration system using artificial neural networks. Expert Systems with Applications, vol. 38, no. 9, p. 11686-11692, DOI:10.1016/j.eswa.2011.03.052. [11] Balli, S., Sen, F. (2015). Failure prediction of cross-ply laminated double-serial mechanically fastened composites using fuzzy expert system. Strojniški vestnik - Journal of Mechanical Engineering, vol. 61, no. 2, p. 123-130, DOI:10.5545/sv-jme.2014.1909. [12] Devedžić, G., Manić, M., Tanikić, D., Ivanović, L., Mirić, N. (2010). Conceptual framework for NPN logic based decision analysis. Strojniški vestnik - Journal of Mechanical Engineering, vol. 56, no. 6, p. 402-408. [13] Sahin, A.S. (2011). Performance analysis of single-stage refrigeration system with internal heat exchanger using neural