Project 1- Traffic Jam Assistant Feature
Answere :
Project 1- Traffic Jam Assistant Feature:
Aim : Model Development of a single feature of Traffic Jam Assist using MATLAB & Simulink as well as Code Generation using Embedded Coder.
Objectives :
1. Model Development as per MBD guidelines .Creation of Simulink Data Dictionary.
2. Code Generation using Embedded Coder Generating Model Advisor Report.
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 ofthesurrounding 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, 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.
- 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.

Designing MATLAB Simulink Model :
Step1: Requirement Analysis :
The Input Voltage, Input Switch ,and the Enable switch are the inputs to the system,and the Output Display is the final Output from the system.
The Overall Model of Traffic Jam Assistant Feature is shown in below.


Requirement 1 :
The Subsystem of the main model as per Requirement 1 is shown below:
• 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 2 –Display Unit 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”.


Step2 : Creation of Simulink Data Dictionary file (SLDD) :
A new simulink data dictionary is created and Updated signals and Calibration data list as per our Requirement.
The Very first thing that we will do is create a simulink data dictionary using the given Signals and Clibration Data list.
The Following is the SLDD File:

Step3: Requirement Tagging :
The steps involved in tagging a requirement in the Simulink model is to first highlight the requirement statement in the Word document, then right click on the subsystem in the model that has to be tagged, then select ‘Requirements’ and then ‘Link to Selection in Word’.
Requirement_1_Subsystem :

Requirement_2_Subsystem :

Step 4: Configuration Parameter Update :
Click on the Model Setting and goes to the Configration Window

In the same configuration window there another settings to model, which is Code generation. Click on code generation, Choose the system targer file as ert.lc (Embedded coder) by clicking on the browse option. Then click on Ok and close the window.

Choose System Target File :

Resolving and Propagating the Signal at various stages:

Step 5: MAB Guidelines Check For Model Explorer :
A check is performed using ‘Model Advisor’ tool in Simulink to see whether the developed model meets the modeling standards for MAB. First go to model advisor and click on ‘MAB’ then run the programme.


Step 6: Embedded Coder (Code Generation) :
Using embedded coder convert the simulnik model as a ‘c code’ file. This file is code generation file.

After clicking on Build it will generate the C Code of our simulink as shown inn the following figure.

Output Code :
/*
* File: Traffic_Jam_Assistant.c
*
* Code generated for Simulink model 'Traffic_Jam_Assistant'.
*
* Model version : 1.2
* Simulink Coder version : 9.7 (R2022a) 13-Nov-2021
* C/C++ source code generated on : Fri Jan 6 13:40:55 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 "rtwtypes.h"
#include "Traffic_Jam_Assistant_private.h"
#include "Traffic_Jam_Assistant_func_local.h"
#include "Traffic_Jam_Assistant_Export.h"
/* Exported data definition */
/* Definition for custom storage class: ExportToFile */
uint8_T Output_Display; /* '/Switch' */
/* 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)
{
/* local block i/o variables */
boolean_T Optimum_Voltage;
/* Logic: '/Logical Operator' incorporates:
* Constant: '/Constant'
* Constant: '/Constant1'
* Inport: '/Input_Voltage'
* RelationalOperator: '/Relational Operator'
* RelationalOperator: '/Relational Operator1'
*/
Optimum_Voltage = ((Input_Voltage >= VOLTAGE_MINIMUM_RANGE) && (Input_Voltage <=
VOLTAGE_MAXIMUM_RANGE));
/* Switch: '/Switch' incorporates:
* Constant: '/Constant4'
* Constant: '/Constant5'
* Inport: '/Input_Switch'
* Logic: '/Logical Operator'
* Logic: '/Logical Operator1'
* Logic: '/Logical Operator2'
* RelationalOperator: '/Relational Operator'
*/
if (Optimum_Voltage && (!Input_Switch) && (INTERRUPT_1 == INTERRUPT_2)) {
uint8_T tmp;
/* 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 0:
/* Switch: '/Switch' incorporates:
* Constant: '/Constant'
*/
Output_Display = ON_MODE;
break;
case 1:
/* Switch: '/Switch' incorporates:
* Constant: '/Constant'
*/
Output_Display = ON_MODE;
break;
case 2:
/* Switch: '/Switch' incorporates:
* Constant: '/Constant1'
*/
Output_Display = OFF_MODE;
break;
case 3:
/* Switch: '/Switch' incorporates:
* Constant: '/Constant1'
*/
Output_Display = OFF_MODE;
break;
default:
/* Switch: '/Switch' incorporates:
* Constant: '/Constant2'
*/
Output_Display = STANDBY_MODE;
break;
}
/* End of MultiPortSwitch: '/Multiport Switch' */
} else {
/* Switch: '/Switch' incorporates:
* Constant: '/Constant3'
*/
Output_Display = NO_DISPLAY;
}
/* End of Switch: '/Switch' */
}
/* Model initialize function */
void Traffic_Jam_Assistant_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Traffic_Jam_Assistant_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
* File: Traffic_Jam_Assistant_func_rom.c
*
* Code generated for Simulink model 'Traffic_Jam_Assistant'.
*
* Model version : 1.2
* Simulink Coder version : 9.7 (R2022a) 13-Nov-2021
* C/C++ source code generated on : Fri Jan 6 13:40:55 2023
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Traffic_Jam_Assistant_func_local.h"
#include "rtwtypes.h"
#include "Traffic_Jam_Assistant_types.h"
/* Exported data definition */
/* ConstVolatile memory section */
/* Definition for custom storage class: ConstVolatile */
const volatile boolean_T INTERRUPT_1 = true;/* Referenced by: '/Constant4' */
const volatile boolean_T INTERRUPT_2 = true;/* Referenced by: '/Constant5' */
const volatile uint8_T NO_DISPLAY = 0U;/* Referenced by: '/Constant3' */
const volatile uint8_T OFF_MODE = 2U; /* Referenced by: '/Constant1' */
const volatile uint8_T ON_MODE = 1U; /* Referenced by: '/Constant' */
const volatile uint8_T STANDBY_MODE = 3U;/* Referenced by: '/Constant2' */
const volatile uint8_T VOLTAGE_MAXIMUM_RANGE = 50U;/* Referenced by: '/Constant1' */
const volatile uint8_T VOLTAGE_MINIMUM_RANGE = 30U;/* Referenced by: '/Constant' */
/*
* File trailer for generated code.
*
* [EOF]
*/
Conclusion : Developed a model of single feature of Traffice Jam Assist as per MAAB Guidelines as well as created Simulink Data
Dictionary using MATLAB & Simulink.Generated a code using Embedde Coder and generated a Model Advisor Report.