Engine Control

The engine control unit (ECU) runs the engine. Learn sensors and actuators, air-mass estimation (MAF and speed-density), fuel calculation and closed-loop λ control, spark timing and knock control, idle and torque-based control, calibration maps, and real-time software.

Hundreds of times per second, the ECU reads sensors (crank position, airflow, pressure, temperature, oxygen, knock), computes how much fuel to inject and when to spark, and adjusts throttle, cam phasers, turbo wastegate and EGR.

Engine control is where mechanical engineering meets embedded software and control theory.

An analogy

The ECU is the engine's brain: sensors are its senses, injectors and coils are its muscles, and calibration maps are its learned experience.

Sensors and actuators

Sensors: crank (60-2 tooth wheel) and cam position, MAF/MAP, throttle position, pedal position, coolant/air temperature, oxygen (λ) sensors, knock sensors, rail pressure. Actuators: injectors, ignition coils, electronic throttle, VVT phasers, wastegate, EGR valve, fuel pump.

Air, fuel and spark

Air mass per cylinder comes from a MAF sensor or speed-density (MAP, IAT, VE map). Fuel is scheduled for the target λ; upstream λ sensors trim it in closed loop. Spark advance tables target MBT, limited by knock; knock sensors retard timing on detection and slowly advance it back.

Torque-based control

Modern ECUs convert driver pedal into a torque request, arbitrate requests from cruise control, traction control, gearbox and limiters, then achieve it via throttle (slow path) and spark (fast path). Idle speed is closed-loop controlled.

Calibration, OBD and software

Thousands of maps and parameters are calibrated on dynamometers and vehicles (INCA, CANape via XCP). OBD monitors misfire, catalyst, sensors and EVAP. Software follows AUTOSAR, runs on multi-core MCUs with angle-synchronous tasks, and must meet ISO 26262 for torque safety (e.g. E-Gas monitoring concept).

Formulas

Worked example: Air per cylinder (speed-density)

Given: MAP 100 kPa, IAT 300 K, V_cyl 0.5 L, VE 0.9

Find: Air and fuel mass per cylinder at λ = 1.

Answer: ≈ 523 mg air, ≈ 36 mg fuel

Worked example: Engine speed from tooth period

Given: 60-2 crank wheel; Tooth period 0.2 ms

Find: Engine speed.

Answer: 5000 rpm

Speed-density fuel calculation (C, simplified)

#include <stdint.h>

#define R_AIR      287.0f      /* J/(kg·K) */
#define AFR_STOICH 14.7f
#define V_CYL      0.0005f     /* m^3 (2.0 L / 4) */
#define INJ_FLOW   15.0e-6f    /* kg/ms static flow */

extern float ve_table_lookup(float rpm, float map_kpa);  /* calibration map */
extern float dead_time_ms(float vbatt);

float fuel_pulse_ms(float rpm, float map_kpa, float iat_k,
                    float lambda_target, float stft, float ltft, float vbatt)
{
    float ve    = ve_table_lookup(rpm, map_kpa);
    float m_air = ve * (map_kpa * 1000.0f * V_CYL) / (R_AIR * iat_k);   /* kg */
    float m_f   = m_air / (lambda_target * AFR_STOICH);
    m_f        *= (1.0f + stft + ltft);                                  /* closed-loop trims */
    return m_f / INJ_FLOW + dead_time_ms(vbatt);
}

Real ECUs add transient (wall-wetting) compensation, cold-start enrichment, and run this per cylinder event synchronised to the crank wheel.

Common mistakes

Applications

Key takeaways

Going further