Main Content

Adaptive Cruise Control System

Simulate adaptive cruise control using model predictive controller

  • Adaptive Cruise Control System block

Libraries:
Model Predictive Control Toolbox / Automated Driving

Description

The Adaptive Cruise Control System block simulates an adaptive cruise control (ACC) system that tracks a set velocity and maintains a safe distance from a lead vehicle by adjusting the longitudinal acceleration of an ego vehicle. The block computes optimal control actions while satisfying safe distance, velocity, and acceleration constraints using model predictive control (MPC).

To customize your controller, for example to use advanced MPC features or modify controller initial conditions, click Create ACC subsystem.

Examples

Ports

Input

expand all

Ego vehicle velocity setpoint in m/s. When there is no lead vehicle, the controller tracks this velocity.

Safe time gap in seconds between the lead vehicle and the ego vehicle. This time gap is used to calculate the minimum safe following distance constraint. For more information, see Safe Following Distance.

Ego vehicle velocity in m/s.

Distance in meters between lead vehicle and ego vehicle. To calculate this signal, subtract the ego vehicle position from the lead vehicle position.

Velocity difference in meters per second between lead vehicle and ego vehicle. To calculate this signal, subtract the ego vehicle velocity from the lead vehicle velocity.

Minimum ego vehicle longitudinal acceleration constraint in m/s2. Use this input port when the minimum acceleration varies at run time.

Dependencies

To enable this port, select Use external source for the Minimum longitudinal acceleration parameter.

Maximum ego vehicle longitudinal acceleration constraint in m/s2. Use this input port when the maximum acceleration varies at run time.

Dependencies

To enable this port, select Use external source for the Maximum longitudinal acceleration parameter.

Controller optimization enable signal. When this signal is:

  • Nonzero, the controller performs optimization calculations and generates a Longitudinal acceleration control signal.

  • Zero, the controller does not perform optimization calculations. In this case, the Longitudinal acceleration output signal remains at the value it had when the optimization was disabled. The controller continues to update its internal state estimates.

Dependencies

To enable this port, select the Use external signal to enable or disable optimization parameter.

Actual longitudinal acceleration in m/s2 applied to the ego vehicle. The controller uses this signal to estimate the ego vehicle model states. Use this input port when the control signal applied to the ego vehicle does not match the optimal control signal computed by the model predictive controller. This mismatch can occur when, for example:

  • The Adaptive Cruise Control System is not the active controller. Maintaining an accurate state estimate when the controller is not active prevents bumps in the control signal when the controller becomes active.

  • The acceleration actuator fails and does not provide the correct control signal to the ego vehicle.

Dependencies

To enable this port, select the Use external control signal for bumpless transfer between ACC and other controllers parameter.

Output

expand all

Acceleration control signal in m/s2 generated by the controller.

Parameters

expand all

Parameters Tab

Ego Vehicle Model

The linear model from the ego vehicle longitudinal acceleration to its longitudinal velocity, specified as an LTI model or a linear System Identification Toolbox model. The controller creates its internal predictive model by augmenting the ego vehicle dynamic model.

Programmatic Use

Block Parameter: EgoModel
Type: string, character vector
Default: "tf(1,[0.5,1,0])"

Initial velocity in m/s of the ego vehicle model, which can differ from the actual ego vehicle initial velocity.

This value is used to configure the initial conditions of the model predictive controller. For more information, see Initial Conditions.

Programmatic Use

Block Parameter: InitialEgoVelocity
Type: string, character vector
Default: "20"

Minimum spacing in meters between the lead vehicle and the ego vehicle. This value corresponds to the target relative distance between the ego and lead vehicles when the ego vehicle velocity is zero.

This value is used to calculate the:

Programmatic Use

Block Parameter: DefaultSpacing
Type: string, character vector
Default: "10"

Maximum ego vehicle longitudinal velocity in m/s.

Programmatic Use

Block Parameter: MaxVelocity
Type: string, character vector
Default: "50"
Adaptive Cruise Controller Constraints

Minimum ego vehicle longitudinal acceleration constraint in m/s2.

If the minimum acceleration varies over time, add the Minimum longitudinal acceleration input port to the block by selecting Use external source.

Programmatic Use

Block Parameter: MinAcceleration
Type: string, character vector
Default: "-3"

Maximum ego vehicle longitudinal acceleration constraint in m/s2.

If the maximum acceleration varies over time, add the Maximum longitudinal acceleration input port to the block by selecting Use external source.

Programmatic Use

Block Parameter: MaxAcceleration
Type: string, character vector
Default: "2"
Model Predictive Controller Settings

Controller sample time in seconds.

Programmatic Use

Block Parameter: Ts
Type: string, character vector
Default: "0.1"

Controller prediction horizon steps. The controller prediction time is the product of the sample time and the prediction horizon.

Programmatic Use

Block Parameter: PredictionHorizon
Type: string, character vector
Default: "30"

Closed-loop controller performance. The default parameter value provides a balanced controller design. Specifying a:

  • Smaller value produces a more robust controller with smoother control actions.

  • Larger value produces a more aggressive controller with a faster response time.

When you modify this parameter, the change is applied to the controller immediately.

Programmatic Use

Block Parameter: ControllerBehavior
Type: string, character vector
Default: "0.5"

Block Tab

Configure the controller to apply a suboptimal solution after a specified maximum number of iterations, which guarantees the worst-case execution time for your controller.

For more information, see Suboptimal QP Solution.

Dependencies

After selecting this parameter, specify the Maximum iteration number parameter.

Programmatic Use

Block Parameter: suboptimal
Type: string, character vector
Default: "off"

Maximum number of controller optimization iterations.

Dependencies

To enable this parameter, select the Use suboptimal solution parameter.

Programmatic Use

Block Parameter: maxiter
Type: string, character vector
Default: "10"

To add the Enable optimization input port to the block, select this parameter.

Programmatic Use

Block Parameter: optmode
Type: string, character vector
Default: "off"

Select this parameter to add the External control signal input port to the block.

Programmatic Use

Block Parameter: trackmode
Type: string, character vector
Default: "off"

Generate a custom ACC subsystem, which you can modify for your application. The configuration data for the custom controller is exported to the MATLAB® workspace as a structure.

You can modify the custom controller subsystem to:

  • Modify default MPC settings or use advanced MPC features.

  • Modify the default controller initial conditions.

  • Use different application settings, such as a custom safe following distance definition.

Algorithms

expand all

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Version History

Introduced in R2018a