Project 2 Adaptive Cruise Control
ADAPTIVE CRUISE CONTROL
AIM OF THE PROJECT:
To determine the Adaptive Cruise Control based on the given Information.
OBJECTIVE OF MINI PROJECT:
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 intelligent form of cruise control that slows down and speeds up automatically to keep pace with the car in front of you. The driver sets the maximum speed — just as with cruise control — then a radar sensor watches for traffic ahead, locks on to the car in a lane, and instructs the car to stay 2, 3, or 4 seconds behind the person car ahead of it (the driver sets the follow distance, within reason). ACC is now almost always paired with a pre-crash system that alerts you and often begins braking.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 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, 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 stop & 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 stop & 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.
INTRODUCTION:
Adaptive Cruise Control (ACC) extends existing cruise control systems to include a headway sensor that monitors the distance between your vehicle and the vehicle ahead. The system is also sometimes called Active Cruise Control (ACC) or Intelligent Cruise Control (ICC). ACC systems are similar to the conventional cruise control systems in the way they maintain the vehicle preset speed. However, unlike conventional systems, ACC automatically adjusts the speed of the vehicle in order to maintain a safe distance from vehicles ahead in the same lane. The system automatically monitors road traffic patterns, employing a headway sensor capable of detecting vehicles at distances up to 500 ft, and using the throttle and brakes to maintain a pre-set distance behind the vehicle ahead. When the road is clear again, the system re-accelerates to the pre-set velocity.
There are two key types of headway sensors. Radar sensors employ microwave signals (typically at 35 or 76 GHz). Lidar sensors employ a laser diode to produce infrared light signals. Both types of sensors send a signal and monitor the time required for the signal to reflect off the object ahead. Optical or infrared image sensors are also being introduced for the purpose of detecting vehicles on the road ahead. These sensors can replace or supplement the information from radar or lidar sensors.
When ACC systems determine there is a need to slow the vehicle, they may use the engine, transmission and/or brakes to decrease the vehicle's speed and maintain a safe following distance. Many systems limit the maximum deceleration to no more than 3 m/s2 (10 ft/s2), although systems are beginning to appear that allow more aggressive braking The ACC user interface typically has both visual and audible indications that are provided to the driver depending on the severity of the situation. ACC systems can always be disengaged through the use of the brake pedal or the primary ACC user interface. In addition, certain stability systems such as traction control may also turn the ACC system off. ACC systems are evolving rapidly and are currently available on many mid- to high-end passenger cars as well as many heavy duty commercial truck
DEVELOPMENT OF MODEL:
STEP1:
By using the following Requirement , we develop a model
Requirement 1– Lead Vehicle:
- Lead Vehicle is a vehicle which is driving in the road ahead of our drive vehicle. Two input signals (Signal Name: CameraInput_LeadVehicle & RadarInput_LeadVehicle).
- Ideally sensor fusion techniques will be deployed to process & analyze data from camera & radar. For complexity reasons, let’s not adapt to any such algorithms.
- We can simply add both the radar & camera inputs & the corresponding output is read as Speed profile output (Signal Name: LeadVehicle_Speed).
- Speed data of the lead vehicle is critical in implementing the Adaptive Cruise Control algorithm.

Requirement 2 – Drive Vehicle:
- Drive Vehicle is the vehicle driven by the user & this is the vehicle which has ACC algorithm in it.
- Like the Lead Vehicle, Drive Vehicle algorithm also has 2 input signals (Signal Name: CameraInput_DriveVehicle, RadarInput_DriveVehicle) & one signal coming as an Input to this subsystem (Signal Name: Acceleration_Mode) – three inputs into this requirement in total.
- Like the above requirement, sensor fusion techniques will also be deployed here, for complexity reasons we are ignoring them.
- Two output signals come from this subsystem (Signal Name: DriveVehicle_Speed & LeadVehicle_Detected).
- Signal DriveVehicle_Speed is summation of three input signals mentioned above & LeadVehicle_Detected is renamed from Input Signal RadarInput_DriveVehicle by mere use of Signal Conversion block.

Requirement 3 – Adaptive Cruise Control Algorithm:
- Adaptive Cruise Control feature has 3 major modes of operation: OFF Mode, STANDBY Mode & ON Mode. This particular requirement has to be implemented as state machine logic in Simulink.
- The input signals to this state machine system are (Signal Name: Time_Gap, Set_Speed, Set_Gap, CruiseSwitch, SetSwitch).
- Also, the output signals (Signal Name: DriveVehicle_Speed & LeadVehicle_Detected) from requirement-2 is fed back as an input signal into this state machine block.
- Additionally, output signal (Signal Name: LeadVehicle_Speed) from requirement-1 is given as an input signal to this state machine block as well.
- Output from this subsystem is a signal (Signal Name: Acceleration_Mode) which governs the vehicular speed of the drive vehicle which automatically adjusts its speed & velocity to match the lead vehicle.

Requirement 3a – ACC OFF MODE state logic:
- This is the default state inside state machine logic. Output signal Acceleration_Mode is at value 0 in this state.
- This state is governed by input signal CruiseSwitch.
- If CruiseSwitch is equal to 1, state ACC STANDBY mode 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

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.
- This state is governed by both input signals CruiseSwitch & SetSwitch.
- If CruiseSwitch is equal to 1, state ACC STANDBY mode 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 sub states to this state logic: They are:
- LeadVehicle_Detected_Follow (Default)
- LeadVehicle_Not_Detected
- LeadVehicle_Detected_Resume
- LeadVehicle_Not_Detected_Resume
- LeadVehicle_Speed_lessthan_Set_Speed
- LeadVehicle_Speed_equal_Set_Speed
Requirement 3c (i) – LeadVehicle_Detected_Follow (ACC ON MODE):
- This is the default sub state inside ACC ON MODE state. Output signal Acceleration_Mode is equal to 2.
- Condition to transit from LeadVehicle_Detected_Follow to LeadVehicle_Not_Detected; Input signal condition LeadVehicle_Detected == 0.
- Condition to transit from LeadVehicle_Detected_Follow to LeadVehicle_Speed_lessthan_Set_Speed; Input Signals condition (LeadVehicle_Detected == 1) && (LeadVehicle_Speed < Set_Speed) || (Time_Gap < Set_Gap).
Requirement 3c (ii) – LeadVehicle_Not_Detected (ACC ON MODE):
- Output signal Acceleration_Mode is equal to 1.
- Condition to transit from LeadVehicle_Not_Detected to LeadVehicle_Detected_Follow; Input signals condition [(LeadVehicle_Detected==1) && (DriveVehicle_Speed == Set_Speed) && (LeadVehicle_Speed >= Set_Speed) && (Time_Gap >= Set_Gap)]
- Condition to transit from LeadVehicle_Not_Detected to LeadVehicle_Speed_lessthan_Set_Speed; Input signals condition [(LeadVehicle_Detected == 1) && (LeadVehicle_Speed < Set_Speed) || (Time_Gap < Set_Gap)]
Requirement 3c (iii) – LeadVehicle_Detected_Resume (ACC ON MODE):
- Output signal Acceleration_Mode is equal to 3.
- Condition to transit from LeadVehicle_Detected_Resume to LeadVehicle_Detected_Follow; Input signals condition [(DriveVehicle_Speed == Set_Speed) && (LeadVehicle_Speed >= Set_Speed) && (Time_Gap >= Set_Gap)]
- Condition to transit from LeadVehicle_Detected_Resume to LeadVehicle_Not_Detected_Resume; Input signal condition LeadVehicle_Detected==0.
- Condition to transit from LeadVehicle_Detected_Resume to LeadVehicle_Speed_equal_Set_Speed; Input Signal condition [(DriveVehicle_Speed < Set_Speed) && (LeadVehicle_Speed > DriveVehicle_Speed) && (Time_Gap >= Set_Gap)]
Requirement 3c (iv) - LeadVehicle_Not_Detected_Resume (ACC ON MODE):
- Output signal Acceleration_Mode is equal to 1.
Requirement 3c (v) - LeadVehicle_Speed_lessthan_Set_Speed (ACC ON MODE):
- Output signal Acceleration_Mode is equal to 4.
- Condition to transit from LeadVehicle_Speed_lessthan_Set_Speed to LeadVehicle_Not_Detected; Input signal condition [(LeadVehicle_Detected == 0) && (DriveVehicle_Speed == Set_Speed)]
- Condition to transit from LeadVehicle_Speed_lessthan_Set_Speed to LeadVehicle_Speed_equal_Set_Speed; Input signals condition [((LeadVehicle_Speed*1.25>=DriveVehicle_Speed) && (LeadVehicle_Speed * 0.75<=DriveVehicle_Speed)) && (DriveVehicle_Speed < Set_Speed) && ((Time_Gap<=1.25*Set_Gap) && (Time_Gap >=0.75*Set_Gap))]
Requirement 3c (vi) - LeadVehicle_Speed_equal_Set_Speed (ACC ON MODE):
- Output signal Acceleration_Mode is equal to 5.
- Condition to transit from LeadVehicle_Speed_equal_Set_Speed to LeadVehicle_Not_Detected_Resume; Input signal conditions is [(LeadVehicle_Detected == 0) || (DriveVehicle_Speed <= Set_Speed)]
- Condition to transit from LeadVehicle_Speed_equal_Set_Speed to LeadVehicle_Detected_Resume; Input signal conditions [(DriveVehicle_Speed < Set_Speed) && (LeadVehicle_Speed > DriveVehicle_Speed) || (Time_Gap >= Set_Gap)]
- Condition to transit from LeadVehicle_Speed_equal_Set_Speed to LeadVehicle_Speed_lessthan_Set_Speed; Input signals conditions [(LeadVehicle_Speed

All Requirement Combine to form a Subsystem

At last Create into single Subsystem

Step 2:
Tagging the Requirement and Tagging
for Requirement 1 only Tagged like wise for all other requirement we need to tag


STEP3:
Linking and creating the Model with SLDD file
- Storage class for Input signals: ImportedExtern
- Storage class for Output signal: Export to File
- Storage class for local signals: localizable
- Storage class for calibration signals: Const.
Step4:
In Configuration Parameters: enable “Support Floating Numbers” under Code Generation settings.

Choose sample time for all signals as 0.01s

Change the system target file into ert.tlc and also change the configuration parameter as per requirements
Step5:
Resolving and propagating the signal

MODEL ADVISOR REPORT:
The model Advisor Report is Shown below

CODE GENERATION:

File: Adaptive_Cruise_Control.c
| 1 | /* |
| 2 | * File: Adaptive_Cruise_Control.c |
| 3 | * |
| 4 | * Code generated for Simulink model 'Adaptive_Cruise_Control'. |
| 5 | * |
| 6 | * Model version : 1.6 |
| 7 | * Simulink Coder version : 9.5 (R2021a) 14-Nov-2020 |
| 8 | * C/C++ source code generated on : Sun Dec 12 13:17:42 2021 |
| 9 | * |
| 10 | * Target selection: ert.tlc |
| 11 | * Embedded hardware selection: Intel->x86-64 (Windows64) |
| 12 | * Code generation objectives: Unspecified |
| 13 | * Validation result: Not run |
| 14 | */ |
| 15 | |
| 16 | #include "Adaptive_Cruise_Control.h" |
| 17 | #include "Adaptive_Cruise_Control_private.h" |
| 18 | |
| 19 | /* Named constants for Chart: ' |
| 20 | #define Ada_IN_LeadVehicle_Not_Detected ((uint8_T)3U) |
| 21 | #define Adaptive_Cr_IN_ACC_STANDBY_MODE ((uint8_T)2U) |
| 22 | #define Adaptive_Cru_IN_NO_ACTIVE_CHILD ((uint8_T)0U) |
| 23 | #define Adaptive_Cruise_IN_ACC_OFF_MODE ((uint8_T)1U) |
| 24 | #define IN_Adaptive_cruise_control_Algo ((uint8_T)3U) |
| 25 | #define IN_LeadVehicle_Detected_Follow ((uint8_T)1U) |
| 26 | #define IN_LeadVehicle_Detected_Resume ((uint8_T)2U) |
| 27 | #define IN_LeadVehicle_Not_Detected_Res ((uint8_T)4U) |
| 28 | #define IN_LeadVehicle_Speed_equal_Set_ ((uint8_T)5U) |
| 29 | #define IN_LeadVehicle_Speed_lessthan_S ((uint8_T)6U) |
| 30 | |
| 31 | /* Block states (default storage) */ |
| 32 | DW_Adaptive_Cruise_Control_T Adaptive_Cruise_Control_DW; |
| 33 | |
| 34 | /* External outputs (root outports fed by signals with default storage) */ |
| 35 | ExtY_Adaptive_Cruise_Control_T Adaptive_Cruise_Control_Y; |
| 36 | |
| 37 | /* Real-time model */ |
| 38 | static RT_MODEL_Adaptive_Cruise_Cont_T Adaptive_Cruise_Control_M_; |
| 39 | RT_MODEL_Adaptive_Cruise_Cont_T *const Adaptive_Cruise_Control_M = |
| 40 | &Adaptive_Cruise_Control_M_; |
| 41 | |
| 42 | /* Model step function */ |
| 43 | void Adaptive_Cruise_Control_step(void) |
| 44 | { |
| 45 | uint8_T rtb_Add; |
| 46 | uint8_T rtb_Sum; |
| 47 | |
| 48 | /* Sum: ' |
| 49 | * Inport: ' |
| 50 | * Inport: ' |
| 51 | * UnitDelay: ' |
| 52 | */ |
| 53 | rtb_Sum = (uint8_T)((uint32_T)(uint8_T)((uint32_T)CameraInput_DriveVehicle + |
| 54 | RadarInput_DriveVehicle) + Adaptive_Cruise_Control_Y.Acceleration_Mode); |
| 55 | |
| 56 | /* Sum: ' |
| 57 | * Inport: ' |
| 58 | * Inport: ' |
| 59 | */ |
| 60 | rtb_Add = (uint8_T)((uint32_T)CameraInput_LeadVehicle + RadarInput_LeadVehicle); |
| 61 | |
| 62 | /* Chart: ' |
| 63 | * Inport: ' |
| 64 | * Inport: ' |
| 65 | * Inport: ' |
| 66 | * Inport: ' |
| 67 | * Inport: ' |
| 68 | * Inport: ' |
| 69 | * UnitDelay: ' |
| 70 | */ |
| 71 | if (Adaptive_Cruise_Control_DW.is_active_c3_Adaptive_Cruise_Co == 0U) { |
| 72 | Adaptive_Cruise_Control_DW.is_active_c3_Adaptive_Cruise_Co = 1U; |
| 73 | Adaptive_Cruise_Control_DW.is_c3_Adaptive_Cruise_Control = |
| 74 | Adaptive_Cruise_IN_ACC_OFF_MODE; |
| 75 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 0U; |
| 76 | } else { |
| 77 | switch (Adaptive_Cruise_Control_DW.is_c3_Adaptive_Cruise_Control) { |
| 78 | case Adaptive_Cruise_IN_ACC_OFF_MODE: |
| 79 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 0U; |
| 80 | if (CruiseSwitch) { |
| 81 | Adaptive_Cruise_Control_DW.is_c3_Adaptive_Cruise_Control = |
| 82 | Adaptive_Cr_IN_ACC_STANDBY_MODE; |
| 83 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 84 | } |
| 85 | break; |
| 86 | |
| 87 | case Adaptive_Cr_IN_ACC_STANDBY_MODE: |
| 88 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 89 | if (!CruiseSwitch) { |
| 90 | Adaptive_Cruise_Control_DW.is_c3_Adaptive_Cruise_Control = |
| 91 | Adaptive_Cruise_IN_ACC_OFF_MODE; |
| 92 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 0U; |
| 93 | } else if (SetSwitch) { |
| 94 | Adaptive_Cruise_Control_DW.is_c3_Adaptive_Cruise_Control = |
| 95 | IN_Adaptive_cruise_control_Algo; |
| 96 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 97 | IN_LeadVehicle_Detected_Follow; |
| 98 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 2U; |
| 99 | } |
| 100 | break; |
| 101 | |
| 102 | default: |
| 103 | /* case IN_Adaptive_cruise_control_Algorithm: */ |
| 104 | if (!SetSwitch) { |
| 105 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 106 | Adaptive_Cru_IN_NO_ACTIVE_CHILD; |
| 107 | Adaptive_Cruise_Control_DW.is_c3_Adaptive_Cruise_Control = |
| 108 | Adaptive_Cr_IN_ACC_STANDBY_MODE; |
| 109 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 110 | } else { |
| 111 | switch (Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo) { |
| 112 | case IN_LeadVehicle_Detected_Follow: |
| 113 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 2U; |
| 114 | if (RadarInput_DriveVehicle == 0) { |
| 115 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 116 | Ada_IN_LeadVehicle_Not_Detected; |
| 117 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 118 | } else if (((RadarInput_DriveVehicle == 1) && (rtb_Add < Set_Speed)) || |
| 119 | (Time_Gap < Set_Gap)) { |
| 120 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 121 | IN_LeadVehicle_Speed_lessthan_S; |
| 122 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 4U; |
| 123 | } |
| 124 | break; |
| 125 | |
| 126 | case IN_LeadVehicle_Detected_Resume: |
| 127 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 3U; |
| 128 | if ((rtb_Sum == Set_Speed) && (rtb_Add >= Set_Speed) && (Time_Gap >= |
| 129 | Set_Gap)) { |
| 130 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 131 | IN_LeadVehicle_Detected_Follow; |
| 132 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 2U; |
| 133 | } else if (RadarInput_DriveVehicle == 0) { |
| 134 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 135 | IN_LeadVehicle_Not_Detected_Res; |
| 136 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 137 | } else if ((rtb_Sum < Set_Speed) && (rtb_Add > rtb_Sum) && (Time_Gap >= |
| 138 | Set_Gap)) { |
| 139 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 140 | IN_LeadVehicle_Speed_equal_Set_; |
| 141 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 5U; |
| 142 | } |
| 143 | break; |
| 144 | |
| 145 | case Ada_IN_LeadVehicle_Not_Detected: |
| 146 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 147 | if ((RadarInput_DriveVehicle == 1) && (rtb_Sum == Set_Speed) && |
| 148 | (rtb_Add >= Set_Speed) && (Time_Gap >= Set_Gap)) { |
| 149 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 150 | IN_LeadVehicle_Detected_Follow; |
| 151 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 2U; |
| 152 | } else if (((RadarInput_DriveVehicle == 1) && (rtb_Add < Set_Speed)) || |
| 153 | (Time_Gap < Set_Gap)) { |
| 154 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 155 | IN_LeadVehicle_Speed_lessthan_S; |
| 156 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 4U; |
| 157 | } |
| 158 | break; |
| 159 | |
| 160 | case IN_LeadVehicle_Not_Detected_Res: |
| 161 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 162 | break; |
| 163 | |
| 164 | case IN_LeadVehicle_Speed_equal_Set_: |
| 165 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 5U; |
| 166 | if ((RadarInput_DriveVehicle == 0) || (rtb_Sum <= Set_Speed)) { |
| 167 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 168 | IN_LeadVehicle_Not_Detected_Res; |
| 169 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 170 | } else if (((rtb_Sum < Set_Speed) && (rtb_Add > rtb_Sum)) || (Time_Gap |
| 171 | >= Set_Gap)) { |
| 172 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 173 | IN_LeadVehicle_Detected_Resume; |
| 174 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 3U; |
| 175 | } else if (((rtb_Add < Set_Speed) && (rtb_Add < rtb_Sum)) || (0.75 * |
| 176 | (real_T)Set_Gap == Time_Gap)) { |
| 177 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 178 | IN_LeadVehicle_Speed_lessthan_S; |
| 179 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 4U; |
| 180 | } |
| 181 | break; |
| 182 | |
| 183 | default: |
| 184 | /* case IN_LeadVehicle_Speed_lessthan_Set_Speed: */ |
| 185 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 4U; |
| 186 | if ((RadarInput_DriveVehicle == 0) && (rtb_Sum == Set_Speed)) { |
| 187 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 188 | Ada_IN_LeadVehicle_Not_Detected; |
| 189 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 1U; |
| 190 | } else if (((real_T)rtb_Add * 1.25 >= rtb_Sum) && ((real_T)rtb_Add * |
| 191 | 0.75 <= rtb_Sum) && (rtb_Sum < Set_Speed) && ((Time_Gap <= |
| 192 | 1.25 * (real_T)Set_Gap) && (Time_Gap >= 0.75 * (real_T)Set_Gap))) { |
| 193 | Adaptive_Cruise_Control_DW.is_Adaptive_cruise_control_Algo = |
| 194 | IN_LeadVehicle_Speed_equal_Set_; |
| 195 | Adaptive_Cruise_Control_Y.Acceleration_Mode = 5U; |
| 196 | } |
| 197 | break; |
| 198 | } |
| 199 | } |
| 200 | break; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /* End of Chart: ' |
| 205 | } |
| 206 | |
| 207 | /* Model initialize function */ |
| 208 | void Adaptive_Cruise_Control_initialize(void) |
| 209 | { |
| 210 | /* (no initialization code required) */ |
| 211 | } |
| 212 | |
| 213 | /* Model terminate function */ |
| 214 | void Adaptive_Cruise_Control_terminate(void) |
| 215 | { |
| 216 | /* (no terminate code required) */ |
| 217 | } |
| 218 | |
| 219 | /* |
| 220 | * File trailer for generated code. |
| 221 | * |
| 222 | * [EOF] |
| 223 | */ |
| 224 |
CONCLUSION:
The Adaptive Cruise Control System is Sucessfully Implemented and also C code is also Generated.