Using LabVIEW for Data Acquisition and Control of a Dual Fuel Engine

Priybrat Sharma, Indian Institute of Technology Mandi, MS Student

"NI products helped us develop an in-house reliable, robust, inexpensive, and versatile engine control and data acquisition system in just two months."

- Priybrat Sharma, Indian Institute of Technology Mandi, MS Student

The Challenge:

The Renewable Fuel and Internal Combustion Engine Lab at the Indian Institute of Technology (IIT) Mandi aimed to develop a system for fast, reliable, and precise control of a converted dual fuel compression ignition (CI) engine. The system should monitor the crank angle of the engine continually, control the fuel injection timings, and track and collect the in-cylinder pressure, fuel line pressure, accelerometer, and microphone data.

The Solution:

The lab used the versatile capabilities of FPGA, a real-time OS, and the support of NI forums to create an accurate, robust, and expandable solution for the problem. The solution developed provides real-time control, monitoring, and analysis of the dual fuel engine with advanced data logging in technical data management streaming (TDMS) format.


Dr. Atul Dhar - Indian Institute of Technology Mandi, Assistant Professor
Priybrat Sharma - Indian Institute of Technology Mandi



The Renewable Fuel and Internal Combustion Engine Lab at the Indian Institute of Technology (IIT) Mandi started in 2016 with a goal to test alternative fuels and develop advanced engine system and combustion technologies. NI products helped us develop an in-house reliable, robust, inexpensive, and versatile engine control and data acquisition system in just two months.


Current internal combustion engine research around the globe focuses on engine performance improvement and emission reduction. Dual fuel engines address both of these concerns, but they require an accurate engine control system to operate safely. Our first assignment was to develop a hydrogen diesel dual fuel research engine setup, which increased our safety concerns further. Additionally, measurement instrumentation of such engines for research purposes is a challenge due to the number and type of sensors, and also the controlled devices like injectors involved. This is where CompactRIO with its C Series modules offered versatility because we could perform data acquisition and control from a single platform.



System Setup

The system we developed uses FPGA to acquire data from an optical encoder, in-cylinder pressure sensor, fuel line pressure sensor, ¼ in. microphone, and single-axis accelerometers. This data is analysed in real time, and we can use the results to control the fuel injection timing and duration with the FPGA. We performed all the engine block and head modification work for sensor mounting, wiring harness, and fuel injection system in-house. We used LabVIEW 2015 to write all the code for both the FPGA and real-time system and used Powertrain Control Device Driver VIs.


Figure 1 shows the schematic of the developed system. The FPGA of the CompactRIO interacts with these three C Series modules:

  • NI-9401—8 channel, 100 ns bi-directional, 5V/TTL I/O module connects to the encoder. It reads the digital position signal from the encoder and triggers the other sensors’ data acquisition.
  • NI-9234—4 channel C Series dynamic signal acquisition module connects to in-cylinder pressure and fuel line pressure transducers. It is set to acquire data at 51.2 kHz in synchronisation with encoder pulse.
  • NI-9758—Port fuel injector driver module drives four low- or high-impedance PFI and four low-side solenoids. It receives power from a 12 VDC external power supply. It provides a current of 8 A peak and 2 A hold using two drivers, FPGA is coded to synchronise two PFI drivers’ ports to achieve this.



The FPGA acquires data from the transducers and encoder connected to C Series modules. Additionally, we compensated for the lack of cam angle sensor by running an AND operation on the encoder’s indexing pulse and cylinder pressure data at the FPGA level. The 40 MHz processing speed of the FPGA helps us achieve coupled masking of the index pulse every other revolution. We then transfer the data to the real-time OS using first-in-first-out (FIFO). A receiver loop receives the FIFO data and creates a data stream. The data stream then moves the data to a conditioning loop, which de-noises and filters the data. Then it transfers the data to a storage (RAW) and processing loop.


The real-time processing loop runs necessary calculations for cylinder volume, pressure rise rate, heat release rate, start and end of combustion, mean effective pressure, and cycle-to-cycle variation in the background. We display this data on a web user interface and simultaneously record it in a flash memory (pen drive) connected to the CompactRIO system as a TDMS file. Figure 2 shows the components of the web-based user interface.



We chose NI hardware and software for our in-house development because it delivers greater programming-level control and hardware flexibility. Other similar integrated control and DAQ solutions from commercial engine research support companies can cost at least twice as much and still provide lower flexibility and compatibility. Also, the rich content with similar applications available on NI forums served as a great starting point. 


Figure 3 shows the engine to which we connected the system. We can rapidly modify the system to work with different CI engines operating in dual fuel mode. On a programming level, the real-time OS code with all the data processing running consumes only 20 percent of the CPU and 30 percent of RAM on average. In the future, we can leverage the remaining computational power to work on more advanced engine control algorithms later.













Thanks to CompactRIO hardware and LabVIEW software, the system we developed helped us reliably and safely test the engine under methane and hydrogen secondary fuel operation. We plan to use the optimisation algorithm for controlled injection timing and duration followed by upgrading the system to a dual-cylinder CI engine after installing more C Series modules.


Author Information:

Priybrat Sharma
Find this author in the NI Developer Community

Figure 1: Schematic of the Developed Engine Control and Data Acquisition System
Figure 2. (a) Tabbed Controls for Engine Position Tracking (EPT), PFI, System Health and RT-FPGA Interaction; (b) Live Data From the Transducers and Encoder; (c) Averaged Data of 100 Cycles for Pressure Crank Angle, Pressure Volume
Figure 3. Overview of the Test Facility