# Engine Optimization Model for Accurate Prediction of Friction Model in Marine Dual-Fuel Engine
## 3 Engine Optimization Model
### Nonlinear Optimizer  
To enhance reproducibility and provide clarity on the implemented procedure, a flowchart of the MATLAB-based optimization algorithm is presented in Figure 4. The algorithm begins by defining the initial values and bounds for the key design variables. These are passed into a nonlinear optimizer, which evaluates a fitness function aimed at maximizing the AFR while satisfying performance and combustion constraints, such as brake power, in-cylinder temperature, maximum pressure, and combustion stability (evaluated using \(\rm{R^{2}}\)). The nonlinear optimizer used in this study is the local optimizer \"fmincon\" based on an interior point algorithm ([PERSON], 1998) and integrated into Matlab. This optimizer has been selected due to its higher accuracy in achieving the optimal solution and lower computational time. The optimizer iteratively adjusts the variables, simulates the engine model in WAVE, and checks convergence until all constraints are met. The final output provides a set of optimized parameters for each operating condition. While it is a local optimizer, the computation can be performed more than once with an updated starting point to achieve the optimal solution and comply with all the constraints. However,  
Figure 3: Maps of (**a**) compressor and (**b**) turbine of the installed turbocharger used in the simulation. the computational time is lower than that of a global optimizer like a genetic algorithm (GA) [66]. The main problem is defined to minimize the objective of the study and specified by the following equation:  
\[\min_{\mathrm{x}}f(\mathrm{x})\ \ \mathrm{such\ that}\left\{ \begin{array}{c} \mathrm{c}(\mathrm{x})\leq 0\\ \mathrm{c}_{\mathrm{eq}}(\mathrm{x})=0\\ \mathrm{A}\cdot\mathrm{x}\leq\mathrm{b}\\ \mathrm{A}_{\mathrm{eq}}\cdot\mathrm{x}=\mathrm{b}_{\mathrm{eq}}\\ \mathrm{lb}\leq\mathrm{x}\leq\mathrm{ub}\end{array} \right. \tag{10}\]  
Figure 4: Schematic diagram of the engine optimization model. where f(x) is the optimization model objective, c is the inequality constraints, ceq is the equality constraints, A as a matrix and b as a vector are the linear inequality constraints, Aeq as a matrix and beq as a vector are the linear equality constraints, and lb and ub are the lower and upper bounds, respectively. In this study, the main objective of the optimization problem is to maximize the AFR, unlike previous studies that minimize only the amount of fuel consumption [16; 67; 68]. Maximizing the AFR helps to not only reduce fuel consumption but also provides a sufficient amount of air, which improves the combustion process, increases the maximum in-cylinder pressure, reduces the maximum in-cylinder temperature, and thus reduces NOx emissions. The optimization model assists in finding the optimal values of the different parameters along the engine parts with the known amount of the fuel rate (FR) collected from the project guide, such as the turbocharger speed (TS), start of injection (SOI), injection duration (INJ\({}_{\text{Dur}}\)), FMEP, and BRPM. The design variables of the engine optimization model are presented by a five-dimensional vector x = (TS, SOI, INJ\({}_{\text{Dur}}\), FMEP, BRPM). The last design variable is optimized at the rated operating point and then kept constant while performing the optimization procedures at the partial operating points. The optimization problem is subjected to different equality and inequality constraints. The main equality constraint of the optimization model is related to the engine brake power, PB, that needs to be achieved, as in Equation (11). \[\text{P}_{\text{B}}\left(\text{x}\right)=\text{P}_{\text{B, obj}} \tag{11}\]  
An additional equality constraint is considered only at the rated operating point, which is the known air mass flow rate, ma, inside the cylinders.