Project 2 Adaptive Cruise Control
MAIN PROJECT-ADAPTIVE CRUISE CONTROL
(ACC):
General overview:
Adaptive Cruise Control 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 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 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 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 speed and distance
from the vehicle in front.
AIM:
To develop a simulink model with adaptive cruise control feature in a vehicle which satisfies the given requirements.
Objective of Main project:
1. Developing Adaptive cruise Control feature as per the Requirement Document using MATLAB Simulink.
2. Follow all the MBD related processes:Requirement Tagging & Traceability,SLLD creation,Configuration Parameter changes, Model Advisor check & Code Generation.
3. in Configuration parameters :enable"support Floating Number" under code generation settings.
4. use Embedded coder to generate the code.
5. if choosing code generation,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
6. choose sample time for all signals as 0.01s.
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_drivevehcile ,
Radarinput_Drive vehicle)& one signal coming as an input to this subsystem(signal
Name:Acceleration_Mode)-three inputs into this requirement intotal.
. like the above requirement,sensor fusion techniqes will also be deployed here,for complexity reasons we are ignoring them.
. two output signals come from this subsystem
(signal Name:Drive vehcile_speed & lead vehicle_detected).
. signal Drive vehicle_speed is summation of three input signals mentioned above & lead vehicle_detected is mentioned above & lead vehicle_detected is renamed from input
signal radarinput _Drive vehicle 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 requrement has to be implemented as state machine
logic in simulink.
. The input signals to this state machine system are(signals name:time _gap set_speed,set-gap,cruiseswitch,setswitch).
. Also ,the output signals (signal
name :drivevehicle_speed &
Lead vehicle _Detected)from requirement-2 is fed back as an input signal into singal into this state manchineblock.
. Additionally,output signal (signal
Name :Lead vehicle _speed)from requirement-1 is given as an input signal to this state machine block as well.
. output from this subsystem is a signal(sighal
name :acceleration_mode )which governs the vehicular speed of the drive vehicle which automatically adjusts its speed & velocity to match the laed 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 3a-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_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
LeadVehile_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 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_ . condition to transit from leadvehicle _not_detected to leadvehicle_speed_lessthan_set_speed;input signals condition[(leadvehicle _speed< set_speed)||(time_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 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 ((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_deteced_resume; input signal condition is [(leadvehicle_detected==0)|| (drivevehicle_speed<=set_speed)] . condition to transit from leadvehicle_speed_equal_set_speed to leadvehicle_detected_resume;input signal coditions [(drivevehicle_speed . condition to transit from leadvehicle_speed_equal_set_speed to leadvehicle_speed_lessthan_set_speed;input signals conditions[(leadvehicle_speed (leadvehicle_speed 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 omn the driver by automatically controlling the vehicle speed&maintaining a prededing vehicle.as a consequence,the drive 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 is clear,cruise control 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 accelerates or actively engaging the brake control system.if thr vehicle ahead speeds up or changes lanes ,the cruise control automatically accelerates to the drivers desired speed.standard adaptive cruise control can be activated from speeds of around 30km/hupwards and supports the driver,primarily on cross-country journeys or on freeways .the cruise control stop & go variant is also active at speeds below 30km/h.in 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 drive 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 drive even in heavy traffic and traffic jams.since adaptive cruise control is a comfrot and convenience system,brake interventions and vehicle acceleration only take place adaptive cruise control switched on,it remains the driver's responsibility to monitor the speed and distance from the vehicle in front. SIMULATION: There are some steps to be followed to develop the model of adaptive cruise control.they are mainly as follows; step-1-Develop the simulink model: Based on the given requirements separate subsystems are made for requirement 1,requirement 2,and requirement 3. Requirement 1-lead vehicle: . Lead vehicle is a vehicle which is driving in the road ahead of our drive vehicle.two input signals(signals 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:lead vehicle_speed). . speed data of the lead vehicle is critical in implementing the adaptive cruise control algorithm. Here ,the two input signals camerainput_leadvehicle & radarinput_leadvehicle are added with an add block instead of using fusion techniques;due to complexity reasons and an output signal leadvehicle _speed is produced. 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 2input signals (signal name:camerainput_drivevehicle,radarinput_drivevehicle)&one signal coming as an input to this subsystem(signal Name:acceleration_mode)-three input 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 :drive vehicle _speed& leadvehicle _detected). . signal drive vehicle _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. Here three input signals camerainput_drivevehicle,radarinput_drivevehicle and acceleration_mode are added with an add block where the radarinput_drivevehicle is also given to a signals conversion block and produces an output signal leadvehicle_detected.the output signal drivevehicle_speed is produced from the summation of the three input signals. 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. Here the input signals time _gap ,set_speed,set_gap,cruiseswitch,setswitch,along with the output signals drivevehicle _speed,leadvehicle _detected and leadvehicle _speed are given as input signals to a chart block and an output signal acceleration_mode is drawn from the chart block. 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 MODE ON OR ACC STANDBY MODE. Here,the default state is taken as ACC_OFF with the entry state as acceleration_mode=0 and the transition is done from ACC_OFF state to ACC_STANDBY mode when the cruiseswitch==1 and the transition reverses when the cruiseswitch==0. 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 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. Here,the default state is taken as ACC_OFF with the entry state as acceleration_mode=0 and the transition is done from ACC_OFF state to ACC_STANDBY mode when the cruiseswitch==1 and the transition reverses when the cruiseswitch==0.the transition occurs from ACC_STANDBY mode to ACC_ON mode when setswitch==1 and the transition reverses when setswitch==0. 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 requirement 3c(ii)-leadvehicle_not_detected(ACC ON MODE): . output singnal acceleration_mode is equal to 1. . condition to transit from leadvehicle_not_detected==1)&&(drivevehicle_speed==set_speed)&&(leadvehicle_speed>=set_speed)&&(time_gap>=set_gap)] . condition to transit from leadvehicle_not_detected to le advehicle_speed_lessthan_set_speed;input signals condition [(leadvehicle_detected==1)&&(leadvehicle_speed 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 [(drive vehicle_speed>=set_speed)&&(leadvehicle_speed>=set_speed)&&(time_gap>=set_gap)] . condition to transit from leadvehicle_detected_resume to leadvehicle_speed_equal_set_speed;input signal condition leadvehicle_detected==0. . condition to transit from leadvehicle_detected_resume to leadvehicle_speed_equal_set_speed;input signal condition to transit from leadvehicle_detected_resume to leadvehicle_speed_equal_set_speed;input signal condition [(drivevehicle_speed 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 _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 condition[(drivevehicle_speed . condition to transit from leadvehicle_speed_equal_set_speed to leadvehicle_speed_lessthan_set_speed;input signals conditions[(leadvehicle_speed (leadvehicle_speed here,the ACC_ON mode 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_lessthan_set_speed depending on the conditions given in the requirements 3c(i)to 3c(vi)the states and the transitions are done and the state flow logic is created. then ,the signals and transition conditions are give as output and input data in the symbols pane. step-2-change the model settings to MBD compliance changes: there are some steps to be folllowed to develop the model of adaptive cruise control.first,changed the model settings TO MBD compliance changes.MBD settings includes solver type to be changed to fixed setup discrete(no continuous states)and fixed step size to 0.01s.under the code generation the target file is changed to embedded coder step-3-develop the simulink data library for the model from the given data: under modelling ,link to data dictionary enables us to create a new SLDD for our model.the SLDD IS designed based on the data given: signals & calibration data list: signal/calibration name signal type data type dimension min max initial value units camerainput_leadvehicle input uint8 1 0 255 - - radarinput _leadvehicle input uint 8 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 uint 8 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 - - signal resolving and propagation: determine resolved signals and propagate signals in the model. step-4- model advisory check for MAB standards: under model advisor window , choose by task and select modeling standards for MAB and select run selected checks option on the right. step-5- code generation: the code for the entire vehicle direction determination model is developed by generating s-function. step-6-requirement tagging: the subsystems are tagged to the respective requirements provided in a word file. CONCLUSION: THE SIMULINK MODEL FOR ADAPTIVE CRUISE CONTROL WAS DEVELOPED UNDER FOLLOWING THE REQUIREMENTS GIVEN.ALSO MODEL ADVISORY CHECKS ARE DONE FOR MAB STANDARDS.THE REPORT SHOWED ABOUT 21 WARNINGS WITH ZERO FAILED CONDITIONS.THE ADVISORY REPORT AND THE CODE GENERATED ARE ATTACHED WITH THIS PROJECT REPORT.THE CODE GENERATED IS PROVIDED AS A C FILE AND H FILE.
gap>=set_gap)]















