Home Learning Paths ECU Lab Assessments Interview Preparation Arena Pricing Log In Sign Up

Capstone Project: EPS (Electric Power Steering) HIL Validation

AttributeValue
ECU under testElectric Power Steering ECU (ASIL-D torque control path)
Plant modelBicycle vehicle dynamics + EPS motor model (PMSM) + steering column torsion bar
HIL platformdSPACE SCALEXIO (Processing Unit + DS2655M FPGA + DS4340 CAN FD)
BusCAN FD 5 Mbit/s: EPS + BCM (simulated) + Cluster (simulated)
Test scopeFunctional: steering assist; Safety: fault detection + safe state; Performance: response time
DeliverablesPlant model Simulink (.slx), pytest HIL test suite, Jenkins Jenkinsfile, test report HTML

Exercise 1: EPS Plant Model

Pythoneps_plant_model.py
#!/usr/bin/env python3
# EPS plant model: vehicle + steering column + PMSM
# Integrates bicycle model with EPS assist torque

import numpy as np

class EPSPlantModel:
    def __init__(self):
        # Steering column parameters
        self.K_torsion = 15000   # torsion bar stiffness (Nm/rad)
        self.J_column  = 0.02    # column inertia (kg.m2)
        self.B_column  = 5.0     # column damping (Nms/rad)

        # Vehicle (bicycle model)
        self.m  = 1500; self.Iz = 2500
        self.lf = 1.2;  self.lr = 1.4
        self.Cf = 60000; self.Cr = 50000
        self.Vx = 0.0

        # States
        self.theta_sw   = 0.0   # steering wheel angle (rad)
        self.dtheta_sw  = 0.0   # steering wheel velocity (rad/s)
        self.theta_col  = 0.0   # column/rack angle (rad)
        self.vy = 0.0; self.r = 0.0

    def step(self, T_driver_Nm, T_assist_Nm, Vx, dt):
        """
        T_driver_Nm: driver hand torque input (Nm)
        T_assist_Nm: EPS ECU assist torque output (Nm) -- from HIL I/O
        Vx: longitudinal speed (m/s)
        """
        self.Vx = Vx

        # Torsion bar torque
        T_torsion = self.K_torsion * (self.theta_sw - self.theta_col)

        # Steering wheel dynamics
        d2theta_sw = (T_driver_Nm - T_torsion - self.B_column*self.dtheta_sw)
        d2theta_sw /= self.J_column
        self.dtheta_sw += d2theta_sw * dt
        self.theta_sw  += self.dtheta_sw * dt

        # Column dynamics (with assist)
        T_rack = T_torsion + T_assist_Nm
        delta_f = self.theta_col / 15.0   # steering ratio 15:1

        # Vehicle lateral dynamics (bicycle model)
        alpha_f = delta_f - (self.vy + 1.2*self.r) / max(Vx, 0.1)
        alpha_r =          -(self.vy - 1.4*self.r) / max(Vx, 0.1)
        Fy_f = self.Cf * alpha_f
        Fy_r = self.Cr * alpha_r
        self.vy += ((Fy_f + Fy_r)/self.m - Vx*self.r) * dt
        self.r  += (1.2*Fy_f - 1.4*Fy_r)/self.Iz * dt

        return {
            "torque_sensor_Nm":  T_torsion,
            "steering_angle_deg":np.degrees(self.theta_sw),
            "yaw_rate_degps":    np.degrees(self.r),
        }

Exercise 2: EPS HIL Test Suite

Pythontest_eps_hil.py
#!/usr/bin/env python3
# EPS HIL validation test suite
# pytest test_eps_hil.py -v --html=eps_validation_report.html

import pytest, time

@pytest.mark.req("TSR-EPS-001")
@pytest.mark.asil("ASIL-D")
def test_eps_assist_nominal(hil):
    """EPS shall provide assist torque proportional to driver torque at 50 km/h"""
    hil.set("Plant/Speed_kph",          50.0)
    hil.set("Plant/Driver/Torque_Nm",    5.0)
    hil.wait(0.5)
    assist = hil.get("ECU.EPS.AssistTorque_Nm")
    assert 10.0 <= assist <= 25.0, f"Assist {assist:.1f} Nm out of range"

@pytest.mark.req("TSR-EPS-015")
@pytest.mark.asil("ASIL-D")
def test_eps_safe_state_on_torque_sensor_fault(hil):
    """EPS shall remove assist within FTTI=200ms of torque sensor fault"""
    hil.set("Plant/Speed_kph",          80.0)
    hil.set("Plant/Driver/Torque_Nm",    5.0)
    hil.wait(1.0)

    t0 = time.time()
    hil.inject_fault("TorqueSensor_ChA", "SHORT_GND")

    safe = False
    while (time.time()-t0)*1000 < 250:
        if abs(hil.get("ECU.EPS.AssistTorque_Nm")) < 0.5:
            t_ms = (time.time()-t0)*1000
            print(f"  Safe state at {t_ms:.1f} ms")
            safe = True; break
        time.sleep(0.005)

    assert safe, "Safe state not reached"
    assert t_ms <= 200, f"FTTI exceeded: {t_ms:.1f} ms > 200 ms"

Summary

The complete EPS HIL validation project brings together all course elements: a physics-based plant model (EPS dynamics + bicycle model) running on SCALEXIO at 1 kHz, a structured pytest test suite covering nominal function and ASIL-D safety requirements, fault injection tests that measure FTTI in milliseconds, and a Jenkins CI pipeline that runs the full suite on every ECU software build. This is the workflow used in production automotive development: every SW change triggers an automated HIL regression run that produces a dated, versioned test report linked to the requirements traceability matrix, providing the continuous safety evidence that ISO 26262 and ASPICE require throughout the development lifecycle.

🔬 Deep Dive — Core Concepts Expanded

This section builds on the foundational concepts covered above with additional technical depth, edge cases, and configuration nuances that separate competent engineers from experts. When working on production ECU projects, the details covered here are the ones most commonly responsible for integration delays and late-phase defects.

Key principles to reinforce:

  • Configuration over coding: In AUTOSAR and automotive middleware environments, correctness is largely determined by ARXML configuration, not application code. A correctly implemented algorithm can produce wrong results due to a single misconfigured parameter.
  • Traceability as a first-class concern: Every configuration decision should be traceable to a requirement, safety goal, or architecture decision. Undocumented configuration choices are a common source of regression defects when ECUs are updated.
  • Cross-module dependencies: In tightly integrated automotive software stacks, changing one module's configuration often requires corresponding updates in dependent modules. Always perform a dependency impact analysis before submitting configuration changes.

🏭 How This Topic Appears in Production Projects

  • Project integration phase: The concepts covered in this lesson are most commonly encountered during ECU integration testing — when multiple software components from different teams are combined for the first time. Issues that were invisible in unit tests frequently surface at this stage.
  • Supplier/OEM interface: This is a topic that frequently appears in technical discussions between Tier-1 ECU suppliers and OEM system integrators. Engineers who can speak fluently about these details earn credibility and are often brought into critical design review meetings.
  • Automotive tool ecosystem: Vector CANoe/CANalyzer, dSPACE tools, and ETAS INCA are the standard tools used to validate and measure the correct behaviour of the systems described in this lesson. Familiarity with these tools alongside the conceptual knowledge dramatically accelerates debugging in real projects.

⚠️ Common Mistakes and How to Avoid Them

  1. Assuming default configuration is correct: Automotive software tools ship with default configurations that are designed to compile and link, not to meet project-specific requirements. Every configuration parameter needs to be consciously set. 'It compiled' is not the same as 'it is correctly configured'.
  2. Skipping documentation of configuration rationale: In a 3-year ECU project with team turnover, undocumented configuration choices become tribal knowledge that disappears when engineers leave. Document why a parameter is set to a specific value, not just what it is set to.
  3. Testing only the happy path: Automotive ECUs must behave correctly under fault conditions, voltage variations, and communication errors. Always test the error handling paths as rigorously as the nominal operation. Many production escapes originate in untested error branches.
  4. Version mismatches between teams: In a multi-team project, the BSW team, SWC team, and system integration team may use different versions of the same ARXML file. Version management of all ARXML files in a shared repository is mandatory, not optional.

📊 Industry Note

Engineers who master both the theoretical concepts and the practical toolchain skills covered in this course are among the most sought-after professionals in the automotive software industry. The combination of AUTOSAR standards knowledge, safety engineering understanding, and hands-on configuration experience commands premium salaries at OEMs and Tier-1 suppliers globally.

← PreviousHIL Lab Management Best Practices