Project 1- Traffic Jam Assistant Feature
Aim Of The Project:
Implementation of the Traffic Jam Assistant algorithm which would predominantly feature in the IPC algorithm.
Objective of the Project:
- The model must be developed in MATLAB Simulink as per MBD guidelines.
- 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.
Introduction:
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.

The BMW Traffic Jam Assistant helps you maintain control of your vehicle in driving conditions where routine tasks are necessary but it’s hard to stay focused on the road, like in a traffic jam. This system can help you keep tabs on the car in front of you from inside your BMW at speeds up to 40 MPH. It is worth noting that the BMW Traffic Jam Assistant is a hands-on program, which means you must keep your hands on the steering wheel at all times for it to work.
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.
Development of the Target Model:
As per the requirement as shown below the target model has been developed:
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 Overall Model of Traffic Jam Assistant Feature is shown below:

The Subsystem of the main model as per Requirement 1 is shown below:

The Display Unit Model as per Requirement 2 is shown below:

Procedures:
1. Linking the Model with SLDD:
After finishing the model design, the signals and the calibration parameters used in the Model are linked in the SLDD as shown below:

2. Resolving and Propagating the Signal at various stages:
All the input and output signals are resolved at their origin and they are propagated at the corresponding stages as shown below:
For Input:


For Output:

1
3. Changes in Configuration parameters for simulation and code generation:
For Simulation the Solver Setting choosen are as follows:

For Code Generation, the embedded coder is as target file as shown below:

Results and Discussion:
Code Generation:
The following model is successfully simulated and the corresonding source file and the header file is generated as follows:
C Source File:
/*
* File: Traffic_Jam_Assistant_Model.c
*
* Code generated for Simulink model 'Traffic_Jam_Assistant_Model'.
*
* Model version : 1.5
* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
* C/C++ source code generated on : Fri Aug 20 21:53:55 2021
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Traffic_Jam_Assistant_Model.h"
#include "Traffic_Jam_Assistant_Model_private.h"
/* Real-time model */
RT_MODEL_Traffic_Jam_Assistan_T Traffic_Jam_Assistant_Model_M_;
RT_MODEL_Traffic_Jam_Assistan_T *const Traffic_Jam_Assistant_Model_M =
&Traffic_Jam_Assistant_Model_M_;
/* Model step function */
void Traffic_Jam_Assistant_Model_step(void)
{
/* local block i/o variables */
boolean_T Optimum_Voltage;
uint8_T tmp;
/* RelationalOperator: '/Relational Operator1' incorporates:
* Constant: '/Constant'
* Constant: '/Constant1'
* Inport: '/Input_Voltage'
* RelationalOperator: '/Relational Operator'
*/
Optimum_Voltage = ((uint32_T)(Input_Voltage >= VOLTAGE_MINIMUM_RANGE) <=
VOLTAGE_MAXIMUM_RANGE);
/* Switch: '/Switch' incorporates:
* Constant: '/Constant3'
* Constant: '/Constant4'
* Constant: '/Constant5'
* Inport: '/Input_Switch'
* Logic: '/AND'
* Logic: '/AND1'
* Logic: '/AND2'
* RelationalOperator: '/Relational Operator'
*/
if ((!Input_Switch) && Optimum_Voltage && (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' incorporates:
* Constant: '/Constant'
* Constant: '/Constant1'
* Constant: '/Constant2'
*/
switch (tmp) {
case 1:
Output_Display = ON_MODE;
break;
case 2:
Output_Display = ON_MODE;
break;
case 3:
Output_Display = OFF_MODE;
break;
case 4:
Output_Display = OFF_MODE;
break;
default:
Output_Display = STANDBY_MODE;
break;
}
/* End of MultiPortSwitch: '/Multiport_Switch' */
} else {
Output_Display = NO_DISPLAY;
}
/* End of Switch: '/Switch' */
}
/* Model initialize function */
void Traffic_Jam_Assistant_Model_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Traffic_Jam_Assistant_Model_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
C Header File:
/*
* File: Traffic_Jam_Assistant_Model.h
*
* Code generated for Simulink model 'Traffic_Jam_Assistant_Model'.
*
* Model version : 1.5
* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
* C/C++ source code generated on : Fri Aug 20 21:53:55 2021
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#ifndef RTW_HEADER_Traffic_Jam_Assistant_Model_h_
#define RTW_HEADER_Traffic_Jam_Assistant_Model_h_
#ifndef Traffic_Jam_Assistant_Model_COMMON_INCLUDES_
# define Traffic_Jam_Assistant_Model_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif /* Traffic_Jam_Assistant_Model_COMMON_INCLUDES_ */
#include "Traffic_Jam_Assistant_Model_types.h"
/* Includes for objects with custom storage classes. */
#include "Traffic_Jam_Assistant_Functions.h"
/* Macros for accessing real-time model data structure */
#ifndef rtmGetErrorStatus
# define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
#endif
#ifndef rtmSetErrorStatus
# define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
#endif
/* Real-time Model Data Structure */
struct tag_RTM_Traffic_Jam_Assistant_T {
const char_T * volatile errorStatus;
};
/* Model entry point functions */
extern void Traffic_Jam_Assistant_Model_initialize(void);
extern void Traffic_Jam_Assistant_Model_step(void);
extern void Traffic_Jam_Assistant_Model_terminate(void);
/* Real-time Model object */
extern RT_MODEL_Traffic_Jam_Assistan_T *const Traffic_Jam_Assistant_Model_M;
/*-
* The generated code includes comments that allow you to trace directly
* back to the appropriate location in the model. The basic format
* is /block_name, where system is the system number (uniquely
* assigned by Simulink) and block_name is the name of the block.
*
* Use the MATLAB hilite_system command to trace the generated code back
* to the model. For example,
*
* hilite_system('') - opens system 3
* hilite_system('/Kp') - opens and selects block Kp which resides in S3
*
* Here is the system hierarchy for this model
*
* '' : 'Traffic_Jam_Assistant_Model'
* '' : 'Traffic_Jam_Assistant_Model/Traffic_Jam_Assistant_Algorithm'
* '' : 'Traffic_Jam_Assistant_Model/Traffic_Jam_Assistant_Algorithm/Display_Unit'
*/
#endif /* RTW_HEADER_Traffic_Jam_Assistant_Model_h_ */
/*
* File trailer for generated code.
*
* [EOF]
*/
Model Advisor Check:
The model advisor report following the MAAB and JMAAB guidelines are shown below:

Conclusion:
The model corresponding to Traffic Jam Assistant feature is successfully implemented. All the compliant changes pertaining to MBD, linking of the model to the SLDD, Code generation and ultimately generation of the Model Advisor Report is presented with detailed analysis.