Challenge

Project 1- Traffic Jam Assistant Feature

Traffic Jam Assistant Feature

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.

Input Signals::

Name of the Signal Data Type Range

Input_Voltage uint8 0 - 255
Input_Switch boolean 0 – 1 Enable_Display uint8 0 - 255

Output Signal::


Name of the Signal Data Type Range

Output_Display uint8 0 - 255

Calibration Signals::

Name of the Signal Data Type Range InitialValue

VOLTAGE_MINIMUM_RANGE uint8 0 – 255 30
VOLTAGE_MAXIMUM_RANGE uint8 0 – 255 50
OFF_MODE uint8 0 – 255 20

N_MODE uint8 0 – 255 1
STANDBY_MODE uint8 0 – 255 3
INTERRUPT_1 boolean 0 – 1 1
INTERRUPT_2 boolean 0 - 1 1
NO_DISPLAY uint8 0 – 255 0

Local Signal::


Name of the Signal Data Type Range

Optimum_Voltage boolean 0 - 1

Main_Model== Traffic_Jam_Assistant

Requirment1 & Requirment2 Subsystem:

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.

SLDD::

  • A Simulink data disctionary contain input, output, calibration values in form signals, parameters, etc..
    to create SLDD first we need to go to "modeling" tab then click on "Link to data dictionary"
  • then click on new and make a new file
  • then after clicking on model explorer click on design data
  • where we can add signals, calibration value by adding and changing the data type.

Coverage_Report::

app > Coverage analyzer

Model

Model Advisor check:

  • Before doing this we need to go in to solver configuration from model settings
  • then solver selection type given to fixed step and solver need to be discrete and fixed step size is given as 0.01
  • in code generation system target file is given as ert.tlc
  • then we can perform model advisor check but first for checking purpose of model we can refresh the model by
    clicking on ctrl+D
  • if we dont recieve any error or anything serious then we can do model advisor check
  • A model advisor check is performed to check that there are no errors in model
  • here we are checking our model as per MAB guidelines (Mathworks Advisory Board)
  • so, we can see that model advisor check is successfully completed without any error
  • and i also tried to reduce the no. of warning so now we have only 11 warnings.

Code Generation::

  • here i clicked on Apps then C code
  • then go to build option
  • and click on generate code

1	/*
2	 * File: ert_main.c
3	 *
4	 * Code generated for Simulink model 'Traffic_Jam_Assistant'.
5	 *
6	 * Model version                  : 1.8
7	 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
8	 * C/C++ source code generated on : Tue Oct 25 09:36:42 2022
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 
17	#include               /* This ert_main.c example uses printf/fflush */
18	#include "Traffic_Jam_Assistant.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	    rtmSetErrorStatus(Traffic_Jam_Assistant_M, "Overrun");
42	    return;
43	  }
44	
45	  OverrunFlag = true;
46	
47	  /* Save FPU context here (if necessary) */
48	  /* Re-enable timer or interrupt here */
49	  /* Set model inputs here */
50	
51	  /* Step the model */
52	  Traffic_Jam_Assistant_step();
53	
54	  /* Get model outputs here */
55	
56	  /* Indicate task complete */
57	  OverrunFlag = false;
58	
59	  /* Disable interrupts here */
60	  /* Restore FPU context here (if necessary) */
61	  /* Enable interrupts here */
62	}
63	
64	/*
65	 * The example "main" function illustrates what is required by your
66	 * application code to initialize, execute, and terminate the generated code.
67	 * Attaching rt_OneStep to a real-time clock is target specific.  This example
68	 * illustrates how you do this relative to initializing the model.
69	 */
70	int_T main(int_T argc, const char *argv[])
71	{
72	  /* Unused arguments */
73	  (void)(argc);
74	  (void)(argv);
75	
76	  /* Initialize model */
77	  Traffic_Jam_Assistant_initialize();
78	
79	  /* Attach rt_OneStep to a timer or interrupt service routine with
80	   * period 0.2 seconds (the model's base sample time) here.  The
81	   * call syntax for rt_OneStep is
82	   *
83	   *  rt_OneStep();
84	   */
85	  printf("Warning: The simulation will run forever. "
86	         "Generated ERT main won't simulate model step behavior. "
87	         "To change this behavior select the 'MAT-file logging' option.\n");
88	  fflush((NULL));
89	  while (rtmGetErrorStatus(Traffic_Jam_Assistant_M) == (NULL)) {
90	    /*  Perform other application tasks here */
91	  }
92	
93	  /* Disable rt_OneStep() here */
94	
95	  /* Terminate model */
96	  Traffic_Jam_Assistant_terminate();
97	  return 0;
98	}
99	
100	/*
101	 * File trailer for generated code.
102	 *
103	 * [EOF]
104	 *
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.