Traffic Jam Assistant Feature
Traffic Jam Assistant Feature
Introduction to the Feature:
Traffic Jam Assistant is one of the most common feature in Advanced Driver Assistance System. Traffic Jam Assistant helps the driver arrive more relaxed at their destination, even in dense traffic or in traffic jams. As a partially automated comfort function, the system takes over the longitudinal & lateral guidance of the vehicle. This means that the car can drive off, accelerate & brake automatically, as well as steer the vehicle within certain constraints. The driver has to permanently supervise the system & be ready to take over the complete control of the vehicle at any time.
Traffic Jam Assistant system helps to avoid rear end collisions in dense traffic conditions & traffic jams. In Traffic jams, the vehicle takes over driving off, acceleration, braking and steering within same lane.
Basic Working Principle:
Traffic Jam Assistant is based on the sensors and the functionality of the Adaptive Cruise Control (ACC) with stop & go and Lane Keeping Support (LKS). When ACC ‘Stop & 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 or a traffic jam at speeds less than 60 kmph, the driver can activate the functionality by press of a button. The vehicle will now automatically follow the vehicle in front, takes over driving off, acceleration, braking and steering within 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.
Problem Statement:
To develop one specific requirement of Traffic Jam Assistant algorithm which would predominantly feature in the IPC algorithm.Please note that the whole Traffic Jam Assistant is a very huge algorithm & only one small part of the logic is implemented here. Idea is to familiarize with concepts of Model Based Development in MATLAB Environment. The Project must be done keeping in mind the following processes & steps.
- This model must be developed in MATLAB Simulink as per MBD guidelines.
- Code Generation Profile must be in Embedded Coder.
- Simulink Data Dictionary must be created for the model & must be linked to the model.
- Model Advisor Report is mandatory & this will be followed by Code Generation.
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 |
Requirement No 1:
- Input Signal “Input_Voltage” is compared against voltage values “VOLTAGE_MINIMUM_RANGE” & “VOLTAGE_MAXIMUM_RANGE”.
- Incoming input signal “Input_Voltage” must be greater than – equal to “VOLTAGE_MINIMUM_RANGE” and less than – equal to “VOLTAGE_MAXIMUM_RANGE”.
- Output signal from here is “Optimum_Voltage” which will be one of the inputs to the subsystem “DisplayUnit”.
Requirement No 2 (DisplayUnit Subsystem):
- Input Signals are “Optimum_Voltage”, “Input_Switch”,“Enable_Display”. Signal “Enable_Display” must be saturated between the range 0 – 7. Output signal from the subsystem is “Output_Display”.
- Input Signal “Enable_Display” is compared against pre – defined set of values in a multiport switch. Total data ports in the multiport switch is 5.
- Multiport switch inputs 1 & 2 is connected to calibration signal “ON_MODE”, Multiport switch inputs 3 & 4 is connected to calibration signal “OFF_MODE” while Multiport switch input 5 is connected to calibration signal “STANDBY_MODE”.
- The output from Multiport switch is connected to the first input port of the Switch block. The third input port of the Switch block is connected to the calibration signal “NO_DISPLAY”.
- Meanwhile NOT value of input signal “Input_Switch” is compared in an AND gate against input signal “Optimum_Voltage” and the output from comparing if calibration signals “INTERRUPT_1” & “INTERRUPT_2” are equal. The output of the AND gate is the second input of the switch block.
- The output from the switch block is “Output_Display”.
The Model:

The top layer has three inputs. The input voltage, input switch and the display enable. The output display is the output.

Requirement 1:
The first requirement is to check if the input voltage is in range between 30 and 50.

Requirements 2:
In the requirement 2 the output display is predicted. Depending on the enable display, the mode is selected between OFF_MODE, ON_MODE and STANDBY_MODE.
If the input switch is 0 and the interrupt signals 1 and 2 are same, then the output display is same as the display mode selected. If the interrupt signals are not equal or the input switch is 1, then there is no display.

SLDD File:

The SLDD file is created in workspace and then imported as follows:





/*
* File: Traffic_Jam_Assistant.c
*
* Code generated for Simulink model 'Traffic_Jam_Assistant'.
*
* Model version : 14.61
* Simulink Coder version : 9.9 (R2023a) 19-Nov-2022
* C/C++ source code generated on : Thu May 25 08:16:32 2023
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Traffic_Jam_Assistant.h"
#include
#include "rt_nonfinite.h"
#include "rtwtypes.h"
#include
/* External inputs (root inport signals with default storage) */
ExtU_Traffic_Jam_Assistant_T Traffic_Jam_Assistant_U;
/* External outputs (root outports fed by signals with default storage) */
ExtY_Traffic_Jam_Assistant_T Traffic_Jam_Assistant_Y;
/* Real-time model */
static RT_MODEL_Traffic_Jam_Assistan_T Traffic_Jam_Assistant_M_;
RT_MODEL_Traffic_Jam_Assistan_T *const Traffic_Jam_Assistant_M =
&Traffic_Jam_Assistant_M_;
/* Model step function */
void Traffic_Jam_Assistant_step(void)
{
real_T tmp;
int32_T tmp_0;
/* Switch: '/Switch' incorporates:
* Constant: '/Constant'
* Constant: '/Constant1'
* Inport: '/Input_Switch'
* Inport: '/Input_Voltage'
* Logic: '/Logical Operator'
* Logic: '/Logical Operator'
* Logic: '/Logical Operator1'
* Logic: '/Logical Operator2'
* RelationalOperator: '/Relational Operator'
* RelationalOperator: '/Relational Operator1'
*/
if ((Traffic_Jam_Assistant_U.Input_Voltage >= 30) &&
(Traffic_Jam_Assistant_U.Input_Voltage <= 50) &&
(!Traffic_Jam_Assistant_U.Input_Switch) &&
Traffic_Jam_Assistant_ConstB.LogicalOperator3) {
/* Saturate: '/Saturation1' incorporates:
* Inport: '/Enable_Display'
*/
if (Traffic_Jam_Assistant_U.Enable_Display > 7.0) {
tmp = 7.0;
} else if (Traffic_Jam_Assistant_U.Enable_Display < 0.0) {
tmp = 0.0;
} else {
tmp = Traffic_Jam_Assistant_U.Enable_Display;
}
/* DataTypeConversion: '/Data Type Conversion' incorporates:
* Saturate: '/Saturation1'
*/
tmp = floor(tmp);
if (rtIsNaN(tmp)) {
tmp_0 = 0;
} else {
tmp_0 = (int32_T)tmp;
}
/* MultiPortSwitch: '/Multiport Switch' incorporates:
* DataTypeConversion: '/Data Type Conversion'
*/
switch (tmp_0) {
case 0:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant'
*/
Traffic_Jam_Assistant_Y.Output_Display = 2U;
break;
case 1:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant'
*/
Traffic_Jam_Assistant_Y.Output_Display = 2U;
break;
case 2:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant1'
*/
Traffic_Jam_Assistant_Y.Output_Display = 1U;
break;
case 3:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant1'
*/
Traffic_Jam_Assistant_Y.Output_Display = 1U;
break;
default:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant2'
*/
Traffic_Jam_Assistant_Y.Output_Display = 3U;
break;
}
/* End of MultiPortSwitch: '/Multiport Switch' */
} else {
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant5'
*/
Traffic_Jam_Assistant_Y.Output_Display = 0U;
}
/* End of Switch: '/Switch' */
}
/* Model initialize function */
void Traffic_Jam_Assistant_initialize(void)
{
/* Registration code */
/* initialize non-finites */
rt_InitInfAndNaN(sizeof(real_T));
/* initialize error status */
rtmSetErrorStatus(Traffic_Jam_Assistant_M, (NULL));
/* external inputs */
(void)memset(&Traffic_Jam_Assistant_U, 0, sizeof(ExtU_Traffic_Jam_Assistant_T));
/* external outputs */
Traffic_Jam_Assistant_Y.Output_Display = 0U;
}
/* Model terminate function */
void Traffic_Jam_Assistant_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/