Skip to content

Injection Scenario Walkthrough

This tutorial demonstrates how to use TrueFidelity's signal injection capabilities to test ECU responses and validate system behavior. You'll learn how to inject CAN signals into a running EV powertrain system, monitor motor and battery controller reactions, and document test results. Signal injection is a powerful technique for validating control logic, testing edge cases, and reproducing field issues in a controlled environment.

Time Estimate

  • System Setup: 10-15 minutes
  • Injection Configuration: 10-15 minutes
  • Test Execution: 15-20 minutes
  • Analysis and Documentation: 10-15 minutes
  • Total Time: 45-65 minutes

Prerequisites

Before starting this tutorial, ensure you have:

  • TrueFidelity Desktop application running
  • Docker Desktop running
  • A configured Drive Cycle system with CAN network (or complete the System Design Workflow tutorial first)
  • The Drive Cycle DBC file with signal definitions
  • Basic understanding of CAN signals and EV powertrain systems
  • Sample BLF file for reference data (optional)

Safety Warning

⚠️ CRITICAL SAFETY INFORMATION ⚠️

Signal injection can affect ECU behavior and system operation. Follow these safety guidelines:

  • Never inject signals into production vehicles or safety-critical systems
  • Only use injection on test benches or isolated systems
  • Ensure emergency stop procedures are in place
  • Verify ECU configurations allow test inputs
  • Monitor system behavior continuously during injection
  • Have a recovery plan if systems behave unexpectedly

Learning Objectives

By completing this tutorial, you will:

  • Understand signal injection concepts and capabilities
  • Learn to use the Signal Player & Injection panel
  • Configure and execute injection tests
  • Monitor ECU responses to injected signals
  • Analyze system behavior under test conditions
  • Document test procedures and results
  • Troubleshoot common injection issues

Scenario Overview

You're tasked with validating the Motor Control Unit's (MCU) response to pedal inputs from the Vehicle Control Unit (VCU). The test engineers report:

  • Torque response feels inconsistent at certain pedal positions
  • Regenerative braking activation seems delayed
  • Motor temperature protection may not engage correctly

Your objectives are:

  1. Create or load the Drive Cycle test system
  2. Inject controlled pedal position signals
  3. Verify the MCU's torque delivery response
  4. Test regenerative braking activation
  5. Document the validation results

This scenario represents a typical hardware-in-the-loop (HIL) testing workflow used in EV powertrain development.

Part 1: System Preparation

Step 1: Load the Test System

Use the Drive Cycle system for injection testing.

  1. Launch TrueFidelity Desktop:
  2. Start in System Design mode
  3. If you have an existing system, save any changes

  4. Open the Drive Cycle system:

  5. Click File → Open
  6. Navigate to your truefidelity-system.json file
  7. Click Open

File menu with Open option highlighted

Or create a new system if needed: - Click File → New - Name it Drive Cycle - Click Create

New System dialog with system name and configuration

  1. Verify the system configuration:
  2. Three ECUs should be present: VCU, MCU, BMS
  3. All connected to a CAN bus
  4. DBC file associated with the network

System Design workspace showing ECU topology

Step 2: Verify ECU Configuration

Ensure ECUs are properly configured for testing.

  1. Select the VCU and verify in Properties panel:
  2. Name: VCU
  3. Board: S32K3X4EVB
  4. Memory: 16MB
  5. Flash: 2MB
  6. Operating System: Zephyr

VCU selected on canvas with Properties panel

  1. Verify MCU configuration:
  2. Name: MCU
  3. Board: S32K3X4EVB
  4. Operating System: Zephyr

  5. Verify BMS configuration:

  6. Name: BMS
  7. Board: S32K3X4EVB
  8. Operating System: Zephyr

Step 3: Verify Network Configuration

Confirm the CAN network is properly set up.

  1. Select the CAN Bus on the canvas

CAN Bus selected with Properties panel showing network settings

  1. Verify network settings:
  2. Name: CAN Bus 1
  3. Baud Rate: 500000 (500 kbps)
  4. DBC File: DBC.dbc should be associated

  5. Check ECU connections:

  6. All three ECUs (VCU, MCU, BMS) connected to the same bus
  7. Blue connection lines visible

Step 4: Start the System

Deploy the system for injection testing.

  1. Save the system first:
  2. Click File → Save
  3. File saves as truefidelity-system.json

File menu with Save option highlighted

  1. Start the system:
  2. Click the Start button (green play icon) in the toolbar
  3. Wait for all ECUs to reach "Running" state

Main toolbar with Start button highlighted

  1. Verify system is running:
  2. Check ECU Status panel shows all ECUs as "Running"
  3. Status bar shows "3 / 3 Containers Running"

ECU Status panel with all ECUs running

Part 2: Injection Setup

Step 5: Switch to CAN Log Analysis Mode

Configure the workspace for injection testing.

  1. Change to analysis mode:
  2. Click View → Layouts → CAN Log Analysis
  3. The layout reconfigures automatically

  4. Understand the layout:

  5. Signal Viewer (left): Signal selection from DBC
  6. Network Traffic (center): Live CAN frames
  7. Signal Chart (right): Real-time signal plots
  8. Signal Player & Injection (bottom): Playback and injection controls

CAN Analysis mode panels

  1. Focus on Signal Player & Injection panel:
  2. Located at the bottom of the screen
  3. Contains both playback and injection controls
  4. If not visible: View → Panels → Signal Player & Injection

Step 6: Understanding Injection Controls

Familiarize yourself with the injection capabilities.

  1. Locate injection controls in the Signal Player & Injection panel:
  2. Find the Injection section on the right side
  3. Available controls:
    • Start all: Begin injection for all selected signals
    • Pause all: Temporarily pause injection
    • Stop all: End all injection
    • Clear all: Remove all injection configurations

Signal Player with injection controls

  1. Understand injection workflow:
  2. Select signals in Signal Viewer
  3. Configure injection parameters
  4. Start injection
  5. Monitor response
  6. Stop and analyze

  7. Important limitations:

  8. Injection sends CAN frames at configured rate
  9. All selected signals inject simultaneously with Start all
  10. System must be running for injection to work
  11. Injected signals appear in Network Traffic

Step 7: Identify Signals for Testing

Select the relevant signals for motor control testing.

  1. Open Signal Viewer panel (left side)

  2. Find VCU output signals (signals to inject):

From VCU_Status_2 (0x101): - Accel_Pedal_Pcnt: Accelerator pedal position (0-100%) - Brake_Pedal_Pcnt: Brake pedal position (0-100%) - Regen_Enable: Regenerative braking enable flag (0/1) - Cmded_Regen_Tq: Commanded regenerative torque (Nm)

From VCU_Status_1 (0x100): - Torque_Req: Torque request to MCU (Nm) - Drive_Mode: Current drive mode (0-7)

Signal Viewer with expanded frames showing VCU signals

  1. Find MCU response signals (signals to monitor):

From MCU_Feedback_1 (0x201): - Motor_Spd: Motor speed in rpm - Actual_Torque: Delivered torque in Nm - Motor_Temp: Motor temperature in °C - Inverter_State: Current inverter state

From MCU_Feedback_2 (0x202): - DC_Link_V: DC bus voltage - Phase_Curr_RMS: Motor phase current - Regen_Active: Regeneration active flag

  1. Select monitoring signals:
  2. Check boxes next to Motor_Spd, Actual_Torque, Regen_Active
  3. These will appear in Signal Chart

Part 3: Injection Execution

Step 8: Configure Injection Values

Set up the signal values to inject for each test scenario.

  1. Define test scenarios:

Scenario 1 - Idle State (Baseline): - Accel_Pedal_Pcnt: 0% - Brake_Pedal_Pcnt: 0% - Expected: Zero torque, motor at idle

Scenario 2 - Moderate Acceleration: - Accel_Pedal_Pcnt: 50% - Brake_Pedal_Pcnt: 0% - Expected: Proportional torque delivery

Scenario 3 - Regenerative Braking: - Accel_Pedal_Pcnt: 0% - Brake_Pedal_Pcnt: 30% - Regen_Enable: 1 - Expected: Negative torque, Regen_Active = 1

Scenario 4 - Full Throttle: - Accel_Pedal_Pcnt: 100% - Brake_Pedal_Pcnt: 0% - Expected: Maximum available torque

  1. Configure first injection (Scenario 1):
  2. In Signal Viewer, click on Accel_Pedal_Pcnt row
  3. Injection options dialog opens
  4. Set Override value: 0
  5. Enable Include in Start all
  6. Click Apply

  7. Add Brake_Pedal_Pcnt to injection:

  8. Click on Brake_Pedal_Pcnt row
  9. Set Override value: 0
  10. Enable Include in Start all
  11. Click Apply

Step 9: Start Signal Injection

Begin the injection test.

  1. Final safety check:

Before starting: - Confirm test bench setup only - Verify no production systems connected - Ensure monitoring panels are visible - Have stop procedure ready

  1. Start injection:
  2. In Signal Player & Injection panel, click Start all
  3. Injection begins immediately
  4. Injected signals transmit to the CAN bus

  5. Monitor Network Traffic:

  6. Watch Network Traffic panel
  7. Injected frames appear with your configured values
  8. Note CAN IDs: 0x101 (VCU_Status_2) appears

Network Traffic panel showing injected CAN messages

  1. Observe initial responses:
  2. Watch Signal Chart for MCU feedback
  3. Actual_Torque should show near zero
  4. Motor_Spd should be at idle
  5. Regen_Active should be 0

Step 10: Monitor System Response

Analyze how the MCU responds to injected signals.

  1. Watch Signal Chart:
  2. Actual_Torque line should be stable near zero
  3. No oscillations or unexpected values
  4. MCU is receiving VCU commands

Signal Chart showing MCU response signals

  1. Check ECU Console for diagnostics:
  2. Filter to MCU logs
  3. Look for processing messages
  4. Verify no error messages

  5. Document baseline behavior:

  6. Note idle torque value
  7. Record motor speed at rest
  8. Screenshot for comparison

  9. Let run for baseline:

  10. Continue injection for 30 seconds
  11. Ensure stability maintained
  12. Watch for any drift

Step 11: Test Acceleration Response

Simulate driver acceleration input.

  1. Prepare for Scenario 2:
  2. Pause current injection: Click Pause all
  3. Prepare to modify values

  4. Update injection values:

  5. Click on Accel_Pedal_Pcnt in Signal Viewer
  6. Change Override value to 50 (50%)
  7. Click Apply

  8. Resume injection:

  9. Click Start all to resume with new values
  10. Or stop and restart if needed

  11. Observe acceleration response:

  12. Actual_Torque should increase proportionally
  13. Expect approximately 50% of max torque
  14. Motor_Spd should begin increasing
  15. DC_Link_V may show slight drop under load

  16. Verify response characteristics:

  17. Measure response time (command to torque)
  18. Check for overshoot or oscillation
  19. Verify smooth torque delivery

  20. Document findings:

  21. Response time: Target < 100ms
  22. Torque accuracy: Within ±5% of expected
  23. Stability: No oscillation

Step 12: Test Regenerative Braking

Validate regen braking activation and response.

  1. Prepare for Scenario 3:
  2. Click Stop all to halt current injection
  3. Prepare regen test configuration

  4. Configure regen signals:

  5. Set Accel_Pedal_Pcnt: 0%
  6. Set Brake_Pedal_Pcnt: 30%
  7. Set Regen_Enable: 1
  8. Optionally set Cmded_Regen_Tq: -100 Nm

  9. Start regen injection:

  10. Click Start all
  11. Watch for regen activation

  12. Observe regen behavior:

  13. Regen_Active should transition to 1
  14. Actual_Torque should go negative (braking)
  15. Pack_I (from BMS) should go negative (charging)
  16. Motor acts as generator

  17. Check timing:

  18. Time from Regen_Enable = 1 to Regen_Active = 1
  19. Should be < 50ms for good response
  20. Note any delays

  21. Document regen results: ``` Regen Activation Test Results:

  22. Brake Pedal: 30%
  23. Regen Enable: Active
  24. Activation Time: ~45ms
  25. Regen Torque: -95 Nm (commanded -100 Nm)
  26. Pack Current: -28 A (charging)
  27. Status: PASS ```

Step 13: Test Edge Cases

Validate error handling and limit behavior.

  1. Test conflicting inputs:

Scenario: Both Pedals Pressed - Set Accel_Pedal_Pcnt: 50% - Set Brake_Pedal_Pcnt: 50% - Expected: Brake should override (safety) - MCU should prioritize braking

  1. Execute conflict test:
  2. Configure both signals with above values
  3. Start injection
  4. Observe which takes precedence
  5. Check for diagnostic messages

  6. Test BMS limit interaction:

  7. Inject high torque request
  8. Monitor if MCU respects Max_Discharge_Tq from BMS
  9. Verify torque limiting when battery constrained

  10. Observe error handling:

  11. MCU should handle gracefully
  12. Check Console for diagnostic messages
  13. Verify system remains stable

  14. Document edge case results: ``` Edge Case: Conflicting Pedal Inputs

  15. Accel: 50%, Brake: 50%
  16. Result: Brake prioritized (correct)
  17. Torque: 0 Nm (braking mode)
  18. Diagnostic: VCU plausibility warning logged
  19. Status: PASS - Safety behavior correct ```

Step 14: Stop Injection

Complete the test sequence.

  1. Prepare to stop:
  2. Ensure all data captured
  3. Take final screenshots
  4. Note ending timestamp

  5. Stop injection:

  6. Click Stop all button
  7. Injection ceases immediately
  8. CAN traffic returns to normal

  9. Verify system state:

  10. MCU returns to idle state
  11. No residual effects
  12. All ECUs still running normally

Part 4: Analysis and Documentation

Step 15: Analyze Test Results

Review the collected data.

  1. Review Signal Chart:
  2. Scroll through entire test duration
  3. Identify each test scenario
  4. Measure response times
  5. Note any anomalies

  6. Quantify performance:

Test Scenario Response Time Accuracy Result
Idle (0%) N/A ±2 Nm PASS
Moderate (50%) 85ms ±5% PASS
Full Throttle (100%) 95ms ±3% PASS
Regen Braking 45ms ±5% PASS
Conflicting Inputs N/A Brake Priority PASS
  1. Correlation analysis:
  2. Compare Torque_Req vs Actual_Torque
  3. Check Accel_Pedal_Pcnt to torque mapping
  4. Verify linear or expected curve response

Step 16: Export Test Data

Save evidence for reporting.

  1. Export Network Traffic:
  2. Click Export in Network Traffic toolbar
  3. Choose format:
    • Text (.txt): Human-readable
    • CSV (.csv): For spreadsheet analysis
    • JSON (.json): For programmatic processing
    • candump: Standard CAN log format
  4. Name: injection_test_traffic.csv

  5. Capture to industry format (for longer recordings):

  6. Click Configure in Network Traffic toolbar
  7. Select network/channel
  8. Choose format: BLF (Vector), MDF4, or CSV
  9. Click Start Capture, then Stop Capture when done

Capture configuration dialog showing network and format options

  1. Export Signal Chart:
  2. Right-click on Signal Chart
  3. Select Export Chart
  4. Save as PNG: torque_response_chart.png

  5. Export Console logs:

  6. Click Export in ECU Console
  7. Choose format (Text, CSV, or JSON)
  8. Name: injection_test_console.txt

Step 17: Create Test Report

Document the injection test.

  1. Compile test documentation:

``` Motor Control Injection Test Report =================================== Date: [Current Date] Test Engineer: [Your Name] System: truefidelity-system.json DBC: DBC.dbc

Test Objective: Validate MCU torque response to VCU pedal commands using signal injection.

Test Setup: - ECUs: VCU, MCU, BMS (S32K3X4EVB, Zephyr) - Network: CAN Bus 1 (500 kbps) - Injection signals: Accel_Pedal_Pcnt, Brake_Pedal_Pcnt - Monitoring signals: Actual_Torque, Motor_Spd, Regen_Active

Test Results:

  1. Idle State (0% pedal)

    • Actual Torque: 0 Nm (±2 Nm noise)
    • Motor Speed: 0 rpm
    • Status: PASS
  2. Moderate Acceleration (50% pedal)

    • Response Time: 85ms
    • Actual Torque: 125 Nm (expected 128 Nm)
    • Accuracy: 97.6%
    • Status: PASS
  3. Full Throttle (100% pedal)

    • Response Time: 95ms
    • Actual Torque: 248 Nm (expected 256 Nm)
    • Accuracy: 96.9%
    • Status: PASS
  4. Regenerative Braking (30% brake, Regen_Enable=1)

    • Activation Time: 45ms
    • Regen Torque: -95 Nm
    • Pack Current: -28 A (charging)
    • Status: PASS
  5. Conflicting Inputs (50% accel + 50% brake)

    • Result: Brake prioritized correctly
    • Torque: 0 Nm (safety override)
    • Status: PASS

Summary: - All test scenarios passed - Response times within specification (<100ms) - Torque accuracy better than 95% - Safety behavior correct for conflicting inputs - Regen braking activates reliably

Recommendations: - System ready for integration testing - Consider testing temperature protection behavior - Validate behavior at BMS power limits

Attachments: - injection_test_traffic.csv - injection_test_console.txt - torque_response_chart.png ```

  1. Organize deliverables:

InjectionTest/ ├── truefidelity-system.json ├── exports/ │ ├── injection_test_traffic.csv │ ├── injection_test_console.txt │ └── torque_response_chart.png └── reports/ └── injection_test_report.md

Part 5: Advanced Injection Techniques

Step 18: Multi-Signal Coordination

Test complex scenarios with multiple coordinated signals.

  1. Plan coordinated injection:
  2. Simulate realistic drive scenario
  3. Combine pedal inputs with mode changes
  4. Test transitions between states

  5. Configure signal set:

  6. Accel_Pedal_Pcnt: Varying values
  7. Drive_Mode: Change from Normal (1) to Sport (3)
  8. Monitor torque mapping changes

  9. Execute coordinated test:

  10. Start with normal mode, moderate pedal
  11. Change drive mode
  12. Observe torque curve change
  13. Document mode-specific behavior

Step 19: Stress Testing

Push the system to validate robustness.

  1. Design stress scenarios:
  2. Rapid pedal transitions (0→100→0%)
  3. Repeated regen activation cycles
  4. Maximum torque requests

  5. Execute stress test:

  6. Configure rapid value changes
  7. Monitor for errors or instability
  8. Check resource usage in ECU Status

  9. Document stress results:

  10. Maximum sustainable update rate
  11. Error handling under stress
  12. Recovery behavior

Troubleshooting Guide

Common Injection Issues

Injection Won't Start

Symptom: Start all button clicked but no injection

Solutions:

  1. Verify system is running (all ECUs show "Running")
  2. Check signals are selected for injection
  3. Ensure Signal Player & Injection panel is open
  4. Verify network configuration is correct
  5. Check for error messages in Console

No ECU Response

Symptom: Injection active but no MCU reaction

Solutions:

  1. Verify MCU receives injected frames in Network Traffic
  2. Check signal scaling matches DBC definition
  3. Ensure correct CAN IDs are being used
  4. Verify MCU firmware expects these inputs
  5. Check diagnostic mode isn't blocking inputs

Unexpected Behavior

Symptom: ECU responds incorrectly

Solutions:

  1. Verify injection values are within valid ranges
  2. Check DBC signal scaling factors
  3. Review ECU specifications for expected behavior
  4. Test with known good values first
  5. Check for conflicting signals

Network Traffic Not Showing Injected Frames

Symptom: Injection running but frames not visible

Solutions:

  1. Clear any filters in Network Traffic panel
  2. Verify correct CAN bus selected
  3. Check injection is actually started (button state)
  4. Verify network configuration matches

Terminal Access Note

Terminal Not Available for Zephyr ECUs

The VCU, MCU, and BMS ECUs in the Drive Cycle system run Zephyr OS, which does not support terminal access. For debugging:

  • Use ECU Console logs for runtime debugging
  • Enable GDB debugging in ECU properties for detailed firmware analysis
  • Add debug print statements to firmware code
  • See the System Design Workflow tutorial for GDB setup

Safety Best Practices

Pre-Test Checklist

Before any injection test:

  • ✓ Test bench only (no production systems)
  • ✓ Emergency stop procedure ready
  • ✓ Team notified of test
  • ✓ Baseline behavior documented
  • ✓ Recovery plan prepared
  • ✓ Monitoring panels active
  • ✓ Data recording enabled

During Test

While injection is active:

  • Monitor continuously
  • Watch for unexpected behavior
  • Be ready to stop immediately
  • Document any anomalies
  • Keep test duration reasonable
  • Start with conservative values

Post-Test

After injection:

  • Verify system returns to normal
  • Check for residual effects
  • Review Console for diagnostics
  • Document all findings
  • Archive test data
  • Stop the system if testing complete

Performance Considerations

Optimizing Injection Tests

  1. Signal Selection:
  2. Start with few signals
  3. Add gradually as needed
  4. Focus on critical control signals
  5. Monitor key response signals

  6. Timing Considerations:

  7. Injection rate matches realistic message rates
  8. Avoid overwhelming the CAN bus
  9. Allow settling time between scenarios
  10. Consider ECU processing cycles

  11. Value Ranges:

  12. Start within normal operating ranges
  13. Test limits gradually
  14. Verify DBC scaling factors
  15. Document valid value ranges

System Resources

  1. Memory Management:
  2. Clear Network Traffic periodically
  3. Export data regularly
  4. Close unused panels
  5. Monitor system resources

  6. Network Utilization:

  7. Calculate bus load with injection
  8. Leave headroom for ECU messages
  9. Consider message priorities
  10. Monitor for dropped frames

Summary

You've completed a comprehensive signal injection workflow:

  • ✅ Prepared the Drive Cycle test system
  • ✅ Configured injection for pedal signals
  • ✅ Executed baseline and acceleration tests
  • ✅ Validated regenerative braking response
  • ✅ Tested edge cases and error handling
  • ✅ Exported and documented results

This tutorial covered essential injection testing techniques used in EV powertrain development. These skills apply to various validation scenarios, from component testing to system integration.

Next Steps

  1. Practice with different scenarios:
  2. Test BMS limit behavior
  3. Validate motor temperature protection
  4. Test drive mode transitions

  5. Develop test libraries:

  6. Create standard injection scenarios
  7. Document expected responses
  8. Build regression test suite

  9. Advanced validation:

  10. Combine playback with injection
  11. Multi-ECU coordination testing
  12. Performance optimization
  • System Design Workflow: Building ECU topologies and GDB debugging
  • ECU Monitoring Walkthrough: Deep dive into monitoring tools
  • Playback Analysis Walkthrough: Analyzing captured CAN logs
  • End-to-End Example: Complete analysis with injection testing