Project 1- Traffic Jam Assistant Feature
To develop one specific requirement of Traffic Jam Assistant algorithm which would predominantly feature in the IPC algorithm using Model Based Development in MATLAB Environment
AIM:
To develop one specific requirement of Traffic Jam Assistant algorithm which would predominantly feature in the IPC algorithm with concepts of Model Based Development in MATLAB Environment and the following conditions should be satisfied
Condition:
- 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:
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 a 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.
REQUIREMENTS:
- 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
- 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”.
DEVELOPED MODEL:
The Main Model:
Under the Subsystem, TJA_Algorithm:
Under the Requirement 1 Subsystem:
Under the DisplayUnit Subsystem:
Simulink Data Dictionary:
REQUIREMENT TAGGING:

Performing MODEL ADVISOR check

The Target File is set to 'ert.tlc' Configuration Parameters
Once the Generate Code option is selected from Apps -> Embedded Coder, the AutoCode Generation begins
The Generated Code:
ert.tlc - Main File
1 /*
2 * File: ert_main.c
3 *
4 * Code generated for Simulink model 'TJA'.
5 *
6 * Model version : 1.9
7 * Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
8 * C/C++ source code generated on : Mon Dec 27 03:32:09 2021
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: Intel->x86-64 (Windows64)
12 * Code generation objectives: Unspecified
13 * Validation result: Not run
14 */
15
16 #include <stddef.h>
17 #include <stdio.h> /* This ert_main.c example uses printf/fflush */
18 #include "TJA.h" /* Model's header file */
19 #include "rtwtypes.h"
20
21 /*
22 * Associating rt_OneStep with a real-time clock or interrupt service routine
23 * is what makes the generated code "real-time". The function rt_OneStep is
24 * always associated with the base rate of the model. Subrates are managed
25 * by the base rate from inside the generated code. Enabling/disabling
26 * interrupts and floating point context switches are target specific. This
27 * example code indicates where these should take place relative to executing
28 * the generated code step function. Overrun behavior should be tailored to
29 * your application needs. This example simply sets an error status in the
30 * real-time model and returns from rt_OneStep.
31 */
32 void rt_OneStep(void);
33 void rt_OneStep(void)
34 {
35 static boolean_T OverrunFlag = false;
36
37 /* Disable interrupts here */
38
39 /* Check for overrun */
40 if (OverrunFlag) {
41 return;
42 }
43
44 OverrunFlag = true;
45
46 /* Save FPU context here (if necessary) */
47 /* Re-enable timer or interrupt here */
48 /* Set model inputs here */
49
50 /* Step the model */
51 TJA_step();
52
53 /* Get model outputs here */
54
55 /* Indicate task complete */
56 OverrunFlag = false;
57
58 /* Disable interrupts here */
59 /* Restore FPU context here (if necessary) */
60 /* Enable interrupts here */
61 }
62
63 /*
64 * The example "main" function illustrates what is required by your
65 * application code to initialize, execute, and terminate the generated code.
66 * Attaching rt_OneStep to a real-time clock is target specific. This example
67 * illustrates how you do this relative to initializing the model.
68 */
69 int_T main(int_T argc, const char *argv[])
70 {
71 /* Unused arguments */
72 (void)(argc);
73 (void)(argv);
74
75 /* Initialize model */
76 TJA_initialize();
77
78 /* Attach rt_OneStep to a timer or interrupt service routine with
79 * period 0.2 seconds (the model's base sample time) here. The
80 * call syntax for rt_OneStep is
81 *
82 * rt_OneStep();
83 */
84 printf("Warning: The simulation will run forever. "
85 "Generated ERT main won't simulate model step behavior. "
86 "To change this behavior select the 'MAT-file logging' option.\n");
87 fflush((NULL));
88 while (1) {
89 /* Perform other application tasks here */
90 }
91
92 /* The option 'Remove error status field in real-time model data structure'
93 * is selected, therefore the following code does not need to execute.
94 */
95 #if 0
96
97 /* Disable rt_OneStep() here */
98 #endif
99
100 return 0;
101 }
102
103 /*
104 * File trailer for generated code.
105 *
106 * [EOF]
107 */
108



CONCLUSION:
- The model for Traffic Jam Assistant is developed using MATLAB Simulink as per MBD guidelines.
- Simulink Data Dictionary is created for the model and is linked to the model.
- Requirement document is tagged with each subsystem.
- Model Advisor Report is performed, and the the Report is Generated
- And finally, Code generation is executed using Embedded Coder