An ANN-GA Framework for Optimal Engine Modeling

Internal combustion engines are a main power source for vehicles. Improving the engine power is important which involved optimizing combustion timing and quantity of fuel. Variable valve timing (VVT) can be used in this respect to increase peak torque and power. In this workArtificial Neural Network (ANN) is used tomodel the effect of theVVTon the power and genetic algorithm (GA) as an optimization technique to find the optimal power setting. The same proposed technique can be used to improve fuel economy or a balanced combination of both fuel and power. Based on the findings of this work, it was noticed that the VVT setting is more important at high speed. It was also noticed that optimal power can be obtained by changing the VVT settings as a function of speed. Also to reduce computational time in obtaining the optimal VVT setting, an ANN was successfully used to model the optimal setting as a function of speed.


Introduction
Internal combustion engines have been a major power source throughout the history of ground vehicles.The two dominating combustion concepts, the Otto engine and the Diesel engine, were developed in the late 1800s.The introduction of electronic ignition and fuel injection systems in the 1980s have given the engineers far more capability of engine control than before.Since then, both fuel economy and emissions have improved, but still more progress can be expected in the future.One of the limitations in engine control development lies in the scarce online information about the controlled process, the combustion [1].
Variable valve timing (VVT) is used in spark ignition automotive engines to improve fuel economy, reduce NO  gases, and increase peak torque and power [2].Valve control is one of the most important parameters for optimizing efficiency and emissions, permitting combustion engines to conform to future emission targets and standards.Thermodynamic conditions during the closed cycle (compression, combustion, and expansion) can be directly controlled by adjusting the intake valve opening (IVO) and intake valve closing (IVC) angle, which defines the total intake mass flow rate and the effective compression ratio of the engine [3].
Control of the intake valve provides optimal filling of the cylinder at all engine speeds.This natural supercharging, and the improved engine torque and power that accompany it, makes it possible to downsize engine capacity and thus reduce fuel consumption at all operating conditions [4].Variable valve timing (VVT) relates to both the opening time and the duration of the valve's open interval.Controlling valve timing can improve the torque curve, the brake power curve, or the indicator-power curve of a given engine.Variable valve timing can also be used to reduce the fuel consumption and, to a small extent, the engine emissions [5].The adoption of a continuous variable valve timing (VVT) system is able to optimize engine torque and efficiency [6].
Genetic algorithm (GA) as an optimization technique is widely used for optimization of engineering problems.Many engineering design problems are very complex and therefore difficult to solve with conventional optimization techniques [7].There are some studies in the literature about using GA for optimization of engine characteristics [8][9][10][11].There is no guarantee that a GA will give an optimal solution or arrangement; there is only a guarantee that the solution will be near optimal in the light of the specific fitness function used in the evaluation of the many possible solutions generated.By near optimal, it is implied that a more optimal solution may exist; however, the stochastic approach is by nature nondeterministic and therefore global optima cannot be guaranteed, and some hybrid techniques exist to combine "hill-climbing" deterministic approaches to stochastic GA approaches to determine the best solution to the accuracy required after the GA method has determined the best region of space to investigate.However, this refinement is not necessary in this study [12].
Artificial Neural Network (ANN) models may be used as an alternative way in engineering analysis and predictions.They are recently used also in engine optimization regarding engine operating parameters and emissions [13][14][15][16].ANN models mimic somewhat the learning process of a human brain.They operate like a "black box" model, requiring no detailed information about the system.Instead, they learn the relationship between the input parameters and the controlled and uncontrolled variables by studying previously recorded data, similar to the way a nonlinear regression might perform.Another advantage of using ANNs is their ability to handle large and complex systems with many interrelated parameters.They seem simply to ignore excess data that are of minimal significance and concentrate instead on the more important inputs [12,17].Also the neural networks can be used in the form of an ensemble which highly adds to the accuracy of these ANNs [18].
Several methodologies for analysis and optimization of diesel engines including DoE [19], Support Vector Machine (SVM) [20], fuzzy modeling [21], particle swarm optimization [22], and specialized modeling software such as MAT-LAB [23] have been reported or can be used.In this work, different techniques are applied in the form of a multistage methodology.ANNs are used for engine modeling as a tool for optimization using GA.This GA is run for the purpose of determining the optimal power conditions at each speed.The ANN is used in reverse to dictate the optimal conditions according to speed.

Artificial Neural
Networks.An Artificial Neural Network is based on the biological neural networks (nervous system) and is composed of "neurons" or "neurodes," which are artificial nodes, processing elements, or "units."A neural network is a mathematical model that is based on interconnection of the neurons and the strength of the connections (weights and biases) to model the majority of not all possible known functions.Neural networks in that respect are a generalized function that can be used to model complex relationships between inputs and outputs or to classify patterns in data.
A schematic diagram of a typical multilayer feed-forward neural network architecture is shown in Figure 1(a).The network usually consists of an input layer, some hidden layers, and an output layer.In its simple form, each single neuron is connected to other neurons of a previous layer through adaptable synaptic weights.Knowledge is usually stored as a set of connection weights (presumably corresponding to synapse efficacy in biological neural systems).Figure 1(b) shows how information is processed through a single node.

Input layer Output layer
Hidden layers

Weights Summation Activation
For the neuron i The basic schematic of an Artificial Neural Network.
(b) The basic information processing in a neural network unit [24].
The node receives weighted activation of other nodes through its incoming connections.First, these are added up (summation).The result is then passed through an activation function; the outcome is the activation of the node.For each of the outgoing connections, this activation value is multiplied with the specific weight and transferred to the next node [24].
Training of the neural network is done using back propagation where the error value and the local gradient of the error are used to estimate the new value of the weights and biases where   is synaptic weight connecting the nodes,  is learning rate,   () is the local gradient for the error in output neuron  at iteration ,   () is the output of the network at neuron  at iteration , and  is iteration number.Several types of neuron activation functions from logsig, tansig, and sigmoid functions were used as activation functions for the neural network.

Genetic Algorithm.
Genetic algorithm (GA) is one type of evolutionary algorithms (EA) that mimics natural evolution as search heuristic to evaluate the global optimal in functions.This is opposed by the traditional optimization which may suffer from long time or local optimum.GA uses biological methods such as inheritance, mutation, selection, and crossover to generate solutions to optimization problems.

Crossover
The evolution usually starts from a population of randomly generated individuals and happens in generations.In each generation, the fitness of every individual in the population is evaluated, the more fit individuals are stochastically selected from the current population, and each individual's genome is modified (recombined and possibly randomly mutated) to form a new population.The new population is then used in the next iteration of the algorithm.Commonly, the algorithm terminates when either a maximum number of generations have been produced or a satisfactory fitness level has been reached for the population.
The basic GA is shown in Algorithm 1 and in Figure 2.

Methodology
In this work we have followed the methodology shown in Figure 3.The engine data are obtained using suitable experimentation.The untrained ANN which is properly sized in terms of functions and neurons is trained for the experimentally obtained data.The result of this training process is trained ANN which can be used to predict the power of the considered engine at any given speed and valve timings.This ANN model is then used together with a genetic algorithm to evaluate the optimal engine parameters for a selected speed.Thus, the GA results are the optimal settings  for each engine speed.The data (speed versus optimal engine parameters) are then used to train the final ANN model.The validation of the results is done using visual inspection, Root Square Mean Error (RSME), that is, and the Nash-Sutcliffe model efficiency coefficient (NSE), that is, The NSE can range from −∞ to 1.An efficiency of 1, that is, NSE = 1, corresponds to a perfect match between model and observations.An efficiency of 0 indicates that the model predictions are as accurate as the mean of the observed data.An efficiency less than 0, that is, −∞ <  < 0, implies that the observed mean is a better predictor than the model.The Nash-Sutcliffe model efficiency coefficient (NSE) is commonly used to assess the predictive power of hydrological discharge models.However, it can also be used to quantitatively describe the accuracy of model outputs in other applications such as the one in this research [25].

Engine and Experimental Practice
For the purpose of analyzing the engine characteristics the dimensions were considered with a specially designed program used to predict the gas flows, combustion, and overall performance of internal combustion engines.Engine speed was varied between 1000 and 6000 rpm.Ignition was taken 10 ∘ bTDC.The specifications for the engine are in Table 1.

Results and Discussion
The initial step is to train the untrained ANN for the experimentally obtained engine data (see Section 5.1).GA is used to select the optimal VVT settings for each speed (Section 5.2).The data (speed versus optimal engine parameters) are then used to train the final ANN model (Section 5.3).

Training Accuracy of the ANN.
ANN of four layers and three neurons per layer is trained for the experimental engine data.Figure 4 shows the ANN power prediction versus the actual values.ANN results fall well within 5% prediction error.The Root Mean Square Error (RMSE) for the model is 0.414.Thus one can conclude that ANN can predict the power of the engine accurately.The Nash-Sutcliffe coefficient  for the results is 0.995 (close to 1).Thus the ANN prediction is very close to the practical results.

Optimal Break Power and Break Power Spread.
The genetic algorithm is then used to obtain optimal power VVT setting at each speed.150 generations are used to achieve the results.Figure 5 shows the obtained optimal power versus engine speed.As expected the power increases with speed, but the curve is slightly quadratic.Within the range 2500-6000 rpm we can approximate the curve with a linear line with little information lost in that respect.The break power generally increases as the speed increases.As the speed increases friction power increases and the volume of air swept in the engine is reduced; thus the curves tend to increase but with less slope to reflect these two important perspectives.
Figure 6 shows the optimal and nonoptimal power in one curve versus engine speed.The -points are the break power at any parameter settings.One important criterion is noticed from the curve which is the importance of the setting is variable with speed.At a speed of 1000 rpm, there is ample time for enough air to flow in and thus the parameter settings are not as important as those for the higher speed where bad setting can lead to unignorable reduction in break power.

GA Optimization of Break Power at Each Engine Speed.
Figure 7 shows the VVT optimal setting as a function of speed.The optimal oven valve intake has two main modes; at low speed the optimal setting increases as speed increases; thus we need more open valve intake time to achieve the optimal power.But the value of this parameter is stabilized at its maximum setting.The intake valve closing at low speeds is not of great importance; thus it is a low setting, but as the speed gets higher we need more time for the valve closing to achieve optimal power.The exhaust valve opening is set at a high initial value at low speed while at higher speeds, it will be fluctuating around its average setting, while exhaust valve closing is set at its highest time to achieve optimal power.The RMS error for the predictions is 0.0274 for the intake valve opening, 0.43 for the intake valve closing, 1.82 for the exhaust valve closing, 0.793 for the exhaust valve opening, and 0 for the exhaust valve closing.The latter is the highest prediction error because it can change with a higher range without affecting the optimal power.
The Nash-Sutcliffe coefficient is 0.99993 for the intake valve opening, 0.993 for the intake valve closing, 0.701 for the exhaust valve opening, and 1 for the exhaust valve closing.

Optimal ANN Model for VVT .
The final stage of this work is to build an ANN model for predicting the optimal VVT settings at each speed.The ANN model is trained for the optimal settings at each speed.The ANN is trained to give the optimal VVT settings given the engine speed as the input.This model can be programmed using a suitable microcontroller or microprocessor and when measuring the engine speed it can estimate or predict the VVT and applies these settings on the engine.The predicted model is shown in Figure 8. Figure 9 shows a comparison between the power obtained using the recommended settings and the actual optimal power.It shows that the achieved model predicts the right optimal power successfully.The RMS for the power prediction is 0.058 which shows the excellent prediction of the system proposed.The Nash-Sutcliffe coefficient is 0.99991 for the data.

Conclusions
This work utilized ANN to model the break power and GA is used to obtain the optimal setting at each speed.Another ANN model is used to predict the optimal VVT settings at each speed.We can conclude the following: (1) The ANN model can be successfully used to predict engine power using the VVT settings and the speed well within 5% error margin.
(3) The ANN model is used to successfully model the optimal GA prediction for the VVT settings over speeds from 1000 to 6000 rpm to an accuracy less than 2%.(4) It was noticed that open valve intake is optimal as low at low speed but is optimal at high value when the engine is at high speed.(5) The intake valve closing is optimal as low at low speeds but we need to increase it gradually as speed is increased.(6) The exhaust valve opening is optimal as high when the speed is low but it fluctuates around a certain average value at higher speed.(7) The exhaust valve closing is optimal at high value at all engine speeds.(8) Finally, RMSE and NSE measures were used to evaluate model accuracy and prediction efficiency.A NSE

Figure 3 :
Figure 3: Proposed optimization methodology for SI engine timing settings.

Figure 4 :Figure 5 :
Figure 4: ANN prediction of engine power versus actual break power.

Figure 6 :
Figure 6: Power spread drawn for all the experimental VVT settings at different engine speeds in addition to optimal power (highest).

Figure 7 :
Figure 7: Optimal engine parameters as predicted by the GA-NN framework versus speed.

Figure 8 :
Figure8: The optimal structure for the NN predicting the optimal engine parameters using speed.

Figure 9 :
Figure 9: Validation of the final ANN; predicted optimal power versus actual optimal power.