Boosting Biodiesel Production from Dairy-Washed Scum Oil Using Beetle Antennae Search Algorithm and Fuzzy Modelling

: The major goal of this study was to develop a robust fuzzy model to mimic the generation of biodiesel from the transesteriﬁcation of dairy-washed milk scum (DWMS) oil. Four process parameters were considered: the molar ratio of methanol to oil, the concentration of KOH, the reaction temperature, and the reaction time. The proposed technique was divided into two steps: fuzzy modelling and optimum parameter identiﬁcation. The capability of fuzzy tools to capture and make use of linguistic variables and fuzzy sets is one of their main beneﬁts. This means that fuzzy logic allows for the representation and manipulation of values that fall across a continuum rather than merely relying on crisp values or binary categories. When dealing with non-linear relationships, this is especially helpful since it gives a more accurate and nuanced depiction of the underlying data. As a result, an accurate fuzzy model was initially built based on collected data to simulate the biodiesel production in terms of the molar ratio of methanol to oil, the concentration of KOH, the temperature of the reaction, and the reaction duration. In the second phase, the beetle antennae search (BAS) algorithm was applied to identify the optimal values of the process parameters to boost the production of biodiesel. The BAS algorithm draws inspiration from beetle behavior, particularly how they navigate using their antennae. It employs a swarm-intelligence method by deploying virtual beetles that swarm over the problem area in search of the best solution. One of its main features is the BAS algorithm’s capacity to balance exploration and exploitation. This is accomplished through the algorithm’s adaptable step-size mechanism during the search phase. As a result, the algorithm can ﬁrst investigate a large portion of the problem space before gradually moving closer to the ideal answer. Compared with ANOVA, and thanks to fuzzy, the RMSE decreased from 7 using ANOVA to 0.73 using fuzzy (a decrease of 89%). The predicted R 2 increased from 0.8934 using ANOVA to 0.9614 using fuzzy (an increase of 7.6). Also, the optimisation results conﬁrmed the superiority of the BAS algorithm. Biodiesel production increased from 92% to 98.16%.


Introduction
Renewable energy is being discussed worldwide as a way to reduce environmental damage, boost economic growth, and provide energy security [1][2][3].Overreliance on fossil fuels promotes unsustainable extraction, reserve depletion, and damaging emissions.Fossil fuel GHG emissions have hastened climate change worldwide.Rising global temperatures, erratic weather, and considerable sea-level rise threaten human livelihoods and biodiversity.However, these developing concerns motivate us to innovate and provide viable energy alternatives.Researchers are using this opportunity to study concepts that could protect our environment.Studying energy-conversion efficiency, green energy-conversion devices, and economically viable renewable-energy-production technologies is important.One focus is energy-conversion-system efficiency, especially in high-energy-consumption businesses.Waste-heat recovery helps industries maximise energy use by reclaiming wasted energy [4,5].This minimises energy demand, saving money and the environment.Researchers are developing ecologically friendly energy-conversion systems using fuel cells [6][7][8].These devices generate power more cleanly and efficiently than combustionbased energy generation.Researching biomass waste-energy harvesting is also important.Exploiting this abundant and under utilised resource could lead to a low-cost, scalable, and long-term energy source that would drastically reduce our dependence on fossil fuels.This urgent switch to renewable energy reflects our need to address the climate crisis and our desire to balance economic growth and environmental responsibility [9,10].
Biofuels offer a viable path towards a low-carbon energy future [11,12].As a result, biofuel generation, particularly from waste oil, is being extensively explored and developed as a technique for reducing the effects of fossil fuels, contributing to the circular economy, and boosting energy security [13,14].However, the productivity of biofuel production is a complex process that is influenced by a variety of factors such as feedstock type, manufacturing procedures, and operational circumstances [15,16].These criteria must be optimised to ensure that biofuel production is not only ecologically beneficial but also economically viable.This is where the potential of AI (artificial intelligence) comes into play.AI, particularly modelling and optimisation, can be used to significantly increase the efficiency of biofuel production.These strategies aid in making optimal judgements about biofuelproduction operating conditions, resulting in increased efficiency and maximizing the output.AI accomplishes this by analysing intricate correlations between various variables, accurately predicting outcomes, and making suggestions based on these predictions [17][18][19].Fuzzy modelling, in particular, provides a flexible and effective method for modelling the inherent uncertainty and non-linearity in biofuel production processes.Meanwhile, AI optimisation algorithms can discover the most effective operating conditions for biofuel synthesis from waste oil, lowering the number of required tests and enhancing overall process efficiency [20,21].
The dairy sector needs a large amount of water to clean and sterilise milk-processing equipment.The effluent treatment plant collects the resulting wastewater, which is a floating mass of fats, lipids, and different distributed contaminants.According to a yearly study from a milk processing centre that processes 200 million liters of milk per day, 90,000 to 100,000 tonnes of dairy waste or milk scum is generated each day.This waste poses environmental and health risks, necessitating cautious handling.Several studies have been conducted to investigate the use of this dairy wash milk scum (DWMS) as a viable raw material for biodiesel synthesis to alleviate the challenges connected with its disposal [22][23][24][25].However, more research is required to prove the feasibility of DWMS for this application.The molar ratio of alcohol to oil, catalyst concentration, reaction time, and temperature all have a substantial impact on the transesterification process.These settings must be meticulously fine-tuned to maximise yield while maintaining optimal fuel characteristics.
Creating a robust model to simulate the production of biodiesel from the transesterification of DWMS oil and determining the optimal values of the input controlling parameters are required in order to boost the production rate of biodiesel.Therefore, in this research work, a fuzzy model was used to simulate the biodiesel production process.Four process parameters were considered: the molar ratio of methanol to oil, the concentration of KOH, the temperature of the reaction, and the reaction time.Then, the beetle antennae search (BAS) algorithm was applied to identify the optimal values of the process parameters to boost the production of biodiesel.The behaviour of beetles, notably their use of antennae for navigation, served as a model for the BAS algorithm.Virtual beetles search the problem space using a swarm-intelligence approach to identify the best solution.The BAS algorithm's ability to balance exploration and exploitation is a crucial advantage.Using an adaptive-step-size mechanism throughout the search process, the problem space was extensively explored in the beginning stages, eventually converging towards the best answer as it moved forward.
The main contributions of this research paper can be outlined as follows: • Developing a robust fuzzy model to simulate the production of biodiesel process.

•
Applying the beetle antennae search algorithm for determining the optimal values of the molar ratio of methanol to oil, the concentration of KOH, the temperature of the reaction, and the reaction time.

•
Increasing the production rate of biodiesel.

•
Carrying out a comprehensive comparison and statistical analysis to support the proposed strategy.
Section 2 provides a description of the dataset utilised to develop the fuzzy model.Section 2 also explains the two steps of the suggested methodology.Section 3 discusses the obtained results.Finally, Section 4 summarises the key findings.

Dataset with Permission
Table 1 presents the considered data (with permission; license number: 5598311120961).There are 29 data points with four input parameters for each-the molar ratio of methanol to oil, the concentration of KOH, the temperature of the reaction, and the reaction duration.The amount of biodiesel that was produced is the value of the output parameter.

Method
The suggested method included two phases: fuzzy modelling and parameter identification.

Fuzzy Modelling
Figure 1 exemplifies the construction of two fuzzy rules of a 2-input single-output model.Fuzzy modelling is a way of expressing and analysing imprecision and uncertainty in data.It seeks to emulate human decision-making processes and reproduce the haziness of human perception.A fuzzy model is produced by combining numerous layers.The first step in fuzzy modelling is to define linguistic variables, which are descriptive terms for the system's input, output, and intermediate variables.Fuzzy sets, which specify the membership function for each linguistic word, are linked to each linguistic variable.Membership functions determine the degree to which an element belongs to a given fuzzy set.Membership functions can take on additional shapes besides the frequently used triangular or trapezoidal ones.The core of fuzzy modelling is fuzzy rules.They use linguistic phrases to build links between the input and output variables.Each rule comprises an antecedent (input conditions) and a consequent (output or action).Fuzzy rules use if-then sentences to encapsulate expert information or experience [26].
Resources 2023, 12, x FOR PEER REVIEW 5 of 14

Product layer
Fuzzification layer

Beetle Antennae Search Algorithm
The longhorn beetle's natural search activity is the basis for the beetle antennae search algorithm.The antennae and erratic traveling patterns of beetles are mimicked by this metaheuristic algorithm.The beetle randomly investigates nearby areas using its two antennae.The beetle changes its route to the opposite side if just one antenna detects the target's odour (the odour concentration represents the objective function f); otherwise, it steers in that direction.These two elements are effectively combined by this algorithm to direct its search process [27].
Considering x t is the beetle's position at iteration t, the new position can be calculated as a function of the position turning of right and left sides (xr and xl) and the directional factor d. The directional factor d can be calculated as a function of the search space dimensions (dim) as follows: The position turning xr and xl can be calculated as: ) where a t is the antennae sensing length at t.It can be calculated as: The new beetle's position can be calculated as follows: ) where b t is the step size that can be calculated as follows: = 0.95 •  −1 (9) Figure 2 illustrates the main steps of this optimisation algorithm.The fuzzy inference system combines fuzzy sets and fuzzy rules to identify the output values depending on the input values.It entails matching the input values to the fuzzy sets and combining them according to the fuzzy rules using logical operators.Aggregating and defuzzifying the fuzzy sets produces a crisp value to compute the outcome.Turning a fuzzy output into a precise value is known as defuzzification.To do this, a representative value from the fuzzy set is computed.The techniques frequently use the centroid, weighted average, and maximum value procedures.Combining these layers results in a fuzzy model that can handle ambiguous input and produce approximative judgements or predictions based on uncertain or imprecise information.Numerous industries, including control systems, decision-making, pattern recognition, and data analysis, have used fuzzy modelling.
An example of the ANFIS rules is as follows: where, the As and Bs are the membership functions of the two inputs x and y, respectively.However, the final output f is calculated based on the two rules' outputs, f 1 and f 2 , as follows: where µ A 1 , µ A 2 , µ B 1 and µ B 2 are the MF values of the two inputs

Beetle Antennae Search Algorithm
The longhorn beetle's natural search activity is the basis for the beetle antennae search algorithm.The antennae and erratic traveling patterns of beetles are mimicked by this metaheuristic algorithm.The beetle randomly investigates nearby areas using its two antennae.The beetle changes its route to the opposite side if just one antenna detects the target's odour (the odour concentration represents the objective function f ); otherwise, it steers in that direction.These two elements are effectively combined by this algorithm to direct its search process [27].
Considering x t is the beetle's position at iteration t, the new position can be calculated as a function of the position turning of right and left sides (x r and x l ) and the directional factor d. The directional factor d can be calculated as a function of the search space dimensions (dim) as follows: The position turning x r and x l can be calculated as: where a t is the antennae sensing length at t.It can be calculated as: The new beetle's position can be calculated as follows: where b t is the step size that can be calculated as follows: Figure 2 illustrates the main steps of this optimisation algorithm.
Resources 2023, 12, x FOR PEER REVIEW 6 of 14

Modelling Phase
The fuzzy model was built using a total of 29 data points.This dataset was separated into two parts, with the first half comprising 20 points for model training and the second half containing data for model testing.A hybrid technique was used in the training process, with least squares estimation (LSE) in the forward path and backpropagation in the reverse path.Furthermore, in this study, the Gaussian-shape, subtractive clustering (SC), and weighted average (Wavg) parameters were adopted.The models were trained iteratively until the root mean square error (RMSE) was reduced.Table 2 shows the statistical metrics produced by the fuzzy model.

Modelling Phase
The fuzzy model was built using a total of 29 data points.This dataset was separated into two parts, with the first half comprising 20 points for model training and the second half containing data for model testing.A hybrid technique was used in the training process, with least squares estimation (LSE) in the forward path and backpropagation in the reverse path.Furthermore, in this study, the Gaussian-shape, subtractive clustering (SC), and weighted average (Wavg) parameters were adopted.The models were trained iteratively until the root mean square error (RMSE) was reduced.Table 2 shows the statistical metrics produced by the fuzzy model.According to Table 2, the RMSEs of the fuzzy model for the training and testing datasets were 0.3162 and 1.2145, respectively.Furthermore, the coefficients of determination (R 2 ) for the training and testing datasets were 0.9958 and 0.9614, respectively.When compared to ANOVA, the use of the fuzzy model resulted in a significant reduction in RMSE, from 7 (as shown in ANOVA [24]) to 0.73, or an 89% reduction.Simultaneously, the predicted R2 value increased by 7.6% from 0.8934 with ANOVA to 0.9614 with the fuzzy model.These low RMSE and high coefficient-of-determination values highlight the fuzzy model's successful modelling phase.Figure 3 depicts the fuzzy model's 4-input single-output architecture, while Figure 4 depicts the graphical representations of the Gaussian-shaped membership functions (MFs).The fuzzy rules are presented in Appendix A. The degree of membership of a particular input value to a given linguistic word is graphically represented in a fuzzy model by the input membership functions (MFs) colours.The use of colours conveys a concise and intuitive comprehension of the fuzzy sets and the accompanying linguistic words.Fuzzy models frequently use colours to represent linguistic concepts or fuzzy sets.The colours may change depending on the particular implementation or modelling software being used.Colour selection is frequently a matter of taste, but it is crucial to use hues that stand out and are pleasing to the eye to make it simple to understand the MFs.Interpreting the fuzzy model and comprehending how the system responds to diverse input values is simpler when colours represent the MFs.This visual depiction can help decision-making and provide a more intuitive understanding of the system's behaviour.
Resources 2023, 12, x FOR PEER REVIEW stand the MFs.Interpreting the fuzzy model and comprehending how the syste sponds to diverse input values is simpler when colours represent the MFs.This depiction can help decision-making and provide a more intuitive understanding system's behaviour.The figure clearly shows that the optimal biodiesel yield was obtained when each binary variable (methanol-to-oil ratio, reaction time, reaction temperature, and KOH concentration) reached its optimal value.Increasing the reaction time from 30 min to 90 min increased biodiesel production.However, it is worth mentioning that a longer reaction time has a negative impact on biodiesel synthesis, owing to the hydrolysis of methyl ester that occurs at longer reaction durations [24].Also, an optimum methanol to oil molar ratio of  The figure clearly shows that the optimal biodiesel yield was obtained when each binary variable (methanol-to-oil ratio, reaction time, reaction temperature, and KOH concentration) reached its optimal value.Increasing the reaction time from 30 min to 90 min increased biodiesel production.However, it is worth mentioning that a longer reaction time has a negative impact on biodiesel synthesis, owing to the hydrolysis of methyl ester that occurs at longer reaction durations [24].Also, an optimum methanol to oil molar ratio of 7.5 to 1 is the best for methyl ester production, i.e., biodiesel production, as there is a shortage of methanol or oil at lower or higher ratios.It was also clear that increasing the KOH concentration from 0.6 wt% to 1.1 wt% resulted in an increase in biodiesel production; however, a higher KOH concentration of 1.6 wt% decreased the biodiesel production.The presence of the KOH enhanced the reaction between methanol and oil for the esterification process; however, at higher KOH concentrations, soap is produced due to the reaction between the potassium and the triglycerides, thus decreasing biodiesel production.
Capturing the correct relationship between the inputs and outputs of the biodieselmanufacturing-process system enables the built fuzzy model to perfectly anticipate performance.This is evident from the plot of the fuzzy model's anticipated outputs against the experimental data in Figure 6.Clearly, there is an excellent fit between the estimated and measured data.In addition, for both the training and testing stages, the predictions' plots around the 100% precision line are shown in Figure 7.

Optimisation Phase
This part of the investigation aimed to determine the best values of methanol-to-oil molar ratio, reaction time, KOH concentration, and temperature for boosting biodiesel production.Accordingly, after constructing a reliable fuzzy model, BSA was applied to estimate the best values for four controlling parameters.The results were compared with PSO and SCA to confirm the suppository of the BAS algorithm.The problem argument of the objective function can be stated as: where x is the set of normalised input variables and y is the percent of the biodiesel production.
7.5 to 1 is the best for methyl ester production, i.e., biodiesel production, as there is a shortage of methanol or oil at lower or higher ratios.It was also clear that increasing the KOH concentration from 0.6 wt% to 1.1 wt% resulted in an increase in biodiesel production; however, a higher KOH concentration of 1.6 wt% decreased the biodiesel production.
The presence of the KOH enhanced the reaction between methanol and oil for the esterification process; however, at higher KOH concentrations, soap is produced due to the reaction between the potassium and the triglycerides, thus decreasing biodiesel production.Capturing the correct relationship between the inputs and outputs of the biodieselmanufacturing-process system enables the built fuzzy model to perfectly anticipate performance.This is evident from the plot of the fuzzy model's anticipated outputs against the experimental data in Figure 6.Clearly, there is an excellent fit between the estimated and measured data.In addition, for both the training and testing stages, the predictions' plots around the 100% precision line are shown in Figure 7.

Optimisation Phase
This part of the investigation aimed to determine the best values of methanol-to-oil molar ratio, reaction time, KOH concentration, and temperature for boosting biodiesel production.Accordingly, after constructing a reliable fuzzy model, BSA was applied to estimate the best values for four controlling parameters.The results were compared with PSO and SCA to confirm the suppository of the BAS algorithm.The problem argument of the objective function can be stated as: Table 3 presents the optimal parameters and corresponding yield of biodiesel using the experimental and RSM methods [24] and the BAS algorithm.The integration between fuzzy and the BAS algorithm boosted the yield of biodiesel by around 6.23% (from 92.4% to 98.16%).Such boosting of the biodiesel production would be related to the capability of the proposed modelling and optimiser in detecting the best operating conditions considering all four operating parameters.Figure 8 shows the particle convergence during the optimisation process.The optimal values were 0.8, 0.8, 0.85, and 1, respectively, for normalised methanol-to-oil molar ratio, normalised reaction time, normalised KOH concentration, and normalised temperature.To confirm the optimisation results by the BAS algorithm and avoid the arbitrary results, the BAS algorithm was executed 30 times.The maximum, minimum, average, and standard deviation values are presented and compared with PSO and SCA in Table 4.As presented in Figure 9, the highest average value of 98.0157% was obtained by the BAS algorithm followed by SCA and then PSO.In addition, the lower STD value of 0.4282 was achieved by the BAS algorithm, whereas the higher STD value of 0.7883 was obtained by PSO.This demonstrated the superiority of the BAS algorithm in determining the optimal values of methanol-to-oil molar ratio, reaction time, KOH concentration, and temperature for boosting biodiesel production.

Method
Methanol-to-

Conclusions
Developing a reliable fuzzy model to mimic the transesterification of dairy-washed milk scum (DWMS) oil into biodiesel was the primary goal of the current research.Th

Conclusions
Developing a reliable fuzzy model to mimic the transesterification of dairy-washed milk scum (DWMS) oil into biodiesel was the primary goal of the current research.The following four process variables were considered: the molar ratio of methanol to oil, the KOH concentration, the reaction temperature, and the reaction time.The two phases of the suggested technique were parameter identification and fuzzy modelling.An accurate fuzzy model was initially developed based on collected data to simulate the generation of biodiesel in terms of the molar ratio of methanol to oil, the concentration of KOH, the reaction temperature, and the reaction duration.The second phase involved applying the beetle antennae search (BAS) algorithm to determine the ideal process parameter values to increase the production of biodiesel.Thanks to fuzzy, the RMSE was reduced from 7 with ANOVA to 0.73 with fuzzy (a decrease of 89%).The predicted R 2 increased from 0.8934 with ANOVA to 0.9614 with fuzzy (an increase of 7.6%).The yield of biodiesel increased by roughly 6.23% from 92.4% to 98.16%, thanks to the combination of fuzzy and the BAS algorithm.The ability of the suggested models and optimiser to find the ideal operating conditions while considering all four operational parameters would be related to

Figure 3 .
Figure 3. Configuration of fuzzy model of biodiesel yield.

Figure 3 .
Figure 3. Configuration of fuzzy model of biodiesel yield.

Figure 3 .
Figure 3. Configuration of fuzzy model of biodiesel yield.

Figure 4 .
Figure 4. Inputs' MFs of fuzzy model of biodiesel yield.

Figure 5
Figure 5 depicts the system's input-output relationship while evaluating two inputs at the same time using a 3D point-of-view spatial representation and contours.The highest output values are indicated in dark red, while the lowest values are depicted in dark blue.The figure clearly shows that the optimal biodiesel yield was obtained when each binary variable (methanol-to-oil ratio, reaction time, reaction temperature, and KOH concentration) reached its optimal value.Increasing the reaction time from 30 min to 90 min increased biodiesel production.However, it is worth mentioning that a longer reaction time has a negative impact on biodiesel synthesis, owing to the hydrolysis of methyl ester that occurs at longer reaction durations[24].Also, an optimum methanol to oil molar ratio of

Figure 4 .
Figure 4. Inputs' MFs of fuzzy model of biodiesel yield.

Figure 5
Figure 5 depicts the system's input-output relationship while evaluating two inputs at the same time using a 3D point-of-view spatial representation and contours.The highest output values are indicated in dark red, while the lowest values are depicted in dark blue.The figure clearly shows that the optimal biodiesel yield was obtained when each binary variable (methanol-to-oil ratio, reaction time, reaction temperature, and KOH concentration) reached its optimal value.Increasing the reaction time from 30 min to 90 min increased biodiesel production.However, it is worth mentioning that a longer reaction time has a negative impact on biodiesel synthesis, owing to the hydrolysis of methyl ester that occurs at longer reaction durations[24].Also, an optimum methanol to oil molar ratio of 7.5 to 1 is the best for methyl ester production, i.e., biodiesel production, as there is a shortage of methanol or oil at lower or higher ratios.It was also clear that increasing the KOH concentration from 0.6 wt% to 1.1 wt% resulted in an increase in biodiesel production; however, a higher KOH concentration of 1.6 wt% decreased the biodiesel production.The presence of the KOH enhanced the reaction between methanol and oil for the esterification process; however, at higher KOH concentrations, soap is produced due to the reaction between the potassium and the triglycerides, thus decreasing biodiesel production.Capturing the correct relationship between the inputs and outputs of the biodieselmanufacturing-process system enables the built fuzzy model to perfectly anticipate performance.This is evident from the plot of the fuzzy model's anticipated outputs against the experimental data in Figure6.Clearly, there is an excellent fit between the estimated and measured data.In addition, for both the training and testing stages, the predictions' plots around the 100% precision line are shown in Figure7.

Figure 6 .
Figure 6.Predicted versus experimental data of fuzzy model.

Figure 6 .
Figure 6.Predicted versus experimental data of fuzzy model.

Figure 7 .
Figure 7. Prediction accuracy of fuzzy model.

Figure 7 .
Figure 7. Prediction accuracy of fuzzy model.

Table 2 .
Statistical metrics of fuzzy model.

Table 2 .
Statistical metrics of fuzzy model.

Table 3 .
Achieved best parameters using considered approaches.

Table 4 .
Statistical evaluation of PSO, SCA, and the BAS algorithm.