AEB Test Bench for Euro NCAP Scenarios

Since R2024a

This example shows how to configure and simulate an autonomous emergency braking (AEB) system, designed in Simulink®, with RoadRunner Scenario using a scenario defined per European New Car Assessment Programme (Euro NCAP®) testing protocols.

Introduction

AEB is an advanced active safety system that helps drivers avoid or mitigate collisions with other vehicles.

The Euro NCAP is a popular car safety performance assessment program that provides an independent evaluation of the safety level for vehicles, including assessments of AEB systems. You can evaluate how effectively can AEB system prevents or mitigates collisions with other vehicles using AEB test scenarios designed per Euro NCAP. These evaluation results contribute to overall vehicle safety rating and provide consumers with important details on AEB performance.

This example shows how to set up the AEB test bench model and simulate Safety Assist (SA) AEB Car-to-Car scenarios. To verify collision between vehicles, you can disable the AEB system. You can also enable it to verify the effectiveness of collision avoidance. In this example, you:

  • Set Up Environment — Configure test environment and MATLAB® to open the AEB test bench model.

  • Explore Test Bench Model — The test bench contains AEB controller, vehicle dynamics, and scenario and environment component, which has interfaces for RoadRunner Scenario.

  • Generate and Review Scenario — Generate Safety Assist AEB Car-to-Car Rear Moving (SA AEB CCRm) scenario per Euro NCAP Test Protocol – AEB Car-to-Car systems version 4.2.

  • Disable AEB and Verify Collision — Configure the test bench model to disable the AEB controller. Simulate the SA AEB CCRm scenario using RoadRunner Scenario. Monitor the collision and review the related statistical data.

  • Enable AEB and Verify Collision Avoidance — Configure the test bench model to enable the AEB controller. Simulate the SA AEB CCRm scenario and plot simulation results.

  • Explore Further — Explore how to simulate AEB test bench for all variants of SA AEB CCRm and also with other SA AEB Car-to-Car scenarios using Simulink Test™.

Set Up Environment

This section shows how to set up the test environment and how to open the project for AEB test bench model.

Start RoadRunner interactively using the roadrunnerSetup function. In the RoadRunner Setup dialog box, specify the RoadRunner Installation Folder and RoadRunner Project Folder locations. You must use a RoadRunner Project created with Base + Add On Assets because this example uses assets from RoadRunner Asset Library.

rrApp = roadrunnerSetup;

The function returns a roadrunner object, rrApp, that provides functions for performing basic workflow tasks such as opening, closing, and saving scenes and projects. After setting up the required paths, close RoadRunner. The subsequent steps in this example assume the RoadRunner application is closed.

After setting up the required paths, close RoadRunner. The subsequent steps in this example use rrApp, and assume the RoadRunner application is closed.

close(rrApp)

The helperSetupEuroNCAPTest helper function initializes RoadRunner application and establishes connection with MATLAB. It also opens the project that contains the AEB test bench, copies the required behavior and asset files into the RoadRunner project, and adds the necessary paths needed to execute the subsequent steps.

helperSetupEuroNCAPTest

Explore Test Bench Model

In this example, you use DrivingTestBench.slx to simulate and test the performance of the AEB controller.

Open the AEB test bench model.

modelName = "DrivingTestBench";
open_system(modelName)

The test bench model contains these modules:

  • Controller — Specifies the steering angle and acceleration controls of the ego vehicle.

  • Vehicle Dynamics — Specifies the ego vehicle dynamics. The Vehicle Dynamics subsystem consists of a variant subsystem that has two vehicle variants, 3DOF (default) and 14DOF.

  • Scenario and Environment — Specifies vehicle paths, sensor blocks, and RoadRunner Scenario blocks, which configure, read from, and write to RoadRunner Scenario.

The Controller reference model accepts inputs such as set velocity, reference pose, current pose, tracks, and curvature deviation from Scenario and Environment subsystem. It computes steering angle and acceleration of the ego vehicle, and provides them as outputs to Vehicle Dynamics subsystem.

Open the Controller reference model.

open_system("Controller")

The controller contains these modules:

  • AEB Controller — The AEB controller subsystem takes Tracks and Ego Velocity inputs from Sensors and Environment subsystem. The controller finds the most important object (MIO) using the Tracks input and enables the AEB Brake Status if there is chance of collision with MIO.

  • Trajectory Following Controller — This subsystem enables the ego vehicle to follow input trajectory and accelerate to the set velocity from a standstill.

  • Controller Mode Selector — This subsystem applies AEB Deceleration signal from AEB Controller if AEB Enable and AEB Brake Status signals are true. Otherwise, this subsystem passes through the Cruise Acceleration signal from the Trajectory Following Controller.

The Vehicle Dynamics subsystem incorporates two distinct vehicle models, namely 3DOF and 14DOF, to dynamically update the state of the ego vehicle based on the inputs from the AEB Controller. Open the Vehicle Dynamics subsystem.

open_system(modelName+"/Vehicle Dynamics/Vehicle Dynamics")

The 3DOF bicycle model block implements a rigid two-axle single track vehicle body model to calculate the longitudinal, lateral, and yaw motion. The block also calculates the body mass, aerodynamic drag, and weight distribution between the axles due to acceleration and steering. For more information, see Bicycle Model. Open the 3DOF variant,

open_system(modelName+"/Vehicle Dynamics/Vehicle Dynamics/3DOF")

As compared to 3DOF variant, the 14DOF variant offers additional simulation aspects such as transmission dynamics, tire interactions, load shifting, braking behavior, and the vehicle's powertrain response. For more details on vehicle dynamics models, see Passenger Vehicle Dynamics Models (Vehicle Dynamics Blockset). Open 14DOF reference model,

open_system("VehDyn14DOF")

The Scenario and Environment subsystem has interfaces to interact with RoadRunner Scenario to cosimulate the AEB application with RoadRunner Scenario. It specifies sensors, reference path information of the ego vehicle, and control signals to enable AEB testing. Open the Scenario and Environment subsystem.

open_system(modelName+"/Scenario and Environment")

The Scenario and Environment subsystem contains these modules:

  • RoadRunner Scenario — Defines the interface for an actor model.

  • Path Action Reader — RoadRunner Scenario Reader block that reads the reference path of the ego vehicle.

  • Self Actor Runtime Reader — RoadRunner Scenario Reader block that reads ego actor runtime information.

  • All Actor Runtime — RoadRunner Scenario Reader block that reads runtime information of all actors in the scenario.

  • Self Actor Runtime Writer — RoadRunner Scenario Writer block that writes the ego vehicle runtime to RoadRunner Scenario.

  • Ego Path — Subsystem that reads the reference path and current ego pose and computes the reference curvature, lateral deviation, relative angle and reference pose required for controller.

  • Sensors — Variant subsystem that enables ground truth or probabilistic vision and radar sensors.

  • Test Enable — Provides AEB Test Enable signal and Stop Simulation signal by using Test Start Position that is previously computed by the setup function of the configureDrivingTestBench object.

Note that, based on the requirements of your controller, you can extract additional signals from the Scenario and Environment subsystem and input them into the Controller reference model.

Generate and Review Scenario

In this section, you generate an SA AEB CCRm test scenario per Euro NCAP protocol. The Euro NCAP specification refers to the ego vehicle as the vehicle under test (VUT) and the target vehicle as a global vehicle target (GVT). In SA AEB CCRm scenario, the VUT travels forwards towards the GVT that is traveling at a constant speed, causing a collision in which the front side of the VUT strikes the rear side of the GVT. You can generate 55 variant scenarios for this scenario per Euro NCAP protocol by varying the VUT speed and the impact overlap between the GVT and VUT.

  • VUT Speed — 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, or 80 km/h

  • Impact Overlap — -50%, -75%, 100%, 75%, 50%

Specify the NCAP test name.

testName = "SA AEB CCRm";

Get Euro NCAP test specifications using ncapSpec function.

ncapSpecTable = ncapSpec(testName);

Display Euro NCAP variations for SA AEB CCRm test scenario.

disp(ncapSpecTable);
    EgoSpeed    ImpactOverlap
    ________    _____________

     8.3333        "-50%"    
     8.3333        "-75%"    
     8.3333        "100%"    
     8.3333        "50%"     
     8.3333        "75%"     
     9.7222        "-50%"    
     9.7222        "-75%"    
     9.7222        "100%"    
     9.7222        "50%"     
     9.7222        "75%"     
     11.111        "-50%"    
     11.111        "-75%"    
     11.111        "100%"    
     11.111        "50%"     
     11.111        "75%"     
       12.5        "-50%"    
       12.5        "-75%"    
       12.5        "100%"    
       12.5        "50%"     
       12.5        "75%"     
     13.889        "-50%"    
     13.889        "-75%"    
     13.889        "100%"    
     13.889        "50%"     
     13.889        "75%"     
     15.278        "-50%"    
     15.278        "-75%"    
     15.278        "100%"    
     15.278        "50%"     
     15.278        "75%"     
     16.667        "-50%"    
     16.667        "-75%"    
     16.667        "100%"    
     16.667        "50%"     
     16.667        "75%"     
     18.056        "-50%"    
     18.056        "-75%"    
     18.056        "100%"    
     18.056        "50%"     
     18.056        "75%"     
     19.444        "-50%"    
     19.444        "-75%"    
     19.444        "100%"    
     19.444        "50%"     
     19.444        "75%"     
     20.833        "-50%"    
     20.833        "-75%"    
     20.833        "100%"    
     20.833        "50%"     
     20.833        "75%"     
     22.222        "-50%"    
     22.222        "-75%"    
     22.222        "100%"    
     22.222        "50%"     
     22.222        "75%"     

This example uses a variant of SA AEB CCRm scenario with ego speed of 65 km/h and impact overlap of 75%.

egoSpeed = 18.056; % ego speed in meters per second
impactOverlap = "75%";

To generate a variant scenario, get the index of the required variant scenario using the EgoSpeed and ImpactOverlap parameters from the ncapSpecTable.

egoSpeedIndices = (find(abs(ncapSpecTable{:,1}-egoSpeed)<1e-2));
impactOverlapIndex = find(ncapSpecTable{egoSpeedIndices,2}==impactOverlap);
variantIndex = egoSpeedIndices(impactOverlapIndex);
disp(variantIndex);
    40

Specify the asset file for the ego vehicle. Then, connect to RoadRunner to get the dimension of the ego vehicle by using the helperGetActorDimensions helper function.

egoAssetFile = "Vehicles/ADT Vehicles/SK_Sedan.fbx_rrx";
egoAssetDim = helperGetActorDimensions(egoAssetFile);

Create the Euro NCAP scenario variant using helperCreateEuroNCAPscenario helper function. This function connects with RoadRunner to create and save the scenario. The helper function returns the saved scenario filename rrScenarioFileName, and the associated test information testData.

[rrScenarioFileName,testData] = helperCreateEuroNCAPscenario(testName,variantIndex,egoAssetDim,egoAssetFile);
Generating seed scenario for SA AEB CCRm ...
Generating Euro NCAP scenario descriptors for SA AEB CCRm, variant 40...
Saved SA_AEB_CCRm_40 scene and scenario.

Open RoadRunner and the generated scenario variant.

rrApp = roadrunner;
openScenario(rrApp,rrScenarioFileName);

Note that this example saves scenario that includes behaviors for the ego and target vehicles.

The ego vehicle has the DrivingTestBench.rrbehavior.rrmeta behavior, which contains the Simulink behavior DrivingTestBench.slx. In this example, the ego vehicle must start from rest and attain a constant speed to meet the test conditions per Euro NCAP protocol. The target vehicle has the MATLAB behavior Target.rrbehavior, which contains the TargetBehavior.m MATLAB System object™. The target vehicle continuously monitors the ego vehicle speed to adjust its timing to ensure a collision with the ego vehicle.

Disable AEB and Verify Collision

In this section, you configure the test bench model to disable AEB, simulate the SA AEB CCRm scenario using RoadRunner, observe the collision, and review if the collision occurred at the specified impact overlap.

Connect to the RoadRunner Scenario server for cosimulation using the createSimulation function, enable data logging, turn off simulation pacing, and set the maximum simulation time.

rrSim = createSimulation(rrApp);
set(rrSim,Logging="on");
set(rrSim,PacerStatus="Off");
set(rrSim,MaxSimulationTime=testData.TestEndTime);

Set the RoadRunner Scenario simulation step size to match that of the test bench model.

stepSize = 0.03;
set(rrSim,StepSize=stepSize);

You can configure the test bench model using the configureDrivingTestBench function, which returns a configuration object drivingConfigObj.

drivingConfigObj  = configureDrivingTestBench;

Specify the vehicle variant configuration by setting the fidelity of vehicle using the VehicleParameters method of the configuration object drivingConfigObj.

vehicleVariant = drivingConfigObj.VehicleParameters("Fidelity", "3DOF");

Apply the vehicle configuration parameters and deactivate the AEB system. Configure the test bench model by using the setup method of the configuration object drivingConfigObj. The method specifies parameters such as: AEB system status, test start time, simulation step size, and the vehicle variant.

setup(drivingConfigObj,AEBEnable=0,TestStartTime=testData.TestStartTime,StepSize=stepSize,Vehicle=vehicleVariant);
fprintf("\nConfiguration of %s has been successfully completed.\n", modelName);
Configuration of DrivingTestBench has been successfully completed.

Simulate the scenario and fetch the simulation log.

set(rrSim,SimulationCommand="Start")
while strcmp(get(rrSim,"SimulationStatus"),"Running")
    pause(1);
end
simulationLog = get(rrSim,"SimulationLog");

Verify the occurrence of a collision between the VUT and GVT using simulation log diagnostics.

diagnostics = simulationLog.get("Diagnostics");
if(strcmp(diagnostics(end).Message,...
        "Simulation failed: Collision occurred between Actor VUT  and Actor GVT ."))
    disp("Collision occurred between VUT And GVT.");
else
    error("Collision did not occur between VUT and GVT.");
end
Collision occurred between VUT And GVT.

To visualize the VUT and GVT actor positions at collision, first get the scenario descriptor using the getScenarioDescriptor function. Then plot the VUT and GVT actor positions in world coordinates using impact overlap percentage at collision event.

rrScenario.SimulatorInstance = rrApp;
rrScenario.SimulationInstance = rrSim;
rrDescriptor = getScenarioDescriptor(rrScenario,Simulator="RoadRunner");
% Get impact overlap from ncapSpecTable.
impactOverlap = ncapSpecTable(variantIndex,:).("ImpactOverlap");
hfig = helperPlotActorsAtCollision(rrDescriptor,testName,ImpactOverlapPercentage=impactOverlap);

The plot illustrates the distance between the impact overlap points of the VUT and GVT. Notice the distance is near zero, which verifies the collision fraction complies with Euro NCAP specification.

Close figure.

close(hfig);

Delete the active RoadRunner simulation object.

delete(rrSim);
pause(5);

Enable AEB and Verify Collision Avoidance

In this section, you configure the test bench to enable the AEB system and verify its effectiveness in preventing collision.

rrSim = createSimulation(rrApp);
set(rrSim,Logging="on");
set(rrSim,PacerStatus="Off");
set(rrSim,MaxSimulationTime=testData.TestEndTime);
setup(drivingConfigObj,AEBEnable=1,TestStartTime=testData.TestStartTime,StepSize=stepSize,Vehicle=vehicleVariant);
fprintf("\nSetup of DrivingTestBench complete.\n");
Setup of DrivingTestBench complete.

Simulate the AEB test bench model.

set(rrSim,SimulationCommand="Start")
while strcmp(get(rrSim,"SimulationStatus"),"Running")
    pause(1);
end
simulationLog = get(rrSim,"SimulationLog");

Plot the simulation results by using the helperPlotAEBResults helper function.

helperPlotAEBResults(out.logsout,rrScenarioFileName);

The simulation results contain these charts:

  • AEB Test Enable — Displays the test enable signal that indicates start of the test.

  • FCW and AEB Status — Displays the forward collision warning (FCW) and AEB activation status.

  • TTC vs. Stopping Time — Compares the time-to-collision (TTC) and the stopping times for the FCW, first stage partial brake, second stage partial brake, and full brake.

  • Ego Car Acceleration — Shows the acceleration of the ego vehicle.

  • Ego Car Velocity — Shows the velocity of the ego vehicle.

  • Headway — Shows the headway between the ego vehicle and the target vehicle.

  • Ego Car Yaw and Yaw Rate — Shows the yaw and yaw rate of the ego vehicle.

When the ego vehicle attains the steady-state speed, this example sets the AEB Test Enable parameter to true, indicating the start of the test. Once the test starts, the ego vehicle applies brakes based on the TTC value to avoid collision with the target vehicle.

Close the active RoadRunner Scenario instance.

close(rrApp);

Explore Further

In this example, you have configured the AEB test bench model to simulate a variant of SA AEB CCRm scenario per Euro NCAP test protocols. You can further explore this example by simulating with other variants of SA AEB CCRm scenarios by selecting different ego speeds and impact overlap values.

You can also programmatically generate other SA AEB Car-to-Car scenarios, perform automated testing, and review the consolidated Euro NCAP report using Simulink Test. For more information, see AEB Euro NCAP Testing with RoadRunner Scenario example.

See Also

Functions

Related Topics