Project 2-Highway Assistant-Lane Changing Assistant
Aim:
Model Development of a feature of Highway Assistant-Lane Changing Assistant using MATLAB and Simulink as per MAAB guidelines, producing Model Advisor Report as well as generating Code using AUTOSAR Coder.
Objective:
- Model Development in MATLAB Simulink as per MAAB guidelines.
- Code Generation using Autosar Coder.
- Creation of Simulink Data Dictionary.
- Mapping all the input & output signals into the Autosar Editor.
- Generating Model Advisor Report.
Highway Assistant – Lane Changing Assistant
Introduction to the Feature:
The Highway Assistant supports the driver and takes over the longitudinal and lateral guidance of the vehicle in monotonous driving situations on highways. The partially automated function can automatically start, accelerate, brake as well as steer the vehicle to a certain extent. The driver has to permanently supervise the system and be ready to take over the complete control of the vehicle at any time.

Fig: Lane Changing Assistant
Drivers are taught to assess surrounding traffic before changing lanes by checking their rearview and side mirrors and looking over each shoulder. However, even for those who follow this sequence of checks, the vehicle's blind spot – the area alongside and just behind the vehicle – is a constant source of danger and often the cause of serious accidents. Even vehicles approaching quickly from behind can pose a risk. To make changing lanes safer, this feature has been developed.
Basic Working Principle:
Highway Assistant is a partially automated driving function for a speed range of up to 180 km/h (112 mph) on highways. It combines the radar-based longitudinal guidance of Adaptive Cruise Control (ACC) with the video-based lateral guidance of lane-keeping support in one system. Highway Assistant can be supplemented by an automatic lane change initiated and monitored by the driver in a speed range of 60 – 130 km/h (35 – 80 mph).
The Lane Change Assistant works by using two mid-range radar sensors that are concealed in the rear bumper – one on the left, one on the right. These two sensors monitor the area alongside and behind the car. Powerful control software collates the sensor information to create a complete picture of all traffic in the area behind the vehicle. Whenever another vehicle approaches at speed from behind or is already present in the blind spot, a signal such as a warning light in the side mirror alerts the driver to the hazard. Should the driver still activate the turn signal to change lanes, the system issues an additional acoustic and/or haptic warning.
MODEL:


REQUIREMENT 1:

ALGORITHM OF REQ. 1

REQUIREMENT 2:

REQUIREMENT 2 ALGORITHM:

REQUIREMENT 3:

SLDD FILE HAS BEEN MADE

CODE GENERATION:
/*
* File: Lane_Change_Assistant.c
*
* Code generated for Simulink model 'Lane_Change_Assistant'.
*
* Model version : 1.15
* Simulink Coder version : 9.7 (R2022a) 13-Nov-2021
* C/C++ source code generated on : Sat Sep 17 20:08:32 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Lane_Change_Assistant.h"
#include "rtwtypes.h"
/* Named constants for Chart: '<S2>/Chart' */
#define IN_Condition_1 ((uint8_T)1U)
#define IN_Condition_2 ((uint8_T)2U)
/* Named constants for Chart: '<S3>/Chart' */
#define IN_Lane_1 ((uint8_T)1U)
#define IN_Lane_2 ((uint8_T)2U)
/* Block states (default storage) */
DW rtDW;
/* External inputs (root inport signals with default storage) */
ExtU rtU;
/* External outputs (root outports fed by signals with default storage) */
ExtY rtY;
/* Real-time model */
static RT_MODEL rtM_;
RT_MODEL *const rtM = &rtM_;
/* Model step function */
void Lane_Change_Assistant_step(void)
{
uint8_T rtb_Highway_Display_Mode_1;
uint8_T rtb_Highway_Display_Mode_3;
/* Chart: '<S2>/Chart' incorporates:
* Inport: '<Root>/Enable_Display'
* Inport: '<Root>/Highway_Input_Signal'
* Inport: '<Root>/Input_Switch'
*/
if (rtDW.is_active_c3_Lane_Change_Assist == 0U) {
rtDW.is_active_c3_Lane_Change_Assist = 1U;
rtDW.is_c3_Lane_Change_Assistant = IN_Condition_1;
rtb_Highway_Display_Mode_1 = 232U;
rtb_Highway_Display_Mode_3 = 41U;
} else if (rtDW.is_c3_Lane_Change_Assistant == IN_Condition_1) {
rtb_Highway_Display_Mode_1 = 232U;
rtb_Highway_Display_Mode_3 = 41U;
if ((rtU.Highway_Input_Signal == 1) && (rtU.Enable_Display == 1) &&
(rtU.Input_Switch == 1)) {
rtDW.is_c3_Lane_Change_Assistant = IN_Condition_2;
rtb_Highway_Display_Mode_1 = 213U;
rtb_Highway_Display_Mode_3 = 9U;
}
} else {
/* case IN_Condition_2: */
rtb_Highway_Display_Mode_1 = 213U;
rtb_Highway_Display_Mode_3 = 9U;
if ((rtU.Highway_Input_Signal == 1) && (rtU.Enable_Display == 0) &&
(rtU.Input_Switch == 1)) {
rtDW.is_c3_Lane_Change_Assistant = IN_Condition_1;
rtb_Highway_Display_Mode_1 = 232U;
rtb_Highway_Display_Mode_3 = 41U;
}
}
/* End of Chart: '<S2>/Chart' */
/* Chart: '<S3>/Chart' incorporates:
* Inport: '<Root>/Enable_Display'
* Inport: '<Root>/Input_Switch'
* Inport: '<Root>/Lane_Input_Signal'
*/
if (rtDW.is_active_c1_Lane_Change_Assist == 0U) {
rtDW.is_active_c1_Lane_Change_Assist = 1U;
rtDW.is_c1_Lane_Change_Assistant = IN_Lane_1;
rtY.Display_Mode_1 = 132U;
rtY.Display_Mode_2 = 185U;
rtY.Display_Mode_3 = 54U;
rtY.Display_Mode_4 = 67U;
} else if (rtDW.is_c1_Lane_Change_Assistant == IN_Lane_1) {
rtY.Display_Mode_1 = 132U;
rtY.Display_Mode_2 = 185U;
rtY.Display_Mode_3 = 54U;
rtY.Display_Mode_4 = 67U;
if ((rtU.Lane_Input_Signal == 6) && (rtU.Enable_Display == 1) &&
(rtU.Input_Switch == 1)) {
rtDW.is_c1_Lane_Change_Assistant = IN_Lane_2;
rtY.Display_Mode_1 = 127U;
rtY.Display_Mode_2 = 248U;
rtY.Display_Mode_3 = 186U;
rtY.Display_Mode_4 = 84U;
}
} else {
/* case IN_Lane_2: */
rtY.Display_Mode_1 = 127U;
rtY.Display_Mode_2 = 248U;
rtY.Display_Mode_3 = 186U;
rtY.Display_Mode_4 = 84U;
if ((rtU.Lane_Input_Signal == 6) && (rtU.Enable_Display == 0) &&
(rtU.Input_Switch == 1)) {
rtDW.is_c1_Lane_Change_Assistant = IN_Lane_1;
rtY.Display_Mode_1 = 132U;
rtY.Display_Mode_2 = 185U;
rtY.Display_Mode_3 = 54U;
rtY.Display_Mode_4 = 67U;
}
}
/* End of Chart: '<S3>/Chart' */
/* Switch: '<S4>/Switch' incorporates:
* Inport: '<Root>/Highway_Input_Signal'
* Switch: '<S4>/Switch1'
* Switch: '<S4>/Switch2'
* Switch: '<S4>/Switch3'
*/
if (rtU.Highway_Input_Signal != 0) {
/* Outport: '<Root>/Display_Mode_1' */
rtY.Display_Mode_1 = rtb_Highway_Display_Mode_1;
/* Outport: '<Root>/Display_Mode_2' */
rtY.Display_Mode_2 = 183U;
/* Outport: '<Root>/Display_Mode_3' */
rtY.Display_Mode_3 = rtb_Highway_Display_Mode_3;
/* Outport: '<Root>/Display_Mode_4' */
rtY.Display_Mode_4 = 94U;
}
/* End of Switch: '<S4>/Switch' */
}
/* Model initialize function */
void Lane_Change_Assistant_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Lane_Change_Assistant_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
Definition
Function defined in Lane_Change_Assistant.c
MODEL ADVISOR REPORT

All the Model and reports are attached below