Challenge

Project 1- Traffic Jam Assistant Feature

Project-1: Traffic Jam Assistant Feature

Aim:

Model Development of a feature of Traffic Jam Assistant Feature using MATLAB and simulink as per MAAB Guidelines.

Objective:

  • This model must be developed in MATLAB Simulink per MBD Guidelines.
  • Create Simulink Data Dictionary & Linked to the model.
  • Code Generation Using AUTOSAR Coder.
  • Generating Model Advisor Report.

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.

Problem Statement:

To develop one specific requirement of Traffic Jam Assistant algorithm which would predominantly feature in the IPC algorithm.Please note that the whole Traffic Jam Assistant is a very huge algorithm & only one small part of the logic is implemented here. Idea is to familiarize with concepts of Model Based Development in MATLAB Environment. The Project must be done keeping in mind the following processes & steps.

  • 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.

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

Initial Value

VOLTAGE_MINIMUM_RANGE

uint8

0 – 255

30

VOLTAGE_MAXIMUM_RANGE

uint8

0 – 255

50

OFF_MODE

uint8

0 – 255

2

ON_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

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”.

Procedure:

The First thing that we will do is create a Simulink Data Dictionary using the given Signal and Calibration Data List.

The Following Is the SLDD file.

As per Requirement-1:

Input_Voltage is compare with VOLTAGE_MINIMUM_RANGE

Input_Voltage is compare with VOLTAGE_MAXIMUM_RANGE

Then their output are given as an input in the AND block, The output of which is Optimum_Voltage

As per Requirment-2:

The Input such as Optimum_Voltage, Input_Switch, Enable_Swich, INTERRUPT_1, INTERRUPT_2.

The Enable_Switch is taken as input in Multiport Switch Depending on the Output from the Saturation block.

We provide the ON_MODE, OFF_MODE, STANDBY_MODE to this switch.

The output of this is one input to the switch block. The conditional input to switch blocks the result of Optimum_Voltage, Input_Switch, INTERRUPT_1, & INTERRUPT_2 operation.

Another input to the Switch block is the NO_DISPLAY. The Output fromSwitch block is the Output_Display.

The following is the model of the featureof Traffic Jam Assistance:

Model configuration:

We will set the system target file as autosar.tlc

and make sure that in Solver we will set the solver to Fixed-Step.

Model Advisor:

The following is the Model Advisor Report:

There are warning that are acceptable but the notable part is that there is not a single failed result.

Code Generation:

The following is the Code Generating Report:

/*
 * File: Traffic_Jam_Model.c
 *
 * Code generated for Simulink model 'Traffic_Jam_Model'.
 *
 * Model version                  : 1.3
 * Simulink Coder version         : 9.6 (R2021b) 14-May-2021
 * C/C++ source code generated on : Sat Jan 21 16:29:02 2023
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Intel->x86-64 (Windows64)
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "Traffic_Jam_Model.h"
#include "Traffic_Jam_Model_private.h"

/* External inputs (root inport signals with default storage) */
ExtU_Traffic_Jam_Model_T Traffic_Jam_Model_U;

/* External outputs (root outports fed by signals with default storage) */
ExtY_Traffic_Jam_Model_T Traffic_Jam_Model_Y;

/* Real-time model */
static RT_MODEL_Traffic_Jam_Model_T Traffic_Jam_Model_M_;
RT_MODEL_Traffic_Jam_Model_T *const Traffic_Jam_Model_M = &Traffic_Jam_Model_M_;

/* Model step function */
void Traffic_Jam_Model_step(void)
{
  /* Switch: '<S3>/Switch' incorporates:
   *  Constant: '<S2>/VOLTAGE_MAXIMUM_RANGE'
   *  Constant: '<S2>/VOLTAGE_MINIMUM_RANGE'
   *  Inport: '<Root>/Input_Switch'
   *  Inport: '<Root>/Input_Voltage'
   *  Logic: '<S2>/AND'
   *  Logic: '<S3>/AND'
   *  Logic: '<S3>/AND1'
   *  Logic: '<S3>/NOT'
   *  RelationalOperator: '<S2>/Relational Operator'
   *  RelationalOperator: '<S2>/Relational Operator1'
   */
  if ((Traffic_Jam_Model_U.Input_Voltage >= 30) &&
      (Traffic_Jam_Model_U.Input_Voltage <= 50) &&
      (!Traffic_Jam_Model_U.Input_Switch) &&
      Traffic_Jam_Model_ConstB.RelationalOperator) {
    uint8_T tmp;

    /* Saturate: '<S3>/Saturation' incorporates:
     *  Inport: '<Root>/Enable_Display'
     */
    if (Traffic_Jam_Model_U.Enable_Display <= 1) {
      tmp = Traffic_Jam_Model_U.Enable_Display;
    } else {
      tmp = 1U;
    }

    /* End of Saturate: '<S3>/Saturation' */

    /* MultiPortSwitch: '<S3>/Multiport Switch' */
    if (tmp == 1) {
      /* Outport: '<Root>/Output_Display' incorporates:
       *  Constant: '<S3>/ON_MODE'
       */
      Traffic_Jam_Model_Y.Output_Display = 1U;
    } else {
      /* Outport: '<Root>/Output_Display' incorporates:
       *  Constant: '<S3>/STANDBY_MODE'
       */
      Traffic_Jam_Model_Y.Output_Display = 3U;
    }

    /* End of MultiPortSwitch: '<S3>/Multiport Switch' */
  } else {
    /* Outport: '<Root>/Output_Display' incorporates:
     *  Constant: '<S3>/NO_DISPLAY'
     */
    Traffic_Jam_Model_Y.Output_Display = 0U;
  }

  /* End of Switch: '<S3>/Switch' */
}

/* Model initialize function */
void Traffic_Jam_Model_initialize(void)
{
  /* (no initialization code required) */
}

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

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
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.