A Model-Based Development Environment and Its Application in Engine Control
Shugang Jiang, Michael Smith, Charles Halasz
A&D Technology Inc.

ABSTRACTTo meet the ever increasing requirements for engine
and vehicle performance, and at the same time shorten
product development time, model-based development
methodologies have been quickly adopted by OEMsand suppliers in recent years. With model-based
development, new algorithms are specified in a highlevel graphical language and directly compiled into
executables to be implemented and tested on rapidcontrol prototyping hardware. This seamless transition
from design to implementation and testing greatly
improves the efficiency of the development process formodern automotive control strategies, especially inengine control system development.
A model-based development environment and its
application in engine control functions development
are presented. The environment consists of the ADX
rapid prototyping controller, various functional boards,
necessary signal conditioning and power electronics
modules, and graphical user interface (GUI) software
VirtualConsole. Control algorithms to realize various
fundamental features necessary for engine operation
are developed. To show the features of theenvironment, the development of two control functions— A/F ratio modulation, and electronic throttle control(ETC) — are selected as examples and theirdevelopment processes are described in detail. The
applications demonstrate the great benefits of thedevelopment environment and the rapid control
prototyping methodology.

INTRODUCTION
Driven by the ever increasing requirements of fueleconomy, safety and environmental protection, moreand more electronic systems are being installed on
vehicles. Despite the increase in number andcomplexity of the electronic systems, OEMs arecontinually seeking to shorten the product development
cycle in order to survive the fierce market competition.
Under such a situation the market sees a great need formethods to rapidly develop, test and calibrate thevehicle subsystems. This has led to the quick adoptionof model-based development methodologies [1-9],
whose basic concepts are shown in Figure 1. Withmodel-based development, new algorithms can bespecified in a high-level graphical language. Then withthe aid of an automatic code generation tool, thealgorithms are converted and compiled into
executables to be implemented and tested on real-time
hardware. Because of the seamless transition fromdesign to implementation and testing, model-based
development provides solutions to quickly prototype
complex control strategies and carry out testing andverification in an efficient way. System behavior canbe assessed and tested in every development phase.
Control software can be evaluated and verified early inthe design process. Due to these advantages, modelbased development has become an essential part of thedevelopment process for modern automotive system
control strategies, especially in engine control systemdevelopment.

Fig. 1 Model-Based Development Process
The effort to set up such a development environment ispresented. For brevity, only the design and rapid
prototyping portion of the process is emphasized in thispaper. The environment is based on the ADX rapid
prototyping controller that includes various functionalboards, and necessary signal conditioning and powerelectronics modules. The ADX rapid prototyping
controller has a dual CPU architecture which enables
highly efficient digital signal processing operations. It
has a modular design and can be configured for a wide
variety of applications by combining multiple
functionalboards.
MathWorks
products—MATLAB®/Simulink®/Stateflow® — are used todevelop control logic in the form of block diagrams.

Real-time interface blocksets for various functionalities
are developed and can be integrated in the model.
Real-Time Workshop® converts the block diagram into
C code, which is then compiled, linked, anddownloaded automatically to the target platform forexecution under a real-time operating system. The
environment uses VirtualConsole for the GUI. Screen
elements can be associated with the parameters andvariables of the model and thus provide an interface forreal-time parameter setting and signal monitoring.
Application of the environment in engine controlfeatures development is presented. Necessaryfunctional boards, including engine timing detection
and control board, analog input board, and PWM board,
are integrated in the system. Signal conditioning for
crank and cam sensors, as well as power electronics
modules, such as low-side drive, high-side drive, andH-bridge, for ignition, injection, and ETC are included.
Control algorithms to realize various fundamental
features necessary for engine operation, such as engine
timing detection, speed calculation and filtering, lookup-tables for basic spark advance and fuel injection
duration, ignition and injection implementation, closedloop A/F ratio control, etc. are developed. To show thefeatures and the great benefits of the environment, thedevelopment of two control functions — A/F ratio
modulation, and electronic throttle control — areselected as examples and their development processes
are described in detail.
The paper is organized into four sections. First, anoverview of the ADX rapid prototyping controller isgiven. The features of the controller, including its
hardware and software configurations, are introduced.
In the second section the integrated environment forengine control development, the function modules andthe overall engine control features are described. The
next section explains in detail the process of algorithm
development for steady state A/F ratio modulation, andETC. Finally a conclusion section summarizes thepaper.

RAPID PROTOTYPINGOVERVIEWCONTROLLER

The ADX rapid prototyping controller is a universal
high-speed measurement and control system. Its
hardware framework is shown in Figure 2. Thecontroller has a dual CPU architecture, using aPentiumM processor for high-speed simulation andcontrol, and a Renesas SH4 processor for running thehuman-machine interface, including color touch-screen
LCD, programmable function keys, and Ethernet

communication with the host PC. A bus controller on
the active back plane handles the data transfer between
the interface boards and the CPUs. This design frees up
the PentiumM CPU and enables execution of highly
efficient digital signal processing operations. The
model cycle of the system can be as high as 20 kHz.
The controller has a modular design. Seven slots areavailable for any combination of dedicated function
boards. Various user selectable general-purpose (A/D,D/A, digital I/O, PWM, thermocouple, serial
communication, etc.) and special function interface
boards (engine timing detection and control, threephase PWM motor control, networking, ECU bypass,etc.) are available. Simulink S-functions to accessboard functions are provided. By combining necessaryfunction boards, the controller can be configured for awide variety of applications, providing very powerfuland flexible solutions for control system design,
prototyping, simulation, and testing.

Fig. 2 Hardware Architecture of the Rapid
Prototyping Controller
Figure 3 shows the software architecture of thecontroller and the specific role of each software
component. Simulink and Stateflow are used todevelop control logic in the form of model block
diagrams. The S-functions for system hardware andfunction boards can be integrated in the block diagram.
Real-Time Workshop converts the Simulink model into
C code, which is then compiled, linked, anddownloaded automatically to the target platform forreal-time execution. VirtualConsole is the GUI
software. It enables arrangement of various screen
elements on the host PC and on the color touch-screen
LCD. These screen elements can be associated with thevariables or parameters of the model, providing users
with an interface for real-time parameter setting andsignal monitoring.

Fig. 4 Engine Control Development Environment

Fig. 3 Specific Roles of the Software Components

ENGINECONTROL
ENVIRONMENTDEVELOPMENTAs shown in Figure 4, the ADX rapid prototyping
controller together with necessary function boards,
signal conditioning and power stage modules form thehardware platform for engine control. For the designand implementation of basic engine control features,
three function boards are integrated in the controller: ageneral purpose A/D input board, an engine timing
detection and control board, and a PWM input andoutput board. The analog input board is used formeasuring such variables as throttle position, manifold
absolute pressure, intake mass air flow rate, intake airtemperature, and engine coolant temperature, etc. For
the environment presented in this paper, the A/D input
board is also used to measure the A/F ratio, which isanalog signal from A/F ratio meter. The engine timing
detection and control board is used for processing thecrankshaft and camshaft input signals, obtaining engine
speed and timing, as well as sending out control
commands for ignition and fuel injection. The PWM
board can be used for solenoid or DC motor control,
for such functions as EGR valve control, variable camphasing, and ETC. Necessary signal conditioning
modules for the engine timing sensors, as well as
power electronics modules with proper functions for
actuator operation, e.g., high-side or low-side drive forignition and injection, H-bridge driver for ETC, arealso integrated in the system.

Real-time crank angle detection and cylinder
identification are critical for engine control. The engine
timing mechanism is specific to customers andplatforms. There are various types of crankshaft andcamshaft signals that are currently used by OEMs andsuppliers. The engine timing detection and control
board of the ADX controller can handle different typesof input signals, e.g., encoder signal, missing toothsignal, chasing tooth signal, etc. The controller can beconfigured to use the specific timing mechanism via
parameter settings of the S-functions. An FPGA is used
for signal processing and the output of control signals
for accurate timing resolution as high as 1 µsec or 0.1°
crank angle.
Engine control algorithms are designed using Simulink
and Stateflow. Based on the hardware platform
described above, control algorithms are developed
using a model-based methodology to realize various
fundamental features necessary for engine operation,such as analog input signal sampling, filtering andconversion, engine timing detection, speed calculationand filtering, look-up-tables for basic spark advanceand fuel injection duration, dwell angle calculation,
spark and fuel adjustment based on temperature,pressure, and battery voltage, ignition and injection
implementation, engine cold start strategy, closed loop
A/F ratio control, A/F ratio modulation etc. Thesebasic control features are used to implement the morecomplex engine operation modes such as idling, steadystate operation, and transient operation. To
demonstrate the control function development processusing the ADX, the algorithm development for A/Fratio modulation and ETC are selected as examples anddescribed in detail in the next section. For brevity, only
the most basic portion of the control algorithms isshown.

A/F RATIO MODULATION AND
ALGORITHMS DEVELOPMENT

ETCwith the control parameters and signals. Through theGUI, the parameters can be adjusted in real time andthe signals monitored simultaneously.

Steady State A/F Ratio Modulation
To reduce engine exhaust emissions, a great manystudies on engine control and catalytic converter
performance have been made. It is well known thatA/F ratio has great effect on catalyst conversion
efficiency. Some research shows that modulating theA/F ratio to make use of the oxygen storage capacity of
the catalyst yields better conversion efficiency than justkeeping the constant stoichiometric value upstream ofthe converter. To study the relationship between forced
A/F ratio modulation and catalyst efficiency, an A/F
ratio control algorithm to realize A/F ratio modulationof various frequencies and amplitudes is needed.
We design the algorithm shown in Figure 5 to realize
steady state A/F ratio modulation. First the real average
A/F ratio is calculated by performing a rolling averagecalculation of the sampled A/F ratio, with the time
window equal to the period of the desired A/F ratio
modulation. Then the base fuel width whichcorresponds to the target average A/F ratio is obtained
through a PI controller based on the deviation between
the targeted and the real average A/F ratio during theengine operation. The A/F ratio modulation is realizedby modulating the base fuel width with a waveform ofproper amplitude and frequency. The control
parameters, such as the target average A/F ratio, Pgain, I gain, and the signals such as the real A/F ratio,
fuel injection width, etc. are designated so as to beaccessed in the VirtualConsole GUI.
We set the control loop timing to be 10 msec. After thealgorithm is designed, it is compiled, downloaded andrun on the ADX hardware. A GUI window is designed
using VirtualConsole. The screen elements, such as
numerical input boxes, oscilloscope, etc. are associatedFigure 6 shows the results of applying the algorithm on
a 4.6 liter V8 engine. The goal is to achieve
stoichiometry as the target average A/F ratio, andrealize 1 Hz modulation of 5% perturbation amplitude.
The left and right banks of the engine are controlledindividually and both lambda values are shown. We
see the designed algorithm gives excellent control
performance and realizes very precise A/F ratio
modulation as desired.

Fig. 6 VirtualConsole GUI for Steady State A/F
Ratio Modulation
Electronic Throttle Control
Electronic throttle control system is more and moreused and becoming a standard part of the engine. It
controls the amount of air intake into the cylinders by
precisely positioning the throttle valve at the desired
position. An ETC system provides the possibility of
improving the overall engine and vehicle performance
because with such a mechanism, the engine controller
can decide and set the throttle position not only basedon driver intention (the acceleration pedal behavior),
but also taking into consideration the specific engine

Signals

Parameters

Fig. 5 Algorithm to Realize A/F Ratio Modulation

operation mode information, such as safety factors,
emission limitation constraints, etc. After the throttle
position target is determined, the requirement for theETC system is that the throttle should achieve thecommanded position as accurately and as quickly as
possible. Some usually adopted specifications for ETC
include, e.g., step response settling time of less than
100 msec, and steady state tracking error of less than2%. Comprehensive control of a throttle body needs
algorithms that take care of such nonlinear effects asfriction, backlash, and return spring nonlinearity. For
simplicity, we only focus on the linear operation modein this paper.
As shown in Figure 7, the electronic throttle bodyconsists of a DC motor, gearbox, throttle plate, return
spring for failsafe, and throttle position sensors(usually two of them). The rapid prototyping controller
samples the acceleration pedal sensor input, andtogether with other information of the engine, it
determines the required throttle opening. Then basedon the throttle position target and the measured real
throttle position, the controller determines the PWM
signal parameters and sends out the signals to control
the operation of the motor, and consequently thethrottle plate. By using an H-bridge driver, the motor
and the throttle plate can rotate in both directions.

Fig. 7 ETC Hardware

A two degree-of-freedom PID controller is adopted forthe throttle control. As shown in Figure 8, theproportional and integral controls are on the setpointerror and the derivative control is on the processvariable. The control voltage value of the motor is
calculated using the PID control gains, which is thenturned into PWM signal duty cycle for motor control.
A saturation block is used in the model to take care of
the upper and lower limits of the duty cycle. The
signals of interest and the control parameters that needbe tuned are labeled and can be accessed when thealgorithm is implemented on the hardware target.
We set the control loop timing to be 1 msec. Figure 9shows the throttle response to a 50 degree stepcommand. The trace of the control variable, i.e. theduty cycle, is also shown. Since the control gains canbe adjusted in real time and the system behavior
monitored simultaneously, the environment provides avery convenient and efficient way for control algorithm
tuning to fulfill such specifications as settling time,overshoot, etc.

Fig. 9 VirtualConsole GUI for ETC

Parameters

SignalsFig. 8 Two Degree-of-Freedom ETC Algorithm

CONCLUSIONCONTACTTo rapidly develop, test and calibrate the vehicle
subsystems, model-based development methodology
has been widely adopted, especially for engine control.
In this paper, a model-based development environment
based on the ADX rapid prototyping controller isestablished. Its application in engine control functions
development is presented. The development process of
two control functions — A/F ratio modulation andelectronic throttle control — are described in detail toshow the features of the system. These examples
clearly demonstrate the great benefits of thedevelopment environment and the rapid control
prototyping methodology.

Dr. Shugang Jiang
Technical Specialist
A&D Technology Inc.
4622 Runway Blvd., Ann Arbor, MI 48108 USAEmail: sjiang@aanddtech.com

REFERENCES
1. Jooyoung Ma, Jeamyoung Youn and Minsuk Shin,et al., “A Design Approach using Seamless
Development Environments, SILs/RCP, for RealTime Control Systems,” SAE 2006-01-0310.
2. Andrew Beaumont, Joe Lemieux and Paul
Battiston, et al., “Design of a Rapid Prototyping
Engine Management System for Development ofCombustion Feedback Control Technology,” SAE
2006-01-0611.
3. Tom Erkkinen and Koos Zwaanenburg, “ASeamless Implementation of Model-Based Design
Applied to a New Fuel Control Feature for an
Existing Engine ECU,” SAE 2006-01-0612.
4. Seungbum Park, Hakmo Yoo and Youngbug Park,et al., “Model-based Development of Engine
Control System from Concept to Vehicle,” SAE
2006-01-0856.
5. Jeffrey D. Naber, Eric K. Bradley and John E.
Szpytman, “Target Based Rapid Prototyping
Control System for Engine Research,” SAE 200601-0860.
6. Michael
BeineandRainer
Otterbach,“Development of Safety-Critical Software Using
Automatic Code generation,” SAE 2004-01-0708.
7. Paul Cook, Peter James and Mark Willows, “RapidPrototyping of Generic Hybrid Concept Vehicles,”SAE 2002-01-0755.
8. Joseph J. Lemieux, “Foundation for Rapid
Embedded Development,” SAE 2001-01-0022.
9. Shugang Jiang, Dharshan Medonza, et al., “Designand Implementation of an Integrated Development
Environment Consisting of Engine Rapid Control
Prototyping and Real Time Vehicle Simulation,”
SAE 2007-01-0515.
MATLAB/Simulink/Stateflow and Real-Time Workshop
are registered trade marks of the MathWorks, Inc.