Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Customer Solutions

Drivven Prototypes FPGA-Based Engine Control System Using NI CompactRIO

Author(s):

Carroll G. Dase, Drivven, Inc.

Industry:

Automotive

Product:

CompactRIO, Data Acquisition, LabVIEW, LabVIEW FPGA, LabVIEW Real-Time

The Challenge:

Building a full-authority, FPGA-based engine control system for a high-performance motorcycle engine.

The Solution:

Using National Instruments CompactRIO and LabVIEW environment to focus directly on engine control software and I/O board development


image
2004 Yamaha YZF-R6 Motorcycle in Final Form

Building a Reliable, High-Performance System
At Drivven, an automotive control and data acquisition solutions provider, we needed reliable, high-performance hardware to prototype an engine control system for a 2004 Yamaha YZF-R6 motorcycle. Engine control requires deterministic loop times on the order of milliseconds and precise fuel and spark timing on the order of microseconds. In addition, the target engine revs to 15,500 RPM. At this speed, there is less than 4 ms per crankshaft rotation, and the system must precisely control fuel and spark events in the angle domain to less than 1 degree.

We specialize in automotive intellectual property (IP) for FPGAs. Our large library of IP includes cores for tracking the angular position of crankshafts from a variety of position sensing formats and generating precise angle-based fuel and spark commands. We aim to provide a seamless path from prototype to production for FPGA-based power train controllers. Because this path includes early stages of prototyping, where flexibility and computing power are paramount, we often choose PC-based hardware. For this project, we chose a four-slot NI CompactRIO embedded system because of its flexibility, small size, and rugged form factor. With this system, we could easily add sensors and actuators while quickly and easily visualizing the data. In addition, we could mount the controller in the extremely limited space available in a super-sport motorcycle. The project consisted of three major phases.

Phase 1: Custom I/O Module Development
We created three custom CompactRIO I/O modules. The first module provided 22 single-ended, 12-bit analog inputs, two variable reluctance (VR) sensor inputs, and two hall-effect sensor inputs. We named it the A/D Combo Module. This module implemented low-pass analog filters as well as over/under voltage protection on all inputs. The second module provided four channels for driving low-impedance port-fuel injectors and four low-side, inductive-load switches for driving general purpose solenoids. Each channel could be diagnosed for open or short circuits and disabled appropriately without CPU intervention. The third module provided eight low-side inductive-style drivers for ignition coils. We designed each module with cost sensitive circuitry for the purpose of prototyping for a production-oriented control system. As a result, developers can realize the same I/O behavior in both prototyping and production stages. These three modules monitored all of the motorcycle sensors and controlled its actuators. We are currently developing additional CompactRIO modules for power train control applications, including modules for driving electronic throttle bodies and interfacing with universal exhaust gas oxygen sensors.

Phase 2: Mapping the Factory ECU
In this phase, we carefully tapped into critical motorcycle sensors and actuators using CompactRIO, and logged their signals and events at 200 Hz to the CompactRIO flash file system. The signals and events included intake air pressure and temperature, barometric air pressure, coolant temperature, throttle position, crank position, cam position, fuel injection start angle and pulse width, and spark advance. Our FPGA-based engine management VIs were used to track the position of the crankshaft (0.3 degree resolution) and capture the angle-based timing of the fuel injection and spark events. We performed a low-budget mapping exercise with a rider on a long, straight road with little or no traffic, so it was not necessary to remove the engine from the motorcycle and install it on a dynamometer.

We recorded the ECU data to 1 Mb files (up to 20 files at 1 file per minute) while riding the bike at many different combinations of throttle position and engine speed (nearly 700 operating points) to fully map the behavior of the factory ECU. The rider carefully drove the motorcycle in a manner to reduce transient operation as much as possible. Periodically, an engineer in a chase vehicle would wirelessly FTP the data files from the CompactRIO to a laptop and analyze them immediately for coverage of operating points. A laptop-based NI LabVIEW application quickly sorted the data into speed/load operating tables while filtering out transient data. A mean and standard deviation was calculated from the data for each operating point. In two hours, the team acquired data for 90 percent of the motorcycle’s operating points, which was ample coverage for fully understanding the mapping of the factory ECU. Later, in the lab, engineers processed the data with LabVIEW again, which provided 3-D and 2-D visualization while graphically modifying the raw data to fill in the missing operating points.

Phase 3: Engine Control
In the final phase, we used CompactRIO to prototype a research-oriented ECU, achieving performance comparable to the factory ECU, yet providing the ability to carry out future control algorithm research and development, which is not possible with production-oriented electronics. With CompactRIO, we implemented several of our engine management FPGA cores, which all have configurable LabVIEW FPGA icons placed on the block diagram. We can port these same cores directly to production FPGA-based controllers. Using LabVIEW Real-Time, we implemented a combination of speed-density and alpha-N engine control strategies commonly found in high-performance race applications.

A speed-density engine control method monitors the intake air pressure and temperature to calculate the theoretical mass (density) of air that enters the combustion chamber on each cylinder’s cycle. The speed of the engine, however, will affect the actual mass of air which enters the chamber due to various restrictions and tuning effects of the air intake and exhaust tracks. Users can characterize this behavior by a one-dimensional lookup table of Volumetric Efficiency (Ve) values versus engine speed. Then users can calculate a fuel injection mass based on the fuel’s stoichiometry (for gasoline, about 14.7 parts air to one part fuel). Many passenger car engine controllers use speed-density for open-loop control until emissions subsystems are operational for closed-loop control. The advantage of speed density is that when making a modification to the intake or exhaust systems, only the Ve table must be modified to account for the changes in volumetric efficiency.

An alpha-n engine control method is simpler because it looks up the empirical mass of air for each throttle angle (alpha) and engine speed (N) operating point, which results in a two-dimensional look-up table of several hundred points. Many high performance and race engine controllers must rely on this method because the intake air pressure will not have enough variability over the entire throttle/load range in order to effectively use a speed-density method. When users make mechanical modifications to these engines, many or all of the operating points must be recalibrated.

We used a combination of these control strategies by applying speed density to low-speed and low-load operating points where intake air pressure had the most variability. An alpha-N method was applied to the rest of the operating map. After we noted Yamaha’s use of sensors on the production motorcycle, we determined that the factory ECU was likely implementing a similar strategy. We used the data acquired in the mapping phase to calibrate these control strategies. Experienced riders could not identify significant differences between the factory ECU control and the prototype control. Most importantly, we achieved this level of control without dynamometer time. We successfully achieved our goal of prototyping a motorcycle ECU on time and on budget.

Saving Time and Money with CompactRIO and LabVIEW
In past projects, we spent at least two man years and $500,000 to develop similar ECU prototyping systems from custom designed hardware. For this project, the equipment costs, including the motorcycle and CompactRIO, were $15,000. In addition, we spent about three man months on this project. CompactRIO and LabVIEW Real-Time delivered the reliability and precise timing resources required, and the system was rugged enough to withstand the high temperatures and high vibration of the operating environment.

Click here to view the NIWeek 2004 keynote presented by Drivven.

Click here to request the Wiring Your Design into LabVIEW Resource CD

Click here to visit the Graphical Systems Design page

For more information, contact:


Carroll G. Dase
President
Drivven, Inc.
14027 N. Hills Village Dr.
San Antonio, TX 78249
Tel: (210) 269-4667
Fax: (661) 761-6542