Challenge

Project 1- Traffic Jam Assistant Feature

Traffic Jam Assistant Feature

AIM: To develop a Simulink model that provides information regarding the Traffic Jam Assistant which will be available to be displayed to the driver in the Instrument Panel Cluster (IPC).

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.

A model is developed in Matlab and Simulink as shown below.

The model consists of a subsystem having the inputs like, Input_voltage, Input_Switch and Enable_Display. And throws the output as Output_Display.

The inside part of the subsystem is shown below,

This consists of the two requirements specified,

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”.
  • Output signal from here is “Optimum_Voltage” which will be one of the inputs to the subsystem “DisplayUnit”.

We can see in the above image the requirement 1 is modelled as per our requirement. The input voltage is compared with the minimum and maximum voltages if both the condition is true then the output optimum_voltage is true.

Further this output goes to the Display_Unit along with the two other inputs.

The Requirement 2 or 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”.

The below image shows the DisplayUnit modelled as per the above requirement.

The input Enable_Display is saturated between 0 and 7 and fed as an input to a multiport switch block. As per the requirement the ON_MODE is conned to the 1st and 2nd port and the OFF_MODE is connected to 3rd and 4th ports and finally the STANDBY_MODE is connected to the 5th port. This output is fed to a switch block, which gets execute if the condition, not Input_Switch and optimum_voltage and if interrupt_1 and interrupt_2 are equal. Otherwise the output will be NO_DISPLAY.

All the input and the output signals along with calibration constants are loaded into a SLDD file named TJD_dd.

The input output signals are loaded as Simulink signals and storage class for the inputs as imported extern and outputs as export to file and the local signals as localizable. The constants are loaded as Simulink parameters with storage class as const volatile having the header file as TJA_model_RAM.h and definiction file as TJA_model_RAM.c.

Once the signals are loaded the input signals are resolved and propagated.

Similarly the output signals are resolved at its origin.

The model settings are change as per our requirements as shown below,

And for code generation settings,

After setting the requirements, the model Advisor check is carried out as per MAAB.

Out of 144 checks 123 passed with no errors and 21 warnings,

Further these warnings are reduced as per the guidelines,

The report is generated for the same,

Once the advisor report is done now we will do the requirement tagging for the subsystems,

Selecting the requirement section in word,

By following the steps as shown below the tagging is done,

Similarly the tagging is done to the 2nd subsystem as well.

The code generation is done for the same model as we have changed the code generation settings to embedded coder, we will now go to the embedded coder option in the apps section.

Then clicking on build the code generation process takes place.

The code for the model is built as can be seen through view code option,

The code generated is attached below,

/*
 * File: TJA_model.c
 *
 * Code generated for Simulink model 'TJA_model'.
 *
 * Model version                  : 1.13
 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
 * C/C++ source code generated on : Thu Jul 13 12:34:40 2023
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Intel->x86-64 (Windows64)
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "TJA_model.h"
#include "TJA_model_private.h"

/* Exported data definition */

/* Definition for custom storage class: ExportToFile */
uint8_T Output_Display;                /* '/Switch' */

/* Real-time model */
static RT_MODEL_TJA_model_T TJA_model_M_;
RT_MODEL_TJA_model_T *const TJA_model_M = &TJA_model_M_;

/* Model step function */
void TJA_model_step(void)
{
  /* local block i/o variables */
  boolean_T Optimum_Voltage;
  uint8_T tmp;

  /* Logic: '/Logical Operator' incorporates:
   *  Constant: '/Constant'
   *  Constant: '/Constant1'
   *  Inport: '/Input_Voltage'
   *  RelationalOperator: '/GreaterThanOrEqual'
   *  RelationalOperator: '/GreaterThanOrEqual1'
   */
  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: '/NOT'
   *  RelationalOperator: '/Relational Operator'
   */
  if ((!Input_Switch) && Optimum_Voltage && (INTERRUPT_1 == INTERRUPT_2)) {
    /* 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 TJA_model_initialize(void)
{
  /* (no initialization code required) */
}

/* Model terminate function */
void TJA_model_terminate(void)
{
  /* (no terminate code required) */
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */

The support files along with the model, MAAB report, and SLDD file are attached in the attachments in a zip folder.

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.