Challenge

Project 2-Highway Assistant-Lane Changing Assistant

Ans.)

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.

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.

Data Dictionary :-

Simulink Model :-

Subsystem :-

Requirement No 1 [Highway_DisplayUnit] :-

Inputs to this particular subsystem are “Highway_Input_Signal”, “Enable_Display”, “Input_Switch”. These three input signals, when assigned to a particular value will give output signals of specific value. The output signals are “Highway_Display_Mode_1”, “Highway_Display_Mode_2”, “Highway_Display_Mode_3”, “Highway_Display_Mode_4”. The requirement must be implemented in the form of a Stateflow logic.

Requirement No 2 [Lane_DisplayUnit] :-

Inputs to this particular subsystem are “Enable_Display”, “Input_Switch”, “Lane_Input_Signal”. These three input signals, when assigned to a particular value will give output signals of specific value. The output signals are “Lane_Display_Mode_1”, “Lane_Display_Mode_2”, “Lane_Display_Mode_3”, “Lane_Display_Mode_4”. The requirement must be implemented in the form of Stateflow logic.

 Requirement No 3 :-

Signals coming from both subsystems “Highway_Display_Mode_1” & “Lane_Display_Mode_1” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_1”.

Signals coming from both subsystems “Highway_Display_Mode_2” & “Lane_Display_Mode_2” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_2”.

Signals coming from both subsystems “Highway_Display_Mode_3” & “Lane_Display_Mode_3” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_3”.

Signals coming from both subsystems “Highway_Display_Mode_4” & “Lane_Display_Mode_4” are given as inputs to a switch block which will have input signal “Highway_Input_Signal” given as 2nd input to the switch block. Corresponding output from this particular switch block is output signal “Display_Mode_4”.

 

For Generating the Model Advisor Report As per the MAAB guideline :-

1.) Goto modelling --> Click on Model Advisor 

2.) Then click on Ok

3.) Then Select Modelling standard For MAB --> Run to generate

All the input & output signals are mapped into the Autosar Editor :-

1.) S-R Interfaces shows with prefix SRIf_ and Data Elements shows with prefix DE_

2.) Receiver Ports shows with prefix Rp_

3.) Sender Ports shows with prefix Pp_

4.) Runnables 

Then we will Validate the model for AUTOSAR Compliance

Code Generation for Model Profile must be Autosar Coder :-

 
/*
 
 
* File: lane_change_assist.c
 
 
*
 
 
* Code generated for Simulink model 'lane_change_assist'.
 
 
*
 
 
* Model version : 1.7
 
 
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
 
 
* C/C++ source code generated on : Thu Mar 3 16:22:50 2022
 
 
*
 
 
* Target selection: autosar.tlc
 
 
* Embedded hardware selection: Intel->x86-64 (Windows64)
 
 
* Code generation objectives: Unspecified
 
 
* Validation result: Not run
 
 
*/
 
 
 
 
 
#include "lane_change_assist.h"
 
 
#include "lane_change_assist_private.h"
 
 
 
 
 
/* Named constants for Chart: '/Chart' */
 
 
#define lane_change_assi_IN_Condition_1 ((uint8)1U)
 
 
#define lane_change_assi_IN_Condition_2 ((uint8)2U)
 
 
 
 
 
/* Named constants for Chart: '/Chart' */
 
 
#define lane_change_assi_IN_condition_1 ((uint8)1U)
 
 
#define lane_change_assi_IN_condition_2 ((uint8)2U)
 
 
 
 
 
/* Block states (default storage) */
 
 
DW_lane_change_assist_T lane_change_assist_DW;
 
 
 
 
 
/* Model step function */
 
 
void lane_change_assist_Step(void)
 
 
{
 
 
sint32 rtb_Highway_Display_Mode_1;
 
 
sint32 rtb_Highway_Display_Mode_3;
 
 
sint32 rtb_Lane_Display_Mode_1;
 
 
sint32 rtb_Lane_Display_Mode_2;
 
 
sint32 rtb_Lane_Display_Mode_3;
 
 
sint32 rtb_Lane_Display_Mode_4;
 
 
sint32 tmp_0;
 
 
uint8 tmp;
 
 
 
 
 
/* Chart: '/Chart' incorporates:
 
 
* Inport: '/Enable_Display'
 
 
* Inport: '/Highway_Input_Signal'
 
 
* Inport: '/Input_Switch'
 
 
*/
 
 
if (lane_change_assist_DW.is_active_c3_lane_change_assist == 0U) {
 
 
lane_change_assist_DW.is_active_c3_lane_change_assist = 1U;
 
 
lane_change_assist_DW.is_c3_lane_change_assist =
 
 
lane_change_assi_IN_Condition_1;
 
 
rtb_Highway_Display_Mode_1 = 232;
 
 
rtb_Highway_Display_Mode_3 = 41;
 
 
} else if (lane_change_assist_DW.is_c3_lane_change_assist ==
 
 
lane_change_assi_IN_Condition_1) {
 
 
if ((Rte_IRead_lane_change_assist_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
 
 
() == 1) &&
 
 
(Rte_IRead_lane_change_assist_Step_Rp_Enable_Display_DE_Enable_Display()
 
 
== 1) &&
 
 
(Rte_IRead_lane_change_assist_Step_Rp_Input_Switch_DE_Input_Switch() ==
 
 
1)) {
 
 
lane_change_assist_DW.is_c3_lane_change_assist =
 
 
lane_change_assi_IN_Condition_2;
 
 
rtb_Highway_Display_Mode_1 = 213;
 
 
rtb_Highway_Display_Mode_3 = 9;
 
 
} else {
 
 
rtb_Highway_Display_Mode_1 = 232;
 
 
rtb_Highway_Display_Mode_3 = 41;
 
 
}
 
 
 
 
 
/* case IN_Condition_2: */
 
 
} else if
 
 
((Rte_IRead_lane_change_assist_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
 
 
() == 1) &&
 
 
(Rte_IRead_lane_change_assist_Step_Rp_Enable_Display_DE_Enable_Display() ==
 
 
0) && (Rte_IRead_lane_change_assist_Step_Rp_Input_Switch_DE_Input_Switch
 
 
() == 1)) {
 
 
lane_change_assist_DW.is_c3_lane_change_assist =
 
 
lane_change_assi_IN_Condition_1;
 
 
rtb_Highway_Display_Mode_1 = 232;
 
 
rtb_Highway_Display_Mode_3 = 41;
 
 
} else {
 
 
rtb_Highway_Display_Mode_1 = 213;
 
 
rtb_Highway_Display_Mode_3 = 9;
 
 
}
 
 
 
 
 
/* End of Chart: '/Chart' */
 
 
 
 
 
/* Chart: '/Chart' incorporates:
 
 
* Inport: '/Enable_Display'
 
 
* Inport: '/Input_Switch'
 
 
* Inport: '/Lane_Input_Signal'
 
 
*/
 
 
if (lane_change_assist_DW.is_active_c1_lane_change_assist == 0U) {
 
 
lane_change_assist_DW.is_active_c1_lane_change_assist = 1U;
 
 
lane_change_assist_DW.is_c1_lane_change_assist =
 
 
lane_change_assi_IN_condition_1;
 
 
rtb_Lane_Display_Mode_1 = 132;
 
 
rtb_Lane_Display_Mode_2 = 185;
 
 
rtb_Lane_Display_Mode_3 = 54;
 
 
rtb_Lane_Display_Mode_4 = 67;
 
 
} else if (lane_change_assist_DW.is_c1_lane_change_assist ==
 
 
lane_change_assi_IN_condition_1) {
 
 
if ((Rte_IRead_lane_change_assist_Step_Rp_Lane_Input_Signal_DE_Lane_Input_Signal
 
 
() == 6) &&
 
 
(Rte_IRead_lane_change_assist_Step_Rp_Enable_Display_DE_Enable_Display()
 
 
== 1) &&
 
 
(Rte_IRead_lane_change_assist_Step_Rp_Input_Switch_DE_Input_Switch() ==
 
 
1)) {
 
 
lane_change_assist_DW.is_c1_lane_change_assist =
 
 
lane_change_assi_IN_condition_2;
 
 
rtb_Lane_Display_Mode_1 = 127;
 
 
rtb_Lane_Display_Mode_2 = 248;
 
 
rtb_Lane_Display_Mode_3 = 186;
 
 
rtb_Lane_Display_Mode_4 = 84;
 
 
} else {
 
 
rtb_Lane_Display_Mode_1 = 132;
 
 
rtb_Lane_Display_Mode_2 = 185;
 
 
rtb_Lane_Display_Mode_3 = 54;
 
 
rtb_Lane_Display_Mode_4 = 67;
 
 
}
 
 
 
 
 
/* case IN_condition_2: */
 
 
} else if
 
 
((Rte_IRead_lane_change_assist_Step_Rp_Lane_Input_Signal_DE_Lane_Input_Signal
 
 
() == 6) &&
 
 
(Rte_IRead_lane_change_assist_Step_Rp_Enable_Display_DE_Enable_Display() ==
 
 
0) && (Rte_IRead_lane_change_assist_Step_Rp_Input_Switch_DE_Input_Switch
 
 
() == 1)) {
 
 
lane_change_assist_DW.is_c1_lane_change_assist =
 
 
lane_change_assi_IN_condition_1;
 
 
rtb_Lane_Display_Mode_1 = 132;
 
 
rtb_Lane_Display_Mode_2 = 185;
 
 
rtb_Lane_Display_Mode_3 = 54;
 
 
rtb_Lane_Display_Mode_4 = 67;
 
 
} else {
 
 
rtb_Lane_Display_Mode_1 = 127;
 
 
rtb_Lane_Display_Mode_2 = 248;
 
 
rtb_Lane_Display_Mode_3 = 186;
 
 
rtb_Lane_Display_Mode_4 = 84;
 
 
}
 
 
 
 
 
/* End of Chart: '/Chart' */
 
 
 
 
 
/* Switch: '/Switch' incorporates:
 
 
* Inport: '/Highway_Input_Signal'
 
 
* Switch: '/Switch1'
 
 
* Switch: '/Switch2'
 
 
* Switch: '/Switch3'
 
 
*/
 
 
tmp_0 =
 
 
Rte_IRead_lane_change_assist_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
 
 
();
 
 
if (tmp_0 != 0) {
 
 
tmp = (uint8)rtb_Highway_Display_Mode_1;
 
 
} else {
 
 
tmp = (uint8)rtb_Lane_Display_Mode_1;
 
 
}
 
 
 
 
 
/* End of Switch: '/Switch' */
 
 
 
 
 
/* Outport: '/Display_Mode_1' */
 
 
Rte_IWrite_lane_change_assist_Step_Pp_Display_Mode_1_DE_Display_Mode_1(tmp);
 
 
 
 
 
/* Switch: '/Switch1' */
 
 
if (tmp_0 != 0) {
 
 
tmp = 183U;
 
 
} else {
 
 
tmp = (uint8)rtb_Lane_Display_Mode_2;
 
 
}
 
 
 
 
 
/* Outport: '/Display_Mode_2' */
 
 
Rte_IWrite_lane_change_assist_Step_Pp_Display_Mode_2_DE_Display_Mode_2(tmp);
 
 
 
 
 
/* Switch: '/Switch2' */
 
 
if (tmp_0 != 0) {
 
 
tmp = (uint8)rtb_Highway_Display_Mode_3;
 
 
} else {
 
 
tmp = (uint8)rtb_Lane_Display_Mode_3;
 
 
}
 
 
 
 
 
/* Outport: '/Display_Mode_3' */
 
 
Rte_IWrite_lane_change_assist_Step_Pp_Display_Mode_3_DE_Display_Mode_3(tmp);
 
 
 
 
 
/* Switch: '/Switch3' */
 
 
if (tmp_0 != 0) {
 
 
tmp = 94U;
 
 
} else {
 
 
tmp = (uint8)rtb_Lane_Display_Mode_4;
 
 
}
 
 
 
 
 
/* Outport: '/Display_Mode_4' */
 
 
Rte_IWrite_lane_change_assist_Step_Pp_Display_Mode_4_DE_Display_Mode_4(tmp);
 
 
}
 
 
 
 
 
/* Model initialize function */
 
 
void lane_change_assist_Init(void)
 
 
{
 
 
/* (no initialization code required) */
 
 
}
 
 
 
 
 
/*
 
 
* File trailer for generated code.
 
 
*
 
 
* [EOF]
 
 
*/

  

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.