Estimation of the mean effective pressure of a spark ignition internal combustion engine using a neural network, considering the wall-wetting dynamics

The management and development of internal combustion engines stand as critical pursuits within the automotive and related industries. Utilizing cylinder pressure as feedback, engine controllers rely on intricate systems to regulate performance. However, due to the inherent complexity and nonlinearity of engines, direct measurement of cylinder pressure through pressure sensors is costly and computationally demanding. Consequently, the need for accurate and detailed engine models becomes paramount. Neural networks offer a promising avenue for simulating internal combustion engines, combining speed and precision. By treating the engine as an enigmatic entity, neural networks can construct detailed models. This study aims to employ two types of neural networks—multilayer perceptron and radial basis functions—to train and build a model of an internal combustion engine. These networks will simulate and estimate the engine's mean suitable pressure, allowing for a comparison of their effectiveness. Prior to implementing the neural network architecture, an engine model was constructed in MATLAB to gather necessary training data. This preliminary step ensured a robust foundation for subsequent network design and implementation. In summary, this research focuses on leveraging neural networks to model internal combustion engines, utilizing both multilayer perceptron and radial basis functions to simulate engine behavior and estimate mean suitable pressure.


Introduction
In recent years, excessive consumption of fossil fuels and greenhouse gas emissions has been a significant global challenge.Consequently, renewable sources of energy are widely used [1][2][3][4][5].A large percentage of fuel consumption and pollutant generation are related to internal combustion engines.This has led to efforts to achieve cleaner and more intrusive internal combustion engines.Before the oil crisis of the 1970s, significant people were only mindful of the easy use of cars and convenience, and no one thought about pollution and fuel consumption [2,3,[6][7][8][9].In recent years, air pollution has become one of the significant problems in the world, causing the pollution of cars to be limited and making its control a significant issue in the policy of car manufacturers [10][11][12][13].
Applying a suitable control method, improvements, and tuning to the vehicle engine can control pollution and reduce fuel consumption [14][15][16][17][18].This makes it much easier and less costly if you have a precise model of that engine.In fact, instead of testing the engine and obtaining experimental data in the laboratory, which is very time-consuming and expensive, the obtained model can be used as a virtual engine and a platform for collecting the required experimental data.You can also apply the designed controller or the desired improvements and tunings to the model and see the result [19][20][21][22].
An accurate model with an acceptable response time is desirable and, of course, complex and challenging.First, the engine dynamics are nonlinear and complex [15,[23][24][25][26][27][28].Second, engine dynamics consist of extensive operating conditions.Linearization methods should often use multi-dimensional correction coefficients.On the other hand, there are two different aspects of each software model: the accuracy of the model and the speed of simulation and calculation, so each one must be ignored slightly to reach the other one.Considering all of the mentioned issues, neural networks are an attractive option for modeling internal combustion engines [15,23,[29][30][31][32][33][34].
In this investigation, a model of the internal combustion engine is developed using the MLP (Multilayer perceptron) neural network to estimate the mean adequate pressure of the engine.Before training the neural network, a discrete engine model has been developed and validated to use as a platform and obtain the data needed to train the neural network.The reason is that for training the neural network, a large amount of data is often needed, which can push the engine under too much pressure or cause it to enter a dangerous running area.Using a model of the engine with the same function makes it possible to prevent excessive pressure on the engine.

Collecting the Experimental Data
A large number of experimental data from the system is usually needed to train a neural network, which is derived from a discrete-time model in this investigation.This model is developed based on experimental data obtained from the Ricardo Engine in the thermodynamic lab of the Faculty of Mechanical Engineering, Amir Kabir University of Technology.

Model Equations
The engine can be considered a chamber where the mass flows into it and another stream flows out.Using the balance of mass and energy, the first law of thermodynamics, and the assumption of an ideal gas, we can write system differential equations for measurable variables P and V.
In which p is the pressure, t is the time,  is the universal gas constant,  is the temperature,   is the inlet temperature,  is the volume, ̇  is the mass flow of the output and ̇  is the mass flow of the input.Usually, the flow passes through a valve or an orifice.It is assumed that there is no friction, and the system is completely isolated.The engine can also be considered as a pump, and an equation for this model is as follows, in which the total flow of mass sucked by the engine is determined.
() 2 ………………………(2) In which   is density,   is the air-to-fuel ratio,   is the displacement volume,   is engine speed, and  is 2 for a fourstroke engine.This equation determines the total mass sucked by the engine.For fuel-injected engines, a part of m dot is the fuel, because of which m dot sub beta, which determines the manifold air flow, will be less than ̇.By combining all the equations, the following equation obtains ̇: In which β is refers to the ambient condition.Mixture properties are approximated by air properties.With this approximation, the error of the calculation for the gasoline is 5%.It is assumed that EGR (Exhaust Gas Recirculation) is received directly from the exhaust valve, and there is no delay or dynamic gas mixing.In Figure 1, mass flow rates of the engine and EGR are shown in which a, m, γ, eg, β, and ε are stands for air, manifold, engine outlet, exhaust gas, engine inlet, and EGR respectively.Mass flow of the exhaust gas is equivalent to the sum of EGR mass flow and manifold inlet air mass flow, and the mass flow of fuel.In the outlet, there is little air that is not burned.The total inlet mass of the engine is obtained by assuming the complete mixing of gases in the inlet manifold.By writing a mass equilibrium for the manifold, equation ( 4) is derived:

(4)
The manifold pressure is determined by the use of ideal gas law.In equation ( 4), ̇() is found by the use of the orifice equation and knowing the pressure and temperature of the inlet and outlet manifolds (15).

Wall Wetting Dynamics
By injecting the fuel into the manifold, only a part of it enters the combustion chamber.Part of this injected fuel condenses on the manifold walls, the other part is located behind the intake valve, and part of the fuel sticking to the wall also evaporates [15].The following mass equilibrium can be written: In which ̇() is the mass flow of the injected fuel,   () is the mass flow rate of the condensed fuel on the walls and ̇() is the mass flow rate of the mixture enters the combustion chamber during the intake stroke.In these equations parameters  and  are not constant and depend on temperature and pressure.One of the methods for determining these parameters is to assume that they are constant at a given point, which by changing the working point, must be defined for new values.The next approach, that is used in this model, is to use the MIT rule to estimate these values at any point.The proposed model is invertible, which means that if the fuel level on the wall,   is known, the desired ̇ which has to be injected can be obtained.The wall wetting dynamics is due to the three parts, the evaporation of droplets during transportation by air, the decrease in the number of droplets due to joining together and the evaporation of liquid fuel on the walls.Total mass flow of the fuel is shown in the following equation.̇ = (̇ − ̇  ) − ̇  …………….. (7) In which ̇ is mass flow of the injected fuel, ̇  is mass flow rate of evaporated fuel to the air from the jet and ̇  is mass flow rate of evaporated fuel from the wall.An important point to note is that it is possible to assume fuel injection as a continuous action and independent of the time of injection.
The mass rate of the injected fuel into the combustion chamber is determined by pushing the driver's pedal, as a result   ̇ is considered as the input of the system.With these values, there is complete information on the engine's variables.Using the thermokinetics relationships, it is possible to calculate the engine's operating characteristics, including its mean adequate pressure.

Discrete Model
MATLAB has been used to develop the discrete-time model.The diagram of this model is shown in Figure 2.This model is used as a virtual engine to collect the data for training the neural network.

Figure 2 Discrete Model Diagram
Since the neural network can only be used for interpolation and not for extrapolation, the collected data should cover all the working areas of the system [15,23].The discrete model discussed above is developed considering this.To ensure the accuracy of this model, the outputs of about 50 cycles with experimental outputs are compared with the same input conditions, the results of which are shown in Figure 3.

Figure 3 Validation of model
Ensuring the model simulates the engine fairly accurately, its output can train the desired neural networks.It is worth noting that although the software model does not have a precision of 100% accuracy in the simulation of the engine.In the best case, the neural network will have the same precision in its output estimation.However, this study aims to demonstrate the neural network capabilities in system modeling.Using a model of the engine with the same function makes it possible to prevent excessive pressure on the engine.The model's inputs are engine speed, inlet temperature, inlet pressure, air-to-fuel ratio, octane number, and EGR.The mean adequate pressure of the engine is considered the model's output.

Multilayer Perceptron Neural Network
The multilayer perceptron neural network is the first neural network designed to simulate this engine.This network is a powerful tool for simulating various dynamic and static systems.In Figure 4, the architecture of the network considered for this model is shown.

Figure 4
The network architecture used to model the Ricardo engine Because the system is dynamic, the inputs and outputs of the system will affect the next cycle.Also, system inputs are not specific to their corresponding cycle, and their effects are visible in the next cycle or cycles.For this purpose, two delays for inputs and outputs are used.This means that in each cycle, the inputs corresponding to that cycle and the previous two cycles and the outputs of the previous two cycles are considered as inputs [4,23,35,36].5 and 6.In these Figures, the parameter R is the linear regression coefficient between the outputs of the network and targets of the network, which are also the outputs of the discrete model for the same input.If the network has 100% accuracy, all these points should be placed on the line with the unit gradient that passes from the origin.As shown in Figure 5, the linear regression coefficient for the test data, in this case, is equal to 0.98257, which is very close to one, which indicates the high accuracy of the result of the designed network for the test data.This coefficient for all data and education is 0.99345 and 0.99937, respectively, indicating an excellent network performance.These values are displayed in Table 1.Average errors and standard deviations are also shown in these Figures.

Radial Basis Function Neural Network
Radial basis function neural network architecture is different from Multilayer Perceptron.These networks have several kernels with linear and nonlinear functions.These networks can approximate any nonlinear function by considering the appropriate coefficients for the kernels.These functions and coefficients are determined in the process of training the network.In order to evaluate the network performance, minimization of the mean squared error is considered the target.The results of training this network are specified in Figure 7.As shown in Figure 7, the error of this network after 500 epochs is similar to that of the multilayer perceptron neural network and even works somewhat better than that.However, the time required to train this network is far greater than that required to train the multilayer perceptron neural network, suggesting that the multilayer perceptron neural network is a better choice.

Conclusion
For modeling the mean adequate pressure of the Ricardo engine, two types of neural networks, multilayer perceptron, and radial basis function, are used, and their results were compared; it was determined that both networks could be used to estimate the outputs very well.
Considering the modeling results, we can well model the mean adequate pressure of internal combustion engines using neural networks.However, the time it takes to train the multilayer perceptron neural network is much less, which makes it much more desirable to use this network.Such a model can be used to design controllers that use a mean adequate pressure as feedback.
With such a capability, it is possible to estimate other engine operating variables, such as the temperature of the exhaust gases or its pressure, to obtain more precise models than the engine and use them to design a turbocharger or exhaust catalytic converter.

Disclosure of conflict of interest
No conflict of interest to be disclosed.

Figure 5 Figure 6
Figure 5 Validation the outputs of the multilayer perceptron neural network and the actual outputs for the test data

Figure 7
Figure 7The result of modeling using the radial basis function neural network

Table 1
Results of modeling with multilayer perceptron neural network