All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim: Design the model of Adaptive Cruise Control (ACC). ABSTRACT: In this project, we going to build the MATLAB model of Adaptive Cruise Control (ACC) by using Simulink blocks and suitable input and output signals in SLDD. Before that, we will know about what is Adaptive…
prathamesh chungadi
updated on 10 Jul 2021
Aim: Design the model of Adaptive Cruise Control (ACC).
ABSTRACT: In this project, we going to build the MATLAB model of Adaptive Cruise Control (ACC) by using Simulink blocks and suitable input and output signals in SLDD. Before that, we will know about what is Adaptive Cruise Control (ACC), how it works, and the benefits of Adaptive Cruise Control (ACC). Then we make an actual model in SIMULINK with suitable blocks from the Simulink block set.
OBJECTIVE:
METHODOLOGY:
THEORY:
Adaptive Cruise Control Feature for passenger cars allows the host vehicle to adapt to the speed in line with the flow of traffic. Driving in heavy traffic or keeping a safe distance to the preceding vehicle calls for a high level of concentration. The Adaptive Cruise Control feature can reduce the stress on the driver by automatically controlling the vehicle speed & maintaining a predefined minimum distance to the preceding vehicle. As a consequence, the driver enjoys more comfort & can concentrate on the road a little better.
A radar sensor is usually at the core of the Adaptive Cruise Control. Installed at the front of the vehicle, the system permanently monitors the road ahead. As long as the road ahead is clear, the cruise control feature maintains the speed set by the driver. If the system spots a slower vehicle within its detection range, it gently reduces speed by releasing the accelerator or actively engaging the brake control system. If the vehicle ahead speeds up or changes lanes, the cruise control automatically accelerates to the driver’s desired speed.
Standard Adaptive Cruise Control can be activated from speeds of around 30 km/h (20 mph) upwards and supports the driver, primarily on cross-country journeys or on freeways. The cruise control stops & go variant is also active at speeds below 30 km/h (20 mph). It can maintain the set distance to the preceding vehicle even at very low speeds and can decelerate to a complete standstill. When the vehicle remains stopped longer, the driver needs only to reactivate the system, for example by briefly stepping on the gas pedal to return to cruise control mode. In this way, cruise control stops & go supports the driver even in heavy traffic and traffic jams.
Since Adaptive Cruise Control is a comfort and convenience system, brake interventions and vehicle acceleration only take place within defined limits. Even with Adaptive Cruise Control switched on, it remains the driver’s responsibility to monitor the speed and distance from the vehicle in front.
Adaptive cruise control (ACC) is an active safety system that automatically controls the acceleration and braking of a vehicle. It is activated through a button on the steering wheel and canceled by the driver's braking and/or another button. It does so by helping the driver keep a steady vehicle speed at a given moment.
MODEL:
Subsystem:
Logic in Flow chart:
After that we did a model adviser report is added.
No fails with 29 warnings.
After that we generate the code :
/*
* File: ACC_model.c
*
* Code generated for Simulink model 'ACC_model'.
*
* Model version : 1.1
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
* C/C++ source code generated on : Fri Jul 2 13:47:36 2021
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "ACC_model.h"
#include "ACC_model_private.h"
/* Named constants for Chart: '<S1>/Chart' */
#define ACC_IN_LeadVehicle_Not_Detected ((uint8_T)3U)
#define ACC_model_IN_NO_ACTIVE_CHILD ((uint8_T)0U)
#define ACC_model_IN_OFF_mode ((uint8_T)1U)
#define ACC_model_IN_ON_mode ((uint8_T)2U)
#define ACC_model_IN_Standby_mode ((uint8_T)3U)
#define IN_LeadVehicle_Detected_Follow ((uint8_T)1U)
#define IN_LeadVehicle_Detected_Resume ((uint8_T)2U)
#define IN_LeadVehicle_Not_Detected_Res ((uint8_T)4U)
#define IN_LeadVehicle_Speed_equal_Set_ ((uint8_T)5U)
#define IN_LeadVehicle_Speed_lessthan_S ((uint8_T)6U)
/* Block states (default storage) */
DW_ACC_model_T ACC_model_DW;
/* External inputs (root inport signals with default storage) */
ExtU_ACC_model_T ACC_model_U;
/* External outputs (root outports fed by signals with default storage) */
ExtY_ACC_model_T ACC_model_Y;
/* Real-time model */
static RT_MODEL_ACC_model_T ACC_model_M_;
RT_MODEL_ACC_model_T *const ACC_model_M = &ACC_model_M_;
/* Model step function */
void ACC_model_step(void)
{
/* Outputs for Atomic SubSystem: '<Root>/Subsystem2' */
/* Sum: '<S4>/Add' incorporates:
* Inport: '<Root>/CameraInput_DriveVehicle'
* Inport: '<Root>/RadarInput_DriveVehicle'
* UnitDelay: '<S1>/Unit Delay'
*/
ACC_model_Y.DriveVehicle_Speed = (ACC_model_U.CameraInput_DriveVehicle +
ACC_model_Y.Acceleration_Mode) + ACC_model_U.RadarInput_DriveVehicle;
/* Sum: '<S3>/Add' incorporates:
* Inport: '<Root>/CameraInput_LeadVehicle'
* Inport: '<Root>/RadarInput_LeadVehicle'
*/
ACC_model_Y.LeadVehicle_Speed = ACC_model_U.CameraInput_LeadVehicle +
ACC_model_U.RadarInput_LeadVehicle;
/* Chart: '<S1>/Chart' incorporates:
* Inport: '<Root>/CruiseSwitch'
* Inport: '<Root>/RadarInput_DriveVehicle'
* Inport: '<Root>/SetSwitch'
* Inport: '<Root>/Set_Gap'
* Inport: '<Root>/Set_Speed'
* Inport: '<Root>/Time_Gap'
* UnitDelay: '<S1>/Unit Delay'
*/
if (ACC_model_DW.is_active_c3_ACC_model == 0U) {
ACC_model_DW.is_active_c3_ACC_model = 1U;
ACC_model_DW.is_c3_ACC_model = ACC_model_IN_OFF_mode;
ACC_model_Y.Acceleration_Mode = 0.0;
} else {
switch (ACC_model_DW.is_c3_ACC_model) {
case ACC_model_IN_OFF_mode:
ACC_model_Y.Acceleration_Mode = 0.0;
if (ACC_model_U.CruiseSwitch == 1.0) {
ACC_model_DW.is_c3_ACC_model = ACC_model_IN_Standby_mode;
ACC_model_Y.Acceleration_Mode = 1.0;
}
break;
case ACC_model_IN_ON_mode:
if (ACC_model_U.CruiseSwitch == 0.0) {
ACC_model_DW.is_ON_mode = ACC_model_IN_NO_ACTIVE_CHILD;
ACC_model_DW.is_c3_ACC_model = ACC_model_IN_OFF_mode;
ACC_model_Y.Acceleration_Mode = 0.0;
} else if (ACC_model_U.SetSwitch == 0.0) {
ACC_model_DW.is_ON_mode = ACC_model_IN_NO_ACTIVE_CHILD;
ACC_model_DW.is_c3_ACC_model = ACC_model_IN_Standby_mode;
ACC_model_Y.Acceleration_Mode = 1.0;
} else {
switch (ACC_model_DW.is_ON_mode) {
case IN_LeadVehicle_Detected_Follow:
ACC_model_Y.Acceleration_Mode = 2.0;
if (ACC_model_U.RadarInput_DriveVehicle == 0.0) {
ACC_model_DW.is_ON_mode = ACC_IN_LeadVehicle_Not_Detected;
ACC_model_Y.Acceleration_Mode = 1.0;
} else if (((ACC_model_U.RadarInput_DriveVehicle == 1.0) &&
(ACC_model_Y.LeadVehicle_Speed < ACC_model_U.Set_Speed)) ||
(ACC_model_U.Time_Gap < ACC_model_U.Set_Gap)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Speed_lessthan_S;
ACC_model_Y.Acceleration_Mode = 4.0;
}
break;
case IN_LeadVehicle_Detected_Resume:
ACC_model_Y.Acceleration_Mode = 3.0;
if ((ACC_model_Y.DriveVehicle_Speed < ACC_model_U.Set_Speed) &&
(ACC_model_Y.LeadVehicle_Speed > ACC_model_Y.DriveVehicle_Speed) &&
(ACC_model_U.Time_Gap >= ACC_model_U.Set_Gap)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Speed_equal_Set_;
ACC_model_Y.Acceleration_Mode = 5.0;
} else if ((ACC_model_Y.DriveVehicle_Speed == ACC_model_U.Set_Speed) &&
(ACC_model_Y.LeadVehicle_Speed >= ACC_model_U.Set_Speed) &&
(ACC_model_U.Time_Gap >= ACC_model_U.Set_Gap)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Detected_Follow;
ACC_model_Y.Acceleration_Mode = 2.0;
} else if (ACC_model_U.RadarInput_DriveVehicle == 0.0) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Not_Detected_Res;
ACC_model_Y.Acceleration_Mode = 1.0;
}
break;
case ACC_IN_LeadVehicle_Not_Detected:
ACC_model_Y.Acceleration_Mode = 1.0;
if ((ACC_model_U.RadarInput_DriveVehicle == 1.0) &&
(ACC_model_Y.DriveVehicle_Speed == ACC_model_U.Set_Speed) &&
(ACC_model_Y.LeadVehicle_Speed >= ACC_model_U.Set_Speed) &&
(ACC_model_U.Time_Gap >= ACC_model_U.Set_Gap)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Detected_Follow;
ACC_model_Y.Acceleration_Mode = 2.0;
} else if (((ACC_model_U.RadarInput_DriveVehicle == 1.0) &&
(ACC_model_Y.LeadVehicle_Speed < ACC_model_U.Set_Speed)) ||
(ACC_model_U.Time_Gap < ACC_model_U.Set_Gap)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Speed_lessthan_S;
ACC_model_Y.Acceleration_Mode = 4.0;
}
break;
case IN_LeadVehicle_Not_Detected_Res:
ACC_model_Y.Acceleration_Mode = 1.0;
break;
case IN_LeadVehicle_Speed_equal_Set_:
ACC_model_Y.Acceleration_Mode = 5.0;
if ((ACC_model_U.RadarInput_DriveVehicle == 0.0) ||
(ACC_model_Y.DriveVehicle_Speed <= ACC_model_U.Set_Speed)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Not_Detected_Res;
ACC_model_Y.Acceleration_Mode = 1.0;
} else if (((ACC_model_Y.DriveVehicle_Speed < ACC_model_U.Set_Speed) &&
(ACC_model_Y.LeadVehicle_Speed >
ACC_model_Y.DriveVehicle_Speed)) || (ACC_model_U.Time_Gap
>= ACC_model_U.Set_Gap)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Detected_Resume;
ACC_model_Y.Acceleration_Mode = 3.0;
} else if (((ACC_model_Y.LeadVehicle_Speed < ACC_model_U.Set_Speed) &&
(ACC_model_Y.LeadVehicle_Speed <
ACC_model_Y.DriveVehicle_Speed)) || (0.75 *
ACC_model_U.Set_Gap == ACC_model_U.Time_Gap)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Speed_lessthan_S;
ACC_model_Y.Acceleration_Mode = 4.0;
}
break;
default:
/* case IN_LeadVehicle_Speed_lessthan_Set_Speed: */
ACC_model_Y.Acceleration_Mode = 4.0;
if ((ACC_model_U.RadarInput_DriveVehicle == 0.0) &&
(ACC_model_Y.DriveVehicle_Speed == ACC_model_U.Set_Speed)) {
ACC_model_DW.is_ON_mode = ACC_IN_LeadVehicle_Not_Detected;
ACC_model_Y.Acceleration_Mode = 1.0;
} else if ((ACC_model_Y.LeadVehicle_Speed * 1.25 >=
ACC_model_Y.DriveVehicle_Speed) &&
(ACC_model_Y.LeadVehicle_Speed * 0.75 <=
ACC_model_Y.DriveVehicle_Speed) &&
(ACC_model_Y.DriveVehicle_Speed < ACC_model_U.Set_Speed) &&
(ACC_model_U.Time_Gap <= 1.25 * ACC_model_U.Set_Gap) &&
(ACC_model_U.Time_Gap >= 0.75 * ACC_model_U.Set_Gap)) {
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Speed_equal_Set_;
ACC_model_Y.Acceleration_Mode = 5.0;
}
break;
}
}
break;
default:
/* case IN_Standby_mode: */
ACC_model_Y.Acceleration_Mode = 1.0;
if (ACC_model_U.CruiseSwitch == 0.0) {
ACC_model_DW.is_c3_ACC_model = ACC_model_IN_OFF_mode;
ACC_model_Y.Acceleration_Mode = 0.0;
} else if (ACC_model_U.SetSwitch == 1.0) {
ACC_model_DW.is_c3_ACC_model = ACC_model_IN_ON_mode;
ACC_model_DW.is_ON_mode = IN_LeadVehicle_Detected_Follow;
ACC_model_Y.Acceleration_Mode = 2.0;
}
break;
}
}
/* End of Chart: '<S1>/Chart' */
/* End of Outputs for SubSystem: '<Root>/Subsystem2' */
/* Outport: '<Root>/LeadVehicle_Detected ' incorporates:
* Inport: '<Root>/RadarInput_DriveVehicle'
*/
ACC_model_Y.LeadVehicle_Detected = ACC_model_U.RadarInput_DriveVehicle;
}
/* Model initialize function */
void ACC_model_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void ACC_model_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
Conclusion: As per requirement we build the model get the adviser report and generate the code.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Project 1
Motor power (Po) = 5 hp = 3.75 KW Motor required voltage (V) = 230 V Motor operating frequency (F) = 60 Hz Stator poles (p) = 4 Stator resistance (rs) = 0.513Ω Rotor resistance (rf) = 0.408Ω Motor inertia (J) = 0.1 Kg−m2 Stator inductance (L1s) = 2.52 mH Rotor inductance (L1r) = 2.52…
13 Oct 2023 05:35 PM IST
Project 1- Traffic Jam Assistant Feature
Objective: To develop one specific requirement of the Traffic Jam Assistant algorithm which would predominantly feature in the IPC algorithm. Requirements: This model must be developed in MATLAB Simulink as per MBD guidelines. Code Generation Profile must be in Embedded Coder. Simulink Data Dictionary must be created…
28 Jul 2021 08:13 PM IST
Project 1 CUK converter
Objective: Design the CUK converter in both Discuntinues Conduction Mode and Continues Conduction Mode. Design Parameters/ Given Data: 1) Input Voltage: 30V to 60V. …
14 Jul 2021 09:21 AM IST
Project 2 interleaving DC/DC converter
Objective: Design an interleaving DC/DC converter system for a data center application with the following specifications: • Input voltage: 45 – 60 v• Output voltage: 3 V• Output current: 100A• Efficiency > 85% (extra credit for efficiency higher than 90% on a spice-based software simulation…
14 Jul 2021 09:20 AM IST
Related Courses
8 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.