Project 1- Traffic Jam Assistant Feature
Traffic Jam Assistant Feature:
Introduction
Traffic Jam Assistant is one of the most common features in the 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 the same lane.
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 the press of a button. The vehicle will now automatically follow the vehicle in front, takes over driving off, accelerate, 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.
Simulink Model:
The model has been developed as per MAAB guidelines, the model is as shown below

Inside 'TrafficJam_Feature'.

Inside 'Requirement_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”.
- The output signal from here is “Optimum_Voltage” which will be one of the inputs to the subsystem “DisplayUnit”.
Inside 'Display_Unit'

- Input Signals are “Optimum_Voltage”, “Input_Switch”, “Enable_Display”. Signal “Enable_Display” must be saturated between the range 0 – 7. The output signal from the subsystem is “Output_Display”.
- Input Signal “Enable_Display” is compared against a pre-defined set of values in a multiport switch. The total data ports in the multiport switch are 5.
- Multiport switch inputs 1 & 2 are connected to calibration signal “ON_MODE”, Multiport switch inputs 3 & 4 are connected to calibration signal “OFF_MODE” while Multiport switch input 5 is connected to calibration signal “STANDBY_MODE”.
- The output from the 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 the value of the input signal “Input_Switch” is compared in an AND gate against the 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”.
Simulink data dictionary
The SLDD file has been created for this model as per requirement.

Attached SLLD file for reference.
Model Advisor Report:
The Model Advisor check was done with references to the MAAB Guidelines, we have cleared a maximum number of warnings.
Attached Model Advisor report for reference.

Code Generation:
Code has been generated for the above model, please find the code below.
Attached C-source file for reference.
/*
* File: TrafficJam_features.c
*
* Code generated for Simulink model 'TrafficJam_features'.
*
* Model version : 1.4
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
* C/C++ source code generated on : Tue Oct 19 14:07:30 2021
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "TrafficJam_features.h"
#include "TrafficJam_features_private.h"
/* External inputs (root inport signals with default storage) */
ExtU_TrafficJam_features_T TrafficJam_features_U;
/* External outputs (root outports fed by signals with default storage) */
ExtY_TrafficJam_features_T TrafficJam_features_Y;
/* Real-time model */
static RT_MODEL_TrafficJam_features_T TrafficJam_features_M_;
RT_MODEL_TrafficJam_features_T *const TrafficJam_features_M =
&TrafficJam_features_M_;
/* Model step function */
void TrafficJam_features_step(void)
{
real_T tmp;
/* Switch: '/Switch' incorporates:
* Constant: '/VOLTAGE_MAXIMUM_RANGE'
* Constant: '/VOLTAGE_MINIMUM_RANGE'
* Constant: '/INTERRUPT_1'
* Constant: '/INTERRUPT_2'
* Inport: '/Input_Switch'
* Inport: '/Input_Voltage'
* Logic: '/AND'
* Logic: '/AND'
* Logic: '/NOT'
* RelationalOperator: '/Relational Operator'
* RelationalOperator: '/Relational Operator1'
* RelationalOperator: '/Relational Operator'
*/
if ((!TrafficJam_features_U.Input_Switch) &&
((TrafficJam_features_U.Input_Voltage <= VOLTAGE_MAXIMUM_RANGE) &&
(TrafficJam_features_U.Input_Voltage >= VOLTAGE_MINIMUM_RANGE)) &&
(INTERRUPT_1 == INTERRUPT_2)) {
/* Saturate: '/Saturation' incorporates:
* Inport: '/Enable_Display'
*/
if (TrafficJam_features_U.Enable_Display > 7.0) {
tmp = 7.0;
} else if (TrafficJam_features_U.Enable_Display < 0.0) {
tmp = 0.0;
} else {
tmp = TrafficJam_features_U.Enable_Display;
}
/* End of Saturate: '/Saturation' */
/* MultiPortSwitch: '/Multiport Switch' */
switch ((int32_T)tmp) {
case 0:
/* Outport: '/Output_Display' incorporates:
* Constant: '/ON_MODE'
*/
TrafficJam_features_Y.Output_Display = ON_MODE;
break;
case 1:
/* Outport: '/Output_Display' incorporates:
* Constant: '/ON_MODE'
*/
TrafficJam_features_Y.Output_Display = ON_MODE;
break;
case 2:
/* Outport: '/Output_Display' incorporates:
* Constant: '/OFF_MODE'
*/
TrafficJam_features_Y.Output_Display = OFF_MODE;
break;
case 3:
/* Outport: '/Output_Display' incorporates:
* Constant: '/OFF_MODE'
*/
TrafficJam_features_Y.Output_Display = OFF_MODE;
break;
default:
/* Outport: '/Output_Display' incorporates:
* Constant: '/STANDBY_MODE'
*/
TrafficJam_features_Y.Output_Display = STANDBY_MODE;
break;
}
/* End of MultiPortSwitch: '/Multiport Switch' */
} else {
/* Outport: '/Output_Display' incorporates:
* Constant: '/NO_DISPLAY'
*/
TrafficJam_features_Y.Output_Display = NO_DISPLAY;
}
/* End of Switch: '/Switch' */
}
/* Model initialize function */
void TrafficJam_features_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void TrafficJam_features_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
Attached Simulink model, SLDD file, Model Advisor report, and generated code file for references.