All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim: To create a Simulink Data Dictionary, develop an algorithm for one of the features of the Traffic jam Assistance and generate a C code for it using Simulink. Objective: Model Development as per the MBD guidelines Creation of Simulink Data Dictionary Code generation using Embedded Coder Generating Model Advisor Report…
Sanket Nehete
updated on 13 Oct 2021
Aim:
To create a Simulink Data Dictionary, develop an algorithm for one of the features of the Traffic jam Assistance and generate a C code for it using Simulink.
Objective:
Overview:
In the Advanced Driver Assistance System, the Traffic Jam Assistance system is one of the most common features of it. Traffic Jam Assistant helps the driver arrive more relaxed at their destination, even in dense traffic. As a partially automated comfort function, the system takes over the longitudinal and lateral guidance of the vehicle. This means that the car can drive off, accelerate and brake automatically, as well as steer the vehicle within certain constraints. The driver has to permanently supervise the system and be ready to take over the complete control of the vehicle at any time.
Traffic jam assistance system helps to avoid rear-end collisions in dense traffic conditions and traffic jams. In traffic jams, the vehicle takes over driving off, acceleration, braking, and steering within the same lane.
Basic Working Principle:
Traffic jam Assistant is based on the sensors and the functionality of the Adaptive Cruise Control (ACC) with stop and go and Lane Keeping Support (LKS). When ACC ‘Stop and Go’ is turned ON, the Traffic Jam Assistant continuously analyses the speed of the surrounding vehicles and compares it with the own driving speed. If the system detects dense traffic at less than 60 kmph, the driver can activate the functionality by the press of a button. The vehicle will now automatically follow the vehicle in front, takes over driving off, acceleration, braking, and steering within the same lane.
Information regarding the Traffic Jam Assistant will be available to be displayed to the driver in the Instrument Panel Cluster (IPC). The algorithm which the students need to implement here in this project is predominantly based on IPC units.
Signals given to us are,
Input Signals:
Name of the Signal |
Data Type |
Range |
Input_Voltage |
uint8 |
0 - 255 |
Input_Switch |
boolean |
0 – 1 |
Enable_Display |
uint8 |
0 - 255 |
Output Signal:
Name of the Signal |
Data Type |
Range |
Output_Display |
uint8 |
0 - 255 |
Calibration Signals:
Name of the Signal |
Data Type |
Range |
Initial Value |
VOLTAGE_MINIMUM_RANGE |
uint8 |
0 – 255 |
30 |
VOLTAGE_MAXIMUM_RANGE |
uint8 |
0 – 255 |
50 |
OFF_MODE |
uint8 |
0 – 255 |
2 |
ON_MODE |
uint8 |
0 – 255 |
1 |
STANDBY_MODE |
uint8 |
0 – 255 |
3 |
INTERRUPT_1 |
boolean |
0 – 1 |
1 |
INTERRUPT_2 |
boolean |
0 - 1 |
1 |
NO_DISPLAY |
uint8 |
0 – 255 |
0 |
Local Signal:
Name of the Signal |
Data Type |
Range |
Optimum_Voltage |
boolean |
0 - 1 |
Procedure:
The figure below shows the Simulink data dictionary (sldd) file according to the given inputs.
Requirement_1:
Requirement No 2 (DisplayUnit Subsystem):
The figure below shows the whole model created for the Traffic Jam Assistance feature with all the input and output ports using Simulink
Now, lets carry out the Model Advisor Check,
We can see that there are zero errors thus we can proceed to our next step that is code generation
Code generation,
Traffic_Jam_Assistance.c
/*
* Trial License - for use to evaluate programs for possible purchase as
* an end-user only.
*
* File: Traffic_Jam_Assistance.c
*
* Code generated for Simulink model 'Traffic_Jam_Assistance'.
*
* Model version : 1.1
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
* C/C++ source code generated on : Wed Oct 13 16:32:00 2021
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Traffic_Jam_Assistance.h"
#include "Traffic_Jam_Assistance_private.h"
/* Exported block signals */
uint8_T Output_Display; /* '/Switch' */
/* Exported data definition */
/* ConstVolatile memory section */
/* Definition for custom storage class: ConstVolatile */
const volatile boolean_T Interrupt_1 = 1;/* Referenced by: '/Constant' */
const volatile boolean_T Interrupt_2 = 1;/* Referenced by: '/Constant1' */
const volatile uint8_T No_Display = 0U;/* Referenced by: '/Constant2' */
const volatile uint8_T Off_Mode = 2U; /* Referenced by: '/Off_Mode' */
const volatile uint8_T On_Mode = 1U; /* Referenced by: '/On_Mode' */
const volatile uint8_T Standby_Mode = 3U;/* Referenced by: '/Standby_Mode' */
const volatile uint8_T Voltage_Maximum_Range = 50U;/* Referenced by: '/Constant' */
const volatile uint8_T Voltage_Minimum_Range = 30U;/* Referenced by: '/Constant' */
/* Real-time model */
static RT_MODEL_Traffic_Jam_Assistan_T Traffic_Jam_Assistance_M_;
RT_MODEL_Traffic_Jam_Assistan_T *const Traffic_Jam_Assistance_M =
&Traffic_Jam_Assistance_M_;
/* Model step function */
void Traffic_Jam_Assistance_step(void)
{
/* local block i/o variables */
boolean_T Optimum_Voltage;
uint8_T tmp;
/* Logic: '/Logical Operator' incorporates:
* Constant: '/Constant'
* Constant: '/Constant'
* Inport: '/Input_Voltage'
* RelationalOperator: '/Compare'
* RelationalOperator: '/Compare'
*/
Optimum_Voltage = ((Input_Voltage >= Voltage_Minimum_Range) || (Input_Voltage <=
Voltage_Maximum_Range));
/* Switch: '/Switch' incorporates:
* Constant: '/Constant'
* Constant: '/Constant1'
* Inport: '/Input_Switch'
* Logic: '/Logical Operator'
* Logic: '/Logical Operator1'
* RelationalOperator: '/Relational Operator'
*/
if (Optimum_Voltage && (!Input_Switch) && (Interrupt_1 == Interrupt_2)) {
/* Saturate: '/Saturation' incorporates:
* Inport: '/Enable_Display'
*/
if (Enable_Display < 7) {
tmp = Enable_Display;
} else {
tmp = 7U;
}
/* End of Saturate: '/Saturation' */
/* MultiPortSwitch: '/Multiport Switch' */
switch (tmp) {
case 1:
/* Switch: '/Switch' incorporates:
* Constant: '/On_Mode'
*/
Output_Display = On_Mode;
break;
case 2:
/* Switch: '/Switch' incorporates:
* Constant: '/On_Mode'
*/
Output_Display = On_Mode;
break;
case 3:
/* Switch: '/Switch' incorporates:
* Constant: '/Off_Mode'
*/
Output_Display = Off_Mode;
break;
case 4:
/* Switch: '/Switch' incorporates:
* Constant: '/Off_Mode'
*/
Output_Display = Off_Mode;
break;
default:
/* Switch: '/Switch' incorporates:
* Constant: '/Standby_Mode'
*/
Output_Display = Standby_Mode;
break;
}
/* End of MultiPortSwitch: '/Multiport Switch' */
} else {
/* Switch: '/Switch' incorporates:
* Constant: '/Constant2'
*/
Output_Display = No_Display;
}
/* End of Switch: '/Switch' */
}
/* Model initialize function */
void Traffic_Jam_Assistance_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Traffic_Jam_Assistance_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
Software in Loop verification for the generated code using Simulation Data inspector,
From the above graph we can see that the output is 3 and the tolerance is 0, thus the generated code has successfully passed the Software-in-Loop test.
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...
Week 7 State of charge estimation
Aim1: Simulate the 3 test cases from harness dashboard and write a detailed report on the results Solution: Battery Management System (BMS) – A battery management system is the electronic system that manages the rechargeable battery, such as by protecting the battery from operating outside its safe operating area, monitoring…
23 Nov 2021 07:00 AM IST
Project 2-Highway Assistant-Lane Changing Assistant
AIM: To develop an algorithm for one of the features of the Highway Lane Changing Assistance, create a Simulink Data Dictionary for the given signals data lists, develop a model advisor report and generate a C code for it using AUTOSAR coder in SIMULINK Objective: Model development in MATLAB Simulink as per MBD guidelines…
16 Oct 2021 06:49 PM IST
Project 1- Traffic Jam Assistant Feature
Aim: To create a Simulink Data Dictionary, develop an algorithm for one of the features of the Traffic jam Assistance and generate a C code for it using Simulink. Objective: Model Development as per the MBD guidelines Creation of Simulink Data Dictionary Code generation using Embedded Coder Generating Model Advisor Report…
13 Oct 2021 11:22 AM IST
Project 1 (Mini Project on Vehicle Direction Detection
Aim: To make a model for vehicle direction determination and making the sldd file Introduction: Identifying the direction of the vehicle is one of the important & diverse features in Autonomous driving & Advanced Driver Assistance Features. This particular sub-feature of identifying the direction of vehicle…
05 Oct 2021 07:56 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.