An Optimized Artificial Neural Network Model of a Limaçon-to-Circular Gas Expander with an Inlet Valve

: In this work, an artificial neural network (ANN)-based model is proposed to describe the input–output relationships in a Limaçon-To-Circular (L2C) gas expander with an inlet valve. The L2C gas expander is a type of energy converter that has great potential to be used in organic Rankine cycle (ORC)-based small-scale power plants. The proposed model predicts the different performance indices of a limaçon gas expander for different input pressures, rotor velocities, and valve cutoff angles. A network model is constructed and optimized for different model parameters to achieve the best prediction performance compared to the classic mathematical model of the system. An overall normalized mean square error of 0.0014, coefficient of determination ( R 2 ) of 0.98, and mean average error of 0.0114 are reported. This implies that the surrogate model can effectively mimic the actual model with high precision. The model performance is also compared to a linear interpolation (LI) method. It is found that the proposed ANN model predictions are about 96.53% accurate for a given error threshold, compared to about 91.46% accuracy of the LI method. Thus the proposed model can effectively predict different output parameters of a limaçon gas expander such as energy, filling factor, isentropic efficiency, and mass flow for different operating conditions. Of note, the model is only trained by a set of input and target values; thus, the performance of the model is not affected by the internal complex mathematical models of the overall valved-expander system. This neural network-based approach is highly suitable for optimization, as the alternative iterative analysis of the complex analytical model is time-consuming and requires higher computational resources. A similar modeling approach with some modifications could also be utilized to design controllers for these types of systems that are difficult to model mathematically.


Introduction
Global warming due to CO 2 gas emissions from the burning of fossil fuels is probably the hardest problem that humanity is confronting in the modern era.According to the latest report by the International Energy Agency (IEA), CO 2 emissions rose to a new high of 36.8Gt in 2022 [1].One way to reduce CO 2 emissions is to utilize waste heat, which is about 20-50% of all industrial energy input [2].In another way, an increase in energy conversion efficiency can contribute to a depletion in energy expenses as well as a curb in CO 2 emissions [3].Among the various technologies that utilize low-grade and waste heat, like economizers, regenerators, recuperators, and so on, the ORC is one of the most commercially viable and efficient applications for small-to large-scale power plants [3].ORC is similar to a conventional Rankine cycle.The main difference is that ORC uses low-boiling-temperature organic fluids like refrigerants and hydrocarbons as working fluids, unlike conventional Rankine cycles.This enables it to utilize low-grade heat sources, including renewable sources such as solar [4][5][6][7] and bio-thermal [8][9][10][11], to name only a few.Thus, ORC systems find applications in Waste Heat Recovery (WHR) [12][13][14] and Combined Heat and Power (CHP) [15][16][17] systems.
Figure 1 shows the basic architecture of an ORC.The compressed working fluid from the pump is heated above its boiling temperature at the evaporator using low-grade heat sources.The evaporated gaseous fluid is then allowed to expand inside the expander chamber, where the potential energy of the fluid is converted into mechanical energy at the rotor shaft.The depressurized fluid is then condensed back to its liquid form at the condenser to be used for the next cycle.Gas expanders are an integral part of ORC and are vital to realizing the potential of ORC-based small-scale power plants.The efficiency of the gas expansion process is critical to the performance of the overall ORC cycle, as the usable energy conversion takes place in the expander [18].Gas expanders can be broadly classified into two groups, namely, turboexpanders and volumetric expanders [19].For small-scale power plants, turboexpanders are unsuitable, as they require higher rotational speeds and more space due to their large inertia.In comparison, volumetric expanders are smaller in size and can operate at lower speeds and working fluid temperatures.Contrary to turboexpanders' continuous fluid flow, volumetric expanders operate at cyclic flow with a confined expansion ratio.They are sometimes called displacement expanders because they take in a fixed amount of fluid and discharge the same after displacing that volume.In recent times, immense effort in the field of positive displacement machines has been directed towards the performance improvement of existing technologies such as screw expanders [20][21][22][23].Although screw expanders offer better performance compared to similar machines like root blowers, their construction is much more complex [24,25].In contrast, limaçon machines are more suited for fluid-processing applications such as expanders, as they offer built-in pressure characteristics as well as simpler construction compared to root-blower and screw machines [26].
In the past decades, Sultan's elaborated work on limaçon machines [26][27][28][29][30] has provided crucial insights into their application as gas expanders.These studies, focused primarily on the geometric and manufacturing features of limaçon machines, have been able to attract renewed attention from the research and industrial communities.Later on, most of the works on limaçon expanders have mainly concentrated on aspects like design optimization and performance improvement.One such work by Sultan and Schaller [31] investigated the effects of port location on the performance of limaçon expanders and provided optimized locations for the ports for improved performance using the simultaneous perturbation stochastic approximation (SPSA) technique.Later, Sultan [32] incorporated a cam-operated inlet control valve into his optimum limaçon expander design and reported an improved isentropic efficiency.Phung et al. investigated the possibility of realizing gas-expander operation using L2C configuration and provided sophisticated mathematical models of expander rotor profile and apex seal [33,34].Recently, Phung and Sultan have furthered this work by investigating the possibility of rotor profile modifications to simplify the manufacturing process and reduce cost [35].
The state of the art described above uses complex mathematical formulations, incorporating differential equations and fluid thermodynamic and transport properties databases like REFPROP [36] to describe the thermodynamic characteristics of the limaçon gas expander.These classical mathematical models are usually solved iteratively, which is, in general, time-consuming, as the database is accessed at each incremental iteration for fluid properties.Optimization sometimes requires running the model thousands of times, which is difficult given the time required in each run.A more simplified and faster model could be more suitable for optimization purposes.In the past, several ANN-based techniques have been used for modeling complex electromechanical systems.For instance, Asgari et al. [37] proposed an ANN model of a low-power single-shaft gas turbine to predict the system performance with high accuracy.A similar study by Liu et al. [38] investigated the application of ANN models to predict the load performance curves for a gas turbine.Other notable works on electromechanical system modeling using ANN include the works by Fast et al. [39], Bartolini et al. [40], Nikpey et al. [41], Park et al. [42], Ye et al. [43], and so on.It is worth noting that, although ANN methods have been utilized to model systems like turbines and engines in the past decades, their utility for gas expanders is still to be explored.Therefore, there are ample opportunities to study the application of ANNs in the field of gas expander modeling.
In this study, an ANN is used to model the input-output relationships in an L2C gas expander equipped with an inlet control valve.The proposed ANN model will describe the relationships between the gas expander's output performance indices and input characteristics.For this purpose, the thermodynamic model of the limaçon expander as proposed by Sultan [32] is used.For the inlet control valve, a stepper motor actuated valve is proposed and integrated into the expander model.The output characteristics of a gas expander are related to the amount of fluid flowing into the expander chamber and the input fluid pressure.In this study, the inlet fluid pressure and expander rotor velocity are varied.The fluid flow is also varied by setting the opening and closing of the inlet valve at different expander rotor positions.This is carried out by varying the cutoff angle of the valve with respect to the expander rotor angle.The ANN model is trained with the input-output data, sourced from the mathematical model of the valved-expander system and later on compared with a test dataset to validate the accuracy of the proposed model.The goal of this study is to provide an ANN model of a complex system that can effectively realize complex relationships between the input and output of the system.The proposed ANN approach can be an effective tool for optimization purposes, as it offers the accuracy of a sophisticated analytical model without the complexity and higher computational time.Moreover, the proposed approach can be utilized as a control tool in the overall control scheme.In the subsequent sections, a classical mathematical model of the valved-expander system is presented, followed by the proposed ANN model.

Classic Mathematical Model
In this section, the detailed mathematical model of the valved-expander system is stipulated.Figure 2 shows the outline of the limaçon expander with an inlet valve.The valve is used to regulate the fluid flow to meet output power demand efficiently.

L2C Positive Displacement Expander
Positive displacement expanders are a type of energy-conversion device that are capable of managing a low flow rate of a two-phase working fluid (coexisting liquid and gaseous fluid) in low-shaft-speed applications, which sets them apart from turbomachines [32].As implementation of small-scale ORC systems that are dependent on low-grade heat sources requires expanders that are capable of operating at high pressure ratios, low flow rates, and low rotational speeds under two-phase conditions, positive displacement expanders are more suitable for such applications [44].Positive displacement expanders can be classified into the following large groups, according to their construction: rotary, piston, and reciprocating [33].Although a limaçon expander's housing and rotor profiles should usually be manufactured to limaçon curves, Sultan [29] pointed out that they can also be circular curves to simplify the manufacturing process.Limaçon expanders are a type of rotary positive displacement machine that consist of a machine housing with inlet and discharge ports and a two-lobe rotor, as shown in Figure 2. The limaçon chord p l p t of length 2l (m), with its center at m, rotates and slides about the limaçon pole o at an angle θ.When the rotor is in motion, its center m traverses a circular path of radius r (m), referred to as the base circle.Now, a thermodynamic model that is used to describe the behavior of such a gas expander is provided, based on the works by Sultan [32].It should be noted that the model is derived considering the following assumptions: A 1D flow in the working chamber is assumed; 2.
The energy transfer to and from the fluid inside the chamber is adiabatic, and the change in enthalpy that occurs inside the chamber is only due to the mass transfer across the boundaries of the control volume; 3.
The kinetic energy of the fluid is small enough to be ignored in the energy balance equation; 4.
Losses due to mechanical friction are neglected in the analysis.Now, the thermodynamic relationships in the gas expander are developed, based on the works of Sultan in [32].During the expansion process, the fluid mass inside the chamber changes, resulting in a change in enthalpy.The change in fluid mass inside the chamber can be described by the following continuity equation: where V (m 3 ) is the volume of the working chamber at time t (s), ρ (kg/m 3 ) is the density of fluid inside the working chamber, m i (kg) is the mass admitted through the inlet, m o (kg) is the mass exhausting through the outlet, and t c (s) is the time of one cycle.Since adiabatic energy transfer inside the chamber volume is considered, the following relationship can be employed: which can be reformulated as follows: where S is the entropy inside the chamber, T (K) is the temperature inside the chamber, ∆h i (J/kg) is the difference between the enthalpy in the inlet manifold and the enthalpy in the chamber, ∆h o (J/kg) is the difference between the enthalpy in the chamber and the enthalpy in the discharge manifold, and P (kPa) is the pressure inside the chamber.The above highly nonlinear stiff differential equations are solved iteratively in a cyclical fashion until the following condition is realized: where ϵ is a small acceptable error.It should be noted that the inlet mass flow rate pointed out in Equation ( 1) is a function of the inlet valve opening angle, Θ ( • ), the pressure differential across the valve ∆P (kPa), and the density ρ (kg/m 3 ) inside the chamber.This can be expressed mathematically as follows: The energy, E c (J), obtainable by expanding the compressed gas in the expander can be calculated as follows: where P(t) (kPa) is the chamber pressure.Output power, P ind (kW) is readily available from E c as P ind = E c t c .The thermal efficiency, ζ, can now be estimated by comparing the energy obtained in one cycle with the maximum energy that can be obtained from the same gas expander as follows: where h i (J/kg) and h o (J/kg) are the enthalpies in the inlet and outlet manifolds, respectively, ρ i (kg/m 3 ) is the density in the inlet manifold, and V i (m 3 ) is the chamber volume when the inlet valve closes.The volumetric efficiency, defined as the filling factor F f , can be calculated from the ratio of total mass flowing into the expander chamber to the total mass that could populate the whole chamber volume in one cycle as follows:

Inlet DDRV
The DDRV actuated by a stepper motor, as depicted in Figure 4a, features a rotating spool with a central orifice facilitating fluid flow.In this configuration, the valve spool is actuated by a stepper motor, which is characterized as a high-torque synchronous motor that translates electric input signals into precise incremental movements.The specific sequence of electric pulses dictates the rotation direction as well as the speed and angle of the rotation.This manuscript employs a two-phase hybrid stepper motor model.The valve is designed to be normally open (NO) when the motor is at its initial or idle position.This NO configuration ensures an uninterrupted fluid flow to the connected gas expander, avoiding potential disruptions due to unforeseen mechanical issues.When the valve is at idle position Θ = 0, the pressurized fluid at pressure, P in (kPa) passes through the valve opening and enters the valve antechamber at pressure, P a (kPa).During the closing operation, an electromagnetic torque, τ m (Nm), generated by the motor actuates the valve and rotates the spool clockwise at an angular velocity Ω (rad/s).The rotation continues until Θ max , the maximum step angle, where the fluid is completely obstructed.Conversely, during the opening operation, the motor rotates the spool in the opposite direction until the valve settles down to its initial NO position at Θ = 0.
The voltage-current relationship in the two phases of the stepper motor, considering it as a simple RL circuit, is given by Matsui et al. [45], as shown in Equation ( 9): where a and b are the two phases, v (V) and i (A) denote voltage and current, R (Ω) and L (H) represent resistance and inductance, and the ψ (Wb) values are the mutual flux linkages.The mutual flux linkages ψ a = ψ m cos(pΘ) and ψ b = ψ m sin(pΘ) in phase a and b, respectively are given by Iqteit et al. [46], where p is the number of pole pairs and Θ is the rotor angular displacement or step angle, measured in degrees.Substituting the expressions for ψ a and ψ b into Equation ( 9) and performing the well-known D-Q transformation gives Here, the two phases are considered identical in terms of resistance, R m , and inductance, L m .The electromagnetic torque, τ m (Nm), provided by the motor can be derived from the input power equation.The input electrical power, Pow in (Watt) supplied to the motor is given by ) + pψ m Ωi q = P cu + P mag + P mech (11) where P cu (Watt) is the copper loss, P mag (Watt) is the magnetic stored energy, and P mech (Watt) is the mechanical power output.Thus, generated torque is given by The mechanical subsystem of the valve can be represented as a spring-damper-mass system, as below: where J (kgm 2 ) is the total inertia of the valve, B (N m.s) is the viscous friction coefficient, τ f (Nm) is the steady-state flow torque, and τ l (Nm) is the loading torque.The flow torque is due to the axial component of the flow force acting on the valve spool during the fluid flow through the valve orifice, given by Okhotnikov et al. [47], as shown in Equation ( 14): where C d is the discharge coefficient, C v is the discharge velocity coefficient, A(Θ) (m 2 ) is the dynamic passage area for fluid, λ (m) is the radius of the rotating spool, and α • is the jet angle.A(Θ) changes with the rotation of the valve spool as shown in Figure 4b and can be expressed as follows: where D valve (m) and D ori f ice (m) are the diameters of the valve inlet and expander orifice, respectively.Any change in A(Θ) is reflected in the fluid mass flow rate, as described in Equation (5).

Iterative Simulation
The system described in Section 2 is solved iteratively to simulate the valved-expander system.It is worth noting here that the simultaneous solution of Equations ( 1), (3), and ( 5) requires input from the control valve model at every iteration.Moreover, these differential equations include several working fluid properties (e.g., enthalpy, density, etc.).However, ORC systems such as this use organic fluids, which, in most cases, are two-phased during expansion.Although these properties can be easily found for air or ideal gases through classic thermodynamic relationships, they are not easy to obtain for organic two-phase fluids.Therefore, most thermodynamic studies utilize a separate computer code (such as REFPROP [36]) that uses iterative calculations to obtain these properties.To ensure convergence to the stiff model presented by Equations ( 1), (3), and ( 5), the time for one cycle (360 • ) is divided into infinitesimal portions, which sometimes exceed 100,000 in number.The complexity of the procedure often results in convergence, occurring in 10 min or even more than an hour, depending on the simulation precision.This lengthy execution time often hinders optimization efforts undertaken to improve the performance of the gas expander.Figure 5 shows the time taken by the classic mathematical model per cycle simulation for an incremental number of division points of a cycle.The simulation was carried out in MATLAB (R2022b) with the following inputs: θ cuto f f = 90 • , ω = 800 rpm, and P i = 1000 kPa.The specifications of the computer are as follows: processor-Intel(R) Core(TM) i5-4670K CPU @ 3.40 GHz, RAM-16 GB, and SSD-446 GB.As the simulation precision increases, the computational time also increases considerably, leaving the model computationally unviable to be used for optimization.The excessive simulation time is primarily due to the huge number of REFPROP database accesses, as seen in Figure 5.

ANN Model
This section introduces the ANN-based model for the above valve expander system.The ANN model has the following inputs: input fluid pressure, P in (kPa), rotor angular velocity, ω (rpm), and valve cutoff angle, θ cuto f f (°), with respect to the expander crankshaft or rotor angular position at which the valve needs to close and cut off flow to the expander.The ANN model has the following output characteristics as predicted targets: energy, E c (J), filling factor, F f , isentropic efficiency, ζ, and mass flow, m i (kg/min) per cycle.
The proposed ANN model is realized using a neural network model similar to the network of Figure 6.A typical neural network consists of an input layer, one or several hidden layers, and an output layer.The input layer takes in the input data and interfaces the data to the network.The present work uses a feedforward neural network or multilayer perceptron to solve a regression problem.The network is comprised of several layers of neurons, where each neuron carries out a weighted summation of its inputs and then applies an activation function.The weighted sum of the inputs for a particular layer is calculated using Equation ( 16): where z is the weighted sum, w is the weight vector, x is the input vector, and b is the bias.The weighted sum is then processed by an activation function, a, such as sigmoid, rectified linear unit (RelU), hyperbolic tangent (tanh), or Softmax to introduce network nonlinearity to map the output, y = a(z).

Dataset Preparation and Preprocessing
For our study, a comprehensive dataset is prepared, comprising a total 936 data points.Each point contains three features (cutoff angle of valve, θ °cuto f f , expander rotor velicity, ω (rpm), and input fluid pressure, P in (kPa)) and four targets (energy, E c (J), filling factor, F f , isentropic efficiency, ζ, and mass flow, m i (kg/min)).The data points are obtained through simulation of the valved-expander system as described in Section 2 for different input features within its operational range and calculation of output performance indices.The design parameters for the valve and expander are stipulated in Tables 1 and 2, respectively.Figure 7 resembles a matrix plot of the distribution of the total dataset.The variations in outputs are depicted for each input variable.The total data are split into training and testing sets, where the training dataset is assigned randomly to 70% of the data and the remaining 30% are kept aside for testing and validation.The datasets are processed and scaled using a normalization technique to obtain uniform and pertinent data that are suitable for subsequent training and prediction phases.At this stage of the study, it is suitable to note that the preparation of this dataset requires simulation of the classic model by iterations equal to the size of the dataset.Although this is somewhat time-consuming, once the dataset is prepared, it can be utilized to produce an accurate and fast model of the system.

Training of ANN Model
The selection of a suitable training algorithm in a neural network is crucial for achieving efficient and accurate learning and for securing optimal network performance.It affects the convergence speed, learning accuracy, treatment of nonlinearities, generalization capability, scalability, and adaptability to network architectures.Figure 8 depicts the flowchart of the training and prediction process of the ANN model.The crucial stage of this process is the model architecture and parameter optimization.An ANN model has different model parameters that define the structure and behavior of the model and have definitive impacts on the performance and efficiency of the model in the training and prediction phases.A few key parameters are the training function, activation function, hidden layer size, number of layers, learning rate, and number of epochs.All these parameters can be optimized to harness the best-fitting model for the incoming features and targets.In this study, the effect of different learning rates is observed first to find the optimal learning rate for the network.Learning rate is a crucial hyperparameter, which refers to the rate at which weights and biases are updated while training.4) BFGS (Broyden-Fletcher-Goldfarb-Shanno) quasi-Newton algorithm (Trainbfg), and (4) Bayesian regularization algorithm (Trainbr).'Trainscg' is a powerful training algorithm that is best suited for complex networks with large parameter densities.It adopts adaptive learning rates and momentum to converge to a good solution efficiently and quickly.Therefore, 'Trainscg' is hugely popular in training large networks, as it reduces computational and memory loads.However, it lacks inherent regularization techniques and may result in overfitting.Techniques like dropout or weight decay can be used in conjunction with 'Trainscg' to achieve better fitness and generalization to the dataset.The next training function in our list is 'Trainlm', which employs the Levenberg-Marquardt algorithm and is particularly suited for training small-to medium-scale networks.It offers good convergence and optimization performance, as it utilizes the gradient descent technique in combination with Gauss-Newton methods.However, 'Trainlm' suffers from overfitting problems and requires added computational resources, particularly when dealing with large networks.Another adaptive training algorithm is called 'Trainrp', which uses a resilient backpropagation method.It is a fast convergent algorithm like 'Trainscg', as it adopts different learning rates for individual parameters according to the sign of their gradient.Like 'Trainscg', it also lacks inherent regularization techniques.The fourth training function tested in this study is 'Trainbfg', which utilizes the BFGS algorithm to efficiently train and optimize moderate networks.It uses Hessian matrix approximation to update weights, resulting in fast convergence.Similar to earlier functions in our list, it requires external regularization tools to prevent overfitting.All the training functions described so far are particularly equipped to effectively handle non-convex error surfaces, unlike 'Trainbr', which is the last function in our list.However, 'Trainbr' has an inherent Bayesian regularization technique, which can efficiently avoid overfitting and provide better generalization.Although it has a slower but effective convergence rate compared to earlier functions, its ability to handle noisy and limited datasets makes it an optimum training algorithm for small-to medium-scale networks.
The ANN is trained with the training data using the five training functions/algorithms to find the optimal training function.The fitness of the training process is validated by examining different performance indices like mean squared error (MSE), coefficient of determination or R squared (R 2 ), and mean average error (MAE).These performance metrics only deal with a certain portion of the entire dataset that had been split into training and testing datasets earlier, rather than the total dataset.To obtain a more reliable estimate of the model's performance across all datasets and an assessment of the model's generalization ability, a k-fold cross-validation (CV) analysis is performed.The k-fold CV analysis is carried out by splitting the total dataset into k number of folds and using 1 fold for testing and k − 1 folds for training.The process is iterated by moving over to the next fold, assigning it for testing and the remaining folds for training in a loop.In each iteration, the performance metrics (MSE, MAE, and R 2 ) are measured, and average performance is measured at the end, as per Equation ( 17): Here, the Per f ormance refers to either MSE, MAE, or R 2 , given by Equation ( 18).The value of k is usually 5 or 10, but any other value can also be assigned.After the selection of an optimal training function, the number of hidden layers and number of neurons are optimized.Different hidden layer sizes are tested for performance and the best performer is selected.
An optimal epoch size is selected afterward.An epoch in ANN is the event of passing the entire training dataset to the model during the training process.In that sense, the epoch size is the total number of epochs utilized in the whole training process.An optimal epoch size refers to an epoch size that reduces computational costs without hampering the model's performance.The model is subsequently tested with the optimized parameters over the test dataset and prediction error is measured.The network model could be optimized further if the prediction accuracy is not satisfactory.

Evaluation of ANN Model
The performance of the ANN model is evaluated using three different metrics, namely, MSE, MAE, and R 2 .The first one is MSE, which is one of the most widely used metrics for the evaluation of ANN models.It is a measure of the average squared differences between the actual and predicted values of the target variable in the test dataset, as given by Equation (18a).Similar to MSE, MAE is another convenient and popular performance metric that provides the mean absolute difference between the actual and predicted target values, as shown in Equation (18b).Both of these metrics reflect the accuracy of the prediction, where lower values indicate better accuracy.However, they do not offer any insights into the fitness of the model to the target dataset.R 2 comes in to address this issue, assessing how well the overall model fits the assigned dataset.The value of R 2 ranges between 0 to 1 and can be calculated using Equation (18c), where a value closer to 1 resembles a better fit.
where Y test and Y pred are the actual and predicted values of the outputs in the test dataset, respectively, n is the number of data points in the testing dataset, and m is the number of outputs.These three performance metrics are usually combined to obtain an overall outlook on the performance and reliability of the ANN model.To be noted, in the following sections, figures depicting the values of R 2 have the vertical axis zoomed in for better understanding, as the difference between the various R 2 values is small.

Optimization of Model Parameters
The ANN model parameters are first optimized under various learning rates, training functions, hidden layer sizes, activation functions, and epoch sizes.For this purpose, the combined MSE, MAE, and R 2 for all predicted outputs for the test data are calculated at each optimization stage.Figure 9 shows the performance of the ANN model against the test dataset under different learning rates.The learning rate is varied from 0.05 to 0.5 with a step size of 0.05, and the performance metrics are calculated.It can be realized that the variation of learning rate has some minor impact on the performance, as MSE is quite small throughout the variation range.This indicates a high prediction accuracy of the ANN model.However, at a learning rate of 0.4, both MSE and MAE are low, at 0.001 and 0.01, respectively, as seen in Figure 9a,b.The R 2 value at a learning rate of 0.4 is highest at 0.978, as seen in Figure 9c, which reflects its validity as a better performer.The ANN model is then optimized for hidden layer sizes.The single and double hidden layers are tested with different numbers of neurons, chosen arbitrarily.Figure 12 shows the effect of hidden layer sizes on the performance of the ANN model.As seen, hidden layer size does not have a significant effect on the performance.Therefore, a moderate double hidden layer, with 10 and 30 neurons, is selected, which produces an MSE of 0.006, MAE of 0.013, and R 2 of 0.94.A higher number of layers and neurons could also be tried, but may result in higher computational costs.

Optimized ANN Model
As per the above analysis, the final model parameters are shown in Table 3.The ANN model is then trained with these optimized parameters.The performance of the optimized model is compared against the performance of a linear interpolation (LI) method.As this study deals with three-dimensional scattered input data to map four scattered output variables, a Delaunay triangulation-based [48] linear interpolation is utilized as a basis for this comparison.The interpolants are constructed for each output based on the training dataset and the mean average error for the test dataset is used as the baseline.The combined performance metrics for all four target variables are MSE = 0.0014, MAE = 0.0114, and R 2 = 0.9803.This high overall R 2 score reflects the efficiency of the model in fitting the assigned input and target data.Figures 15-18 shows the prediction performance of the four outputs: energy, filling factor, isentropic efficiency, and mass flow, respectively.As seen in Figure 15, the predicted values of energy closely resemble those of the actual values, and the error is centered around 0. The prediction error distribution is mostly below the mean average error of LI.Similarly, the prediction of the rest of the target variables has errors close to the zero-value mark.Although there are some outliers in the predictions of all four targets, the accuracy is still high-over 90% within the error thresholds, as seen in Table 4.The prediction accuracy of the ANN model for all outputs is less than that of the LI method, which gives a clear indication of the performance of the proposed model.Figure 19 shows the error histogram for the overall prediction.It is seen that most of the predicted normalized data points are within the error range of ±0.25 and are distributed around zero error.About 1105 data points are within this range, which are about 98.3% of the total test data points of 1124.However, with the LI method, the number of data points within the same range is 1035, which is just 92.08%.In addition to the accuracy, the proposed model is also quite fast compared to the classical model.Table 5 shows a comparison of the run-times between the classic and proposed ANN model for five randomly selected inputs.It is seen that the run-times for the classic model are much higher and vary with inputs.However, the ANN model run-times are fast and consistent throughout input variations.While the classical model takes about 253.93 s on average to simulate the input-output relationships of the expander, the proposed model takes just a fraction of a second (around 0.0143 s) for the same inputs with the same computer and simulation software.This is a tremendous improvement, considering its application in optimization and control.

Conclusions
In this study, an ANN-based model is proposed for a limaçon expander system.It has been demonstrated that an ANN model can be used effectively as an alternative to the complex mathematical model.Several model hyperparameters have been tuned, and an optimized network is proposed for this particular application.The proposed surrogate model achieves an overall mean square error of just 0.0014 and a mean average error of 0.0114 compared to the actual mathematical model.With an impressive coefficient of determination of 0.98, the proposed model can avoid the overfitting problem.The proposed model is also about 5.07% more accurate than a conventional LI approach.In addition to the accuracy, the model is faster than the classic mathematical model.This network model can be utilized as an alternative to the complex and bulky computational mathematical model for optimization purposes.It can also be used as a control tool to control the valved-expander system.The proposed model can, thus, be effectively utilized to study small-scale power plants comprising limaçon gas expander-based ORC systems.

Figure 3
Figure 3 shows the operating cycle of the valve.Here, a direct-drive rotary valve (DDRV) actuated by a stepper motor is used.The valve is configured as normally open, allowing unrestricted flow of compressed gas into the expander; the flow is cut off at a certain rotor crankshaft angular position, termed as θ cuto f f .The valve opens again at the start of the next half-cycle.

Figure 3 .
Figure 3. Valve operating angle in a half-cycle.

Figure 5 .
Figure 5. (a) Computational times and (b) number of REFPROP accesses for the classic mathematical model under different precision values.

Figure 7 .
Figure 7.The dataset used for training and testing.Then, an optimal training function is selected among the various training and optimization functions available.In this study, five different training functions are tested: (1) Scaled conjugate gradient algorithm (Trainscg), (2) Levenberg-Marquardt backpropagation algorithm (Trainlm), (3) Resilient backpropagation algorithm (Trainrp), (4) BFGS (Broyden-Fletcher-Goldfarb-Shanno) quasi-Newton algorithm (Trainbfg), and (4) Bayesian regularization algorithm (Trainbr).'Trainscg' is a powerful training algorithm that is best suited for complex networks with large parameter densities.It adopts adaptive learning rates and momentum to converge to a good solution efficiently and quickly.Therefore, 'Trainscg' is hugely popular in training large networks, as it reduces computational and memory loads.However, it lacks inherent regularization techniques and may result in overfitting.Techniques like dropout or weight decay can be used in conjunction with 'Trainscg' to achieve better fitness and generalization to the dataset.The next training function in our list is 'Trainlm', which employs the Levenberg-Marquardt algorithm and is particularly suited for training small-to medium-scale networks.It offers good convergence and optimization performance, as it utilizes the gradient descent technique in combination with Gauss-Newton methods.However, 'Trainlm' suffers from overfitting problems and requires added computational resources, particularly when dealing with large networks.Another adaptive training algorithm is called 'Trainrp', which uses a resilient backpropagation method.It is a fast convergent algorithm like 'Trainscg', as it adopts different learning rates for individual parameters according to the sign of their gradient.Like 'Trainscg', it also lacks inherent regularization techniques.The fourth training function tested in this study is 'Trainbfg', which utilizes the BFGS algorithm to efficiently train and optimize moderate networks.It uses Hessian matrix approximation to update weights, resulting in fast convergence.Similar to earlier functions in our list, it requires external regularization tools to prevent overfitting.All the training functions described so far are particularly equipped to effectively handle non-convex error surfaces, unlike 'Trainbr', which is the last function in our list.However, 'Trainbr' has an inherent Bayesian regularization technique, which can efficiently avoid overfitting and provide better generalization.Although it has a slower but effective convergence rate compared to earlier functions, its ability to

Figure 8 .
Figure 8. Flowchart of the training and prediction process.

Figure 9 .
Figure 9. Effects of learning rate on (a) MSE, (b) MAE, and (c) R 2 .ANN models utilize different training algorithms, according to the applications and the nature of the data.In this section, five different training functions, comprising 'Trainscg', 'Trainlm', 'Trainrp', 'Trainbfg', and 'Trainbr', are tested to evaluate individual training performances.The performance metrics of the ANN model for different training functions against the test dataset are shown in Figure 10.It can be seen that, among the different training functions, 'Trainbr' has the best performance in dealing with this dataset, which is reflected in its low MSE of 0.002, low MAE of 0.01, and high R 2 of 0.971.

Figure 10 .
Figure 10.Effects of training function on (a) MSE, (b) MAE, and (c) R 2 .A 5-fold CV analysis is also conducted to ensure the validity of the training algorithm throughout the scope of the dataset.The total dataset is split into five equal portions, and performance metrics are calculated.The average of the performance metrics throughout the 5 folds gives the CV scores, as depicted in Figure 11.It is seen that CV scores are in agreement with the performance metrics calculated earlier.'Trainbr' outperforms other training functions, with CV scores of MSE = 0.0001, MAE = 0.003, and R 2 = 0.981.All other training functions perform reasonably well in CV analysis.The ANN model is then optimized for hidden layer sizes.The single and double hidden layers are tested with different numbers of neurons, chosen arbitrarily.Figure12shows the effect of hidden layer sizes on the performance of the ANN model.As seen, hidden layer size does not have a significant effect on the performance.Therefore, a moderate double hidden layer, with 10 and 30 neurons, is selected, which produces an MSE of 0.006, MAE of 0.013, and R 2 of 0.94.A higher number of layers and neurons could also be tried, but may result in higher computational costs.