Challenge

Project 1- Traffic Jam Assistant Feature

Aim: To develop MATLAB simulink model for the Traffic Jam Assistant Feature which woud predominently feature in the Instrument Panel Cluster (IPC).

Objective of the Project:

  • Prepare the simulink data directory for the Data provided.
  • Prepare the simulink model for as per the requirement provided.
  • 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.
  • To create the 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 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”.

________________________________________________________________________________________________

---- For the starting building the model the following settings should be there in the modelconfiguration of the MATLAB Simulink.

- The solver type is fixed and the solver is discrete no continous state and sample time is taken aas 0.01 second.

- The code generation settings are as follows.

- System target file is selected as ert.tlc , as in coming steps the embeded coder will used.

- The following model is created according to requirement 1 and the requirement 2 that is Display_Unit

Requirement_1:

Above is the portion of the subsytem which is made according to the given requirement 1.

The voltage limits are compared with the Input voltage and the boolian true output is generated if voltage is within the limit.

Requirement_2 (Display_Uinit):

The above imge represent the display unit subsytem.

It is made according to the requrement given in the question.

The connection are made according to the requirements associated with the multiport switch and the switch block. The output from this subsystem is Output_Display.

Simulink Data Dictionary (SLDD):

- The following SLDD is made for the given model.

- All the data type and their values are taken from the question itself.

The respective storage class is provided to the signals:

-Here the storage class is not mentioned in the question.

- 3 inputs The Input_switch ,Enable_Switch and Input_Voltage has storage class as Auto to avoid the error during the building the model.

The storage class is succesfully assigned to all the output signals as shon in the above image.

#Requirement Tagging:

The requiremnt tagging is used for the get back to the requirements of the customer and helps to quickly review it.

---FIrst select the respective selection for the reuirement.

Then go to MATLAB and right click to respective subsyetem and select requirement option.

Then select the selection from the word option and that will lead to requirement tagging in the word.

To Develop MATLAB Simulink Model as per MBD guidelines:

- To develop the model as per the MBD guidlines the model should be the passed from the Model Advisor check.

- In Model advisor check select the MAB guildlines check to make MBD compient model.

- Run the selcted check.

\

- It should have no failed check. warnings are acceptble for some extend, but it should not have failed check in it.

Code Generation in Embedded Coder:

Selecting the outer most subsystem as atomic unit with sample time of 0.01 sec.

- For generating code go to embeded coder and then go to the build option for the genration of the code from it.

- The process of the building the code will start.

As shown in the above image the code is generated succesfully as shown in the above image.

/*
 * File: Poject1_Autosar.c
 *
 * Code generated for Simulink model 'Poject1_Autosar'.
 *
 * Model version                  : 1.31
 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
 * C/C++ source code generated on : Thu Dec 23 11:48:03 2021
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Intel->x86-64 (Windows64)
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "Poject1_Autosar.h"
#include "Poject1_Autosar_private.h"

/* External inputs (root inport signals with default storage) */
ExtU_Poject1_Autosar_T Poject1_Autosar_U;

/* Real-time model */
static RT_MODEL_Poject1_Autosar_T Poject1_Autosar_M_;
RT_MODEL_Poject1_Autosar_T *const Poject1_Autosar_M = &Poject1_Autosar_M_;

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

  /* Outputs for Atomic SubSystem: '/Traffic Jam Assistance' */
  /* Logic: '/Logical Operator' incorporates:
   *  Constant: '/Constant'
   *  Constant: '/Constant1'
   *  Inport: '/Input_Voltage'
   *  RelationalOperator: '/Relational Operator'
   *  RelationalOperator: '/Relational Operator1'
   */
  Optimum_Voltage = ((Poject1_Autosar_U.Input_Voltage >= VOLTAGE_MINIMUM_RANGE) &&
                     (Poject1_Autosar_U.Input_Voltage <= VOLTAGE_MAXIMUM_RANGE));

  /* Switch: '/Switch' incorporates:
   *  Constant: '/INTERRUPT_1'
   *  Constant: '/INTERRUPT_2'
   *  Inport: '/Input_Switch'
   *  Logic: '/Logical Operator'
   *  Logic: '/Logical Operator1'
   *  Logic: '/Logical Operator2'
   *  RelationalOperator: '/Relational Operator'
   */
  if ((!Poject1_Autosar_U.Input_Switch) && Optimum_Voltage && (INTERRUPT_1 ==
       INTERRUPT_2)) {
    /* Saturate: '/Saturation' incorporates:
     *  Inport: '/Enable_Display'
     */
    if (Poject1_Autosar_U.Enable_Display < 7) {
      tmp = Poject1_Autosar_U.Enable_Display;
    } else {
      tmp = 7U;
    }

    /* End of Saturate: '/Saturation' */

    /* MultiPortSwitch: '/Multiport Switch' */
    switch (tmp) {
     case 1:
      /* Switch: '/Switch' incorporates:
       *  Constant: '/ON_MODE'
       */
      Output_Display = ON_MODE;
      break;

     case 2:
      /* Switch: '/Switch' incorporates:
       *  Constant: '/ON_MODE'
       */
      Output_Display = ON_MODE;
      break;

In the above code the following is Requirement 1 generated.

Following image represents the Requirement 2.

Conclusion:

The Model is prepared as per the requirements and the Model Advisor Check for Making the MBD compient model.

The code is successfully generated by the using Embeded Coder. The requiremet tagging also done and file is also attched for that.

Files attached:

-Requ_Proj1_Autosar.docx--> Requiremnt file

-Poject1_Autosar.slmx --> MATLAB tracibility File

Model Advisor Report for 'Poject1_Autosar'.pdf ---> Model Advisor Check Report

Poject1_Autosar_ert_rtw.zip --> Embeded coder, code file in .zip formate

Poject1_Autosar.slx ---> Main Simulink Model File

Proj1_SLDD.sldd --> Simulink Data Dictionary File

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.

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.