All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM: To develop one specific requirement of Highway Assistant – Lane Changing Assistant algorithm. OBJECTIVE: This model must be developed in MATLAB Simulink per MBD guidelines. Code Generation Profile must be Autosar Coder. Simulink Data Dictionary must be created for the model & must be linked to…
Harika Bale
updated on 20 Sep 2021
AIM: To develop one specific requirement of Highway Assistant – Lane Changing Assistant algorithm.
OBJECTIVE:
INTRODUCTION:
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.
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 with the intention of changing lanes, the system issues an additional acoustic and/or haptic warning.
SOLUTION:
The following are the steps followed to implement the Highway Assistant – Lane Changing Assistant algorithm.
1. Create the Simulink Data Dictionary (sldd file) for given Input, Output, Local signals.
2. As per Requirement-1:(Highway_Display Unit)
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.
Condition |
Action |
Highway_Input_Signal = 1 Enable_Display = off Input_Switch = on |
Highway_Display_Mode_1 = 232 Highway_Display_Mode_2 = 183 Highway_Display_Mode_3 = 41 Highway_Display_Mode_4 = 94 |
Highway_Input_Signal = 1 Enable_Display = on Input_Switch = on |
Highway_Display_Mode_1 = 213 Highway_Display_Mode_2 = 183 Highway_Display_Mode_3 = 9 Highway_Display_Mode_4 = 94 |
From inputs the conditions are implemented as below in a subsystem:
Inside the subsystem, there is algorithm
State flow chart algorithm and symbols panel used are shown below
3. As per 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.
Condition |
Action |
Lane_Input_Signal= 6 Enable_Display = off Input_Switch = on |
Lane_Display_Mode_1 = 132 Lane_Display_Mode_2 = 185 Lane_Display_Mode_3 = 54 Lane_Display_Mode_4 = 67 |
Lane_Input_Signal= 6 Enable_Display = on Input_Switch = on |
Lane_Display_Mode_1 = 127 Lane_Display_Mode_2 = 248 Lane_Display_Mode_3 = 186 Lane_Display_Mode_4 = 84 |
From the inputs, conditions are implemented as below:
Inside the subsystem:
The algorithm is as below:
According to the Requirement-2, the Highway_Display_mode and Lane_Display_mode are as follows:
4. As per 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”.
From the inputs, conditions are implemented as below:
5. The total system is as below:
Or it can be shown in single subsystem as follows:
6. Now change the System target file as autosar.tlc and Solver as Fixed - step
7. Now Goto ---> Apps ---> select AUTOSAR component designer, it opens - AUTOSAR Code mappings as below, so configure the receiver, sender, SR interfaces ports in it:
XML options:
Receiver ports:
SenderPorts:
SR interfaces:
Dataelements in SR interface:
8. After configuring all ports, Validate the model in AUTOSAR SW Components window, so that all are mapped:
9. After validation, run the program for Model Advisor check
The Model advisor report is attached for reference
10. Now generate the code for AUTOSAR code generation:
The file Highway_Lanechange_Assistant.c code is as follows:
/*
* File: Highway_Lanechange_Assist.c
*
* Code generated for Simulink model 'Highway_Lanechange_Assist'.
*
* Model version : 1.5
* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
* C/C++ source code generated on : Mon Sep 20 23:12:20 2021
*
* Target selection: autosar.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Highway_Lanechange_Assist.h"
#include "Highway_Lanechange_Assist_private.h"
/* Named constants for Chart: '<S3>/Highway Display Unit Algorithm' */
#define Highway_Lanechan_IN_Condition_1 ((uint8)1U)
#define Highway_Lanechan_IN_Condition_2 ((uint8)2U)
/* Block signals (default storage) */
B_Highway_Lanechange_Assist_T Highway_Lanechange_Assist_B;
/* Block states (default storage) */
DW_Highway_Lanechange_Assist_T Highway_Lanechange_Assist_DW;
/* Model step function */
void Highway_Lanechange_Assist_Step(void)
{
sint32 rtb_Highway_Display_Mode_1;
sint32 rtb_Highway_Display_Mode_3;
float64 tmp;
sint32 tmp_0;
/* Chart: '<S3>/Highway Display Unit Algorithm' incorporates:
* Inport: '<Root>/Enable_Display'
* Inport: '<Root>/Highway_Input_Signal'
* Inport: '<Root>/Input_Switch'
*/
if (((uint32)Highway_Lanechange_Assist_DW.is_active_c3_Highway_Lanechange) ==
0U) {
Highway_Lanechange_Assist_DW.is_active_c3_Highway_Lanechange = 1U;
Highway_Lanechange_Assist_DW.is_c3_Highway_Lanechange_Assist =
Highway_Lanechan_IN_Condition_1;
rtb_Highway_Display_Mode_1 = 232;
rtb_Highway_Display_Mode_3 = 41;
} else if (((uint32)
Highway_Lanechange_Assist_DW.is_c3_Highway_Lanechange_Assist) ==
Highway_Lanechan_IN_Condition_1) {
if (((((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
()) == 1) && (((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Enable_Display_DE_Enable_Display
()) == 1)) && (((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Input_Switch_DE_Input_Switch
()) == 1)) {
Highway_Lanechange_Assist_DW.is_c3_Highway_Lanechange_Assist =
Highway_Lanechan_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;
}
} else {
/* case IN_Condition_2: */
if (((((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
()) == 1) && (((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Enable_Display_DE_Enable_Display
()) == 0)) && (((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Input_Switch_DE_Input_Switch
()) == 1)) {
Highway_Lanechange_Assist_DW.is_c3_Highway_Lanechange_Assist =
Highway_Lanechan_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: '<S3>/Highway Display Unit Algorithm' */
/* Outputs for Enabled SubSystem: '<S1>/Lane_Display_Mode' incorporates:
* EnablePort: '<S4>/Enable'
*/
/* RelationalOperator: '<S2>/Compare' incorporates:
* Constant: '<S2>/Constant'
* Inport: '<Root>/Lane_Input_Signal'
*/
if (Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Lane_Input_Signal_DE_Lane_Input_Signal
() == ((uint8)6U)) {
/* Chart: '<S4>/Lane_Display_Unit_Algorithm' incorporates:
* Inport: '<Root>/Enable_Display'
* Inport: '<Root>/Input_Switch'
*/
if (((uint32)Highway_Lanechange_Assist_DW.is_active_c1_Highway_Lanechange) ==
0U) {
Highway_Lanechange_Assist_DW.is_active_c1_Highway_Lanechange = 1U;
Highway_Lanechange_Assist_DW.is_c1_Highway_Lanechange_Assist =
Highway_Lanechan_IN_Condition_1;
Highway_Lanechange_Assist_B.Lane_Display_Mode_1 = 132.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_2 = 185.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_3 = 54.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_4 = 67.0;
} else if (((uint32)
Highway_Lanechange_Assist_DW.is_c1_Highway_Lanechange_Assist) ==
Highway_Lanechan_IN_Condition_1) {
if ((((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Enable_Display_DE_Enable_Display
()) == 1) && (((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Input_Switch_DE_Input_Switch
()) == 1)) {
Highway_Lanechange_Assist_DW.is_c1_Highway_Lanechange_Assist =
Highway_Lanechan_IN_Condition_2;
Highway_Lanechange_Assist_B.Lane_Display_Mode_1 = 127.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_2 = 248.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_3 = 186.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_4 = 84.0;
} else {
Highway_Lanechange_Assist_B.Lane_Display_Mode_1 = 132.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_2 = 185.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_3 = 54.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_4 = 67.0;
}
} else {
/* case IN_Condition_2: */
if ((((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Enable_Display_DE_Enable_Display
()) == 0) && (((sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Input_Switch_DE_Input_Switch
()) == 1)) {
Highway_Lanechange_Assist_DW.is_c1_Highway_Lanechange_Assist =
Highway_Lanechan_IN_Condition_1;
Highway_Lanechange_Assist_B.Lane_Display_Mode_1 = 132.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_2 = 185.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_3 = 54.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_4 = 67.0;
} else {
Highway_Lanechange_Assist_B.Lane_Display_Mode_1 = 127.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_2 = 248.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_3 = 186.0;
Highway_Lanechange_Assist_B.Lane_Display_Mode_4 = 84.0;
}
}
/* End of Chart: '<S4>/Lane_Display_Unit_Algorithm' */
}
/* End of RelationalOperator: '<S2>/Compare' */
/* End of Outputs for SubSystem: '<S1>/Lane_Display_Mode' */
/* Switch: '<S1>/Switch 1' incorporates:
* Inport: '<Root>/Highway_Input_Signal'
* Switch: '<S1>/Switch 2'
* Switch: '<S1>/Switch 3'
* Switch: '<S1>/Switch 4'
*/
tmp_0 = (sint32)
Rte_IRead_Highway_Lanechange_Assist_Step_Rp_Highway_Input_Signal_DE_Highway_Input_Signal
();
if (tmp_0 > ((sint32)((uint8)0U))) {
tmp = (float64)rtb_Highway_Display_Mode_1;
} else {
tmp = Highway_Lanechange_Assist_B.Lane_Display_Mode_1;
}
/* End of Switch: '<S1>/Switch 1' */
/* Outport: '<Root>/Display_Mode_1' */
Rte_IWrite_Highway_Lanechange_Assist_Step_Pp_Display_Mode_1_DE_Display_Mode_1
(tmp);
/* Switch: '<S1>/Switch 2' */
if (tmp_0 > ((sint32)((uint8)0U))) {
tmp = 183.0;
} else {
tmp = Highway_Lanechange_Assist_B.Lane_Display_Mode_2;
}
/* Outport: '<Root>/Display_Mode_2' */
Rte_IWrite_Highway_Lanechange_Assist_Step_Pp_Display_Mode_2_DE_Display_Mode_2
(tmp);
/* Switch: '<S1>/Switch 3' */
if (tmp_0 > ((sint32)((uint8)0U))) {
tmp = (float64)rtb_Highway_Display_Mode_3;
} else {
tmp = Highway_Lanechange_Assist_B.Lane_Display_Mode_3;
}
/* Outport: '<Root>/Display_Mode_3' */
Rte_IWrite_Highway_Lanechange_Assist_Step_Pp_Display_Mode_3_DE_Display_Mode_3
(tmp);
/* Switch: '<S1>/Switch 4' */
if (tmp_0 > ((sint32)((uint8)0U))) {
tmp = 94.0;
} else {
tmp = Highway_Lanechange_Assist_B.Lane_Display_Mode_4;
}
/* Outport: '<Root>/Display_Mode_4' */
Rte_IWrite_Highway_Lanechange_Assist_Step_Pp_Display_Mode_4_DE_Display_Mode_4
(tmp);
}
/* Model initialize function */
void Highway_Lanechange_Assist_Init(void)
{
/* (no initialization code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
11. The model is simulated as per the conditions given, without any errors and are mapped correctly.
CONCLUSION: Highway Assistant - Lane Changing Assistant is developed according to the MAAB guidelines and related files - Simulink Data Dictionary (SLDD file) , Model Advisor Check report, Model are attached for reference.
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-Highway Assistant-Lane Changing Assistant
AIM: To develop one specific requirement of Highway Assistant – Lane Changing Assistant algorithm. OBJECTIVE: This model must be developed in MATLAB Simulink per MBD guidelines. Code Generation Profile must be Autosar Coder. Simulink Data Dictionary must be created for the model & must be linked to…
20 Sep 2021 05:50 PM IST
Project 1- Traffic Jam Assistant Feature
AIM: To develop a single feature of Traffic Jam Assistant algorithm using MATLAB & SIMULINK. OBJECTIVE: 1. Model development as per MBD guidelines. 2. Creation of Simulink Data Dictionary (SLDD) file 3. Code Generation using Embedded Coder 4. Generate Model Advisor Report INTRODUCTION: Traffic Jam Assistant is one…
14 Sep 2021 07:04 PM IST
Project 1 (Mini Project on Vehicle Direction Detection
AIM: TO make the model for Vehicle Direction Detection OBJECTIVE: 1. To develop Vehicle Direction Detection feature as per the Requirement Document using MATLAB Simulink. 2. Follow all the MBD related processes: Requirement Tagging & Traceability, SLDD creation, Configuration Parameter changes, Model Advisor check…
14 Sep 2021 01:39 PM IST
Project 2 Thermal modeling of battery pack
AIM: To simulate 10cell series Lithium Ion battery model and to analyze thermal effects, life cycle performance at various temperatures, charge - discharge rates using MATLAB-SIMULINK. PROCEDURE: The following figure shows simulink model of 10 cells series Lithium-Ion battery model using an AC source with cyclic…
01 Sep 2021 05:20 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.