Drivving the FPGA

If you add a Field Programmable Gate Array to a data acquisition and control system and then allow it to be programmed by an end user, the results can be rather racy.

Field programmable gate arrays (FPGAs) have been widely used in the past by designers of control and acquisition systems. But traditionally their role has been defined at the design stage and remains fixed during the lifetime of the product.

Clearly, however, allowing a user to define the function of such FPGA hardware in such a system would provide a real benefit – namely that the system could then be specifically tailored to the requirements of the application.

That was the thought process that led engineers at National Instruments to develop their new CompactRIO platform – a small rugged industrial control and acquisition system that incorporates FPGA based I/O.

The CompactRIO embedded system itself features the usual real-time embedded processor, but in addition contains a 4 or 8-slot ‘reconfigurable chassis’ containing the user-programmable FPGA and hot-swappable industrial I/O modules that sport built-in signal conditioning for direct connection to sensors and actuators. The FPGA chip itself is connected to the I/O modules in a star topology, while a local PCI bus provides an interface between the FPGA and the real-time processor.

In use, the FPGA can be defined by the user to provide a custom hardware implementation of control or acquisition circuitry. And what’s more, software applications can be developed using the LabView graphical programming tools – alleviating the need for the user to program in specialised hardware design languages.

The CompactRIO system has already proven a hit with the system designers at Drivven, a US-based automotive control and data acquisition systems development house.

They used the CompactRIO system to prototype an engine control system for a Yamaha YZF-R6 motorcycle to demonstrate their ability to develop a turnkey development platform that would give their customers in research and development the ability to rapidly prototype engine control systems.

Drivven itself specialises in developing FPGA-based algorithms or ‘IP cores’ for engine applications. And it recognised that if it could implement those cores in an FPGA-based CompactRIO system, it would be possible to design powertrain control systems that could be quickly modified. In addition, it was evident that the same FPGA cores used on a research platform could also be used, without any modification, in production controllers.

Engine control itself requires deterministic loop times on the order ofmilliseconds 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 rotation of the crankshaft, and the system must precisely control fuel and spark events in the angle domain to less than 1 degree.

By customising the National Instruments FPGA-based Compact RIO using its own engine control IP cores, the developers were able to meet the precise timing resources that were required, as well as provide a system that was rugged enough to withstand the high temperatures and high vibration of the operating environment.

“With CompactRIO, we ran deterministic loops on the order of milliseconds and performed FPGA-based fuel and spark timing on the order of microseconds. In addition, we could easily add sensors and actuators, or otherwise modify our system, with minimal time investment,” said Carroll G. Dase, Drivven’s President.

Demonstrating the effectiveness of the Drivven platform was a three stage process. First off, the Drivven engineers chose a four-slot NI CompactRIO embedded system with which they could add sensors and actuators as well as mount in the limited space available in the motorcycle. Then they created three custom CompactRIO I/O modules to monitor all of the motorcycle sensors and control its actuators.

Second, that’s just what they did. They monitored all the signals from the motorcycle sensors and actuators including intake air pressure, barometric air pressure, intake air temperature, coolant temperature, throttle position, crank position, cam position, fuel injector solenoid and ignition coil.

Drivven’s engine management software IP cores, represented in Labview as Virtual Instruments (VIs), and hardwired into the CompactRIO FPGA-based system for performance reasons, were used to track the position of the crankshaft (0.3 degree resolution) and capture the angle-based timing of the fuel injector and spark events. The fuel injection pulse-width was also captured.

This information was recorded while the bike was put through its paces at many different combinations of throttle position and engine speed (about 700 operating points) to fully map the behaviour of the existing factory ECU on the bike. An engineer in a chase vehicle was then able to wirelessly ftp the data files from the CompactRIO system to a laptop and analyse it immediately for coverage of all operating points.

A LabVIEW application then sorted the data into speed/load operating tables and displayed the data. In two hours, the team acquired data for 90% of the motorcycle operating points, which was ample coverage for fully understanding the mapping of the factory ECU. Later, engineers processed the data with the LabVIEW software, which provided 3D and 2D data visualisation while graphically modifying the raw data to fill in the missing operating points.

Lastly, Drivven used CompactRIO to prototype a research-oriented ECU, achieving performance comparable to the factory ECU.

To do so, the engineers used the post processed data and applied it to Drivven’s speed-density and alpha-n engine control strategies to successfully control the engine, matching the functionality of the factory ECU very closely.

A speed-density engine control method monitors the intake air pressure and temperature to calculate the theoretical mass (density) of air which 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.

This behaviour can be characterized by a one-dimensional lookup table of Volumetric Efficiency (Ve) values versus engine speed. Then a fuel injection mass can be calculated based on the fuel’s stoichiometry (for gasoline, about 14.7 parts air to 1 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 since 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 due to the fact that intake air pressure will not have enough variability over the entire throttle/load range in order to effectively use a speed-density method. When mechanical modifications are made to these engines, many or all of the operating points must be recalibrated.

Drivven 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 noting Yamaha’s use of sensors on the production motorcycle, Drivven determined that the factory ECU was likely implementing a similar strategy.

Once again, Drivven’s configurable FPGA-based engine management cores were used for tracking the position of the crankshaft while generating precisely timed fuel and spark pulses in the angle/time domain.

The FPGA-based engine management IP cores allowed Drivven to complete the entire project with two engineers in under three months.

“Using our existing powertrain control and LabVIEW expertise, we prototyped an engine control system with National Instruments CompactRIO that controls a high-performance motorcycle engine in just three man months. In past projects, it took us at least two man years to develop similar ECU systems with custom designed hardware,” added Dase.

Want to know more? Well if you’ve got a broadband connection, why not watch Mr. Dase explain the technology behind the bike by clicking <link>here=mms://trog.ni.com/ni/niweek/2004/day1/demo6_fast.wmv</link>.

Or, if you only have a slow connection, you can also see the video <link>here=mms://trog.ni.com/ni/niweek/2004/day1/demo6_slow.wmv</link>.