Project 2 Adaptive Cruise Control
Project 2 Adaptive Cruise Control
Aim of the project:
The aim of the project is to develop an Adaptive Cruise Control (ACC) feature for vehicles using MATLAB Simulink and follow Model-Based Design (MBD) processes.
1. Adaptive Cruise Control Overview:
- The ACC feature allows a vehicle to automatically adjust its speed to maintain a safe following distance from the vehicle in front, thereby reducing the driver's stress and improving comfort.
- A radar sensor placed at the front of the vehicle continuously monitors the road ahead.
- The ACC operates in three main modes: OFF, STANDBY, and ON, which need to be implemented as a state machine in Simulink.
2. Main Project Objective:
- Develop the ACC feature based on the provided Requirement Document using MATLAB Simulink.
- Following MBD processes, including requirement tagging and traceability, creating Simulink Design Data (SLDD), configuring parameters, using Model Advisor for checks, and generating code.
- Enable "Support Floating Numbers" in the Code Generation settings.
- Utilize Embedded Coder to generate code.
- Define storage classes for input, output, local, and calibration signals.
- Set a sample time of 0.01 seconds for all signals.
3. Requirement 1 - Lead Vehicle:
- Focuses on the lead vehicle, which is the vehicle ahead of the driver's vehicle.
- Utilizes input signals from both a camera and radar sensor to determine the lead vehicle's speed.
4. Requirement 2 - Drive Vehicle:
- Concerns about the driver's vehicle with the ACC algorithm.
- Takes input signals from both a camera and radar sensor, as well as an acceleration mode signal.
- Implements sensor fusion techniques but simplifies for complexity reasons.
- Outputs the speed of the driver's vehicle and whether a lead vehicle is detected.
5. Requirement 3 - Adaptive Cruise Control Algorithm:
- Defines the logic for the ACC feature's three main modes: OFF, STANDBY, and ON.
- Takes input signals related to time gap, set speed, set gap, cruise switch, and set switch.
- Uses feedback from Requirement 2 (driver's vehicle speed and lead vehicle detection).
- Outputs an acceleration mode signal that governs the driver's vehicle speed to match the lead vehicle.
6. Requirement 3a - ACC OFF MODE:
- Default state inside the ACC state machine logic.
- Sets the acceleration mode to 0.
- Transition conditions are based on the cruise switch.
7. Requirement 3b - ACC STANDBY MODE:
- Activated state inside the state machine.
- Sets the acceleration mode to 1.
- Transition conditions are based on the cruise switch and set switch.
8. Requirement 3c - ACC ON MODE:
- Activated when the set switch is equal to 1.
- Contains sub-states with different acceleration mode values.
- Transition conditions are defined for each sub-state based on various inputs related to lead vehicle detection, speed, and time gap.
The overall aim is to develop a comprehensive ACC system that can intelligently control the driver's vehicle's speed based on input from sensors and user-defined settings, ensuring safety and comfort while driving. The problem statement provides a detailed breakdown of the requirements, including the logic for each state and sub-state within the ACC algorithm, which will guide the development process.
Description:
-
Creating 3 different subsystems for 3 different requirements. 3 subsystems are a) Lead Vehicle b) Drive Vehicle c) Adaptive Cruise Control Algorithm
-
a) Lead Vehicle subsystem: In this subsystem, there are two inputs CameraInput_LeadVehicle and RadarInput_LeadVehicle. These signals add up and provide LeadVehicle_Speed as an output.
-
b) Drive Vehicle subsystem: In this subsystem, there are three inputs CameraInput_DriveVehicle, RadarInput_DriveVehicle, and feedback input from 3rd subsystem (ACC's output). These signals add up and provide DriveVehicle_Speed as an output. RadarInput_DriveVehicle is used as LeadVehicle_Detected by using a signal conversion.
-
c) Adaptive Cruise Control Algorithm subsystem: This is the main control logic for ACC. There are 8 inputs to this subsystem like LeadVehicle_Speed, DriveVehicle_Speed, LeadVehicle_Detected, CruiseSwitch, SetSwitch, Time_Gap, Set_Speed, and Set_Gap.
-
Two switch blocks are used to choose the ACC ON, OFF, and STANDBY modes. If CruiseSwitch==0 then ACC OFF MODE will be operated which means the Acceleration_Mode=0. If CruiseSwitch==1 then it will go to the other switch where it will compare the SetSwitch value. If SetSwitch==0 then ACC STANDBY MODE will be operated which means the Acceleration_Mode=1, but if SetSwitch==1 then ACC ON MODE will be selected.
-
Inside ACC ON MODE we have six states, LeadVehicle_Detected_Follow, LeadVehicle_Not_Detected, LeadVehicle_Speed_lessthan_Set_Speed, LeadVehicle_Detected_Resume, LeadVehicle_Not_Detected_Resume, and LeadVehicle_Speed_equal_Set_Speed.
-
By comparing various input values different states are selected as per the real life condition. All the signals mentioned above are declared inside the SLDD.
(Dear TSE,
I've not performed code generation and requirement tagging tasks due to the unavailability of the option in Matlab version 2023a. Nevertheless, I have written below the steps required to perform the same.)
Code Generation Steps & Requirement Tagging:
-
Configuration Parameters -> Code Generation -> Target Selection -> System target file -> ert.tlc (Embedded Coder)
-
Coverage -> Enable coverage analysis -> Coverage metric -> Structural coverage level -> Modified Condition Decision Coverage (MCDC)
-
Press Ctrl + D to generate code for the model.
-
For Requirement tagging just right the subsystem -> Requirements -> Link to selection in 'WORD'
All the necessary screenshots and models are attached herewith.