All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
EV BATCH17 AIM: To develop a model of adaptive cruise control by using the matlab. Objective: Development of a MATLAB Simulink Model for Adaptive Cruise Control feature as per the requirement document following Model Based Development(MBD) related process.SLDD creation,configuration parameter changes,Model advisor check…
Mohmmed Riyaz
updated on 27 Jun 2022
EV BATCH17
AIM:
To develop a model of adaptive cruise control by using the matlab.
Objective:
Development of a MATLAB Simulink Model for Adaptive Cruise Control feature as per the requirement document following Model Based Development(MBD) related process.SLDD creation,configuration parameter changes,Model advisor check and code generation using embedded codel tool.
Overview:
Adaptive Cruise Control Feature for passenger cars allows the host vehicle to adapt to the speed in ine 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 distanec to the preceding vehicle.As a consequence,the driver enjoys more comfort & can concentrate on the road little better.
A radar sensor usually at the core of the Adaptive Cruise Control.Installed a the front of the vehicle,the system permanently monitors the road ahead.As long as the road ahead is clear,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 speed up or changes lanes,the cruise controll automatically accelerates to the drivers desired speed.
standard Adaptive Cruise Control can be activated from speeds of around 30 km/h (20mph) upwards and supports to the driver,primarily on cross-country journeys or on free ways.The cruise control stop & go variant is also activate at speeds below 30km/h(20mph).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 breifly stepping on the gas pedal return to cruise control mode.In this way,cruise control stop & go supports the driver even in heavy traffic and traffic jams.
since Adaptive Cruise control is the 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.
FIGURE:1 Schematic of intelligent Cruise Control,the red car automatically maintains a safe distance from blue car.
Model Development:
solver settings of Adaptive Cruise Control:
Figure:1.1 Solver Setup,Figure:1.2 Code Generation Setup.
Figure:1.3 Floating Point Setup.
Signals and calibration data:
Signal/Calibration Name | Signal Type | Data Type | Dimension | Min | Max | Initial Value | units |
CameraInput_LeadVehicle | Input | Uint8 | 1 | 0 | 255 | - | - |
RadarInput_LeadVehcicle | Input | Uint8 | 1 | 0 | 255 | - | - |
CameraInput_DriveVehicle | Input | Uint8 | 1 | 0 | 255 | - | - |
RadarInput_DriveVehicle | Input | Uint8 | 1 | 0 | 255 | - | - |
Time_Gap | Input | Uint8 | 1 | 0 | 255 | - | - |
Set_Speed | Input | Uint8 | 1 | 0 | 255 | - | - |
Set_Gap | Input | Uint8 | 1 | 0 | 255 | - | - |
CruiseSwitch | Input | Boolean | 1 | 0 | 1 | - | - |
SetSwitch | Input | Boolean | 1 | 0 | 1 | - | - |
Acceleration_Mode | Output | Uint8 | 1 | 0 | 255 | - | - |
LeadVehicle_Speed | Output | Uint8 | 1 | 0 | 255 | - | - |
DriveVehicle_Speed | Output | Uint8 | 1 | 0 | 255 | - | - |
LeadVehicle_Detected | Output | Uint8 | 1 | 0 | 255 | - | - |
Creation of Simulink Data Dictionary file (SLDD):
A Simulink Data Dictionary (SLDD)file is created that contains input,output signals and calibration parameters used in the model.SLDD file is created by clicking on Modelling.then 'Model Properties',then 'External Data' and specifying a file name for the Data Dictionary.
Figure:2 Data Dictionary file in Model Explorer
Adaptive Cruise Control Model:
The main subsystem 'Adaptive Cruise Control' with inputs of 'Camera_LeadVehicle','RadarInput_Leadvehicle' ,'CameraInput_DriveVehicle','RadarInput_DriveVehcile','CruiseSwitch','Tine_Gap','Set_Speed','Set_Gap','SetSwitch'and Output is 'Acceleration_Mode' is shown below:
Figure:3 Adaptive Cruise Control Model
The Main Subsystem is further Divided into three more subsystems which are 'Requirement1-LeadVehicle','Requirement2-DriveVehicle' and 'Requiremnet3-ACC ON MODE' are shown below.
Figure:4 Lead_Vehicle,Drive_Vehicle and ACC_Algorithm subsystems present inside.
Requirement 1-LeadVehicle:
Figure:5 Lead_Vehicle subsytem.
Requirement:2- Drive Vehicle:
Figure:6 Drive_Vehicle substem
Requirement 3-Adaptive Cruise Control Algorithm:
Figure:7 State Machine Chart ACC_Algorithm subsystem for requirement 3.
Requirement 3a-ACC OFF MODE state logic:
Requirement 3b-ACC STANDBY MODE state logic:
This is the second activated state inside state Machine logic :Output signal Acceleration_Mode is at value 1 in this state.
if CuiseSwitch is equal to 1,state ACC STANDBY model will get Activated.If CruiseSwitch is equal to 0,state ACC OFF mode will get Activated,from either ACC_ON mode or ACC STANDBY mode.
If SetSwitch is equal to 1,state ACC ON mode will get activated.if SetSwitch is equal to 0,state ACC STANDBY mode will get Activated.
Requirement 3c-ACC ON MODE state logic:
This state will be activated when input signal SetSwitch is equal to 1.there are 6 Substates to the state logic:they are:
Requirement 3c(i)-LeadVehicle_Detected_Follow(AC ON MODE):
Requirement 3c(ii)-LeadVehicle_Not_Detected(ACC ON MODE):
Requirement 3c(iii)-LeadVehicle_Detected_Resume(ACC ON MODE):
Requirement 3c(iv)-LeadVehicle_Not_Deteced_Resume(ACC ON MODE):
Requirement 3c(v)-LeadVehicle_Speed_lessthan_set_speed(ACC ON MODE):
Requirement 3c(vi)-LeadVehicle_Speed_equal_Set_Speed(ACC ON MODE):
Figure:8 ACC_Logic chart in ACC_Algorithm subsystem.
Requirement Tagging of Simulink Model:
The requirements 'Requirement 1','Requirement 2', and 'Requiremnt 3' as provided in the Requirements Word document are tagged to theri corressponding subsystem in the Simulink Model.
The Steps involved in tagging a requirement in the Simulink model is to first highlight the requirement in the Word document,then right click on the subsystem in the model that has to be tagged,then select 'Requirements' and then 'Link to Selection inWord'.
Figure:9 Highlighting the requirement to be tagged in the requirement Word document.
Figure:10 Tagging 'LeadVehicle' subsystem to its requirement in Word document.
MAAB Guidliness Check in Model Advisor:
A check is performed using 'Model Advisor' tool in Simulink to see Whether the developed model meets the modeling standards for MAAB.
Generated report should be showned below:
Figure:11 Model Advisor Report for MAAB guideliness check.
Generation of C-Code from model:
Using the embeded Coder tool in MATLAB,C code is generated for the model.
Figure:11 C code generation using embeded coder in MATLAB.
C-Codes:
The Code is transferred to the ECU of the Vehicle.The Code is Created Based on our Model behaviour (i.e.if-else condition).
The generated code should be attached below:
/*
* File: Adaptive_cruise_control.c
*
* Code generated for Simulink model 'Adaptive_cruise_control'.
*
* Model version : 1.30
* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
* C/C++ source code generated on : Mon Jun 27 10:41:47 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Adaptive_cruise_control.h"
#include "Adaptive_cruise_control_private.h"
/* Named constants for Chart: '/ACC_Logic' */
#define Ada_IN_LeadVehicle_Not_Detected ((uint8_T)3U)
#define Adaptive_cr_IN_ACC_STANDBY_MODE ((uint8_T)3U)
#define Adaptive_cru_IN_NO_ACTIVE_CHILD ((uint8_T)0U)
#define Adaptive_cruise_IN_ACC_OFF_MODE ((uint8_T)1U)
#define Adaptive_cruise__IN_ACC_ON_MODE ((uint8_T)2U)
#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)
/* Exported data definition */
/* Definition for custom storage class: ExportToFile */
uint8_T Acceleration_Mode; /* '/Unit_Delay' */
uint8_T DriveVehicle_Speed; /* '/Add' */
uint8_T LeadVehicle_Detected; /* '/Signal Conversion' */
uint8_T LeadVehicle_Speed; /* '/Add' */
/* Block states (default storage) */
DW_Adaptive_cruise_control_T Adaptive_cruise_control_DW;
/* External outputs (root outports fed by signals with default storage) */
ExtY_Adaptive_cruise_control_T Adaptive_cruise_control_Y;
/* Real-time model */
RT_MODEL_Adaptive_cruise_cont_T Adaptive_cruise_control_M_;
RT_MODEL_Adaptive_cruise_cont_T *const Adaptive_cruise_control_M =
&Adaptive_cruise_control_M_;
/* Forward declaration for local functions */
static void Adaptive_cruise_con_ACC_ON_MODE(void);
real_T rt_roundd_snf(real_T u)
{
real_T y;
if (fabs(u) < 4.503599627370496E+15) {
if (u >= 0.5) {
y = floor(u + 0.5);
} else if (u > -0.5) {
y = u * 0.0;
} else {
y = ceil(u - 0.5);
}
} else {
y = u;
}
return y;
}
/* Function for Chart: '/ACC_Logic' */
static void Adaptive_cruise_con_ACC_ON_MODE(void)
{
int32_T tmp;
int32_T tmp_0;
uint8_T tmp_1;
uint8_T tmp_2;
/* Inport: '/CruiseSwitch' incorporates:
* Inport: '/SetSwitch'
*/
if (!CruiseSwitch) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE = Adaptive_cru_IN_NO_ACTIVE_CHILD;
Adaptive_cruise_control_DW.is_c3_Adaptive_cruise_control =
Adaptive_cruise_IN_ACC_OFF_MODE;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 0U;
} else if (!SetSwitch) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE = Adaptive_cru_IN_NO_ACTIVE_CHILD;
Adaptive_cruise_control_DW.is_c3_Adaptive_cruise_control =
Adaptive_cr_IN_ACC_STANDBY_MODE;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
} else {
switch (Adaptive_cruise_control_DW.is_ACC_ON_MODE) {
case IN_LeadVehicle_Detected_Follow:
/* Outport: '/Acceleration_Mode' */
/* Inport: '/Set_Gap' incorporates:
* Inport: '/Set_Speed'
* Inport: '/Time_Gap'
*/
Adaptive_cruise_control_Y.Acceleration_Mode_p = 2U;
if (LeadVehicle_Detected == 0) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
Ada_IN_LeadVehicle_Not_Detected;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
} else {
if (((LeadVehicle_Detected == 1) && (LeadVehicle_Speed < Set_Speed)) ||
(Time_Gap < Set_Gap)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Speed_lessthan_S;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 4U;
}
}
break;
case IN_LeadVehicle_Detected_Resume:
/* Outport: '/Acceleration_Mode' */
/* Inport: '/Set_Gap' incorporates:
* Inport: '/Set_Speed'
* Inport: '/Time_Gap'
*/
Adaptive_cruise_control_Y.Acceleration_Mode_p = 3U;
if (LeadVehicle_Detected == 0) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Not_Detected_Res;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
} else if ((DriveVehicle_Speed < Set_Speed) && (LeadVehicle_Speed >
DriveVehicle_Speed) && (Time_Gap >= Set_Gap)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Speed_equal_Set_;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 5U;
} else {
if ((DriveVehicle_Speed == Set_Speed) && (LeadVehicle_Speed >= Set_Speed)
&& (Time_Gap >= Set_Gap)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Detected_Follow;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 2U;
}
}
break;
case Ada_IN_LeadVehicle_Not_Detected:
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
/* Inport: '/Set_Speed' incorporates:
* Inport: '/Set_Gap'
* Inport: '/Time_Gap'
*/
if (((LeadVehicle_Detected == 1) && (LeadVehicle_Speed < Set_Speed)) ||
(Time_Gap < Set_Gap)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Speed_lessthan_S;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 4U;
} else {
if ((LeadVehicle_Detected == 1) && (DriveVehicle_Speed == Set_Speed) &&
(LeadVehicle_Speed >= Set_Speed) && (Time_Gap >= Set_Gap)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Detected_Follow;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 2U;
}
}
break;
case IN_LeadVehicle_Not_Detected_Res:
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
break;
case IN_LeadVehicle_Speed_equal_Set_:
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 5U;
/* Inport: '/Set_Speed' incorporates:
* Inport: '/Set_Gap'
* Inport: '/Time_Gap'
*/
if ((LeadVehicle_Detected == 0) || (DriveVehicle_Speed <= Set_Speed)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Not_Detected_Res;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
} else if (((DriveVehicle_Speed < Set_Speed) && (LeadVehicle_Speed >
DriveVehicle_Speed)) || (Time_Gap >= Set_Gap)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Detected_Resume;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 3U;
} else {
if (((LeadVehicle_Speed < Set_Speed) && (LeadVehicle_Speed <
DriveVehicle_Speed)) || ((int32_T)rt_roundd_snf(0.75 * (real_T)
Set_Gap) == Time_Gap)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Speed_lessthan_S;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 4U;
}
}
break;
default:
/* Outport: '/Acceleration_Mode' */
/* case IN_LeadVehicle_Speed_lessthan_Set_Speed: */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 4U;
/* Inport: '/Set_Speed' */
if ((LeadVehicle_Detected == 0) && (DriveVehicle_Speed == Set_Speed)) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
Ada_IN_LeadVehicle_Not_Detected;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
} else {
tmp = (int32_T)rt_roundd_snf((real_T)LeadVehicle_Speed * 1.25);
/* Inport: '/Set_Gap' */
tmp_0 = (int32_T)rt_roundd_snf(1.25 * (real_T)Set_Gap);
if (tmp < 256) {
tmp_1 = (uint8_T)tmp;
} else {
tmp_1 = MAX_uint8_T;
}
if (tmp_0 < 256) {
tmp_2 = (uint8_T)tmp_0;
} else {
tmp_2 = MAX_uint8_T;
}
/* Inport: '/Time_Gap' incorporates:
* Inport: '/Set_Gap'
*/
if ((tmp_1 >= DriveVehicle_Speed) && ((int32_T)rt_roundd_snf((real_T)
LeadVehicle_Speed * 0.75) <= DriveVehicle_Speed) &&
(DriveVehicle_Speed < Set_Speed) && (Time_Gap <= tmp_2) && (Time_Gap
>= (int32_T)rt_roundd_snf(0.75 * (real_T)Set_Gap))) {
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Speed_equal_Set_;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 5U;
}
}
break;
}
}
/* End of Inport: '/CruiseSwitch' */
}
/* Model step function */
void Adaptive_cruise_control_step(void)
{
/* SignalConversion: '/Signal Conversion' incorporates:
* Inport: '/RadarInput_DriveVehicle'
*/
LeadVehicle_Detected = RadarInput_DriveVehicle;
/* UnitDelay: '/Unit_Delay' */
Acceleration_Mode = Adaptive_cruise_control_DW.Unit_Delay_DSTATE;
/* Sum: '/Add' incorporates:
* Inport: '/CameraInput_DriveVehicle '
* Inport: '/RadarInput_DriveVehicle'
*/
DriveVehicle_Speed = (uint8_T)((uint32_T)(uint8_T)((uint32_T)Acceleration_Mode
+ CameraInput_DriveVehicle) + RadarInput_DriveVehicle);
/* Sum: '/Add' incorporates:
* Inport: '/CameraInput_LeadVehicle'
* Inport: '/RadarInput_LeadVehicle'
*/
LeadVehicle_Speed = (uint8_T)((uint32_T)CameraInput_LeadVehicle +
RadarInput_LeadVehicle);
/* Chart: '/ACC_Logic' incorporates:
* Inport: '/CruiseSwitch'
* Inport: '/SetSwitch'
*/
if (Adaptive_cruise_control_DW.is_active_c3_Adaptive_cruise_co == 0U) {
Adaptive_cruise_control_DW.is_active_c3_Adaptive_cruise_co = 1U;
Adaptive_cruise_control_DW.is_c3_Adaptive_cruise_control =
Adaptive_cruise_IN_ACC_OFF_MODE;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 0U;
} else {
switch (Adaptive_cruise_control_DW.is_c3_Adaptive_cruise_control) {
case Adaptive_cruise_IN_ACC_OFF_MODE:
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 0U;
if (CruiseSwitch) {
Adaptive_cruise_control_DW.is_c3_Adaptive_cruise_control =
Adaptive_cr_IN_ACC_STANDBY_MODE;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
}
break;
case Adaptive_cruise__IN_ACC_ON_MODE:
Adaptive_cruise_con_ACC_ON_MODE();
break;
default:
/* Outport: '/Acceleration_Mode' */
/* case IN_ACC_STANDBY_MODE: */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 1U;
if (!CruiseSwitch) {
Adaptive_cruise_control_DW.is_c3_Adaptive_cruise_control =
Adaptive_cruise_IN_ACC_OFF_MODE;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 0U;
} else {
if (SetSwitch) {
Adaptive_cruise_control_DW.is_c3_Adaptive_cruise_control =
Adaptive_cruise__IN_ACC_ON_MODE;
Adaptive_cruise_control_DW.is_ACC_ON_MODE =
IN_LeadVehicle_Detected_Follow;
/* Outport: '/Acceleration_Mode' */
Adaptive_cruise_control_Y.Acceleration_Mode_p = 2U;
}
}
break;
}
}
/* End of Chart: '/ACC_Logic' */
/* Update for UnitDelay: '/Unit_Delay' incorporates:
* Outport: '/Acceleration_Mode'
*/
Adaptive_cruise_control_DW.Unit_Delay_DSTATE =
Adaptive_cruise_control_Y.Acceleration_Mode_p;
}
/* Model initialize function */
void Adaptive_cruise_control_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Adaptive_cruise_control_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
ert main.C:
/*
* File: ert_main.c
*
* Code generated for Simulink model 'Adaptive_cruise_control'.
*
* Model version : 1.30
* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
* C/C++ source code generated on : Mon Jun 27 10:41:47 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include
#include /* This ert_main.c example uses printf/fflush */
#include "Adaptive_cruise_control.h" /* Model's header file */
#include "rtwtypes.h"
/*
* Associating rt_OneStep with a real-time clock or interrupt service routine
* is what makes the generated code "real-time". The function rt_OneStep is
* always associated with the base rate of the model. Subrates are managed
* by the base rate from inside the generated code. Enabling/disabling
* interrupts and floating point context switches are target specific. This
* example code indicates where these should take place relative to executing
* the generated code step function. Overrun behavior should be tailored to
* your application needs. This example simply sets an error status in the
* real-time model and returns from rt_OneStep.
*/
void rt_OneStep(void);
void rt_OneStep(void)
{
static boolean_T OverrunFlag = false;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
rtmSetErrorStatus(Adaptive_cruise_control_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
/* Step the model */
Adaptive_cruise_control_step();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
/*
* The example "main" function illustrates what is required by your
* application code to initialize, execute, and terminate the generated code.
* Attaching rt_OneStep to a real-time clock is target specific. This example
* illustrates how you do this relative to initializing the model.
*/
int_T main(int_T argc, const char *argv[])
{
/* Unused arguments */
(void)(argc);
(void)(argv);
/* Initialize model */
Adaptive_cruise_control_initialize();
/* Attach rt_OneStep to a timer or interrupt service routine with
* period 0.01 seconds (the model's base sample time) here. The
* call syntax for rt_OneStep is
*
* rt_OneStep();
*/
printf("Warning: The simulation will run forever. "
"Generated ERT main won't simulate model step behavior. "
"To change this behavior select the 'MAT-file logging' option.\n");
fflush((NULL));
while (rtmGetErrorStatus(Adaptive_cruise_control_M) == (NULL)) {
/* Perform other application tasks here */
}
/* Disable rt_OneStep() here */
/* Terminate model */
Adaptive_cruise_control_terminate();
return 0;
}
/*
* File trailer for generated code.
*
* [EOF]
*/
CONCLUSION:
Adaptive Cruise Control has been Created successfully by using the matlab.
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 2
AIM: To develop the forward energy-based fuel Consumption model of a P1 hybrid vehicle by using the matlab and simulink. Overview: 1. Hybrid Electric vehicle: Using the Two or more energy sources to propulsion system in driving is called the Hybrid Electric Vehicle. Conventionally,petroleum fuel based energy source (Petrol,deisel,etc..)via…
30 Jun 2022 03:17 PM IST
Project 2 Adaptive Cruise Control
EV BATCH17 AIM: To develop a model of adaptive cruise control by using the matlab. Objective: Development of a MATLAB Simulink Model for Adaptive Cruise Control feature as per the requirement document following Model Based Development(MBD) related process.SLDD creation,configuration parameter changes,Model advisor check…
27 Jun 2022 07:56 AM IST
Project 1 (Mini Project on Vehicle Direction Detection
AIM: To develop the model of vehicle direction by using the matlab. OBJECTIVE: The objective of this project is to create a MBD complaint MATLAB Simulink model for a vehicle direction dectection as per the requirement specified. Tag the requirements to the simulink model;Requirement 1 & Requirement 2 are tagged…
26 Jun 2022 06:30 AM IST
Project 2 Thermal modeling of battery pack
EV BATCH17 AIM: To design a 10 series lithium ion battery model,simulate the thermal effects by using the matlab. abstract: Lithium ion (Li-ion) battery pack is a complex system consisting of numerous cells connected in parallel and series. The performance of the pack is highly dependent on the health of each individual…
18 Jun 2022 09:46 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.