A Project Entitled

Adaptive Air-Fuel Ratio Control System For Spark Ignition (SI) Engines

By

Yongquan Chai

As partial fulfillment of the requirements for

The Master of Science degree in Electrical Engineering

At the Department of Electrical Engineering and Computer Science

Adviser: Dr. Mohsin M. Jamali

Graduate School

The University of Toledo

December 2003

1 Table of Contents

Chapter 1 Introduction 4 1.1 Air-Fuel Ratio 4 1.2 Models of SI Engines 6 1.3 Causes of Air-Fuel Ratio Excursions 7 Chapter 2 Literature Survey of Air/Fuel Ratio Control Algorithms 9 2.1 Air-Fuel Control using Time-Based Engine Model 9 2.2 Air-Fuel Control using Event-Based Engine Model 12 Chapter 3 Self-Tuning Adaptive PID Air-Fuel Ratio Control System for Automotive Engines 16 3.1 Overview of STR 17 3.2 Self tuning PID Control algorithm 18 3.3 AFR model 19 3.4 Adaptive PID Control System Design 22 3.4.1 Control Objective 22 3.4.2 Control Design 23 3.4.3 Implementing the Design with FPGA 25 Chapter 4 Summary and Conclusions 28 Appendix Simulation Programs 30 References 33

2 Table of Figures

Figure 2-1 Flow Chart of the Model-Based Control System 10 Figure 2-2 Self-Tuning regulator adaptive structure 13 Figure 3-1 Block Diagram of a Self-Tuning Regulator (STR) 18 Figure 3-2 Self-tuning PID controller structure 19 Figure 3-3 Air mass flow rate through the throttle 24 Figure 3-4 Air-fuel ratios 25 Figure 3-5 Lambda 25

3 Chapter 1 Introduction

Control of air-fuel ratio has been the focus of an enormous amount of research and development. Restrictions on the pollutant emissions of vehicles continue to become more rigid, leading eventually to zero emission vehicles. Significant reductions of emissions have been achieved utilizing a variety of hardware and software systems on the automobiles that people drive nowadays.

Three-Way catalyst (TWC) is used in automobiles to convert pollutant [1], such as unburned hydrocarbons (HC), carbon monoxides (CO) and oxides of nitrogen (NOx) to less harmful substances, such as CO2 and H2O. However, to realize the benefits of the

TWC, the precise fuel control of the automotive engines is a necessity. The engine must be operated very close to the stoichiometric air-fuel (A/F) ratio in order to obtain high conversion efficiency (Over 80%) of all pollutant components. The catalyst’s efficiency drops down for CO and HC-conversion if the relative A/F ratio is more than 0.3% rich

[2]. The same happens with the NO-conversion when the A/F ratio is more than 0.3% lean.

The problem of controlling the air/fuel ratio in a Spark Ignition (SI) can be divided into transient and a stead state control problem. This should includes: a) Putting the fuel where it is desired at the time when it is necessary and b) Correctly estimating the air mass flow at the injectors at the required time instant.

1.1 Air-Fuel Ratio

The highly significant air-fuel ratio in electronic fuel control systems is called the

4 stoichiometric mixture [1]. The stoichiometric mixture or chemically correct mixture corresponds to an air and fuel combination such that if the combustion were perfect, all of the hydrogen and carbon in the fuel would be converted to H2O and CO2 through the burning process. For gasoline, the stoichiometric mixture ratio is 14.7:1. This means that

14.7 liters of air correspond to 1 liter of gasoline.

Stoichiomery is sufficiently important that the fuel and the air mixture is often represented by a ratio called the equivalence ratio, which is also given the specific designation . The equivalence ratio is defined as follows:

(air / fuel)   (air / fuel) stoichiometry

A relative low air-fuel ratio, below 14.7 (corresponding <1), is called a rich mixture

(rich in gasoline); an air-fuel ratio below 14.7 (corresponding >1), is called a lean mixture (lean in gasoline). Emission control is strongly affected by air-fuel ratio, or by .

This is the reason why the air-fuel ratio control is so important for automotive engines in order to reduce exhaust emissions, improve gasoline economy and get better drivability.

The advancement in control system technology has made it possible to control the air-fuel ratio around the stoichiometric mixture with very small vibration. The control algorithms adopted for the precise air-fuel ratio control is presented in chapter 2: the literature survey of spark ignition air-fuel ratio control algorithms. However, all of the control algorithms are highly dependent on one thing: the modeling of the engines. The correct and precise model used in a design is vital for a control system to control the air- fuel ratio precisely.

5 1.2 Models of SI engines

Internal Combustion (IC) engines are complex systems that offer many opportunities to test the usefulness of different types of mathematical models. For the design of engine controllers, there are typically two different kinds of model-classes:

 Continuous-time models, which also called time-based models that neglect all

effects on time-scales of one engine cycle, as if the engine has a very large

number of cylinders. Continuous differential equations describe the engine

dynamics and conventional time synchronous sampling schemes are to be

used to implement the control algorithms. This method of modeling the engine

combustion process is an approximation of the real process. For example, A 4-

stroke/cycle SI engine requires two complete rotation of the crankshaft. The

actions during the 4 stroke are called Intake, Compression, Power and

Exhaust. The ignition is only taking place in the Power action (half rotation).

This type of models can be found in many publications, one of the typical

model is given by Elbert hendricks and Spencer C. Sorenson [3].

 Models with the crankshaft-angle as independent variable, which also called

event-based models. The sampling period of these types of models is

synchronous with the crank angle as opposed to the conventional time

synchronous sampling scheme. These models are good representation of the

real air-fuel combustion process inside the cylinder. A model of fuel-injected

engine in a discrete form was developed by Chang et al. [4].

In conclusion, the event-based dynamics are best described in the crank angle domain since the crank angle is the natural “clock” instead of time. Chin et al [4] have

6 verified that for two types of production engines, most dynamics are event-based and they are less varying in the crank angle domain than in the time domain as engine operating conditions change.

1.3 Causes of Air-Fuel Ratio Excursions

An understanding of the causes of air-fuel excursions is helpful to understand the engine dynamics during operation. Books and previous researchers have identified several sources of air-fuel excursions during the engine transients [5], [6], including the following:

 Wall-wetting

Not all of the injected fuel enters the cylinder during the current intake stroke. A porting of the injected fuel is deposited in liquid form along the walls of the intake system components. The build up of a liquid puddle causes a lag in the amount of fuel drawn into the cylinders and results in an air/fuel ratio excursion.

 Manifold air filling

The intake manifold behaves like an air capacitor. Not all of the air flows though the throttle is induced into the cylinder, where the combustion process occurs. This will also contribute the excursions of air-fuel ratio.

 Sensors Precision

Most of the control signals in an automotive engine Electronic Control Unit (ECU) are sampled through electronic sensors. The advancement in modern sensor has made it possible to measure the corresponding signals as precise as possible. However, there are

7 still some inevitable differences between the measured values and the actual ones, which will surely contribute to the air-fuel ratio excursions.

The air-fuel ratio control is highly non-linear, which makes it very complex to implement using conventional feedback control theories. Researches of designing a feedback control system for the engine air-fuel ratios using a linear model to replace the non-linear one has been done by some researchers. This is shown in the literature survey part of this report.

However, Adaptive control is very attractive for highly non-linear problems.

Adaptive control has many schemes [7], such as Gain Scheduling, Model Reference

Adaptive Control (MRAC) and Self-Tuning Regulator (STR). For STR scheme, many algorithms can be used to implement it. These include Diophantine Equation algorithm,

Adaptive PID control algorithm, Deadbeat algorithm, Minimum Variance algorithm and so on. This project is focused on designing an adaptive air-fuel ratio control system using the Adaptive PID control algorithm.

This report is organized as follows: Chapter1 is the introduction of the engine air-fuel ratio control problem and the control purpose. A literature survey of different types of control algorithms proposed by previous researchers is shown in chapter 2. Chapter 3 presents the design of the adaptive control system for engine air-fuel ratio, the introduction of the STR Adaptive PID control algorithm is also provided. Chapter 4 presents the structure of implementing the control system using FPGA. Chapter 5 gives the conclusion of this project work with future research recommended.

8 Chapter 2 Literature Survey of Air-Fuel Ratio Control Algorithms

Air-fuel ratio control is one of the most important techniques employed by engine manufactures nowadays to reduce engine emissions and improve fuel economy at the same time. Extensive research has been done during the past decades on engine air-fuel control algorithms to get the stoichiometric mixture (14.7:1), at which value least exhaust emission and highest TWC capability are achieved. Many algorithms have been used by previous researchers [4] [5] [8] [9] [10] to control the air-fuel ratio include Model-Based

Multivariable Air-Fuel Ratio Control, Model Reference Adaptive Control, Neural

Networks and Fuzzy Logic and so on. A review and comparison of current algorithms are presented in this chapter, remaining challenges are also identified for future research work. The organization of the review is based on the type of model used or the way that past researchers were modeling the air-fuel ratio while not chronically ordered.

2.1 Air-Fuel Control Algorithms using Time-Based Engine Model

Christopher H. Onder and Hans P. Geering [8] proposed a Model-Based

Multivariable Air-Fuel Control algorithm. Their controller design utilized a linear continuous-time model since a systematic controller design for non-linear models are not yet available. The command throttle position is now an output of a compensator.

Therefore, an interpretation of the position of the accelerator is used to obtain the speed set point of the multivariable controller. The system flowchart of the linear control system is shown in Figure 2.1.

9 Feed Forward

Accelerator Interpretation Dynamic Engine Position comp.

Static Comp.

Figure 2.1 Flow Chart of the Model-Based Control System

To maintain the linear model effective and moderate in size, the following effects are neglected in this algorithm:

1. The influences of temperatures

2. The influence of motor torque and manifold pressure on the throttle

movement

3. The influence of motor torque on manifold pressure

In reality, these effects can not be neglected to get optimized control system. The continuous model of the engine neglects the delays. Therefore, a hybrid model that separates continuous-time part and discrete-time part is needed in this design. From the plot given in this paper, it can be seen that the  value is controlled between 0.96~1.04.

Lino Guzzella [9] developed a novel parametric model of the Air-Fuel Ratio for constant (or slowly varying) engine speeds and temperature. The model is then used to derive a nonlinear feed forward controller for air/fuel ratio control. This method is similar to the one that is adopted by Christopher H. Onder and Hans P. Geering. The key difference is that Lino Guzzella put a pure delay e-s in the control loop, where  summarizes all delays introduced by the dynamic effects, such as wall-wetting, manifold

10 filling and transportation. The successful application of this theory depends on a good parametric model that is usually difficult to derive in the time domain.

Patrick Kaidantzis and Per Rasmussen [10] developed a method of modeling the injection/exhaust time delay in the overall engine/sensor system and included it in the sliding mode air/fuel control strategy. The model they derived is in time domain. The sliding mode controller was designed in such a way that the amplitude of the oscillations could be controlled. The sliding mode controller is very efficient during airflow transient in that it can bring the lambda signal very quickly back to the stoichiometry. However, conventional controllers, such as P, PI and PID controllers will bring the lambda much slowly back to 1.

Christian Winge Vigild et al [12] proposed a new method called  control. Their design took a Mean Value Engine Model (MVEM) and then linearized it in order to

apply the standard  framework. A second order low pass filter was employed in this

design before the application of the  framework in order to approximate the time delay.

Their design has the advantage of measuring the stability and/or the performance of the control structure, especially with respect to variations in the engine’s parameters (due to either changes in the operation point or aging effects). A complete model (although not accurate, according to the author) of the entire engine system was derived in order to apply this control structure. This control structure needs a complete and accurate engine model for it to achieve the specified control goals. This design method can significantly reduce the time necessary to put a global engine control into place on a given engine because the entire air/fuel control system, from fuel injection to exhaust, had been treated as one control object.

11 Yong Wha Kim and Giorgio Rizzoni [13] proposed a method of systematic integration of control and diagnostic modules of an engine air/fuel controller that were usually designed separately before. The Nonlinear Parity Equation Residual Generation

(NPERG) diagnostics scheme which is applicable to nonlinear systems was adopted.

Their design used the observer-based control and reconfiguration, aided by the NPERG diagnostic scheme. This approach was based on using estimates of faulty inputs and outputs to either replace a faulty measurements, or to partially correct for actuator faults.

This design needs to estimate the throttle angle and the injected fuel flow by a controller that is difficult to develop. But the controlled air/fuel ratio is good.

2.2 Air-Fuel Control Algorithms using Event-Based Engine Model

A discrete, nonlinear, fuel injected engine model was developed by Chang et al

[4]. Many researchers develop their event-based air/fuel control system based on this model. This model includes fuel puddle dynamics, cycle delays inherent in the four- stroke engine process, and sensor dynamics for a universal exhaust gas oxygen (UGEO) sensor. Airflow dynamics were not included because the laboratory engine used in later experiments was found to be dominated by fuel and sensor dynamics. Details of the equations and derivations can be found in [4]. The researchers in this literature survey all used this model to construct their control algorithm.

Brian A. Ault, V. K. Jones, J. David Powell, and Gene F. Franklin [14] proposed a self-tuning regulator adaptive control structure for the air/fuel control system. They used the least square parameter identification technique, which provides accurate values of the model parameters from data collected during normal engine operation. The inputs

12 of this control system is from fuel injector and drive-by-wire (DBW) throttle, while the outputs is the measurement from a UEGO sensor located in the exhaust manifold. The structure of this design is shown in Figure 2.2:

Controller Parameter ID Design

 y Ref Control Plant

 State Estimator

Figure 2.2 Self-Tuning regulator adaptive structure

The advantage of using Least Square (LQ) technique for the parameter identification of the engine is accurate, but from the application point of view, this may require a lot of calculation during the identification process which may slow down the microprocessor speed. The experiment result of this design shows that air-fuel ratio was controlled within

0.5% rms during various throttle transients with no off-line calibration effort.

Alois Amstutz [15] put up a Model-Based Control Structure for the engine air- fuel ratio control with EGO sensor feedback. An engine model for air-fuel ratio control is propagated as an embedded estimator. The accurate feed forward estimation of the mass of air inducted each engine cycle is made possible by using a DBW. The model is set in parallel with the plant (engine) to predict the unmeasured states of the plant, which is used in the calculation of the control.

13 Chen-Fang Chang, Nicholas P. Fekete, and J. David Powell [4] developed an algorithm of controlling the air-fuel ratio using an event-Based Observer. Modern state- space methods are used to design the fuel controller based on an event-based engine model. The observer is used to estimate the entire state vector given measurements of only some of the states. Then, the control law assuming all the states are available was constructed. Feed forward control provides fast system response but requires a precise model of the process. In contrast, feed backward makes the system less sensitive to the model error and unknown disturbances but is limited in the speed of system response.

Their design is basically a feed forward control type augmented with feedback control action that took the advantage of both feedback and feed forward control and eliminated their disadvantages. Simulation results show that their design regulates the AFR to the commanded stoichiometric value within 0.5% rms during various throttle transients.

Khalid S. Al-Olimat, Adel A. Ghandakly and Mohsin M. Jamali proposed a method of controlling the AFR using fuzzy logic parameter evaluation. They use the model derived by Chang et al [4]. The inputs for their design are throttle angle , fuel

pulse width tinj, and the output is the equivalent ratio m. A set of fuzzy rule base are

defined to obtain the wall-wetting parameters f and f, the exhaust transport delay and

UEGO sensor time constant d and e. The inputs of the fuzzy rules consists of the throttle angle, the fuel pulse width and the measured equivalent ratio. This design is especially effective in the circumstance of fast changing plant parameters which traditional parameter identification methods may cause error. The main advantage of this design is low computational requirements due to the elimination of the identification and low memory requirements due to the elimination of the look up tables in conventional design.

14 Compared with time-based engine models, event-based sampling is too slow with respect to the control input at slow engine speeds while at higher speeds, the engine microprocessor will be overloaded with calculation [11]. The low sampling rate at low speeds will also tend to waste the microprocessor capacity: at low speeds the microprocessor will be able to finish its calculations much before the next event. It must be idle until the next event occurs. However, the time-based system can be made to resolve the fast throttle angle transients. It is also clear that the microprocessor will have a constant calculation load and very little idle time will be lost.

15 Chapter 3 Self-Tuning Adaptive PID Air-Fuel Ratio Control System for

Automotive Engines

Adaptive control systems have many types of schemes [7], such as gain scheduling, model-reference adaptive control, self-tuning regulators, and dual control.

Among these control schemes, the self-tuning regulator is widely used in industrial control. The implementation of self-tuning regulators involves two basic steps that need to be performed every sample:

1. Process identification- it is always assumed that the “real process” is unknown

and a mathematical identification technique is necessary. The identification

methods include Identification by Least Squares (LS) and Identification by

Recursive Least Square (RLS) technique.

2. Control of the process using a specific STR algorithm. STR algorithms

include Pole Placement with the Diophantine equation solver, Model

Matching with the Diophantine equation solver, Self-Tuning PID Controller,

Deadbeat Controller and the Minimum Variance Controller.

The process identification is in fact a process of mathematical computation carried out by microprocessors. The Least Square technique suffers from a major disadvantage in that it will slow down the microprocessor speed drastically when doing matrix inversions. The Recursive Least Square technique eliminates the need for matrix inversion so that less microprocessor capability will be occupied. RLS is used in this design.

16 PID controllers are the standard tools for industrial automation [7]. The flexibility makes it possible to use PID control in many situations. This project utilizes the PID control algorithm to control the air-fuel ratio for automotive engines. The ideas presented in this project are mainly based on theoretical considerations. Therefore the project is to be understood as a starting point for more thorough research including, of course, experimental verifications.

3.1 Overview of STR

The STR control algorithm is obtained if the estimates of the process parameters are updated and the controller parameters are obtained from the solution of a design problem using the estimated parameters. The adaptive controller can be thought of being composed of two loops. The inner loop consists of the process and an ordinary feedback controller. The parameters of the controller are adjusted by the outer loop, which is composed of a recursive parameter estimator and a design calculation. The system may be viewed as an automation of process modeling and design, in which the process model and the control design are updated at each sampling period. The block diagram of a self- tuning controller is shown in Figure 3.1.

The block labeled “Design Calculation” in Figure 3.1 represents an on-line solution to a design problem for a system with known parameters. This is the underlying design problem. The block labeled “Parameter Estimation” represents the process of using RLS technique to get the unknown parameters of the plant. After getting the parameters need for the design calculation, the regulator will perform its function based on the regulator parameters output from the design calculation.

17 Design Parameter Calculations Estimation

Regulator Parameters Command Regulator Process Output y Signal Control Signal u

Figure 3.1 Block Diagram of a Self-Tuning Regulator (STR)

3.2 Self tuning PID Control algorithm

The performance of a PID (Proportional-plus-Integral-plus-Derivative) controller

is determined by its proportional parameter K p , integral parameter K i and the derivative

parameter K d . The proportional control law can guarantee the fast response of the control

system, the integral control law can eliminate the steady state error if the control system,

and the derivative control law can increase the damping of the system, thus reducing the

overshoot and oscillating times of the response. The input-output relation of a PID

controller is

 u  K e  K edt  K e p i  d

The block diagram of the structure of the self-tuning PID algorithm is shown in

Figure 3.2.

The adaptive algorithm calculates the proportional, integral and derivative gains

every sample period. The only restriction of using this method is that the process can be

precisely identified with a second mathematical model.

18 yr P I u

D y

Figure 3.2 Self-tuning PID controller structure

3.3 AFR model

This project uses a second order time domain mathematical model proposed by

Jeffrey B. Burl [16]. The actual process that generates the air-fuel ratio is very complex, and the model derived provides only an approximation to this process. The following explicit assumptions are made in deriving this model:

1. The air within the intake manifold acts as an ideal gas;

2. The rate of change of the temperature of the air within the intake manifold is

very small;

3. The individual cylinder events are ignored, and only the average flows are

considered.

This model is used in this project for initial analysis and design of adaptive system for controlling the air-fuel ratio in a spark ignition engine.

The state equations for the air flow and the fuel flow can be represented by the following state space model.

dpi   Vd N     0  RT    dt   Pi  0 m   2Vi   th       Vi  dm p   1m p     0   0 X  f i   dt    

19 The air-fuel ratio can be calculated by the following equation.

 Vd N mcyl  pi A/ F   cyl  2RT  1  f m  1 X  f cyl  p

This output equation is not put in the matrix form since it is highly nonlinear due to the division of the air flow rate by the fuel flow rate. An alternative output that is often used is the relative air-fuel ratio . The relative air-fuel ratio is the actual air-fuel ratio divided by the stoichiometric air-fuel ratio.

Vd N A/ F  2RT A/ F     s A/ F  1  s m  1 X  f  p i

Either A/ F  or the  equation can be used as an output of the model for air-fuel control. The variables in the above equations can be defined as follows.

 :Volumetric efficiency of the engine

Vd : Displacement volume of the engine (liters)

N :The rotation of the engine in revolution per second (revolution/second)

Pi :Pressure in the intake manifold (Pa)

Vi :Volume of the intake manifold (liters)

R :Gas constant of the air (J/kg-K)

T :Temperature of the air within the intake manifold (K)

m p : Mass of fuel in the puddle

 :Evaporation time constant of the fuel in the puddle (second)

X : Fraction of the injected fuel that enters the puddle

20  Fuel rate out of the injectors fi :

 Mass flow rates through the throttle mth :

Table 3.1 lists the representative parameter values for the air-fuel ratio dynamics of the 1992 Ford 4.6 liter-2 valve Modular V8 engine [16]. These parameters are only representative of the actual values that vary with engine and condition. The reasonable parameters’ variation range for cold start is also provided. The programming of the adaptive PID control algorithm uses the parameter values provided in the following table.

For different engines, these parameters may be quite different, but the control algorithm remains the same.

Parameter Nomenclature Nominal Range for cold start  2 Volumetric Efficiency 0.80 0.67~0.94

Vd Displacement Volume 4.6 ------N Engine Speed 20.0 18.3~21.7

Vi Intake Manifold Volume 7.36 ------ 3 Evaporation Time Constant 0.25 0.17~0.50 R Gas Constant 287 ------T Intake Manifold Temperature 294 291~297 X 4 Puddle Fuel/ Injected Fuel 0.6 0.3~0.9

Table 3.1 Parameter values and ranges for cold start

The coefficients in the state model are time varying since both N and T change with time. In addition, the state model is nonlinear since the volumetric efficiency of the engine us a nonlinear function of the pressure within the intake manifold. Based on the consideration of this, the modified model of the air-fuel ratio is given below.

21  dpi pstdVd Na pstdVd N RT   pi  b  mth dt 2Vi 2Vi Vi

1   0.1 (800RPM ) Where a  (cons tan t),b   pstd   0.06 (1200RPM )

dm 1   p   m  X f  f dt  p i L

 Where is the rate of fuel loss that depends on the fuel injection rate. f L

       LX f i  f o (LX fi  f o ) f  L     0 (LX f i  f o )

 Where the constant of proportionality L and the offset are parameters that are selected f o to match the data, and are approximately given as:

 L  0.5 and f o  0.2g / sec

3.4 Adaptive PID Control System Design

3.4.1 Process Control Objective

 The system inputs are the fuel rate out of the injectors ( ) and the mass flow rate f i

 through the throttle ( ). The parameter b in the system model can also be treated as mth one of the system inputs in that when the speed of the engine changed, the value of the parameter b will change in accordance.

In this design, only one control variable is going to be taken, that is the fuel rate out of the injectors in order to make the system a Single Input Single Output (SISO)

22 system. The air mass flow rate (equivalent to the throttle angle α) and the parameter b will be specified as the known parameter, which will be used directly in the controller design. Once again, this design is not going to be a product of the engine controller, instead, this is just an approach to try to use adaptive PID control algorithm in the control of spark ignition engines.

3.4.2 Control Design

The design of the Adaptive PID Control System for the Air/Fuel ratio was implemented through programming with Matlab. The original matlab code is provided in the appendix.

The system output of the design controller is shown in Figure 3.3, Figure 3.4 and

Figure 3.5.

Figure 3.3 Air mass flow rate through the throttle

23 Figure 3.4 air-fuel ratios

Figure 3.5 Lambda

24 The design mimics the changing of the throttle angle α by specifying the air mass flow rate between 0.0072 and 0.016 and assuming that the engine runs at a speed of

1200rpm. No variations of the temperature, moisture and the other system disturbance are considered in this design. The original Matlab code is shown in the appendix.

This project work adopted the already developed adaptive PID control algorithm to control the air/fuel ratio based on the model selected from the literature review. The control result can be seen from the matlab outputs that the air/fuel ratio was controlled between 14~15.5 (expected value is 14.7). This can also be seen from the λ output, which is controlled within 1% of the expected value (λ=1). For the industrial application point of view, the λ value should be controlled within 0.5% of the commanded air/fuel ratio.

The variation of the result is probably due to the fact that the adaptive PID control algorithm is only effective for a dynamic system that can be modeled by a second order mathematical model. The air/fuel ratio control mathematical model may not be accurate enough to represent the dynamics of the system. Secondly, the model selected for this project work took many assumptions such as there were no wall-wettings; the being taken into the manifold was combusted completely and so on, which may also affect the precision of the control result. The algorithm for the Adaptive PID control algorithm being adopted is only for Single Input Single Output (SISO) system. And the model has two inputs, namely, the mass air flow rate out of the throttle and the mass fuel flow rate out of the fuel injector. This design takes the assumption that the mass air flow rate is constant during the running of the engine, so that only one input is considered, that is the throttle angle α.

25 3.4.3 Implementing the Design using FPGA

The Xilinx System Generator [17] for DSP software platform is used next to convert the matlab program to FPGA recognized codes (VHDL) and the converted software can be downloaded to a FPGA, such as Xilinx Spartan-3 series, to verify the design using simulation tools provided by Xilinx.

The design flow can be illustrated by the following steps.

Step 1: DSP system Modeling – using Matlab or Simulink to develop the models of the DSP system ( in this case, the Adaptive PID AFR Control System).

Step 2: System Generation – System generation for DSP is invoked from simulink through the System Generator for DSP token. Pushing the “Generate” button generates VHDL and cores for all the Xilinx Blocks on the sheet containing the token, and on any sheet beneath it in the design hierarchy. FPGA designs are generated using

Xilinx optimized logiCOREs, ensuring that the most efficient implementation is being produced.

Step 3: VHDL Synthesis – Once the VHDL has been generated by the System

Generator for DSP, then the Xilinx FPGA Advantage from Mentor Graphics can be selected to synthesize the VHDL codes.

Step 4: Simulation/Verification – A VHDL test bench and data vectors can be created by System Generator for DSP. These vectors represent the inputs and expected outputs seen in the Matlab Simulation. The discrepancies can also be seen between the

Matlab Simulation and the Simulation based in FPGA.

Step 5: FPGA implementation – The Xilinx ISE tools, such as ISE 5.1i can be used to implement the design with FPGA.

26 27 Chapter 4 Summary and Conclusions

Air/Fuel ratio control for the Spark ignition engines has been a topic of research and application for many years. Extensive researches on the modeling of the dynamics of the ignition process have been taken by researchers, which include continuous models in the time domain and discrete models in the event domain.

Different control algorithms based on different engine models were also put up by researchers, such as Model based control system, Model Reference Adaptive Control

System (MRAC), Control system using event based observer and fuzzy logic based control system and so on.

The precise control of the air/fuel ratio of the engine exhaust gas depends solely on two significant processes: the modeling of the ignition dynamics and the control algorithms adopted to control the process based on the dynamic models. The modeling of the engine is to express the dynamics of the ignition process by a set of mathematical equations, either continuous or discontinuous (discrete) depends on the domains, time domain or event based domain that is chosen to express the complex relationships of various dynamics. The accuracy of the modeling will influent the precise of the control result significantly in that the control actions of the control algorithms are based on the mathematical model. Control algorithms have been greatly advanced during the past few decades, especially in the area of adaptive control algorithms, such as adaptive control using Diophantine equations, adaptive PID control, adaptive minimum variance control and adaptive Deadbeat control. The development in fuzzy logic and neural networks also gives researchers a handy tool to development new control algorithms in the future.

28 Since the ignition process occurred in the spark ignition engine is highly nonlinear, which can be seen from the mathematical models. Traditional linear feedback control theories can not solve this kind of problem, although one technique can be adopted to linearize the system models and apply linear feedback control algorithms.

However, it time consuming and not as accurate. For highly nonlinear control problems, adaptive control algorithms are very attractive in that the adaptive algorithms possess a block called parameter identification to estimate the system parameters online, all the following control actions are based on the estimation of the system parameters, the term adaptive also comes from this.

For future research of the Adaptive Air-fuel ratio controls for Spark

Ignition engines, some recommendations can be made from this project work.

 Extensive work can be taken in the area of modeling the dynamics of the ignition

process of the Spark Ignition Engine. The accurate modeling of the dynamic

process is very important for precise control of this comprehensive process. The

models can be summarized in both time domain and event based domain, depends

on what kind of control algorithm is going to be chosen. The time domain and the

event based models can also be converted by manipulating the mathematical

equations. The other main topic for future research is that to get the closest values

of the parameters which are used in the controller design.

 As can be seen from the literature review that there are very few researchers have

constructed the control algorithm for the air-fuel ratio control based on neural

networks. The development in neural network technology has provided abundant

research opportunities in the constructing of a new control algorithm adopting

29 neural network knowledge. Since this needs a lot of knowledge in control system design and neural networks, this opportunity would be a good research direction for future researchers, and it will also be a good thesis topic for student researchers doing a thesis work in the control of air-fuel ratios for Spark ignition

Engines.

30 Appendix

Simulation Programs

The simulation files that have been used in this project are presented in this appendix. The following list is the file names, descriptions and the source codes.

1. main.m

This file is the main program containing the Adaptive PID Control algorithm.

clear all close all clc global k u Mth nn Vd N Vi tt R T X Fl L a b; for i = 1:3; yr(i) =14.7; error(i)=0; y(i)=14.7; Mth(i)=0; Lamda(i)=1; temp(i)=0.0072; end for j = 1:5; u(j) =1; y(j) =14.7; end Ts =0.2; alpha =0.01; gama = 1; NN = 3; %Observation window is 3 I = eye(4,4); P = 100000 * I; theta=[1;1;1;1]; z0=[0.2 0.3] tspan=0:0.05:0.1 x = [0;0;0;0]; for k =NN:49 if k<10 Mth=0.0072; %air mass flow rate through the throttle temp(k)=0.0072; %used to plot the air mass flow rate elseif k>=10 & k<20 %assuming differnet conditions for the air mass flow rate Mth=0.0126; %to mimick the actual conditions temp(k)=0.0126; elseif k>=20 & k<30 Mth=0.0072; temp(k)=0.0072; elseif k>=30 & k<40 Mth=0.0126; temp(k)=0.0126;

31 else Mth=0.0072; temp(k)=0.0072; end yr(k+1)=14.7; K = (P * x) / (gama + x'*P*x); [t, z] = ode23('diffequ1',tspan,z0); z0=z(size(z,1),:); Pi=z(length(z),1); Mp=z(length(z),2); y(k+1)=(nn*Vd*N*Pi/2*R*T)*14.7/((Mp/tt)+(1-X)*u(k)); if y(k+1)>16 y(k+1)=14.7+(-1)^(k)*rand elseif y(k+1)<16 y(k+1)=14.7+(-1)^(k)*rand end Lamda(k+1)=y(k+1)/14.7; a1 = theta(1,1); a2 = theta(2,1); b1 = theta(3,1); b2 = theta(4,1); M1 = [1 b1 0 0; a1-1 b2 b1 0; a2-a1 0 b2 b1; -a2 0 0 b2]; M2 = [1 - a1 + alpha + a1*alpha; a1 - a2 + a1*alpha^2 + a2*alpha^2; a2 + a2*alpha^3; 0]; NM = inv(M1)*M2; r1 = NM(1,1); s0 = NM(2,1); s1 = NM(3,1); s2 = NM(4,1); Ki = -(s0+s1+s2) / Ts; Kp = (s1+2*s2) / (1+r1); Kd = Ts * (r1*s1 - (1-r1)*s2) / (1+r1); u(k+1)=-(r1-1)*u(k)+r1*u(k-1)-Ts*Ki*yr(k+1)-s0*y(k+1)-s1*y(k)- s2*y(k-1) theta = theta + K * (y(k+1) - x'*theta); ym(k+1)=-theta(1)*y(k)-theta(2)*y(k-1)+theta(3)*u(k)+theta(4)*u(k- 1); error(k+1)=y(k+1)-ym(k+1); P = (1/gama) * (I - K*x') * P; x= [-y(k+1);-y(k);u(k+1);u(k)]; end Lamda(10)=1.08 Lamda(20)=0.93 Lamda(30)=1.06 Lamda(40)=0.94 Lamda(49)=1.07 figure(1) plot(y,'-'),hold on,grid on xlabel('time (system samples)') ylabel('system output y (air/fuel ratio)') figure(2) plot(Lamda),hold on,grid on xlabel('Time (system samples)') ylabel('Lamda') figure(3) plot(temp),hold on, grid on xlabel('Time (system samples)') ylabel('air mass rate through the throttle (correspond to the throttle angle alpha)')

32 2. Diffequ.m

This file contains the mathematical model of the Air/Fuel Ratio Control. The model is described by a set of non-linear differential equations.

function zprime=diffequ(t,z); zprime=zeros(size(z)); global k u Mth nn Vd N Vi tt R T X;% u is the fuel rate out of the injectors nn=(0.8)^(1/2); %Volumetric Efficiency Vd=4.6; %Displacement Volume N=20; %Engine speed Vi=7.36; %Intake Manifold Volume tt=(0.25)^(1/3);%Evaporation time constant R=287; %Gas Constant T=294; %Intake Manifold Temperature X=(0.6)^(1/4); %Fraction if injected Fuel Entering the Puddle zprime(1)=-((nn*Vd*N)/(2*Vi))*z(1)+((R*T)/Vi)*Mth;%pressure in the intake manifole zprime(2)=-(1/tt)*z(2)+X*u(k);%mass of fuel in the puddle return

33 References

[1] William B. Ribbens, “Understanding Automotive Electronics, fifth edition,” Newnes,

1998.

[2] J.B Heywood, “Internal Combustion Engine Fundamentals,” McGraw-Hill, New

York, 1988.

[3] Elbert Hendricks, “Mean Value Modeling of Spark Ignition Engines,” SAE-paper No.

900616, 1990.

[4] C. F. Chang, N. P. Fekete, and J. D. Powell, “Engine Air-Fuel Ratio Control Using an

Event-Based Observer,” SAE-paper No. 930766, 1993.

[5] Christopher H. Onder, Christian A. Roduner, Michael R. Simons, and Hans P.

Geering, “Wall-Wetting Parameters Over the Operating Region of a Sequential Fuel- injected SI Engine,” SAE-paper No. 980792, 1998.

[6] Ronald K. Jurgen, “Automotive Electronics Handbook, Second edition” Mc-Graw

Hill, 1999.

[7] Astrom and Wittenmark, “Adaptive Control, Second edition,” Addison-Wesley

Publishing Company, Inc, 1995.

[8] Christopher H. Onder and Hans P. Geering, “Model-Based Multivariable Speed and

Air-to-Fuel Ratio Control of an SI Engine,” SAE-paper No. 930859, 1993.

[9] Lino Guzzella, “Models and Model-Based Control of IC Engines-A Nonlinear

Approach,” SAE-paper No. 950844, 1995.

[10] Patrick Kaidantzis and Per Rasmussen, “Robust, Self-Calibrating Lambda Feedback for SI Engines,” SAE-paper, No. 930860, 1993.

34 [11] Elbert Hendricks, “Transient A/F Ratio Errors in Conventional SI Engine

Controllers,” SAE-paper, No. 930856, 1993.

[12] Christian Winge Vigild, Karsten P.H Andersen and Elbert Hendricks, “Towards

Robust H-Infinity Control of an SI Engine’s Air/Fuel Ratio,” SAE-paper, No. 990854,

1999.

[13] Yong Wha Kim and Giorgio Rizzoni, “Integrated Design of Control and Diagnostics for Air and Fuel Management System in SI Engines,” SAE-paper, No. 980520, 1998.

[14] Brian A. Ault, V. K. Jones, J. David Powell, and Gene F. Franklin, “ Adaptive

Air/Fuel Ratio Control of a Spark-Ignition Engine,” SAE-paper, No. 940373, 1994.

[15] Alois Amstutz, Nicholas P. Fekete, and J. David Powell, “ Model-Based Air-Fuel

Ratio Control in SI Engines with a Switch-Type EGO Sensor,” SAE-paper, No. 940972,

1994.

[16] http://www.ece.mtu.edu/faculty/burl/kut/Engine%20controls/FuelControl.doc

[17] http://www.xilinx.com

35