Project 1- Traffic Jam Assistant Feature
AIM:
To Build Traffic Jam Assistant Feature on basis of requirenments Given.
- 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.
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.
REQUIRENMENTs:
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”.
Steps:
1]Creating sldd file on given data
Goto->Modeling->Link_To_Data-Dictionary
Click on new -> Give file name and save

Step 2]
Modeling on Requirenment 1

Modeling on Requirenment 2

Step 3]
Run the model and check for any errors and warnings.
Signal Resolution and propagation is done

Step4]
Do Model Advisory for MAB guidelines.

Step5]
Froms Modeling->Model Settings->Code generation;
Select Embeded coder
now
Goto ->APPS->Embeded Coder->Build
generated code
/*
* File: Traffic_JamA.c
*
* Code generated for Simulink model 'Traffic_JamA'.
*
* Model version : 1.2
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
* C/C++ source code generated on : Wed Jun 8 22:33:52 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Traffic_JamA.h"
#include "Traffic_JamA_private.h"
/* External inputs (root inport signals with default storage) */
ExtU_Traffic_JamA_T Traffic_JamA_U;
/* External outputs (root outports fed by signals with default storage) */
ExtY_Traffic_JamA_T Traffic_JamA_Y;
/* Real-time model */
static RT_MODEL_Traffic_JamA_T Traffic_JamA_M_;
RT_MODEL_Traffic_JamA_T *const Traffic_JamA_M = &Traffic_JamA_M_;
/* Model step function */
void Traffic_JamA_step(void)
{
uint8_T tmp;
/* Switch: '/Switch' incorporates:
* Constant: '/Constant'
* Constant: '/Constant1'
* Inport: '/Input_Switch'
* Inport: '/Input_Voltage'
* Logic: '/AND'
* Logic: '/AND'
* Logic: '/AND1'
* Logic: '/NOT'
* RelationalOperator: '/Relational Operator'
* RelationalOperator: '/Relational Operator1'
*/
if ((Traffic_JamA_U.Input_Voltage >= 30) && (Traffic_JamA_U.Input_Voltage <=
50) && (!Traffic_JamA_U.Input_Switch) && Traffic_JamA_ConstB.Equal) {
/* Saturate: '/Saturation' incorporates:
* Inport: '/Enable_Display'
*/
if (Traffic_JamA_U.Enable_Display < 7) {
tmp = Traffic_JamA_U.Enable_Display;
} else {
tmp = 7U;
}
/* End of Saturate: '/Saturation' */
/* MultiPortSwitch: '/Multiport Switch' */
switch (tmp) {
case 1:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant'
*/
Traffic_JamA_Y.Output_Display = 1U;
break;
case 2:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant'
*/
Traffic_JamA_Y.Output_Display = 1U;
break;
case 3:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant1'
*/
Traffic_JamA_Y.Output_Display = 2U;
break;
case 4:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant1'
*/
Traffic_JamA_Y.Output_Display = 2U;
break;
default:
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant2'
*/
Traffic_JamA_Y.Output_Display = 3U;
break;
}
/* End of MultiPortSwitch: '/Multiport Switch' */
} else {
/* Outport: '/Output_Display' incorporates:
* Constant: '/Constant3'
*/
Traffic_JamA_Y.Output_Display = 0U;
}
/* End of Switch: '/Switch' */
}
/* Model initialize function */
void Traffic_JamA_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Traffic_JamA_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/